![]() |
How to change the kernel command line used by Debian / NSLU2The kernel command line used by a Debian/NSLU2 system is passed to the kernel by the second-stage boot loader, APEX. Two utilities for changing the kernel command line stored in the APEX configuration environment are described on this page. Apart from these two utilities, the command line can also be changed by rebuilding APEX. This option is not described here. Please see CompileApex for information on compiling APEX. Using apex-env on Debian/NSLU2 (etch)The Debian apex-nslu2 package includes a utility You can try to regenerate a copy of a 0xff padded /dev/mtdblock2 yourself, and then edit the APEX configuration environment using $ sudo apex-env printenv bootaddr *= 0x00008000 cmdline = console=ttyS0,115200 rtc-x1205.probe=0,0x6f noirqdebug rootdelay=10 cmdline-alt *= console=ttyS0,115200 rtc-x1205.probe=0,0x6f noirqdebug fis-drv *= nor:0x7e0000+4k kernelsrc *= fis://kernel kernelsrc-alt *= fis://kernel ramdiskaddr *= 0x01000000 ramdisksrc *= fis://ramdisk ramdisksrc-alt *= fis://ramdisk startup *= copy -s $kernelsrc $bootaddr; copy -s $ramdisksrc $ramdiskaddr; wait 10 Type ^C key to cancel autoboot.; boot Note The APEX configuration in this file has the To replace the Debian etch APEX copy, download etch-modified-mtdblock2.bin, and copy it to your NSLU2. You may want to make a backup of you current flash at this stage (see the NSLU2/Debian FAQ). Then do $ su -c 'cat etch-modified-mtdblock2.bin > /dev/mtdblock2' to overwrite the existing copy of APEX in the NSLU2 flash. Check that your APEX configuration matches the one listed above by doing $ sudo apex-env printenv If it does, you should be able to change the kernel command line stored in the APEX configuration environment by by doing $ sudo apex-env setenv cmdline 'console=ttyS0,115200 rtc-x1205.probe=0,0x6f noirqdebug' You can add any additional kernel options you want to set, e.g. 'rootdelay=10' to the end of the kernel command line. See 'apex-env --help' or 'man apex-env' for more information. Using apexctl (written by Phil Endecott)Phil Endecott wrote a utility ( # apexctl Usage: apexctl [options] printenv apexctl [options] getenv variable (exit status 2 if not found) apexctl [options] setenv variable value apexctl [options] init Options: -d device specify /dev/mtd* device containing environment -o offset specify offset into device of start of environment (in decimal; prefix with 0x for hex) # apexctl -d /dev/mtdblock2 -o 0x1c000 printenv cmdline = console=ttyS0,115200 rtc-x1205.probe=0,0x6f \ # /tmp/apexctl -d /dev/mtdblock2 -o 0x1c000 getenv cmdline console=ttyS0,115200 rtc-x1205.probe=0,0x6f \ # /tmp/apexctl -d /dev/mtdblock2 -o 0x1c000 setenv foo blah # /tmp/apexctl -d /dev/mtdblock2 -o 0x1c000 printenv cmdline = console=ttyS0,115200 rtc-x1205.probe=0,0x6f \ The source code is here http://svn.chezphil.org/utils/trunk/apexctl.cc. It relies on some library utility stuff from http://svn.chezphil.org/libpbe/trunk/. If you would like to try this but don't have the necessary tools to compile it, let me know and I can send a binary; it's about 33k. You may have noticed from the example output above that I have been experimenting with an NFS root filesystem. This is a bit tricky if you don't have an initramfs. I got this working eventually; let me know if you're interested.
view ·
edit ·
print ·
history ·
Last edited by john.
Based on work by Cedric Boutillier, dumfrac, and Phil Endecott. Originally by Phil Endecott. Page last modified on November 09, 2008, at 07:55 PM
|