Cross Testing with QEMU

This document covers only setting up an environment for testing cross-compilers to arm-linux-gnueabi with qemu's Linux user emulation mode. While using qemu for testing be warned that this is only to speed up testing for the developer using a cross-build and this should be followed with the native bootstraps and tests that happen on a continuous basis in the Toolchain WG.

Before you start testing using these instructions you would have built an arm-linux-gnueabi cross-compiler with the libraries installed in a sysroot that resembles the root file system on the target.

Notes on the version of qemu

The version of qemu in maverick doesn't work because of a bug with decoding CP15 instructions in Thumb2 space. These instructions were written after this was tested using qemu-0.13.0 on a maverick host on x86_64-linux-gnu.

There might be some issues with testing Neon but we'll have to deal with it as we go along which will be an issue around some of the unpredictable Neon instructions.

Building qemu.

Typically I download qemu 0.13.0 , configure it with

ramana@...$ cd <qemu-src> && ./configure --target-list=arm-linux-user,arm-softmmu --enable-linux-user --prefix=<path where I want to install it> && make && make install

Using qemu in the GNU test harness.

export DEJAGNU=<whereever_installed>/site.exp cd $obj/gcc-final/ make check-gcc

And my site.exp looks like :

case "$target_triplet" in { 

   { "arm*-*-*eabi*" "arm*-*-elf*" "xscale*-*-elf*"} { 
     global SIM
     set target_list { "arm-sim" } 
     set board_info(arm-sim,sim,options) "-cpu cortex-a8 -L<path_to_rootfs>/sysroot" 
     set SIM "qemu-arm"
   } 
} 

The only disadvantage with this set up is that everytime you do a test you have to update your site.exp to point to the right directory for the purpose of running tests but that's just a sed everytime you want to run tests from a canned script after you've built your cross-compiler.

It takes about 200 minutes with a single threaded test run for c,c++,fortran on my laptop - it sure can be faster than that if you use make check -j<parallel> as appropriate for you.

WorkingGroups/ToolChain/CrossTestingQemu (last modified 2011-01-27 21:22:14)