petalinux-config
下配置:
Auto Config Setting →
[ ] kernel auto config 以及 [ ] u-boot auto config 先不选;(离线编译)
Subsystem AUTO Hardware Settings → Flash Settings
选择 Advanced bootable images storage Setting →
boot image settings → image storage media (primary sd) → ( X ) primary flash
kernel image settings → image storage media (primary sd) → ( X ) primary flash
修改QSPI Flash分区:
Subsystem AUTO Hardware Settings → Flash Settings
- boot分区: 存放的是boot.bin
(boot)name: 0xA00000
- boot的环境变量分区:存放的是u-boot的环境变量设置
(bootenv)name:0x10000
- kernel分区:存放的是image.ub
(kernel)name:0x1500000
- boot.scr(额外增加的分区):存放boot.scr文件
(boot.scr)name:0x10000
注意:这里后面的数字是指分配的大小
分区的大小只要大于实际存放在这些分区中文件的大小即可;
进入:Image Packaging Configuration→
修改文件类型:Root filesystem type (INITRD)→ (X) INITRAMFS
配置U-BOOT:
petalinux-config -c u-boot
:
设置boot.scr的偏移量:
ARM architecture→ (0x3F80000) Boot script offset→ 0x1F10000
该值为:boot分区大小(0xA00000) + u-boot环境变量分区的大小(0x10000) + 内核分区的大小(0x1500000);(以本文上述为例)
修改 OFFSET
meta_user -> recipes-bsp->uboot->u-boot-zynq-src.bbappend
QSPI_KERNEL_OFFSET = “0xA10000” (内核前两个分区大小的和:boot分区 + u-boot环境变量分区)
QSPI_FIT_IMAGE_SIZE = “0x1500000”(petalinux-config中配置的kernel分区的大小)
上述配置完成之后编译工程即可:petalinux-bulid
编译完成后打包BOOT.bin
,需要把fsbl、u-boot、kernel以及boot.scr
都打包进BOOT.bin
文件中:
petalinux-package --boot --fsbl ./images/linux/zynqMP_fsbl.elf --fpga --u-boot --kernel --add ./images/linux/boot.scr --offset 0x01F10000 --force
批处理方式烧写Boot.bin到QSPI-Flash
在windows系统下的Vitis烧写QSPI-Flsh操作:
- 批处理文件:
call D:\FpgaTool\Vitis2023_2\Vitis\2023.2\bin\program_flash -f BOOT.bin -offset 0 -flash_type qspi-x4-single -fsbl fsbl.elf -verify
pause
- FSBL.elf:使用vitis生成的;
运行批处理文件即可;
xsct下执行program_flash会打印帮助
xsct% program_flash
WARNING: [Common 17-259] Unknown Tcl command ‘program_flash’ sending command to the OS shell for execution. It is recommended to use ‘exec’ to send the command to the OS shell.****** Program Flash
……
参考:ALINX Zynq MPSoC XILINX FPGA视频教程 Linux基础开发—QSPI FLASH系统搭建及启动