Difference between revisions of "Xen on ARM and Yocto"

From Xen
Line 1: Line 1:
 
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.
 
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 yocto and meta-virtualization repositories and checkout the right branches. Here we are using the ''krogoth'' release.
+
Firstly clone the poky, we are using the ''warrior'' release:
   
git clone http://git.yoctoproject.org/git/poky
+
git clone -b warrior http://git.yoctoproject.org/git/poky
 
cd poky
 
cd poky
git checkout -b krogoth origin/krogoth
 
   
  +
Download and install the relevant meta repositories:
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
+
$ git clone -b warrior http://git.openembedded.org/meta-openembedded
  +
$ git clone http://github.com/cazfi/meta-games.git
cd meta-openembedded
 
  +
$ git clone -b warrior https://git.yoctoproject.org/git/meta-virtualization
git checkout -b krogoth origin/krogoth
 
cd ..
 
   
 
The following is specific to Xilinx:
 
The following is specific to Xilinx:
   
git clone https://github.com/Xilinx/meta-xilinx.git
+
git clone -b warrior https://github.com/Xilinx/meta-xilinx.git
cd meta-xilinx
 
git checkout -b krogoth origin/krogoth
 
cd ..
 
   
  +
meta-games is needed for sdl but freeciv causes issues with warrior. Let's remove it:
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:
 
   
  +
$ rm -rf meta-games/recipes-games/freeciv/
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:
+
Manually edit conf/bblayers.conf, add the following, where /scratch/repos/poky is the directory where you cloned poky previously:
 
BBLAYERS ?= " \
 
BBLAYERS ?= " \
/local/repos/yocto/poky/meta \
+
/scratch/repos/poky/meta \
/local/repos/yocto/poky/meta-poky \
+
/scratch/repos/poky/meta-poky \
/local/repos/yocto/poky/meta-yocto-bsp \
+
/scratch/repos/poky/meta-yocto-bsp \
/local/repos/yocto/poky/meta-openembedded/meta-oe \
+
/scratch/repos/poky/meta-openembedded/meta-oe \
/local/repos/yocto/poky/meta-openembedded/meta-python \
+
/scratch/repos/poky/meta-openembedded/meta-filesystems \
/local/repos/yocto/poky/meta-openembedded/meta-networking \
+
/scratch/repos/poky/meta-openembedded/meta-python \
/local/repos/yocto/poky/meta-virtualization \
+
/scratch/repos/poky/meta-openembedded/meta-networking \
/local/repos/yocto/poky/meta-xilinx \
+
/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, making sure to set MACHINE to your target platform (here we are using ''zcu102-zynqmp'' as reference):
+
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"
 
MACHINE ??= "zcu102-zynqmp"
  +
DISTRO = "poky"
IMAGE_INSTALL_append = " dropbear"
 
 
INITRAMFS_IMAGE = "core-image-minimal"
 
INITRAMFS_IMAGE_BUNDLE = "1"
 
 
IMAGE_FSTYPES += "cpio.gz"
 
IMAGE_FSTYPES += "cpio.gz"
 
 
DISTRO_FEATURES_append=" xen"
 
DISTRO_FEATURES_append=" xen"
IMAGE_INSTALL_append = " dropbear xen-base zlib-dev libsdl libsdl-mixer"
+
IMAGE_INSTALL_append = " busybox dropbear xen-base zlib-dev libsdl-net libsdl-mixer"
 
ASSUME_PROVIDED += "iasl-native"
 
ASSUME_PROVIDED += "iasl-native"
  +
  +
IMAGE_INSTALL_append = " dropbear"
  +
INITRAMFS_IMAGE = "core-image-minimal"
  +
INITRAMFS_IMAGE_BUNDLE = "1"
  +
   
 
Finally lunch the build!
 
Finally lunch the build!

Revision as of 17:29, 24 October 2019

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"


Finally lunch the build!

bitbake core-image-minimal

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