[PATCH v3 04/10] binman: Android boot image support

Simon Glass sjg at chromium.org
Sun Jun 14 18:18:58 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 image support
>
> Introduce initial support for Android boot images (abootimgs).
>
> The AOSP implementation was used as a reference for this work.
>
> We start with just v0 and v2 support. v1/v3/v4 are deliberately left
> unimplemented for now as no use-case has been found for them yet.
>
> Since we're targeting U-Boot use cases here, a couple of things were
> omitted from this impl, namely 'second' and recovery_dtbo support.
>
> Link: https://android.googlesource.com/platform/system/tools/mkbootimg/
> Signed-off-by: Sam Day <me at samcday.com>
>
> tools/binman/etype/android_boot.py                 | 285 +++++++++++++++++++++
>  tools/binman/ftest.py                              | 148 +++++++++++
>  tools/binman/test/android_boot_chonky_cells.dts    |  13 +
>  tools/binman/test/android_boot_dtb_in_v0.dts       |  12 +
>  tools/binman/test/android_boot_invalid_addr.dts    |  13 +
>  .../binman/test/android_boot_invalid_pagesize.dts  |  11 +
>  tools/binman/test/android_boot_invalid_subnode.dts |  12 +
>  tools/binman/test/android_boot_missing_kernel.dts  |   9 +
>  .../test/android_boot_oversized_bootname.dts       |  12 +
>  .../test/android_boot_unsupported_version.dts      |  11 +
>  tools/binman/test/android_boot_v0.dts              |  34 +++
>  .../test/android_boot_v0_pagesize_too_smol.dts     |  12 +
>  tools/binman/test/android_boot_v2.dts              |  50 ++++
>  tools/binman/test/android_boot_v2_missing_dtb.dts  |  12 +
>  .../test/android_boot_v2_pagesize_too_smol.dts     |  13 +
>  tools/binman/test/android_boot_v2_vendor_dt.dts    |  14 +
>  16 files changed, 661 insertions(+)

> diff --git a/tools/binman/etype/android_boot.py b/tools/binman/etype/android_boot.py
> @@ -0,0 +1,285 @@
> +    def _BuildV0SectionData(self, required):
> +        kernel = self._GetEntryData('kernel', required)
> +        ramdisk = self._GetEntryData('ramdisk', required, b'')
> +        if not required and (kernel is None or vendor_dt is None or
> +                             ramdisk is None):
> +            return None

...

> diff --git a/tools/binman/test/android_boot_v2_vendor_dt.dts b/tools/binman/test/android_boot_v2_vendor_dt.dts
> @@ -0,0 +1,14 @@
> +             android-boot {
> +                     header-version = <2>;
> +                     kernel {};
> +                     dtb {};
> +                     vendor-dt {};
> +             };

This fixture and the corresponding testAndroidBootV2VendorDt() in
ftest.py belong in patch 6 - they exercise the vendor-dt subnode which
this patch does not yet recognise. Against this commit alone,
ReadEntries() raises "Unexpected subnode 'vendor-dt'" rather than the
message the test asserts on. Also vendor_dt is not defined
yet...please bisect-check the series.

> diff --git a/tools/binman/etype/android_boot.py b/tools/binman/etype/android_boot.py
> @@ -0,0 +1,285 @@
> +BOOT_IMAGE_HEADER_V0 = '<{}s10I{}s{}s{}s'.format(len(BOOT_MAGIC),
> +                                                    BOOT_NAME_SIZE,
> +                                                    BOOT_ARGS_SIZE,
> +                                                    IMAGE_ID_SIZE)

Continuation lines are over-indented past the opening paren. Please
align with the '(' or drop to a single hanging indent.

> diff --git a/tools/binman/etype/android_boot.py b/tools/binman/etype/android_boot.py
> @@ -0,0 +1,285 @@
> +        boot_id_payloads = [kernel, ramdisk, b'']
> +        image_id = self._BootId(*boot_id_payloads)

The v2 path passes the payloads inline to _BootId() - please do the
same here for consistency; the temporary list doesn't seem worth it.

Regards,
Simon


More information about the U-Boot mailing list