1 从下述页面下载petalinux installer和zcu102 bsp
2 安装petalinux
$ mkdir petalinux
$ cd petalinux/
$ ~/Downloads/petalinux-v2023.2-10121855-installer.run --platform aarch64
3 安装bsp
bsp文件是petalinux编译好的image镜像等打包,第6步依赖于bsp中的xsa文件
$ tar xf xilinx-zcu102-v2023.2-10140544.bsp
4 包含petalinux环境
$ source settings.sh
5 创建一个project
$ petalinux-create --type project --template zynqMP --name proj_cg
6 配置
$ cd proj_cg
$ petalinux-config --get-hw-description ../../xilinx-zcu102-2023.2/project-spec/hw-description/
[INFO] Sourcing buildtools
[INFO] Getting hardware description...
[INFO] Generating Kconfig for project
[INFO] Menuconfig project
[INFO] Generating kconfig for rootfs
[INFO] Silentconfig rootfs
[INFO] Adding user layers
[INFO] Generating machine conf file
[INFO] Generating plnxtool conf file
[INFO] Generating workspace directory
[INFO] Successfully configured project
之前有报错:
error loading hsi package: couldn't load file "libxv_commontasks.so": libtinfo.so.5: cannot open shared object file: No such file or directory
$ find ../ -name librdi_commontasks.so
../tools/xsct/lib/lnx64.o/librdi_commontasks.so
$ ldd ../tools/xsct/lib/lnx64.o/librdi_commontasks.so
linux-vdso.so.1 (0x00007ffe0259e000)
libboost_filesystem.so => /lib64/libboost_filesystem.so (0x00007f95bf4f2000)
libboost_program_options.so => /lib64/libboost_program_options.so (0x00007f95bedbc000)
libboost_regex.so => /lib64/libboost_regex.so (0x00007f95bed75000)
libedit.so.0 => /lib64/libedit.so.0 (0x00007f95bed38000)
libisl_iostreams.so => not found
libisl_sysinfo.so => not found
libpython3.8.so.1.0 => not found
librdi_common.so => not found
librdi_commonmain.so => not found
librdi_commonxillic.so => not found
librdi_sio.so => not found
libtcl8.5.so => not found
libdl.so.2 => /lib64/libdl.so.2 (0x00007f95bf4e9000)
libpthread.so.0 => /lib64/libpthread.so.0 (0x00007f95bf4e4000)
libstdc++.so.6 => /lib64/libstdc++.so.6 (0x00007f95bea00000)
libgomp.so.1 => /lib64/libgomp.so.1 (0x00007f95becf3000)
libgcc_s.so.1 => /lib64/libgcc_s.so.1 (0x00007f95becd8000)
libc.so.6 => /lib64/libc.so.6 (0x00007f95be600000)
/lib64/ld-linux-x86-64.so.2 (0x00007f95bf52c000)
libicudata.so.69 => /lib64/libicudata.so.69 (0x00007f95bca00000)
libicui18n.so.69 => /lib64/libicui18n.so.69 (0x00007f95bc600000)
libicuuc.so.69 => /lib64/libicuuc.so.69 (0x00007f95be80e000)
libtinfo.so.6 => /lib64/libtinfo.so.6 (0x00007f95beca9000)
libm.so.6 => /lib64/libm.so.6 (0x00007f95bc524000)
尝试手动链接后ok
$ sudo ln -s /lib64/libtinfo.so.6 /lib64/libtinfo.so.5
中间会弹出menuconfig配置,可以设置linux为本地路径,u-boot为本地路径,节省下载时间
7 编译
$ petalinux-build
[INFO] Sourcing buildtools
[INFO] Building project
[INFO] Silentconfig project
[INFO] Silentconfig rootfs
[INFO] Generating workspace directory
INFO: bitbake petalinux-image-minimal
NOTE: Started PRServer with DBfile: /work/zynq/petalinux/proj_cg/build/cache/prserv.sqlite3, Address: 127.0.0.1:41243, PID: 18391
Loading cache: 100% | | ETA: --:--:--
Loaded 0 entries from dependency cache.
Parsing recipes: 100% |#################################################################################################################################################################################################| Time: 0:01:11
Parsing of 4400 .bb files complete (0 cached, 4400 parsed). 6339 targets, 333 skipped, 1 masked, 0 errors.
NOTE: Resolving any missing task queue dependencies
NOTE: Fetching uninative binary shim file:///work/zynq/petalinux/proj_cg/components/yocto/downloads/uninative/3dd82c3fbdb59e87bf091c3eef555a05fae528eeda3083828f76cd4deaceca8b/x86_64-nativesdk-libc-3.9.tar.xz;sha256sum=3dd82c3fbdb59e87bf091c3eef555a05fae528eeda3083828f76cd4deaceca8b (will check PREMIRRORS first)
Initialising tasks: 100% |##############################################################################################################################################################################################| Time: 0:00:05
Checking sstate mirror object availability: 100% |######################################################################################################################################################################| Time: 0:01:52
Sstate summary: Wanted 1597 Local 0 Mirrors 1427 Missed 170 Current 0 (89% match, 0% complete)
NOTE: Executing Tasks
NOTE: linux-xlnx: compiling from external source tree /work/zynq/linux-xlnx/
NOTE: u-boot-xlnx: compiling from external source tree /work/zynq/u-boot-xlnx/
NOTE: Tasks Summary: Attempted 4278 tasks of which 3564 didn't need to be rerun and all succeeded.
INFO: Failed to copy built images to tftp dir: /tftpboot
[INFO] Successfully built project
参考:
教你使用 Petalinux 定制 Linux, https://www.bilibili.com/read/cv21581215/