Seabright Technology Header Image

Running Raspbian inside Linaro QEMU

Raspbian is a hard float build of Debian wheezy for the ARMv6K processor in the Raspberry Pi. Here’s yet another set of instructions for running the image under QEMU, this time using the pre-built Linaro goodness that comes with Ubuntu Precise. This is a hack that happens to work – see Peter’s comment below for more.

The cliff notes are:

  • Install qemu-linaro: sudo apt-get install qemu-system
  • Grab this prebuilt 3.2 kernel
  • Download the latest Raspbian image. I used 2012-08-16-wheezy-raspbian.zip.torrent.
  • Unzip it
  • Run using
    qemu-system-arm -M versatilepb -cpu arm1176 -m 256 \
      -hda 2012-08-16-wheezy-raspbian.img -kernel zImage-raspbian-3.2 \
      -append "root=/dev/sda2 rootwait console=ttyAMA0" \
      -serial stdio -redir tcp:2222::22
  • Once booted, ssh in: ssh -p 2222 pi@localhost

The kernel is a ugly hack based on CNXSoft‘s notes. Basically:

  • Install Linaro GCC: sudo apt-get install gcc-arm-linux-gnueabihf
  • Grab the upstream 3.2 kernel. I used git and the v3.2 tag.
  • Apply a hack to build an ARMv6 Versatile PB
  • Use this .config
  • Build: ARCH=arm CROSS_COMPILE=arm-linux-gnueabihf- make -j4 zImage

The ARM Realview emulation would be a better choice but I was short on time and a plain build didn’t boot.

2 Comments

  1. Peter Maydell says:

    I should point out that running the ‘versatilepb’ board model with an ‘arm1176′ CPU is not really a supported combination — it doesn’t correspond to any real hardware and so the kernel may or may not handle it properly, and similarly it’s not an intended or tested config of QEMU. At some point we might put in warnings (or errors?) for trying to run QEMU with one of these unsupported combos…

    (In fact QEMU doesn’t have any board models for the 1176 CPU as far as I know; realview-eb would probably be closest but it’s possible we don’t get the 1176-specific detail correct. Or adding realview-pb-1176 support would probably not be too difficult. Patches welcome :-) )

  2. michaelh says:

    Edit: added a note on this being a hack that happens to work.

Leave a Reply