Сравнить два файла дерева устройств
root@orangepizero2:~# dtdiff --help
Usage: dtdiff <device tree> <device tree>
root@orangepizero2:~#
На самом деле, инструмент dtdiff - это bash-скрипт, который проверяет формат файлов,
при необходимости с помощью утилиты dtc преобразует файлы dtb в dts,
а затем выполняет команду diff -u
( -u, -U NUM, --unified[=NUM] output NUM (default 3) lines of unified context)
выводить заданное количество строк после отличий (по умолчанию 3)
Текст скрипта:
Источник: https://github.com/qemu/dtc/blob/master/dtdiff
--------------------
#! /bin/bash
# This script uses the bash <(...) extension.
# If you want to change this to work with a generic /bin/sh, make sure
# you fix that.
DTC=dtc
source_and_sort () {
DT="$1"
if [ -d "$DT" ]; then
IFORMAT=fs
elif [ -f "$DT" ]; then
case "$DT" in
*.dts)
IFORMAT=dts
;;
*.dtb)
IFORMAT=dtb
;;
esac
fi
if [ -z "$IFORMAT" ]; then
echo "Unrecognized format for $\DT" >&2
exit 2
fi
$DTC -I $IFORMAT -O dts -qq -f -s -o - "$DT"
}
if [ $# != 2 ]; then
echo "Usage: dtdiff <device tree> <device tree>" >&2
exit 1
fi
diff -u <(source_and_sort "$1") <(source_and_sort "$2")
----------------------
Пример сравнения двух файлов дерева устройств:
boot.dtb - скопирован по пути /boot/dtb-4.9.170-sun50iw9/sunxi/sun50i-h616-orangepi-zero2.dtb
sys.dtb - скопирован по пути /sys/firmware/fdt
root@orangepizero2:~# dtdiff /tmp/boot.dtb /tmp/sys.dtb
--- /dev/fd/63 2021-10-04 05:01:29.260680708 +0000
+++ /dev/fd/62 2021-10-04 05:01:29.264013982 +0000
@@ -1,6 +1,8 @@
/dts-v1/;
/memreserve/ 0x0000000048000000 0x0000000001000000;
+/memreserve/ 0x000000004989c000 0x0000000000763d37;
+/memreserve/ 0x000000007be89580 0x000000000001fa80;
/ {
#address-cells = <0x2>;
#size-cells = <0x2>;
@@ -256,7 +258,7 @@
ohci3 = "/soc@03000000/ohci3-controller@0x05311400";
pcie = "/soc@03000000/pcie@0x05400000";
pio = "/soc@03000000/pinctrl@0300b000";
- pmu0 = "/soc@03000000/twi@0x07081400/pmu";
+ pmu0 = "/soc@03000000/twi@0x07081400/pmu", "";
pwm = "/soc@03000000/pwm@0300a000";
pwm0 = "/soc@03000000/pwm0@0300a000";
pwm1 = "/soc@03000000/pwm1@0300a000";
@@ -267,11 +269,23 @@
pwm5_pin_a = "/soc@03000000/pinctrl@0300b000/pwm5@0";
pwm5_pin_b = "/soc@03000000/pinctrl@0300b000/pwm5@1";
r_pio = "/soc@03000000/pinctrl@07022000";
- reg_aldo1 = "/soc@03000000/twi@0x07081400/pmu/regulators/ldo1";
- reg_dcdc1 = "/soc@03000000/twi@0x07081400/pmu/regulators/dcdc1";
- reg_dcdc2 = "/soc@03000000/twi@0x07081400/pmu/regulators/dcdc2";
- reg_dcdc3 = "/soc@03000000/twi@0x07081400/pmu/regulators/dcdc3";
+ reg_aldo1 = "/soc@03000000/twi@0x07081400/pmu/regulators/aldo1", "";
+ reg_aldo2 = "/soc@03000000/twi@0x07081400/pmu/regulators/aldo2", "";
+ reg_aldo3 = "/soc@03000000/twi@0x07081400/pmu/regulators/aldo3", "";
+ reg_bldo1 = "/soc@03000000/twi@0x07081400/pmu/regulators/bldo1", "";
+ reg_bldo2 = "/soc@03000000/twi@0x07081400/pmu/regulators/bldo2", "";
+ reg_bldo3 = "/soc@03000000/twi@0x07081400/pmu/regulators/bldo3", "";
+ reg_bldo4 = "/soc@03000000/twi@0x07081400/pmu/regulators/bldo4", "";
+ reg_cldo1 = "/soc@03000000/twi@0x07081400/pmu/regulators/cldo1", "";
+ reg_cldo2 = "/soc@03000000/twi@0x07081400/pmu/regulators/cldo2", "";
+ reg_cldo3 = "/soc@03000000/twi@0x07081400/pmu/regulators/cldo3", "";
+ reg_dcdc1 = "/soc@03000000/twi@0x07081400/pmu/regulators/dcdca", "";
+ reg_dcdc2 = "/soc@03000000/twi@0x07081400/pmu/regulators/dcdcb", "";
+ reg_dcdc3 = "/soc@03000000/twi@0x07081400/pmu/regulators/dcdcc", "";
+ reg_dcdc4 = "/soc@03000000/twi@0x07081400/pmu/regulators/dcdcd", "";
+ reg_dcdc5 = "/soc@03000000/twi@0x07081400/pmu/regulators/dcdce", "";
reg_dldo1 = "/soc@03000000/twi@0x07081400/pmu/regulators/ldo2";
+ reg_sw = "/soc@03000000/twi@0x07081400/pmu/regulators/sw", "";
rgb24_pins_a = "/soc@03000000/pinctrl@0300b000/rgb24@0";
rgb24_pins_b = "/soc@03000000/pinctrl@0300b000/rgb24@1";
rtc = "/soc@03000000/rtc@07000000";
@@ -332,7 +346,7 @@
spi1_pins_c = "/soc@03000000/pinctrl@0300b000/spi1@2";
standby_blue = "/soc@03000000/pinctrl@0300b000/standby@1";
standby_bt = "/soc@03000000/pinctrl@0300b000/standby@2";
- standby_param = "/soc@03000000/twi@0x07081400/pmu/standby_param";
+ standby_param = "/soc@03000000/twi@0x07081400/pmu/standby_param", "";
standby_red = "/soc@03000000/pinctrl@0300b000/standby@0";
ths = "/soc@03000000/thermal_sensor";
ths_calib = "/sunxi-sid-ng@03006000/calib@14";
@@ -444,9 +458,9 @@
};
chosen {
- bootargs = "earlyprintk=sunxi-uart,0x05000000 loglevel=8 initcall_debug=1
console=ttyS0 init=/init";
- linux,initrd-end = <0x0 0x0>;
- linux,initrd-start = <0x0 0x0>;
+ bootargs = "root=UUID=725764e4-aab7-4776-a29f-b3f2100834b8 rootwait
rootfstype=ext4 console=ttyS0,115200 console=tty1 consoleblank=0
loglevel=1 ubootpart=eb1890ff-01 disp_reserve=3686400,0x7bf51cc0 ";
+ linux,initrd-end = <0x0 0x49fffd37>;
+ linux,initrd-start = <0x0 0x4989c000>;
};
clocks {
@@ -1692,7 +1706,7 @@
clocks = <0xd3>;
compatible = "arm,cortex-a53", "arm,armv8";
cpu-idle-states = <0xd5>;
- cpu-supply = <0xd6>;
+ cpu-supply = <0x18a>;
device_type = "cpu";
dynamic-power-coefficient = <0x64>;
enable-method = "psci";
@@ -1760,39 +1774,39 @@
dram_clk = <0x2d0>;
dram_dx_dri = <0xe0e0e0e>;
dram_dx_odt = <0x8080808>;
- dram_mr0 = <0x840>;
- dram_mr1 = <0x4>;
+ dram_mr0 = <0x30fa>;
+ dram_mr1 = <0x4000000>;
dram_mr11 = <0x0>;
dram_mr12 = <0x0>;
dram_mr13 = <0x0>;
dram_mr14 = <0x0>;
dram_mr16 = <0x0>;
dram_mr17 = <0x0>;
- dram_mr2 = <0x8>;
+ dram_mr2 = <0x1f14>;
dram_mr22 = <0x0>;
- dram_mr3 = <0x0>;
+ dram_mr3 = <0x4>;
dram_mr4 = <0x0>;
dram_mr5 = <0x0>;
dram_mr6 = <0x0>;
- dram_odt_en = <0x1>;
- dram_para1 = <0x30fa>;
- dram_para2 = <0x1000>;
- dram_tpr0 = <0x0>;
+ dram_odt_en = <0xe0e0e0e>;
+ dram_para1 = <0xe0e>;
+ dram_para2 = <0x1>;
+ dram_tpr0 = <0x20>;
dram_tpr1 = <0x0>;
- dram_tpr10 = <0xf83438>;
+ dram_tpr10 = <0x0>;
dram_tpr11 = <0x0>;
dram_tpr12 = <0x0>;
- dram_tpr13 = <0x40>;
+ dram_tpr13 = <0x0>;
dram_tpr2 = <0x0>;
dram_tpr3 = <0x0>;
dram_tpr4 = <0x0>;
dram_tpr5 = <0x0>;
- dram_tpr6 = <0x33808080>;
+ dram_tpr6 = <0x0>;
dram_tpr7 = <0x0>;
dram_tpr8 = <0x0>;
dram_tpr9 = <0x0>;
dram_type = <0x3>;
- dram_zq = <0x3f3fdd>;
+ dram_zq = <0x8080808>;
linux,phandle = <0x17b>;
phandle = <0x17b>;
};
@@ -1932,7 +1946,7 @@
memory@40000000 {
device_type = "memory";
- reg = <0x0 0x40000000 0x0 0x20000000>;
+ reg = <0x0 0x40000000 0x0 0x40000000>;
};
n_brom {
@@ -2399,7 +2413,10 @@
};
disp@01000000 {
- boot_disp = <0x0>;
+ boot_disp = <0x40a>;
+ boot_disp1 = <0x0>;
+ boot_disp2 = <0x0>;
+ boot_fb0 = "7bf51cc0,500,2d0,20,1400,1e0,f0,320,1e0";
chn_cfg_mode = <0x1>;
clocks = <0xb 0x98 0x12 0x13 0x14 0x15 0x16>;
compatible = "allwinner,sunxi-disp";
@@ -2450,6 +2467,7 @@
screen1_output_scan = <0x0>;
screen1_output_type = <0x2>;
status = "okay";
+ tv_vdid = <0x7be852a0>;
};
dma-controller@03002000 {
@@ -3157,12 +3175,7 @@
gpio_para {
compatible = "allwinner,sunxi-init-gpio";
device_type = "gpio_para";
- easy_light_used = <0x1>;
- gpio_num = <0x2>;
- gpio_pin_1 = <0x53 0x2 0xc 0x1 0xffffffff 0xffffffff 0x0>;
- gpio_pin_2 = <0x53 0x2 0xd 0x1 0xffffffff 0xffffffff 0x1>;
- normal_led = "gpio_pin_2";
- normal_led_light = <0x1>;
+ gpio_num = <0x0>;
status = "okay";
};
@@ -3301,6 +3314,22 @@
status = "okay";
};
+ leds {
+ compatible = "gpio-leds";
+
+ power {
+ default-state = "off";
+ gpios = <0x53 0x2 0xc 0x1 0xffffffff 0xffffffff 0x0>;
+ label = "orangepi:red:power";
+ };
+
+ status {
+ default-state = "on";
+ gpios = <0x53 0x2 0xd 0x1 0xffffffff 0xffffffff 0x0>;
+ label = "orangepi:green:status";
+ };
+ };
+
mbus-controller@047fa000 {
#mbus-cells = <0x1>;
compatible = "allwinner,sun50i-mbus";
@@ -5171,14 +5200,118 @@
status = "okay";
pmu {
- compatible = "x-powers,axp1530";
- linux,phandle = <0x127>;
- phandle = <0x127>;
+ compatible = "x-powers,axp806";
+ linux,phandle = <0x18b>;
+ phandle = <0x18b>;
reg = <0x36>;
wakeup-source;
regulators {
+ aldo1 {
+ linux,phandle = <0x191>;
+ phandle = <0x191>;
+ regulator-always-on;
+ regulator-final-delay-us = <0x32>;
+ regulator-max-microvolt = <0x325aa0>;
+ regulator-min-microvolt = <0x325aa0>;
+ regulator-name = "axp806-aldo1";
+ regulator-step-delay-us = <0x19>;
+ };
+
+ aldo2 {
+ linux,phandle = <0x192>;
+ phandle = <0x192>;
+ regulator-always-on;
+ regulator-final-delay-us = <0x32>;
+ regulator-max-microvolt = <0x325aa0>;
+ regulator-min-microvolt = <0x325aa0>;
+ regulator-name = "axp806-aldo2";
+ regulator-step-delay-us = <0x19>;
+ };
+
+ aldo3 {
+ linux,phandle = <0x193>;
+ phandle = <0x193>;
+ regulator-always-on;
+ regulator-final-delay-us = <0x32>;
+ regulator-max-microvolt = <0x325aa0>;
+ regulator-min-microvolt = <0x325aa0>;
+ regulator-name = "axp806-aldo3";
+ regulator-step-delay-us = <0x19>;
+ };
+
+ bldo1 {
+ linux,phandle = <0x194>;
+ phandle = <0x194>;
+ regulator-always-on;
+ regulator-final-delay-us = <0x32>;
+ regulator-max-microvolt = <0x1b7740>;
+ regulator-min-microvolt = <0x2bf20>;
+ regulator-name = "axp806-bldo1";
+ regulator-step-delay-us = <0x19>;
+ };
+
+ bldo2 {
+ linux,phandle = <0x195>;
+ phandle = <0x195>;
+ regulator-final-delay-us = <0x32>;
+ regulator-max-microvolt = <0x1cfde0>;
+ regulator-min-microvolt = <0xaae60>;
+ regulator-name = "axp806-bldo2";
+ regulator-step-delay-us = <0x19>;
+ };
+
+ bldo3 {
+ linux,phandle = <0x196>;
+ phandle = <0x196>;
+ regulator-final-delay-us = <0x32>;
+ regulator-max-microvolt = <0x1cfde0>;
+ regulator-min-microvolt = <0xaae60>;
+ regulator-name = "axp806-bldo3";
+ regulator-step-delay-us = <0x19>;
+ };
+
+ bldo4 {
+ linux,phandle = <0x197>;
+ phandle = <0x197>;
+ regulator-final-delay-us = <0x32>;
+ regulator-max-microvolt = <0x1cfde0>;
+ regulator-min-microvolt = <0xaae60>;
+ regulator-name = "axp806-bldo4";
+ regulator-step-delay-us = <0x19>;
+ };
+
+ cldo1 {
+ linux,phandle = <0x198>;
+ phandle = <0x198>;
+ regulator-final-delay-us = <0x32>;
+ regulator-max-microvolt = <0x325aa0>;
+ regulator-min-microvolt = <0xaae60>;
+ regulator-name = "axp806-cldo1";
+ regulator-step-delay-us = <0x19>;
+ };
+
+ cldo2 {
+ linux,phandle = <0x199>;
+ phandle = <0x199>;
+ regulator-final-delay-us = <0x32>;
+ regulator-max-microvolt = <0x401640>;
+ regulator-min-microvolt = <0xaae60>;
+ regulator-name = "axp806-cldo2";
+ regulator-step-delay-us = <0x19>;
+ };
+
+ cldo3 {
+ linux,phandle = <0x19a>;
+ phandle = <0x19a>;
+ regulator-final-delay-us = <0x32>;
+ regulator-max-microvolt = <0x325aa0>;
+ regulator-min-microvolt = <0xaae60>;
+ regulator-name = "axp806-cldo3";
+ regulator-step-delay-us = <0x19>;
+ };
+
dcdc1 {
linux,phandle = <0x129>;
phandle = <0x129>;
@@ -5213,6 +5346,60 @@
regulator-step-delay-us = <0x19>;
};
+ dcdca {
+ linux,phandle = <0x18a>;
+ phandle = <0x18a>;
+ regulator-always-on;
+ regulator-final-delay-us = <0x32>;
+ regulator-max-microvolt = <0x173180>;
+ regulator-min-microvolt = <0x927c0>;
+ regulator-name = "axp806-dcdca";
+ regulator-step-delay-us = <0x19>;
+ };
+
+ dcdcb {
+ linux,phandle = <0x18d>;
+ phandle = <0x18d>;
+ regulator-final-delay-us = <0x32>;
+ regulator-max-microvolt = <0x26e8f0>;
+ regulator-min-microvolt = <0xf4240>;
+ regulator-name = "axp806-dcdcb";
+ regulator-step-delay-us = <0x19>;
+ };
+
+ dcdcc {
+ linux,phandle = <0x18e>;
+ phandle = <0x18e>;
+ regulator-always-on;
+ regulator-final-delay-us = <0x32>;
+ regulator-max-microvolt = <0x173180>;
+ regulator-min-microvolt = <0x927c0>;
+ regulator-name = "axp806-dcdcc";
+ regulator-step-delay-us = <0x19>;
+ };
+
+ dcdcd {
+ linux,phandle = <0x18f>;
+ phandle = <0x18f>;
+ regulator-always-on;
+ regulator-final-delay-us = <0x32>;
+ regulator-max-microvolt = <0x325aa0>;
+ regulator-min-microvolt = <0x927c0>;
+ regulator-name = "axp806-dcdcd";
+ regulator-step-delay-us = <0x19>;
+ };
+
+ dcdce {
+ linux,phandle = <0x190>;
+ phandle = <0x190>;
+ regulator-always-on;
+ regulator-final-delay-us = <0x32>;
+ regulator-max-microvolt = <0x325aa0>;
+ regulator-min-microvolt = <0x325aa0>;
+ regulator-name = "axp806-dcdce";
+ regulator-step-delay-us = <0x19>;
+ };
+
ldo1 {
linux,phandle = <0x68>;
phandle = <0x68>;
@@ -5234,12 +5421,18 @@
regulator-name = "axp1530-dldo1";
regulator-step-delay-us = <0x19>;
};
+
+ sw {
+ linux,phandle = <0x19b>;
+ phandle = <0x19b>;
+ regulator-name = "axp806-sw";
+ };
};
standby_param {
- linux,phandle = <0x128>;
- phandle = <0x128>;
- vcc-dram = <0x4>;
+ linux,phandle = <0x18c>;
+ phandle = <0x18c>;
+ vcc-dram = <0x8>;
};
};
};