petalinux如何修改设备树(设备树修改后编译不更新问题解决)
一、设备树生成及编译
1、执行petalinux-create创建工程
2、执行petalinux-config --get-hw-description导入硬件配置
3、执行petalinux-config -c device-tree生成设备树,生成的设备树在petalinux_project/components/plnx_workspace/device-tree/ 目录下
4、执行petalinux-build -c device-tree 编译设备树,编译后的dtb文件为petalinux_project/pre-built/linux/images/system.dtb。(如果是执行petalinux-build则一步到位编译设备树、内核、uboot等)
注:如果不是第一次编译设备树,即使修改了设备树执行petalinux-build -c device-dree也不会生成dtb文件,这时应先执行petalinux-build -c device-tree -x cleansstate 清理编译状态后再编译设备树。
二、修改设备树
petalinux_project/components/plnx_workspace/device-tree/目录下的设备树是软件自动生成的,最好不做修改,xilinux提供了一个用户设备树,该设备树为:petalinux_project/project-spec/meta-user/recipes-bsp/device-tree/files/system-user.dtsi。petalinux_project/components/plnx_workspace/device-tree/ system-top.dts最终是包含了system-user.dtsi
1、将 system-user.dtsi复制到petalinux_project/components/plnx_workspace\device-tree/ 目录下(如果将system-user.dtsi放在原来目录,则修改无效,原因未知)
2、执行petalinux-build -c device-tree -x cleansstate清理设备树编译状态
3、执行petalinux-build -c device-tree编译设备树
三、设备树反编译
dtc -I dtb -O dts -o system.dts system.dtb