
On Fri, Dec 06, 2024 at 06:11:12AM -0700, Simon Glass wrote:
[snip]
A comment in that function says that we assume there is space after the existing fdt to use for padding, with the padding size set to CONFIG_SYS_FDT_PAD
However, there is no guarantee that this space is available. If using the control FDT, then global_data is immediately above it, so expanding the FDT and adding FDT properties will cause U-Boot to fail.
This sounds like a generic issue and should be fixed outside of a "Pi" series.
diff --git a/dts/Kconfig b/dts/Kconfig index 41a758e83a6..360611edd01 100644 --- a/dts/Kconfig +++ b/dts/Kconfig @@ -219,6 +219,17 @@ config OF_OMIT_DTB This is used for boards which normally provide a devicetree via a runtime mechanism (such as OF_BOARD), to avoid confusion.
+config OF_EXPAND
- hex # "Amount to allow the control FDT to expand"
No "# ..." because the help explains what to do here, if needed.
- default SYS_FDT_PAD if OF_LIBFDT
- default 0
A "default 0" is almost always wrong.
- help
Some boards make use of the control FDT to boot an OS, thus when
image_setup_libfdt() adds extra things to the end of the FDT, there
needs to be enough space.
Set this to the number of bytes of extra space required for the FDT.
We should just use SYS_FDT_PAD directly and not add a new option.