ECE497 Modifying Kernel Command Line Parameters
The linux kernel is booted with a series of parameters known as the kernel command line. On the BeagleBoard, the uBoot bootloader handles both the booting and the passing of parameters. A typical command line on the BeagleBoard might look something like this:
#console=ttyS2,115200n8 console=tty0 root=/dev/mmcblk0p2 rw rootwait
Modification of the kernel command line is necessary for things like:
In order to edit the command line, we need to edit a few uBoot files.
When uBoot finishes its initilization phase, it looks for a file called boot.scr This is a binary file which is read by uBoot before it loads uImage which allows us to modify environment variables such as 'bootargs' (the kernel command-line) before we boot.
Boot.cmd is the plain text, uncompiled version of boot.scr. A standard BeagleBoard boot.cmd might look like:
if fatload mmc 0 80200000 uImage then \techo ***** Kernel: /dev/mmcblk0p1/uImage ***** else echo ***** Kernel: /dev/mtd3 ***** nand read 80200000 280000 400000 fi echo ***** RootFS: /dev/mmcblk0p2 ***** setenv bootargs 'console=ttyS2,115200n8 console=tty0 ethaddr=01:2b:03:01:23:45 g_ether.host_addr=00:dc:c8:f7:75:05 g_ether.dev_addr=00:dd:dc:eb:6d:f1 root=/dev/mmcblk0p2 rw rootwait' bootm 80200000
The key part of this file is the line
setenv bootargs 'console=ttyS2,115200n8 console=tty0 ...'
This is the kernel command line, any additional parameters added on this line will be passed to the kernel when it is booted.
Compiling with mkimage
Once the boot.cmd file has been authored, we need to compile it to produce a boot.scr file. This is done with the mkimage program. On Ubuntu, this program is available through the package 'uboot-mkimage'. It should be similarly available for most distributions.