Mainline U-Boot Inconsistencies

Moderators: mdrjr, odroid

Mainline U-Boot Inconsistencies

Unread postby vindicator » Tue Dec 15, 2015 4:04 pm

I thought I'd take another stab at mainline and there have been some changes, but seems the odroid part is being neglected.

I really like HK's boot.ini method since you don't have to "make" any .scr file. It's basically a text script for u-boot, but mainline doesn't use it. It's also great that you can edit the text file on a live system and not have to worry about changing env values in u-boot itself (having to go through uart).
Mainline seems to be doing something along the lines of syslinux (sysboot) and looks for "extlinux.conf" first. U-boot maintains compatibility with the old .scr, but it sounds like it would like to move away from it:
this document recommends that distros generate extlinux.conf rather than boot.scr
*README.distro

Also while README.odroid was updated a year ago to include xu3 changes, it doesn't say anything about extlinux.conf, and when it does mention boot options like "boot_zimg", that doesn't seem to be an option for xu3/4.

Instead boot goes something like this:
bootcmd->distro_bootcmd->bootcmd_mmc0->mmc_boot->scan_dev_for_boot_part->scan_dev_for_boot->
1) scan_dev_for_extlinux->boot_extlinux->sysboot mmc 0:1 any 0x50000000 /extlinux/extlinux.conf
or
2) scan_dev_for_scripts->boot_a_script->load mmc 0:1 0x50000000 /boot.scr;source 0x50000000

I tried "/extlinux/extlinux.conf" with:
Code: Select all
DEFAULT linux
LABEL linux
KERNEL ../zImagexu444R4
FDTFILE ../exynos5422-odroidxu444R4.dtb
APPEND console=tty1 console=ttySAC2,115200n8 root=UUID=e139ce78-9841-40fe-8823-96a304a09859 rootwait ro fsck.repair=yes

And while it appeared to take the kernel, it complained about FDTFILE and surprisingly even APPEND:
Code: Select all
Scanning mmc 0:1...                                                                                                                               
Found /extlinux/extlinux.conf                                                                                                                     
Retrieving file: /extlinux/extlinux.conf                                                                                                           
reading /extlinux/extlinux.conf                                                                                                                   
211 bytes read in 4 ms (50.8 KiB/s)                                                                                                               
Ignoring unknown command: FDTFILE                                                                                                                 
Ignoring unknown command: APPEND                                                                                                                   
1:      linux                                                                                                                                     
Retrieving file: /extlinux/../zImagexu444R4                                                                                                       
reading /extlinux/../zImagexu444R4                                                                                                                 
2869328 bytes read in 218 ms (12.6 MiB/s)                                                                                                         
Kernel image @ 0x42000000 [ 0x000000 - 0x2bc850 ]                                                                                                 
                                                                                                                                                   
Starting kernel ...


Has anyone toyed with sysboot to know if I did something wrong?
Should I shoot an email to Hyungwon Hwang and/or Przemyslaw Marczak linking to this thread (regarding the readme.odroid)?
http://git.denx.de/?p=u-boot.git;a=comm ... fb15335d48
vindicator
 
Posts: 137
Joined: Wed Feb 27, 2013 4:00 pm
languages_spoken: english
ODROIDs: U2, XU4

Re: Mainline U-Boot Inconsistencies

Unread postby umiddelb » Wed Dec 16, 2015 6:43 am

vindicator wrote:[...]It's also great that you can edit the text file on a live system and not have to worry about changing env values in u-boot itself (having to go through uart).

You can edit the u-boot environment outside of u-boot with fw_setenv/fw_printenv, see here for details.

vindicator wrote:Mainline seems to be doing something along the lines of syslinux (sysboot) and looks for "extlinux.conf" first. U-boot maintains compatibility with the old .scr [...]

The extlinux.conf thing seems to be similar to the uEnv.txt method for manipulating the u-boot environment at boot time (which isn't used for ODROID boards).
I'm about to refactor the different ways of how u-boot is beeing used on various ARM boards and integrate some enhancements, e.g. display a simple boot menue or try a test kernel and to fall back to a default kernel automatically for the next boot (if the test kernel crashes)
umiddelb
 
Posts: 440
Joined: Thu Jan 29, 2015 6:42 am
languages_spoken: English, German
ODROIDs: ODROID-C1, ODROID-XU4, ODROID-C2

Re: Mainline U-Boot Inconsistencies

Unread postby vindicator » Wed Dec 16, 2015 6:57 am

After taking a very quick glance at the doc you linked to, I question the addressing portion of it.
99E00 seems to be a very small offset and looks like it would overwrite the u-boot bin.
According to README.odroid (and the offset I used with dd), the environment starts at block 2560 = 0x140000.

I guess Prz is then expecting that .scr will still be used which is bothersome compared to the nice boot.ini and even extlinux.conf that could (should) be the way to go.
Although I still think that the syslinux/sysboot CAN be used with odroid since it actually did call and run sysboot which read the conf and started up (or at least tried to) the kernel.
vindicator
 
Posts: 137
Joined: Wed Feb 27, 2013 4:00 pm
languages_spoken: english
ODROIDs: U2, XU4

Re: Mainline U-Boot Inconsistencies

Unread postby umiddelb » Wed Dec 16, 2015 7:19 am

vindicator wrote:After taking a very quick glance at the doc you linked to, I question the addressing portion of it.
99E00 seems to be a very small offset and looks like it would overwrite the u-boot bin.

I've taken the offsets from the official documentation. These offsets may vary between different u-boot forks (e.g. ODROID vs. mainline).
fw_printenv will complain if the CRC checksum is invalid ...

vindicator wrote:According to README.odroid (and the offset I used with dd), the environment starts at block 2560 = 0x140000.

This explains why the first partition starts at sector 3072 although the sectors 1263-3071 are unused at the moment.
umiddelb
 
Posts: 440
Joined: Thu Jan 29, 2015 6:42 am
languages_spoken: English, German
ODROIDs: ODROID-C1, ODROID-XU4, ODROID-C2

Re: Mainline U-Boot Inconsistencies

Unread postby tc424 » Sun Mar 25, 2018 6:43 am

vindicator wrote:Has anyone toyed with sysboot to know if I did something wrong?
Should I shoot an email to Hyungwon Hwang and/or Przemyslaw Marczak linking to this thread (regarding the readme.odroid)?
http://git.denx.de/?p=u-boot.git;a=comm ... fb15335d48

I know I'm digging up an ancient thread here, but I've got syslinux/pxelinux style booting working here on an ODROID-HC1. The end of my boot.ini is changed to:

Code: Select all
[...]
# Boot the board
#bootz 0x40008000 0x42000000 0x44000000
setenv bootfile default-arm-exynos
sysboot mmc 0:1 fat

And default-arm-exynos has:

Code: Select all
MENU TITLE ODroid Boot Menu
LABEL Boot from cloned fs3 image (MMC / LVM)
kernel odroidxu4/zImage.fanotify
fdt odroidxu4/exynos5422-odroidxu4.dtb
append console=tty1 console=ttySAC2,115200n8 net.ifnames=0 root=UUID=6ff146cd-8b3c-4edc-b7d5-fc24e5ad731a rootwait ro
initrd odroidxu4/uInitrd-4.14.5-92

LABEL Boot from SSD
MENU DEFAULT
kernel odroidxu4/zImage.fanotify
fdt odroidxu4/exynos5422-odroidxu4.dtb
append console=tty1 console=ttySAC2,115200n8 net.ifnames=0 root=UUID=6ff146cd-8b3c-4edc-b7d5-fc24e5ad731b rootwait ro
initrd odroidxu4/uInitrd-4.14.5+

PROMPT 1
TIMEOUT 50

It's all working quite happily, and is useful for trying out new kernels while still being able to easily fall back to older, known good ones.

S.
tc424
 
Posts: 20
Joined: Sat Mar 03, 2018 10:26 pm
languages_spoken: english
ODROIDs: HC-1

Re: Mainline U-Boot Inconsistencies

Unread postby rooted » Sun Mar 25, 2018 12:46 pm

tc424 wrote:
vindicator wrote:Has anyone toyed with sysboot to know if I did something wrong?
Should I shoot an email to Hyungwon Hwang and/or Przemyslaw Marczak linking to this thread (regarding the readme.odroid)?
http://git.denx.de/?p=u-boot.git;a=comm ... fb15335d48

I know I'm digging up an ancient thread here, but I've got syslinux/pxelinux style booting working here on an ODROID-HC1. The end of my boot.ini is changed to:

Code: Select all
[...]
# Boot the board
#bootz 0x40008000 0x42000000 0x44000000
setenv bootfile default-arm-exynos
sysboot mmc 0:1 fat

And default-arm-exynos has:

Code: Select all
MENU TITLE ODroid Boot Menu
LABEL Boot from cloned fs3 image (MMC / LVM)
kernel odroidxu4/zImage.fanotify
fdt odroidxu4/exynos5422-odroidxu4.dtb
append console=tty1 console=ttySAC2,115200n8 net.ifnames=0 root=UUID=6ff146cd-8b3c-4edc-b7d5-fc24e5ad731a rootwait ro
initrd odroidxu4/uInitrd-4.14.5-92

LABEL Boot from SSD
MENU DEFAULT
kernel odroidxu4/zImage.fanotify
fdt odroidxu4/exynos5422-odroidxu4.dtb
append console=tty1 console=ttySAC2,115200n8 net.ifnames=0 root=UUID=6ff146cd-8b3c-4edc-b7d5-fc24e5ad731b rootwait ro
initrd odroidxu4/uInitrd-4.14.5+

PROMPT 1
TIMEOUT 50

It's all working quite happily, and is useful for trying out new kernels while still being able to easily fall back to older, known good ones.

S.


That is useful information.
User avatar
rooted
 
Posts: 5458
Joined: Fri Dec 19, 2014 9:12 am
Location: Gulf of Mexico, US
languages_spoken: english
ODROIDs: C1, C1+, C2
XU3 Lite, XU4
N1
VU7+
HiFi Shield 2
Smart Power (original)

Re: Mainline U-Boot Inconsistencies

Unread postby tc424 » Sun Mar 25, 2018 5:43 pm

One thing I would say is that the u-boot code seems a bit buggy - I across a few instances were things that seemed like they should work, or were actually documented as working, didn't, due to things like variables not getting set at the right time, or being overwritten, etc.

Long-term, has anyone investigated barebox as a bootloader? Looks like it can be chained from u-boot, but might be nice to see how much work would be involved in using it as a replacement :)
tc424
 
Posts: 20
Joined: Sat Mar 03, 2018 10:26 pm
languages_spoken: english
ODROIDs: HC-1

Re: Mainline U-Boot Inconsistencies

Unread postby OverSun » Sun Mar 25, 2018 7:21 pm

User avatar
OverSun
 
Posts: 1373
Joined: Mon Apr 29, 2013 5:12 pm
languages_spoken: english

Re: Mainline U-Boot Inconsistencies

Unread postby tc424 » Wed Aug 29, 2018 2:05 am

This is sort of relevant to this - I've found that it's possible to run a u-boot script through mkimage mkimage -A arm -T script -d input_script output_image, which can then be run from the u-boot prompt with only two commands:

Code: Select all
fatload mmc 0:1 ${loadaddr} script
source ${loadaddr}

Which makes switching between configs slightly less painful... (remember to remove the ODROIDXU-UBOOT-CONFIG first line if using a boot.ini)

I had forgotten about the GRUB idea .. will add it to the list of things to investigate :)

S.
tc424
 
Posts: 20
Joined: Sat Mar 03, 2018 10:26 pm
languages_spoken: english
ODROIDs: HC-1


Return to General Chat

Who is online

Users browsing this forum: No registered users and 2 guests