Generate Android boot images with binman
Subsystems (3)
cover Generate Android boot images with binman
U-Boot is seeing increasing adoption on pocket computers, many of which (sadly) have fused bootloader chains. Many of these bootloaders have a very rigid definition of what a "valid" downstream payload looks like. Sometimes it's just a boring old v0/v2 Android boot image. Sometimes it's something decidedly more grotesque.
To date, this last-mile packaging step has been trapped in downstream CI pipelines, blogposts, documentation, etc. This patch series aims to gather up all that esoterica and institutional knowledge and codify it in U-Boot's build system, using binman.
Put differently: an overwhelming majority of these pocket computer devices have a "canonical" payload format that U-Boot currently has no support for. Let's fix that.
The first patches in this series introduce an android_boot etype. To begin with, this is a "typical" abootimg, as defined by canonical AOSP sources and reference fastboot/mkbootimg implementation. There's plenty of devices out there with a sane(-ish, nothing in Android-land is ever truly sane) bootloader that will happily chain a U-Boot rolled into the kernel section of an abootimg.
With that out of the way, the cursed bootloaders are next to be supported. Binman etypes for Qualcomm's "QCDT" and Samsung's "DTBH" formats are implemented. These are non-standard vendor-specific devicetree containers, which the previous bootloader uses to pick a FDT to boot the downstream with.
In both cases, these vendor-specific formats are tacked on to the end of a v0 abootimg, with the header_version being hijacked to encode the length of this following payload. Thus, the android_boot etype is retrofitted to allow these shenanigans.
Binman configs that produce flashable boot artifacts are introduced for the following devices:
* google-sargo (vanilla v2)
* oneplus-fajita (vanilla v2)
* samsung-a5u-eur (QCDT v0)
* samsung-gt510 (QCDT v0)
* samsung-j7xelte (DTBH v0)
I also successfully tested a vanilla v0 on my samsung-expressltexx, in conjunction with the qcom-armv7 series already on the list. However, since that work is still in-flight and the expressltexx DTS is downstream, I opted not to include it here.
---
Sam Day (13):
binman: Android boot image support .gitignore: ignore binman-generated blobs
arch: arm: qcom: google-sargo binman config
qcom: arch: arm: qcom: sdm845-fajita binman configs
mach-snapdragon: enable BINMAN
binman: android_boot: vendor-dt support
binman: Add QCDT support
binman: android_boot: SEANDROIDENFORCE support
arch: arm: qcom: samsung-a5u-eur binman config
arch: arm: qcom: samsung-gt510 binman config
binman: Add DTBH support
arch: arm: exynos: add j7xelte binman config
configs: exynos-mobile: pull in BINMAN
.gitignore | 1 + arch/arm/Kconfig | 1 + arch/arm/dts/exynos-mobile.dtsi | 5 + arch/arm/dts/exynos7870-j7xelte-u-boot.dtsi | 24 ++ arch/arm/dts/msm8916-samsung-a5u-eur-u-boot.dtsi | 39 ++ arch/arm/dts/msm8916-samsung-gt510-u-boot.dtsi | 39 ++ arch/arm/dts/qcom.dtsi | 5 + arch/arm/dts/sdm670-google-sargo-u-boot.dtsi | 27 ++ arch/arm/dts/sdm845-oneplus-fajita-u-boot.dtsi | 25 ++ arch/arm/mach-exynos/Kconfig | 1 + configs/exynos-mobile_defconfig | 1 + configs/qcom_defconfig | 1 + tools/binman/etype/android_boot.py | 408 +++++++++++++++++++++ tools/binman/etype/dtbh.py | 173 +++++++++ tools/binman/etype/qcdt.py | 160 ++++++++ tools/binman/ftest.py | 127 +++++++ .../test/vendor/android_boot_seandroidenforce.dts | 22 ++ tools/binman/test/vendor/android_boot_v0.dts | 29 ++ tools/binman/test/vendor/android_boot_v2.dts | 46 +++ .../binman/test/vendor/android_boot_vendor_dt.dts | 27 ++ tools/binman/test/vendor/dtbh.dts | 29 ++ tools/binman/test/vendor/dtbh_bad_model_info.dts | 19 + tools/binman/test/vendor/qcdt.dts | 20 + tools/binman/test/vendor/qcdt_bad_msm_id.dts | 17 + 24 files changed, 1246 insertions(+)
---
base-commit: a4c8728f225b0d7d591fb9199ce7efb72f48290e
change-id: 20260604-android-binman-ad7a43f4e99d
Best regards,
Signature · 1 line
Sam Day <[email protected]>
PATCH 1/13 binman: Android boot image support
Introduce initial support for Android boot images (abootimgs). This initial stab supports both v0 and v2 headers. The AOSP implementation was used as a reference.
Since we're targeting U-Boot use cases here, a couple of things were omitted from this impl, namely "second" and recovery_dtbo support.
--- tools/binman/etype/android_boot.py | 337 +++++++++++++++++++++++++++ tools/binman/ftest.py | 66 ++++++ tools/binman/test/vendor/android_boot_v0.dts | 29 +++ tools/binman/test/vendor/android_boot_v2.dts | 46 ++++ 4 files changed, 478 insertions(+)
tools/binman/etype/android_boot.py new file +337 -0
@@ -0,0 +1,337 @@ +# SPDX-License-Identifier: GPL-2.0+ +# Entry-type module for Android boot images + +import hashlib +import struct + +from binman.entry import Entry +from binman.etype.section import Entry_section +from dtoc import fdt_util + + +BOOT_MAGIC = b'ANDROID!' +BOOT_NAME_SIZE = 16 +BOOT_ARGS_SIZE = 512 +IMAGE_ID_SIZE = 32 +BOOT_EXTRA_ARGS_SIZE = 1024 + +BOOT_IMAGE_HEADER_V0 = '<{}s10I{}s{}s{}s'.format(len(BOOT_MAGIC), + BOOT_NAME_SIZE, + BOOT_ARGS_SIZE, + IMAGE_ID_SIZE) +BOOT_IMAGE_HEADER_V0_SIZE = struct.calcsize(BOOT_IMAGE_HEADER_V0) +BOOT_IMAGE_HEADER_V2 = (BOOT_IMAGE_HEADER_V0 + + '{}sIQIIQ'.format(BOOT_EXTRA_ARGS_SIZE)) +BOOT_IMAGE_HEADER_V2_SIZE = struct.calcsize(BOOT_IMAGE_HEADER_V2) + +def _align_up(value, align): + return (value + align - 1) & ~(align - 1) + + +def _pad(data, align): + return data + b'\0' * (_align_up(len(data), align) - len(data)) + + +class Entry_android_boot(Entry_section): + """Android boot image + + This creates an Android v0 or v2 boot image. + + A kernel payload, optional ramdisk payload can be supplied. A DTB payload + can also be provided when header_version == v2. + + Properties / Entry arguments: + - header-version: Android boot image header version, must be 0 or 2, + defaults to 0 + - page-size: Image page size, defaults to 2048 + - base: Base address added to the offsets below, defaults to 0x10000000 + - kernel-offset: Kernel load offset from base, defaults to 0x00008000 + - ramdisk-offset: Ramdisk load offset from base, defaults to 0x01000000 + - tags-offset: ATAGS/FDT offset from base, defaults to 0x00000100 + - dtb-offset: DTB load offset from base, defaults to 0x01f00000 + - os-version: Encoded Android OS version and patch level, defaults to 0 + - boot-name: Android boot image board name + - cmdline: Android boot command line + + This entry uses the following subnodes: + - kernel: section containing the executable payload + - dtb: section containing the DTB payload, used by header version 2 only + - ramdisk: optional section containing a ramdisk payload + + Example:: + A v2 abootimg with control FDT placed in the DTB section: + + android-boot { + header-version = <2>; + page-size = <4096>; + base = <0x12345678>; + kernel-offset = <0xCAFED00D>; + ramdisk-offset = <0xBEEFBABE>; + tags-offset = <0xFEEDDEAD>; + dtb-offset = <0x06660666>; + cmdline = "foo bar"; + + kernel { + u-boot-nodtb { + # Many Android bootloaders support gzipped kernels + compress = "gzip"; + }; + }; + + dtb { + u-boot-dtb { + }; + }; + }; + + A v0 abootimg with embedded control FDT (v0 doesn't support DTBs) and + an empty ramdisk (some bootloaders insist on a ramdisk being present): + android-boot { + header-version = <0>; + page-size = <2048>; + base = <0x80200000>; + + kernel { + u-boot { + no-expanded; + }; + }; + + ramdisk { + fill { + size = <1>; + }; + }; + }; + """ + + def ReadNode(self): + super().ReadNode() + self.header_version = fdt_util.GetInt(self._node, 'header-version', 0) + self.page_size = fdt_util.GetInt(self._node, 'page-size', 2048) + self.base = self._GetIntCells('base', 0x10000000) + self.kernel_offset = self._GetIntCells('kernel-offset', 0x00008000) + self.ramdisk_offset = self._GetIntCells('ramdisk-offset', 0x01000000) + self.tags_offset = self._GetIntCells('tags-offset', 0x00000100) + self.dtb_offset = self._GetIntCells('dtb-offset', 0x01f00000) + self.os_version = fdt_util.GetInt(self._node, 'os-version', 0) + self.boot_name = fdt_util.GetString(self._node, 'boot-name', '') + self.cmdline = fdt_util.GetString(self._node, 'cmdline', '') + + if self.header_version not in (0, 2): + self.Raise('Only Android boot image header versions 0 and 2 are ' + 'supported') + if self.page_size <= 0 or self.page_size & (self.page_size - 1): + self.Raise('page-size must be a power of two') + if 'kernel' not in self._entries: + self.Raise("Missing required subnode 'kernel'") + + if self.header_version == 0: + if self.page_size < BOOT_IMAGE_HEADER_V0_SIZE: + self.Raise('page-size must fit the Android boot image header') + if 'dtb' in self._entries: + self.Raise("Subnode 'dtb' requires header-version 2") + else: + # v2 + if self.page_size < BOOT_IMAGE_HEADER_V2_SIZE: + self.Raise('page-size must fit the Android boot image header') + if 'dtb' not in self._entries: + self.Raise("Missing required subnode 'dtb'") + + def ReadEntries(self): + for node in self._node.subnodes: + if self.IsSpecialSubnode(node): + continue + if node.name not in ('kernel', 'ramdisk', 'dtb'): + self.Raise("Unexpected subnode '%s'" % node.name) + + entry = Entry.Create(self, node, etype='section', + expanded=self.GetImage().use_expanded, + missing_etype=self.GetImage().missing_etype) + entry.ReadNode() + entry.SetPrefix(self._name_prefix) + self._entries[node.name] = entry + + def _GetIntCells(self, propname, default): + prop = self._node.props.get(propname) + if not prop: + return default + + values = prop.value if isinstance(prop.value, list) else [prop.value] + if len(values) > 2: + self.Raise("Property '%s' must contain one or two cells" % + propname) + + value = 0 + for cell in values: + value = value << 32 | fdt_util.fdt32_to_cpu(cell) + + return value + + def _GetAddr(self, offset, name, size=32): + addr = self.base + offset + if addr >= 1 << size: + self.Raise('%s address %#x does not fit in %d bits' % + (name, addr, size)) + + return addr + + @staticmethod + def _CheckFit(name, data, size): + if len(data) > size: + raise ValueError('%s is %d bytes, maximum is %d' % + (name, len(data), size)) + + return data + b'\0' * (size - len(data)) + + @staticmethod + def _BootId(*payloads): + digest = hashlib.sha1() + for data in payloads: + digest.update(data) + digest.update(struct.pack('<I', len(data))) + + return digest.digest() + b'\0' * 12 + + def _SplitCmdline(self): + cmdline = self.cmdline.encode('ascii') + b'\0' + return (self._CheckFit('cmdline', cmdline[:BOOT_ARGS_SIZE], + BOOT_ARGS_SIZE), + self._CheckFit('extra-cmdline', cmdline[BOOT_ARGS_SIZE:], + BOOT_EXTRA_ARGS_SIZE)) + + def _GetEntryData(self, name, required): + entry = self._entries.get(name) + data = entry.GetData(required) + if data is None and not required: + return None + + return data + + def _GetOptionalEntryData(self, name, required, default=b''): + entry = self._entries.get(name) + if not entry: + return default + + data = entry.GetData(required) + if data is None and not required: + return None + + return data + + @staticmethod + def _BuildDtb(node): + import libfdt + + fsw = libfdt.FdtSw() + fsw.INC_SIZE = 65536 + fsw.finish_reservemap() + + def _AddNode(in_node): + for pname, prop in in_node.props.items(): + fsw.property(pname, prop.bytes) + for subnode in in_node.subnodes: + with fsw.add_node(subnode.name): + _AddNode(subnode) + + with fsw.add_node(''): + _AddNode(node) + if not node.FindNode('chosen'): + with fsw.add_node('chosen'): + pass + fdt = fsw.as_fdt() + fdt.pack() + return bytes(fdt.as_bytearray()) + + def _BuildV0SectionData(self, required): + kernel = self._GetEntryData('kernel', required) + if kernel is None: + return None + + ramdisk = self._GetOptionalEntryData('ramdisk', required) + if ramdisk is None: + return None + + boot_name = self._CheckFit('boot-name', self.boot_name.encode('ascii'), + BOOT_NAME_SIZE) + cmdline = self._CheckFit('cmdline', self.cmdline.encode('ascii'), + BOOT_ARGS_SIZE) + + boot_id_payloads = [kernel, ramdisk, b''] + image_id = self._BootId(*boot_id_payloads) + + header = struct.pack(BOOT_IMAGE_HEADER_V0, + BOOT_MAGIC, + len(kernel), + self._GetAddr(self.kernel_offset, 'kernel'), + len(ramdisk), + self._GetAddr(self.ramdisk_offset, 'ramdisk'), + 0, # second_len + 0, # second_offset + self._GetAddr(self.tags_offset, 'tags'), + self.page_size, + self.header_version, + self.os_version, + boot_name, + cmdline, + image_id) + + image = bytearray() + image += _pad(header, self.page_size) + image += _pad(kernel, self.page_size) + image += _pad(ramdisk, self.page_size) + + return bytes(image) + + def _BuildV2SectionData(self, required): + kernel = self._GetEntryData('kernel', required) + if kernel is None: + return None + + dtb = self._GetEntryData('dtb', required) + if dtb is None: + return None + + ramdisk = self._GetOptionalEntryData('ramdisk', required) + if ramdisk is None: + return None + boot_name = self._CheckFit('boot-name', self.boot_name.encode('ascii'), + BOOT_NAME_SIZE) + cmdline, extra_cmdline = self._SplitCmdline() + image_id = self._BootId(kernel, ramdisk, b'', b'', dtb) + + header = struct.pack(BOOT_IMAGE_HEADER_V2, + BOOT_MAGIC, + len(kernel), + self._GetAddr(self.kernel_offset, 'kernel'), + len(ramdisk), + self._GetAddr(self.ramdisk_offset, 'ramdisk'), + 0, # second_len + 0, # second_offset + self._GetAddr(self.tags_offset, 'tags'), + self.page_size, + self.header_version, + self.os_version, + boot_name, + cmdline, + image_id, + extra_cmdline, + 0, # recovery_dtbo_len + 0, # recovery_dtbo_offset + BOOT_IMAGE_HEADER_V2_SIZE, + len(dtb), + self._GetAddr(self.dtb_offset, 'dtb', size=64)) + + image = bytearray() + image += _pad(header, self.page_size) + image += _pad(kernel, self.page_size) + image += _pad(ramdisk, self.page_size) + image += _pad(dtb, self.page_size) + + return bytes(image) + + def BuildSectionData(self, required): + if self.header_version == 0: + return self._BuildV0SectionData(required) + + return self._BuildV2SectionData(required)
tools/binman/ftest.py +66 -0
72 lines not on this page · raw message
tools/binman/test/vendor/android_boot_v0.dts new file +29 -0
@@ -0,0 +1,29 @@ +// SPDX-License-Identifier: GPL-2.0+ + +/dts-v1/; + +/ { + #address-cells = <1>; + #size-cells = <1>; + + binman { + android-boot { + header-version = <0>; + page-size = <0x800>; + base = <0x80200000>; + cmdline = "foo"; + + kernel { + u-boot { + no-expanded; + }; + }; + + ramdisk { + fill { + size = <1>; + }; + }; + }; + }; +};
tools/binman/test/vendor/android_boot_v2.dts new file +46 -0
46 lines not on this page · raw message
Signature · 1 line
2.54.0
PATCH 2/13 .gitignore: ignore binman-generated blobs
In reply to Sam DayThe new android_boot etype is causing these /comp*u-boot-nodtb artifacts to be generated, which aren't currently picked up by any ignore rules.
--- .gitignore | 1 + 1 file changed, 1 insertion(+)
.gitignore +1 -0
@@ -84,6 +84,7 @@ fit-dtb.blob* /test/fdt_overlay/test-fdt-overlay-stacked.dtbo.S /test/fdt_overlay/test-fdt-overlay.dtbo.S capsule_esl_file +/comp.*.u-boot-nodtb # # Generated include files
Signature · 1 line
2.54.0
PATCH 3/13 arch: arm: qcom: google-sargo binman config
In reply to Sam DayThis binman configuration emits an Android v2 boot image that ABL will accept. Notably, this platform does not seem to accept uncompressed kernel payloads, so it's gzipped.
--- arch/arm/dts/sdm670-google-sargo-u-boot.dtsi | 27 +++++++++++++++++++++++++++ 1 file changed, 27 insertions(+)
arch/arm/dts/sdm670-google-sargo-u-boot.dtsi new file +27 -0
@@ -0,0 +1,27 @@ +// SPDX-License-Identifier: GPL-2.0 + +#include <config.h> + +/ { + binman { + filename = "u-boot-google-sargo.img"; + + android-boot { + header-version = <2>; + page-size = <4096>; + base = <0x80000000>; + kernel-offset = <0x00008000>; + dtb-offset = <0x01f00000>; + + kernel { + u-boot-nodtb { + compress = "gzip"; + }; + }; + + dtb { + u-boot-dtb {}; + }; + }; + }; +};
Signature · 1 line
2.54.0
PATCH 4/13 qcom: arch: arm: qcom: sdm845-fajita binman configs
In reply to Sam DayThis binman configuration emits an Android v2 boot image that ABL will accept. This platform accepts uncompressed kernel artifacts, and the boot partition(s) are plenty big enough, so we opt for speed over size.
--- arch/arm/dts/sdm845-oneplus-fajita-u-boot.dtsi | 27 ++++++++++++++++++++++++++ 1 file changed, 27 insertions(+)
arch/arm/dts/sdm845-oneplus-fajita-u-boot.dtsi new file +27 -0
@@ -0,0 +1,27 @@ +// SPDX-License-Identifier: GPL-2.0 + +#include <config.h> + +#ifdef CONFIG_BINMAN +/ { + binman { + filename = "u-boot-oneplus-fajita.img"; + + android-boot { + header-version = <2>; + page-size = <4096>; + base = <0x00000000>; + kernel-offset = <0x00008000>; + dtb-offset = <0x01f00000>; + + kernel { + u-boot-nodtb {}; + }; + + dtb { + u-boot-dtb {}; + }; + }; + }; +}; +#endif
Signature · 1 line
2.54.0
PATCH 5/13 mach-snapdragon: enable BINMAN
In reply to Sam DayNow that binman provides abootimg support and we've defined configuration for it on a number of qcom devices, let's enable BINMAN for *all* ARCH_SNAPDRAGON builds.
This is a pragmatic choice: BINMAN needs to be pulled in by an existing Kconfig symbol so we can't just enable it in a .config fragment. Rather than defining a new symbol that can be opted into, we just opt in everywhere. There's plenty of prior art for ARCH_* symbols doing exactly this.
Not necessarily all (though, I suspect, a vast majority) of qcom devices need or can benefit from binman. Unfortunately, binman will choke if a DEVICE_TREE= lacking the binman{} DT node is selected as the control FDT. To accommodate this, we drop in a small globally-included .dtsi fragment that defines an empty binman{} node, so that no builds are broken.
--- arch/arm/Kconfig | 1 + arch/arm/dts/qcom.dtsi | 5 +++++ configs/qcom_defconfig | 1 + 3 files changed, 7 insertions(+)
arch/arm/Kconfig +1 -0
@@ -1135,6 +1135,7 @@ config ARCH_RENESAS config ARCH_SNAPDRAGON bool "Qualcomm Snapdragon SoCs" select ARM64 + select BINMAN select DM select DM_GPIO select DM_SERIAL
arch/arm/dts/qcom.dtsi new file +5 -0
@@ -0,0 +1,5 @@ +// SPDX-License-Identifier: GPL-2.0 +/ { + binman { + }; +};
configs/qcom_defconfig +1 -0
@@ -50,6 +50,7 @@ CONFIG_CMD_REGULATOR=y CONFIG_CMD_LOG=y CONFIG_OF_LIVE=y CONFIG_OF_UPSTREAM_BUILD_VENDOR=y +CONFIG_DEVICE_TREE_INCLUDES="qcom.dtsi" CONFIG_ENV_USE_DEFAULT_ENV_TEXT_FILE=y CONFIG_ENV_DEFAULT_ENV_TEXT_FILE="board/qualcomm/default.env" CONFIG_BUTTON_QCOM_PMIC=y
Signature · 1 line
2.54.0
PATCH 6/13 binman: android_boot: vendor-dt support
In reply to Sam DayThere'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.
--- tools/binman/etype/android_boot.py | 38 ++++++++++++++++++++-- tools/binman/ftest.py | 11 ++++++- .../binman/test/vendor/android_boot_vendor_dt.dts | 27 +++++++++++++++ 3 files changed, 73 insertions(+), 3 deletions(-)
tools/binman/etype/android_boot.py +36 -2
@@ -40,6 +40,9 @@ class Entry_android_boot(Entry_section): A kernel payload, optional ramdisk payload can be supplied. A DTB payload can also be provided when header_version == v2. + Vendor-specific payloads are also supported. These are non-standard + v0 images with a special DT container format appended. + Properties / Entry arguments: - header-version: Android boot image header version, must be 0 or 2, defaults to 0
@@ -52,11 +55,13 @@ class Entry_android_boot(Entry_section): - os-version: Encoded Android OS version and patch level, defaults to 0 - boot-name: Android boot image board name - cmdline: Android boot command line + used by header version 0 only This entry uses the following subnodes: - kernel: section containing the executable payload - dtb: section containing the DTB payload, used by header version 2 only - ramdisk: optional section containing a ramdisk payload + - vendor-dt: legacy vendor DT payload, used by header version 0 only Example:: A v2 abootimg with control FDT placed in the DTB section:
@@ -117,6 +122,7 @@ class Entry_android_boot(Entry_section): self.os_version = fdt_util.GetInt(self._node, 'os-version', 0) self.boot_name = fdt_util.GetString(self._node, 'boot-name', '') self.cmdline = fdt_util.GetString(self._node, 'cmdline', '') + self.vendor_dt_node = self._node.FindNode('vendor-dt') if self.header_version not in (0, 2): self.Raise('Only Android boot image header versions 0 and 2 are '
@@ -131,17 +137,26 @@ class Entry_android_boot(Entry_section): self.Raise('page-size must fit the Android boot image header') if 'dtb' in self._entries: self.Raise("Subnode 'dtb' requires header-version 2") + if self.vendor_dt_node and self.os_version: + self.Raise("os_version not allowed when vendor-dt is in use") else: # v2 if self.page_size < BOOT_IMAGE_HEADER_V2_SIZE: self.Raise('page-size must fit the Android boot image header') if 'dtb' not in self._entries: self.Raise("Missing required subnode 'dtb'") + if self.vendor_dt_node: + self.Raise("Subnode 'vendor-dt' requires header-version 0") def ReadEntries(self): for node in self._node.subnodes: if self.IsSpecialSubnode(node): continue + + if node.name == 'vendor-dt': + self._ReadVendorDtEntries(node) + continue + if node.name not in ('kernel', 'ramdisk', 'dtb'): self.Raise("Unexpected subnode '%s'" % node.name)
@@ -152,6 +167,15 @@ class Entry_android_boot(Entry_section): entry.SetPrefix(self._name_prefix) self._entries[node.name] = entry + def _ReadVendorDtEntries(self, vendor_dt_node): + entry = Entry.Create(self, vendor_dt_node, etype='section', + expanded=self.GetImage().use_expanded, + missing_etype=self.GetImage().missing_etype) + entry.page_size = fdt_util.GetInt(self._node, 'page-size', 2048) + entry.ReadNode() + entry.SetPrefix(self._name_prefix) + self._entries[vendor_dt_node.name] = entry + def _GetIntCells(self, propname, default): prop = self._node.props.get(propname) if not prop:
@@ -243,11 +267,18 @@ class Entry_android_boot(Entry_section): fdt.pack() return bytes(fdt.as_bytearray()) + 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) if kernel is None: return None - + vendor_dt = self._BuildVendorDt(required) + if vendor_dt is None: + return None ramdisk = self._GetOptionalEntryData('ramdisk', required) if ramdisk is None: return None
@@ -258,6 +289,8 @@ 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) header = struct.pack(BOOT_IMAGE_HEADER_V0,
@@ -270,7 +303,7 @@ class Entry_android_boot(Entry_section): 0, # second_offset self._GetAddr(self.tags_offset, 'tags'), self.page_size, - self.header_version, + len(vendor_dt), self.os_version, boot_name, cmdline,
@@ -280,6 +313,7 @@ class Entry_android_boot(Entry_section): image += _pad(header, self.page_size) image += _pad(kernel, self.page_size) image += _pad(ramdisk, self.page_size) + image += _pad(vendor_dt, self.page_size) return bytes(image)
tools/binman/ftest.py +10 -1
@@ -5662,7 +5662,16 @@ fdt fdtmap Extract the devicetree blob from the fdtmap self.assertEqual(U_BOOT_DTB_DATA, data[0x1000:0x1000 + len(U_BOOT_DTB_DATA)]) - self.assertEqual(U_BOOT_DATA, data[0x800:0x800 + len(U_BOOT_DATA)]) + def testAndroidBootVendorDt(self): + """Test that android-boot can embed an arbitrary vendor-dt section""" + data = self._DoReadFile('vendor/android_boot_vendor_dt.dts') + header = struct.unpack_from('<8s10I16s512s32s', data, 0) + vendor_dt = b'howdy' + self.assertEqual(len(vendor_dt), header[9]) + self.assertEqual(0, header[10]) + self.assertEqual(self._AndroidBootId(U_BOOT_DATA, b'\0', b'', + vendor_dt), header[13]) + self.assertEqual(vendor_dt, data[0x1800:0x1805]) def testFitFdtOper(self): """Check handling of a specified FIT operation"""
tools/binman/test/vendor/android_boot_vendor_dt.dts new file +27 -0
@@ -0,0 +1,27 @@ +// SPDX-License-Identifier: GPL-2.0+ +/dts-v1/; +/ { + #address-cells = <1>; + #size-cells = <1>; + binman { + android-boot { + header-version = <0>; + kernel { + u-boot { + no-expanded; + }; + }; + ramdisk { + fill { + size = <1>; + }; + }; + vendor-dt { + text { + size = <5>; + text = "howdy"; + }; + }; + }; + }; +};
Signature · 1 line
2.54.0
PATCH 7/13 binman: Add QCDT support
In reply to Sam DayThis vendor-specific format is used by many bootloaders on older qcom SoCs, such as msm8916. It's a container for N FDTs. Each one is contained in a record that includes metadata about the platform/variant it targets. The previous bootloader picks the "right" record based on this metadata.
This initial impl targets a streamlined v2 path, with no support for different versions or multiple qcom,msm-id/qcom,board-id tuples. If/when that's needed it will be implemented in a follow-up.
--- tools/binman/etype/android_boot.py | 30 +++++ tools/binman/etype/qcdt.py | 160 +++++++++++++++++++++++++++ tools/binman/ftest.py | 22 ++++ tools/binman/test/vendor/qcdt.dts | 20 ++++ tools/binman/test/vendor/qcdt_bad_msm_id.dts | 17 +++ 5 files changed, 249 insertions(+)
tools/binman/etype/android_boot.py +30 -0
@@ -108,6 +108,36 @@ class Entry_android_boot(Entry_section): }; }; }; + + A legacy QCDT abootimg, the kind msm8916 bootloaders expect: + + android-boot { + base = <0x80000000>; + + kernel { + u-boot { + no-expanded; + }; + }; + + ramdisk { + fill { + size = <1>; + }; + }; + + vendor-dt { + qcdt { + dtb-0 { + qcom,msm-id = <206 0>; + qcom,board-id = <0xce08ff01 1>; + + u-boot-dtb { + }; + }; + }; + }; + }; """ def ReadNode(self):
tools/binman/etype/qcdt.py new file +160 -0
160 lines not on this page · raw message
tools/binman/ftest.py +22 -0
@@ -5673,6 +5673,28 @@ fdt fdtmap Extract the devicetree blob from the fdtmap vendor_dt), header[13]) self.assertEqual(vendor_dt, data[0x1800:0x1805]) + def testAndroidBootQcdt(self): + """Test that binman can produce a QCDT container""" + data, dtb_data, _map, _dtb = self._DoReadFileDtb( + 'vendor/qcdt.dts', use_real_dtb=True) + + dtb_size = tools.align(len(dtb_data), 0x800) + + self.assertEqual(b'QCDT', data[:4]) + self.assertEqual((2, 1), struct.unpack_from('<II', data, 4)) + self.assertEqual((0xce, 0xce08ff01, 1, 0, 0x800, dtb_size), + struct.unpack_from('<IIIIII', data, 12)) + self.assertEqual(0xd00dfeed, + struct.unpack_from('>I', data, 0x800)[0]) + self.assertEqual(dtb_data, data[0x800:0x800 + len(dtb_data)]) + + def testAndroidBootQcdtBadMsmId(self): + """Test that QCDT rejects invalid msm-id properties""" + with self.assertRaises(ValueError) as exc: + self._DoReadFile('vendor/qcdt_bad_msm_id.dts') + self.assertIn("Property 'qcom,msm-id' must contain exactly 2 cells", + str(exc.exception)) + def testFitFdtOper(self): """Check handling of a specified FIT operation""" entry_args = {
tools/binman/test/vendor/qcdt.dts new file +20 -0
@@ -0,0 +1,20 @@ +// SPDX-License-Identifier: GPL-2.0+ + +/dts-v1/; + +/ { + #address-cells = <1>; + #size-cells = <1>; + + binman { + qcdt { + dtb-0 { + qcom,msm-id = <0xce 0>; + qcom,board-id = <0xce08ff01 1>; + + u-boot-dtb { + }; + }; + }; + }; +};
tools/binman/test/vendor/qcdt_bad_msm_id.dts new file +17 -0
@@ -0,0 +1,17 @@ +// SPDX-License-Identifier: GPL-2.0+ + +/dts-v1/; + +/ { + #address-cells = <1>; + #size-cells = <1>; + + binman { + qcdt { + dtb-0 { + qcom,msm-id = <0xce 0 1>; + qcom,board-id = <0xce08ff01 1>; + }; + }; + }; +};
Signature · 1 line
2.54.0
PATCH 8/13 binman: android_boot: SEANDROIDENFORCE support
In reply to Sam DaySome older MSM8916-era bootloaders want to see this string appended to the abootimg, or they log an ugly warning to the screen.
--- tools/binman/etype/android_boot.py | 11 +++++++++++ tools/binman/ftest.py | 6 ++++++ .../test/vendor/android_boot_seandroidenforce.dts | 22 ++++++++++++++++++++++ 3 files changed, 39 insertions(+)
tools/binman/etype/android_boot.py +11 -0
@@ -24,6 +24,8 @@ BOOT_IMAGE_HEADER_V2 = (BOOT_IMAGE_HEADER_V0 + '{}sIQIIQ'.format(BOOT_EXTRA_ARGS_SIZE)) BOOT_IMAGE_HEADER_V2_SIZE = struct.calcsize(BOOT_IMAGE_HEADER_V2) +SEANDROIDENFORCE = b'SEANDROIDENFORCE' + def _align_up(value, align): return (value + align - 1) & ~(align - 1)
@@ -56,6 +58,7 @@ class Entry_android_boot(Entry_section): - boot-name: Android boot image board name - cmdline: Android boot command line used by header version 0 only + - append-seandroid-enforce: Append Samsung SEANDROIDENFORCE trailer, This entry uses the following subnodes: - kernel: section containing the executable payload
@@ -113,6 +116,7 @@ class Entry_android_boot(Entry_section): android-boot { base = <0x80000000>; + append-seandroid-enforce; kernel { u-boot {
@@ -152,6 +156,8 @@ class Entry_android_boot(Entry_section): self.os_version = fdt_util.GetInt(self._node, 'os-version', 0) self.boot_name = fdt_util.GetString(self._node, 'boot-name', '') self.cmdline = fdt_util.GetString(self._node, 'cmdline', '') + self.append_seandroid = fdt_util.GetBool(self._node, + 'append-seandroid-enforce') self.vendor_dt_node = self._node.FindNode('vendor-dt') if self.header_version not in (0, 2):
@@ -175,6 +181,9 @@ class Entry_android_boot(Entry_section): self.Raise('page-size must fit the Android boot image header') if 'dtb' not in self._entries: self.Raise("Missing required subnode 'dtb'") + if self.append_seandroid: + self.Raise("Property 'append-seandroid-enforce' requires " + "header-version 0") if self.vendor_dt_node: self.Raise("Subnode 'vendor-dt' requires header-version 0")
@@ -344,6 +353,8 @@ class Entry_android_boot(Entry_section): image += _pad(kernel, self.page_size) image += _pad(ramdisk, self.page_size) image += _pad(vendor_dt, self.page_size) + if self.append_seandroid: + image += SEANDROIDENFORCE return bytes(image)
tools/binman/ftest.py +6 -0
@@ -5673,6 +5673,12 @@ fdt fdtmap Extract the devicetree blob from the fdtmap vendor_dt), header[13]) self.assertEqual(vendor_dt, data[0x1800:0x1805]) + def testAndroidBootSeAndroidEnforce(self): + """Test that binman appends SEANDROIDENFORCE""" + data = self._DoReadFile('vendor/android_boot_seandroidenforce.dts') + + self.assertEqual(b'SEANDROIDENFORCE', data[-16:]) + def testAndroidBootQcdt(self): """Test that binman can produce a QCDT container""" data, dtb_data, _map, _dtb = self._DoReadFileDtb(
tools/binman/test/vendor/android_boot_seandroidenforce.dts new file +22 -0
@@ -0,0 +1,22 @@ +// SPDX-License-Identifier: GPL-2.0+ +/dts-v1/; +/ { + #address-cells = <1>; + #size-cells = <1>; + binman { + android-boot { + header-version = <0>; + append-seandroid-enforce; + kernel { + u-boot { + no-expanded; + }; + }; + ramdisk { + fill { + size = <1>; + }; + }; + }; + }; +};
Signature · 1 line
2.54.0
PATCH 9/13 arch: arm: qcom: samsung-a5u-eur binman config
In reply to Sam DayEmits an Android boot.img that runs U-Boot from the boot partition (chained from aboot).
--- arch/arm/dts/msm8916-samsung-a5u-eur-u-boot.dtsi | 39 ++++++++++++++++++++++++ 1 file changed, 39 insertions(+)
arch/arm/dts/msm8916-samsung-a5u-eur-u-boot.dtsi new file +39 -0
@@ -0,0 +1,39 @@ +// SPDX-License-Identifier: GPL-2.0 + +#include <dt-bindings/arm/qcom,ids.h> + +/ { + binman { + filename = "u-boot-samsung-a5u-eur.img"; + + android-boot { + header-version = <0>; + page-size = <2048>; + base = <0x80000000>; + append-seandroid-enforce; + + kernel { + u-boot { + no-expanded; + }; + }; + + ramdisk { + fill { + size = <1>; + }; + }; + + vendor-dt { + qcdt { + dtb-0 { + qcom,msm-id = <QCOM_ID_MSM8916 0>; + qcom,board-id = <0xce08ff01 1>; + + u-boot-dtb {}; + }; + }; + }; + }; + }; +};
Signature · 1 line
2.54.0
PATCH 10/13 arch: arm: qcom: samsung-gt510 binman config
In reply to Sam DayEmits an Android boot.img that runs U-Boot from the boot partition (chained from aboot).
--- arch/arm/dts/msm8916-samsung-gt510-u-boot.dtsi | 39 ++++++++++++++++++++++++++ 1 file changed, 39 insertions(+)
arch/arm/dts/msm8916-samsung-gt510-u-boot.dtsi new file +39 -0
@@ -0,0 +1,39 @@ +// SPDX-License-Identifier: GPL-2.0 + +#include <dt-bindings/arm/qcom,ids.h> + +/ { + binman { + filename = "u-boot-samsung-gt510.img"; + + android-boot { + header-version = <0>; + page-size = <2048>; + base = <0x80000000>; + append-seandroid-enforce; + + kernel { + u-boot { + no-expanded; + }; + }; + + ramdisk { + fill { + size = <1>; + }; + }; + + vendor-dt { + qcdt { + dtb-0 { + qcom,msm-id = <QCOM_ID_MSM8916 0>; + qcom,board-id = <0xce08ff01 7>; + + u-boot-dtb {}; + }; + }; + }; + }; + }; +};
Signature · 1 line
2.54.0
PATCH 11/13 binman: Add DTBH support
In reply to Sam DayDTBH, used by Samsung S-BOOT bootloaders, is similar to QCDT. That is, it's a multi-record container that carries vendor-specific magic values to assist the previous bootloader in picking the appropriate FDT for the booting device.
dtbTool-exynos was used as a reference for this implementation.
--- tools/binman/etype/android_boot.py | 44 +++--- tools/binman/etype/dtbh.py | 173 +++++++++++++++++++++++ tools/binman/ftest.py | 24 ++++ tools/binman/test/vendor/dtbh.dts | 29 ++++ tools/binman/test/vendor/dtbh_bad_model_info.dts | 19 +++ 5 files changed, 265 insertions(+), 24 deletions(-)
tools/binman/etype/android_boot.py +20 -24
@@ -142,6 +142,26 @@ class Entry_android_boot(Entry_section): }; }; }; + + A legacy DTBH abootimg, the kind some Samsung bootloaders expect: + + android-boot { + header-version = <0>; + + kernel { + u-boot-nodtb { + }; + }; + + vendor-dt { + dtbh { + dtb-0 { + u-boot-dtb { + }; + }; + }; + }; + }; """ def ReadNode(self):
@@ -282,30 +302,6 @@ class Entry_android_boot(Entry_section): return data - @staticmethod - def _BuildDtb(node): - import libfdt - - fsw = libfdt.FdtSw() - fsw.INC_SIZE = 65536 - fsw.finish_reservemap() - - def _AddNode(in_node): - for pname, prop in in_node.props.items(): - fsw.property(pname, prop.bytes) - for subnode in in_node.subnodes: - with fsw.add_node(subnode.name): - _AddNode(subnode) - - with fsw.add_node(''): - _AddNode(node) - if not node.FindNode('chosen'): - with fsw.add_node('chosen'): - pass - fdt = fsw.as_fdt() - fdt.pack() - return bytes(fdt.as_bytearray()) - def _BuildVendorDt(self, required): if not self.vendor_dt_node: return b''
tools/binman/etype/dtbh.py new file +173 -0
173 lines not on this page · raw message
tools/binman/ftest.py +24 -0
@@ -5701,6 +5701,30 @@ fdt fdtmap Extract the devicetree blob from the fdtmap self.assertIn("Property 'qcom,msm-id' must contain exactly 2 cells", str(exc.exception)) + def testAndroidBootDtbh(self): + """Test that binman can produce a DTBH container""" + data, dtb_data, _map, _dtb = self._DoReadFileDtb( + 'vendor/dtbh.dts', use_real_dtb=True) + + dtb_size = tools.align(len(dtb_data), 0x800) + + self.assertEqual(b'DTBH', data[:4]) + self.assertEqual((2, 1), struct.unpack_from('<II', data, 4)) + self.assertEqual((7870, 0x50a6, 0x217584da, 6, 6, 0x800, + dtb_size, 0x20), + struct.unpack_from('<8I', data, 12)) + self.assertEqual(0xd00dfeed, + struct.unpack_from('>I', data, 0x800)[0]) + self.assertEqual(dtb_data, data[0x800:0x800 + len(dtb_data)]) + + def testAndroidBootDtbhBadModelInfo(self): + """Test that DTBH rejects invalid model_info properties""" + with self.assertRaises(ValueError) as exc: + self._DoReadFileDtb('vendor/dtbh_bad_model_info.dts', + use_real_dtb=True) + self.assertIn("DTB root property 'model_info-chip' must contain " + "exactly 1 cell", str(exc.exception)) + def testFitFdtOper(self): """Check handling of a specified FIT operation""" entry_args = {
tools/binman/test/vendor/dtbh.dts new file +29 -0
@@ -0,0 +1,29 @@ +// SPDX-License-Identifier: GPL-2.0+ + +/dts-v1/; + +/ { + #address-cells = <2>; + #size-cells = <1>; + model = "Samsung Galaxy J7 (2016)"; + compatible = "samsung,j7xelte", "samsung,exynos7870"; + model_info-chip = <7870>; + model_info-hw_rev = <6>; + model_info-hw_rev_end = <6>; + + chosen { + }; + + memory@40000000 { + device_type = "memory"; + reg = <0 0x40000000 0x3e400000>; + }; + + binman { + dtbh { + dtb-0 { + u-boot-dtb {}; + }; + }; + }; +};
tools/binman/test/vendor/dtbh_bad_model_info.dts new file +19 -0
@@ -0,0 +1,19 @@ +// SPDX-License-Identifier: GPL-2.0+ + +/dts-v1/; + +/ { + #address-cells = <2>; + #size-cells = <1>; + model_info-chip = <7870 1>; + model_info-hw_rev = <6>; + model_info-hw_rev_end = <6>; + + binman { + dtbh { + dtb-0 { + u-boot-dtb {}; + }; + }; + }; +};
Signature · 1 line
2.54.0
PATCH 12/13 arch: arm: exynos: add j7xelte binman config
In reply to Sam DayNote that, as of this commit, j7xelte does not yet exist in U-Boot's upstream DTS tree. It was accepted into next so it should appear here eventually.
S-BOOT expects a DTBH with hw-rev == 6.
--- arch/arm/dts/exynos7870-j7xelte-u-boot.dtsi | 24 ++++++++++++++++++++++++ arch/arm/dts/sdm845-oneplus-fajita-u-boot.dtsi | 2 -- 2 files changed, 24 insertions(+), 2 deletions(-)
arch/arm/dts/exynos7870-j7xelte-u-boot.dtsi new file +24 -0
@@ -0,0 +1,24 @@ +// SPDX-License-Identifier: GPL-2.0 + +/ { + /* These properties are required by S-BOOT. */ + model_info-chip = <7870>; + model_info-hw_rev = <6>; + model_info-hw_rev_end = <6>; + + binman { + filename = "u-boot-samsung-j7xelte.img"; + android-boot { + kernel { + u-boot-nodtb {}; + }; + vendor-dt { + dtbh { + dtb-0 { + u-boot-dtb { }; + }; + }; + }; + }; + }; +};
arch/arm/dts/sdm845-oneplus-fajita-u-boot.dtsi +0 -2
@@ -2,7 +2,6 @@ #include <config.h> -#ifdef CONFIG_BINMAN / { binman { filename = "u-boot-oneplus-fajita.img";
@@ -24,4 +23,3 @@ }; }; }; -#endif
Signature · 1 line
2.54.0
PATCH 13/13 configs: exynos-mobile: pull in BINMAN
In reply to Sam DayAll Exynos7 mobile devices need abootimg+DTBH wrapping to be bootable from the fused S-BOOT bootloader. So we enable BINMAN everywhere. Ideally we'll have full coverage of these devices with binman configs in the overlay DTSIs but, for now, we ensure there's a placeholder node. That way no existing devices will regress their cleanly buildable state.
--- arch/arm/dts/exynos-mobile.dtsi | 5 +++++ arch/arm/mach-exynos/Kconfig | 1 + configs/exynos-mobile_defconfig | 1 + 3 files changed, 7 insertions(+)
arch/arm/dts/exynos-mobile.dtsi new file +5 -0
@@ -0,0 +1,5 @@ +// SPDX-License-Identifier: GPL-2.0 +/ { + binman { + }; +};
arch/arm/mach-exynos/Kconfig +1 -0
@@ -255,6 +255,7 @@ endif config TARGET_EXYNOS_MOBILE bool "Samsung Exynos Generic Boards (for mobile devices)" select ARM64 + select BINMAN select BOARD_EARLY_INIT_F select CLK_EXYNOS select LINUX_KERNEL_IMAGE_HEADER
configs/exynos-mobile_defconfig +1 -0
@@ -32,6 +32,7 @@ CONFIG_EFI_PARTITION=y CONFIG_OF_UPSTREAM=y CONFIG_OF_UPSTREAM_BUILD_VENDOR=y CONFIG_OF_BOARD=y +CONFIG_DEVICE_TREE_INCLUDES="exynos-mobile.dtsi" CONFIG_BLKMAP=y CONFIG_BUTTON_REMAP_PHONE_KEYS=y CONFIG_CLK_EXYNOS7870=y
Signature · 1 line
2.54.0
Hi Sam,
Quoted 10 lines · On 6/6/26 02:52, Sam Day via B4 Relay wrote:
U-Boot is seeing increasing adoption on pocket computers, many of which (sadly) have fused bootloader chains. Many of these bootloaders have a very rigid definition of what a "valid" downstream payload looks like. Sometimes it's just a boring old v0/v2 Android boot image. Sometimes it's something decidedly more grotesque.
To date, this last-mile packaging step has been trapped in downstream CI pipelines, blogposts, documentation, etc. This patch series aims to gather up all that esoterica and institutional knowledge and codify it in U-Boot's build system, using binman.
Awesome!!! :D
So happy to see this being worked on, it's a huge benefit to have this here in the build system.
That said, I think we need a bit of discussion around binman, I previously worked on using it for teaching the build system to emit .mbn files (see [1]), in the end getting binman to co-operate was a bunch of really annoying work and I wound up with a sub-par result.
The new approach which made a whole lot more sense is to use a vendor Makefile fragment to add a custom build target, skip dealing with binman and just have the necessary info in Python (since adding a table entry to a Python script is really no different to adding a binman DTB node). That's in [2].
I'm really not in favour of adding a binman node to the DTB that U-Boot uses, and I think it's kinda dumb that this is the only sensible way to configure binman today...
The way that mkmbn works is it just has all the device-specific config in a dictionary where the key is the compatible string, it finds the DTB in the U-Boot image and gets the appropriate mbn config from there.
I see you've clearly put a lot of effort into this, and I hate to ask you to do a lot more, but I'd really like to avoid using binman, would you be willing to rework this to put the config in Python and just have a custom make target like in the mkmbn patches? You can probably base it on top.
This way it avoids the need to add stuff to the dtb, you can just parse u-boot.dtb to determine the device and pick the right config.
[1]: https://lore.kernel.org/u-boot/20250722-b4-qcom-tooling-improvements-v5-0-df143f1247fc@linaro.org/
[2]: https://lore.kernel.org/u-boot/20260511-b4-qcom-tooling-improvements-v7-0-0c06346e79a9@linaro.org/
Quoted 84 lines
Put differently: an overwhelming majority of these pocket computer devices have a "canonical" payload format that U-Boot currently has no support for. Let's fix that.
The first patches in this series introduce an
android_bootetype. To begin with, this is a "typical" abootimg, as defined by canonical AOSP sources and referencefastboot/mkbootimgimplementation. There's plenty of devices out there with asane(-ish, nothing in Android-land is ever truly sane)bootloader that will happily chain a U-Boot rolled into the kernel section of an abootimg.With that out of the way, the cursed bootloaders are next to be supported. Binman etypes for Qualcomm's "QCDT" and Samsung's "DTBH" formats are implemented. These are non-standard vendor-specific devicetree containers, which the previous bootloader uses to pick a FDT to boot the downstream with.
In both cases, these vendor-specific formats are tacked on to the end of a v0 abootimg, with the
header_versionbeing hijacked to encode the length of this following payload. Thus, theandroid_bootetype is retrofitted to allow these shenanigans.Binman configs that produce flashable boot artifacts are introduced for the following devices:
* google-sargo (vanilla v2)
* oneplus-fajita (vanilla v2)
* samsung-a5u-eur (QCDT v0)
* samsung-gt510 (QCDT v0)
* samsung-j7xelte (DTBH v0)I also successfully tested a vanilla v0 on my samsung-expressltexx, in conjunction with the qcom-armv7 series already on the list. However, since that work is still in-flight and the expressltexx DTS is downstream, I opted not to include it here.
Signed-off-by Sam Day <[email protected]>---
Sam Day (13):
binman: Android boot image support .gitignore: ignore binman-generated blobs
arch: arm: qcom: google-sargo binman config
qcom: arch: arm: qcom: sdm845-fajita binman configs
mach-snapdragon: enable BINMAN
binman:android_boot: vendor-dt support
binman: Add QCDT support
binman:android_boot: SEANDROIDENFORCE support
arch: arm: qcom: samsung-a5u-eur binman config
arch: arm: qcom: samsung-gt510 binman config
binman: Add DTBH support
arch: arm: exynos: add j7xelte binman config
configs: exynos-mobile: pull in BINMAN.gitignore | 1 + arch/arm/Kconfig | 1 + arch/arm/dts/exynos-mobile.dtsi | 5 + arch/arm/dts/exynos7870-j7xelte-u-boot.dtsi | 24 ++ arch/arm/dts/msm8916-samsung-a5u-eur-u-boot.dtsi | 39 ++ arch/arm/dts/msm8916-samsung-gt510-u-boot.dtsi | 39 ++ arch/arm/dts/qcom.dtsi | 5 + arch/arm/dts/sdm670-google-sargo-u-boot.dtsi | 27 ++ arch/arm/dts/sdm845-oneplus-fajita-u-boot.dtsi | 25 ++ arch/arm/mach-exynos/Kconfig | 1 + configs/exynos-mobile_defconfig | 1 + configs/qcom_defconfig | 1 + tools/binman/etype/android_boot.py | 408 +++++++++++++++++++++ tools/binman/etype/dtbh.py | 173 +++++++++ tools/binman/etype/qcdt.py | 160 ++++++++ tools/binman/ftest.py | 127 +++++++ .../test/vendor/android_boot_seandroidenforce.dts | 22 ++ tools/binman/test/vendor/android_boot_v0.dts | 29 ++ tools/binman/test/vendor/android_boot_v2.dts | 46 +++ .../binman/test/vendor/android_boot_vendor_dt.dts | 27 ++ tools/binman/test/vendor/dtbh.dts | 29 ++ tools/binman/test/vendor/dtbh_bad_model_info.dts | 19 + tools/binman/test/vendor/qcdt.dts | 20 + tools/binman/test/vendor/qcdt_bad_msm_id.dts | 17 + 24 files changed, 1246 insertions(+)---
base-commit:a4c8728f225b0d7d591fb9199ce7efb72f48290e
change-id: 20260604-android-binman-ad7a43f4e99dBest regards,
Salutations Casey,
Quoted 16 lines · Casey Connolly
Hi Sam,
Quoted 10 lines · On 6/6/26 02:52, Sam Day via B4 Relay wrote:
U-Boot is seeing increasing adoption on pocket computers, many of which (sadly) have fused bootloader chains. Many of these bootloaders have a very rigid definition of what a "valid" downstream payload looks like. Sometimes it's just a boring old v0/v2 Android boot image. Sometimes it's something decidedly more grotesque.
To date, this last-mile packaging step has been trapped in downstream CI pipelines, blogposts, documentation, etc. This patch series aims to gather up all that esoterica and institutional knowledge and codify it in U-Boot's build system, using binman.
Awesome!!! :D
Quoted 7 lines
So happy to see this being worked on, it's a huge benefit to have this here in the build system.
That said, I think we need a bit of discussion around binman, I previously worked on using it for teaching the build system to emit .mbn files (see [1]), in the end getting binman to co-operate was a bunch of really annoying work and I wound up with a sub-par result.
Yes, I saw that series. I tried to engage you on Matrix about it a few days ago to get a sense for why you felt that binman was unsalvageable. I should have engaged you properly here on the list, that's my bad.
Quoted 6 lines
The new approach which made a whole lot more sense is to use a vendor
Makefilefragment to add a custom build target, skip dealing with binman and just have the necessary info in Python (since adding a table entry to a Python script is really no different to adding a binman DTB node). That's in [2].
I would prefer to use binman. It's already well documented. It's already in use by countless other boards in U-Boot. I prefer maintaining DTSI's for the configuration DSL than some Python dicts. Also, at some point once enough devices have their native Android boot artifact described, there will be clear patterns that can be neatly tucked away into shared DTSI fragments.
Quoted 4 lines
I'm really not in favour of adding a binman node to the DTB that U-Boot uses, and I think it's kinda dumb that this is the only sensible way to configure binman today...
I see nothing wrong with that. Can you expand on your concerns a little more?
Quoted 10 lines
The way that mkmbn works is it just has all the device-specific config in a dictionary where the key is the compatible string, it finds the DTB in the U-Boot image and gets the appropriate mbn config from there.
I see you've clearly put a lot of effort into this, and I hate to ask you to do a lot more, but I'd really like to avoid using binman, would you be willing to rework this to put the config in Python and just have a custom make target like in the mkmbn patches? You can probably base it on top.
I'm definitely not interested in doing that. I would, however, be very willing to address any specific concerns you have with binman.
At any rate, if you want to NAK any binman usage in the qualcomm side, that's fair enough. Please let me know if you see absolutely no path forward, and I'll split the series to just focus on the binman etype impls and their usage on the Exynos side. That would be a bummer, but I'm intending to maintain a long-lived close-to-mainline downstream anyway, so I would continue widening the support there and hope that your opinion on binman changes in future :D
Quoted 9 lines
This way it avoids the need to add stuff to the dtb, you can just parse
u-boot.dtbto determine the device and pick the right config.[1]:
https://lore.kernel.org/u-boot/20250722-b4-qcom-tooling-improvements-v5-0-df143f1247fc@linaro.org/[2]:
https://lore.kernel.org/u-boot/20260511-b4-qcom-tooling-improvements-v7-0-0c06346e79a9@linaro.org/
I wonder if maybe the ELF wrangling in particular was cursed? I had absolutely no issues using binman and getting it to produce native binaries for a half-dozen disparate devices.
Cheers,
-Sam
Quoted 87 lines
Quoted 85 lines
Put differently: an overwhelming majority of these pocket computer devices have a "canonical" payload format that U-Boot currently has no support for. Let's fix that.
The first patches in this series introduce an
android_bootetype. To begin with, this is a "typical" abootimg, as defined by canonical AOSP sources and referencefastboot/mkbootimgimplementation. There's plenty of devices out there with asane(-ish, nothing in Android-land is ever truly sane)bootloader that will happily chain a U-Boot rolled into the kernel section of an abootimg.With that out of the way, the cursed bootloaders are next to be supported. Binman etypes for Qualcomm's "QCDT" and Samsung's "DTBH" formats are implemented. These are non-standard vendor-specific devicetree containers, which the previous bootloader uses to pick a FDT to boot the downstream with.
In both cases, these vendor-specific formats are tacked on to the end of a v0 abootimg, with the
header_versionbeing hijacked to encode the length of this following payload. Thus, theandroid_bootetype is retrofitted to allow these shenanigans.Binman configs that produce flashable boot artifacts are introduced for the following devices:
* google-sargo (vanilla v2)
* oneplus-fajita (vanilla v2)
* samsung-a5u-eur (QCDT v0)
* samsung-gt510 (QCDT v0)
* samsung-j7xelte (DTBH v0)I also successfully tested a vanilla v0 on my samsung-expressltexx, in conjunction with the qcom-armv7 series already on the list. However, since that work is still in-flight and the expressltexx DTS is downstream, I opted not to include it here.
Signed-off-by Sam Day <[email protected]>---
Sam Day (13):
binman: Android boot image support .gitignore: ignore binman-generated blobs
arch: arm: qcom: google-sargo binman config
qcom: arch: arm: qcom: sdm845-fajita binman configs
mach-snapdragon: enable BINMAN
binman:android_boot: vendor-dt support
binman: Add QCDT support
binman:android_boot: SEANDROIDENFORCE support
arch: arm: qcom: samsung-a5u-eur binman config
arch: arm: qcom: samsung-gt510 binman config
binman: Add DTBH support
arch: arm: exynos: add j7xelte binman config
configs: exynos-mobile: pull in BINMAN.gitignore | 1 + arch/arm/Kconfig | 1 + arch/arm/dts/exynos-mobile.dtsi | 5 + arch/arm/dts/exynos7870-j7xelte-u-boot.dtsi | 24 ++ arch/arm/dts/msm8916-samsung-a5u-eur-u-boot.dtsi | 39 ++ arch/arm/dts/msm8916-samsung-gt510-u-boot.dtsi | 39 ++ arch/arm/dts/qcom.dtsi | 5 + arch/arm/dts/sdm670-google-sargo-u-boot.dtsi | 27 ++ arch/arm/dts/sdm845-oneplus-fajita-u-boot.dtsi | 25 ++ arch/arm/mach-exynos/Kconfig | 1 + configs/exynos-mobile_defconfig | 1 + configs/qcom_defconfig | 1 + tools/binman/etype/android_boot.py | 408 +++++++++++++++++++++ tools/binman/etype/dtbh.py | 173 +++++++++ tools/binman/etype/qcdt.py | 160 ++++++++ tools/binman/ftest.py | 127 +++++++ .../test/vendor/android_boot_seandroidenforce.dts | 22 ++ tools/binman/test/vendor/android_boot_v0.dts | 29 ++ tools/binman/test/vendor/android_boot_v2.dts | 46 +++ .../binman/test/vendor/android_boot_vendor_dt.dts | 27 ++ tools/binman/test/vendor/dtbh.dts | 29 ++ tools/binman/test/vendor/dtbh_bad_model_info.dts | 19 + tools/binman/test/vendor/qcdt.dts | 20 + tools/binman/test/vendor/qcdt_bad_msm_id.dts | 17 + 24 files changed, 1246 insertions(+)---
base-commit:a4c8728f225b0d7d591fb9199ce7efb72f48290e
change-id: 20260604-android-binman-ad7a43f4e99dBest regards,
Hi Sam,
Quoted 39 lines · Sam Day
Salutations Casey,
Quoted 16 lines · Casey Connolly
Hi Sam,
Quoted 10 lines · On 6/6/26 02:52, Sam Day via B4 Relay wrote:
U-Boot is seeing increasing adoption on pocket computers, many of which (sadly) have fused bootloader chains. Many of these bootloaders have a very rigid definition of what a "valid" downstream payload looks like. Sometimes it's just a boring old v0/v2 Android boot image. Sometimes it's something decidedly more grotesque.
To date, this last-mile packaging step has been trapped in downstream CI pipelines, blogposts, documentation, etc. This patch series aims to gather up all that esoterica and institutional knowledge and codify it in U-Boot's build system, using binman.
Awesome!!! :D
Quoted 7 lines
So happy to see this being worked on, it's a huge benefit to have this here in the build system.
That said, I think we need a bit of discussion around binman, I previously worked on using it for teaching the build system to emit .mbn files (see [1]), in the end getting binman to co-operate was a bunch of really annoying work and I wound up with a sub-par result.
Yes, I saw that series. I tried to engage you on Matrix about it a few days ago to get a sense for why you felt that binman was unsalvageable. I should have engaged you properly here on the list, that's my bad.
Quoted 6 lines
The new approach which made a whole lot more sense is to use a vendor
Makefilefragment to add a custom build target, skip dealing with binman and just have the necessary info in Python (since adding a table entry to a Python script is really no different to adding a binman DTB node). That's in [2].
Quoted 5 lines
I would prefer to use binman. It's already well documented. It's already in use by countless other boards in U-Boot. I prefer maintaining DTSI's for the configuration DSL than some Python dicts. Also, at some point once enough devices have their native Android boot artifact described, there will be clear patterns that can be neatly tucked away into shared DTSI fragments.
From my side, binman is a no-go for a bunch of reasons, polluting the device dtb being a big one, the ability to debug and maintain it is also not something i feel particularly confident about. Hence having a standalone tool would be the appropriate way to go for this, I really want to avoid having to learn this bespoke overly complex build tooling when it's selling points aren't things that have much value for Qualcomm.
Quoted 7 lines
Quoted 5 lines
I'm really not in favour of adding a binman node to the DTB that U-Boot uses, and I think it's kinda dumb that this is the only sensible way to configure binman today...
I see nothing wrong with that. Can you expand on your concerns a little more?
It really just goes against the goal of using upstream DT. Previously I managed to get binman to parse its config from a separate DTB but that was hellish to integrate the tooling for.
Having this random node at runtime for completely unnecessary arbitrary reasons feels just wrong to me.
Quoted 6 lines
Quoted 6 lines
The way that mkmbn works is it just has all the device-specific config in a dictionary where the key is the compatible string, it finds the DTB in the U-Boot image and gets the appropriate mbn config from there.
Quoted 8 lines
Quoted 5 lines
I see you've clearly put a lot of effort into this, and I hate to ask you to do a lot more, but I'd really like to avoid using binman, would you be willing to rework this to put the config in Python and just have a custom make target like in the mkmbn patches? You can probably base it on top.
I'm definitely not interested in doing that. I would, however, be very willing to address any specific concerns you have with binman.
That's a shame to hear>
Quoted 6 lines
At any rate, if you want to NAK any binman usage in the qualcomm side, that's fair enough. Please let me know if you see absolutely no path forward, and I'll split the series to just focus on the binman etype impls and their usage on the Exynos side. That would be a bummer, but I'm intending to maintain a long-lived close-to-mainline downstream anyway, so I would continue widening the support there and hope that your opinion on binman changes in future :D
I don't feel comfortable depending on binman for Qualcomm, so we'll leave it there.
Kind regards,
// Casey>
Quoted 103 lines
Quoted 9 lines
This way it avoids the need to add stuff to the dtb, you can just parse
u-boot.dtbto determine the device and pick the right config.[1]:
https://lore.kernel.org/u-boot/20250722-b4-qcom-tooling-improvements-v5-0-df143f1247fc@linaro.org/[2]:
https://lore.kernel.org/u-boot/20260511-b4-qcom-tooling-improvements-v7-0-0c06346e79a9@linaro.org/I wonder if maybe the ELF wrangling in particular was cursed? I had absolutely no issues using binman and getting it to produce native binaries for a half-dozen disparate devices.
Cheers,
-SamQuoted 87 lines
Quoted 85 lines
Put differently: an overwhelming majority of these pocket computer devices have a "canonical" payload format that U-Boot currently has no support for. Let's fix that.
The first patches in this series introduce an
android_bootetype. To begin with, this is a "typical" abootimg, as defined by canonical AOSP sources and referencefastboot/mkbootimgimplementation. There's plenty of devices out there with asane(-ish, nothing in Android-land is ever truly sane)bootloader that will happily chain a U-Boot rolled into the kernel section of an abootimg.With that out of the way, the cursed bootloaders are next to be supported. Binman etypes for Qualcomm's "QCDT" and Samsung's "DTBH" formats are implemented. These are non-standard vendor-specific devicetree containers, which the previous bootloader uses to pick a FDT to boot the downstream with.
In both cases, these vendor-specific formats are tacked on to the end of a v0 abootimg, with the
header_versionbeing hijacked to encode the length of this following payload. Thus, theandroid_bootetype is retrofitted to allow these shenanigans.Binman configs that produce flashable boot artifacts are introduced for the following devices:
* google-sargo (vanilla v2)
* oneplus-fajita (vanilla v2)
* samsung-a5u-eur (QCDT v0)
* samsung-gt510 (QCDT v0)
* samsung-j7xelte (DTBH v0)I also successfully tested a vanilla v0 on my samsung-expressltexx, in conjunction with the qcom-armv7 series already on the list. However, since that work is still in-flight and the expressltexx DTS is downstream, I opted not to include it here.
Signed-off-by Sam Day <[email protected]>---
Sam Day (13):
binman: Android boot image support .gitignore: ignore binman-generated blobs
arch: arm: qcom: google-sargo binman config
qcom: arch: arm: qcom: sdm845-fajita binman configs
mach-snapdragon: enable BINMAN
binman:android_boot: vendor-dt support
binman: Add QCDT support
binman:android_boot: SEANDROIDENFORCE support
arch: arm: qcom: samsung-a5u-eur binman config
arch: arm: qcom: samsung-gt510 binman config
binman: Add DTBH support
arch: arm: exynos: add j7xelte binman config
configs: exynos-mobile: pull in BINMAN.gitignore | 1 + arch/arm/Kconfig | 1 + arch/arm/dts/exynos-mobile.dtsi | 5 + arch/arm/dts/exynos7870-j7xelte-u-boot.dtsi | 24 ++ arch/arm/dts/msm8916-samsung-a5u-eur-u-boot.dtsi | 39 ++ arch/arm/dts/msm8916-samsung-gt510-u-boot.dtsi | 39 ++ arch/arm/dts/qcom.dtsi | 5 + arch/arm/dts/sdm670-google-sargo-u-boot.dtsi | 27 ++ arch/arm/dts/sdm845-oneplus-fajita-u-boot.dtsi | 25 ++ arch/arm/mach-exynos/Kconfig | 1 + configs/exynos-mobile_defconfig | 1 + configs/qcom_defconfig | 1 + tools/binman/etype/android_boot.py | 408 +++++++++++++++++++++ tools/binman/etype/dtbh.py | 173 +++++++++ tools/binman/etype/qcdt.py | 160 ++++++++ tools/binman/ftest.py | 127 +++++++ .../test/vendor/android_boot_seandroidenforce.dts | 22 ++ tools/binman/test/vendor/android_boot_v0.dts | 29 ++ tools/binman/test/vendor/android_boot_v2.dts | 46 +++ .../binman/test/vendor/android_boot_vendor_dt.dts | 27 ++ tools/binman/test/vendor/dtbh.dts | 29 ++ tools/binman/test/vendor/dtbh_bad_model_info.dts | 19 + tools/binman/test/vendor/qcdt.dts | 20 + tools/binman/test/vendor/qcdt_bad_msm_id.dts | 17 + 24 files changed, 1246 insertions(+)---
base-commit:a4c8728f225b0d7d591fb9199ce7efb72f48290e
change-id: 20260604-android-binman-ad7a43f4e99dBest regards,
Quoted 6 lines · Casey Connolly via groups.io
<...>
Quoted 5 lines
Quoted 4 lines
I'm really not in favour of adding a binman node to the DTB that U-Boot uses, and I think it's kinda dumb that this is the only sensible way to configure binman today...
Quoted 6 lines
Quoted 1 line
I see nothing wrong with that. Can you expand on your concerns a little more?
It really just goes against the goal of using upstream DT. Previously I managed to get binman to parse its config from a separate DTB but that was hellish to integrate the tooling for.
Having this random node at runtime for completely unnecessary arbitrary reasons feels just wrong to me.
For what is worth, binman config typically goes in -u-boot.dtsi, not the device upstream .dts. It also doesn't have to be in <device-name>-u-boot.dtsi, see for example rockchip-u-boot.dtsi and meson-gx-u-boot.dtsi.
I'd guess binman is more geared towards boards where multiple firmware stages are loaded though (e.g. you have to load u-boot TPL then SPL then TF-A etc), rather than just one u-boot.bin that's inside an android boot.img.
Best regards,
Ferass
Hello,
Quoted 93 lines · Casey Connolly
Hi Sam,
Quoted 39 lines · Sam Day
Salutations Casey,
Quoted 16 lines · Casey Connolly
Hi Sam,
Quoted 10 lines · On 6/6/26 02:52, Sam Day via B4 Relay wrote:
U-Boot is seeing increasing adoption on pocket computers, many of which (sadly) have fused bootloader chains. Many of these bootloaders have a very rigid definition of what a "valid" downstream payload looks like. Sometimes it's just a boring old v0/v2 Android boot image. Sometimes it's something decidedly more grotesque.
To date, this last-mile packaging step has been trapped in downstream CI pipelines, blogposts, documentation, etc. This patch series aims to gather up all that esoterica and institutional knowledge and codify it in U-Boot's build system, using binman.
Awesome!!! :D
Quoted 7 lines
So happy to see this being worked on, it's a huge benefit to have this here in the build system.
That said, I think we need a bit of discussion around binman, I previously worked on using it for teaching the build system to emit .mbn files (see [1]), in the end getting binman to co-operate was a bunch of really annoying work and I wound up with a sub-par result.
Yes, I saw that series. I tried to engage you on Matrix about it a few days ago to get a sense for why you felt that binman was unsalvageable. I should have engaged you properly here on the list, that's my bad.
Quoted 6 lines
The new approach which made a whole lot more sense is to use a vendor
Makefilefragment to add a custom build target, skip dealing with binman and just have the necessary info in Python (since adding a table entry to a Python script is really no different to adding a binman DTB node). That's in [2].Quoted 5 lines
I would prefer to use binman. It's already well documented. It's already in use by countless other boards in U-Boot. I prefer maintaining DTSI's for the configuration DSL than some Python dicts. Also, at some point once enough devices have their native Android boot artifact described, there will be clear patterns that can be neatly tucked away into shared DTSI fragments.
From my side, binman is a no-go for a bunch of reasons, polluting the
device dtb being a big one, the ability to debug and maintain it is also not something i feel particularly confident about. Hence having a standalone tool would be the appropriate way to go for this, I really want to avoid having to learn this bespoke overly complex build tooling when it's selling points aren't things that have much value for Qualcomm.Quoted 7 lines
Quoted 5 lines
I'm really not in favour of adding a binman node to the DTB that U-Boot uses, and I think it's kinda dumb that this is the only sensible way to configure binman today...
I see nothing wrong with that. Can you expand on your concerns a little more?
It really just goes against the goal of using upstream DT. Previously I managed to get binman to parse its config from a separate DTB but that was hellish to integrate the tooling for.
Having this random node at runtime for completely unnecessary arbitrary reasons feels just wrong to me.
Quoted 6 lines
Quoted 6 lines
The way that mkmbn works is it just has all the device-specific config in a dictionary where the key is the compatible string, it finds the DTB in the U-Boot image and gets the appropriate mbn config from there.
Quoted 8 lines
Quoted 5 lines
I see you've clearly put a lot of effort into this, and I hate to ask you to do a lot more, but I'd really like to avoid using binman, would you be willing to rework this to put the config in Python and just have a custom make target like in the mkmbn patches? You can probably base it on top.
I'm definitely not interested in doing that. I would, however, be very willing to address any specific concerns you have with binman.
That's a shame to hear>
Quoted 6 lines
At any rate, if you want to NAK any binman usage in the qualcomm side, that's fair enough. Please let me know if you see absolutely no path forward, and I'll split the series to just focus on the binman etype impls and their usage on the Exynos side. That would be a bummer, but I'm intending to maintain a long-lived close-to-mainline downstream anyway, so I would continue widening the support there and hope that your opinion on binman changes in future :D
Quoted 2 lines
I don't feel comfortable depending on binman for Qualcomm, so we'll leave it there.
Acknowledged. I'll resend this series scoped to Exynos only and hope that you're no longer a gatekeeper for Qualcomm in future.
-Sam
Quoted 108 lines
Kind regards,
// Casey>Quoted 103 lines
Quoted 9 lines
This way it avoids the need to add stuff to the dtb, you can just parse
u-boot.dtbto determine the device and pick the right config.[1]:
https://lore.kernel.org/u-boot/20250722-b4-qcom-tooling-improvements-v5-0-df143f1247fc@linaro.org/[2]:
https://lore.kernel.org/u-boot/20260511-b4-qcom-tooling-improvements-v7-0-0c06346e79a9@linaro.org/I wonder if maybe the ELF wrangling in particular was cursed? I had absolutely no issues using binman and getting it to produce native binaries for a half-dozen disparate devices.
Cheers,
-SamQuoted 87 lines
Quoted 85 lines
Put differently: an overwhelming majority of these pocket computer devices have a "canonical" payload format that U-Boot currently has no support for. Let's fix that.
The first patches in this series introduce an
android_bootetype. To begin with, this is a "typical" abootimg, as defined by canonical AOSP sources and referencefastboot/mkbootimgimplementation. There's plenty of devices out there with asane(-ish, nothing in Android-land is ever truly sane)bootloader that will happily chain a U-Boot rolled into the kernel section of an abootimg.With that out of the way, the cursed bootloaders are next to be supported. Binman etypes for Qualcomm's "QCDT" and Samsung's "DTBH" formats are implemented. These are non-standard vendor-specific devicetree containers, which the previous bootloader uses to pick a FDT to boot the downstream with.
In both cases, these vendor-specific formats are tacked on to the end of a v0 abootimg, with the
header_versionbeing hijacked to encode the length of this following payload. Thus, theandroid_bootetype is retrofitted to allow these shenanigans.Binman configs that produce flashable boot artifacts are introduced for the following devices:
* google-sargo (vanilla v2)
* oneplus-fajita (vanilla v2)
* samsung-a5u-eur (QCDT v0)
* samsung-gt510 (QCDT v0)
* samsung-j7xelte (DTBH v0)I also successfully tested a vanilla v0 on my samsung-expressltexx, in conjunction with the qcom-armv7 series already on the list. However, since that work is still in-flight and the expressltexx DTS is downstream, I opted not to include it here.
Signed-off-by Sam Day <[email protected]>---
Sam Day (13):
binman: Android boot image support .gitignore: ignore binman-generated blobs
arch: arm: qcom: google-sargo binman config
qcom: arch: arm: qcom: sdm845-fajita binman configs
mach-snapdragon: enable BINMAN
binman:android_boot: vendor-dt support
binman: Add QCDT support
binman:android_boot: SEANDROIDENFORCE support
arch: arm: qcom: samsung-a5u-eur binman config
arch: arm: qcom: samsung-gt510 binman config
binman: Add DTBH support
arch: arm: exynos: add j7xelte binman config
configs: exynos-mobile: pull in BINMAN.gitignore | 1 + arch/arm/Kconfig | 1 + arch/arm/dts/exynos-mobile.dtsi | 5 + arch/arm/dts/exynos7870-j7xelte-u-boot.dtsi | 24 ++ arch/arm/dts/msm8916-samsung-a5u-eur-u-boot.dtsi | 39 ++ arch/arm/dts/msm8916-samsung-gt510-u-boot.dtsi | 39 ++ arch/arm/dts/qcom.dtsi | 5 + arch/arm/dts/sdm670-google-sargo-u-boot.dtsi | 27 ++ arch/arm/dts/sdm845-oneplus-fajita-u-boot.dtsi | 25 ++ arch/arm/mach-exynos/Kconfig | 1 + configs/exynos-mobile_defconfig | 1 + configs/qcom_defconfig | 1 + tools/binman/etype/android_boot.py | 408 +++++++++++++++++++++ tools/binman/etype/dtbh.py | 173 +++++++++ tools/binman/etype/qcdt.py | 160 ++++++++ tools/binman/ftest.py | 127 +++++++ .../test/vendor/android_boot_seandroidenforce.dts | 22 ++ tools/binman/test/vendor/android_boot_v0.dts | 29 ++ tools/binman/test/vendor/android_boot_v2.dts | 46 +++ .../binman/test/vendor/android_boot_vendor_dt.dts | 27 ++ tools/binman/test/vendor/dtbh.dts | 29 ++ tools/binman/test/vendor/dtbh_bad_model_info.dts | 19 + tools/binman/test/vendor/qcdt.dts | 20 + tools/binman/test/vendor/qcdt_bad_msm_id.dts | 17 + 24 files changed, 1246 insertions(+)---
base-commit:a4c8728f225b0d7d591fb9199ce7efb72f48290e
change-id: 20260604-android-binman-ad7a43f4e99dBest regards,
Hi Casey,
Quoted 49 lines · Casey Connolly
Hi Sam,
Quoted 39 lines · Sam Day
Salutations Casey,
Quoted 16 lines · Casey Connolly
Hi Sam,
Quoted 10 lines · On 6/6/26 02:52, Sam Day via B4 Relay wrote:
U-Boot is seeing increasing adoption on pocket computers, many of which (sadly) have fused bootloader chains. Many of these bootloaders have a very rigid definition of what a "valid" downstream payload looks like. Sometimes it's just a boring old v0/v2 Android boot image. Sometimes it's something decidedly more grotesque.
To date, this last-mile packaging step has been trapped in downstream CI pipelines, blogposts, documentation, etc. This patch series aims to gather up all that esoterica and institutional knowledge and codify it in U-Boot's build system, using binman.
Awesome!!! :D
Quoted 7 lines
So happy to see this being worked on, it's a huge benefit to have this here in the build system.
That said, I think we need a bit of discussion around binman, I previously worked on using it for teaching the build system to emit .mbn files (see [1]), in the end getting binman to co-operate was a bunch of really annoying work and I wound up with a sub-par result.
Yes, I saw that series. I tried to engage you on Matrix about it a few days ago to get a sense for why you felt that binman was unsalvageable. I should have engaged you properly here on the list, that's my bad.
Quoted 6 lines
The new approach which made a whole lot more sense is to use a vendor
Makefilefragment to add a custom build target, skip dealing with binman and just have the necessary info in Python (since adding a table entry to a Python script is really no different to adding a binman DTB node). That's in [2].Quoted 5 lines
I would prefer to use binman. It's already well documented. It's already in use by countless other boards in U-Boot. I prefer maintaining DTSI's for the configuration DSL than some Python dicts. Also, at some point once enough devices have their native Android boot artifact described, there will be clear patterns that can be neatly tucked away into shared DTSI fragments.
Quoted 6 lines
From my side, binman is a no-go for a bunch of reasons, polluting the
device dtb being a big one, the ability to debug and maintain it is also not something i feel particularly confident about. Hence having a standalone tool would be the appropriate way to go for this, I really want to avoid having to learn this bespoke overly complex build tooling when it's selling points aren't things that have much value for Qualcomm.
Binman is the usual U-Boot way to build images. We should not be inventing new, custom ways of doing things, least of all more scripts. We should should be describing the image, not coding it.
Quoted 7 lines
Quoted 7 lines
Quoted 6 lines
I'm really not in favour of adding a binman node to the DTB that U-Boot uses, and I think it's kinda dumb that this is the only sensible way to configure binman today...
Quoted 8 lines
Quoted 1 line
I see nothing wrong with that. Can you expand on your concerns a little more?
It really just goes against the goal of using upstream DT. Previously I managed to get binman to parse its config from a separate DTB but that was hellish to integrate the tooling for.
Having this random node at runtime for completely unnecessary arbitrary reasons feels just wrong to me.
On some boards (e.g. x86) it is used at runtime to locate things. In any case it provides a clear indication of what is where, in data rather than code. We don't need to make it use a separate DT, so far as I can tell.
Quoted 24 lines
Quoted 7 lines
Quoted 7 lines
The way that mkmbn works is it just has all the device-specific config in a dictionary where the key is the compatible string, it finds the DTB in the U-Boot image and gets the appropriate mbn config from there.
Quoted 8 lines
Quoted 5 lines
I see you've clearly put a lot of effort into this, and I hate to ask you to do a lot more, but I'd really like to avoid using binman, would you be willing to rework this to put the config in Python and just have a custom make target like in the mkmbn patches? You can probably base it on top.
I'm definitely not interested in doing that. I would, however, be very willing to address any specific concerns you have with binman.
That's a shame to hear>
Quoted 6 lines
At any rate, if you want to NAK any binman usage in the qualcomm side, that's fair enough. Please let me know if you see absolutely no path forward, and I'll split the series to just focus on the binman etype impls and their usage on the Exynos side. That would be a bummer, but I'm intending to maintain a long-lived close-to-mainline downstream anyway, so I would continue widening the support there and hope that your opinion on binman changes in future :D
Quoted 2 lines
I don't feel comfortable depending on binman for Qualcomm, so we'll leave it there.
I'd like to figure this out, particularly as Qualcomm is ramping up its U-Boot efforts.
Regards,
Simon
Quoted 108 lines · Simon Glass
Hi Casey,
Quoted 49 lines · Casey Connolly
Hi Sam,
Quoted 39 lines · Sam Day
Salutations Casey,
Quoted 16 lines · Casey Connolly
Hi Sam,
Quoted 10 lines · On 6/6/26 02:52, Sam Day via B4 Relay wrote:
U-Boot is seeing increasing adoption on pocket computers, many of which (sadly) have fused bootloader chains. Many of these bootloaders have a very rigid definition of what a "valid" downstream payload looks like. Sometimes it's just a boring old v0/v2 Android boot image. Sometimes it's something decidedly more grotesque.
To date, this last-mile packaging step has been trapped in downstream CI pipelines, blogposts, documentation, etc. This patch series aims to gather up all that esoterica and institutional knowledge and codify it in U-Boot's build system, using binman.
Awesome!!! :D
Quoted 7 lines
So happy to see this being worked on, it's a huge benefit to have this here in the build system.
That said, I think we need a bit of discussion around binman, I previously worked on using it for teaching the build system to emit .mbn files (see [1]), in the end getting binman to co-operate was a bunch of really annoying work and I wound up with a sub-par result.
Yes, I saw that series. I tried to engage you on Matrix about it a few days ago to get a sense for why you felt that binman was unsalvageable. I should have engaged you properly here on the list, that's my bad.
Quoted 6 lines
The new approach which made a whole lot more sense is to use a vendor
Makefilefragment to add a custom build target, skip dealing with binman and just have the necessary info in Python (since adding a table entry to a Python script is really no different to adding a binman DTB node). That's in [2].Quoted 5 lines
I would prefer to use binman. It's already well documented. It's already in use by countless other boards in U-Boot. I prefer maintaining DTSI's for the configuration DSL than some Python dicts. Also, at some point once enough devices have their native Android boot artifact described, there will be clear patterns that can be neatly tucked away into shared DTSI fragments.
Quoted 6 lines
From my side, binman is a no-go for a bunch of reasons, polluting the
device dtb being a big one, the ability to debug and maintain it is also not something i feel particularly confident about. Hence having a standalone tool would be the appropriate way to go for this, I really want to avoid having to learn this bespoke overly complex build tooling when it's selling points aren't things that have much value for Qualcomm.Binman is the usual U-Boot way to build images. We should not be inventing new, custom ways of doing things, least of all more scripts. We should should be describing the image, not coding it.
Quoted 7 lines
Quoted 7 lines
Quoted 6 lines
I'm really not in favour of adding a binman node to the DTB that U-Boot uses, and I think it's kinda dumb that this is the only sensible way to configure binman today...
Quoted 8 lines
Quoted 1 line
I see nothing wrong with that. Can you expand on your concerns a little more?
It really just goes against the goal of using upstream DT. Previously I managed to get binman to parse its config from a separate DTB but that was hellish to integrate the tooling for.
Having this random node at runtime for completely unnecessary arbitrary reasons feels just wrong to me.
On some boards (e.g. x86) it is used at runtime to locate things. In any case it provides a clear indication of what is where, in data rather than code. We don't need to make it use a separate DT, so far as I can tell.
Quoted 24 lines
Quoted 7 lines
Quoted 7 lines
The way that mkmbn works is it just has all the device-specific config in a dictionary where the key is the compatible string, it finds the DTB in the U-Boot image and gets the appropriate mbn config from there.
Quoted 8 lines
Quoted 5 lines
I see you've clearly put a lot of effort into this, and I hate to ask you to do a lot more, but I'd really like to avoid using binman, would you be willing to rework this to put the config in Python and just have a custom make target like in the mkmbn patches? You can probably base it on top.
I'm definitely not interested in doing that. I would, however, be very willing to address any specific concerns you have with binman.
That's a shame to hear>
Quoted 6 lines
At any rate, if you want to NAK any binman usage in the qualcomm side, that's fair enough. Please let me know if you see absolutely no path forward, and I'll split the series to just focus on the binman etype impls and their usage on the Exynos side. That would be a bummer, but I'm intending to maintain a long-lived close-to-mainline downstream anyway, so I would continue widening the support there and hope that your opinion on binman changes in future :D
Quoted 5 lines
Quoted 2 lines
I don't feel comfortable depending on binman for Qualcomm, so we'll leave it there.
I'd like to figure this out, particularly as Qualcomm is ramping up its U-Boot efforts.
I believe the problems with binman and Qualcomm platforms have been well enough documented and discussed in the thread where Casey attempted to make it all work with binman and found how ill-suited it seemed to be, unfortunately.
Signature · 1 line
Tom
Hi Tom,
Quoted 113 lines · Tom Rini
Quoted 111 lines · Simon Glass
Hi Casey,
Quoted 49 lines · Casey Connolly
Hi Sam,
Quoted 39 lines · Sam Day
Salutations Casey,
Quoted 16 lines · Casey Connolly
Hi Sam,
Quoted 10 lines · On 6/6/26 02:52, Sam Day via B4 Relay wrote:
U-Boot is seeing increasing adoption on pocket computers, many of which (sadly) have fused bootloader chains. Many of these bootloaders have a very rigid definition of what a "valid" downstream payload looks like. Sometimes it's just a boring old v0/v2 Android boot image. Sometimes it's something decidedly more grotesque.
To date, this last-mile packaging step has been trapped in downstream CI pipelines, blogposts, documentation, etc. This patch series aims to gather up all that esoterica and institutional knowledge and codify it in U-Boot's build system, using binman.
Awesome!!! :D
Quoted 7 lines
So happy to see this being worked on, it's a huge benefit to have this here in the build system.
That said, I think we need a bit of discussion around binman, I previously worked on using it for teaching the build system to emit .mbn files (see [1]), in the end getting binman to co-operate was a bunch of really annoying work and I wound up with a sub-par result.
Yes, I saw that series. I tried to engage you on Matrix about it a few days ago to get a sense for why you felt that binman was unsalvageable. I should have engaged you properly here on the list, that's my bad.
Quoted 6 lines
The new approach which made a whole lot more sense is to use a vendor
Makefilefragment to add a custom build target, skip dealing with binman and just have the necessary info in Python (since adding a table entry to a Python script is really no different to adding a binman DTB node). That's in [2].Quoted 5 lines
I would prefer to use binman. It's already well documented. It's already in use by countless other boards in U-Boot. I prefer maintaining DTSI's for the configuration DSL than some Python dicts. Also, at some point once enough devices have their native Android boot artifact described, there will be clear patterns that can be neatly tucked away into shared DTSI fragments.
Quoted 6 lines
From my side, binman is a no-go for a bunch of reasons, polluting the
device dtb being a big one, the ability to debug and maintain it is also not something i feel particularly confident about. Hence having a standalone tool would be the appropriate way to go for this, I really want to avoid having to learn this bespoke overly complex build tooling when it's selling points aren't things that have much value for Qualcomm.Binman is the usual U-Boot way to build images. We should not be inventing new, custom ways of doing things, least of all more scripts. We should should be describing the image, not coding it.
Quoted 7 lines
Quoted 7 lines
Quoted 6 lines
I'm really not in favour of adding a binman node to the DTB that U-Boot uses, and I think it's kinda dumb that this is the only sensible way to configure binman today...
Quoted 8 lines
Quoted 1 line
I see nothing wrong with that. Can you expand on your concerns a little more?
It really just goes against the goal of using upstream DT. Previously I managed to get binman to parse its config from a separate DTB but that was hellish to integrate the tooling for.
Having this random node at runtime for completely unnecessary arbitrary reasons feels just wrong to me.
On some boards (e.g. x86) it is used at runtime to locate things. In any case it provides a clear indication of what is where, in data rather than code. We don't need to make it use a separate DT, so far as I can tell.
Quoted 26 lines
Quoted 7 lines
Quoted 7 lines
The way that mkmbn works is it just has all the device-specific config in a dictionary where the key is the compatible string, it finds the DTB in the U-Boot image and gets the appropriate mbn config from there.
Quoted 8 lines
Quoted 5 lines
I see you've clearly put a lot of effort into this, and I hate to ask you to do a lot more, but I'd really like to avoid using binman, would you be willing to rework this to put the config in Python and just have a custom make target like in the mkmbn patches? You can probably base it on top.
I'm definitely not interested in doing that. I would, however, be very willing to address any specific concerns you have with binman.
That's a shame to hear>
Quoted 6 lines
At any rate, if you want to NAK any binman usage in the qualcomm side, that's fair enough. Please let me know if you see absolutely no path forward, and I'll split the series to just focus on the binman etype impls and their usage on the Exynos side. That would be a bummer, but I'm intending to maintain a long-lived close-to-mainline downstream anyway, so I would continue widening the support there and hope that your opinion on binman changes in future :D
I don't feel comfortable depending on binman for Qualcomm, so we'll leave it there.
Quoted 7 lines
Quoted 2 lines
I'd like to figure this out, particularly as Qualcomm is ramping up its U-Boot efforts.
I believe the problems with binman and Qualcomm platforms have been well enough documented and discussed in the thread where Casey attempted to make it all work with binman and found how ill-suited it seemed to be, unfortunately.
I found a few links so I'll start a new thread.
Regards,
Simon