FAQ Hero Banner

The Question and the Answer

Compiling qemu and zynq-linux
Compiling qemu and zynq-linux
Compiling qemu and zynq-linux
Question:

How do i get the qemu VM running on a 32 bit install of Linux?

Answer:

We have described how to get a VirtualBox VM running on Windows and launch the 64bit precompiled binary of the Zynq qemu Virtual Machine.

Here we will touch on how to get the qemu VM running on a 32 bit install of Linux.

Note: You will need a Xilinx login (free) to download some of these tools/packages/source code.

I will be running on Ubuntu LTS 10.04 32 bit for this how-to. I also will be doing everything as root. To make things easy for myself I just launch an instance of bash as root with the following command:

bash> sudo bash
[sudo] password for zynqgeek:

Ok, now that we are setup with root access, let's get into the nitty gritty. I will be using the Xilinx wiki page for qemu as a reference here.

http://wiki.xilinx.com/zynq-qemu

First, we need to download the qemu source from the git tree. Create a working folder that you will be using as scratch pad space. Mine is in /home/tim/user. Download the git source with this command:

bash> git clone git://git.xilinx.com/qemu-xarm.git

Note: if you do not have git installed, you can download it with this command:

bash> apt-get install git

Once you have git installed and pull down the source tree we can build qemu for our local system.  Note: this will require you to have the full gcc toolchain installed.  This blog isn't going to go into that, you can find more information about installing gcc here: http://gcc.gnu.org/install/

Ok, once git is done downloading about 110 or so MBytes you will see that a folder called qemu-xarm has been created.  Go into that directory.

bash> cd qemu-xarm

Again following the how-to posted on the Xilinx qemu wiki, we are going to configure the system to be built. We do this with the configure script and this command:

bash> ./configure --target-list=arm-softmmu --disable-werror --disable-kvm

Now, this might be where you dive into dependency hell. If you are running on Ubuntu 10.04 LTS and haven't installed anything using apt-get, here is the list-o-libs that you will need to download and install:

zlib: download the latest from http://www.zlib.net/ and do the following:

bash> tar -zxvf zlib-x.y.z.tar.gz
bash> cd zlib-x.y.x.tar.gz
bash> ./configure
bash> make
bash> make install

glib-2.0:  download the latest by using apt-get:

bash> apt-get install libglib2.0-dev

This should get you to a point where the ./configure command executes correctly. Now we need to build qemu:

bash> make

Assuming this executes correctly, you should end up with an executable called qemu-system-arm in the arm-softmmu folder. Next, we need to compile a version of Linux for our emulator. The Xilinx zynq-linux wiki does a great job of explaining how this is done. Note: the kernel is large, over a Gigabyte large - plan accordingly.

http://wiki.xilinx.com/zynq-linux#toc7

Also, you need to download the arm tool chain to actually be able to compile the kernel against the arm ARCH. The CodeBench Lite tools take a bit to install (java based installer).

http://wiki.xilinx.com/zynq-tools

A note on the .bin download, you may need to give it execution rights with chmod.

bash> chmod +x xilinx_2011.09-50-arm-xilinx-linux-gnueabi.bin

At the time of this blog post the wiki appeared to have an error in its export command.  This is the command that I used:

bash> export PATH=
/CodeSourcery/Sourcery_CodeBench_Lite_for_Xilinx_GNU_Linux/bin:$PATH

Once you have all the tools installed, the environment configured correctly, and the kernel compiled (which will take a while), we can move on to launching it with qemu! 

Compiling qemu and zynq-linux