Search code examples
linux-kernelyoctoboot

Where is this set of boot arguments coming from?


I'm using Yocto to port the EVL Core to an iMX6 Sabre SD board.

I had an core-image-minimal of a kernel (apparently not mainline) that booted correctly with the following boot arguments being displayed before boot:

[    0.000000] Kernel command line: console=ttymxc0,115200 root=/dev/mmcblk2p2 rootwait rw 

I then proceeded to change the core for that of the EVL core (which is a mainline kernel) (both Kernels are 5.4). After making some changes to the device tree, of the new kernel, I verified that it is booting with the following:

[    0.000000] Kernel command line: console=ttymxc0,115200 root=/dev/mmcblk2p2 r

That is, the rootwait rw was replaced by just r. Needless to say this is causing problems during boot and I want to change it.

However, I can't figure out where is this line coming from. I searched the kernel source code and couldn't find the specific line, not even some parts of it. I reckon that instead of just being written in a script, it is being formed by a sequence of some sort of append command.

For reference, the files in which I am searching for this are here.

Question: How is this line being formed, where are the arguments coming from?

I checked that most boards have a "bootargs" line in their device tree that gives in directly the arguments to be passed. However, for the specific case of the Sabre SD this seems to be different, with the line being formed via another script (That I failed to identify which).

Note: I understand that this question could arguably be considered tangent to the topic of this site. If that is the case I can move to the Unix/Linux SE.

Additional Info: I am booting using U-boot, and trying to boot via an SD card. The problem being caused by the absence of rootwait rw is that during boot the kernel fails to see one of the SD partitions and thus cannot continue to boot, resulting in a Kernel Panic.


Solution

  • So after some help received I found the answer. In my bootenv environment there is no bootargs variable. That is because one can see, as part of the output of printenv*:

    bootcmd=run findfdt;run findtee;mmc dev ${mmcdev};if mmc rescan; then if run loadbootscript; then run bootscript; else if run loadimage; then run mmcboot; else run netboot; fi; fi; else run netboot; fi
    

    The first two commands are tests that succeeded. After that, in enters in a sequence of nested ifs. In these ifs we can see that it runs MMC boot (since I am booting from a SD card). This commands then defines the bootargs variable on-the-run during boottime, that's why I couldn't find it in the source code.

    *Which I failed to provide in this question. This detail was fundamental.