STT

PetaLinux build artifacts

How to keep them and where to find them

PetaLinux build artifacts
These tips apply to PetaLinux 2020.2.

To save disk space, the PetaLinux tools deletes all build artifacts at the end of the build process. If you want to keep them for debugging or to help you develop a patch, you can add the following line to the project-spec/meta-user/conf/petalinuxbsp.conf file:

  RM_WORK_EXCLUDE += "recipe"

Where recipe must be substituted with a valid recipe name such as the following:

Sources Recipe name
Kernel linux-xlnx
FSBL fsbl
U-Boot u-boot-xlnx
PMU firmware pmu-firmware
Device tree device-tree

If you want to preserve the build artifacts of more than one component, you can append the recipe names, separated by spaces, for example, to preserve the kernel sources and the FSBL:

  RM_WORK_EXCLUDE += "linux-xlnx fsbl"

Alternatively you can add a line for each:

  RM_WORK_EXCLUDE += "linux-xlnx"
  RM_WORK_EXCLUDE += "fsbl"

You can also preserve the sources of custom applications, kernel modules, packages, etc, just by using their names. For example, to preserve the sources for a custom application called “myapp”, as well as Busybox and Glibc, add this line:

  RM_WORK_EXCLUDE += "myapp busybox glibc"

How to keep ALL build artifacts

The setting that makes PetaLinux tools delete build artifacts in the first place is contained in the build/conf/local.conf file.

  INHERIT += "rm_work"

If you want to keep all build artifacts, just add the following line to the project-spec/meta-user/conf/petalinuxbsp.conf file:

  INHERIT_remove = "rm_work"

Where to find the build artifacts

In general, you will find the build artifacts in build/tmp/work/. Digging deeper, you’ll find the various components in these directories:

Sources Build artifacts location
Kernel build/tmp/work/-xilinx-linux/linux-xlnx
FSBL build/tmp/work/-xilinx-linux/fsbl
U-Boot build/tmp/work/-xilinx-linux/u-boot-xlnx
PMU firmware build/tmp/work/-xilinx-linux/pmu-firmware
Device tree build/tmp/work/-xilinx-linux/device-tree
Apps/pkg/mod build/tmp/work/aarch64-xilinx-linux

In the above paths, you must replace with the Yocto machine name given to your PetaLinux project. The Yocto machine name is the value of CONFIG_YOCTO_MACHINE_NAME in the project-spec/configs/config file.

How to delete the build artifacts

Finally, you can clean the project and delete the build artifacts by running this command: petalinux-build -x mrproper