1 Overview

Running AXIOM Beta on qemu is important when you are testing or implementing things on AXIOM Beta. This wiki page will guild you to build and run AXIOM Beta on QEMU.

2 For the impatient

Clone https://github.com/apertus-open-source-cinema/axiom-beta-qemu and run the scripts.

Just be prepared to fix a bunch of typos in them :D

3 QEMU

Since we are using ZYNQ, we recommend to use the QEMU provided by Xilinx.

4 Build QEMU from Ubuntu

Downlading QEMU Source Code The Xilinx Zynq QEMU source code is available on the Xilinx Git server. You can download the source code using the following command.

       $ git clone git://github.com/Xilinx/qemu.git
       $ cd qemu

Above commands will clone the the source code form master branch of QEMU.

QEMU Dependencies If the configuring or building steps fails, it means it is possible because you are missing some build dependencies. Therefor you need to add relevant dependencies for the building process. On Ubuntu, most of the following dependencies will be installed. If you get any kind of issues, please try searching the errors on internet.

       $ sudo apt install libglib2.0-dev libgcrypt20-dev zlib1g-dev autoconf automake libtool bison flex

After installing the dependencies, you also need to include the sub modules which will need to be checked out. You can checkout the sub modules using the following command.

       $ git submodule update --init pixman dtc

Configuring QEMU You must configure the QEMU before you start building QEMU. Following command will configure the QEMU.

       $ ./configure --target-list="aarch64-softmmu,microblazeel-softmmu" --enable-fdt --disable-kvm --disable-xen

If you get any error on configuring QEMU, it means you haven't got dependencies correctly. Try installing dependencies again and also try checkout for the sub modules.

Building and installing QEMU After configuring, you can build QEMU using following command.

       $ make -j4
       $ sudo make install


5 Running AXIOM Beta on QEMU

Up to now, you have successfully build and installed the QEMU. Now lets talk about running the AXIOM Beta on QEMU.

Downloading AXIOM Beta image & settings First you need an image to run the QEMU. You can donwload the AXIOM Beta latest disk image form this [1] or using following command.

       $ wget http://vserver.13thfloor.at/Stuff/AXIOM/BETA/beta_20170109.dd.xz

This will be arround 3.7Gb. After downloading the disk image, you need to extract it. After extracting this image, it will cost around 16Gb. You can extract it using a extracting software or using following command.

       $ unxz beta_20170109.dd.xz

After extracting the disk image, you still can't start running the QEMU. You need to have .dtb file which describes the portions of the beta_20170109.dd image and u-boot file which describes the booting settings. You can dhttp://vserver.13thfloor.at/Stuff/AXIOM/BETA/devicetree.dtb.devicetree.dtb] and from this link [2] or you can download them using following commands.

       $ wget http://vserver.13thfloor.at/Stuff/AXIOM/BETA/devicetree.dtb
       $ wget http://vserver.13thfloor.at/Stuff/AXIOM/BETA/u-boot

After downloading this two files, you can start running the QEMU.

Running QEMU To run the AXIOM Beta on QEMU, first you need to have all beta_20170109.dd, devicetree.dtb and u-boot files on same folder. Then using the following command, you can boot the AXIOM Beta on QEMU.

       $ qemu-system-aarch64 -M arm-generic-fdt-7series -machine linux=on -m 1024 -serial /dev/null -serial mon:stdio -nographic -hw-dtb devicetree.dtb -kernel zImage -drive if=sd,format=raw,index=0,file=beta_20170109.dd -boot mode=5 -append "root=/dev/mmcblk0p2 ro rootwait rootfstype=ext4"

Notes This is the current image (Kernel 4.6.0). You can build any kernel version you want and run with QEMU using the same image. You can run QEMU for custom build Kernels. The process for build Kernel and running was explained in this [3] page.

6 Profiling the Beta firmware on QEMU

To access the monitor console while the Beta firmware is running, append this to the QEMU command line:

 -chardev socket,server,nowait,path=qemu.monitor,id=monsock \
 -mon chardev=monsock,mode=readline \

then, in a second terminal:

 socat - UNIX-CONNECT:qemu.monitor

There, you can type QEMU monitor commands.

For example:

 help
 info mtree

TODO:

- how to get a RAM or I/O trace - how to debug the operating system with GDB - any other kind of debugging info you may need

Useful links:

- http://nairobi-embedded.org/category/qemu.html