技术专栏
全志平台uboot节点dts使用说明
1.前言
uboot中,在控制台修改device tree配置使用的方法
2. FDT工具
在UBOOT控制台停下后,输入fdt
sunxi#fdt
fdt - flattened device tree utility commands
Usage:
fdt addr [-c] <addr> [<length>] - Set the [control] 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 get value <var> <path> <prop> - Get <property> and store in <var>
fdt get name <var> <path> <index> - Get name of node <index> and store in <var>
fdt get addr <var> <path> <prop> - Get start address of <property> and store in <var>
fdt get size <var> <path> [<prop>] - Get size of [<property>] or num nodes and store in <var>
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
fdt save - write fdt to flash
NOTE: Dereference aliases by omiting the leading '/', e.g. fdt print ethernet0.
Fdt list 用来查询节点配置
Fdt set 用来修改节点配置
3. 查询配置
先确定要查询的字段在device tree的路径,如果不知道路径,则需要用fdt命令查询
(1)根目录查找
sunxi#fdt list /
/ {
model = "sun50iw1p1";
compatible = "arm,sun50iw1p1", "arm,sun50iw1p1";
interrupt-parent = <0x00000001>;
#address-cells = <0x00000002>;
#size-cells = <0x00000002>;
......................
cpuscfg {
};
ion {
};
dram {
...
如果找到需要的配置,比如wlan的配置,可查找关键字
sunxi#fdt list /wlan //注意路径中的 /
wlan {
compatible = "allwinner,sunxi-wlan";
clocks = <0x00000096>;
wlan_power = "vcc-wifi";
wlan_io_regulator = "vcc-wifi-io";
wlan_busnum = <0x00000001>;
status = "okay";
device_type = "wlan";
wlan_regon = <0x00000077 0x0000000b 0x00000002 0x00000001 0xffffffff 0xffffffff 0x00000000>;
wlan_hostwake = <0x00000077 0x0000000b 0x00000003 0x00000006 0xffffffff 0xffffffff 0x00000000>;
};
(2)SOC目录查找
比如nand0的配置,则该配置可能在soc目录下
sunxi#fdt list /soc
soc@01c00000 {
compatible = "simple-bus";
#address-cells = <0x00000002>;
#size-cells = <0x00000002>;
ranges;
device_type = "soc";
......................
hdmi@01ee0000 {
};
.....
(3)使用路径别名查找
别名是device tree中完整路径的一个简写,有一个专门的节点( /aliases )来表示别名的相关信息,用如下命令可以查看系统中别名的配置情况:
sunxi#fdt list /aliases
aliases {
serial0 = "/soc@01c00000/uart@01c28000";
..............
mmc0 = "/soc@01c00000/sdmmc@01c0f000";
mmc2 = "/soc@01c00000/sdmmc@01C11000";
nand0 = "/soc@01c00000/nand0@01c03000";
disp = "/soc@01c00000/disp@01000000";
lcd0 = "/soc@01c00000/lcd0@01c0c000";
hdmi = "/soc@01c00000/hdmi@01ee0000";
pwm = "/soc@01c00000/pwm@01c21400";
boot_disp = "/soc@01c00000/boot_disp";
};
注:在fdt的所有命令中,别名可用path 字段
fdt list
fdt set
4. 修改配置
(1)修改整数配置
命令格式:fdt set path prop
示例: fdt set /wlan wlan_busnum <0x2>
sunxi#fdt list /wlan
wlan {
compatible = "allwinner,sunxi-wlan";
clocks = <0x00000096>;
wlan_power = "vcc-wifi";
wlan_io_regulator = "vcc-wifi-io";
wlan_busnum = <0x00000001>;
status = "disable";
device_type = "wlan";
};
sunxi#fdt set /wlan wlan_busnum <0x2>
sunxi#fdt list /wlan
wlan {
compatible = "allwinner,sunxi-wlan";
clocks = <0x00000096>;
wlan_power = "vcc-wifi";
wlan_io_regulator = "vcc-wifi-io";
wlan_busnum = <0x00000002>; //修改后
status = "disable";
device_type = "wlan";
};
(2)修改字符串
命令格式:fdt set path prop "xxxxx"
示例: fdt set /wlan status "disable"
sunxi#fdt list /wlan
wlan {
compatible = "allwinner,sunxi-wlan";
clocks = <0x00000096>;
wlan_power = "vcc-wifi";
wlan_io_regulator = "vcc-wifi-io";
wlan_busnum = <0x00000001>;
status = "okay";
device_type = "wlan";
};
sunxi#fdt set /wlan status "disable"
sunxi#fdt list /wlan
wlan {
compatible = "allwinner,sunxi-wlan";
clocks = <0x00000096>;
wlan_power = "vcc-wifi";
wlan_io_regulator = "vcc-wifi-io";
wlan_busnum = <0x00000001>;
status = "disable"; //修改后
device_type = "wlan";
};
sunxi#
5. 保存配置
命令格式:fdt save
作用:保存配置到存储介质上,掉电不会丢失。
运行该命令后,可以接着运行 reset命令重启系统,然后用fdt查询命令看所修改的内容是否已永久生效。
声明:本文内容由易百纳平台入驻作者撰写,文章观点仅代表作者本人,不代表易百纳立场。如有内容侵权或者其他问题,请联系本站进行删除。
红包
14
2
评论
打赏
- 分享
- 举报
评论
0个
手气红包
暂无数据
相关专栏
-
浏览量:10597次2020-10-13 17:41:07
-
浏览量:1944次2020-12-30 16:54:40
-
浏览量:4571次2020-06-19 15:56:33
-
浏览量:6059次2020-10-21 16:08:13
-
浏览量:4235次2020-09-23 19:01:05
-
浏览量:2474次2020-08-25 18:07:51
-
浏览量:4876次2021-03-26 15:39:50
-
浏览量:5133次2020-08-25 18:07:54
-
浏览量:10142次2021-01-22 16:07:20
-
浏览量:6059次2020-12-25 16:29:18
-
2024-08-22 21:17:40
-
浏览量:3640次2017-11-16 11:30:55
-
浏览量:3273次2018-04-12 11:32:51
-
浏览量:11313次2020-12-16 19:13:45
-
浏览量:15321次2018-09-27 20:15:39
-
浏览量:6923次2021-01-22 15:28:47
-
浏览量:6727次2020-09-28 16:30:39
-
浏览量:10992次2020-12-16 18:56:54
-
浏览量:9476次2020-09-28 16:42:40
置顶时间设置
结束时间
删除原因
-
广告/SPAM
-
恶意灌水
-
违规内容
-
文不对题
-
重复发帖
打赏作者
free-jdx
您的支持将鼓励我继续创作!
打赏金额:
¥1
¥5
¥10
¥50
¥100
支付方式:
微信支付
打赏成功!
感谢您的打赏,如若您也想被打赏,可前往 发表专栏 哦~
举报反馈
举报类型
- 内容涉黄/赌/毒
- 内容侵权/抄袭
- 政治相关
- 涉嫌广告
- 侮辱谩骂
- 其他
详细说明
审核成功
发布时间设置
发布时间:
请选择发布时间设置
是否关联周任务-专栏模块
审核失败
失败原因
请选择失败原因
备注
请输入备注