资料准备
1、xsa 文件:top_020.xsa(使用vivado 2024.1制作)
2、设置 Petalinux (2024.1)环境变量:sptl
创建 petalinux 工程
构建工程
petalinux-create -t project --template zynq -n project
配置 petalinux 工程
cd project
petalinux-config --get-hw-description ../
问题:
INFO] Getting hardware description
[INFO] Renaming top_020.xsa to system.xsa
[INFO] Extracting yocto SDK to components/yocto. This may take time!
[INFO] Getting Platform info from HW file
[INFO] Generating Kconfig for project
[ERROR]package require xsdb FAILED: error loading hsi package: couldn’t load
file “libxv_commontasks.so”: libtinfo.so.5: cannot open shared object
file: No such file or directory
while executing “error “error loading hsi package: $msg””
(file “/opt/pkg/petalinux/2024.1/components/xsct/scripts/xsct/xsdb/xsdb.tcl”
line 11)
invoked from within “source /opt/pkg/petalinux/2024.1/components/xsct/scripts/xsct/xsdb/xsdb.tcl”
(“package ifneeded xsdb 0.1” script)[ERROR] Command gen-machineconf --soc-family zynq --hw-description
/home/aa/workspace/pro/pro_pe_hw/project/project-spec/hw-description/system.xsa
–xsct-tool /opt/pkg/petalinux/2024.1/components/xsct --output /home/aa/workspace/pro/pro_pe_hw/project/project-spec/configs
–add-rootfsconfig /home/aa/workspace/pro/pro_pe_hw/project/project-
spec/meta-user/conf/user-rootfsconfig --petalinux --menuconfig project failed
解决
sudo apt-get install libtinfo5
弹出 petalinux 工程配置窗口
重新生成 xsa 文件后,可以重新执行“petalinux-config --get-hw-description < xsa 文件所在的位置>”以重新配置 Petalinux 工程。
只需输入“petalinux-config”命令即可重新配置
配置 Linux 内核
petalinux-config -c kernel
需要等待一段时间
保存配置并退出
配置 Linux 根文件系统
petalinux-config -c rootfs
保存配置并退出
配置设备树文件
vi project-spec/meta-user/recipes-bsp/device-tree/files/system-user.dtsi
内容编辑完成之后保存退出即可。
/include/ "system-conf.dtsi"
/ {
dma_proxy {
compatible ="xlnx,dma_proxy";
dmas = <&axi_dma_0 0 &axi_dma_0 1>;
dma-names = "dma_proxy_tx", "dma_proxy_rx";
} ;
};
内容编辑完成之后保存退出即可。
编译 Petalinux 工程
petalinux-build
WARNING: XSCT has been deprecated. It will still be available for several releases. In the future, it’s recommended to start new projects with SDT workflow.
XSCT已弃用:这条警告告诉你,XSCT工具已经被标记为弃用(deprecated),意味着它虽然在当前和未来的几个版本中仍然可用,但不再被推荐用于新项目的开发。
推荐使用SDT工作流:警告还建议你,在未来开始新项目时,应该使用SDT(Software Development Tool)工作流。SDT工作流可能是一个更新或替代XSCT的更为现代和集成的开发方法。
WARNING: Logfile for failed setscene task is /home/aa/workspace/pro/pro_pe_hw/project/build/tmp/work/cortexa9t2hf-neon-xilinx-linux-gnueabi/bzip2/1.0.8-r0/temp/log.do_populate_lic_setscene.21605
WARNING: Setscene task (/home/aa/workspace/pro/pro_pe_hw/project/components/yocto/layers/poky/meta/recipes-extended/bzip2/bzip2_1.0.8.bb:do_populate_lic_setscene) failed with exit code ‘1’ - real task will be run instead
WARNING: Logfile for failed setscene task is /home/aa/workspace/pro/pro_pe_hw/project/build/tmp/work/cortexa9t2hf-neon-xilinx-linux-gnueabi/libx11/1_1.8.1-r0/temp/log.do_package_write_rpm_setscene.24362
WARNING: Setscene task (/home/aa/workspace/pro/pro_pe_hw/project/components/yocto/layers/poky/meta/recipes-graphics/xorg-lib/libx11_1.8.1.bb:do_package_write_rpm_setscene) failed with exit code ‘1’ - real task will be run insteadWARNING: Logfile for failed setscene task is /home/aa/workspace/pro/pro_pe_hw/project/build/tmp/work/cortexa9t2hf-neon-xilinx-linux-gnueabi/libx11/1_1.8.1-r0/temp/log.do_package_write_rpm_setscene.24362
WARNING: Setscene task (/home/aa/workspace/pro/pro_pe_hw/project/components/yocto/layers/poky/meta/recipes-graphics/xorg-lib/libx11_1.8.1.bb:do_package_write_rpm_setscene) failed with exit code ‘1’ - real task will be run instead
WARNING: xilinx-bootbin-1.0-r0 do_configure: Empty file /home/aa/workspace/pro/pro_pe_hw/project/build/tmp/work/zynq_generic_7z020-xilinx-linux-gnueabi/xilinx-bootbin/1.0-r0/recipe-sysroot/boot/bitstream/download-zynq-generic-7z020.bit, excluding from bif file
NOTE: Tasks Summary: Attempted 4435 tasks of which 3774 didn’t need to be rerun and all succeeded.
补充安装上面的编译包后,得到上面的结果
Failed to copy built images to tftp dir: /tftpboot
解决
去掉tftpboot的设置: petalinux-config -> Image Packaging Configuration -> Copy final images to tftpboot
再次重新编译
petalinux-build
还是存在的警告
WARNING: XSCT has been deprecated. It will still be available for several releases. In the future, it’s recommended to start new projects with SDT workflow.
WARNING: xilinx-bootbin-1.0-r0 do_configure: Empty file /home/aa/workspace/pro/pro_pe_hw/project/build/tmp/work/zynq_generic_7z020-xilinx-linux-gnueabi/xilinx-bootbin/1.0-r0/recipe-sysroot/boot/bitstream/download-zynq-generic-7z020.bit, excluding from
该命令将生成设备树 DTB 文件、fsbl 文件、U-Boot 文件、boot.scr 文件、Linux 内核和根文件系统文件。
编译完成后,生成的镜像文件将位于工程的 images 目录下
https://docs.amd.com/r/en-US/ug1144-petalinux-tools-reference-guide/Configuring-and-Building
制作 BOOT.BIN 启动文件
petalinux-package boot --fsbl --fpga ./bitstream/top.bit --u-boot --force
[INFO] File in BOOT BIN: "/home/aa/workspace/pro/pe_hw/images/linux/zynq_fsbl.elf"
[INFO] File in BOOT BIN: "/home/aa/workspace/pro/pe_hw/bitstream/top.bit"
[INFO] File in BOOT BIN: "/home/aa/workspace/pro/pe_hw/images/linux/u-boot.elf"
[INFO] File in BOOT BIN: "/home/aa/workspace/pro/pe_hw/images/linux/system.dtb"
[INFO] Generating zynq binary package BOOT.BIN...
[INFO]
****** Bootgen v2024.1
**** Build date : Apr 29 2024-12:18:25
** Copyright 1986-2022 Xilinx, Inc. All Rights Reserved.
** Copyright 2022-2024 Advanced Micro Devices, Inc. All Rights Reserved.
[INFO] : Bootimage generated successfully
[INFO] Binary is ready.
[INFO] Successfully Generated BIN File
petalinux-package boot --fsbl --fpga --u-boot --force
petalinux-package --boot --fsbl ./ images/linux/zynq_fsbl.elf ./images/linux/u-boot.elf --fpga ./images/linux/system.bit --u-boot --force
参数–boot表明我们要通过petalinux-package命令生成BOOT.BIN启动镜像文件
参数–fsbl用于指定 fsbl 镜像文件的位置zynqmp_fsb
l.elf
参数–fpga用于指定 bitstream文件的位置system.bit
参数–u-boot用于指定 U-BOOT文件的位置u-boot.elf
参数–force表示强制覆盖当前目录下的BOOT.BIN文件
选项“–fsbl”用于指定 fsbl 文件所在位置,后面接文件对应的路径信息,如果不指定文件位置,默认
对应的是 images/linux/zynq_fsbl.elf;
选项“–fpga”用于指定 bitstream文件所在位置,后面接该文件对应的
路径信息,默认对应的是 images/linux/system.bit,实际可能有区别;
选项“–u-boot”用于指定 U-Boot文件
所在位置,后面接该文件所在路径信息,默认为 images/linux/u-boot.elf。
问题
[NOTE] Argument: “–boot” has been deprecated. It is recommended to start using new python command line Argument.
[NOTE] Use: petalinux-package boot [OPTIONS]
[INFO] Getting Default bit file
[ERROR] Default bitsream() is not found,please specify a bitstream file path with --fpga
到这里得到制作SDK 需要的四个文件
但是不能确保所有的文件正确
制作 SD 启动卡
将该工程 image/linux 目录下的 BOOT.BIN、boot.scr 和 image.ub 文件拷贝到名为 boot 的分区也即/dev/sdb1 分区
将rootfs.ext4放到
sudo umount /dev/sdX2
sudo dd if=images/linux/rootfs.ext4 of=/dev/sdX2
sync
以下命令还将拉伸文件系统,以便您可以使用 SD 卡的额外空间。请务必像上面一样替换块设备节点:
sudo resize2fs /dev/sdX2
sync
开发板启动模式设置
1、插入SDK
2、启动模式设置为SDK
3、连接串口
4、上电查看
5、使用 root 用户登录,登录密码为“root”
错误
INFO: Sourcing build tools
[INFO] Silentconfig project
[INFO] Sourcing build environment
[INFO] Generating kconfig for Rootfs
[INFO] Silentconfig rootfs
[INFO] Generating plnxtool conf
ERROR: Failed to generate plnxtool.conf
ERROR: Failed to config kernel.
build/config.log
Add Extra Users (ADD_EXTRA_USERS) []
#
# configuration written to /home/aa/workspace/pro/pataliunx_pro/ALIENTEK-ZYNQ/project-spec/configs/rootfs_config
#
[INFO] Generating plnxtool conf
Traceback (most recent call last):
File "rootfs_config.py", line 351, in <module>
parse_args(sys.argv[1:])
File "rootfs_config.py", line 333, in parse_args
update_cfg(cfg_file,xilinx_arch,proot)
File "rootfs_config.py", line 117, in update_cfg
write_list(cfg_file,packages['image_packages'])
KeyError: 'image_packages'
ERROR: Failed to generate plnxtool.conf