petalinux 修改设备树
一、设备树生成及编译
1、执行petalinux-create创建工程
2、执行petalinux-config --get-hw-description导入硬件配置
3、执行petalinux-config -c device-dree生成设备树,生成的设备树在petalinux_project\components\plnx_workspace\device-tree\ 目录下
4、执行petalinux-build -c device-dree 编译设备树,编译后的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-dree编译设备树
三、设备树反编译
dtb文件可用dtc编译工具反编译成dts,linux提供的dtc源码在petalinux_project\build\tmp\work-shared\zynqmp-generic\
kernel-source\scripts\dtc目录下。执行petalinux-build后,会将dtc源码编译成dtc应用程序petalinux_project\build\tmp\sysroots-components\x86_64\dtc-native\usr\bin\dtc,
可以把system.dtb复制到该目录下,进入该目录。执行“./dtc -I dtb -O dts -o system.dts system.dtb” 会生成system.dts。
或则使用linux自带的dtc命令直接编译:dtc -I dtb -O dts -o system.dts system.dtb
【推荐】国内首个AI IDE,深度理解中文开发场景,立即下载体验Trae
【推荐】编程新体验,更懂你的AI,立即体验豆包MarsCode编程助手
【推荐】抖音旗下AI助手豆包,你的智能百科全书,全免费不限次数
【推荐】轻量又高性能的 SSH 工具 IShell:AI 加持,快人一步
· 记一次.NET内存居高不下排查解决与启示
· 探究高空视频全景AR技术的实现原理
· 理解Rust引用及其生命周期标识(上)
· 浏览器原生「磁吸」效果!Anchor Positioning 锚点定位神器解析
· 没有源码,如何修改代码逻辑?
· 分享4款.NET开源、免费、实用的商城系统
· 全程不用写代码,我用AI程序员写了一个飞机大战
· MongoDB 8.0这个新功能碉堡了,比商业数据库还牛
· 白话解读 Dapr 1.15:你的「微服务管家」又秀新绝活了
· 上周热点回顾(2.24-3.2)