[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]

Passing arguments to initrd's 'init' script.



Is it possible to pass arguments from the kernel (boot) command line to the 'init' script located in my initrd?  If so, is there a best-practice method for doing this?

Looking at the non-initrd system init script '/etc/event.d/rcS', I see that it just reads '/proc/cmdline' and looks for relevent tokens:

{{{
for t in $(cat /proc/cmdline); do
    case $t in
        -s|single|S|s) runlevel="S" ;;
        [1-9])       runlevel="$t" ;;
    esac
done
}}}

I assume that the initrd's 'init' script has access to this same information, at least after it mounts '/proc'.  Is there some reason not to use this from the initrd, or is it acceptable?

This is related to a larger question I have about 'mkinitrd' and the 'init' script:  Why does 'mkinitrd' hard-code the name of the LVM root device, among other things, instead of reading it from the 'root=' parameter on the boot command line?  Wouldn't it make more sense to dynamically pick up the root device on each boot, using a method similar to the 'rcS' script, above?

-Ryan




[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]