Initrd Question

Jim Gifford
2004-02-13T03:13:20Z

I wrote the initrd hint for the Linux from Scratch. I have followed the
initrd.txt exactly to the letter. The problem I have noticed is with one of
the commands, and I checked other mkinitrd scripts and they have the
workaround in it.

According to initrd.txt the echo 0x301 >/proc/sys/kernel/real-root-dev is
for the old change root mechanism, but I have tried to elminate that from my
script and it fails everytime saying it can't find the root, the infamous
Kernel panic: VFS: Unable to mount root fs on xx:xx. Here is my linuxrc
script that is built from my mkinitrd script which can be viewed at
http://cvs.jg555.com/viewcvs.cgi/scripts/system/mkinitrd.

I use busybox for my script so I can keep the size down. My current size is
only 387k.

#!/bin/sh

echo "Initial RAMDISK Loading Starting..."
insmod /lib/megaraid.ko
insmod /lib/aic7xxx.ko
insmod /lib/uhci-hcd.ko
echo "Mounting proc..."
mount -n -t proc none /proc
echo 0x0100 > /proc/sys/kernel/real-root-dev
echo "Mounting real root dev..."
mount -n -o ro /dev/sda2 /new_root
echo "Running pivot_root..."
pivot_root /new_root /new_root/initrd
if [ -c initrd/dev/.devfsd ]
then
echo "Mounting devfs..."
mount -n -t devfs none dev
fi
if [ $$ = 1 ]
then
echo "Running init..."
exec chroot . sbin/init dev/console 2>&1
else
echo "Using bug circumvention for busybox..."
exec chroot . sbin/linuxrc dev/console 2>&1
fi
echo "Initial RAMDISK Loading Completed..."

----
Jim Gifford
maillist@jg555.com