Petalinux Project Creation- Short HOWTOGetting Linux working on Zynq is very simple, following steps are required - Vivado/SDK/PetaLinux 20xx.x installed (important do not mix versions!)
- Create Vivado Project, configure PS, Export HDF (XSA for 19.2 and newer)
- Ceate new PetaLinux project
- Import HDF(XSA for 19.2 and newer) into project
- petalinux-build
- 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 2020.2PetaLinux Installation(optional) Create new VM with supported Linux OS. Download PetaLinux from Xilinx Website: http://www.xilinx.com/support/download/index.html/content/xilinx/en/downloadNav/embedded-design-tools.html Use UG1144 "PetaLinux Tools Documentation - Reference Guide" that's corresponding with your PetaLinux Version Use bash as terminal: $ sudo dpkg-reconfigure dash → press no
Check "PetaLinux Tools Installation Requirements" chapter and install missing tool/libraries https://www.xilinx.com/support/answers/73296.html download plnx-env-setup.sh and run
$ sudo apt-get update
$ sudo apt-get install iproute2 gawk python3 python build-essential gcc git make net-tools libncurses5-dev tftpd zlib1g-dev libssl-dev flex bison libselinux1 gnupg wget git-core diffstat chrpath socat xterm autoconf libtool tar unzip texinfo zlib1g-dev gcc-multilib automake zlib1g:i386 screen pax gzip cpio python3-pip python3-pexpect xz-utils debianutils iputils-ping python3-git python3-jinja2 libegl1-mesa libsdl1.2-dev pylint3 -y
- This is necessary because lnx-env-setup.sh seems to be not install all packages correctly
Install petalinux (Note: do not start from shared folder, copy installer into home directory) $ mkdir -p ~/petalinux/2020.2 - copy petalinux-v2020.2-final-installer.run into ~/petalinux/2020.2
$ ./petalinux-v2020.2-final-installer.run
source enviroment $ source ~/petalinux/2020.2/settings.sh
Deactivate Webtalk: $ 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.
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 2. Basic Note to TE Petalinux Templates, see: PetaLinux TE-Template#PetaLinux2020.2 New with 2020.2: - Trenz FSBL patches are available for petalinux now (beta, vitis template recommended at the moment)
- Xilinx changes:
- boot.src is need for uboot now (will be generated with petalinux) see:
- "petalinux-devtool" command is need to update user layer with uboot and kernel changes
|
- 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
- (optional to create project from scretch instead of Trenz Templates) Create a New Project (see UG1144):
$ 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
- 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
- (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
- Build System Image (see UG1144):
- While anywhere in the project folder tree:
- Run:$ petalinux-build
- Take u-boot.elf, image.ub, bl31.elf (ZynqMP only) from "<plnx-proj-root>/images/linux" for BOOT.BIN generation, also boot.scr is used (put separate on SD or include into Boot.bin for QSPI boot only). It is recommended to create the FSBL and PMU Firmware (ZynqMP only) with Vitis tools.
Petalinux ConfigurationMost settings can be changed with menu-config*: - $ petalinux-config
- $ petalinux-config -c u-boot
- $ petalinux-config -c kernel
- $ petalinux-config -c rootfs
* with 2020.2 kernel and u-boot changes must be exported to the user-layer with petalinux-devtool command. Manual changes can be done in the subfolder "<plnx-proj-root>/project-spec/meta-user/" CONFIG | - project-spec/config/config
| - changes with "petalinux-config" will be saved here
| U-Boot | - recipes-bsp/u-boot/files
- recipes-bsp/u-boot/files/platform-top.h
| - changes with "petalinux-config -c u-boot" will be add in the yocto workspace
- force changes to the user layer run "petalinux-devtool finish u-boot-xlnx ${PWD}/project-spec/meta-user/ -f"
- optional overwrite, add UBoot settings on platform-top.h
| Device Tree | - recipes-bsp/device-tree/files/system-user.dtsi
- recipes-bsp/device-tree/files/pl-custom.dtsi
| - overwrite or add device tree attributes
| Kernel | - recipes-kernel/linux/linux-xlnx/
| - changes with "petalinux-config -c kernel" will be add in the yocto workspace
- force changes to the user layer run "petalinux-devtool finish linux-xlnx ${PWD}/project-spec/meta-user/ -f"
| 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"
| ROOTFS | - project-spec/config/rootfs_config
- project-spec/meta-user/conf/user-rootfsconfig
| - "petalinux-config -c rootfs" will save changes in the general config spec, only apps will be saved in user-rootfsconfig also
- user-rootfsconfig must be changed manually and will read after rootfs_config is used
| Xilinx generated configuration | | Note: config and rootfs_config are shared at the moment, they include user and xilinx default changes from XSA import |
Additional DescriptionsReferences- PetaLinux Tools Documentation - Reference Guide (UG1144)
PetaLinux Tools Documentation - PetaLinux Command Line Reference (UG1157) - https://www.devicetree.org/
- https://www.devicetree.org/specifications/
- https://github.com/Xilinx/linux-xlnx/tree/master/Documentation/devicetree/bindings
|