转载: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. .net 将DLL程序集生成到指定目录中

    .在程序集右键属性 .在程序集属性界面中找到生成事件 在预先生成事件命令行添加: IF NOT EXIST "$(ProjectDir)..\Bin" MD "$(Pro ...

  2. Delphi XE开发 Android 开机自动启动

    https://blog.csdn.net/tanqth/article/details/74357209 Android 下的广播 在Android下,要让我们开发的APP能在开机时自动启动,必须使 ...

  3. CSS技巧:逐帧动画抖动解决方案

    笔者所在的前端团队主要从事移动端的H5页面开发,而团队使用的适配方案是: viewport units + rem.具体可以参见凹凸实验室的文章 – 利用视口单位实现适配布局 . 笔者目前(2017. ...

  4. c++ istream转换为std::string

    std::istreambuf_iterator<char> eos; std::string s(std::istreambuf_iterator<char>(stream) ...

  5. 熟悉使用ConfigParser库读写配置文件

    Python的配置文件 配置文件 setting.ini文件是一个纯文本 [DataBase1] username = admin passwors = root [DataBase2] hostna ...

  6. Windows下Visual Studio 2013编译Lua 5.2.3

    1.创建一个Visual C++的Empty Project,如果需要支持Windows XP将Platform Toolset设置为Visual Studio 2013 - Windows XP ( ...

  7. tars环境部署

    author: headsen  chen date: 2018-10-18 12:35:40 注意:依据Git上的tars搭建步骤整理而来 参考: https://max.book118.com/h ...

  8. GDI+绘制半圆按钮

    新建一个用户控件: public partial class UserControl1 : UserControl { public UserControl1() { InitializeCompon ...

  9. eclipse打断点只进入class文件中的解决办法

    内容来源 https://www.cnblogs.com/scode2/p/8671908.html#undefined 是由于对应的Java类跟编译后的class文件,没有关联上, 解决办法: 在打 ...

  10. openstack 部署(Q版)-----keystone认证服务安装配置

    一.新建数据库及用户 CREATE DATABASE keystone; GRANT ALL PRIVILEGES ON keystone.* TO 'keystone'@'localhost' ID ...