4

How can uboot pass command line argument to kernel? I did some googling and got to know that it uses the bootargs environment variable. There it was mentioned that setenv bootargs key=value. Since I am using bash and don't have setenv I did this using export bootargs="value". But it's not affecting anything. I checked in /proc/cmdline the arguments remain the same. Any idea what I am doing wrong?

3

There are two ways to pass arguments to kernel: 1. Compile them inside. 2. Use bootloader

So first check if your arguments are not compiled into kernel. Second setenv command you've found in not a bash command but boot loader command. It depends on how particular device made, but usually there is a partition in some internal storage (flash memory of your device, not on host) where bootloader reads parameters or file on filesystem and u-boot takes configuration from there.

Other way is to connect your device via cable and use device-specific way to get bootloader prompt and interactively change your settings.

It's not really trivial if you not familiar with your particular device boot scheme. Name your device, it may help to answer your question.

1

You can use a uEnv.txt file in your boot partition to specify arguments for the boot. This is an example for Xilinx zynq-7000 devices from the yocto meta-zybo layer:

kernel_image=uImage
devicetree_image=zybo-zynq7.dtb
bootargs=console=ttyPS0,115200 root=/dev/mmcblk0p2 rw rootwait earlyprintk
uenvcmd=echo Copying Linux from SD to RAM... && fatload mmc 0 0x3000000 ${kernel_image} && fatload mmc 0 0x2A00000 ${devicetree_image} && bootm 0x3000000 - 0x2A00000

It specifies the device tree to use (you don't need to do this if your is called device_tree.dtb ) followed by a set of arguments for the kernel.

You can find more information on the usage of uEnv.txt here

0

you can pass your boot files through uEnv.txt file, besides your files on SD card.

you need these files for boot: BOOT.bin (loads fsbl and uboot), bitstream.bit (your bitstream that loads to PL, uImage (compiled linux kernel), devicetree.dtb (address of drivers that linux reads it), uramdisk.image.gz (linux files after booting).

you can load these to your DDR by this commands:

bootargs=console=ttyPS0,115200 root=/dev/ram rw earlyprintk
load_image=fatload mmc 0 ${kernel_load_address} ${kernel_image} && 
fatload mmc 0 ${devicetree_load_address} ${devicetree_image} && 
fatload mmc 0 ${ramdisk_load_address} ${ramdisk_image} uenvcmd=run mmc_loadbit_fat && 
echo Copying Linux from SD to RAM... && 
run load_image && 
bootm ${kernel_load_address} ${ramdisk_load_address} ${devicetree_load_address}

also if you want to load other linux files from ext4 partition of SD, you can use this commands on uEnv.txt:

bootargs=console=ttyPS0,115200 root=/dev/mmcblk0p2 rw earlyprintk rootfstype=ext4 rootwait devtmpfs.mount=0
load_image=fatload mmc 0 ${kernel_load_address} ${kernel_image} && 
fatload mmc 0 ${devicetree_load_address} ${devicetree_image} uenvcmd=run mmc_loadbit_fat && 
echo Copying Linux from SD to RAM... && 
mmcinfo &&  run load_image && 
bootm ${kernel_load_address} - ${devicetree_load_address}

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.