I just took a "Building Linux Kernel" training. I finished all labs with my partner during the training. I am repeating the labs on my personal desktop at home.
First, I installed Fedora-7 one my PC, which had installed Window XP. Dual-boot are fine, both WinXP and Fedora-7.
Second, I downloaded the linux kernel from www.kernel.org
and busybox. I used default settings for both. "make" were good. I can boot the new kernel with the automatically created initrd.
Then, I want to build my own root filesys. I created rootdir diretories, copied busybox to rootdir/bin, and made softlinks for commands in busybox. "chroot" is fine.
I installed the modules to my rootdir directory from the kernel I made. Now rootdir is too big. The only device drive I want to load is NIC driver. The target rootdir size is less than 8M. I started to delete drivers in rootdir.
Basically, I only kept my nic driver and fs/ext2 and fs/ext3. rootdir size is now about 7M.
rootdir/etc/inittab and rc.sysinit were created.
dd if=/dev/zero of=initrd.img bs=8M count=1
mke2fs -F -v -m0 initrd.img
mount -o loop initfs.img mntdir/initrd
Then copy rootdir/* to mntdir/initrd and gzip initrd.img.
copy the compressed initrd.img to /boot.
title Fedora (220.127.116.11)
kernel /vmlinuz-18.104.22.168 root=/dev/ram rw
title Fedora (2.6.21-1.3194.fc7)
kernel /vmlinuz-2.6.21-1.3194.fc7 ro root=LABEL=/1 rhgb quiet
/boot is on hdc6
swap is on hdc7
/ is on hdc8
hdc7 is SATA HDD.
I intended to mount root to ram (from the training lab).
The new system failed to bootup. The message are:
RAMDISK: Compressed image found at block 0
grow_buffers: requested out-ot-range block 1844... for device ram0
isofs_fill_supper: bread failed, dev=ram0, iso_blknum=17, block=-21474...
List of all partitions:
No filesystem could mount root, tried iso9660
Kernel panic - not syncing: VFS: Unable to mount root fs on unknown-block(1,0)