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