Snaps - xlnx-config Snap for Certified Ubuntu on Xilinx Devices

This page provides usage and release notes for the xlnx-config snap. The xlnx-config snap can be found in the Canonical Snap Store at https://snapcraft.io/xlnx-config .

Table of Contents

Introduction

Xlnx-config is command line tool used to manage and manipulate the hardware platform for Xilinx ZCU102/4/6 boards running Certified Ubuntu 20.04 LTS for Xilinx Devices. Xlnx-config provides two main functions as detailed below.

Platform Management

The main purpose of the xlnx-config is to load custom hardware platforms (Targeted reference designs (TRDs), Vitis accelerated platforms, etc) for the ZC10x boards other than the standard standard platforms delivered as part of the Certified Ubuntu for Xilinx Devices Image. Xlnx-config manages the installing of the custom boot assets (bitstream, firmware, and xclbin) while maintaining the “golden” boot assets delivered with the Certified Ubuntu image.

Xclbin Access for Snaps

Xlnx-config provides a way for strictly confined applications snaps to access the xclbin currently present in the system. Since snap applications are strictly confined, they don’t access to many system resources. However, xlnx-config is a “classic” snap which means it has more access to the system than a typical snap. We use the concept of a “content plug” to provide the xclbin (and possibly other system resources) to “consumer snaps” from the xlnx-config “producer” snap.

When application snaps that need access to the xclbin are installed, they automatically connect to the xlnx-config assets directory through the content interface as specified in the snapcraft build file for the application snap. This allows files (ex: dpu.xclbin) to be shared through the interface.

Xilinx-specific System Initialization

The sysinit sub application is used to install Xilinx Gstreamer and Video packages to facilitate the use of the advanced multi-media features of the Zynq UltraScale+ MPSoC device. This sub app should be executed after first boo.

Installation

To install xlnx-config, you must include the --classic option since this is a classic confined snap:

1 sudo snap install xlnx-config --classic

Supported Options

Option

Description

Option

Description

--version, -v

returns current version of xlnx-config

--query, -q

Checks for currently available HW configurations, by  searching for manifest files. The locations where it searches are:

  • Platform Snap: /snap/*/current/hwconfig/*/manifest.yaml

  • Manual Install

    • /usr/local/share/xlnx-config/*/hwconfig/*/manifest.yaml

    • /boot/firmware/xlnx-config/*/hwconfig/*/manifest.yaml

--activate, -a <config_name>

Activates a configuration by using its name or, directly, the path to the manifest. It checks the system compatibility by looking at the manifest and then applies the configuration (for instance, it builds and installs the boot and FPGA assets).

--get-board, -b:

returns the system's board model (currently, one of zcu102, zcu104 or zcu106).

--force, -f

Use jointly with `-a` or `-d` to force activation/deactivation even if the configuration seems already correct.

--deactivate, -d

Deactivates the currently active configuration, uninstalling its assets. After a reboot, the default boot assets for the board will be loaded.

--is-active, -i

<hwconfig_name_or_manifest>: Check whether a HW configuration (given by name or by manifest path) is currently active.

--update, -u

Update the assets directory to match /usr/lib/dpu.xclbin and deactivate any platform not matching
the current board. This is executed one time every boot as a one-shot daemon. See One-Shot Daemon for more details.

xlnx-config.sysinit

Sub-application that installs Xilinx-specific gstreamer and video packages

Platform Assets Container

A Platform Assets Container (PAC) is used to package one or more sets of custom boot assets. The boot assets and manifests will always be under a directory called hwconfig in the installed package or snap. The hwconfig directory contains at least one “configuration” directory (the names of the configuration directories are user-defined) which defines a unique reference design in the package that could have support for multiple boards. Under the configuration directory, there is a manifest.yaml, and at least one board-specific “assets directory” that contains the boot assets for that configuration/board combination.

The [data] shown below is optional, and can be used to store software, data, config files, etc. It can have any name, and xlnx-config does not parse it.

The diagram below shows what the PAC directory structure would look like with three unique configurations with assets for all three boards:

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 <PAC Name> | |--[data] | └--hwconfig |---- <config_1> ---- manifest.yaml | |-- zcu102 ---- | | |-- bootgen.bif | | |-- [dpu.xclbin] | | |-- <fsbl> | | |-- <bitstream> | | | . | | | . | | └-- <other_boot_assets> | |-- zcu104 . . └--<zcu104 assets> . . | └-- zcu106 |-- <config_2> └--<zcu106 assets> . . └-- <config_N>

Format of the manifest file

Manifest files will contain meta-information for a concrete hardware configuration, usually tied to capabilities needed by an application. It’s a yaml file describing compatibility information and the location of the boot assets. For example:

1 2 3 4 5 name: <configuration> description: <full description> revision: <number> assets:     zcuXXX: <assets directory>

Field details:

  • name: configuration name, usually the same as the parent directory

  • description: a detailed description. Details on how to run the application can be described here.

  • revision: a number used to version the boot assets

  • assets: information about assets for a given board. This is a dictionary where keys are the board name as returned by the --get-board option

    • Valid keys are zcu102, zcu104, zcu106, zcu111, zcu208, and zcu216. The “assets directory” is typically named the same, but it can be unique.

Assets Directory

The directory will contain .bif file describing how to build boot*.bin files and the boot assets necessary for that. Additionally, an xclbin file called dpu.xclbin might be present for DPU-enabled systems. There will be an directory for every compatible board (zcu102, zcu104, zcu106).

The names expected for the files are:

Filename

Description

bootgen.bif

Bootgen config file used by xlnx-config to package new boot.bin

fsbl.elf

Zynq UltraScale+ First Stage Boot Loader (FSBL)

bl31.elf

ARM Trusted Firmware (ATF)

pmufw.elf

Platform Management Unit (PMU) Firmware

system.bit

The Programmable Logic bitstream

system.dtb

The Linux Device tree that matches the contents of the bitstream

dpu.xclbin

The xclbin file that matches system.bit (optional)

The bootgen.bif must reference a U-Boot binary. For Certified Ubuntu on Xilinx Devices, this should be the u-boot.elf provided by Canonical at /usr/lib/u-boot/xilinx_zynqmp_virt/u-boot.elf)

After activation, the manifest for the currently active configuration is stored by xlnx-config. If we try to activate the same configuration again, xlnx-config will detect that and will not re-apply the changes. The revision field can be increased to signal that assets have changed  so they are updated even when the configuration is already active.

Run-Time Asset Management

Handling of the boot assets

When an configuration is activated, if the assets directory for the board contains a bootgen.bif file, new boot assets will be generated by xlnx-config by following these steps:

  1. Copy files from the assets directory to a temporary directory.

  2. Run bootgen using bootgen.bif as input. This file can reference not only the files coming from the assets directory, but also the default boot assets installed in the system like /usr/lib/u-boot/xilinx_zynqmp_virt/u-boot.elf or /usr/share/xlnx-firmware/zcu10*/*, so there is no need to include all binaries in the application package.

  3. Copy the resulting boot10?0.bin file to /boot/firmware/.  This file has precedence over the default boot assets named boot10?1.bin, so if present, they are loaded by the image selector.

  4. The manifest.yaml file for the configuration will be copied to /var/lib/xlnx-config. This way the snap will know if it has been activated and if that is the case, which configuration has been activated. 

  5. A file named active_board is created in the same directory that includes the active board name and the location of the activated assets directory.

  6. Once the activation is complete, the user must manually reboot the system in order for the new boot assets to take effect.

 

When a configuration is deactivated, the following steps will be taken:

  1. The /boot/firmware/boot10?0.bin file will be removed if present, and the user will be asked to reboot the system for the changes to take effect.

  2. The manifest.yaml and active_board files will be removed from /var/lib/xlnx-config.

Note that when a new configuration is activated, the steps to deactivate any previously activated configuration are applied as first step.

Handling of dpu.xclbin

Each of the three platforms provided with the Certified Ubuntu on Xilinx Devices images includes the Xilinx® Deep Learning Processor Unit (DPU)  in the PL. On Ubuntu, there is a symbolic link with path /usr/lib/dpu.xclbin that points to the correct dpu.xclbin file for the board. Each time the system boots, a script runs (dpu-config.sh, see table below) to make sure the link is pointing to the correct dpu.xclbin for the current evaluation board. In the case that a custom set of boot assets (provided by a PAC) has been activated, and the standard dpu.xclbin has been updated, the dpu-config.sh will not overwrite it. Upon deactivation of the custom boot assets, xlnx-config will restore the link back to the the proper board-specific dpu.xclbin.

For example after the zcu102 is booted the first time, the following link will be configured:

1 /usr/lib/dpu.xclbin -> /usr/share/xlnx-firmware/zcu102/dpu.xclbin

If the SD card is moved to a ZCU104, the link will be updated:

1 /usr/lib/dpu.xclbin -> /usr/share/xlnx-firmware/zcu104/dpu.xclbin

There three scenarios where xlnx-config needs to make sure that the dpu.xclbin in its assets directory is up to date:

Scenario

Action Taken

Scenario

Action Taken

Initial snap install

The xlnx-config install hook copies /usr/lib/dpu.xclbin to the xlnx-config assets directory

Reboot with Golden image

xlnx-config --update is called by the one-shot daemon at boot to make sure the assets directory is in sync with /usr/lib/dpu.xclbin.

Activation of new PAC boot assets that includes dpu.xclbin

xlnx-config copies the new dpu.xclbin to the assets directory as part of the activation process.

Snap Details

Snap Install Hook

When xlnx-config is installed, the "install hook" will look in the firmware directory of the current board (e.g. /usr/share/xlnx-firmware/zcu106 ) and, if present, copy the dpu.xclbin to the $SNAP_DATA/assets directory  (/var/snap/xlnx-config/current/assets).  This assets directory is made available as a read-only "content interface" to all other xlnx- snaps.  For other snaps to access this assets directory, their snapcraft.yaml should include the following plug definition:

1 2 3 4 plugs:     assets:         interface: content         target: $SNAP_DATA/assets

Before running an application that requires the DPU, the following environment variable is set to point to the dpu.xclbin being shared by the xlnx-config snap:

1 export XLNX_VART_FIRMWARE=$SNAP_DATA/assets/dpu.xclbin

This can be either be set in the wrapper script that calls the DPU app, or set in the apps/environment property in snapcraft.yaml

1 2 3 4 5 test-app:    command: bin/test_app.sh    plugs: [opengl, home]    environment:        XLNX_VART_FIRMWARE: $SNAP_DATA/assets/dpu.xclbin

One-Shot Daemon

Each time the system boots after xlnx-config has been installed, a “one-shot daemon” will run and execute the following command: xlnx-config --update

The update option causes xlnx-config to go and copy the existing /usr/lib/dpu.xclbin, to the xlnx-config assets directory. This is necessary in the case that user switches an SD Card from one evaluation board type to another. It also checks to see if there is a currently activated set of custom PAC boot assets in the system. If so, it will check /var/lib/xlnx-config/active_board file to see if the assets were activated on a different board than we’re currently running on. If the boards are different, then the current set of boot assets will be deactivated.

Usage Example

In this example, we’ll examine the makeup of a PAC, then walk through the process of activating and deactivating a simple set of PAC boot assets.

Custom PAC Installation

 Custom PACs can be installed in two ways:

  • Manually install in the filesystem

  • Install as a PAC snap

Manual Installation

 When using the manual install method, the PAC archive must be copied/extracted into one of two places:

  1. /boot/firmware/xlnx-config/<pac name>

  2. /usr/local/share/xlnx-config/<pac name>

/boot/firmware is the mount point for the FAT partition of the SD card

 

In this example, the PAC name is "test_pac". After copying the PAC archive to the target board, it has been extracted into the  /boot/firmware/xlnx-config/test_pac directory.  The PAC includes two unique configurations: foo and hello world.  Each of the configurations includes boot assets for both the ZCU102 and ZCU104.  The directory structure is shown below:

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 test_pac/ └── hwconfig ├── foo │   ├── manifest.yaml │   ├── zcu102 │   │   ├── bl31.elf │   │   ├── bootgen.bif │   │   ├── fsbl.elf │   │   ├── pmufw.elf │   │   ├── system.bit │   │   └── system.dtb │   └── zcu104 │   ├── bl31.elf │   ├── bootgen.bif │   ├── fsbl.elf │   ├── pmufw.elf │   ├── system.bit │   └── system.dtb └── hello_world ├── manifest.yaml ├── zcu102 │   ├── bl31.elf │   ├── bootgen.bif │   ├── fsbl.elf │   ├── pmufw.elf │   ├── system.bit │   └── system.dtb └── zcu104 ├── bl31.elf ├── bootgen.bif ├── fsbl.elf ├── pmufw.elf ├── system.bit └── system.dtb

Snap Installation

When installing the PAC as a PAC snap using "sudo snap install <PAC snap name>,"  the contents of the PAC will be found at the following location:

/snap/<PAC snap name>/current/

The hwconfig directory must, for example, be in the following location:

/snap/test_pac/current/hwconfig

Manifest Files

 The manifest.yaml is parsed by xlnx-config to discover details about the available board-specific boot assets. For this test, the manifests for the two configurations are shown below:

 hello_world configuration manifest:

1 2 3 4 5 6 name: test_platform-foo desscription: Boot assets for the 2020.2 foo design revision: 1 assets:         zcu102: zcu102         zcu104: zcu104

hello_world configuration manifest: 

1 2 3 4 5 6 name: test_platform-hello_world desscription: Boot assets for the 2020.2 hello_world design revision: 1 assets:         zcu102: zcu102         zcu104: zcu104

Boot Assets

The board specific boot assets folder (typically named the same as the board) contains the set of files needed to create a new boot.bin. In the case of dpu-enabled platforms, it also includes a dpu.xclbin. See the Assets Directory section above for more information.

Bootgen BIF File

Typically, each configuration will include all of the boot assets needed to generate a boot.bin. The one exception is u-boot.elf, which should come from the currently installed u-boot.elf provided by the u-boot debian package.  A typical bootgen.bif is shown below: 

1 2 3 4 5 6 7 8 9 the_ROM_image: {         [bootloader, destination_cpu=a53-0] fsbl.elf         [pmufw_image] pmufw.elf         [destination_device=pl] system.bit         [destination_cpu=a53-0, exception_level=el-3, trustzone] bl31.elf         [destination_cpu=a53-0, load=0x00100000] system.dtb         [destination_cpu=a53-0, exception_level=el-2] /usr/lib/u-boot/xilinx_zynqmp_virt/u-boot.elf }

It's also possible to refer to the golden boot assets for a particular board by referring to the files at /usr/share/xlnx-firmware/zcu10[x]

Activating the Platform

Now that the PAC is installed, xlnx-config -q can be used to query the system and report any boot assets available for the current boards:

1 2 3 4 5 6 7 8 9 10 11 ubuntu@zynqmp:~$ xlnx-config -q Hardware Platforms Present in the System:  | Platform                      |Act| zcu102 Assets Directory --------------------------------------------------------------------------------------------------------------- | test_platform-hello_world     |   | /boot/firmware/xlnx-config/test_pac/hwconfig/hello_world/zcu102 | test_platform-foo             |   | /boot/firmware/xlnx-config/test_pac/hwconfig/foo/zcu102 --------------------------------------------------------------------------------------------------------------- * No configuration is currently activated *

 

Since we're running on the ZCU102, only the ZCU102 boot assets are listed.  The "Platform" column will report the name field from the manifest, and the "Assets Directory" will display the directory where the boot assets are located. The "Act" column will indicated if any of the listed platforms are active.

Now, we can activate the platform we want to use:

1 2 3 4 5 6 7 8 9 10 11 ubuntu@zynqmp:~$ sudo xlnx-config -a test_platform-hello_world ubuntu@zynqmp:~$ sudo xlnx-config -a test_platform-hello_world Activating assets for test_platform-hello_world on the zcu102 * Generating boot binary... * Updating Multi-boot register * Updating /var/lib/xlnx-config/active_board with zcu102 IMPORTANT: Please reboot the system for the changes to take effect.  

 

As noted in the output, we must now reboot the board for the changes to take effect. Run the following command to reboot:

1 sudo reboot now

 

Once rebooted, we can query the system again and see that the test_platform-hello_world platform configuration is active:

1 2 3 4 5 6 7 8 9 ubuntu@zynqmp:~$ xlnx-config -q Hardware Platforms Present in the System:  | Platform                      |Act| zcu102 Assets Directory --------------------------------------------------------------------------------------------------------------- | test_platform-hello_world     | * | /boot/firmware/xlnx-config/test_pac/hwconfig/hello_world/zcu102 | test_platform-foo             |   | /boot/firmware/xlnx-config/test_pac/hwconfig/foo/zcu102 ---------------------------------------------------------------------------------------------------------------

 

Deactivating the Platform

To return to the golden image for the ZCU102, we can deactivate the current platform:

1 2 3 4 5 6 7 8 ubuntu@zynqmp:/boot/firmware/xlnx-config$ sudo xlnx-config -d Deactivating test_platform-hello_world * Reference /usr/lib/dpu.xclbin restored for zcu102 * Removed /boot/firmware/boot1020.bin * Updating Multi-boot register * IMPORTANT: Please reboot the system for the changes to take effect.

Again, for the changes to take effect, the system must be rebooted.

 

Important Files and Directories

File

Description

/var/snap/xlnx-config/current/assets

xlnx-config assets directory used to provide access to xclbin or other data files to consumer snaps

/usr/lib/dpu.xclbin

System dpu.xclbin for non-snap applications

/usr/share/xlnx-firmware/zcu10[x]

Golden boot assets for each ZCU10x board.

/usr/share/xlnx-firmware/dpu-config.sh

Script run during each boot to make sure /usr/lib/dpu.xclbin is linked to the right board specific dpu.xclbin in the zcu10x directory based on which board we're currently running on.

/usr/local/share/xlnx-config/

/boot/firmware/xlnx-config/

Directories where manually installed custom PACs are searched for

/var/lib/xlnx-config/manifest.yaml

The manifest file for the currently activated boot assets

/var/lib/xlnx-config/active_board

Stores the board and assets directory of the currently activated boot assets

/boot/firmware/

Contents of the FAT boot partition

Snap Release Notes

Date

Revision

Version

Notes

Date

Revision

Version

Notes

10/5/21

9

1.0

Added support for zcu111,zcu208, and zcu216

8/26/21

8

1.0

Added support for sysinit script

8/17/21

6

1.0

Initial Public Release