I am trying to boot a machine using a version of the kernel (linux- - unpatched) that I have compiled and mount a small root filesystem.

I have created a small ext2 file system using the following:

dd if=/dev/zero of=rootfs.img bs=1k count=8000
mkfs.ext2 -i 1024 -F rootfs.img

I have populated in accordance with the following guide: http://blog.braslavsky.org/2010/01/embedded-linux-from-scratch-in-90.html So it has the necessary busybox binaries and an init script to run.

This all works fine when launching using QEMU to emulate a real machine i.e. the Kernel loads and mounts the rootfs e.g.:

qemu-system-x86_64 -m 64 -hda ./rootfs.img -kernel linux- -append "root=/dev/sda init=/sbin/init"

However, I've tried to add my kernel binary (bzImage) and my rootfs (rootfs.img) to a VM running fedora 22 so that I can boot it using that. I've added the kernel to /boot and renamed it as appropriate. I then ran grub update or similar to regenerate /boot/grub2/grub.cfg and it successfully picked up my new kernel. All seemed well and I now get a boot loader menu for the VM.

I've tried to manually edit the grub.cfg file to mount my file system e.g. root=/rootfs.img.

However, when trying to boot the kernel, it loads but stalls complaining that it can't mount that particular VFS and throws a kernel panic.

Any ideas? Am I specifying my root file system incorrectly? I've even tried converting my rootfs to ext3, but it does not make a difference.

Is my approach doomed to fail?

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.