Steps to Build User Applications - 2021.2 English

PetaLinux Tools Documentation: Reference Guide

Document ID
UG1144
Release Date
2021-10-27
Version
2021.2 English

Running petalinux-build in the project directory <plnx-proj-root> rebuilds the system image including the selected user application myapp. (The output directory for this build process is <TMPDIR>/work/aarch64-xilinx-linux/myapp/1.0-r0/.)

$ petalinux-build

To build myapp into an existing system image:

$ cd <plnx-proj-root>
$ petalinux-build -c rootfs
$ petalinux-build -x package

Other petalinux-build options are explained with --help. Some of the build options are:

  • To clean the selected user application:
    $ petalinux-build -c myapp -x do_clean
  • To rebuild the selected user application:
    $ petalinux-build -c myapp

    This compiles the application. The compiled executable files are in the ${TMPDIR}/work/aarch64-xilinx-linux/myapp/1.0-r0/ directory.

    If you want to use the build artifacts for debugging with the third party utilities, add the line: RM_WORK_EXCLUDE += "myapp" in <plnx-proj-root>/project-spec/meta-user/conf/petalinuxbsp.conf. Without this line, the BitBake removes all the build artifacts after building successfully.

  • To see all list of tasks for myapp:
    petalinux-build -c myapp -x listtasks
  • To install the selected user application:
    $ petalinux-build -c myapp -x do_install

    This installs the application into the target the root file system host copy: <TMPDIR>/work/<MACHINE_NAME>-xilinx-linux/petalinux-image-minimal/1.0-r0/rootfs/.

    TMPDIR can be found in petalinux-config > Yocto-settings > TMPDIR. If the project is on local storage, TMPDIR is <plnx-proj-root>/build/tmp/.

    If you want to use the build artifacts for debugging with third party utilities, add the following line in project-spec/meta-user/conf/petalinuxbsp.conf:

    RM_WORK_EXCLUDE += "myapp"