You are on page 1of 8

Hardware Emulation in QEMU

Suchakra

Embedded Design Center, COEP

March 26, 2011

Suchakra Kernel, RootFS for an Emulated ARM Machine


Introducing QEMU

What is QEMU?
QEMU is a open source machine emulator and virtualizer

What are we gonna do with it?


Machine Emulation - Emulating ARM, MIPS, PowerPC
QEMU can run OSes and programs made for one machine
(e.g. an ARM board) on a different machine (e.g. your own
PC)

Suchakra Kernel, RootFS for an Emulated ARM Machine


Emulation Technique

What QEMU does essentially is instruction set conversion during


runtime from target to host

Details about QEMU’s operation 1

1
http://lugatgt.org/2009/01/28/qemu-internals/
Suchakra Kernel, RootFS for an Emulated ARM Machine
Using QEMU for ARM Emulation

Setup Your System


yum install qemu-system-arm
apt-get install qemu qemu-kvm-extras

On Embedded Studio VM
All tools are already setup -
cd Desktop/tools/qemu-experiments

Suchakra Kernel, RootFS for an Emulated ARM Machine


Building Kernel and RootFS

Kernel Compilation
tar -xvf linux-2.6.29.tar.gz
cd linux-2.6.29
cd arch/arm/configs
make ARCH=arm versatile defconfig
cd ../../../
make ARCH=arm menuconfig
make ARCH=arm CROSS COMPILE=arm-linux- all

Running a User Application


arm-none-linux-gnueabi-gcc -static test.c -o test
echo test | cpio -o --format=newc > test rootfs
-
qemu-system-arm -M versatilepb -m 128M -kernel
path/to/zImage -initrd path/to/test rootfs -append
"root=/dev/ram rdinit=/test"
Suchakra Kernel, RootFS for an Emulated ARM Machine
Building Kernel and RootFS

BusyBox - A minimal RootFS


export ROOTFS PATH=path/of/your/choice/for/rootfs
-
wget
http://www.busybox.net/downloads/busybox-1.16.0.tar.bz2
tar jxf busybox-1.16.0.tar.bz2
cd busybox-1.16.0
make ARCH=arm CROSS COMPILE=arm-linux- defconfig
make ARCH=arm CROSS COMPILE=arm-linux- menuconfig
-
(BusyBox Settings – Build Options – Static Executable)
-
make ARCH=arm CROSS COMPILE=arm-linux- install
cd install
find . | cpio -o --format=newc > ../../rootfs.img

Suchakra Kernel, RootFS for an Emulated ARM Machine


Testing The System

qemu-system-arm -M versatilepb -m 128M -serial stdio


-kernel path/to/zImage -initrd path/to/rootfs.img
-append "root=/dev/ram rdinit=/bin/sh"

Suchakra Kernel, RootFS for an Emulated ARM Machine


Thats All Folks!!

Get me @
suchakra [at] gmail [dot] com
http://suchakra.wordpress.com
Twitter Handle : @tuxology

Suchakra Kernel, RootFS for an Emulated ARM Machine

You might also like