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
make
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=0x83, starthead 0, startsector 144585, 4048380 sectors, code offset 0x0
$ dc -e ‘144585 512 * p’
74027520
…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
Jean-Luc started CNX Software in 2010 as a part-time endeavor, before quitting his job as a software engineering manager, and starting to write daily news, and reviews full time later in 2011.
Support CNX Software! Donate via cryptocurrencies, become a Patron on Patreon, or purchase goods on Amazon or Aliexpress
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.
Thanks.
I can see another guy had a similar problem at http://balau82.wordpress.com/2010/03/22/compiling-linux-kernel-for-qemu-arm-emulator/. Check the comments by Robert Smith.
You can try to open another console using Ctrl + Alt + 3 to open a new console. The next comments (by Balau) also explain how to use GDB to check what may be the issue.
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
@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.
Iam getting this error please help me with a solution
sudo add-apt-repository ppa:linaro-maintainers/tools
/!\ WARNING – This PPA is devirtualized, which means: a) it builds on real buildds rather than virtual machines; b) it builds on armel and on other architectures usually not enabled on regular PPAs, but this uses our very precious armel buildds; please test build your packages on x86 before uploading here.
Archive for tools currently developed/improved by Linaro
More info: https://launchpad.net/~linaro-maintainers/+archive/ubuntu/tools
Press [ENTER] to continue or ctrl-c to cancel adding it