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