QEMU for cross test

This page covers a basic QEMU system mode setup that allows cross testing of GLIBC and the toolchain binaries.

Also titled "Hey, look, another set of out of date instructions!".


Ubuntu Precise and later come with Linaro QEMU 2012.03.

Build a rootfs:

  • cd linaro-image-tools
  • ./linaro-media-create --image-file ../rootfs.img --dev vexpress-a9 --hwpack ~/Downloads/hwpack_linaro-lt-vexpress* --binary ~/Downloads/linaro-o-developer* --hwpack-force-yes

Pull out the kernel:

  • mcopy -i rootfs.img@@32256 ::* .

Start the image:

qemu-system-arm \
 -M vexpress-a9 -kernel uImage -m 1024 -initrd uInitrd \
 -append 'root=/dev/mmcblk0p2 rw rootwait mem=1024M console=ttyAMA0,38400n8' \
 -drive if=sd,cache=writeback,file=./rootfs.img \
 -clock unix -redir tcp:5022::22 -nographic

Setup the guest via the console:

  • apt-get update
  • apt-get install openssh-server
  • adduser cbuild
  • adduser cbuild admin

Add the entry to the host ~/.ssh/config:

Host qtest
    Port 5022
    Hostname localhost
    User cbuild


  • ssh-copy-id qtest
  • ssh qtest
  • sudo profit


Use SSH port forwarding when testing GDB server:

  • Ensure the host .gdbinit has target remote localhost:7777

  • Log into the guest using ssh -L 7777:localhost:7777 qtest

  • Start gdbserver :7777 hello-cc.elf

MichaelHope/Sandbox/QEMUCrossTest (last modified 2012-04-25 22:50:25)