[plug] a bit more initrd confusion :-(
Tony Breeds
magni at plug.linux.org.au
Tue Apr 20 13:47:05 WST 2004
On Tue, Apr 20, 2004 at 06:57:05AM +0800, Denis Brown wrote:
> Dear PLUG list members,
>
> Thanks to those who responded to my earlier confusion! I will reply
> including a "mkinitrd for the first time" synopsis in case it will help
> others along the way. Meantime I have gathered the bits and pieces
> together for my first initrd BUT cannot see how the new kernel - which has
> not yet been loaded - can be specified as an argument to the mkinitrd
> script.
>
> By that I mean...
>
> a) I have a mostly-non-modular kernel 2.4.25 so if I do uname -r I get
> 2.4.25 uname -r is used in the mkinitrd script to deteremine the
> location of modules for the fresh kernel.
>
> b) My new kernel is 2.4.26 and this time the scsi driver will be modular
>
> c) If I therefore do mkinitrd -o /boot/initrd.img /dev/sda3 how does
> the mkinitrd process determine that it is the 2.4.26 kernel I want
> initrd'ed and not the current 2.4.25 kernel??????
>
Ummm I think you're using the wrong syntax. /every/ mkinitrd I've used
has taken the kernel name as the last argument. i.e.
mkinitrd -o /boot/initrd-2.4.26.img 2.4.26
Note:
The "2.4.26" must match the directory name on /lib/modules.
> I'll have a play on a non-production system first, of course, but I would
> like to understand the process rather than just rely on some automagical
> procedure. I've looked through - and grep'ped - the mkinitrd script to
> try to see where the new kernel, maybe as bzImage or as vmlinuz or other
> likely-sounding name is referenced but I have come up blank.
This is how Linux boots:
* PC starts executing code in the MBR, typically this will run either
lilo or grub. Whatever this application is called I'll refer to it
as the Boot loader. (MBR == Master Boot Record)
* The boot loader loactes the supplied kernel and runs it with the
correct argments (cat /proc/cmdline for an example). At this point
potentially your new kernel (2.4.26) is runnign BUT it has very
little knowledge of the hadrware. One of the most importand
arguments to the name of the root device.
* The running kernel now locates CPU's memory and peripheral buses
(PCI/ISA even USB etc etc). At some point it will cease discovering
hardware and move to launching userspace.
* At this point IFF you have supplied an initrd it will be located
decompressed mounted as / and /linuxrc will be run. This script can
(usually does) load the appropriate modules to locate the root device
and the filesystem (yes you can have both IDE and ext3 as modules and
still boot "from" an IDE drive with ext3).
* Once the real root device is mounted /sbin/init (or other execuatable
supplied in init=.... on the command line) is run and the normal
userspace machine startup ensues.
So as long as you do something like:
unpack, configure, build and install 2.4.26
build the initrd
update your boot loader config file to know about the new kernel[1]
rerun your bootloader[2]
reboot
You should be able to run the newly build kernel.
[1] Yes I know you don't need to do this for gurb but it does help
[2] Yes I know that you don't need to do this with grub, but it doesn't
hurt
I hope that clarifies the boot process.
>
> TIA,
> Denis
>
>
>
> _______________________________________________
> PLUG discussion list: plug at plug.linux.org.au
> http://mail.plug.linux.org.au/cgi-bin/mailman/listinfo/plug
> Committee e-mail: committee at plug.linux.org.au
--
Yours Tony
Linux.Conf.AU http://lca2005.linux.org.au/
Apr 18-23 2005 The Australian Linux Technical Conference!
More information about the plug
mailing list