top of page
  • Zach Pfeffer

Add a Yocto Layer to a PetaLinux Project and Build a Recipe in the Layer with PetaLinux Tools


This post shows how to add a new Yocto layer to your PetaLinux project and build a recipe in the Yocto layer with PetaLinux Tools 2017.4.

This post uses the "meta-example" from DynamicDevices.

Looking for help build software for Xilinx SoCs? Email inquiries@centennialsoftwaresolutions.com today to schedule a 30-min consult for $99.00

Prerequisites

Download and Install Xilinx's 2017.4 PetaLinux Tools at link

Post Updates

May 4th 2018

These instructions don't cover creating a layer, they cover pulling in an existing layer.

April 25th 2018

Updated the example to use ${PROOT} instead of an absolute path when entering the user layer into the config field. Using ${PROOT} in the user layer path allows you to support running petalinux-build immediately after unpacking a PetaLinux project. Without ${PROOT}, the user is required to run petalinux-config after unpacking a PetaLinux project.

Motivation

In Yocto new layers are added to BBLAYERS listed in conf/bblayers.conf. PetaLinux Tools 2017.4 creates this file and says not to edit it:

It doesn't work to disregard the warning, edit this file and run petalinux-config to pick up the layer because PetaLinux Tools will regenerate it during petalinux-config.

This write up shows the correct way to add a layer to BBLAYERS in conf/bblayers.conf using PetaLinux Tools 2017.4.

Check Out the Layer and Put it in the Right Spot

1. cd into your PetaLinux project

2. make and cd into components/ext_source

You should put your external source here according to Table A-1 on p89 of the PetaLinux Tools reference guide.

3. Get source with:

Add a layer to BBLAYERS in conf/bblayers.conf

1. cd into your PetaLinux project

2. Type:

After a few seconds the misc/config System Configuration menu will appear:

3. Press down until the cursor is on Yocto Settings ---> and hit Enter.

After hitting Enter you should see:

4. Press down until the cursor is on User Layers ---> and hit Enter.

After hitting Enter you will see:

5. Press Enter.

You should see the following:

6. Enter the full path to meta-example:

Note: you should use ${PROOT}. ${PROOT} is also used in TMPDIR (${PROOT}/build/tmp).

...and hit Enter to Ok

You should see:

If you want to enter in another layer scroll down to user layer 1, hit enter, enter the path...etc.

You can enter up-to 10 user layers.

7. Select Exit:

...Exit:

...Exit:

...and <Yes> to save the configuration:

After these steps the following update gets made to the project (that are not .gitignored):

In addition conf/bblayers.conf now contains meta-example:

Note: ${PROOT} gets turned into /home/pfefferz/plprjs4/mtd_board in this case.

Build a Recipe from meta-example with PetaLinux Tools

1. Open project-spec/meta-user/recipes-core/images/petalinux-image.bbappend and add IMAGE_INSTALL_append = " bbexample"

The space between " and bbexample" this is required.

Note: there is a very brief section in the PetaLinux Tools reference guide called Adding a Recipe from Yocto e-SDK Layers topetalinux-image-full.bb on page 81 that gives the location of the file (project-spec/meta-user/recipes-core/images/petalinux-image.bbappend) that has to be edited.

2. Run:

You should see:

3. Arrow down to user packages --->:

...and hit Enter. You should see:

4. Type 'Y'. You'll see:

5. Hit Exit, Exit then Yes to save.

You'll see the following difference in project-spec/configs/rootfs_config

In addition ./project-spec/meta-plnx-generated/recipes-core/images/petalinux-user-image.bb gets generated:

6. Now type:

You should see:

...and something like the following if everything built okay:

6. After booting your target, run bbexample:

Find where its located:

Also find the lib:

Note on the Yocto Version used in PetaLinux Tools 2017.4

PetaLinux Tools 2017.4 is based on the 2.2.3 "Morty" release of the Yocto Project. See the release notes @ link for details.

If you check out Morty and diff it with the release you will see 928 lines added from the morty branch and 1494 lines removed.

Here are the commands to run through the calc:

References

  • Yocto

  • Yocto docs

  • Yocto Project Mega-Manual Morty 2.2.3 PDF @ link

  • ​See 5.1 Understanding and Creating Layers for a discussion about layers (p37/400)

  • Yocto Project Mega-Manual Rocko 2.4.2 PDF @ link

  • Yocto Source Repositories @ link

  • Building your own recipes from first principles @ link

  • Xilinx

  • PetaLinux Tools 2017.4 Reference Guide UG1144 (v2017.4) December 20, 2017 @ link

bottom of page