I’ve been searching for an easy way to develop openFrameworks for Raspberry Pi. One of the first things I thought is to emulate the hardware in a virtual machine and run raspbian on it. This is a small guide on how to do that on OSX using QEMU, I tried Raspbian wheezy 2014-01-07 within Mavericks.
I came across then with this post: http://igor.gold.ac.uk/~mas01mjy/wp/?p=95
It doesn’t work right now, so I collect a little bit of info and want to share my experience here.
0. You should have installed Xcode and the command line tools from Apple Developer site (free registration required), or if you are under OSX 10.9 you can open a terminal and type “
1. The first actual thing to do is to install MacPorts.
2. After the installation is complete, open a terminal window and type: “
sudo port install qemu +target_arm“. Enter your password and wait till is finished. This will install qemu with the right compiler for the Raspberry Pi hardware.
3. Meanwhile you can create a folder somewhere in your drive to put the downloads inside. We need two files: the Raspbian image and a working kernel. I changed the raspbian image name to raspbian.img and put into my path: Users/Myself/RPI/
4. Once everything is downloaded we can open a terminal and navigate to your own folder, for example: “
5. 1st. Boot. We need to make a small change before we can actually boot into the system. In the terminal type: “
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 raspbian.img“.
After the kernel boots you will be presented with a prompt like that: ‘root@(none):/#’ We need to comment a line in a file to be able to boot into the image. Type “
nano /etc/ld.so.preload“. It will open the nano text editor. To comment the first line in the file we have to put a # symbol at the beginning. It should look like that: “#/usr/lib/arm-linux-gnueabihf/libcofi_rpi.so”. Press ‘ctrl+x’ to exit and press ‘y’ to save your changes. Back in the prompt type “
halt” and close the qemu window.
6. 2nd and subsequent boots. Inside your path, in my case ‘Users/Myself/RPI/’ type the following in the terminal app: “
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" -hda raspbian.img“. I recommend to save this command in the name of a text file for later use.
That’s all, you are now supposed to be able to login with the username ‘pi’ and the password ‘raspberry’. Now you have a fully functional virtual machine running Raspbian wheezy. Here’s a video with the boot up: