Steps to Include Prebuilt Libraries - 2020.2 English

PetaLinux Tools Documentation Reference Guide (UG1144)

Document ID
Release Date
2020.2 English

If your prebuilt library name is, including this into PetaLinux root file system is explained in following steps.

  1. Ensure that the pre-compiled code has been compiled for your PetaLinux target architecture, for example, MicroBlaze™ processors, Arm® cores, etc.
  2. Create an application with the following command.
    $ petalinux-create -t apps --template install --name mylib --enable
    Note: --enable should be executed after the petalinux-config command.
  3. Change to the newly created application directory.
    $ cd <plnx-proj-root>/project-spec/meta-user/recipes-apps/mylib/files/
  4. Remove existing mylib file, and copy the prebuilt into mylib/files directory.
    $ rm mylib
    $ cp <> ./
  5. Create an application and include a prebuilt library into the root file system with a single command instead of following steps 2, 3, and 4. The following command creates mylib app and copies from <path-to-dir> to mylib/files directory.
    $ petalinux-create -t apps --template install --name mylib --srcuri <path-to-dir>/ --enable
    Note: This is applicable for applications and modules.
  6. Create an application with multiple source files.
    $ petalinux-create -t apps --template install --name mylibs --srcuri "<path-to-dir>/ <path-to-dir>/"
    Note: This is applicable for applications and modules.
  7. Create an app with remote sources. The following examples will create applications with specified git/http/https pointing to the srcuri.
    $ petalinux-create -t apps -n myapp --enable --srcuri http://example.tar.gz
    $ petalinux-create -t apps -n myapp --enable --srcuri git://example.git\;protocol=https
    $ petalinux-create -t apps -n myapp --enable --srcuri https://example.tar.gz
    Note: This is applicable for applications and modules.
  8. Edit <plnx-proj-root>/project-spec/meta-user/recipes-apps/mylib/

    The file should look like the following.

    # This file is the libs recipe.
    SUMMARY = "Simple libs application"
    LIC_FILES_CHKSUM = "file://${COMMON_LICENSE_DIR}/MIT;md5=0835ade698e0bcf8506ecda2f7b4f302"
    SRC_URI = "file:// \
    S = "${WORKDIR}"
    do_install() {
          install -d ${D}${libdir}
          install -m 0655 ${S}/ ${D}${libdir}
    FILES_${PN} += "${libdir}"
  9. Run petalinux-build -c rootfs.
Important: You need to ensure that the binary data being installed into the target file system by an install template application is compatible with the underlying hardware implementation of your system.