Migrate from PetaLinux project to Yocto project
PetaLinux is a development and build environment which automate tasks required to boot embedded Linux on Xilinx Platforms. It uses Yocto underneath for configuring and building various Xilinx components. This page helps to migrate the PetaLinux generated conf files to Yocto project.
Note that this flow is provided as is and not supported by Xilinx Technical Support. This flow only works in 2021.1 - 2022.2.
For 2023.1 and later releases this flow has been deprecated, please use Gen Machine Conf instead gen-machine-conf/README.md at main · Xilinx/gen-machine-conf , this presentation and this README are also of value.
Table of Contents
Exporting PetaLinux Project
This section provides the steps to export the Petalinux project into a .run file which could be easily imported into the Yocto project.
Step 1: Create the petalinux project using template flow/bsp flow and configure it as required.
$ petalinux-create -t project -s <bsp path>
$ petalinux-config --silentconfig
settings.sh is for bash if shell is csh use settings.csh.
Step 2: Get the script and run it to generate the .run file.
The above yocto-migrate.sh script will take the petalinux project as input which is specified as argument and creates the plnx-yocto-migrate.run file.
$ chmod a+x yocto-migrate.sh
$ ./yocto-migrate.sh <petalinux project path>
Importing Petalinux Project into Yocto Project
Step 1: Create yocto project using below steps
$ mkdir yocto
$ cd yocto
$ repo init -u https://github.com/Xilinx/yocto-manifests.git -b <branch-name>
$ repo sync
$ chmod 666 setupsdk
Step 2: To import the petalinux data into yocto project run the plnx-yocto-migrate.run which is generated in the section 'Exporting Petalinux Project' above. This will create and extract the files into yocto/sources/petalinux directory.
$ ./plnx-yocto-migrate.run yocto
$ ls <yocto project>/sources/petalinux/
etc plnx-setupsdk plnxtool.conf project-spec
plnx-setupsdk | Setup script to add petalinux project environment into the yocto project. This will be called inside the setupsdk file if you specify the PLNX_SETUP=1. |
---|---|
etc/ | This directory will contain the tcl script which will be used to create the uboot/device-tree configuration files Ex: system-conf.dtsi. |
plnxtool.conf | Petalinux generated .conf file with yocto variables. You can edit this file as required and build in yocto project. |
project-spec/ | Project configuration files directory. It will have the hardware file(xsa) which was included in petalinux project. |
Step 3: source the setupsdk and build
$ PLNX_SETUP=1 source setupsdk
This will copy plnxtool.conf file into yocto/build/conf directory from yocto/sources/petalinux and add yocto/sources/petalinux/project-spec/meta-user layer into yocto/build/conf/bblayers.conf file.
It is always recomended to use PLNX_SETUP=1 when sourcing the setupsdk to setup petalinux environment properly otherwise build may fail.
$ bitbake petalinux-image-minimal
The images/linux directory will be created in yocto/sources/petalinux/
User can not run any petalinux commands in <yocto project>/source/petalinux(for example, petalinux-package to generate BOOT.BIN), an error will be encountered since the current directory is not part of a petalinux project. Instead user can copy images/linux directory into the petalinux project for running any subsequent petalinux commands.
Output Logs
:source plnx-tool/settings.sh
PetaLinux environment set to '/scratch/yocto-migrate/plnx-tool'
INFO: Checking free disk space
INFO: Checking installed tools
INFO: Checking installed development libraries
INFO: Checking network and other services
WARNING: No tftp server found - please refer to "UG1144 2020.2 PetaLinux Tools Documentation Reference Guide" for its impact and solution
:petalinux-create -t project -s xilinx-zcu102-v2020.2-final.bsp
INFO: Create project:
INFO: Projects:
INFO: * xilinx-zcu102-2020.2
INFO: Has been successfully installed to /scratch/yocto-migrate/
INFO: New project successfully created in /scratch/yocto-migrate/
:cd xilinx-zcu102-2020.2/
:petalinux-config --silentconfig
INFO: Sourcing build tools
[INFO] Generating Kconfig for project
[INFO] Silentconfig project
[INFO] Extracting yocto SDK to components/yocto
[INFO] Sourcing build environment
[INFO] Generating kconfig for Rootfs
[INFO] Silentconfig rootfs
[INFO] Generating plnxtool conf
[INFO] Adding user layers
[INFO] Generating workspace directory
[INFO] Successfully configured project
:./yocto-migrate.sh xilinx-zcu102-2020.2/
:ls plnx-yocto-migrate.run
plnx-yocto-migrate.run
:mkdir yocto;cd yocto
:repo init -u https://github.com/Xilinx/yocto-manifests.git -b rel-v2020.2
Get https://gerrit.googlesource.com/git-repo/clone.bundle
Get https://gerrit.googlesource.com/git-reporemote: Finding sources: 100% (7/7)…
repo has been initialized in /scratch/yocto-migrate/yocto
:repo sync
…
Checking out projects: 100% (17/17), done.repo sync has finished successfully.
:./plnx-yocto-migrate.run .
:PLNX_SETUP=1 source setupsdk
You had no conf/local.conf file. This configuration file has therefore been…
NOTE: Starting bitbake server...
:bitbake petalinux-image-minimal
Parsing recipes: 100% |##############################################################################################| Time: 0:00:28
Parsing of 3060 .bb files complete (0 cached, 3060 parsed). 4329 targets, 248 skipped, 0 masked, 0 errors.
NOTE: Resolving any missing task queue dependencies
…
meta-user = "HEAD:79a30746e1237daecfc99717450b1efdcb49afec"
…
NOTE: Setscene tasks completed
NOTE: Tasks Summary: Attempted 3113 tasks of which 2406 didn't need to be rerun and all succeeded.
NOTE: Writing buildhistoryNOTE: Writing buildhistory took: 4 seconds
:ls sources/petalinux/images/linux/
bl31.bin image.ub rootfs.cpio.gz rootfs.tar.gz u-boot.elf zynqmp-qemu-multiarch-arm.dtb
bl31.elf pmufw.elf rootfs.cpio.gz.u-boot system.bit vmlinux zynqmp-qemu-multiarch-pmu.dtb
boot.scr pxelinux.cfg rootfs.jffs2 system.dtb zynqmp_fsbl.elfImage rootfs.cpio rootfs.manifest
u-boot.bin zynqmp-qemu-arm.dtb
Related content
© Copyright 2019 - 2022 Xilinx Inc. Privacy Policy