Uboot查看并修改内核设备树节点
FDT命令说明
FDT:flattened device tree 的缩写在 U-Boot 控制台停下后,输入fdt,可以查看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
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。
其中常用的命令就是fdt list 和 fdt set,fdt list 用来查询节点配置,fdt set 用来修改节点配置。
1. 查询配置
首先确定要查询的字段在 device tree 的路径,如果不知道路径,则需要用fdt命令按以下步骤进
行查询。1. 在根目录下查找。
sunxi#fdt list /
/ {
model = "{LICHEE_CHIP}";
compatible = "arm,{LICHEE_CHIP}", "arm,{LICHEE_CHIP}";
interrupt-parent = <0x00000001>;
#address-cells = <0x00000002>;
#size-cells = <0x00000002>;
......................
cpuscfg {
};
ion {
};
dram {
};
memory@40000000 {
};
interrupt-controller@1c81000 {
};
sunxi-chipid@1c14200 {
};
timer {
};
pmu {
};
dvfs_table {
};
dramfreq {
};
gpu@0x01c40000 {
};
wlan {
};
bt {
};
btlpm {
};
};