Home > Freescale i.MX, Linux, Linux 2.6, Texas Instruments OMAP 3 > Qemu Linaro Versatile Express Image on Ubuntu 10.10

Qemu Linaro Versatile Express Image on Ubuntu 10.10

I’ve installed qemu-linaro and run an ARM image based on the instructions on https://wiki.linaro.org/PeterMaydell/QemuVersatileExpress. I used Ubuntu 10.10 desktop edition.

First, install the Linaro images tools:

sudo apt-get install linaro-image-tools

Download the Linaro release and versatile hardware pack:

wget http://releases.linaro.org/platform/linaro-n/nano/alpha-3/linaro-natty-nano-tar-20110302-0.tar.gz
wget http://releases.linaro.org/platform/linaro-n/hwpacks/alpha-3/hwpack_linaro-vexpress_20110302-0_armel_supported.tar.gz

You can download another hwpack for omap3, i.mx51, pandaboard, beagleboard, ST U8500, etc.. if needed at http://releases.linaro.org/platform/linaro-n/hwpacks/alpha-3/

Download the source, extract it, then configure, build and install qemu linaro:

wget http://launchpad.net/qemu-linaro/trunk/2011.03-1/+download/qemu-linaro-0.14.50-2011.03-1.tar.gz
tar xzvf qemu-linaro-0.14.50-2011.03-1.tar.gz
cd qemu-linaro-0.14.50-2011.03-1
./configure –prefix=/usr
sudo make install

Make sure the prefix is set to /usr in order to overwrite any previous version of Qemu (It installed qemu linaro in /usr/local/ instead in my case). Failure to do so may generate the following error during linaro-media-create:

qemu: fatal: cp15 insn ee1d6f70

Instead of compiling qemu, you can install qemu-linaro with apt-get (this will avoid possible version issues between linaro-media-create and qemu):

sudo add-apt-repository ppa:linaro-maintainers/tools
sudo apt-get update
sudo apt-get install qemu-user-static qemu-system

Create a 2GB image file (it takes a while) based on the image and hwpack:

linaro-media-create –image_file vexpress.img –dev vexpress –console ttyAMA0,38400n8 –binary linaro-natty-nano-tar-20110302-0.tar.gz –hwpack hwpack_linaro-vexpress_20110302-0_armel_supported.tar.gz

It will automatically install some required tools during that step (debootstrap, qemu-arm-static and qemu-kvm-extras-static…) enter ‘Y’ to accept the installation of those tools.

Now you need to extract the kernel and initrd from the image file. To do this we must find the starting sector of the second partition and multiply it by the sector size to get a byte offset:

file vexpress.img
vexpress.img: x86 boot sector; partition 1: ID=0xe, active, starthead 1, startsector 63, 144522 sectors; partition 2: ID=0×83, starthead 0, startsector 144585, 4048380 sectors, code offset 0×0
$ dc -e ’144585 512 * p’

…and then loopback mount the file and copy out the kernel:

sudo mount -o loop,offset=74027520 -t auto vexpress.img /mnt/mnt/
cp /mnt/mnt/boot/* .
sudo umount /mnt/mnt

and you can run qemu like this:

qemu-system-arm -kernel vmlinuz-2.6.37-1003-linaro-vexpress -M vexpress-a9 -cpu cortex-a9 -serial stdio -m 1024 -initrd initrd.img-2.6.37-1003-linaro-vexpress -append ‘root=/dev/mmcblk0p2 rw mem=1024M raid=noautodetect console=ttyAMA0,38400n8 rootwait vmalloc=256MB devtmpfs.mount=0′ -sd vexpress.img

Digg This
Reddit This
Stumble Now!
Buzz This
Vote on DZone
Share on Facebook
Bookmark this on Delicious
Kick It on DotNetKicks.com
Share on LinkedIn
Bookmark this on Technorati
Post on Twitter

Categories: Freescale i.MX, Linux, Linux 2.6, Texas Instruments OMAP 3 Tags: linaro, qemu, ubuntu
  1. Pratik
    September 9th, 2011 at 17:57 | #1

    First of all thanks for nice tutorial,
    I am trying to emulate linaro image for IGEPv2, This is my command line,

    qemu-system-arm -M realview-pb-a8 –cpu cortex-a8 -m 1024 -sd ./linaro.img -append “console=ttyS2,115200n8 root=/dev/mmcblk0p2 rw” -serial stdio -kernel ./vmlinuz-2.6.35-1008-linaro-omap -initrd ./initrd.img-2.6.35-1008-linaro-omap

    but nothing happens only blanck screen.

  2. Alexey Smirnov
    November 22nd, 2011 at 19:59 | #3

    Thanks for this tutorial – BUT it does not work. I have a fresh Ubuntu-10.10 install and I follow the steps you describe precisely. But I get the qemu cp15 exception that you mentioned, even though I am pretty sure I have no other qemu installed on my Ubuntu.

    And qemu is indeed the problem, as after I replaced it things started to work. To replace it I had to run the following commands:

    sudo add-apt-repository ppa:linaro-maintainers/tools
    sudo apt-get update
    sudo apt-get install qemu-user-static qemu-system

  3. November 22nd, 2011 at 20:23 | #4

    @Alexey Smirnov
    I suppose linaro-media-create has been updated, but I gave the instructions to build qemu 0.14.5 so there is probably a version mismatch between qemu and linaro-media-create. I’ll update the post to use apt-get instead. Thanks for the comment.

  1. No trackbacks yet.