PetaLinux/Pynq in QEMU HowTo


Before stepping into the virtio acceleration, we will build and run a Linux(PetaLinux) in FPGA.

Despite the poor performance of simulation in X86, it’s very convenient to create POC.

We choose MPSoC zcu106(PS) to test ARM, Zynq zc702(PS) to test ARM and Kintex UltraScale kcu705(PL) to test MicroBlaze softcore.

0. Essential tools

OS: Ubuntu 16.04 Desktop

Vivado: 2019.1

Xilinx SDK: 2019.1

PetalLinux SDK:  PetaLinux 2019.1

BSP: Evaluation Board BSP or generated from Vivado/Xilinx SDK

1. Build QEMU

QEMU is in the PetaLinux SDK directory, it’s not necessary to rebuild if you do not wanna modify anything.

git clone git://
cd qemu
apt install libglib2.0-dev libgcrypt20-dev zlib1g-dev autoconf automake libtool bison flex libpixman-1-dev
git submodule update --init dtc
./configure --target-list="aarch64-softmmu,microblazeel-softmmu" --enable-fdt --disable-kvm --disable-xen
make -j4


2. PetaLinux Project

2.1. Create Project

petalinux-create -t project -n zcu106_arm_a53 --template zynqMP -s ../bsp/xilinx-zcu106-v2019.1-final.bsp
petalinux-config # Decide what to build


After the project created, pre-built images is in directory pre-built. You can test it via petalinux-boot

petalinux-boot --qemu --prebuilt 3 # Start ZCU106 virtual machine with prebuilt kernel


To accelerate the sstate mirror check process, you need download the sstate cache in Ref [5].

If you are using petalinux as root, you need modify sanity.conf like this:

cat /opt/petalinux/v2019.1/components/yocto/source/aarch64/layers/core/meta/conf/sanity.conf

# Sanity checks for common user misconfigurations
# See sanity.bbclass
# Expert users can confirm their sanity with "touch conf/sanity.conf"
BB_MIN_VERSION = "1.39.1"

SANITY_ABIFILE = "${TMPDIR}/abi_version"


#INHERIT += "sanity"

2.2. Build Kernel/Rootfs


3. Boot from QEMU

3.1. Debug

petalinux-boot --qemu --prebuilt 3


3.2. Run with self-compiled-QEMU

/root/Desktop/qemu_zynq_devices/qemu/aarch64-softmmu/qemu-system-aarch64 \
-M arm-generic-fdt-7series -machine linux=on -smp 2 -m 1G \
-serial /dev/null -serial mon:stdio -display none \
-kernel images/linux/uImage -dtb images/linux/system.dtb

Now we’ll add sdcard and try to boot Ubuntu Core OS.

qemu-img create qemu_sd.img 2G
-M arm-generic-fdt-7series -machine linux=on -smp 2 -m 1G \
-serial /dev/null -serial mon:stdio -display none \
-kernel images/linux/uImage -dtb images/linux/system.dtb


4. Co-Sim


5. Boot from Evaluation Board SDCard



[1] Build QEMU:

[2] Zynq UltraScale+ QEMU:

[3] CoSim:

[4] Xilinx Evaluation Board BSP files and Yocto local mirror: