Installing Xen Support on Xilinx ZynqMP

Installing Xen Support on Xilinx ZynqMP

This blog post summarizes how to install and run Xen with Linux as Dom0 from an SD card on the ZCU102 Rev 1.1 development board by Xilinx.
The method is based on a Yocto-generated build but includes a few manual adjustments to enable Xen hypervisor support without embedding it directly in the Yocto recipes. This approach is useful for debugging, experimenting with boot configurations, and staying flexible.

Boot Script

The following U-Boot script is used to load Xen, Linux, and the device tree blob (DTB) from the SD card. It also demonstrates how to patch the FDT in memory before booting.

setenv xen_addr 0x80000
fatload mmc 0:1 ${xen_addr} xen
setenv fdt_addr 0x1000000
fatload mmc 0:1 ${fdt_addr} system.dtb
fatload mmc 0:1 0x2000000 Image
booti ${xen_addr} - ${fdt_addr}

# Modify FDT in RAM if needed
fdt add
fdt addr ${fdt_addr}
fdt resize
fdt print /chosen
fdt set /chosen bootargs "root=/dev/mmcblk0p2 rw quiet loglevel=0"
fdt set /axi/usb@ff9d0000 status "disabled"

booti ${xen_addr} - ${fdt_addr}

Generate Boot Script Image

Convert your boot.cmd into a bootable U-Boot script image:

mkimage -A arm -T script -C none -n "Xen boot script" -d boot.cmd boot.scr

Set Static IP

If you’re running a minimal Linux system (e.g. via Yocto), network configuration is likely managed by systemd-networkd.

Create or edit:

/etc/systemd/network/10-eth0-static.network

[Match]
Name=eth0

[Network]
Address=192.168.1.100/24
Gateway=192.168.1.1
DNS=8.8.8.8

Disable DHCP (if present)

Check for any .network files with DHCP=yes. If found, rename or remove them to prevent conflicts.

Enable and Restart Networking

systemctl enable systemd-networkd
systemctl restart systemd-networkd

Add Xen Support to the Device Tree

In order for U-Boot and Xen to cooperate, the DTB must be modified to include a chosen node with Xen-specific fields.
Edit the file zynqmp-zcu102-revA.dts and replace or add the following section:

chosen {
    #address-cells = <2>;
    #size-cells = <1>;

    stdout-path = "serial0:115200n8";
    bootargs = "earlycon console=dtuart";

    xen,dom0-bootargs = "console=hvc0 root=/dev/mmcblk0p2 rw earlycon";

    module@0 {
        compatible = "multiboot,module", "multiboot,kernel";
        reg = <0x00000000 0x02000000 0x02000000>;
    };
};

This tells Xen how to find the kernel and pass the correct boot arguments to Linux running as Dom0.


Rebuilding the Kernel and Device Tree

The kernel and DTS sources are usually located under Yocto’s tmp/work-shared directory.
However, it is recommended to extract them into a standalone repository for ease of modification, version control, and iterative compilation.

Example:

make ARCH=arm64 CROSS_COMPILE=aarch64-unknown-linux-gnu- dtbs

Create xen.ub

The xen.ub is a multi-image that bundles Xen, Linux, and the modified device tree into a single U-Boot-friendly file.
It’s typically placed under:

tmp/deploy/images/zcu102-zynqmp/

Steps:

  1. Recompile your modified device tree:
make ARCH=arm64 CROSS_COMPILE=aarch64-unknown-linux-gnu- dtbs
  1. Replace the deployed DTB:
cp ./arch/arm64/boot/dts/xilinx/zynqmp-zcu102-revB.dtb ./tmp/deploy/images/zcu102-zynqmp/system.dtb
  1. Create the multi-image:
mkimage -A arm64 -T multi -C none -n "Xen Image" -d xen:Image:system.dtb xen.ub

Create the SD Card

Use fdisk to create two partitions on the SD card:

  1. FAT32
  2. ext4 (Linux)

Example (GPT layout):

sudo fdisk /dev/sdX
# Use 'n' to create partitions, and 't' to set type (e.g., type c for FAT32)

mkfs.vfat /dev/sdX1
mkfs.ext4 /dev/sdX2

Copy Files:

Copy the following to the FAT32 partition:

  • xen.ub
  • boot.scr
  • Image (Linux kernel)
  • system.dtb

Manual U-Boot Script Execution

To run your boot script manually from the U-Boot shell:

load mmc 0:1 ${loadaddr} boot.scr
source ${loadaddr}

This is useful for debugging or testing different configurations without reflashing the board.

Comments
comments powered by Disqus