Use the Rapsberry Pi with QEmu on Mac OS X

Warning : This article has been automatically translated by Bing Translate


Danger : This article has been automatically translated by Bing Translate


Caveat : This article has been automatically translated by Bing Translate

You may want to do tests with a Raspberry but without a handy. In another article, I had mentioned the ability to virtualize via VirtualBox. Today, It is to directly use Qemu on Mac OS.

qemu_logo

What do we need to get there ?

  • Xcode. You will need to download it from the AppStore
    App_Store
  • Xcode command-line tools. Go into Preferences, and in the download tab, install the tools from the command line. If you do not find the option, installation of HomeBrew will offer you.
  • HomeBrew
    ruby -e "$(curl -fsSL https://raw.github.com/mxcl/homebrew/go/install)"

    Raspberry Pi Home Server - Utiliser le Rapsberry Pi avec QEmu sous Mac OS X - Installer brew

Now it is time to move on to the configuration and installation !

  1. Install packages needed for compiling
    brew install pkg-config brew install glib brew link glib brew install apple-gcc42
  2. Start the installation of Qemu
    brew install qemu --env=std --use-gcc
  3. Contrôler le support du CPU
    qemu-system-arm -cpu ?

    There must be arm1176 in the list

  4. Retrieve a kernel suitable for emulation. You can download a sample here. You will need to unpack it first.

First start

For this first boot, You must configure the image to not load some libraries at boot. For this, you are going to start Qemu with the following command :

QEMU-system-arm - kernel zImage - cpu arm1176 m 256 -M versatilepb -no-reboot -serial stdio -append "root = / dev/sda2 rootfstype = ext4 elevator = deadline rw panic = 1 init = / bin/bash" -hda 2013-09-25-wheezy - raspbian.img

With this command, asked 256Mb memory, to load the image (the file IMG) as a device hda and start /bin/bash to have a shell without starting different services.

Once you have the hand, you need to put a # before each line (in principle it is a) file /etc/ld.so.preload. You save and you stop Qemu.

Second start

You will now use a classic boot, that is to say without asking a shell in the phase init :

QEMU-system-arm - kernel zImage - cpu arm1176 m 256 -M versatilepb -no-reboot -serial stdio -append "root = / dev/sda2 rootfstype = ext4 elevator = deadline rw panic = 1" -hda 2013-09-25-wheezy - raspbian.img

You will arrive after several (long) minutes, on the command screen raspi-config :

Raspberry Pi Home Server - Utiliser le Rapsberry Pi avec QEmu sous Mac OS X

At the exit you can shut down the system.

Third start-up (and the following)

You always use the same command. And according to your settings, You can arrive on the GUI, ready to make your project !

Raspberry Pi Home Server - Utiliser le Rapsberry Pi avec QEmu sous Mac OS X

Limitations, There are ofcourse. The most important for me is the non emulation of the GPIO. So if your project contains electronics, vous devrez toujours utiliser l’original 😉

Have fun !

Like this article ? Bear with me on patreon!

You may also like...