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