On 1/28/26 3:18 PM, Beleswar Padhi wrote:
From: Marek Vasut <[email protected]>
Please drop this , it isnt needed.
When CONFIG_SPL_MULTI_DTB_FIT is enabled, multiple device trees are
packed inside the multidtb.fit FIT image. While the individual DTBs
and the FIT image start address are 8-byte aligned, the DTBs embedded
within the FIT image are not guaranteed to maintain 8-byte alignment.
This misalignment causes -FDT_ERR_ALIGNMENT failure in
setup_multi_dtb_fit() when locating the next available DTB within the
FIT blob and setting gd->fdt_blob, because of the recent libfdt
hardening since commit 0535e46d55d7 ("scripts/dtc: Update to upstream
version v1.7.2-35-g52f07dcca47c")
To fix this, check the image type when extracting
"extracting" ? This code changes mkimage, so not "extracting" but
"packing" (into fitImage), right ?
FIT image data and
set the alignment size to 8 bytes (if not already) only for flat_dt
images. This ensures correct alignment for device tree blobs as per the
DT spec, while also allowing different alignment sizes for other image
types within the FIT.
[...]
diff --git a/tools/fit_image.c b/tools/fit_image.c
index e865f65a400..f842c845771 100644
--- a/tools/fit_image.c
+++ b/tools/fit_image.c
@@ -682,9 +682,17 @@ static int fit_extract_data(struct image_tool_params
*params, const char *fname)
for (node = fdt_first_subnode(fdt, images);
node >= 0;
node = fdt_next_subnode(fdt, node)) {
- const char *data;
+ const char *data, *type;
int len;
+ /* Fallback to 8-byte alignment for DTBs if unaligned */
+ type = fdt_getprop(fdt, node, FIT_TYPE_PROP, &len);
+ if (type &&
+ len == sizeof("flat_dt") &&
+ !memcmp(type, "flat_dt", len) &&
+ align_size & 0x7)
What will be the resulting alignment if align_size = 0x1f ? 8 right ? I
think it should be 0x20 .
+ align_size = 8;