Skip to content
Dhruv Vyas edited this page Sep 16, 2015 · 23 revisions

Welcome to the qemu-rpi-kernel wiki!

Emulation could be necessary aspect of embedded system development and Qemu is the right open source tool to do so for linux based SBCs.

To emulate RPi on Qemu, you will need two necessary files.

  1. Rpi kernel
  2. Rpi rootfs (That would be second portion of official .img file)

You will also need to have latest Qemu for your OS. Go to official (http://wiki.qemu.org/Download).

You can probably download Qemu by using package manager as well.

  1. For ubuntu (and any debian based OSes):

sudo apt-get install qemu

  1. For Mac OS X :

brew install qemu

  1. For windows users :

You will have to download Qemu installer.

Once, Qemu installed and you have necessary files for emulation as mentioned above, Follow these particular steps for emulating RPi.

  1. qemu-system-arm -kernel kernel-qemu -cpu arm1176 -m 256 -M versatilepb -no-reboot -serial stdio -append "root=/dev/sda2 panic=1 rootfstype=ext4 rw init=/bin/bash" -hda .img

  2. You should get # prompt (bash) at the end of processing.

  3. nano /etc/ld.so.preload

  4. Comment the 1st line saying /usr/lib/arm-linux-gnueabihf/libcofi_rpi.so by putting # in front of it.

  5. Now, nano /etc/udev/rules.d/90-qemu.rules

  6. Add these lines.

KERNEL=="sda", SYMLINK+="mmcblk0" KERNEL=="sda?", SYMLINK+="mmcblk0p%n" KERNEL=="sda2", SYMLINK+="root"

  1. sudo power

  2. Re-emulate by this command, qemu-system-arm -kernel kernel-qemu -cpu arm1176 -m 256 -M versatilepb -serial stdio -append "root=/dev/sda2 panic=1 rootfstype=ext4 rw" -hda <raspbian-image>.img

Key notes :

You can have maximum ram upto 256 only as there's a bug in versatilepb which doesn't allow to emulate more than 256 MB.

You might want to set up ssh by adding this extra flag while using Qemu. -redir tcp:2222::22

Hope it helps.

Clone this wiki locally