In Linux, I've created the root file system (rootfs) by following commands:

dd if=/dev/zero of=ramdisk.img bs=1M count=4
mkfs.ext2 ramdisk.img
sudo mount -o loop ramdisk.img rootfs
sudo cp init rootfs 
sudo mkdir rootfs/dev
sudo mknod rootfs/dev/console c 5 1
sudo mknod rootfs/dev/ram b 1 0
sudo umount rootfs

but when I run qemu by following command, it say: No file system could mount root

qemu -kernel arch/x86/boot/bzImage  -initrd ../qemu-i386/ramdisk.img  -append "root=/dev/ram init=/init"

enter image description here

What the problem with my instructions?

  • 1
    The only thing immediately jumping out of me is that it should be root=/dev/ram0 not root=/dev/ram. Not sure if this is a strict requirement though. But the kernel docs explicitly say it should be /dev/ram0. – Patrick Dec 10 '13 at 14:01
  • @Patrick changing /dev/ram to /dev/ram0 doen't works. Can you introduce me some resource to learn creating rootfs? – Milad Khajavi Dec 10 '13 at 14:44
  • 1
    I was just going off the initrd.txt file in the Documentation directory of the kernel source. Another thought, are you sure you have initrd support enabled in the kernel? I personally don't use initrd any more. Initramfs is the more modern way of doing init root filesystems. – Patrick Dec 10 '13 at 15:41

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.