转载:https://blog.csdn.net/voice_shen/article/details/7441894

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

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

实现:只要加入

#define CONFIG_OF_LIBFDT               /* Device Tree support */

重新编译u-boot,就可以实现对device tree的支持。

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命令

把device tree blob (dtb)文件下载到内存里。

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

设置fdt的地址

U-Boot> fdt addr 0x71000000

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

U-Boot> fdt header
magic: 0xd00dfeed
totalsize: 0x1887 ()
off_dt_struct: 0x38
off_dt_strings: 0x1648
off_mem_rsvmap: 0x28
version:
last_comp_version:
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-Boot> fdt print /memory
memory {
device_type = "memory";
reg = <0x70000000 0x4000000>;
};

uboot中fdt命令的使用的更多相关文章

  1. uboot中的命令体系

    一.uboot的命令体系介绍以及实例分析: U-Boot 的命令实现大多在 common 目录下.在该目录下命令的代码文件都是以“ cmd_”开头的,如下图所示: 其中每一个文件都是一个命令实现的代码 ...

  2. u-boot中添加自定义命令

    1.u-boot命令机制u-boot中,每个命令都使用一个struct cmd_tbl_s结构体定义,该定义在include/command.h中实现:struct cmd_tbl_s{ char * ...

  3. 在u-boot中添加命令

    转:http://www.embedu.org/Column/Column464.htm 作者:曾宏安,华清远见嵌入式学院讲师. u-boot是嵌入式系统中广泛使用的一种bootloader.它不仅支 ...

  4. 在U-Boot中添加自定义命令以实现自动下载程序【转】

    本文转载自:https://gaomf.cn/2016/06/26/%E5%9C%A8U-Boot%E4%B8%AD%E6%B7%BB%E5%8A%A0%E8%87%AA%E5%AE%9A%E4%B9 ...

  5. uboot中ftd命令

    可以从u-boot官网源码下载一个比较新的u-boot, 查看它的cmd/fdt.cftp://ftp.denx.de/pub/u-boot/ fdt命令使用示例nand read.jffs2 320 ...

  6. uboot中添加自定义命令

    uboot中可以通过修改源程序来添加自定义命令,进一步扩展uboot的功能. 我想在uboot下添加一条新的命令(名为varcpy),用来拷贝uboot中的环境变量. 修改方式如下: 创建新文件com ...

  7. uboot启动 及命令分析(3)

    u-boot命令 先贴一个重要结构,位于uboot/include/command.h,这个结构代表每个uboot命令 struct cmd_tbl_s { char     *name;   /* ...

  8. uboot中的快捷菜单的制作说明 【转】

    转自:http://blog.chinaunix.net/uid-22030783-id-366971.html   在uboot中加入快捷操作菜单的方法非常简单,在论坛发布的uboot201003V ...

  9. U-Boot中的filesize环境变量

    U-Boot中的环境命令可以使用$(filesize)来确定刚下载(传输)得到的文件大小. 因为使用类似tftp命令传输文件后,会自动更新filesize环境变量.如:setenv updateroo ...

随机推荐

  1. open-falcon之transfer

    功能 负责数据转发,接受agent上报的数据,然后使用一致性hash规则对数据进行分片,最后将分片后的数据分别转发至judge,graph 对接收到的数据进行合法性校验.规整 针对每个后端实例维护一个 ...

  2. Objective-C官方文档 协议

    版权声明:原创作品,谢绝转载!否则将追究法律责任. 在现实生活中,当处理某一情况的时候人们往往遵循严格的程序.执法人员他们在打官司的收集证据和询问的时候一定要遵守协议. 在面向对象的语言中,最重要的是 ...

  3. SharpGL学习笔记(六) 裁剪变换

    在OpenGL中,除了视景体定义的6个裁剪平面(上下左右前后)外, 用户还可以定义一个或者多个附加的裁剪平面,以去掉场景中无关的目标. 附加平面裁剪函数原型如下: ClipPlane(OpenGL.G ...

  4. Python 2.7.6 安装lxml模块[ubuntu14.04 LTS]

    lxml --->首字母是字母l,不是数字1 lxml 2.x : https://pypi.python.org/pypi/lxml/2.3 1xml官网:http://lxml.de/ 一 ...

  5. sencha touch JsonP 自动提示消息 masked

    //公用类 Ext.define('app.util', { alternateClassName: 'util', statics: { /*为Ext.Viewport添加一个消息提示组件(需要初始 ...

  6. 攻防对抗中常用的windows命令(渗透测试和应急响应)

    一.渗透测试 1.信息收集类 #查看系统信息 >systeminfo #查看用户信息 >net user >net user xxx #查看网络信息 >ipconfig /al ...

  7. CENTOS安装ElasticSearch

    原文链接:https://my.oschina.net/topeagle/blog/591451?fromerr=mzOr2qzZ CENTOS安装ElasticSearch ElasticSearc ...

  8. 使用Autolayout xib实现动态高度的TableViewCell

    http://my.oschina.net/u/2360693/blog/481236?p={{totalPage}} 创建Xib文件 首先将Cell做好布局,调整到满意的位置和宽度,然后开始做Aut ...

  9. MYSQL中GROUP BY不包含所有的非聚合字段时的注意事项

    本文导读:在MYSQL中使用GROUP BY分组时,我们可以select 多个非聚合字段,但是这些字段不在GROUP BY中,这样的SQL查询在SQL SERVER.ORACLE中是不合理的,且会报错 ...

  10. TOP100summit 2017:亚马逊Echo音箱能够语音识人,华人工程师揭秘设计原理

      本文编辑:Cynthia 2017年,人工智能的消费产品落地聚焦在了智能音箱上,谷歌.亚马逊纷纷推出智能音箱产品,国内的阿里巴巴推出天猫精灵,小米推出小米AI音箱.智能音箱通过语音可以发出指令,未 ...