Xen on ARM and Yocto

From Xen
Jump to navigationJump to search

Follow these instructions to cross-compile a minimal Dom0 initramfs with all the Xen tools for ARM64 platforms. The build runs on x86 machines, while the target is ARM64 platforms.

First we need to clone the Yocto and meta-virtualization repositories and checkout the right branches. Here we are using the krogoth release.

git clone http://git.yoctoproject.org/git/poky
cd poky
git checkout -b krogoth origin/krogoth
git clone https://git.yoctoproject.org/git/meta-virtualization
cd meta-virtualization
git checkout -b krogoth origin/krogoth
cd ..
git clone git://git.openembedded.org/meta-openembedded
cd meta-openembedded
git checkout -b krogoth origin/krogoth
cd ..

Make sure to also checkout the following if your target is a Xilinx MPSoC board:

git clone https://github.com/Xilinx/meta-xilinx.git
cd meta-xilinx
git checkout -b krogoth origin/krogoth
cd ..

Add xen_4.8.0.bb to meta-virtualization/recipes-extended/xen, make sure to edit the file to specify the git url, branch and revision you want to be built. Then execute:

source oe-init-build-env

Manually edit conf/bblayers.conf, add the following, where /local/repos/yocto is the directory where you cloned poky previously:

BBLAYERS ?= " \
  /local/repos/yocto/poky/meta \
  /local/repos/yocto/poky/meta-poky \
  /local/repos/yocto/poky/meta-yocto-bsp \
  /local/repos/yocto/poky/meta-openembedded/meta-oe \
  /local/repos/yocto/poky/meta-openembedded/meta-python \
  /local/repos/yocto/poky/meta-openembedded/meta-networking \
  /local/repos/yocto/poky/meta-virtualization \
  /local/repos/yocto/poky/meta-xilinx \
  "

Edit conf/local.conf, add the following, making sure to set MACHINE to your target platform (here we are using zcu102-zynqmp as reference):

MACHINE ??= "zcu102-zynqmp"
IMAGE_INSTALL_append = " dropbear"

INITRAMFS_IMAGE = "core-image-minimal"
INITRAMFS_IMAGE_BUNDLE = "1"
IMAGE_FSTYPES += "cpio.gz"
  
DISTRO_FEATURES_append=" xen"
IMAGE_INSTALL_append = " dropbear xen-base zlib-dev libsdl libsdl-mixer"
ASSUME_PROVIDED += "iasl-native"

Finally lunch the build!

bitbake core-image-minimal

The output will be found under build/tmp/deploy/images.