转载: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. Caused by: java.lang.OutOfMemoryError: Failed to allocate a 29433932 byte allocation with 14683576 free bytes and 14MB

    解决Android 内存溢出 其实你可以添加在你的清单 android:hardwareAccelerated="false" android:largeHeap="tr ...

  2. 【Python3】端口占用监测的程序

    #!/usr/bin/env python # -*- coding:utf- -*- #python端口占用监测的程序,该程序可以监测指定IP的端口是否被占用 import socket,time, ...

  3. JS笔记 - JQ事件委托( 适用于给动态生成的脚本元素添加事件)

    最近一段时间打了一个大仗,现在总算消停点,才有时间来做个总结吧算是: 移动端遇到一个项目,是一个列表的侧滑栏,在我这里用jq写的交互事件.自测各方面都挺好的,美滋滋的给了研发.研发也美滋滋的开始开发. ...

  4. 利用按钮打开tabBar页面

    场景:当tabBar上有个人中心的时候,这里假设需要登陆才可以看到个人中心A页面,在A页面onload中先判断是否登陆,如果没有登陆就跳转到登陆页面B,待输入用户名和密码,点击登陆按钮后再跳转到A页面 ...

  5. sencha touch list 选择插件,可记忆已选项,可分组全选

    选择记忆功能参考:https://market.sencha.com/extensions/ext-plugin-rememberselection 插件代码: /* * 记住列表选择状态 * 如果分 ...

  6. JVM常用工具使用之jmap

    一.参考链接 https://www.cnblogs.com/yjd_hycf_space/p/7753847.html 二.个人的总结 一般我习惯使用 jmap -dump:live,format= ...

  7. C#取得Web程序和非Web程序的根目录的N种取法

    取得控制台应用程序的根目录方法方法1.Environment.CurrentDirectory 取得或设置当前工作目录的完整限定路径方法2.AppDomain.CurrentDomain.BaseDi ...

  8. 【BZOJ1210】[HNOI2004]邮递员 插头DP+高精度

    [BZOJ1210][HNOI2004]邮递员 Description Smith在P市的邮政局工作,他每天的工作是从邮局出发,到自己所管辖的所有邮筒取信件,然后带回邮局.他所管辖的邮筒非常巧地排成了 ...

  9. Android KITKAT 以上实现沉浸式状态栏

    extends:http://www.jianshu.com/p/f8374d6267ef 代码未行,效果先上 Flyme4.2 Android4.4.4上运行效果 如何实现 在 KITKAT 之后, ...

  10. Node复制文件

    本人开发过程中,经常遇到,要去拷贝模板到当前文件夹,经常要去托文件,为了省事,解决这个问题,写了一个node复制文件. // js/app.js:指定确切的文件名.// js/*.js:某个目录所有后 ...