Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.
Comment: Update: How to update psu_init Files. For 2021.1 & 2022.2+ fsbl is now fsbl-firmware

This page is intended to be a collection place for tips and tricks related to Yocto layers and how Yocto works under Petalinux.

Table of Contents

Table of Contents
excludeTable of Contents

Documentation

The first place you should start to better understand many details of the Yocto project is the Yocto project website

Override syntax changes from Yocto honister/PetaLinux 2022.1

From 2022 release, the : character replaces the use of _ to refer to an override, most commonly when making a conditional assignment of a variable.

Please refer to /wiki/spaces/XWUC/pages/2329444389for more details.

To help with migration of layers, a script has been provided in OE-Core. Once configured with the overrides used by a layer, this can be run as:

With in PetaLinux:

Code Block
themeMidnight
$ cd <plnx-proj-root>
$ $PETALINUX/components/yocto/buildtools/sysroots/x86_64-petalinux-linux/usr/bin/python3 components/yocto/layers/core/scripts/contrib/convert-overrides.py <meta-layer-path>


With in Yocto:

Code Block
themeMidnight
$ cd <yocto-proj-dir>
$ sources/core/scripts/contrib/convert-overrides.py <meta-layer-path>


Note

To execute above convert-overrides.py you need python3 should be installed on host machine.



...

3. To add compiler flags in PMUFW, see PMU FW Build Flags:


Info

Note that the method of loading the PMUFW can prevent early prints (during code initialization) from being output.  See PMU Firmware > Using FSBL to load PMUFW for additional details.


Code Block
themeMidnight
#Add compiler flags for PMUFW
# From 2022.1 onwards
YAML_COMPILER_FLAGS:append = " -DDEBUG_MODE -DXPFW_DEBUG_DETAILED"

# For 2021.2 and old PetaLinux releases
YAML_COMPILER_FLAGS_append = " -DDEBUG_MODE -DXPFW_DEBUG_DETAILED"


4. To add BSP flags(secure mode) in PMUFW:

...


Code Block
themeMidnight
$ petalinux-build -c pmufw

Configuring the PLM component in a PetaLinux Project

1. Create a plm-firmware_%.bbappend file and add below content

Code Block
themeMidnight
$ vim <plnx-proj-root>/project-spec/meta-user/recipes-bsp/embeddedsw/plm-firmware_%.bbappend

2. To add BSP flags(to enable USB boot mode) in PLM: For more option see https://xilinx-wiki.atlassian.net/wiki/spaces/A/pages/2037088327/Versal+Platform+Loader+and+Manager#PLM-Build-Flags

Code Block
themeMidnight
#Add BSP flags for PLM. Here USB boot mode is enabled and debug level changed to level0 (minimal)
#Alternatively, each of these two parameters can be configured separately
YAML_BSP_CONFIG += "plm_usb_en plm_dbg_lvl"
YAML_BSP_CONFIG[plm_usb_en] = "set,true"
YAML_BSP_CONFIG[plm_dbg_lvl] = "set,level0"


3. To build PLM

Code Block
themeMidnight
$ petalinux-build -c plm

How to Update psu_init Files in PetaLinux Project

Info

Note: PSU_INIT files are generated based on HDF or XSA parsing, Hence these files can't be patched on top of embedded_sw repo using Yocto SRC_URI variable. Alternatively we can update these files by editing <plnx-proj-root>/project-spec/hw-description/psu_init.c and copy to FSBL build workspace during do_compile_prepend bitbake task.


1. Modify <plnx-proj-root>/project-spec/hw-description/psu_init.c file as per your requirement 

2. Create a FSBL bbappend file under <plnx-proj-root>/project-spec/meta-user/recipes-bsp/embeddedsw/fsbl-firmware_%.bbappend and add below content to update psu_init.c changes to FSBL

Code Block
themeMidnight
# For 2018.2 and below versions
do_compile_prepend(){
   install -m 0644 ${TOPDIR}/../project-spec/hw-description/psu_init.c ${TOPDIR}/../components/plnx_workspace/fsbl/fsbl_hwproj/psu_init.c
}

# For 2018.3 and later versions we removed FSBL and PMUFW external workspace from <plnx-proj-root>/components/plnx_workspace directory
# to align Yocto patching mechanism. Hence we are copying the files to build workspace(${B})
# https://github.com/Xilinx/meta-xilinx-tools/blob/rel-v2018.3/classes/xsctbase.bbclass#L14
do_compile_prepend(){
   install -m 0644 ${TOPDIR}/../project-spec/hw-description/psu_init.c ${B}/fsbl/psu_init.c
}

## From 2021.1 onwards

do_compile_prepend(){
   install -m 0644 ${TOPDIR}/../project-spec/hw-description/psu_init.c ${B}/fsbl-firmware/psu_init.c
}

# For 2022.1 release onwards
do_compile:prepend(){
   install -m 0644 ${TOPDIR}/../project-spec/hw-description/psu_init.c ${B}/fsbl-firmware/psu_init.c
}

How to Add Pre-built Libraries in PetaLinux or Yocto Projects


1. Create an application/recipe and copy prebuilt library and header files with the following commands. Assuming prebuilt library name is libcpsample.so.1.0.1.    

...