Developing for non-x86 targets using QEMU

Rob Landley and Mark Miller

Impact Linux, LLC

http://impactlinux.com

Saturday, September 26, 2009

Introduction

Emulation allows even casual hobbyist developers to build and test the software they write on multiple hardware platforms from the comfort of their own laptop.

QEMU is rapidly becoming a category killer in open source emulation software, capable of not only booting a Knoppix CD in a window but booting Linux systems built for ARM, MIPS, PowerPC, SPARC, sh4, and more.

This talk covers application vs system emulation, native vs cross compiling (and combining the two with distcc), using QEMU, setting up an emulated development environment, real world scalability issues, using the Amazon EC2 Cloud, and building a monster server for under $3k.

Advantages of cross-compiling

Disadvantages of cross-compiling

Advantages of native compiling on real hardware

Disadvantages of native compiling on real hardware

What do we want?

Compiling under emulation

QEMU Application Emulation

QEMU System Emulation

Obtaining a development environment for QEMU

Using Prebuilt Binaries

Building a development environment from source

Understanding your build environment

Reinventing the wheel

Package Management and Accidental Distros

Buildroot Example

Orthogonal layers

Downloading Source

Host Tools

Create a Cross-Compiler

Cross-compile a root filesystem

Package a system image

Alternatives to packaging

Booting a system under QEMU

QEMU Command Line Options

qemu -nographic -no-reboot -kernel zImage-i686 -hda image-i686.sqf -append "root=/dev/hda rw init=/usr/sbin/init.sh panic=1 PATH=/usr/bin console=ttyS0"

Troubleshooting

Using your emulated development environment

Getting data in/out of the emulator

Debugging

Interacting with upstream package maintainers

Performance considerations

Questions?