Xen on ARM and Yocto

From Xen
Revision as of 17:33, 24 October 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 http://github.com/cazfi/meta-games.git $ 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

meta-games is needed for sdl but freeciv causes issues with warrior. Let's remove it:

$ rm -rf meta-games/recipes-games/freeciv/

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-games \
/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 libsdl-net libsdl-mixer"
ASSUME_PROVIDED += "iasl-native"
IMAGE_INSTALL_append = " dropbear" 
INITRAMFS_IMAGE = "core-image-minimal"
INITRAMFS_IMAGE_BUNDLE = "1"

You also need to add the following if you are using meta-xilinx:

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

and also add 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.