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

Re: what's the processing sequence for initramfs during boot?

Somebody in the thread at some point said:

> there is no "pivot_root" in the fedora-supplied nash script but, near
> the end, there are "setuproot" and "switchroot" commands.  are you
> suggesting that one of these is responsible for processing the "root="
> option.  after all, *someone* has to process it, i'm just trying to
> figure out who.

These are the magic bits

echo Creating root device.
mkrootdev -t ext3 -o defaults,ro /dev/f8/root
echo Mounting root filesystem.
mount /sysroot
echo Setting up other filesystems.
echo Switching to new root and running init.

mkrootdev is the guy that actually scans /proc/cmdline for root= (if you
didn't give a partition on the mkrootdev line, which mkinitrd takes care
of on Fedora) and mounts the device mentioned there at /sysroot in the
initrd filesystem.  It also makes an entry for it in the initrd
filesystem /etc/fstab.

mkrootdev path
              Makes path a block inode for the device which should be
              mounted as root. To determine this device nash uses the
              device suggested by the root= kernel
              command line argument (if root=LABEL is used devices are
              probed to find one with that label). If no  root=
              argument  is  available,  /proc/sys/ker-
              nel/real-root-dev provides the device number.

setuproot (undocumented) populates the final root filesystem with
critical mounted goodies according to the initrd /etc/fstab.  If there
isn't one, it mounts /sysroot/proc and /sysroot/sys

switchroot is documented:

       switchroot newrootpath
              Makes the filesystem mounted at newrootpath the new root
              filesystem by moving the mountpoint.  This will only work
              in 2.6 or later kernels.

so switchroot does the pivot_root action with initrd fs /sysroot
(mounted with the mkrootdev device or failing that the kernel root= guy)
-> /

This info is coming from eyeballing the nash sources in the mkinitrd
SRPM, see ./nash/nash.c in there.

> or does the boot-time parm "quiet" toss all that output?

The "setquiet" nash command does that.

              Cause any later echos in this script to not be displayed.


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