Xen on ARM and Yocto

From Xen
Revision as of 01:59, 9 November 2019 by StefanoStabellini (talk | contribs)
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. In this example, we are targeting Xilinx Zynq MPSoCs.

Firstly clone the poky, we are using the warrior release:

$ git clone -b warrior http://git.yoctoproject.org/git/poky
$ cd poky

Download and install the relevant meta repositories:

$ git clone -b warrior http://git.openembedded.org/meta-openembedded
$ git clone -b warrior https://git.yoctoproject.org/git/meta-virtualization

The following is specific to Xilinx:

git clone -b warrior https://github.com/Xilinx/meta-xilinx.git

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

BBLAYERS ?= " \
/scratch/repos/poky/meta \
/scratch/repos/poky/meta-poky \
/scratch/repos/poky/meta-yocto-bsp \
/scratch/repos/poky/meta-openembedded/meta-oe \
/scratch/repos/poky/meta-openembedded/meta-filesystems \
/scratch/repos/poky/meta-openembedded/meta-python \
/scratch/repos/poky/meta-openembedded/meta-networking \
/scratch/repos/poky/meta-virtualization \
/scratch/repos/poky/meta-xilinx/meta-xilinx-bsp \
/scratch/repos/poky/meta-xilinx/meta-xilinx-contrib \
/scratch/repos/poky/meta-xilinx/meta-xilinx-standalone \
"
INHERIT += "externalsrc"
EXTERNALSRC_pn-xen = "/scratch/repos/xen"
EXTERNALSRC_BUILD_pn-xen = "/scratch/repos/xen"

Edit conf/local.conf, add the following or making sure they match if already present (MACHINE is the target platform, here we are using zcu102-zynqmp as reference):

MACHINE ??= "zcu102-zynqmp"
DISTRO = "poky"
IMAGE_FSTYPES += "cpio.gz"
DISTRO_FEATURES_append=" xen"
IMAGE_INSTALL_append = " busybox dropbear xen-base zlib-dev"
ASSUME_PROVIDED += "iasl-native"
PACKAGECONFIG_remove_pn-xen += " sdl"

Sdl is enabled by default in the Xen build but it is not actually necessary. If you would like to build QEMU to provide PV backends, such as disk and 9pfs, then you need to add to conf/local.conf:

IMAGE_INSTALL_append += " qemu" PACKAGECONFIG_pn-qemu += " virtfs xen fdt" PACKAGECONFIG_remove_pn-qemu += " sdl" QEMU_TARGETS = "i386 aarch64"

If you are using meta-xilinx and building for zcu102-zynqmp, then you also need the following in conf/local.conf:

BBMULTICONFIG ?= "pmu"
do_image[mcdepends] = "multiconfig::pmu:pmu-firmware:do_deploy"

and the following to conf/multiconfig/pmu.conf:

MACHINE="zynqmp-pmu" 
DISTRO="xilinx-standalone" 
TMPDIR="${TOPDIR}/pmutmp"


Finally lunch the build!

bitbake core-image-minimal

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