[INCOMPLETE] Xilinx Zynq 7000

Board description

An SOC from Xilinx that combines an FPGA and ARM®-based processor. This project is based on the TE0715 Module from Trenz. The integration layer is not specific to Trenz however and so it is titled as Zynq-7000.

URL: https://www.xilinx.com/products/silicon-devices/soc/zynq-7000.html
URL: https://www.xilinx.com/products/boards-and-kits/1-672i0r.html
Wiki: TODO: wiki URL (if available)

Test results

The Yocto Project releases in the table below have been tested by the Mender community. Please update it if you have tested this integration on other Yocto Project releases:

Yocto Project Build Runtime Petalinux Version
rocko(2.4) :test_works: 12 :test_works: 12 2018.3
thud(2.6) :test_works: 12 :test_works: 13 2019.1

1. Tested by single developer
2. Tested with Mender 1.7.1 and Mender 2.0.0
3. Tested with Mender 2.0.0

Build Means that the Yocto Project build using this Mender integration completes without errors and outputs images.
Runtime Means that Mender has been verified to work on the board. For U-Boot-based boards, the integration checklist has been verified.

Getting started

Prerequisites

Build from example project (Only for 2018.3)

  • git clone https://github.com/reachBAM/Zynq-Petalinux-Example.git
  • cd Zynq-Petalinux-Example
  • git checkout MenderSupport
  • mkdir -p components/ext_source
  • cd components/ext_source
  • git clone https://github.com/reachBAM/meta-mender-zynq.git
  • cd meta-mender-zynq
  • git clone https://github.com/reachBAM/meta-mender.git
  • cd meta-mender
  • git checkout add_mender_dtb_name_force
  • cd ../../..
  • source <petalinux_install_directory>/2018.3/settings.sh
  • petalinux-config --get-hw-description
    • Exit
  • petalinux-build

Configuring the build from scratch

Setup Petalinux/Yocto environment

  • source <petalinux_install_directory>/<version>/settings.sh
    • Where version is 2018.3 or 2019.1
  • petalinux-create -t project --template zynq -n <project_name>
  • cd <project_name>

Import Layers

  • Create user layer directory
    • mkdir -p components/ext_source/
  • cd components/ext_source/
  • Download meta-mender-zynq layer
    • git clone https://github.com/brymatPC/meta-mender-zynq.git
    • cd meta-mender-zynq
    • git checkout petalinux_2018.3 OR
    • git checkout petalinux_2019.1
  • Download mender layer
    • git clone https://github.com/mendersoftware/meta-mender.git
      • cd meta-mender
      • git checkout rocko - For 2018.3
      • git checkout thud - For 2019.1
    • Patch Mender (2018.3)
      • git apply ../meta-mender-zynq/patches/Mender_No_Dtb_Fix.patch
      • This patch provides a mechanism for avoiding a compile error because Zynq puts the dtb file inside a fitimage
      • Recommendation taken from Mender Hub Page
    • Patch Mender (2019.1)
      • git apply ../meta-mender-zynq/patches/Mender_No_Dtb_Fix.patch
      • This patch provides a mechanism for avoiding a compile error because Zynq puts the dtb file inside a fitimage
      • git apply ../meta-mender-zynq/patches/Mender_Remove_Duplicate_UBoot_Patch.patch
      • Xilinx uses their own u-boot branch and it contains a duplicate patch that causes the build to fail

Configure Petalinux

  • cd ../../..
  • Copy in example hdf file
    • cp components/ext_source/meta-mender-zynq/templates/example.hdf .
  • Run petalinux-config
    • petalinux-config --get-hw-description
    • Wait for config menu to display
    • Add mender layers
      • Yocto Settings —>
      • User Layers —>
      • ${PROOT}/components/ext_source/meta-mender/meta-mender-core
      • ${PROOT}/components/ext_source/meta-mender-zynq
      • Exit
      • Exit
    • Disable automatic u-boot environmental settings
      • Subsystem AUTO Hardware Settings —>
      • Advanced bootable images storage Settings —>
      • u-boot env partition settings —>
      • image storage media —>
      • set to manual
      • Exit
      • Exit
      • Exit
    • Place root filesystem on sd card
      • Image Packaging Configuration —>
      • Root filesystem type —>
      • set to SD card
      • Exit
    • Exit

Modify Petalinux Files

  • Add mender to root filesystem
    • echo "CONFIG_mender=y" >> project-spec/configs/rootfs_config
  • Add mender to install packages
    • echo "IMAGE_INSTALL_append = \" mender\"" >> project-spec/meta-user/recipes-core/images/petalinux-image-full.bbappend
  • Overwrite project-spec/meta-user/recipes-bsp/device-tree/files/system-user.dtsi
    • cp components/ext_source/meta-mender-zynq/templates/system-user.dtsi project-spec/meta-user/recipes-bsp/device-tree/files/system-user.dtsi
    • TODO: Provide example when not using device tree
  • Add bootcount defines for u-boot (2018.3 Only)
    • echo "#define CONFIG_BOOTCOUNT_LIMIT" >> project-spec/meta-user/recipes-bsp/u-boot/files/platform-top.h
    • echo "#define CONFIG_BOOTCOUNT_ENV" >> project-spec/meta-user/recipes-bsp/u-boot/files/platform-top.h
  • Import uEnv.txt for u-boot (2018.3 Only)
    • cp components/ext_source/meta-mender-zynq/templates/uEnv.txt project-spec/meta-user/recipes-bsp/u-boot/files/
    • cp components/ext_source/meta-mender-zynq/templates/u-boot-xlnx_%.bbappend project-spec/meta-user/recipes-bsp/u-boot/
  • Add golang recipe
    • Download golang recipe to project-spec/meta-users/recipes-apps/go
    • NOTE: Mender 2.0 requires Go 1.12
  • Apply petalinuxbsp.conf.append
    • Copy and paste file contents to bottom of project-spec/meta-user/conf/petalinuxbsp.conf
  • Set path to hdf file in project-spec/meta-user/conf/petalinuxbsp.conf
    • Needs to be full path to hdf file generated by Xilinx Vivado tools
    • HDF_PATH = "/home/<user>/.../<project_name>/example.hdf"
  • Set artifact name in project-spec/meta-user/conf/petalinuxbsp.conf
    • MENDER_ARTIFACT_NAME="Example"
  • Set SDCard Size in project-spec/meta-user/conf/petalinuxbsp.conf
    • MENDER_STORAGE_TOTAL_SIZE_MB="30436"

Building the image

  • petalinux-build

Using the build output

After a successful build, the images and build artifacts are placed in images/linux/

The disk image with .sdimg is used to provision the device storage for devices without Mender running already. Please proceed to the official documentation on provisioning a new device for steps to do this.

On the other hand, if you already have Mender running on your device and want to deploy a rootfs update using this build, you should use the Mender Artifact files, which have .mender suffix. You can either deploy this Artifact in managed mode with the Mender server (upload it under Releases in the server UI) or by using the Mender client only in Standalone deployments.

References

TODO: Add any relevant references such as repository README.md files, etc.

Known issues

  • Default Petalinux build likely doesn’t have a golang recipe
  • The interplay between bootargs in u-boot vs the device-tree isn’t well understood by me. Testing so far is only with the device-tree bootargs.
  • The bootcount defines still need to be added manually to the platform-top.h file. This should be done in a bbappend.
    • Issue is actually that the xlnx-uboot 2018.3 repo doesn’t have the correct kconfig for CONFIG_BOOTCOUNT_LIMIT, so the defines have to be added to the platform-top.h file. Patching this file doesn’t seem appropriate since it is a user file.
  • Haven’t done any testing with a Mender server
  • Shouldn’t need to manually patch mender.

If this post was useful to you, please press like, or leave a thank you note to the contributor who put valuable time into this and made it available to you. It will be much appreciated!

2 Likes

This looks great.

I have add to my TODO to test the instructions outlined in this post, but have a couple of comments just from reading the post.

Comment 1

Generally we try to keep the instructions/steps outlined in an tutorial style post to be copy/paste making the instructions explicit. Obviously this is applied to the extent it is possible and makes sense. From our experience this flow is easiest to follow.

To give you an example I would probably replace:

Modify project-spec/configs/rootfs_config

  • Add CONFIG_mender=y

with

Modify project-spec/configs/rootfs_config:

echo "CONFIG_mender=y" >> project-spec/configs/rootfs_config

Comment 2

Regarding the " Configure Petalinux" section, does running petalinux-config generate a configuration file that can be re-used? What I am thinking here is to provide a working example configuration essentially skipping the need of running petalinux-config and instead just coping the working example conf to the correct location.

I have no idea how petalinux-config works :stuck_out_tongue:

Comment 3

I just wanted to highlight that we do provide a repository to share board integrations,

The purpose of this to try to keep the board integration lays in one single location.

Your meta-mender-zynq fits well in to above, but in the end up to you where you want to host this :slight_smile:

Thanks for the feedback, I will incorporate those suggestions as I work through a few other details.

Regarding Petalinux, it really is quite an invasive tool set. Unlike the one you suggested, kas, Petalinux almost tries to completely mask Yocto and bitbake. So the command petalinux-config actually generates it’s own config files which are then used to generate input files to bitbake when you run petalinux-build. This is one of the main reasons for the suggestion to avoid Petalinux.

I am realizing my instructions above do require some knowledge of Petalinux to make it work. I will try add more details to the setup to make that a bit easier.