after getting kernel with separate dtb running, i continue with DTO…
compiling above dts gives me this warning:
bpi-r2-mac.dtb: Warning (unit_address_vs_reg): Node /fragment@0 has a unit name, but no reg property
is this needed or how to fix this?
i tried to load it, but in uboot there seem no fdt apply
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 [<extrasize>] - Resize fdt to size + padding to 4k addr + some optional <extrasize> if needed
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
dto gets loaded, but after it i get “usage”…seems apply does trigger it
loaddto=echo "loaddto:${dto}";fdt addr ${dtaddr};fdt resize; setexpr fdtovaddr ${dtaddr} + F000; fatload ${device} ${partition} ${fdtovaddr} ${bpi}/${board}/${service}/dtb/${dto} && fdt apply ${fdtovaddr}
documentation of uboot uses also apply (doc/README.fdt-overlays)
- You are now ready to apply the overlay.
=> fdt apply $fdtovaddr
seems i need “OF_LIBFDT_OVERLAY”-option in uboot…
after that i got this:
fdt=4.19.13-main.dtb
27836 bytes read in 10 ms (2.7 MiB/s)
dto=bpi-r2-mac.dtb
loaddto:bpi-r2-mac.dtb
229 bytes read in 7 ms (31.3 KiB/s)
failed on fdt_overlay_apply(): FDT_ERR_NOTFOUND
base fdt does did not have a /__symbols__ node
make sure you've compiled with -@
## Booting kernel from Legacy Image at 82000000 ...
Image Name: Linux Kernel 4.19.13-main
Image Type: ARM Linux Kernel Image (uncompressed)
Data Size: 7311880 Bytes = 7 MiB
Load Address: 80008000
Entry Point: 80008000
Verifying Checksum ... OK
ERROR: Did not find a cmdline Flattened Device Tree
Could not find a valid device tree
i checked it via
[11:36:58]$ fdtdump bpi-r2-4.19.13-main_nodt.dtb | grep -C3 __symbols__
**** fdtdump is a low-level debugging tool, not meant for general use.
**** If you want to decompile a dtb, you probably want
**** dtc -I dtb -O dts <filename>
so it seems i need to compile base dtb by myself…
[11:37:14]$ dtc -@ -I dts -O dtb -o bpi-r2-base.dtb arch/arm/boot/dts/mt7623n-bananapi-bpi-r2.dts
Error: arch/arm/boot/dts/mt7623n-bananapi-bpi-r2.dts:8.1-9 syntax error
FATAL ERROR: Unable to parse input tree
line 8 is first include…so it seems i need to pass include-dir
i tried this, because include-folder in root contains the dt-bindings subfolder (including the input/input.h), but same result
dtc -i ./include -@ -I dts -O dtb -o bpi-r2-base.dtb arch/arm/boot/dts/mt7623n-bananapi-bpi-r2.dts
also tried to build dtb with “make dtbs”…same
kernel seems to use make to build dtb’s
arch/arm/Makefile:
%.dtb: | scripts
$(Q)$(MAKE) $(build)=$(boot)/dts MACHINE=$(MACHINE) $(boot)/dts/$@
but how to add “-@” to generate symbols? and modifying Makefile is maybe not the best way…only for testing
tried also moving from phandle to path like mentioned here: https://www.kernel.org/doc/Documentation/devicetree/overlay-notes.txt
added
export DTC_FLAGS=-@
to my build.sh and now i see the symbols
[09:59:40]$ fdtdump bpi-r2.dtb | grep -C3 __symbols__
**** fdtdump is a low-level debugging tool, not meant for general use.
**** If you want to decompile a dtb, you probably want
**** dtc -I dtb -O dts <filename>
device_type = "memory";
reg = <0x00000000 0x80000000 0x00000000 0x80000000>;
};
__symbols__ {
cpu_opp_table = "/opp-table";
cpu0 = "/cpus/cpu@0";
cpu1 = "/cpus/cpu@1";
uboot boots it…and i see mac set via dto 
2: eth0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc pfifo_fast state UP g0
link/ether 02:01:02:03:04:05 brd ff:ff:ff:ff:ff:ff
3: wan@eth0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc noqueue state UP 0
link/ether 02:01:02:03:04:05 brd ff:ff:ff:ff:ff:ff