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

Re: kernel-package question and suggestion (initrd module loading)



On Tue, 31 Aug 1999 you wrote:
>         I do not have time at the moment to play around with creating
>  initrd bootup procerss, but I would be happy to accept anything you
>  have ;-) I think this is a great idea. I even started reading up on
>  this to iomlement this, but ran out of time.
I have something working now (I am writing this with an IDE system and a
kernel that has IDE support compiled as modules), please try it out and report
any errors you find.

My main work is around a shell-script for creating the initrd image and a small
C program for /linuxrc. The shell-script 'mkinitrd' is called with 2
parameters: The kernel version number and the location of the kernel modules.
    e.g.: ./mkinitrd 2.2.11 /lib/modules/2.2.11

You will also have to customize some variables at the beginning of the shell
script (mainly copy_files_from which should point to the directory containing
'linuxrc' and 'insmod.static' - I think these should be somewhere under
/usr/lib or /usr/share in the package).

The shell script depends on bash, sash, awk and certainly a few others that I am
not aware of now ;-)

At the moment the image size depends on the size of the modules that are copied
to it. Now I only copy scsi and block (line 54) module, but I am not sure if
there should be cdrom, fs and net too. What do you think ?
Also a statically linked shell (sash) is copied and linked as /bin/sh on the
initrd image, but I designed the linuxrc program so that it should work without
a shell (although I did not try it out without it up to now). The shell should
go away as it takes over 200 kb of RAM and is not needed.

You can customize which modules are loaded on boot time with a special kernel
parameter on the kernel command line in the form of:
    boot_modules=ide-mod,ide-probe,ide-disk
You can also give module parameters like
  boot_modules=sb:io=0x220:irq=5:dma=1:dma16=5:mpu_io=0x330,opl3:io=0x388
(senseless, but shows how to separate parameters)

Now a special kernel parameter is needed to give the real root device on boot:
    real_root_dev=770
I am trying to figure out how to compute this number (I got it by booting with
a kernel with IDE support and doing a 'cat /proc/sys/kernel/real-root-dev'),
but the way MAKEDEV does it is too complicated (when the kernel changes, linuxrc
would have to be recompiled). It should be possible to read the 'root=......'
option on the kernel commandline (linuxrc is doing that now) and compute the
number for the real-root-dev.
But I think that should not be needed. I have the problem that the kernel uses
root device 000 if it can not find the device given by 'root=.....' on the
command line BEFORE it starts linuxrc. When reading
/proc/sys/kernel/real-root-dev from linuxrc, it says (correctly) 770 with a
kernel with IDE support, but 000 with a kernel without IDE support.
I am working on this (I really, really do not like the real_root_dev=
parameter).

There is another small problem: How do I redirect the kernel messages printed
during the load of a modules (normally these go to syslog, but during bootup
the go to the console) to a file ? It works with stderr, but not with these
messages.....


Manoj, I am sending you the needed files as a .tar.gz in an extra mail because
I am cc'ing this to debian-devel.
Everybody who wants to try this out (please do so), please write me mail and I
will send it to you.

greets
Rene

-- 
Rene Mayrhofer
mailto: rmayr@vianova.at


Reply to: