在Petalinux中编译DPU的驱动及Linux镜像
环境要求
- Petalinux2019.1,参见https://blog.csdn.net/lulugay/article/details/99715402
Quick Way
在https://download.csdn.net/download/lulugay/11986331有做好的bsp文件
步骤
1. 创建Petalinux工程
petalinux-create --type project --template zynq --name pynqz2_dpu
cd pynqz2_dpu
petalinux-config --get-hw-description=<path to pynqz2_dpu.hdf>
2. 改为从SD卡启动
- DTG Settings->Kernel Bootargs->disable
generate boot args automatically
and enter the following bootargs inuser set kernel bootargs
console=ttyPS0,115200 root=/dev/mmcblk0p2 rw earlyprintk quiet rootfstype=ext4 rootwait cma=256M
- Image Packaging Configuration->Root filesystem type (SD card)
3. 修改设备树
将 <path to plnx project>/project-spec/meta-user/recipes-bsp/device-tree/files/system-user.dtsi
的内容改为
/include/ "system-conf.dtsi"
&amba {
xlnk {
compatible = "xlnx,xlnk-1.0";
};
};
&amba{
dpu{
#address-cells = <1>;
#size-cells = <1>;
compatible = "xilinx,dpu";
base-addr = <0x4f000000>; //CHANGE THIS ACCORDING TO YOUR DESIGN
dpucore {
compatible = "xilinx,dpucore";
interrupt-parent = <&intc>;
interrupts = <0 29 4>; //CHANGE THIS ACCORDING TO YOUR DESIGN
core-num = <0x1>; //CHANGE THIS ACCORDING TO YOUR DESIGN
};
};
};
4. 添加DPU驱动
- 将zcu102-dpu-trd-2019-1-190809/apu/dpu_petalinux_bsp/xilinx-dpu-trd-zcu102-v2019/zcu102-dpu-trd-2019-1/project-spec/meta-user下的recipes-modules文件夹复制到< path to petalinux project>/project-spec/meta-user
- 在< path to petalinux project>/project-spec/meta-user/recipes-core/images/petalinux-image-full.bbappend最后一行添加
IMAGE_INSTALL_append = "dpu"
5. 修改rootfs
petalinux-config -c rootfs
- modules -> dpu
- Petalinux Package Groups -> petalinuxgroup-petalinux-opencv -> opencv, opencv-dev
- Filesystem Packages -> console -> utils -> pkgconfig -> pkgconfig, pkgconfig-dev
7. 编译工程
petalinux-build
petalinux-package --boot --force --fsbl images/linux/zynq_fsbl.elf --fpga images/linux/*.bit --u-boot
/images/linux/BOOT.BIN
,/images/linux/image.ub
,/images/linux/rootfs.tar.gz
这些文件会在后面的步骤里用到
8. *打包工程
如果有必要的话,可以将做好的petalinux工程打包成bsp
petalinux-package --bsp -p . -o xilinx-pynq-z2-v2019.1-dpu3.0.bsp