Raspberry Pi - necessity to use additional boatloder - is it possible to read the original command line parameters provided by start.elf?


I'm preparing a system with a Raspberry Pi as an embedded computer, running the Buildroot compiled Linux. To extend possible boot options I have to use additional bootloader (barebo x or u-Boot). Everything works fine, however it appears, that this intermediate bootloade r needs to pass the original kernel command line parameters, which are prep ared by the start.elf tool.

Of course I can hijack those parameters, booting the Linux kernel instead o f my bootloader and storing the content of the /proc/cmdline to the SD card . However those parameters depend on the individual board (for example this i s how the MAC address is passed to the board).

For example in one of the boards the following set of parameters is passed to the kernel (MAC address and serial number are partially masked for priva cy):

dma.dmachans=0x7f35 bcm2708_fb.fbwidth=720 bcm2708_fb.fbheight=480 bc m2708.boardrev=0xd bcm2708.serial=0x6f15XXXX smsc95xx.macaddr=B8:27:E B:XX:XX:XX bcm2708_fb.fbswap=1 sdhci-bcm2708.emmc_clock_freq=250000000 vc_mem.mem_base=0x1ec00000 vc_mem.mem_size=0x20000000 console=ttyAMA

0 root=/dev/mmcblk0p2 rootwait

Only the "console=ttyAMA0 root=/dev/mmcblk0p2 rootwait" is taken from t he cmdline.txt file, the previous settings are generated by the start.elf

To avoid extracting the boot parameters for each board individually, and av oid possible problems if somebody swaps the SD cards, I'd like the boatload er to read the boot parameters provided by the start.elf when the boatloade r is started, possibly modify them and pass to the finally booted kernel.

Unfortunately neither in barebox nor in U-Boot i can find a way to access t he command line parameters... How can I modify one of those bootloaders to access those parameters? Is it possible at all?

TIA & Regards, Wojtek

Reply to
Loading thread data ...

The command line should be passed in an ATAG from the bootloader (in this case start.elf) to the kernel. If you choose to put in a secondary[1] bootloader it'll boot as if it were a kernel, and so the command line should be handed to it in the ATAGs. As to what u-boot or barebox do with it from then on, that's up to them.

(The command line is also available in Device Tree, though I'm unclear how the Pi's bootloaders handle DT)


[1] start.elf is actually the tertiary bootloader, so this would be a fourth-stage from the perspective of the SoC
Reply to
Theo Markettos

ElectronDepot website is not affiliated with any of the manufacturers or service providers discussed here. All logos and trade names are the property of their respective owners.