U-Boot Passing Kernel Arguments

来源:互联网 发布:qq ubuntu 安装包下载 编辑:程序博客网 时间:2024/06/05 02:19

本文转载至:http://www.denx.de/wiki/view/DULG/LinuxKernelArgs

 In nearly all cases, you will want to pass additional information tothe Linux kernel; for instance, information about the root device ornetwork configuration.

In U-Boot, this is supported using the bootargsenvironment variable. Its contents are automatically passed to theLinux kernel as boot arguments (or "command line" arguments). This allows the use of the same Linux kernel image in a wide range of configurations. Forinstance, by just changing the contents of thebootargs variable you can use the very same Linuxkernel image to boot with aninitrd ramdisk image,with a root filesystem over NFS, with aCompactFlash disk or from aflash filesystem.

As one example, to boot the Linux kernel image at address0x400000 usingthe initrd ramdisk image at address0x600000 asroot filesystem, and with the flattened device tree blob at address 0x800000, and with the flattened device tree blob at address 0xFC1E0000, you can use the following commands:

=> setenv bootargs root=/dev/ram rw=> bootm0x400000 0x600000 0x800000  0xFC1E0000 

To boot the same kernel image with a root filesystem over NFS, thefollowing command sequence can be used. This example assumes that yourNFS server has the IP address "192.168.1.1" and exports the directory"/opt/eldk-4.2/ppc_4xx" as root filesystem for the target. The target has beenassigned the IP address "192.168.100.6" and the hostname "canyonlands". A netmaskof "255.255.0.0" is used:

=> setenv bootargs root=/dev/nfs rw nfsroot=192.168.1.1:/opt/eldk-4.2/ppc_4xx ip=192.168.100.6:192.168.1.1:192.168.1.1:255.255.0.0:canyonlands::off=> bootm0x400000 - 0x800000  - 0xFC1E0000 

Please see also the files Documentation/initrd.txtand Documentation/nfsroot.txt in your Linux kernelsource directory for more information about which options can bepassed to the Linux kernel.

ALERT! Note: Once your system is up and running, if you have a simple shell login,you can normally examine the boot arguments that were used by the kernel for the most recent boot with the command:

$ cat /proc/cmdline

0 0
原创粉丝点击