[PLUG] Re: Linux kernel ties to the filesystem

Elliott Mitchell ehem at m5p.com
Sun Nov 16 22:40:02 UTC 2003


> From: Derek Loree <drl at drloree.com>
> On Fri, 2003-11-14 at 10:32, Ed Sawicki wrote:
> > Does the kernel know about /lib or is there another mechanism
> > that tells the kernel about it?
> 
> Only that the modules are kept there.  If the kernel needs a module to
> finish booting (say IDE for instance), it could read it from there. 

Bzzt! Wrong answer! Thanks for being on our show...

I'm uncertain whether the kernel load files or simply data as modules,
but either way you can attempt to load any file anywhere into the kernel.
All the kernel cares about is that it is in the right format and has the
right symbols inside it. OTOH modprobe (but not insmod) looks in
/lib/modules/<kernver> for kernel modules to load.

> >From my understanding though, this is where an initrd image must be
> incorporated into the boot cycle.  This image is a compressed file
> system of the information that the kernel needs to load modules for
> devices that could become the root of the file system.  The boot loader
> is responsible for knowing the location of the initrd image.  I haven't
> tried to mount an initrd image, so I really don't know what the kernel
> sees in them.

You got this right. The boot loader uses the BIOS to load the initial ram
disk, and the right kernel driver (which skips the BIOS) can be loaded
from the initrd, which since it is already in memory can be accessed
without the driver already present in the kernel.

> > Is there anything in /etc that the kernel is aware of?
> 
> Well, if the root designation in /etc/fstab is screwed up, the kernel
> will panic and the boot process can not proceed.  Seems like a kernel
> dependency to me.

Wrong. The kernel has two paths for root device. First, it can get the
device major/minor directly specified. This specification in turn has two
paths, there is a value built into the kernel itself which `rdev` can
change, otherwise it can be passed on the kernel command line. Second,
once an initrd is loaded the "pivot_root" system call can be used to
specify an arbitrary FS as root (look at the kernel source,
linux/Documentation/initrd.txt for details). /etc/fstab has absolutly no
relevance to this process.

> If LVM is enabled in the kernel, it will need to be able to see
> /etc/raidtab.  
> 
> That is all that I can think of.

Wrong. With new style (autodetect) the RAID devices are specified on the
devices themselves. With the old style RAID devices the
_scripts/binaries_ look at /etc/raidtab to determine what devices to tell
the kernel what to load as RAID devices, but the kernel itself doesn't
care at all.

> > What about /var?
> 
> The kernel boot info is written to several files, but I have a feeling
> that information is stored in a buffer until something can be done with
> it.  On my system, a daemon called "bootlogd" is the first one started,
> and then it is stopped at the end of the second runlevel.  Actually, a
> start command is used to "stop-bootlogd".

Correct. syslogd/klogd reads the buffer and dumps it wherever you want it
to.


-- 
(\___(\___(\______          --=> 8-) EHM <=--          ______/)___/)___/)
 \   (    |         EHeM at gremlin.m5p.com PGP 8881EF59         |    )   /
  \_  \   |  _____  -O #include <stddisclaimer.h> O-   _____  |   /  _/
    \___\_|_/82 04 A1 3C C7 B1 37 2A*E3 6E 84 DA 97 4C 40 E6\_|_/___/






More information about the PLUG mailing list