Table of Contents
Building the Xen Image
Below are the steps to build the Xen Image using Yocto:
Install the repo
Repo is a tool that enables the management of many git repositories given a single manifest file. The repo will fetch the git repositories specified in the manifest and, by doing so, sets up a Yocto Project build environment for you.
Code Block |
---|
language | bash |
---|
theme | Midnight |
---|
|
# Download the Repo script.
curl -k https://storage.googleapis.com/git-repo-downloads/repo > repo
# Generally, curl is install at /usr/bin/curl. If it is installed at custom location please point it to correct location.
# Make it executable.
chmod a+x repo
# If it is correctly installed, you should see a Usage message when invoked with the help flag.
repo --help
# If system complaints about repo not found. Please run with './repo --help' |
Fetch all sources
Code Block |
---|
language | bash |
---|
theme | Midnight |
---|
|
# initialize the repo.
repo init -u git://github.com/Xilinx/yocto-manifests.git -b <release-version>
# repo sync to get all sources
repo sync |
Example of release-version: rel-v2020.2, rel-v2020.1 and rel-v2019.2 etc.
In case you get the following error
Code Block |
---|
language | bash |
---|
theme | Midnight |
---|
|
ayankuma@xcbayankuma40x:/scratch$ repo sync
File "/scratch/.repo/repo/main.py", line 79
file=sys.stderr)
^
SyntaxError: invalid syntax |
...
Code Block |
---|
language | bash |
---|
theme | Midnight |
---|
|
# initialize the repo.
python3 repo init -u git://github.com/Xilinx/yocto-manifests.git -b <release-version>
# repo sync to get all sources
python3 repo sync |
Source environment
Code Block |
---|
language | bash |
---|
theme | Midnight |
---|
|
# source the environment to build using bitbake.
source setupsdk |
Add option to generate rootfs image with Yocto build
This option will generate the rootfs in cpio.gz format which will be used in creating boot-scripts step. Rootfs built will contain the useful Xen tools like xl.
Code Block |
---|
language | bash |
---|
theme | Midnight |
---|
|
# Edit conf/local.conf and Add the below line
IMAGE_FSTYPES += "cpio.gz" |
Build using bitbake
Next, we will build the xen-image-minimal image. This will produce Xen, Linux kernel for Xen and rootfs. If only Xen needs to be build, it can done using MACHINE=vck190-versal bitbake xen.
Code Block |
---|
|
$ MACHINE=vck190-versal bitbake xen-image-minimal
# Please use appropriate yocto machine name to build for a target hardware. Examples:
#MACHINE=vck190-versal
#MACHINE=zcu102-zynqmp
#MACHINE=zcu104-zynqmp
#MACHINE=ultra96-zynqmp |
Warning |
---|
This step can take a lot of time depending upon host machine processing power. It will also required significant disk space, please see Yocto for more details. |
Creating boot scripts
To create boot scripts, we use Imagebuilder which generates a U-Boot script that loads all the necessary binaries and automatically adds the required entries to device tree at boot time. In order to use it, we will need to write a config file first.
First, cd to <current directory>/tmp/deploy/images/$(machine_name). Example: build/tmp/deploy/images/vck190-versal.
Next, create a file named "config" with the contents as illustrated below and save the file.
Code Block |
---|
|
MEMORY_START="0x0"
MEMORY_END="0x80000000"
DEVICE_TREE="system.dtb"
XEN="xen"
DOM0_KERNEL="Image"
DOM0_RAMDISK="xen-image-minimal-vck190-versal.cpio.gz"
NUM_DOMUS=0
UBOOT_SOURCE="boot_xen.source"
UBOOT_SCRIPT="boot_xen.scr" |
...