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
Documentation
The first place you should start to better understand many details of the Yocto project is the Yocto project website.
...
Create a
fsbl_%.bbappend file and add below content
Code Block |
---|
|
$ vim <plnx-proj-root>/project-spec/meta-user/recipes-bsp/fsbl/fsbl_%.bbappend |
To enable debugs in FSBL:
Code Block |
---|
|
#Add debug for FSBL
XSCTH_BUILD_DEBUG = "1" |
To add compiler flags in FSBL:
Code Block |
---|
|
#Add compiler flags for FSBL
YAML_COMPILER_FLAGS_append = " -DFSBL_PROT_BYPASS" |
To add BSP flags(secure mode) in FSBL:
Code Block |
---|
|
#Add BSP flags for FSBL
YAML_BSP_CONFIG += "secure_mode"
YAML_BSP_CONFIG[secure_mode] = "set,true" |
Create a
pmu-firmware_%.bbappend file and add below content
Code Block |
---|
|
$ vim <plnx-proj-root>/project-spec/meta-user/recipes-bsp/pmu/pmu-firmware_%.bbappend
#For v2018.1 or later PetaLinux releases only
$ vim <plnx-proj-root>/project-spec/meta-user/recipes-bsp/pmu-firmware/pmu-firmware_%.bbappend |
To enable debugs in PMUFW refer this
https://xilinx-wiki.atlassian.net/wiki/spaces/A/pages/18841724/PMU+Firmware page for DEBUG flags list
Code Block |
---|
|
#Add debug for PMUFW
XSCTH_BUILD_DEBUG = "1" |
To add compiler flags in PMUFW, see
PMU FW Build Flags:
Code Block |
---|
|
#Add compiler flags for PMUFW
YAML_COMPILER_FLAGS_append = " -DDEBUG_MODE -DXPFW_DEBUG_DETAILED" |
To add BSP flags(secure mode) in PMUFW:
Code Block |
---|
|
#Add BSP flags for PMUFW
YAML_BSP_CONFIG += "secure_mode"
YAML_BSP_CONFIG[secure_mode] = "set,true" |
To add BSP flags(debug mode) in PMUFW: For example if you want to enable https://github.com/Xilinx/embeddedsw/blob/release-2018.3/lib/sw_apps/zynqmp_pmufw/misc/xfpga_config.h#L34 debug is Xil BSP libraries
Code Block |
---|
|
#Add BSP flags for PMUFW
YAML_BSP_CONFIG += "debug_mode"
YAML_BSP_CONFIG[debug_mode] = "set,true" |
By pass PMUFW debug logs on different UART console:
Code Block |
---|
|
YAML_SERIAL_CONSOLE_STDIN_forcevariable = "psu_uart_1"
YAML_SERIAL_CONSOLE_STDOUT_forcevariable = "psu_uart_1" |
Remove the
<plnx-proj-root>/components/plnx_workspace and clean you project workspace before rebuilding FSBL or PMUFW components
Code Block |
---|
|
$ petalinux-build -x mrproper
#Note: In v2018.1 or later PetaLinux release "petalinux-build -x mrproper" command will remove <plnx-proj-root>/components/plnx_workspace directory
$ rm -rf <plnx-proj-root>/components/plnx_workspace
$ petalinux-build |
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/fsbl/fsbl_%.bbappend and add below content to update psu_init.c changes to FSBL
Code Block |
---|
|
# 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
} |
How to Add Pre-built Libraries in PetaLinux or Yocto Recipes
1. Create a new recipe or in existing recipe in meta-user layer as shown
Code Block |
---|
|
$ mkdir -p <plnx-proj-root>/project-spec/meta-user/recipes-apps/libcpsample/files |
2. Copy pre-built libraries files and header file required for libraries to
<plnx-proj-root>/project-spec/meta-user/recipes-apps/libcpsample/files as
Code Block |
---|
|
$ cp libcpsample.so.1.0.1 <plnx-proj-root>/project-spec/meta-user/recipes-apps/libcpsample/files
$ cp cpsample.h <plnx-proj-root>/project-spec/meta-user/recipes-apps/libcpsample/files |
3. Add the below content to recipe file
Code Block |
---|
|
#
# This file is the libcpsample recipe.
#
SUMMARY = "Sample pre-built library copy to rootfs"
SECTION = "libs"
LICENSE = "MIT"
LIC_FILES_CHKSUM = "file://${COMMON_LICENSE_DIR}/MIT;md5=0835ade698e0bcf8506ecda2f7b4f302"
SRC_URI = " \
file://libcpsample.so.1.0.1 \
file://cpsample.h \
"
S = "${WORKDIR}"
# Add dependency libraires if any
# for example DEPENDS = "libpcap"
# If you need to create a symbolic link using the pre-built libraries you should use oe_soinstall.
# This copies libraries to "{TARGET_ROOTFS}/usr/lib" directory and create a symlink as
# lrwxrwxrwx libcpsample.so.1.0 -> libcpsample.so.1.0.1
# -rwxr-xr-x libcpsample.so.1.0.1
do_install() {
install -d ${D}${libdir}
oe_soinstall ${S}/libcpsample.so.1.0.1 ${D}${libdir}
install -d -m 0655 ${D}${includedir}/CPSAMPLE
install -m 0644 ${S}/*.h ${D}${includedir}/CPSAMPLE/
}
# Inhibit warnings about files being stripped
INSANE_SKIP_${PN} = "ldflags"
INSANE_SKIP_${PN} = "already-stripped"
# If you don't have .h file to copy to /usr/include add something like below
# FILES_${PN} = "${libdir}/*.so.*"
FILES_${PN} = "${libdir}/*.so.* ${includedir}/*"
FILES_${PN}-dev = "${libdir}/*.so" |
4. Build the pre-built library recipe
Code Block |
---|
|
$ petalinux-build -c libcpsample |
...