blob: 71a9fc627e558a7af34fe25ebe85bee730d7aee2 [file] [log] [blame]
Simon Glass25fae922022-07-13 06:07:00 -06001.. SPDX-License-Identifier: GPL-2.0+
2
Heinrich Schuchardt1b0c3162024-01-14 14:53:13 +01003.. index::
4 single: fdt (command)
5
Simon Glass25fae922022-07-13 06:07:00 -06006fdt command
7===========
8
Heinrich Schuchardt44b09b32024-03-16 11:09:36 +01009Synopsis
10--------
Simon Glass25fae922022-07-13 06:07:00 -060011
12::
13
14 fdt addr [-cq] [addr [len]]
15
16Description
17-----------
18
19The fdt command provides access to flat device tree blobs in memory. It has
20many subcommands, some of which are not documented here.
21
22Flags:
23
24-c
25 Select the control FDT (otherwise the working FDT is used).
26-q
27 Don't display errors
28
29The control FDT is the one used by U-Boot itself to control various features,
30including driver model. This should only be changed if you really know what you
31are doing, since once U-Boot starts it maintains pointers into the FDT from the
32various driver model data structures.
33
34The working FDT is the one passed to the Operating System when booting. This
35can be freely modified, so far as U-Boot is concerned, since it does not affect
36U-Boot's operation.
37
38fdt addr
39~~~~~~~~
40
41With no arguments, this shows the address of the current working or control
42FDT.
43
44If the `addr` argument is provided, then this sets the address of the working or
45control FDT to the provided address.
46
47If the `len` argument is provided, then the device tree is expanded to that
48size. This can be used to make space for more nodes and properties. It is
49assumed that there is enough space in memory for this expansion.
50
51Example
52-------
53
54Get the control address and copy that FDT to free memory::
55
56 => fdt addr -c
57 Control fdt: 0aff9fd0
58 => cp.b 0aff9fd0 10000 10000
59 => md 10000 4
60 00010000: edfe0dd0 5b3d0000 78000000 7c270000 ......=[...x..'|
61
62The second word shows the size of the FDT. Now set the working FDT to that
63address and expand it to 0xf000 in size::
64
65 => fdt addr 10000 f000
Simon Glass84328cf2022-10-11 09:47:12 -060066 Working FDT set to 10000
Simon Glass25fae922022-07-13 06:07:00 -060067 => md 10000 4
68 00010000: edfe0dd0 00f00000 78000000 7c270000 ...........x..'|
69
70Return value
71------------
72
73The return value $? indicates whether the command succeeded.