Saturday, July 13, 2013

Emulate Raspberry Pi - My Walk-through - Build QEMU on Ubuntu 12.04

Although i already have the real Pi on my desk, setting up the emulation can speed up compiling projects by using my desktop computer power.

I have a ubuntu 12.04 running on a AMD quad core machine that i think will be nice for emulation.
Lot of successful stories on the net.  The following is my version.


Emulation using QEMU

The command i need is 'qemu-system-arm'.  But the software manager somehow doesn't have 'qemu'.   (on newer os 'qemu' can be installed using software manager).

So I decided to build QEMU myself (reference: QEMU - Compiling for ARM (1176) emulation)

Steps:

1. set up environment
sudo apt-get install git zlib1g-dev libsdl1.2-dev libpixman-1-dev
mkdir ~/raspi
cd ~/raspi

2. download qemu latest source code from here.

3. uncompress qemu
tar jxvf qemu-1.5.1.tar.bz2

4. config, compile, and install are straight forward
  ./configure --help
  ./configure --target-list="arm-softmmu arm-linux-user" --enable-sdl --prefix=/usr
  make
  sudo make install

5. query supported chips including arm1176 for raspberry pi
qemu-system-arm -cpu ?


Disk Images

Emulation requires two files:  kernel and partition image

Steps:

1.  get kernel:
wget http://xecdesign.com/downloads/linux-qemu/kernel-qemu

2. get Raspbian from their site


It took a while for downloading the image.  Everyone said go for a coffee.  I went for a shower.  :P


Let's Roll it!

Now, run Emulation by one single command:

qemu-system-arm -cpu arm1176 -kernel kernel-qemu -name 'builder-raspi' -m 256 -M versatilepb -no-reboot -serial stdio -append "root=/dev/sda2 panic=0" -hda 2013-02-09-wheezy-raspbian.img


and ........  well!  it DOESN't work!

qemu booted up and stuck at an error, something "... Id '1' respawning too fast.  Disable for 5 minutes"

searched on the net...
It's the latest image having problem.  Some guys came up with a patch; i went for an older version of wheezy, 2012-10-28-wheezy-raspbian.img.

finally boot up successfully.   ^^

just in case, the default username is 'pi'.  password is 'raspberry'.


References:

Labels: ,

0 Comments:

Post a Comment

<< Home