iMX8M Passing bootargs from U-Boot without using command line

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

iMX8M Passing bootargs from U-Boot without using command line

Jump to solution
4,598 Views
bharatkumarbach
Contributor III

I am trying to understand how the bootargs are being passed to the kernel from U-Boot. I am not interested in using U-Boot prompt to setup environment variables.
Is there any fixed address the kernel looks at? or Is it stored in some RAM location and the address is passed onto kernel through "x" registers?

Board: iMX8M 

Thanks and Regards,
Bharat Kumar.

1 Solution
3,967 Views
felixradensky
Contributor IV

U-boot passes kernel command line arguments via /chosen node in DTS.

See https://www.kernel.org/doc/Documentation/devicetree/usage-model.txt 

View solution in original post

3 Replies
3,968 Views
felixradensky
Contributor IV

U-boot passes kernel command line arguments via /chosen node in DTS.

See https://www.kernel.org/doc/Documentation/devicetree/usage-model.txt 

3,967 Views
radhikasomaiya
Senior Contributor II

Hi bharatkumarbacha‌,

Kindly find my answers inline :

I am trying to understand how the bootargs are being passed to the kernel from U-Boot. I am not interested in using U-Boot prompt to setup environment variables.

When u-boot starts kernel code by bootm for example, it will pass the start address and end address of the command line string, and kernel takes it from there.
Is there any fixed address the kernel looks at? or Is it stored in some RAM location and the address is passed onto kernel through "x" registers?

Yes. U-Boot has it's predefined addresses from where the kernel gets the information about boot arguments. You can check the address in u-Boot source code - <uboot_src>/git/include/configs/<your_board.h>

The MACRO will be named as "CONFIG_ENV_OFFSET"

Hope this will help you.

3,967 Views
bharatkumarbach
Contributor III

Hi radhika.somaiya@volansystech.com‌,

Thanks for the quick response.

When u-boot starts kernel code by bootm for example, it will pass the start address and end address of the command line string, and kernel takes it from there.

As per Kernel requirements, U-Boot uses 4 registers X0(FDT), X1(res), X2(res), and X3(res) to pass arguments. It would be of great help if you can brief about how the start and end addresses are passed to the kernel.

Yes. U-Boot has it's predefined addresses from where the kernel gets the information about boot arguments. You can check the address in u-Boot source code - <uboot_src>/git/include/configs/<your_board.h>

The MACRO will be named as "CONFIG_ENV_OFFSET"

I thought so and to verify it, I opened the boot prompt and entered the following commands.

u-boot=>setenv bootargs root=/dev/mmcblk0p1

u-boot=>run bootargs

Used the following to read from MMC

u-boot=> mmc read <ram address> <Sector of CONFIG_ENV_OFFSET> <CONFIG_ENV_SIZE/512>

u-boot=>md.b <ram address> <CONFIG_ENV_SIZE>

I expected the bootargs to be saved in the memory I read, but it was not the case unless I do

u-boot=> saveenv

Usually, the kernel can be booted without calling saveenv and I wild guess bootargs are copied into RAM and passed.

Thanks.

Regards,

Bharat Kumar Bacha.