EmbeddedRelated.com
Forums

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

Started by Unknown November 13, 2015
Hi,

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 (barebox or u-Boot).
Everything works fine, however it appears, that this intermediate bootloader needs to pass the original kernel command line parameters, which are prepared by the start.elf tool.

Of course I can hijack those parameters, booting the Linux kernel instead of 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 is 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 privacy):

dma.dmachans=0x7f35 bcm2708_fb.fbwidth=720 bcm2708_fb.fbheight=480 bcm2708.boardrev=0xd bcm2708.serial=0x6f15XXXX smsc95xx.macaddr=B8:27:EB:XX:XX:XX bcm2708_fb.fbswap=1 sdhci-bcm2708.emmc_clock_freq=250000000 vc_mem.mem_base=0x1ec00000 vc_mem.mem_size=0x20000000  console=ttyAMA0 root=/dev/mmcblk0p2 rootwait

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

To avoid extracting the boot parameters for each board individually, and avoid possible problems if somebody swaps the SD cards, I'd like the boatloader to read the boot parameters provided by the start.elf when the boatloader 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 the command line parameters...
How can I modify one of those bootloaders to access those parameters?
Is it possible at all?

TIA & Regards,
Wojtek
wzab01@gmail.com wrote:
> Hi, > > Unfortunately neither in barebox nor in U-Boot i can find a way to access > the command line parameters... How can I modify one of those bootloaders > to access those parameters? Is it possible at all?
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) Theo [1] start.elf is actually the tertiary bootloader, so this would be a fourth-stage from the perspective of the SoC