| Summary of What Was Done |
cd /usr/src/linux-2.4.7-10
make xconfig
configure your kernel and save, then
make dep
make clean
make bzImage
make modules
make modules_install
Ensure the kernel-sources and gcc RPMs are installed.
kernel panic: VFS: unable to mount root fs<DOTS>
and VFS (under File systems, the latter for the boot process);
| Kernel Command-Line Options |
I had a little trouble getting the root-pivotting/chroot/second-init sequence to work properly. (Judging by results from Google, so do many others.) Solution: read /usr/src/linux-2.4/Documentation/initrd.txt carefully. In particular, the kernel (within BOOT.IMG) needs to be supplied with some boot-time options (these go within SYSLINUX.CFG if using SYSLINUX, or within lilo.conf, if using lilo --- e.g., if testing):
We combine the contents of Maragda's script Init_initrd with the gist of the description contained in Rute. Points to note:
chroot ./initrd /bin/sh
and try running linuxrc and all the executables in /bin.
| Building initrd.gz |
Contents and Structure
I used two different initrds --- one to aid in debugging, whilst testing, which includes some extra bits and pieces, and is to big to fit on a floppy with the custom kernel, and a second one which is the actual, real, working mccoy:
Building
Given the above listed files within directory initrd, then:
dd if=/dev/zero of=initrd.img count=2500 bs=1024
# ...count may need to be made bigger, and can perhaps be made
# smaller;
losetup /dev/loop0 initrd.img
mke2fs /dev/loop0
mkdir mnt
mount /dev/loop0 mnt
cp -a initrd/* mnt
umount mnt
losetup -d /dev/loop0
gzip -c -9 initrd.img > initrd.gz
| The script used |
Again, two different version, one for testing and debugging, a second actually used:
| The Obsolete Sequence |
The Maragda documentation (and linuxrc) describes and uses an obsolete root-pivotting method, as mentioned in /usr/src/linux-2.4/Documentation/initrd.txt. This involves all sorts of weird and wonderful stuff like...???. Thankfully it is obsolete.
Put copies of, or links to ROOT.FS and WHOLE.FS in place so that linuxrc can find them, e.g., in /system, on one of the linux installations; place the custom kernel, bzImage-2002Mar22, say, and the initial ramdisk, initrd.gz-2002Mar22 in /boot on the same installation. Edit your boot loader configuration so that the new kernel is a bootable option, e.g., with lilo: /etc/lilo.conf should include:
image=/boot/bzImage--<version>
label=my_cd_kernel
initrd=/boot/initrd.gz.my_cd_k
read-only
append="root=/dev/ram0 init=/linuxrc rw ramdisk_size=100000"
(note the append line). Then run lilo and (and lilo -q if you want),
then reboot and choose the new kernel from the lilo menu.
Check all is ok before making the floppy boot image, BOOT.IMG.
Tip
If running linuxrc works from the command line but when booting and running it looks ok, but the wrong init sequence is run, e.g., that on the harddisk, check:
We follow Maragda and use syslinux, rather than lilo as our boot loader (its smaller???).
/usr/bin/syslinux /dev/fd0
which will write linux.sys to the floppy and make it bootable.
dd if=/dev/fd0 of=BOOT.IMG
This will be used in making the bootable CDROM.
Essentially we follow the Cp_root script of Maragda, with a few modifications.
mkdir tmp_root
mkdir mnt_root
tar --create --directory $ORIG --exclude var/lib --exclude \
lib/modules --file - bin sbin boot dev etc home lib mnt proc \
root tmp var | tar --extract --directory tmp_root \
--same-permissions --file -
mkdir tmp_root/lib/modules
cp -a ${MODULES_ORIG}/2.4.7-10custom \
tmp_root/lib/modules/2.4.7-10custom
cd tmp_root
mkdir initrd
mkdir tmp_root/mnt/cdrom
mkdir tmp_root/mnt/floppy
mkdir tmp_root/cdrom
mkdir tmp_root/floppy
for i in `find tmp_root/var/log -type f`
do
> $i
done
| The Init Sequence |
action $"Starting $subsys: " $i start
which wraps the script --- amongst other things stdout and stderr go
to syslog, rather than the screen. But the [Si]Maragda scripts are
interactive, so we edit rc like so:
| Making ROOT.FS |
./maragda_Make_fs 70 Mb
mv 70Mb.FS ROOT.FS
mount ROOT.FS mnt_root -o loop
cp -a $DEST/* $FINAL_DEST
umount mnt_root
| Issues and Usage |
There are some issues which remain --- in particular, how to get our IP address. See Current Status. One can simply run netconfig after logging in as root as a work around/solution.
This, thankfully, is simple.
./maragda_Make_fs 550 Mb
mv 550Mb.FS USR.FS
mkdir mnt_usr
mount USR.FS mnt_usr -o loop
tar --create --directory $ORIG --exclude usr/doc \
--exclude usr/share/doc --exclude usr/src \
--file - usr | tar --extract --directory mnt_usr \
--same-permissions --file -
umount mnt_usr
See "Testing the Kernel and Associated initrd", above.
./maragda/
./maragda/boot/
./maragda/boot/BOOT.IMG
./maragda/MARAGDA/
./maragda/system/
./maragda/system/ROOT.FS
./maragda/system/WHOLE.FS
and run, from ., mkisofs:
mkisofs -r -T -f -l -v -o maragda.iso -A 'maragda linux' \
-P 'Jordi Bataller' -b boot/BOOT.IMG maragda
Then burn the CD from the image.