• 欢迎访问少将全栈,学会感恩,乐于付出,珍惜缘份,成就彼此、推荐使用最新版火狐浏览器和Chrome浏览器访问本网站。
  • 吐槽,投稿,删稿,交个朋友,商务沟通v:ai_draw
  • 如果您觉得本站非常有看点,那么赶紧使用Ctrl+D 收藏少将全栈吧

u-boot中fdt命令的使用

点滴 admin 11年前 (2013-12-09) 2939次浏览 已收录 0个评论 扫描二维码

依linux community的要求,从linux-3.5后,新提交的code必须对devicetree进行支持。下面介绍如何使u-boot支持devicetree,以及fdt命令的使用。

1.u-boot对fdt(flattened device tree)的支持。

实现:只要加入

#define CONFIG_OF_LIBFDT /* Device Tree support */
重新编译u-boot,就可以实现对devicetree的支持。
2.u-boot下的fdt命令使用
2.1首先查看fdt的帮助信息。
————————————————
U-Boot fdt
fdt – flattened device tree utility commands

Usage:
fdt addr addr [length] – Set the fdt location to addr
fdt move fdt newaddr length – Copy the fdt to addr and make it active
fdt resize – Resize fdt to size + padding to 4k addr
fdt print path [prop] – Recursive print starting at path
fdt list path [prop] – Print one level starting at path
fdt set path prop [val] – Set property [to val]
fdt mknode path node – Create a new node after path
fdt rm path [prop] – Delete the node or property
fdt header – Display header info
fdt bootcpu id – Set boot cpuid
fdt memory addr size – Add/Update memory node
fdt rsvmem print – Show current mem reserves
fdt rsvmem add addr size – Add a mem reserve
fdt rsvmem delete index – Delete a mem reserves
fdt chosen [start end] – Add/update the /chosen branch in the tree
start/end – initrd start/end addr
NOTE: Dereference aliases by omiting the leading ’/’, e.g. fdt print ethernet0.
U-Boot

————————————————

2.2使用fdt命令

把devicetreeblob (dtb)文件下载到内存里

—————————————–

U-Boot tftpboot 0x71000000 bshen/test-ek.dtb

—————————————–

设置fdt的地址

—————————————–

U-Boot fdt addr 0x71000000

—————————————–

然后就可以使用其余的命令参数了

—————————————–

U-Bootfdt header
magic: 0xd00dfeed
totalsize: 0x1887 (6279)
off_dt_struct: 0x38
off_dt_strings: 0x1648
off_mem_rsvmap: 0x28
version: 17
last_comp_version: 16
boot_cpuid_phys: 0x0
size_dt_strings: 0x23f
size_dt_struct: 0x1610
number mem_rsv: 0x0

—————————————–

fdt print 不跟参数时,打印出整颗树

fdt print加path参数,则打path内容,如下(其中/memory是path):

—————————————–

U-Bootfdt print /memory
memory {
device_type = “memory”;
reg = 0x70000000 0x4000000;
};

—————————————–

喜欢 (0)
[🍬谢谢你请我吃糖果🍬🍬~]
分享 (0)
关于作者:
少将,关注Web全栈开发、项目管理,持续不断的学习、努力成为一个更棒的开发,做最好的自己,让世界因你不同。
发表我的评论
取消评论

表情 贴图 加粗 删除线 居中 斜体 签到

Hi,您需要填写昵称和邮箱!

  • 昵称 (必填)
  • 邮箱 (必填)
  • 网址