PetaLinux is brand name used by Xilinx, it is based on Yocto and pretty decent mainstream kernel, what Petalinux adds is the HSI (Hardware Software Interface from Vivado) and special tools for boot image creation.

Online version of this manual and other related documents can be found at https://wiki.trenz-electronic.de/display/PD/PetaLinux+KICKstart


Table of Content



Petalinux Project Creation- Short HOWTO

Getting Linux working on Zynq is very simple, following steps are required

  1. Vivado/SDK/PetaLinux 20xx.x installed (important do not mix versions!)
  2. Create Vivado Project, configure PS, Export HDF (XSA for 19.2 and newer)
  3. Ceate new PetaLinux project
  4. Import HDF(XSA for 19.2 and newer) into project
  5. petalinux-build
  6. copy boot.bin and image.ub to SD Card (only 2 files no more)

This is generic how-to, everything is setup for your by the Vivado->PetaLinux flow. Note, the boot.bin generated by PetaLinux may not always work, in such case it is recommended to make the boot.bin with SDK-GUI or command line tools manually.

There is no need to install anything else, or to fetch anything from any github repos, etc.

PetaLinux 2019.2

PetaLinux Installation

Creating a Project from Vivado Project

Some reference designs contains a preconfigured PetaLinux project as template. This can be used instead of creating a new project described on step two. Basic Note to TE Petalinux Templates, see: PetaLinux TE-Template#Template-PetaLinux2018.3

  1. PetaLinux Working Environment (see UG1144)
  2. (optional to create project from scretch instead of Trenz Templates) Create a New Project (see UG1144): 
    1. $ petalinux-create --type project --template <CPU_TYPE> --name <PROJECT_NAME>

      • <CPU_TYPE>: zynqMP, zynq, microblaze
      • <PROJECT_NAME>:The name of the project you are building
  3. Import Hardware Configuration (see UG1144):
  4. (optional) Configure your PetaLinux:
  5. Build System Image (see UG1144):
  6. Take u-boot.elf,  image.ub,  bl31.elf (ZynqMP only) from "<plnx-proj-root>/images/linux" for BOOT.BIN generation.  It is recommended to create the FSBL and PMU Firmware (ZynqMP only) with Vitis tools.

Petalinux Configuration

Most settings can be changed with menu-config:

Manual changes can be done in the subfolder "<plnx-proj-root>/project-spec/meta-user/"

U-Bootrecipes-bsp/u-boot/files/platform-top.hoverwrite, add UBoot settings
Device Tree

recipes-bsp/device-tree/files/system-user.dtsi

overwrite, add device tree attributes
Kernelrecipes-kernel/linux/linux-xlnx/

changes with "petalinux-config -c kernel" will be add here automatically

Appsproject-spec/meta-user/recipes-apps

add simple new app with "petalinux-create -t apps -n myapp --enable"

enable/disable with "petalinux-config -c rootfs"

PetaLinux 2018.3

PetaLinux Installation

Creating a Project from Vivado Project

Some reference designs contains a preconfigured PetaLinux project as template. This can be used instead of creating a new project described on step two. Basic Note to TE Petalinux Templates, see: PetaLinux TE-Template#Template-PetaLinux2018.3

  1. PetaLinux Working Environment (see UG1144)
  2. Create a New Project (see UG1144):
  3. Import Hardware Configuration (see UG1144):
  4. (optional) Configure your PetaLinux:
  5. Build System Image (see UG1144):
  6. Take u-boot.elf,  image.ub,  bl31.elf (ZynqMP only) from "<plnx-proj-root>/images/linux" and make BOOT.BIN.  It is recommended to create the FSBL and PMU Firmware (ZynqMP only) with SDK/HSI tools.

Petalinux Configuration

Most settings can be changed with menu-config:

Manual changes can be done in the subfolder "<plnx-proj-root>/project-spec/meta-user/"

U-Bootrecipes-bsp/u-boot/files/platform-top.hoverwrite, add UBoot settings
Device Tree

recipes-bsp/device-tree/files/system-user.dtsi
recipes-bsp/device-tree/files/zynqmp-qemu-arm.dts

overwrite, add device tree attributes
Kernelrecipes-kernel/linux/linux-xlnx/

changes with "petalinux-config -c kernel" will be add here automatically

Appsproject-spec/meta-user/recipes-apps

add simple new app with "petalinux-create -t apps -n myapp --enable"

enable/disable with "petalinux-config -c rootfs"

PetaLinux 2018.2

PetaLinux Installation

Creating a Project from Vivado Project

Some reference designs contains a preconfigured PetaLinux project as template. This can be used instead of creating a new project described on step two.

Some 18.2 designs include "./init_config.sh" to change directory path (CONFIG_TMP_DIR_LOCATION  on <plnx-proj-root>/project-spec/configs/config). This is not longer necessary with petalinux 2018.2. this files will be removed on later updates


  1. PetaLinux Working Environment (see UG1144)
  2. Create a New Project (see UG1144):
  3. Import Hardware Configuration (see UG1144):
  4. (optional) Configure your PetaLinux:
  5. Build System Image (see UG1144):
  6. Take u-boot.elf,  image.ub,  bl31.elf (ZynqMP only) from "<plnx-proj-root>/images/linux" and make BOOT.BIN.  It is recommended to create the FSBL and PMU Firmware (ZynqMP only) with SDK/HSI tools.

Petalinux Configuration

Most settings can be changed with menu-config ($ petalinux-config, petalinux-config -c kernel, petalinux-config -c rootfs).

Manual changes can be done in the subfolder "<plnx-proj-root>/project-spec/meta-user/"

U-Bootrecipes-bsp/u-boot/files/platform-top.hoverwrite, add UBoot settings
Device Tree

recipes-bsp/device-tree/files/system-user.dtsi
recipes-bsp/device-tree/files/zynqmp-qemu-arm.dts

overwrite, add device tree attributes
Kernelrecipes-kernel/linux/linux-xlnx/

changes with "petalinux-config -c kernel" will be add here automatically

PetaLinux 2017.4

PetaLinux Installation

Creating a Project from Vivado Project

Some reference designs contains a preconfigured PetaLinux project as template. This can be used instead of creating a new project described on step two.

PetaLinux 17.4 is using one absolute path in "<plnx-proj-root>/project-spec/configs/config
Change path of CONFIG_TMP_DIR_LOCATION variable to your project path "<plnx-proj-root>/build/tmp" manually or use provided "./init_config.sh" to change path variable automatically. If missing, change execution rights for init_config.sh with chmod


  1. PetaLinux Working Environment (see UG1144)
  2. Create a New Project (see UG1144):
  3. Import Hardware Configuration (see UG1144):
  4. (optional) Configure your PetaLinux:
  5. Build System Image (see UG1144):
  6. Take u-boot.elf,  image.ub,  bl31.elf (ZynqMP only) from "<plnx-proj-root>/images/linux" and make BOOT.BIN.  It is recommended to create the FSBL and PMU Firmware (ZynqMP only) with SDK/HSI tools.

Petalinux Configuration

Most settings can be changed with menu-config ($ petalinux-config, petalinux-config -c kernel, petalinux-config -c rootfs).

Manual changes can be done in the subfolder "<plnx-proj-root>/project-spec/meta-user/"

U-Bootrecipes-bsp/u-boot/files/platform-top.hoverwrite, add UBoot settings
Device Tree

recipes-bsp/device-tree/files/system-user.dtsi
recipes-bsp/device-tree/files/zynqmp-qemu-arm.dts

overwrite, add device tree attributes
Kernelrecipes-kernel/linux/linux-xlnx/

changes with "petalinux-config -c kernel" will be add here automatically

PetaLinux 2017.2

PetaLinux Installation

Creating a Project from Vivado Project

Some reference designs contains a preconfigured PetaLinux project as template. This can be used instead of creating a new project described on step two.

PetaLinux 17.2 is using one absolute path in "<plnx-proj-root>/project-spec/configs/config
Change path of CONFIG_TMP_DIR_LOCATION variable to your project path "<plnx-proj-root>/build/tmp" manually or use provided "init_config.sh" to change path variable automatically.


  1. PetaLinux Working Environment (see UG1144)
  2. Create a New Project (see UG1144):
  3. Import Hardware Configuration (see UG1144):
  4. (optional) Configure your PetaLinux:
  5. Build System Image (see UG1144):
  6. Take u-boot.elf,  image.ub,  bl31.elf (ZynqMP only) from "<plnx-proj-root>/images/linux" and make BOOT.BIN.  It is recommended to create the FSBL and PMU Firmware (ZynqMP only) with SDK/HSI tools.

Petalinux Configuration

Most settings can be changed with menu-config ($ petalinux-config, petalinux-config -c kernel, petalinux-config -c rootfs).

Manual changes can be done in the subfolder "<plnx-proj-root>/project-spec/meta-user/"

U-Bootrecipes-bsp/u-boot/files/platform-top.hoverwrite, add UBoot settings
Device Tree

recipes-bsp/device-tree/files/system-user.dtsi
recipes-bsp/device-tree/files/zynqmp-qemu-arm.dts

overwrite, add device tree attributes
Kernelrecipes-kernel/linux/linux-xlnx/changes with "petalinux-config -c kernel" will be add here automatically

PetaLinux 2017.1

PetaLinux Installation


Creating a Project from Vivado Project

Some reference designs contains a preconfigured PetaLinux project as template. This can be used instead of creating a new project described on step two.

PetaLinux 17.1 is using one absolute path in "<plnx-proj-root>/project-spec/configs/config
Change path of CONFIG_TMP_DIR_LOCATION variable to your project path "<plnx-proj-root>/build/tmp" manually.



  1. PetaLinux Working Environment (see UG1144)
  2. Create a New Project (see UG1144):
  3. Import Hardware Configuration (see UG1144):
  4. (optional) Configure your PetaLinux:
  5. Build System Image (see UG1144):
  6. Take u-boot.elf,  image.ub,  bl31.elf (ZynqMP only) and pmufw.elf (ZynqMP only) from "<plnx-proj-root>/images/linux" and make BOOT.BIN.  It is recommended to create the FSBL with SDK/HSI tools.

Petalinux Configuration

Most settings can be changed with menu-config ($ petalinux-config, petalinux-config -c kernel, petalinux-config -c rootfs).

Manual changes can be done in the subfolder "<plnx-proj-root>/project-spec/meta-user/"

U-Bootrecipes-bsp/u-boot/files/platform-top.hoverwrite, add UBoot settings
Device Treerecipes-bsp/device-tree/files/system-user.dtsioverwrite, add device tree attributes
Kernelrecipes-kernel/linux/linux-xlnx/changes with "petalinux-config -c kernel" will be add here automatically

PetaLinux 2016.4

PetaLinux Installation


Creating a Project from Vivado Project

Some reference designs contains a preconfigured PetaLinux project as template. This can be used instead of creating a new project described on step two.

PetaLinux 16.4 is using one absolute path in "<plnx-proj-root>/project-spec/configs/config
Change path of CONFIG_TMP_DIR_LOCATION variable to your project path "<plnx-proj-root>/build/tmp" manually.



  1. PetaLinux Working Environment (see UG1144)
  2. Create a New Project (see UG1144):
  3. Import Hardware Configuration (see UG1144):
  4. (optional) Configure your PetaLinux:
  5. Build System Image (see UG1144):
  6. Take u-boot.elf,  image.ub and bl31.elf (zynqMP only) from "<plnx-proj-root>/images/linux" and make BOOT.BIN.  It is recommended to create the FSBL with SDK/HSI tools.

Petalinux Configuration

Most settings can be changed with menu-config ($ petalinux-config, petalinux-config -c kernel, petalinux-config -c rootfs).

Manual changes can be done in the subfolder "<plnx-proj-root>/project-spec/meta-user/"

U-Bootrecipes-bsp/u-boot/files/platform-top.hoverwrite, add UBoot settings
Device Treerecipes-dt/device-tree/files/system-top.dtsoverwrite, add device tree attributes
Kernelrecipes-kernel/linux/linux-xlnx/changes with "petalinux-config -c kernel" will be add here automatically

PetaLinux 2016.2

PetaLinux Installation


Creating a Project from Vivado Project

Some reference designs contains a preconfigured PetaLinux project as template. This can be used instead of creating a new project described on step two.

  1. PetaLinux Working Environment (see UG1144)
  2. Create a New Project (see UG1144):
  3. Import Hardware Configuration (see UG1144):
  4. (optional) Configure your PetaLinux:
  5. Build System Image (see UG1144):
  6. Take u-boot.elf and image.ub from "<plnx-proj-root>/images/linux" and make BOOT.BIN.  It is recommended to create the FSBL with SDK/HSI tools.

Petalinux Configuration

Most settings can be changed with menu-config ($ petalinux-config).

There are 3 more files that user can edit, they are

FileDescriptionLocation
system-top.dtsDevice tree changes are to be applied here<petalinux-project>/subsystems/linux/configs/device-tree
platform-top.hU-boot changes are to be applied here<petalinux-project>/subsystems/linux/configs/u-boot
fsbl_hooks.cFSBL changes are to be applied hereSDK/HSI FSBL-Template

There should be no reason to modify any other files by editing them (most of them are generated and would be overwritten).

Additional Descriptions

References

  1. PetaLinux Tools Documentation - Reference Guide (UG1144)
  2. PetaLinux Tools Documentation - PetaLinux Command Line Reference (UG1157)
  3. https://www.devicetree.org/
    1. https://www.devicetree.org/downloads/devicetree-specification-v0.1-20160524.pdf
  4. https://github.com/Xilinx/linux-xlnx/tree/master/Documentation/devicetree/bindings