Install and Build with Xilinx Yocto


Table of Contents

Install Xilinx Yocto

Yocto Host Dependencies

Install the standard Yocto dependencies for your host machine per the Yocto Reference Manual.

Repo

Repo is a repository management tool that is built on top of Git. Repo unifies the many Git repositories when necessary, and automates parts of the development workflow. Repo is not meant to replace Git, only to make it easier to work with Git in the context of development.The repo command is an executable Python script that you can put anywhere in your path. In working with the source files, you will use Repo for across-network operations. For example, with a single Repo command you can download files from multiple repositories into your local working directory.

Install Repo

Here we will simply install the repo script from Google.

Fetch Source

Repo uses a manifest which is an XML file that describes all the required repositories.  It can manage all of your git repositories so they remain in sync.

Configure the Xilinx Yocto Build

This section shows how to do three basic Yocto configurations.

  1. Generate u-boot scripts to control your kernel SD boot
  2. Add an initramfs
  3. Generate a FIT image

Generate U-boot Boot Scripts (recommended)

U-boot is built with default variables that control the boot.  You may use the defaults, modify them by patching the configuration headers during the build or modify them at run-time from the hush shell.  A more flexible way to control the boot is through boot scripts, boot.scr or extlinux.conf.  U-boot 2019.01 defaults to distro boot (2) as the boot mechanism, which searches for things to boot.  Distro boot will look for extlinux.conf, boot.scr and an EFI image in that order.  This section shows how to build extlinux.conf and boot.scr.

Boot.scr

Meta-xilinx-bsp provides the "u-boot-zynq-scr.bb" recipe to generate the boot.scr.  To build boot.scr, add the Yocto variable below to your local.conf.  

Extlinux

Configuring Yocto for extlinux will generate a extlinux.conf file to control the u-boot environment variables.  Add the Yocto variables below to your local.conf if you want to build extlinux.conf.  These Yocto variables give you granular control over how the u-boot variables are populated.  An advantage of extlinux is that it is well known, cross-platform and ASCII text.  U-boot will search for extlinux.conf in /boot/extlinux/.

Build an Initramfs (optional)

The default Yocto configuration will build images for deploying on a dual partition SD card.  This optional section shows how to build with an initramfs for a single partition SD card.  Edit your local.conf file and add the lines shown below.  This will tell bitbake to create an initramfs image and bundle it with the kernel (2).

Generate a FIT Image (optional)

If you want to build a FIT image, add the variables shown below to your local.conf.  A FIT image contains partitions for all of the images required to boot the kernel.

Yocto may build two FIT images depending on if you've enabled initramfs or not:

  1. fitimage-<machine>.bin (kernel and dtb)
  2. fitimage-<image>-<machine>.bin (kernel, dtb and initramfs)

Build with Xilinx Yocto

Source the Yocto Environment

Setupsdk is a Xilinx script which configures the Xilinx Yocto environment.  Essentially it's a wrapper for the familiar "oe-init-build-env" Yocto script.

Bitbake the Image

Finally bitbake the target image "petalinux-image-minimal".  You can pass the target machine on the command line or add it to your local.conf as the default machine.  When the build is completes, your images are located in "build/tmp/deploy/images/<machine>".  In this example we are building for the ZCU102.

Install the Images

Finally let's install the images onto an SD card.  The directory structure is slightly different depending on whether you are installing with boot.scr or extlinux.conf, so both are shown below.  Cd into the deploy images directory for the machine you just built.

Install with Boot.scr

Install with Extlinux

References

  1. U-boot Distro Boot
  2. Yocto Initramfs