Jeremy Malcolm (email@example.com)
Sun, 5 Apr 1998 22:39:49 +0800
-----BEGIN PGP SIGNED MESSAGE-----
Short version of question:
How do I load kernel modules from an initial ramdisk?
Long version of question:
This is a bit complicated (more so than appears from the short version
of the question above), so I hope you will bear with me. I have a
parallel port SparQ drive which I want to install Debian 1.3.1 on, to
boot from my Windows NT laptop. To get the kernel to recognise the
SparQ device I need to add the Parport modules to it
As my boot partition is going to be on the SparQ cartridge, obviously
I can't put the modules there. Instead, I plan to put them on an
initial ramdisk (initrd). The idea is that the kernel will load the
initrd image from a small FAT partition on my NT's hard drive and load
the modules from the ramdisk. Having done that, it will be able to
recognise my SparQ media and continue booting from there.
Much of what I need to do I have already done, or know how to do. For
* I have got the kernel modules that I need to access the SparQ drive,
and can insert these into the kernel using "insmod" from Linux on my
* I have copied a full Debian installation onto a SparQ cartridge from
my DX-66, and created a swap partition on it too.
* I have made a FAT partition on my Windows NT machine to hold the
kernel, initrd image file and lilo boot sector, for use with the NT
* I have set up lilo with the initrd option on my DX-66, and a test
"linuxrc" file is running from the ramdisk correctly.
* I know how to include a proc filesystem on my initial ramdisk and to
change /proc/kernel/real_boot_device to point to my SparQ drive.
* I know how to use mknod to create /dev/pda1 ... /dev/pda5 on my
initial ramdisk as the device files for the partitions on my SparQ
What I cannot seem to do is to get a shell script that loads the
kernel modules to run as linuxrc (ie. the file that automatically runs
from the initial ramdisk). In fact, I can't get *anything* to run as
linuxrc, aside from the test linuxrc file referred to in the
documentation (a binary which prints out environment variables). When
I use any other file as linuxrc, the kernel mounts the initial ramdisk
and then does one of three things, depending on how I have set up
(a) If I have specified root=/dev/hda3 (the root partition on my DX
66) in lilo.conf, mounts this file system and runs init, without
running linuxrc at all (apart from the test linuxrc referred to
above). However I know that initrd has mounted properly, because it
is accessible in /initrd when the system has finished booting from my
hard disk. I can also manually execute linuxrc from there.
(b) If I have specified root=/dev/pda1 in lilo.conf, I get a kernel
panic. This indicates that the kernel modules to access the SparQ
drive have not been successfully loaded. (As an aside, even the
*test* linuxrc file which works under (a) above, doesn't work when I
specify root=/dev/pda1, so it seems the kernel panic is occuring even
before the linuxrc file is normally executed.)
(c) If I have specified root=/dev/ram in lilo.conf, the kernel hangs
as soon as it has mounted linuxrc. No kernel panic; it just hangs.
(Again, interestingly, this hang seems to occur before the linuxrc
file would normally be executed, because even the test linuxrc file
that I can get to work under option (a) does not run when I specify
The documentation suggests that *any* executable file can be run as
linuxrc, including shell scripts, but nothing I have tried (apart from
the test executable mentioned above) has worked. For example, I have
tried using simple executables such as /bin/ash and /bin/ls as linuxrc
files, but to no avail. I have also tried to run shell scripts as
linuxrc (also copying the appropriate shell to the initial ramdisk)
but with the same result.
I figured that the reason must be because my pseudo-root file system
does not have the correct files and libraries required by the linuxrc
files that I need to run. The only files I have on my initrd file
system are insmod (to load the modules), a shell (to run any scripts),
/proc (so that I can change real_root_device), /dev (with a few files
such as ttys1 and pda1) and the modules themselves. I don't know what
files *must* be in the root file system to enable an executable to run
or modules to be loaded, but apparently the files I have put there are
Having concluded that this is the reason for my problem, I have tried
to create a proper root file system on my initrd in various ways.
First, I have copied the initrd root file system that is created by
the Debian 1.3.1 rescue disk. This works fine if I don't mess with it
(ie. the Debian install program starts up), but as soon as I try to
modify it in any way (ie. to get it to load my modules, instead of
installing Linux) it suffers the same problems as mentioned above; the
kernel either ignores the linuxrc file and continues booting, gives a
"kernel panic", or hangs.
Next, I have tried using the files from a Slackware boot disk
(rescue.gz) to populate my initial ramdisk. This has even less
success than using the Debian rescue disk; once again it either
ignores the linuxrc and continues booting, panics or hangs. Finally,
I have tried to manually copy files that I think might be needed from
my real root file system to the initial ramdisk file system. You
guessed it; the same problem once again...
So my questions are:
1. How can I create an initial ramdisk file system from which I can
run simple shell scripts as linuxrc (basically, the script just needs
to insert the kernel modules using insmod, change the real_root_device
2. Alternatively, is there some other way for the kernel to load the
modules it needs from the initial ramdisk, that doesn't involve the
use of a linuxrc file at all?
As you can probably tell from the above I have wasted many hours on
this problem and I am tearing so much hair out that pretty soon I'll
need a toupee. I would be eternally grateful for anyone who can shed
some light on these intractable problems I am having. If you need any
more information about my system setup, please don't hesitate to ask.
|--------- JEREMY MALCOLM <firstname.lastname@example.org> ---------|
SIG of the day: [ ] Contact [ ] Web [ ] PGP [ ] Taglines #1 [x] #2
"I'm a lawyer." "Honest?" "No, the usual kind." | Linux, the choice of
a GNU generation. | Are you the brain specialist? | "Could anyone pass
the sodium chloride, please?" - Adric (5W) | The Nanites have lawyers?
-----BEGIN PGP SIGNATURE-----
Version: PGP for Business Security 5.5
-----END PGP SIGNATURE-----
-- To unsubscribe, send mail to: email@example.com --
-- with the single word "unsubscribe" in the body of the message. --
This archive was generated by hypermail 2.0b3 on Wed 30 Dec 1998 - 10:17:36 EST