Running Kernel Image and RootFS on QEMU

Home / Running Kernel Image and RootFS on QEMU

Running Kernel Image and RootFS on QEMU

December 5, 2015 | Article | No Comments

On previous article, we have discussed about QEMU installation on Slackware64. In this article we will discuss about how to test QEMU-KVM to run kernel image and rootfs, specifically for ARM embedded system.

In this article, I use:

  1. Slackware64 14.0
  2. Debian ARM

Our goal is to demonstrate QEMU for running kernel image and a rootfs. In specific, we will try to run a Debian installer.

Acquiring the Required Package

As stated before, we will use Debian for ARM. There are two files we need to obtain: the kernel and the initrd.gz. You can download them by using this command:

export SITE=ftp://ftp.debian.org/debian/dists/wheezy/main/installer-armel/current/images/versatile/netboot
wget ${SITE}/vmlinuz-3.2.0-4-versatile
wget ${SITE}/initrd.gz

You may create a directory if you want to keep all the files grouped.

Creating Raw Virtual Hard Disk

Next is creating raw virtual hard disk. At least we need 2GB for storage / image. For that purpose we can create image by:

qemu-img create -f raw hda.img 2G

The -f is for specifying what format of virtual hard drive, which is raw in this case.

Running Virtual Machine with QEMU

Now, the final step. We will running the virtual machine. To do that, invoke this command:

qemu-system-arm -m 256 -M versatilepb -kernel vmlinuz-3.2.0-4-versatile \
-initrd initrd.gz -hda hda.img -append

The command is actually self-explaining. We run machine and gives it 256MB RAM with kernel vmlinuz-3.2.0-4-versatile and initial ramdisk initrd.img, as downloaded.

Now, have fun 😀

, ,

About Author

about author

xathrya

A man who is obsessed to low level technology.

Leave a Reply

Your email address will not be published. Required fields are marked *

Social media & sharing icons powered by UltimatelySocial