How do you create a linux (RHEL) bootdisk that runs busybox in a ramdisk (initrd)?

I’ve been trying to create a bootdisk (something like a live-cd) which loads into memory-only without mounting the disk. My steps are listed below, but when I boot using the cd, I get:

Kernel Panic - not syncing: VFS: unable to mount root fs on unknown-block (9,1)

Here’s what I am doing to create the boot disk:

  1. Create a ramdisk using the mkinitrd tool, then decompress:

    mkinitrd myrd $(uname -r)
    mkdir myrdroot && cd myrdroot
    dd if=../myrd bs=1k | gunzip | cpio -id

  2. Git rid of nash, the init (nash script) and modprobe (a symlink to nash)

    rm -f init bin/nash bin/modprobe

  3. Install busybox (Busybox is default config, except it’s statically linked). Busybox will create a linuxrc and an sbin/init in myrd.

    pushd ~/busybox
    make CONFIG_ROOT=/path/to/myrd install
    popd

  4. rebundle the inird:

    find . | cpio -n -o | gzip -9 > ../myrd.img

This ramdisk is then used with ISOLINUX on a CD. I copy over the kernel that matches $(uname -r), and configure ISOLINUX to boot the kernel with the ramdisk.

Answer

It looks like the problem is related to the CPIO archive format. When I create the ramdisk using ext2/gzip format, it works.

Attribution
Source : Link , Question Author : JeffG , Answer Author : JeffG

Leave a Comment