initrd hacking [was: booting with grub to /dev/sda]
Jim Cromie
jcromie at divsol.com
Thu Jan 6 04:43:09 UTC 2005
Ow Mun Heng wrote:
>On Tue, 2005-01-04 at 23:45, Jim Cromie wrote:
>
>
>>Ow Mun Heng wrote:
>>
>>
>>
>One MSG shows you to put sda into device.map. Did you try that already?
>Can your laptop boot directly from USB?
>
>
>
yes - didnt work. grub doesnt see it. says (from memory)
err 21, non-existent drive
<snipping>
>Hmm..
>
yes - I do want both
1 - full understanding of grub
2 - a 250gb 'brick' which I can use on OPC (other peoples computers)
Aside - I want a bumper sticker that says -
my other computer is your windows box. :-)
>>mount: errort 2 mounting none
>>
>>
>
>Is this a Typo??
>
>
>
yes. no cut-paste practical from boot..
>>Switching to new root
>>switchroot: mount failed: 22
>>umount /initrd/dev failed : 2
>>Kernel panic -not syncing: attempted to kill init
>>
>>hangs.. CtlAltDel doesnt clear it. power cycling does.
>>
>>
>
>
>Can you try to mount the initrd image via loopback and look at the
>linuxrc file?? I know it can be done simply with mkinitrd, but I've gone
>the manual part and hacked the linuxrc file.
>
>
>
>
I have unpacked and inspected.
<aside>
AIUI, you cant loop mount it - its a compressed cpio not an ext2 or
cramfs
ie:
[root at harpo nomad]# mount -o loop initrd-2.6.9-1.724_FC3.img /mnt/t1
mount: you must specify the filesystem type
[root at harpo nomad]# mount -o cloop initrd-2.6.9-1.724_FC3.img /mnt/t1
mount: initrd-2.6.9-1.724_FC3.img is not a block device (maybe try `-o
loop'?)
[root at harpo nomad]# mount -t cpio -o cloop initrd-2.6.9-1.724_FC3.img
/mnt/t1
mount: fs type cpio not supported by kernel
[root at harpo nomad]# mount -t ext2 -o cloop initrd-2.6.9-1.724_FC3.img
/mnt/t1
mount: initrd-2.6.9-1.724_FC3.img is not a block device (maybe try `-o
loop'?)
[root at harpo nomad]# mount -t ext2 -o loop initrd-2.6.9-1.724_FC3.img /mnt/t1
mount: wrong fs type, bad option, bad superblock on /dev/loop3,
or too many mounted file systems
(could this be the IDE device where you in fact use
ide-scsi so that sr0 or sda or so is needed?)
Can you stack drivers ? one to decompress, other to handle FS ?
</aside>
I did unpack it. (btw it is 'init' in fedora, not linuxrc like debian)
Ive already hacked it - indirectly - by hacking mkinitrd (a shell script)
- I turned off the setquiet in hope that it would tell me where the bug
was :-(
here it is:#!/bin/nash
mount -t proc /proc /proc
echo Mounted /proc filesystem
echo Mounting sysfs
mount -t sysfs none /sys
echo Creating /dev
mount -o mode=0755 -t tmpfs none /dev
mknod /dev/console c 5 1
mknod /dev/null c 1 3
mknod /dev/zero c 1 5
mkdir /dev/pts
mkdir /dev/shm
echo Starting udev
/sbin/udevstart
echo -n "/sbin/hotplug" > /proc/sys/kernel/hotplug
echo "Loading jbd.ko module"
insmod /lib/jbd.ko
echo "Loading ext3.ko module"
insmod /lib/ext3.ko
echo "Loading scsi_mod.ko module"
insmod /lib/scsi_mod.ko
echo "Loading usb-storage.ko module"
insmod /lib/usb-storage.ko
sleep 5
/sbin/udevstart
echo Creating root device
mkrootdev /dev/root
umount /sys
echo Mounting root filesystem
mount -o defaults --ro -t ext3 /dev/root /sysroot
mount -t tmpfs --bind /dev /sysroot/dev
echo Switching to new root
switchroot /sysroot
umount /initrd/dev
I stalled out after looking for nash docs explaining what
"mkrootdev /dev/root" actually does.
it would make sense if its whatever is on kernel-command line,
ie root=/dev/sda1 in my case.
Id welcome other suggestions.
thx
jimc
More information about the fedora-list
mailing list