QEMU

ARM user-mode emulation

The following guide is based on Explorig BeagleBone Chapter 7.

Install an armhf chroot jail. Note the commandline specifies the version of the debian distribution, i.e., wheezy, and the utilities to include.

$ sudo mkdir /newchroot
$ sudo apt-get install debootstrap
$ sudo deboostrap --foreign --verbose --arch=armhf --include=aptitude,iputils-ping,module-init-tools,ifupdown,ipfroute,nano,wget,udev wheezy /newchroot http://ftp.us.debian.org/debian

Install qemu user-mode tools

$ sudo apt-get install qemu-user-static
$ sudo cp /us/bin/qemu-user-static /newchroot/usr/bin

Now you can test it by entering the jail:

$ sudo chroot /newchroot/
# uname -a

Set root password for the jail

# cd /debootstrap
# ./debootstrap --second-stage
# passwd

Install toolchain in the chroot jail

$ sudo chroot /newchroot/
# apt-get update
# apt-get install build-essential

Now the jail is ready for you to develop and run programs for ARM/Debian Linux systems. In the jail, you do not need prefix gcc with -arm-linux-gnueabihf anymore. By default, gcc and all binary utilies are ARM binaries and produce/operate ARM binaries. It is no-longer cross-development: you are developing ARM/Linux programs in an emulated ARM/Linux environment now. If you transport the output binaries to an ARM/Linux system like BBB, they will be ready to run there.

ARM system emulation

We will use QEMU to emulate a Versatile Express board: vexpress-a9

Use QEMU's manual Section 3.3 to understand the command line options

Versatile Express with Cortext-A9

BeagleBoard

We need Linaro's version of QEMU for BeagleBoard. You will need to compile it from source.

$ git clone git://git.linaro.org/qemu/qemu-linaro.git
$ cd qemu-linaro/
$ ./configure --target-list=arm-softmmu,arm-linux-user
$ make -j`getconf _NPROCESSORS_ONLN`
$ sudo make install
Note getconf_NPROCESSORS_ONLY returns the number of cores available in the system.