Building User Modules - 2023.2 English

PetaLinux Tools Documentation: Reference Guide (UG1144)

Document ID
Release Date
2023.2 English

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


To build mymodule 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 module:
    petalinux-build -c mymodule -x do_cleansstate
  • To rebuild the selected user module:
    petalinux-build -c mymodule

    This compiles the module. The compiled executable files are placed in <TMPDIR>/work/<MANCHINE_NAME>-xilinx-linux/mymodule/1.0-r0/ directory.

  • To see all list of tasks for this module:
    petalinux-build -c mymodule -x listtasks
  • To install the selected user module:
    petalinux-build -c mymodule -x do_install

    This installs the module 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 <${PROOT}>/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 += "mymodule"