Allow extra room for modifications to FDT.
This fixes the tests with the --tfa flag, which were broken by
https://hafnium-review.googlesource.com/c/hafnium/+/8241.
Bug: 150587116
Change-Id: Ia60427fd0c7cf5655967cfff05f4e7fa018cd3af
diff --git a/src/fdt_patch.c b/src/fdt_patch.c
index 5161192..81202e2 100644
--- a/src/fdt_patch.c
+++ b/src/fdt_patch.c
@@ -95,6 +95,12 @@
goto out_unmap_fdt;
}
+ /* Allow some extra room for the modifications to the FDT. */
+ if (fdt_open_into(fdt, fdt, buf_size) != 0) {
+ dlog_error("FDT failed to open_into.\n");
+ goto out_unmap_fdt;
+ }
+
off = fdt_path_offset(fdt, "/chosen");
if (off < 0) {
dlog_error("Unable to find FDT '/chosen' node.\n");
@@ -136,6 +142,11 @@
goto out_unmap_fdt;
}
+ if (fdt_pack(fdt) != 0) {
+ dlog_error("Failed to pack FDT.\n");
+ goto out_unmap_fdt;
+ }
+
ret = true;
out_unmap_fdt: