Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

Excerpt

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

  • (optional) Create new VM with supported Linux OS.
    • Attention: Use English as OS language for your Linux System (Keyboard language can be any language). Other languages may cause errors on PetaLinux build process.
      • with OracleVM:
        • VM Setup:
          • RAM: >= 8GB
          • CPU:  >= 4
          • HDD: 200GB dynanically
            • ubuntu-18.04-desktop-amd64.iso
            • install vm guest additions
          • Network: network bridge
          • optional: add shared folder, enable drag and drop
  • Download PetaLinux  from Xilinx Website: http://www.xilinx.com/support/download/index.html/content/xilinx/en/downloadNav/embedded-design-tools.html
    • Choose  a PetaLinux Version, that's corresponding to the installed Vivado and SDK Version.
      • Example: Use Vitis (SDK+Vivado) 2019.2 with PetaLinux 2019.2
  • Use UG1144 "PetaLinux Tools Documentation - Reference Guide" that's corresponding with your PetaLinux Version
    1. Use bash as terminal:
      1. $ sudo dpkg-reconfigure dash 
        1. → press no
    2. Check "PetaLinux Tools Installation Requirements" chapter and install missing tool/libraries
      1. $ sudo apt-get update
      2. $ sudo apt-get install tofrodos iproute2 gawk make net-tools libncurses5-dev tftpd zlib1g:i386 libssl-dev flex bison libselinux1 gnupg wget diffstat chrpath socat xterm autoconf libtool tar unzip texinfo zlib1g-dev gcc-multilib build-essential screen pax gzip python 2.7.5 -y
    3. Change owner of installation directory to non root
      1. $ sudo chown <owner>:<owner> /opt/

    4. Install petalinux (Note: do not start from shared folder, copy installer into home directory)
      1. $ mkdir -p /opt/pkg/petalinux/2019.2
      2. $ ./petalinux-v2019.2-final-installer.run /opt/pkg/petalinux/2019.2
    5. source enviroment
      1. $ source /opt/pkg/petalinux/2019.2/settings.sh
    6. Deactivate Webtalk:
      1. $ petalinux-util --webtalk off
  • Note:
    • There is no need to install anything else, or to fetch anything from any github repos, etc.
    • It is recommended to test the installation by creating a dummy template project and building it.
      • Download one of the BSP Examples from Xilinx Website (Only to test your installation)
      • Install:$ petalinux-create -t project -s <path-to-bsp>
      • Build: $ petalinux-build

Creating a Project from Vivado Project

Info

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)
    • PetaLinux Tools Installation is completed.
    • (Note: do not create project from shared folder, use home directory)
    • "/bin/sh" is bash

    • Set Working Environment:
      • $ source <path-to-installed-PetaLinux>/settings.sh
  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):
    • Export Hardware Definition File (*.xsa) from the Vivado Project into the PetaLinux root folder "<plnx-proj-root>":
      • change to PetaLinux root folder:
      • Run:$ petalinux-config --get-hw-description
  4. (optional) Configure your PetaLinux:
    • While anywhere in the project folder tree:
    • Run:$ petalinux-config
    • Run:$ petalinux-config -c u-boot
    • Run:$ petalinux-config -c kernel
    • Run:$ petalinux-config -c rootfs
  5. Build System Image (see UG1144):
    • While anywhere in the project folder tree:
    • Run:$ petalinux-build
  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:

  • petalinux-config
  • petalinux-config -c u-boot
  • petalinux-config -c kernel
  • $  petalinux-config -c rootfs

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

U-Boot
  • recipes-bsp/u-boot/files/platform-top.h
overwrite, add UBoot settings
Device Tree
  • recipes-bsp/device-tree/files/system-user.dtsi
  • recipes-bsp/device-tree/files/pl-custom.dtsi
overwrite, add device tree attributes
Kernel
  • recipes-kernel/linux/linux-xlnx/

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

Apps
  • project-spec/meta-user/recipes-apps

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

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


Additional Descriptions

Children Display

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.pdfspecifications/
  4. https://github.com/Xilinx/linux-xlnx/tree/master/Documentation/devicetree/bindings

...