[PATCH] spl: Align device tree blob address at 8-byte boundary

Bin Meng
2021-07-12T03:52:47Z

Since libfdt v1.6.1, a new requirement on the device tree address via:

commit 5e735860c478 ("libfdt: Check for 8-byte address alignment in fdt_ro_probe_()")

must be met that the device tree must be loaded in to memory at an
8-byte aligned address.

Signed-off-by: Bin Meng <bmeng.cn@gmail.com>
---

common/spl/spl_fit.c | 6 ++++++
1 file changed, 6 insertions(+)

diff --git a/common/spl/spl_fit.c b/common/spl/spl_fit.c
index f41abca0cc..9baf6aca9f 100644
--- a/common/spl/spl_fit.c
+++ b/common/spl/spl_fit.c
@@ -374,6 +374,12 @@ static int spl_fit_append_fdt(struct spl_image_info *spl_image,
*/
image_info.load_addr = spl_image->load_addr + spl_image->size;

+ /*
+ * Since libfdt v1.6.1, the device tree must be loaded in to memory
+ * at an 8-byte aligned address.
+ */
+ image_info.load_addr = roundup(image_info.load_addr, 8);
+
/* Figure out which device tree the board wants to use */
node = spl_fit_get_image_node(ctx, FIT_FDT_PROP, index++);
if (node < 0) {
--
2.25.1