[PATCH v3 06/10] binman: android_boot: vendor-dt support

Simon Glass sjg at chromium.org
Sun Jun 14 18:19:11 CEST 2026


Hi Sam,

On 2026-06-10T01:27:41, Sam Day via B4 Relay
<devnull+me.samcday.com at kernel.org> wrote:
> binman: android_boot: vendor-dt support
>
> There's many Android bootloaders out there that expect non-standard
> abootimgs. Samsung and Qualcomm, and likely many others. This quirk has
> been codified in the widely used osm0sis fork/rewrite of mkbootimg.
>
> Presumably, these vendor-specific abootimgs were conceived before the v2
> format was widely available or specified. The evidence for this is their
> hijacking of the header_version field to specify the length of a payload
> that follows the main abootimg.
>
> At least QCDT and DTBH (both of which will be implemented as binman
> etypes in following commits) use this approach.
>
> Link: https://github.com/osm0sis/mkbootimg
> Signed-off-by: Sam Day <me at samcday.com>
>
> tools/binman/etype/android_boot.py           | 41 ++++++++++++++++++++++++++--
>  tools/binman/ftest.py                        | 15 ++++++++++
>  tools/binman/test/android_boot_vendor_dt.dts | 27 ++++++++++++++++++
>  3 files changed, 81 insertions(+), 2 deletions(-)

> diff --git a/tools/binman/etype/android_boot.py b/tools/binman/etype/android_boot.py
> @@ -198,8 +217,14 @@ class Entry_android_boot(Entry_section):
>              return default
>          return entry.GetData(required)
>
> +    def _BuildVendorDt(self, required):
> +        if not self.vendor_dt_node:
> +            return b''
> +        return self._GetEntryData('vendor-dt', required)
> +
>      def _BuildV0SectionData(self, required):
>          kernel = self._GetEntryData('kernel', required)
> +        vendor_dt = self._BuildVendorDt(required)

Since _ReadVendorDtEntries already stores the section under
self._entries['vendor-dt'], this helper is just a thin wrapper. I
think you can drop _BuildVendorDt and write:

    vendor_dt = self._GetEntryData('vendor-dt', required, b'')

which mirrors how ramdisk is handled just below. What do you think?

> diff --git a/tools/binman/etype/android_boot.py b/tools/binman/etype/android_boot.py
> @@ -211,8 +236,18 @@ class Entry_android_boot(Entry_section):
>                                   BOOT_ARGS_SIZE)
>
>          boot_id_payloads = [kernel, ramdisk, b'']
> +        if self.vendor_dt_node:
> +            boot_id_payloads.append(vendor_dt)
>          image_id = self._BootId(*boot_id_payloads)
>
> +        overloaded_header_version =  self.header_version
> +        if self.vendor_dt_node:
> +            # vendor DTs overload the header_version field to store the length
> +            # of the appended payload. Hopefully AOSP abootimg never progresses
> +            # to v8192-ish or we might have some real specificity problems on
> +            # our hands.
> +            overloaded_header_version = len(vendor_dt)

Stray double space after the '=' on the assignment. Worth noting in
the docstring that the vendor-dt subnode is itself a section, with a
small example showing how to compose this with the QCDT/DTBH etypes
added later.

Regards,
Simon


More information about the U-Boot mailing list