From mboxrd@z Thu Jan 1 00:00:00 1970 From: Alexander Dahl Date: Fri, 19 Oct 2018 10:17:27 +0200 Subject: [U-Boot] U-Boot and The Boot Loader Specification In-Reply-To: <20181019065315.738CB240044@gemini.denx.de> References: <2092760.TlMJupW03t@ada> <20181019065315.738CB240044@gemini.denx.de> Message-ID: <18120382.ptJS9iqsuP@ada> List-Id: MIME-Version: 1.0 Content-Type: text/plain; charset="windows-1252" Content-Transfer-Encoding: quoted-printable To: u-boot@lists.denx.de Hello, Am Freitag, 19. Oktober 2018, 08:53:15 CEST schrieb Wolfgang Denk: > In message <2092760.TlMJupW03t@ada> you wrote: > > I played with the extlinux.conf format snippets from the U-Boot docs. > > Upstream extlinux docs are not really helpful, especially not for optio= ns > > regarding dtb>=20 > > files. And I tried a config based on the Boot Loader Spec: > > Scanning mmc 2:1... > > Found /boot/extlinux/extlinux.conf > > Retrieving file: /boot/extlinux/extlinux.conf > > 366 bytes read in 268 ms (1000 Bytes/s) > > Ignoring unknown command: title > > Ignoring unknown command: version > > Ignoring unknown command: options > > Ignoring unknown command: linux > > Ignoring unknown command: devicetree > >=20 > > Am I right, U-Boot does not support that spec at all? Files are in > > different positions, and the keywords are all different? If so, then the > > U-Boot documentation is misleading (and people will be frustrated to > > follow the hints given in there). >=20 > It would definitely help if you tell us which actual command > (sequence) you used to get this output, and what the exact content > of this extlinux.conf was. Okay first the content of /boot/extlinux/extlinux.conf from the root=20 filesystem, which does not work (of course without additional linebreaks fr= om=20 my mail client): title PTXdist version 4.9.133 options mtdparts=3Dgpmi-nand:8M(fcb),7M(reserved)ro,512k(env= 1), 512k(env2),-(fs) ubi.mtd=3Dfs console=3Dttymxc0,115200 rootwait rw root=3D/= dev/ mmcblk0p1 linux /boot/zImage devicetree /boot/imx6dl-ttcore.dtb As you might guess, I use ptxdist for building the BSP for an i.MX6 based=20 platform. Currently everything is on a SD-Card and the system can boot from= =20 that card, if I load kernel image and dtb manually in U-Boot (or use anothe= r=20 extlinux.conf). > Without such information, we cannot even guess what you did. I was basically following the instructions from doc/README.distro so I read= =20 http://www.freedesktop.org/wiki/Specifications/BootLoaderSpec/ as mentioned= in=20 section "Boot Configuration Files" and set CONFIG_DISTRO_DEFAULTS=3Dy and a= dded=20 the following to the board configuration header file in include/configs/ /* PHYS_ADDR is 0x10000000 for i.MX6S, * Kernel doc recommends to put dtb at 128 MiB, zImage above 32 MiB, * but below 128 MiB. So we put them there and scriptaddr after dtb. * We don't strictly need ramdisk_addr_r, but just set it to some * reasonable value according to doc/README.distro =E2=80=A6 * This should not collide with U-Boot which places itself at the * lowest 8k and something around 8 MB at the top of the memory, the * board currently has 512 MiB. */ #define MEM_LAYOUT_ENV_SETTINGS \ "kernel_addr_r=3D0x12000000\0" \ "fdt_addr_r=3D0x18000000\0" \ "scriptaddr=3D0x18100000\0" \ "pxefile_addr_r=3D0x18200000\0" \ "ramdisk_addr_r=3D0x18300000\0" #define BOOT_TARGET_DEVICES(func) \ func(MMC, mmc, 0) \ func(MMC, mmc, 1) \ func(MMC, mmc, 2) \ func(UBIFS, ubifs, 0) \ func(USB, usb, 0) #ifndef CONFIG_SPL_BUILD #include #include #endif So in U-Boot env the following is set (this is populated by U-Boot itself b= y=20 default, I removed non interesting lines and added some linebreaks): boot_a_script=3Dload ${devtype} ${devnum}:${distro_bootpart} ${scriptaddr} $ {prefix}${script}; source ${scriptaddr} boot_extlinux=3Dsysboot ${devtype} ${devnum}:${distro_bootpart} any $ {scriptaddr} ${prefix}extlinux/extlinux.conf boot_net_usb_start=3Dusb start boot_prefixes=3D/ /boot/ boot_script_dhcp=3Dboot.scr.uimg boot_scripts=3Dboot.scr.uimg boot.scr boot_targets=3Dmmc0 mmc1 mmc2 ubifs0 usb0=20 bootcmd=3Drun distro_bootcmd bootcmd_mmc0=3Dsetenv devnum 0; run mmc_boot bootcmd_mmc1=3Dsetenv devnum 1; run mmc_boot bootcmd_mmc2=3Dsetenv devnum 2; run mmc_boot bootcmd_ubifs0=3Dsetenv devnum 0; run ubifs_boot bootcmd_usb0=3Dsetenv devnum 0; run usb_boot distro_bootcmd=3Dfor target in ${boot_targets}; do run bootcmd_${target}; d= one mmc_boot=3Dif mmc dev ${devnum}; then setenv devtype mmc; run=20 scan_dev_for_boot_part; fi pxefile_addr_r=3D0x18200000 scan_dev_for_boot=3Decho Scanning ${devtype} ${devnum}:${distro_bootpart}..= .;=20 for prefix in ${boot_prefixes}; do run scan_dev_for_extlinux; run=20 scan_dev_for_scripts; done; scan_dev_for_boot_part=3Dpart list ${devtype} ${devnum} -bootable devplist;= env=20 exists devplist || setenv devplist 1; for distro_bootpart in ${devplist}; d= o=20 if fstype ${devtype} ${devnum}:${distro_bootpart} bootfstype; then run=20 scan_dev_for_boot; fi; done scan_dev_for_extlinux=3Dif test -e ${devtype} ${devnum}:${distro_bootpart} $ {prefix}extlinux/extlinux.conf; then echo Found ${prefix}extlinux/ extlinux.conf; run boot_extlinux; echo SCRIPT FAILED: continuing...; fi scan_dev_for_scripts=3Dfor script in ${boot_scripts}; do if test -e ${devty= pe} $ {devnum}:${distro_bootpart} ${prefix}${script}; then echo Found U-Boot scri= pt=20 ${prefix}${script}; run boot_a_script; echo SCRIPT FAILED: continuing...; f= i;=20 done What happens is what I wrote in the first mail. extlinux.conf is found and = 'sysboot' fails because it ignores all the keywords. What actually works is using an extlinux.conf similar to the examples in do= c/ README.distro, but there are two things to mention: 1) keywords are used which are not mentioned in the upstream extlinux=20 documentation 2) keywords from the bootloader spec don't work at all So, although the idea to have a config file in the Linux filesystem an let = the=20 distribution set things in it, might be the same as in the Boot Loader=20 Specification, my impression is, U-Boot does not follow the specification. = Neither does it support multiple files (just /boot/extlinux/extlinux.conf=20 works) nor the keywords specified? An extlinux.conf that works is this: label PTXdist kernel /boot/zImage fdtdir /boot append mtdparts=3Dgpmi-nand:8M(fcb),7M(reserved)ro,512k(env1),512k(env= 2),- (UBI) ubi.mtd=3DUBI console=3Dttymxc0,115200 rootwait rw root=3D/dev/mmcblk= 0p1 I have to add, I currently still use U-Boot 2016.09, but I did a thorough=20 research in master and the responsible code in cmd/pxe.c did not change fro= m a=20 functional point of view since 2016.09. Greets Alex