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 [] – Print one level starting at fdt set [] – Set [to ]
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查询命令看所修改的内容是否已永久生效。
免责声明:文章内容来自互联网,本站不对其真实性负责,也不承担任何法律责任,如有侵权等情况,请与本站联系删除。
转载请注明出处:全志平台uboot节点dts使用说明 https://www.yhzz.com.cn/a/14397.html