在ZCU106 XRT环境搭建【Xilinx Vitis】中针对我本地的环境,以及ZCU106的需求,生成了最终使用的PetaLinux工程。
PetaLinux工程的创建、编译都是使用脚本peta_build.sh 来完成的。这篇文章分析一下我本地的不同于ZCU102、ZCU104的区别。
在config.sh文件中可以针对不同硬件平台进行额外的配置。peta_build.sh在运行中会优先选择运行config.sh中的功能,而不运行自己的功能。下面进行分析。
函数:config_peta
# The first argument is the petalinux configure file
# config_peta /project-spec/configs/config
#
config_peta()
{
PETA_CONFIG_FILE=$1
echo "CONFIG_YOCTO_ENABLE_DEBUG_TWEAKS=y" >> $PETA_CONFIG_FILE
echo "CONFIG_YOCTO_LOCAL_SSTATE_FEEDS_URL=\"~/Xilinx/PetaLinux/sstate_aarch64_2019.2/aarch64\"" >> $PETA_CONFIG_FILE
echo "CONFIG_PRE_MIRROR_URL=\"file://~/Xilinx/PetaLinux/downloads\"" >> $PETA_CONFIG_FILE
}
设置以上配置的目的是避免每次编译petalinux工程时从网站去下载第三方库,而是优先使用本地的相关库。
函数:config_rootfs,rootfs_menu
# The first argument is the rootfs configure file
# config_rootfs project-spec/configs/rootfs_config
#
config_rootfs()
{
ROOTFS_CONFIG_FILE=$1
echo 'CONFIG_xrt=y' >> $ROOTFS_CONFIG_FILE
echo 'CONFIG_mnt-sd=y' >> $ROOTFS_CONFIG_FILE
echo 'CONFIG_xrt-dev=y' >> $ROOTFS_CONFIG_FILE
echo 'CONFIG_zocl=y' >> $ROOTFS_CONFIG_FILE
echo 'CONFIG_opencl-headers-dev=y' >> $ROOTFS_CONFIG_FILE
echo 'CONFIG_opencl-clhpp-dev=y' >> $ROOTFS_CONFIG_FILE
echo 'CONFIG_packagegroup-petalinux-opencv=y' >> $ROOTFS_CONFIG_FILE
echo 'CONFIG_gstreamer-vcu-examples=y' >> $ROOTFS_CONFIG_FILE
echo 'CONFIG_gstreamer-vcu-notebooks=y' >> $ROOTFS_CONFIG_FILE
echo 'CONFIG_packagegroup-petalinux-v4lutils=y' >> $ROOTFS_CONFIG_FILE
echo 'CONFIG_gst-shark=y' >> $ROOTFS_CONFIG_FILE
}
# The first argument is the rootfsconfig file
# rootfs_menu conf/user-rootfsconfig
#
rootfs_menu()
{
ROOTFSCONFIG=$1
echo 'CONFIG_xrt' >> $ROOTFSCONFIG
echo 'CONFIG_mnt-sd' >> $ROOTFSCONFIG
echo 'CONFIG_xrt-dev' >> $ROOTFSCONFIG
echo 'CONFIG_zocl' >> $ROOTFSCONFIG
echo 'CONFIG_opencl-clhpp-dev' >> $ROOTFSCONFIG
echo 'CONFIG_opencl-headers-dev' >> $ROOTFSCONFIG
echo 'CONFIG_packagegroup-petalinux-opencv' >> $ROOTFSCONFIG
echo 'CONFIG_gstreamer-vcu-examples' >> $ROOTFSCONFIG
echo 'CONFIG_gstreamer-vcu-notebooks' >> $ROOTFSCONFIG
echo 'CONFIG_packagegroup-petalinux-v4lutils' >> $ROOTFSCONFIG
echo 'CONFIG_gst-shark' >> $ROOTFSCONFIG
}
函数:config_dts
# The first argument is the rootfs configure file
# config_dts recipes-bsp/device-tree/files/system-user.dtsi
#
config_dts()
{
DTS_FILE=$1
#GLOB_DTS=${XRT_REPO_DIR}/src/runtime_src/core/edge/fragments/xlnk_dts_fragment_mpsoc.dts
#echo "cat ${XRT_REPO_DIR}/src/runtime_src/core/edge/fragments/xlnk_dts_fragment_mpsoc.dts >> recipes-bsp/device-tree/files/system-user.dtsi"
#cat ${XRT_REPO_DIR}/src/runtime_src/core/edge/fragments/xlnk_dts_fragment_mpsoc.dts >> recipes-bsp/device-tree/files/system-user.dtsi
echo "cat ${THIS_CONFIG_SCRIPT_DIR}/zcu106vcu_base_fragment.dts >> $DTS_FILE"
cat ${THIS_CONFIG_SCRIPT_DIR}/zcu106vcu_base_fragment.dts >> $DTS_FILE
}
其它平台类似,都有这个函数。用于针对ZCU106添加特定的设备树配置。
zcu106vcu_base_fragment.dts文件内容如下:
/ {
chosen {
bootargs = "earlycon clk_ignore_unused consoleblank=0 cma=1000M uio_pdrv_genirq.of_id=generic-uio";
stdout-path = "serial0:115200n8";
};
};
&axi_intc_0 {
compatible = "xlnx,xps-intc-1.00.a";
xlnx,kind-of-intr = <0x0>;
interrupt-parent = <&gic>;
interrupts = <0 89 4>;
};
&amba_pl {
zyxclmm_drm {
compatible = "xlnx,zocl";
status = "okay";
interrupt-parent = <&axi_intc_0>;
interrupts = <0 4>, <1 4>, <2 4>, <3 4>,
<4 4>, <5 4>, <6 4>, <7 4>,
<8 4>, <9 4>, <10 4>, <11 4>,
<12 4>, <13 4>, <14 4>, <15 4>,
<16 4>, <17 4>, <18 4>, <19 4>,
<20 4>, <21 4>, <22 4>, <23 4>,
<24 4>, <25 4>, <26 4>, <27 4>,
<28 4>, <29 4>, <30 4>, <31 4>;
};
vcu_apm: apm@0xb0040000 {
#address-cells = <0x1>;
#size-cells = <0x1>;
compatible = "generic-uio";
reg = <0x0 0xb0040000 0x0 0x10000>;
reg-names = "generic";
};
};
我在处理的时候没有使用其它板子的方法删除掉自身的pl.dtsi,所以与其它平台略有区别。
以上最核心的配置还是rootfs和device-tree,它门影响了驱动层面的东西,处理时候必须要注意。
以后补充其它信息。