From: Mattijs Korpershoek <mkorpershoek@kernel.org>
To: Marek Vasut <marek.vasut+renesas@mailbox.org>, u-boot@lists.denx.de
Cc: Marek Vasut <marek.vasut+renesas@mailbox.org>,
Aaron Kling <webgeek1234@gmail.com>,
Eddie Kovsky <ekovsky@redhat.com>,
George Chan <gchan9527@gmail.com>,
Julien Masson <jmasson@baylibre.com>,
Mattijs Korpershoek <mkorpershoek@kernel.org>,
Nicolas Belin <nbelin@baylibre.com>, Sam Day <me@samcday.com>,
Simon Glass <sjg@chromium.org>, Tom Rini <trini@konsulko.com>
Subject: Re: [PATCH v3 1/2] boot: android: Always use 8-byte aligned DT with libfdt
Date: Thu, 20 Nov 2025 10:38:56 +0100 [thread overview]
Message-ID: <87fra9avrj.fsf@kernel.org> (raw)
In-Reply-To: <20251119193311.127633-1-marek.vasut+renesas@mailbox.org>
Hi Marek,
Thank you for the patch.
On Wed, Nov 19, 2025 at 20:32, Marek Vasut <marek.vasut+renesas@mailbox.org> wrote:
> Newer versions of libfdt strictly check whether the FDT blob
> passed to them is at 8-byte aligned offset, if it is not, then
> the library fails checks with -FDT_ERR_ALIGNMENT . Currently,
> android_image_print_dtb_contents() passed FDT directly mapped
> from abootimg to libfdt, and this FDT is not always aligned to
> 8-byte offset. Specifically, the FDTs are somewhat packed in
> the abootimg, therefore if the first FDT blob is e.g. 0xfd bytes
> long, then the next FDT blob ends up at 0xfd offset, which is
> not 8-byte aligned.
>
> Fix this by first extracting the header into 8-byte aligned buffer,
> checking only the header for validity, and then by copying the
> entire FDT into newly allocated 8-byte aligned buffer. While this
> is not efficient, it is the correct way to handle DTs, which must
> be at 8-byte aligned offsets. Mitigate the inefficiency for the
> common case by checking whether the DT might be 8-byte aligned and
> if it is, map it directly.
>
> Signed-off-by: Marek Vasut <marek.vasut+renesas@mailbox.org>
Reviewed-by: Mattijs Korpershoek <mkorpershoek@kernel.org>
> ---
next prev parent reply other threads:[~2025-11-20 9:39 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-11-19 19:32 [PATCH v3 1/2] boot: android: Always use 8-byte aligned DT with libfdt Marek Vasut
2025-11-19 19:32 ` [PATCH v3 2/2] test/py: android: Point fdt command to aligned addresses Marek Vasut
2025-11-20 9:39 ` Mattijs Korpershoek
2025-11-19 19:39 ` [PATCH v3 1/2] boot: android: Always use 8-byte aligned DT with libfdt Tom Rini
2025-11-20 9:38 ` Mattijs Korpershoek [this message]
2025-12-05 16:22 ` Mattijs Korpershoek
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=87fra9avrj.fsf@kernel.org \
--to=mkorpershoek@kernel.org \
--cc=ekovsky@redhat.com \
--cc=gchan9527@gmail.com \
--cc=jmasson@baylibre.com \
--cc=marek.vasut+renesas@mailbox.org \
--cc=me@samcday.com \
--cc=nbelin@baylibre.com \
--cc=sjg@chromium.org \
--cc=trini@konsulko.com \
--cc=u-boot@lists.denx.de \
--cc=webgeek1234@gmail.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.