Generate Android boot images with binman
Subsystems (3)
v2 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.
Note that, I dropped the commits that introduce this support for Qualcomm devices, as it was NAK'd by "Qualcomm". I still think this is worth inclusion upstream for a couple of reasons:
* It's still useful for Exynos devices.
* If/when other non-qcom devices with fused Android bootloaders come along, it will likely be useful there as well.
* Downstreams can easily carry DTSI overlays for qcom devices to take advantage of this new native U-Boot support there.
* Maybe the hard position against binman will change/soften on the Qualcomm side, in which case we can simply start dropping in DTSIs to add support for those devices.
---
Changes in v2:
- Rebase on next
- Drop all qcom-related work as it has been NAK'd from mach-snapdragon
- Link to v1: https://lore.kernel.org/r/[email protected]
---
Sam Day (8):
binman: Android boot image support .gitignore: ignore binman-generated blobs
binman: android_boot: vendor-dt support
binman: Add QCDT support
binman: android_boot: SEANDROIDENFORCE support
binman: Add DTBH support
arch: arm: exynos: add j7xelte binman config
configs: exynos-mobile: pull in BINMAN
.gitignore | 1 + arch/arm/dts/exynos-mobile.dtsi | 5 + arch/arm/dts/exynos7870-j7xelte-u-boot.dtsi | 24 ++ arch/arm/mach-exynos/Kconfig | 1 + configs/exynos-mobile_defconfig | 1 + tools/binman/etype/android_boot.py | 407 +++++++++++++++++++++ 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 + 17 files changed, 1108 insertions(+)
---
base-commit: 9e87893c24d1f21350e69bc222e6a3214c933b3b
change-id: 20260604-android-binman-ad7a43f4e99d
Best regards,
Signature · 1 line
Sam Day <[email protected]>
PATCH v2 1/8 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 | 313 +++++++++++++++++++++++++++ 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, 454 insertions(+)
tools/binman/etype/android_boot.py new file +313 -0
@@ -0,0 +1,313 @@ +# 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 + + 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
Re: [PATCH v2 1/8] binman: Android boot image support
Hi Sam,
Quoted 20 lines · On 2026-06-07T23:37:09, Sam Day via B4 Relay…
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_dtbosupport.Signed-off-by Sam Day <[email protected]>
tools/binman/etype/android_boot.py| 313 +++++++++++++++++++++++++++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, 454 insertions(+)
tools/binman/etype/android_boot.py line 7
Quoted 7 lines
tools/binman/etype/android_boot.py +7
-0@@ -0,0 +1,313 @@ + @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))
Please raise via self.Raise() so the user gets the node path. A bare ValueError makes it hard to track down which entry overflowed when several android-boot images are present.
Quoted 10 lines
tools/binman/etype/android_boot.py +8
-0@@ -0,0 +1,313 @@ + 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 +
tools/binman/etype/android_boot.py line 18
Quoted 10 lines
tools/binman/etype/android_boot.py +10
-0+ 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
These two are almost identical and the names don't distinguish them, i.e. _GetEntryData() will AttributeError if the name isn't present, while _GetOptionalEntryData() returns the default. Please fold them into one with a default=None parameter: None means required, anything else means optional (function comment). Also, the 'if data is None and not required' branch in _GetEntryData() does nothing - both arms return data.
Quoted 5 lines
tools/binman/etype/android_boot.py +3
-0@@ -0,0 +1,313 @@ + def ReadNode(self): + super().ReadNode() + self.header_version = fdt_util.GetInt(self._node, 'header-version', 0)
...
tools/binman/etype/android_boot.py line 123
Quoted 3 lines
tools/binman/etype/android_boot.py +3
-0+ if self.header_version not in (0, 2): + self.Raise('Only Android boot image header versions 0 and 2 are ' + 'supported')
Please call this out in the commit message - AOSP defines v0..v4 and readers will wonder why v1/v3/v4 are missing. Something like "v1, v3, v4 are not implemented as no use case has come up yet" would help.
tools/binman/ftest.py fdt fdtmap Extract the devicetree blob from the fdtmap · line 5602
Quoted 7 lines
tools/binman/ftest.py +5
-0@@ -5598,6 +5598,72 @@ fdt fdtmap Extract the devicetree blob from the fdtmap + self.assertEqual(U_BOOT_DATA, data[0x800:0x800 + len(U_BOOT_DATA)]) + 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)])
Last assertion duplicates the first - please drop it.
tools/binman/ftest.py fdt fdtmap Extract the devicetree blob from the fdtmap · line 5600
Quoted 5 lines
tools/binman/ftest.py +3
-0@@ -5598,6 +5598,72 @@ fdt fdtmap Extract the devicetree blob from the fdtmap + def testAndroidBootV0(self): + """Test that binman can produce a plain legacy Android boot image""" + data = self._DoReadFile('vendor/android_boot_v0.dts')
Missing coverage for several error paths - U haven't run this but there is Raise() for unsupported header_version, non-power-of-two page-size, etc. Binman aims for full branch coverage - please add tests for these, and verify 'binman test -T' still shows 100% coverage for your etype
tools/binman/test/vendor/android_boot_v2.dts line 4
Quoted 6 lines
tools/binman/test/vendor/android_boot_v2.dts +4
-0@@ -0,0 +1,46 @@ + kernel-offset = <0x00008000>; + ramdisk-offset = <0x01000000>; + second-offset = <0x00f00000>; + tags-offset = <0x00000100>;
'second-offset' is silently ignored - the etype doesn't parse it and the commit message says 'second' support is dropped. Do you need it?
tools/binman/test/vendor/android_boot_v0.dts line 3
Quoted 5 lines
tools/binman/test/vendor/android_boot_v0.dts +3
-0@@ -0,0 +1,29 @@ +// SPDX-License-Identifier: GPL-2.0+ + +/dts-v1/;
Why a new 'vendor/' subdirectory? The contents here are plain Android boot images, not anything vendor-specific. I'd suggest 'android/' (or leaving them in test/ alongside other etype .dts files), which also leaves a clearer naming pattern for QCDT/DTBH later.
Quoted 6 lines
tools/binman/etype/android_boot.py +4
-0@@ -0,0 +1,313 @@ + Example:: + A v2 abootimg with control FDT placed in the DTB section: + + android-boot {
...
tools/binman/etype/android_boot.py line 89
Quoted 3 lines
tools/binman/etype/android_boot.py +3
-0+ 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 {
These render as one big code block in the auto-generated docs, with the v0 description folded into the literal. Please split into two 'Example::' blocks, with a blank line between the v0 prose and its 'android-boot {'.
Regards,
Simon
Re: [PATCH v2 1/8] binman: Android boot image support
Hello Simon,
Quoted 22 lines · Simon Glass
Hi Sam,
Quoted 17 lines · On 2026-06-07T23:37:09, Sam Day via B4 Relay…
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_dtbosupport.Signed-off-by Sam Day <[email protected]>
tools/binman/etype/android_boot.py| 313 +++++++++++++++++++++++++++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, 454 insertions(+)
Quoted 13 lines
tools/binman/etype/android_boot.py line 7
Quoted 9 lines
tools/binman/etype/android_boot.py +7
-0@@ -0,0 +1,313 @@ + @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))Please raise via
self.Raise()so the user gets the node path. A bare ValueError makes it hard to track down which entry overflowed when several android-boot images are present.
Ack, done in v3.
Quoted 22 lines
Quoted 11 lines
tools/binman/etype/android_boot.py +8
-0@@ -0,0 +1,313 @@ + 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 +tools/binman/etype/android_boot.py line 18
Quoted 10 lines
tools/binman/etype/android_boot.py +10
-0+ 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
Quoted 7 lines
These two are almost identical and the names don't distinguish them, i.e.
_GetEntryData()will AttributeError if the name isn't present, while_GetOptionalEntryData()returns the default. Please fold them into one with a default=None parameter: None means required, anything else means optional (function comment). Also, the 'if data is None and not required' branch in_GetEntryData()does nothing - both arms return data.
Good catch, collapsed and simplified _GetEntryData() in v3.
Quoted 8 lines
Quoted 6 lines
tools/binman/etype/android_boot.py +3
-0@@ -0,0 +1,313 @@ + def ReadNode(self): + super().ReadNode() + self.header_version = fdt_util.GetInt(self._node, 'header-version', 0)...
Quoted 7 lines
tools/binman/etype/android_boot.py line 123
Quoted 3 lines
tools/binman/etype/android_boot.py +3
-0+ if self.header_version not in (0, 2): + self.Raise('Only Android boot image header versions 0 and 2 are ' + 'supported')Please call this out in the commit message - AOSP defines v0..v4 and readers will wonder why v1/v3/v4 are missing. Something like "v1, v3, v4 are not implemented as no use case has come up yet" would help.
Noted, added the explicit callout in v3.
Quoted 10 lines
tools/binman/ftest.py fdt fdtmap Extract the devicetree blob from the fdtmap · line 5602
Quoted 8 lines
tools/binman/ftest.py +5
-0@@ -5598,6 +5598,72 @@ fdt fdtmap Extract the devicetree blob from the fdtmap + self.assertEqual(U_BOOT_DATA, data[0x800:0x800 + len(U_BOOT_DATA)]) + 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)])Last assertion duplicates the first - please drop it.
Apologies, this was junk I didn't properly catch in the zillionth rebasing session. It was already cleaned up in a subsequent commit. v3 will clean it up properly.
Quoted 12 lines
tools/binman/ftest.py fdt fdtmap Extract the devicetree blob from the fdtmap · line 5600
Quoted 6 lines
tools/binman/ftest.py +3
-0@@ -5598,6 +5598,72 @@ fdt fdtmap Extract the devicetree blob from the fdtmap + def testAndroidBootV0(self): + """Test that binman can produce a plain legacy Android boot image""" + data = self._DoReadFile('vendor/android_boot_v0.dts')Missing coverage for several error paths - U haven't run this but there is
Raise()for unsupportedheader_version, non-power-of-two page-size, etc. Binman aims for full branch coverage - please add tests for these, and verify 'binman test -T' still shows 100% coverage for your etype
As discussed in IRC, I agree this is very reasonable... I didn't appreciate just how far the proposed code was from that 100% goal, though ;)
v3 introduces a much more comprehensive suite that hits 100% coverage.
Quoted 10 lines
tools/binman/test/vendor/android_boot_v2.dts line 4
Quoted 7 lines
tools/binman/test/vendor/android_boot_v2.dts +4
-0@@ -0,0 +1,46 @@ + kernel-offset = <0x00008000>; + ramdisk-offset = <0x01000000>; + second-offset = <0x00f00000>; + tags-offset = <0x00000100>;'second-offset' is silently ignored - the etype doesn't parse it and the commit message says 'second' support is dropped. Do you need it?
Nope, another vestige of a previous iteration that I didn't clean up properly in the rebasing, sorry about that! Removed in v3.
Quoted 11 lines
tools/binman/test/vendor/android_boot_v0.dts line 3
Quoted 6 lines
tools/binman/test/vendor/android_boot_v0.dts +3
-0@@ -0,0 +1,29 @@ +// SPDX-License-Identifier: GPL-2.0+ + +/dts-v1/;Why a new 'vendor/' subdirectory? The contents here are plain Android boot images, not anything vendor-specific. I'd suggest 'android/' (or leaving them in test/ alongside other etype .dts files), which also leaves a clearer naming pattern for QCDT/DTBH later.
Fair call - I've yanked everything up to the top level in v3.
Quoted 9 lines
Quoted 7 lines
tools/binman/etype/android_boot.py +4
-0@@ -0,0 +1,313 @@ + Example:: + A v2 abootimg with control FDT placed in the DTB section: + + android-boot {...
Quoted 8 lines
tools/binman/etype/android_boot.py line 89
Quoted 3 lines
tools/binman/etype/android_boot.py +3
-0+ 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 {These render as one big code block in the auto-generated docs, with the v0 description folded into the literal. Please split into two 'Example::' blocks, with a blank line between the v0 prose and its 'android-boot {'.
Ack, fixed in v3.
Quoted 4 lines
Regards,
Simon
Thanks for the thorough review Simon, much appreciated.
Cheers,
-Sam
Re: [PATCH v2 1/8] binman: Android boot image support
Hi Sam,
Quoted 121 lines · Sam Day
Hello Simon,
Quoted 22 lines · Simon Glass
Hi Sam,
Quoted 17 lines · On 2026-06-07T23:37:09, Sam Day via B4 Relay…
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_dtbosupport.Signed-off-by Sam Day <[email protected]>
tools/binman/etype/android_boot.py| 313 +++++++++++++++++++++++++++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, 454 insertions(+)Quoted 13 lines
tools/binman/etype/android_boot.py line 7
Quoted 9 lines
tools/binman/etype/android_boot.py +7
-0@@ -0,0 +1,313 @@ + @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))Please raise via
self.Raise()so the user gets the node path. A bare ValueError makes it hard to track down which entry overflowed when several android-boot images are present.Ack, done in v3.
Quoted 22 lines
Quoted 11 lines
tools/binman/etype/android_boot.py +8
-0@@ -0,0 +1,313 @@ + 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 +tools/binman/etype/android_boot.py line 18
Quoted 10 lines
tools/binman/etype/android_boot.py +10
-0+ 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 dataQuoted 7 lines
These two are almost identical and the names don't distinguish them, i.e.
_GetEntryData()will AttributeError if the name isn't present, while_GetOptionalEntryData()returns the default. Please fold them into one with a default=None parameter: None means required, anything else means optional (function comment). Also, the 'if data is None and not required' branch in_GetEntryData()does nothing - both arms return data.Good catch, collapsed and simplified
_GetEntryData()in v3.Quoted 8 lines
Quoted 6 lines
tools/binman/etype/android_boot.py +3
-0@@ -0,0 +1,313 @@ + def ReadNode(self): + super().ReadNode() + self.header_version = fdt_util.GetInt(self._node, 'header-version', 0)...
Quoted 7 lines
tools/binman/etype/android_boot.py line 123
Quoted 3 lines
tools/binman/etype/android_boot.py +3
-0+ if self.header_version not in (0, 2): + self.Raise('Only Android boot image header versions 0 and 2 are ' + 'supported')Please call this out in the commit message - AOSP defines v0..v4 and readers will wonder why v1/v3/v4 are missing. Something like "v1, v3, v4 are not implemented as no use case has come up yet" would help.
Noted, added the explicit callout in v3.
Quoted 10 lines
tools/binman/ftest.py fdt fdtmap Extract the devicetree blob from the fdtmap · line 5602
Quoted 8 lines
tools/binman/ftest.py +5
-0@@ -5598,6 +5598,72 @@ fdt fdtmap Extract the devicetree blob from the fdtmap + self.assertEqual(U_BOOT_DATA, data[0x800:0x800 + len(U_BOOT_DATA)]) + 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)])Last assertion duplicates the first - please drop it.
Apologies, this was junk I didn't properly catch in the zillionth rebasing session. It was already cleaned up in a subsequent commit. v3 will clean it up properly.
Quoted 12 lines
tools/binman/ftest.py fdt fdtmap Extract the devicetree blob from the fdtmap · line 5600
Quoted 6 lines
tools/binman/ftest.py +3
-0@@ -5598,6 +5598,72 @@ fdt fdtmap Extract the devicetree blob from the fdtmap + def testAndroidBootV0(self): + """Test that binman can produce a plain legacy Android boot image""" + data = self._DoReadFile('vendor/android_boot_v0.dts')Missing coverage for several error paths - U haven't run this but there is
Raise()for unsupportedheader_version, non-power-of-two page-size, etc. Binman aims for full branch coverage - please add tests for these, and verify 'binman test -T' still shows 100% coverage for your etype
Quoted 2 lines
As discussed in IRC, I agree this is very reasonable... I didn't appreciate just how far the proposed code was from that 100% goal, though ;)
Indeed...in particularly we are not used to adding tests for failure cases and it can be a bit tedious. It does make you think though, whether an error is needed, whether a condition should be removed, etc. Also it becomes very hard for future changes to break your etype.
Quoted 49 lines
v3 introduces a much more comprehensive suite that hits 100% coverage.
Quoted 10 lines
tools/binman/test/vendor/android_boot_v2.dts line 4
Quoted 7 lines
tools/binman/test/vendor/android_boot_v2.dts +4
-0@@ -0,0 +1,46 @@ + kernel-offset = <0x00008000>; + ramdisk-offset = <0x01000000>; + second-offset = <0x00f00000>; + tags-offset = <0x00000100>;'second-offset' is silently ignored - the etype doesn't parse it and the commit message says 'second' support is dropped. Do you need it?
Nope, another vestige of a previous iteration that I didn't clean up properly in the rebasing, sorry about that! Removed in v3.
Quoted 11 lines
tools/binman/test/vendor/android_boot_v0.dts line 3
Quoted 6 lines
tools/binman/test/vendor/android_boot_v0.dts +3
-0@@ -0,0 +1,29 @@ +// SPDX-License-Identifier: GPL-2.0+ + +/dts-v1/;Why a new 'vendor/' subdirectory? The contents here are plain Android boot images, not anything vendor-specific. I'd suggest 'android/' (or leaving them in test/ alongside other etype .dts files), which also leaves a clearer naming pattern for QCDT/DTBH later.
Fair call - I've yanked everything up to the top level in v3.
Quoted 9 lines
Quoted 7 lines
tools/binman/etype/android_boot.py +4
-0@@ -0,0 +1,313 @@ + Example:: + A v2 abootimg with control FDT placed in the DTB section: + + android-boot {...
Quoted 8 lines
tools/binman/etype/android_boot.py line 89
Quoted 3 lines
tools/binman/etype/android_boot.py +3
-0+ 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 {These render as one big code block in the auto-generated docs, with the v0 description folded into the literal. Please split into two 'Example::' blocks, with a blank line between the v0 prose and its 'android-boot {'.
Quoted 8 lines
Ack, fixed in v3.
Quoted 4 lines
Regards,
SimonThanks for the thorough review Simon, much appreciated.
You're welcome.
Regards,
Simon
PATCH v2 2/8 .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
Re: [PATCH v2 2/8] .gitignore: ignore binman-generated blobs
Hi Sam,
Quoted 12 lines · On 2026-06-07T23:37:09, Sam Day via B4 Relay…
.gitignore: ignore binman-generated blobs
The new
android_bootetype is causing these /comp*u-boot-nodtb artifacts to be generated, which aren't currently picked up by any ignore rules.Signed-off-by Sam Day <[email protected]>.gitignore | 1 +
1 file changed, 1 insertion(+)
.gitignore fit-dtb.blob* · line 87
Quoted 4 lines
.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
Hmmm yes binman drops intermediate files into the build dir...it would be nice to have it write these into a subdirectory. One day we should try to use a subdir instead, cleaning it up at the end. This is a completely separate issue though.
Also worth mentioning in the commit message that this only affects in-tree builds. BTW I almost never do in-tree builds.
Regards,
Simon
Simon Glass
Reviewed-byRe: [PATCH v2 2/8] .gitignore: ignore binman-generated blobs
Quoted 27 lines · Simon Glass
Hi Sam,
Quoted 12 lines · On 2026-06-07T23:37:09, Sam Day via B4 Relay…
.gitignore: ignore binman-generated blobs
The new
android_bootetype is causing these /comp*u-boot-nodtb artifacts to be generated, which aren't currently picked up by any ignore rules.Signed-off-by Sam Day <[email protected]>.gitignore | 1 +
1 file changed, 1 insertion(+).gitignore fit-dtb.blob* · line 87
Quoted 4 lines
.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-nodtbHmmm yes binman drops intermediate files into the build dir...it would be nice to have it write these into a subdirectory. One day we should try to use a subdir instead, cleaning it up at the end. This is a completely separate issue though.
Quoted 2 lines
Also worth mentioning in the commit message that this only affects in-tree builds. BTW I almost never do in-tree builds.
PATCH v2 3/8 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 | 37 ++++++++++++++++++++-- tools/binman/ftest.py | 11 ++++++- .../binman/test/vendor/android_boot_vendor_dt.dts | 27 ++++++++++++++++ 3 files changed, 72 insertions(+), 3 deletions(-)
tools/binman/etype/android_boot.py +35 -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
@@ -57,6 +60,7 @@ class Entry_android_boot(Entry_section): - 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 +121,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 +136,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 +166,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:
@@ -219,11 +242,18 @@ class Entry_android_boot(Entry_section): return data + 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
@@ -234,6 +264,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,
@@ -246,7 +278,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,
@@ -256,6 +288,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
Re: [PATCH v2 3/8] binman: android_boot: vendor-dt support
Hi Sam,
Quoted 24 lines · On 2026-06-07T23:37:09, Sam Day via B4 Relay…
binman:
android_boot: vendor-dt supportThere'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_versionfield 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.
Signed-off-by Sam Day <[email protected]>
tools/binman/etype/android_boot.py| 37 ++++++++++++++++++++--tools/binman/ftest.py | 11 ++++++- .../binman/test/vendor/android_boot_vendor_dt.dts | 27 ++++++++++++++++ 3 files changed, 72 insertions(+), 3 deletions(-)
tools/binman/etype/android_boot.py class Entry_android_boot(Entry_section): · line 140
Quoted 5 lines
tools/binman/etype/android_boot.py +2
-0@@ -131,17 +136,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")
Two things. The message uses the Python attribute name; users see the DT property, so this should read 'os-version'. Second, the commit message doesn't explain why os-version becomes invalid in this mode - in the v0 header layout, dt_size (the field we hijack) and os_version are separate u32 fields, so there's no obvious conflict.
If a downstream bootloader interprets os_version differently when dt_size is set, please document that - otherwise I'd drop the restriction. Either way, please add a test for the Raise().
tools/binman/etype/android_boot.py class Entry_android_boot(Entry_section): · line 176
Quoted 13 lines
tools/binman/etype/android_boot.py +8
-0@@ -152,6 +166,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
Forcing etype='section' here works only because qcdt/dtbh later walks up via getattr(self.section, 'page_size', 2048). That coupling is invisible from this file. Please add a comment noting this attribute is consumed by child etypes (qcdt/dtbh in later patches) - otherwise it looks like dead code. A cleaner alternative would be for the child etype to look up the android-boot ancestor directly, so page-size doesn't need to be smuggled through an unrelated attribute.
Also 'page-size' is re-read from self._node here, but ReadNode() has already cached it in self.page_size. Just use that.
tools/binman/etype/android_boot.py class Entry_android_boot(Entry_section): · line 281
Quoted 7 lines
tools/binman/etype/android_boot.py +1
-1@@ -246,7 +278,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),
This conflates two distinct fields. For a plain v0 image the slot is header_version; for a vendor-dt image it's dt_size. The current code only produces the right bytes because both collapse to 0 when there is no vendor-dt. Please make it explicit:
dt_size = len(vendor_dt) if self.vendor_dt_node else self.header_version
and add a comment that this slot is overloaded. As written, anyone adding a new v0 header_version in future will silently break vendor-dt builds.
tools/binman/ftest.py fdt fdtmap Extract the devicetree blob from the fdtmap · line 5665
Quoted 7 lines
tools/binman/ftest.py +1
-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):
You're silently dropping a duplicated assertion left over from patch 1/8. That cleanup belongs in its own patch (or a fixup to 1/8), not buried in the vendor-dt commit.
tools/binman/ftest.py fdt fdtmap Extract the devicetree blob from the fdtmap · line 5671
Quoted 12 lines
tools/binman/ftest.py +10
-0@@ -5662,7 +5662,16 @@ fdt fdtmap Extract the devicetree blob from the fdtmap + 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])
Coverage is thin. Please add tests for the two new Raise() paths ('vendor-dt' on v2, os-version with vendor-dt), and assert that vendor_dt is padded to page-size - slicing [0x1800:0x1805] only proves the first five bytes landed, not that the next 0x7fb bytes are zero or that the overall image length is right.
Regards,
Simon
Re: [PATCH v2 3/8] binman: android_boot: vendor-dt support
'Ello Simon,
Quoted 26 lines · Simon Glass
Hi Sam,
Quoted 21 lines · On 2026-06-07T23:37:09, Sam Day via B4 Relay…
binman:
android_boot: vendor-dt supportThere'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_versionfield 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.
Signed-off-by Sam Day <[email protected]>
tools/binman/etype/android_boot.py| 37 ++++++++++++++++++++--tools/binman/ftest.py | 11 ++++++- .../binman/test/vendor/android_boot_vendor_dt.dts | 27 ++++++++++++++++ 3 files changed, 72 insertions(+), 3 deletions(-)
Quoted 13 lines
tools/binman/etype/android_boot.py class Entry_android_boot(Entry_section): · line 140
Quoted 7 lines
tools/binman/etype/android_boot.py +2
-0@@ -131,17 +136,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")Two things. The message uses the Python attribute name; users see the DT property, so this should read 'os-version'. Second, the commit message doesn't explain why os-version becomes invalid in this mode - in the v0 header layout,
dt_size(the field we hijack) andos_versionare separate u32 fields, so there's no obvious conflict.
Good point. I double checked and there's no need to add / enforce this invariant. I simply added it purely out of paranoia, since it's right next to the header_version and possibly some bootloader somewhere interprets the "vendor DT" size as 64 bit. But then again, probably not ;)
Quoted 4 lines
If a downstream bootloader interprets
os_versiondifferently whendt_sizeis set, please document that - otherwise I'd drop the restriction. Either way, please add a test for theRaise().
mkbootimg-osm0sis doesn't enforce it, at any rate. So I've removed the check from v3.
Quoted 23 lines
Quoted 4 lines
tools/binman/etype/android_boot.py +0
-0@@ -152,6 +166,15 @@ class Entry_android_boot(Entry_section): entry.SetPrefix(self._name_prefix)tools/binman/etype/android_boot.py class Entry_android_boot(Entry_section): · line 176
Quoted 10 lines
tools/binman/etype/android_boot.py +8
-0self._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] = entryForcing etype='section' here works only because qcdt/dtbh later walks up via
getattr(self.section, 'page_size', 2048). That coupling is invisible from this file. Please add a comment noting this attribute is consumed by child etypes (qcdt/dtbh in later patches) - otherwise it looks like dead code. A cleaner alternative would be for the child etype to look up the android-boot ancestor directly, so page-size doesn't need to be smuggled through an unrelated attribute.
Quoted 2 lines
Also 'page-size' is re-read from self._node here, but
ReadNode()has already cached it in self.page_size. Just use that.
I opted for the cleaner alternative you proposed. In v3 the qcdt/dtbh etypes traverse their ancestors to find an explicit page-size, falling back to the local prop, or 2048 otherwise.
Quoted 14 lines
tools/binman/etype/android_boot.py class Entry_android_boot(Entry_section): · line 281
Quoted 8 lines
tools/binman/etype/android_boot.py +1
-1@@ -246,7 +278,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),This conflates two distinct fields. For a plain v0 image the slot is
header_version; for a vendor-dt image it'sdt_size. The current code only produces the right bytes because both collapse to 0 when there is no vendor-dt. Please make it explicit:
Quoted 2 lines
dt_size=len(vendor_dt)if self.vendor_dt_node else self.header_version
I did actually code-golf it that way, but I agree it's too clever ;) (And by clever I mean obnoxiously obtuse)
I've introduced an explicit overloaded_header_version in v3, and included a comment about this special/weird behaviour.
Quoted 3 lines
and add a comment that this slot is overloaded. As written, anyone adding a new v0
header_versionin future will silently break vendor-dt builds.
Not sure I follow this part. _BuildV0SectionData is only ever called when self.header_version == 0.
Quoted 6 lines
Quoted 6 lines
tools/binman/ftest.py +0
-0@@ -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)])
Quoted 6 lines
tools/binman/ftest.py fdt fdtmap Extract the devicetree blob from the fdtmap · line 5665
Quoted 2 lines
tools/binman/ftest.py +1
-1- self.assertEqual(U_BOOT_DATA, data[0x800:0x800 + len(U_BOOT_DATA)]) + def testAndroidBootVendorDt(self):You're silently dropping a duplicated assertion left over from patch 1/8. That cleanup belongs in its own patch (or a fixup to 1/8), not buried in the vendor-dt commit.
Aye, oops. That's cleaned up properly in v3.
Quoted 11 lines
Quoted 11 lines
tools/binman/ftest.py +8
-0@@ -5662,7 +5662,16 @@ fdt fdtmap Extract the devicetree blob from the fdtmap + 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'',
Quoted 8 lines
tools/binman/ftest.py fdt fdtmap Extract the devicetree blob from the fdtmap · line 5674
Quoted 2 lines
tools/binman/ftest.py +2
-0+ vendor_dt), header[13]) + self.assertEqual(vendor_dt, data[0x1800:0x1805])Coverage is thin. Please add tests for the two new
Raise()paths ('vendor-dt' on v2, os-version with vendor-dt), and assert thatvendor_dtis padded to page-size - slicing [0x1800:0x1805] only proves the first five bytes landed, not that the next0x7fbbytes are zero or that the overall image length is right.
Ack - v3 will have 100% test coverage for all 3 newly introduced etypes.
Again, thanks for the very comprehensive review!
Kind regards,
-Sam
Quoted 4 lines
Regards,
Simon
PATCH v2 4/8 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
@@ -107,6 +107,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
Re: [PATCH v2 4/8] binman: Add QCDT support
Hi Sam,
Quoted 12 lines · On 2026-06-07T23:37:09, Sam Day via B4 Relay…
binman: Add QCDT support
This 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.
Quoted 8 lines
Signed-off-by Sam Day <[email protected]>
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(+)
Your comment says "A legacy QCDT abootimg, the kind msm8916 bootloaders expect"
Please can you spell out the acronym...I would also prefer qcom_xxx for the etype name where xxx is whatever this means, since presumably this is Qualcomm-specific.
tools/binman/etype/qcdt.py line 3
Quoted 5 lines
tools/binman/etype/qcdt.py +3
-0@@ -0,0 +1,160 @@ +from binman.entry import Entry +from binman.etype.section import Entry_section +from dtoc import fdt_util
The _align_up()/_pad() helpers at the top are duplicated from android_boot.py in patch 1, and will be again in dtbh.py in patch 6. Please factor them into a shared helper module (or stick them on Entry_section).
tools/binman/etype/qcdt.py line 9
Quoted 11 lines
tools/binman/etype/qcdt.py +9
-0@@ -0,0 +1,160 @@ + def ReadEntries(self): + for node in self._node.subnodes: + if self.IsSpecialSubnode(node): + continue + + payloads = self._GetPayloadSubnodes(node) + if len(payloads) > 1: + raise ValueError("Node '%s': must contain exactly one DTB " + "payload subnode" % node.path)
Please use self.Raise() throughout - that's the binman convention and it adds the node path for you. The static/classmethod helpers should become plain methods so they can use self.Raise() too.
Quoted 6 lines
tools/binman/etype/qcdt.py +4
-0@@ -0,0 +1,160 @@ + dtb_offset = _align_up(12 + len(dtbs) * 24, page_size) + records = [] + payloads = bytearray() + for msm_id, board_id, dtb in dtbs:
tools/binman/etype/qcdt.py line 14
Quoted 10 lines
tools/binman/etype/qcdt.py +10
-0+ dtb_size = _align_up(len(dtb), page_size) + records.append((*msm_id, *board_id, dtb_offset, dtb_size)) + payloads += _pad(dtb, page_size) + dtb_offset += dtb_size + + qcdt = bytearray(struct.pack('<4sII', QCDT_MAGIC, QCDT_VERSION, + len(records))) + for platform_id, soc_rev, variant_id, subtype, offset, size in records: + qcdt += struct.pack('<IIIIII', platform_id, variant_id, subtype, + soc_rev, offset, size)
The 12 and 24 magic numbers should be struct.calcsize() of named header/record format strings, the way android_boot.py does for BOOT_IMAGE_HEADER_V0_SIZE. That also documents the layout.
Also, unpacking msm-id as (platform_id, soc_rev) and board-id as (variant_id, subtype), then packing in the swapped order (platform_id, variant_id, subtype, soc_rev) is hard to read. Please build each record directly with the on-disk field order and add a comment referencing the LK/AOSP source for the QCDT v2 record layout.
tools/binman/etype/qcdt.py line 4
Quoted 6 lines
tools/binman/etype/qcdt.py +4
-0@@ -0,0 +1,160 @@ + def BuildSectionData(self, required): + if not self._node.subnodes: + raise ValueError("Node '%s': Missing required DTB subnodes" % + self._node.path)
Redundant with the 'if not dtbs:' check further down (which correctly handles the case where the only subnodes are special). Please drop it.
tools/binman/etype/qcdt.py line 5
Quoted 7 lines
tools/binman/etype/qcdt.py +5
-0@@ -0,0 +1,160 @@ + def _GetPageSize(self): + if self._page_size is not None: + return self._page_size + + return getattr(self.section, 'page_size', 2048)
The docstring says "defaults to the parent android-boot page size", but in practice this picks it up from the vendor-dt section that _ReadVendorDtEntries() stamps with a page_size attribute. Please update the docstring - or better, but really you should look up the enclosing android-boot section directly rather than relying on an attribute being monkey-patched onto an intermediate generic section.
tools/binman/ftest.py fdt fdtmap Extract the devicetree blob from the fdtmap · line 5676
Quoted 6 lines
tools/binman/ftest.py +4
-0@@ -5673,6 +5673,28 @@ fdt fdtmap Extract the devicetree blob from the fdtmap + 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)
Only one record is covered. Since the whole point of QCDT is to hold multiple DTBs picked by msm-id/board-id, please add a test with at least two dtb-* records so the offset/size table-walking code is actually exercised.
tools/binman/ftest.py fdt fdtmap Extract the devicetree blob from the fdtmap · line 5681
Quoted 5 lines
tools/binman/ftest.py +5
-0+ binman: Add QCDT support + + 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.
How abouta Link: to the LK/AOSP reference for the QCDT v2 record format?
Regards,
Simon
Re: [PATCH v2 4/8] binman: Add QCDT support
Greetings Simon,
Quoted 25 lines · Simon Glass
Hi Sam,
Quoted 12 lines · On 2026-06-07T23:37:09, Sam Day via B4 Relay…
binman: Add QCDT support
This 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.
Quoted 8 lines
Signed-off-by Sam Day <[email protected]>
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(+)
Quoted 3 lines
Your comment says "A legacy QCDT abootimg, the kind msm8916 bootloaders expect"
Please can you spell out the acronym...
I'd love to, but I think nobody can actually do that. There's not really any canonical impl or reference point for this stuff. I believe the reason everyone calls it "QCDT" is because that's the magic identifier in the header.
Maybe it means "QualComm Device(tree) Table"? Or perhaps it means "Qualcomm/CodeAurora Device Trees"? We may never truly know :)
Quoted 3 lines
I would also prefer
qcom_xxx
for the etype name where xxx is whatever this means, since presumably this is Qualcomm-specific.
Given the acronym doesn't have a canonical definition, and the limited references to it use the "QCDT" moniker directly, I opted to keep it as-is for v3, since qcom_cdt is confusing and would be a unique reference that exists only in U-Boot. Or would you prefer qcom_qcdt?
Quoted 11 lines
tools/binman/etype/qcdt.py line 3
Quoted 6 lines
tools/binman/etype/qcdt.py +3
-0@@ -0,0 +1,160 @@ +from binman.entry import Entry +from binman.etype.section import Entry_section +from dtoc import fdt_utilThe _align_up()/_pad() helpers at the top are duplicated from
android_boot.pyin patch 1, and will be again indtbh.pyin patch 6. Please factor them into a shared helper module (or stick them onEntry_section).
I opted for the latter. v3 introduces a new patch to put these shared helpers in Entry_section.
Quoted 16 lines
tools/binman/etype/qcdt.py line 9
Quoted 12 lines
tools/binman/etype/qcdt.py +9
-0@@ -0,0 +1,160 @@ + def ReadEntries(self): + for node in self._node.subnodes: + if self.IsSpecialSubnode(node): + continue + + payloads = self._GetPayloadSubnodes(node) + if len(payloads) > 1: + raise ValueError("Node '%s': must contain exactly one DTB " + "payload subnode" % node.path)Please use
self.Raise()throughout - that's the binman convention and it adds the node path for you. The static/classmethod helpers should become plain methods so they can useself.Raise()too.
Ack, done in v3.
Quoted 13 lines
Quoted 13 lines
tools/binman/etype/qcdt.py +10
-0@@ -0,0 +1,160 @@ + dtb_offset = _align_up(12 + len(dtbs) * 24, page_size) + records = [] + payloads = bytearray() + for msm_id, board_id, dtb in dtbs: + dtb_size = _align_up(len(dtb), page_size) + records.append((*msm_id, *board_id, dtb_offset, dtb_size)) + payloads += _pad(dtb, page_size) + dtb_offset += dtb_size + + qcdt = bytearray(struct.pack('<4sII', QCDT_MAGIC, QCDT_VERSION,
Quoted 8 lines
tools/binman/etype/qcdt.py line 158
Quoted 4 lines
tools/binman/etype/qcdt.py +4
-0+ len(records))) + for platform_id, soc_rev, variant_id, subtype, offset, size in records: + qcdt += struct.pack('<IIIIII', platform_id, variant_id, subtype, + soc_rev, offset, size)The 12 and 24 magic numbers should be
struct.calcsize()of named header/record format strings, the wayandroid_boot.pydoes forBOOT_IMAGE_HEADER_V0_SIZE. That also documents the layout.
Hm yeah, I got lazy here. v3 removes the magic values and formalizes the format/size calculations like android_boot does.
Quoted 6 lines
Also, unpacking msm-id as (
platform_id,soc_rev) and board-id as (variant_id, subtype), then packing in the swapped order (platform_id,variant_id, subtype,soc_rev) is hard to read. Please build each record directly with the on-disk field order and add a comment referencing the LK/AOSP source for the QCDT v2 record layout.
Ack - this isn't very readable, I agree. Overhauled in v3.
Quoted 10 lines
tools/binman/etype/qcdt.py line 4
Quoted 7 lines
tools/binman/etype/qcdt.py +4
-0@@ -0,0 +1,160 @@ + def BuildSectionData(self, required): + if not self._node.subnodes: + raise ValueError("Node '%s': Missing required DTB subnodes" % + self._node.path)Redundant with the 'if not dtbs:' check further down (which correctly handles the case where the only subnodes are special). Please drop it.
Ack. v3 refactors this heavily and the redundant check is gone.
Quoted 15 lines
tools/binman/etype/qcdt.py line 5
Quoted 8 lines
tools/binman/etype/qcdt.py +5
-0@@ -0,0 +1,160 @@ + def _GetPageSize(self): + if self._page_size is not None: + return self._page_size + + return getattr(self.section, 'page_size', 2048)The docstring says "defaults to the parent android-boot page size", but in practice this picks it up from the vendor-dt section that
_ReadVendorDtEntries()stamps with apage_sizeattribute. Please update the docstring - or better, but really you should look up the enclosing android-boot section directly rather than relying on an attribute being monkey-patched onto an intermediate generic section.
Indeed. v3 refactors this heavily to introduce a shared base class, which prefers a locally set page-size, falling back to traversing the ancestry to find an android-boot preference (and finally falling back to 2048).
Quoted 12 lines
tools/binman/ftest.py fdt fdtmap Extract the devicetree blob from the fdtmap · line 5676
Quoted 7 lines
tools/binman/ftest.py +4
-0@@ -5673,6 +5673,28 @@ fdt fdtmap Extract the devicetree blob from the fdtmap + 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)Only one record is covered. Since the whole point of QCDT is to hold multiple DTBs picked by msm-id/board-id, please add a test with at least two dtb-* records so the offset/size table-walking code is actually exercised.
Agree. Done in v3.
Quoted 8 lines
tools/binman/ftest.py fdt fdtmap Extract the devicetree blob from the fdtmap · line 5681
Quoted 6 lines
tools/binman/ftest.py +5
-0+ binman: Add QCDT support + + 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.How abouta Link: to the LK/AOSP reference for the QCDT v2 record format?
Good idea, done in v3.
Thanks Simon,
-Sam
Quoted 4 lines
Regards,
Simon
Re: [PATCH v2 4/8] binman: Add QCDT support
Hi Sam,
Quoted 34 lines · Sam Day
Greetings Simon,
Quoted 25 lines · Simon Glass
Hi Sam,
Quoted 12 lines · On 2026-06-07T23:37:09, Sam Day via B4 Relay…
binman: Add QCDT support
This 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.
Quoted 8 lines
Signed-off-by Sam Day <[email protected]>
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(+)Quoted 3 lines
Your comment says "A legacy QCDT abootimg, the kind msm8916 bootloaders expect"
Please can you spell out the acronym...
Quoted 7 lines
I'd love to, but I think nobody can actually do that. There's not really any canonical impl or reference point for this stuff. I believe the reason everyone calls it "QCDT" is because that's the magic identifier in the header.
Maybe it means "QualComm Device(tree) Table"? Or perhaps it means "Qualcomm/CodeAurora Device Trees"? We may never truly know :)
Hilarious :-)
Quoted 9 lines
Quoted 4 lines
I would also prefer
qcom_xxx
for the etype name where xxx is whatever this means, since presumably this is Qualcomm-specific.Given the acronym doesn't have a canonical definition, and the limited references to it use the "QCDT" moniker directly, I opted to keep it as-is for v3, since
qcom_cdtis confusing and would be a unique reference that exists only in U-Boot. Or would you preferqcom_qcdt?
Let me look. Mostly it is about being unique...I quite like the idea of a qcom_ prefix but it isn't very important.
Quoted 124 lines
Quoted 12 lines
tools/binman/etype/qcdt.py line 3
Quoted 7 lines
tools/binman/etype/qcdt.py +3
-0@@ -0,0 +1,160 @@ +from binman.entry import Entry +from binman.etype.section import Entry_section +from dtoc import fdt_utilThe _align_up()/_pad() helpers at the top are duplicated from
android_boot.pyin patch 1, and will be again indtbh.pyin patch 6. Please factor them into a shared helper module (or stick them onEntry_section).I opted for the latter. v3 introduces a new patch to put these shared helpers in
Entry_section.Quoted 16 lines
tools/binman/etype/qcdt.py line 9
Quoted 12 lines
tools/binman/etype/qcdt.py +9
-0@@ -0,0 +1,160 @@ + def ReadEntries(self): + for node in self._node.subnodes: + if self.IsSpecialSubnode(node): + continue + + payloads = self._GetPayloadSubnodes(node) + if len(payloads) > 1: + raise ValueError("Node '%s': must contain exactly one DTB " + "payload subnode" % node.path)Please use
self.Raise()throughout - that's the binman convention and it adds the node path for you. The static/classmethod helpers should become plain methods so they can useself.Raise()too.Ack, done in v3.
Quoted 13 lines
Quoted 13 lines
tools/binman/etype/qcdt.py +10
-0@@ -0,0 +1,160 @@ + dtb_offset = _align_up(12 + len(dtbs) * 24, page_size) + records = [] + payloads = bytearray() + for msm_id, board_id, dtb in dtbs: + dtb_size = _align_up(len(dtb), page_size) + records.append((*msm_id, *board_id, dtb_offset, dtb_size)) + payloads += _pad(dtb, page_size) + dtb_offset += dtb_size + + qcdt = bytearray(struct.pack('<4sII', QCDT_MAGIC, QCDT_VERSION,Quoted 8 lines
tools/binman/etype/qcdt.py line 158
Quoted 4 lines
tools/binman/etype/qcdt.py +4
-0+ len(records))) + for platform_id, soc_rev, variant_id, subtype, offset, size in records: + qcdt += struct.pack('<IIIIII', platform_id, variant_id, subtype, + soc_rev, offset, size)The 12 and 24 magic numbers should be
struct.calcsize()of named header/record format strings, the wayandroid_boot.pydoes forBOOT_IMAGE_HEADER_V0_SIZE. That also documents the layout.Hm yeah, I got lazy here. v3 removes the magic values and formalizes the format/size calculations like
android_bootdoes.Quoted 6 lines
Also, unpacking msm-id as (
platform_id,soc_rev) and board-id as (variant_id, subtype), then packing in the swapped order (platform_id,variant_id, subtype,soc_rev) is hard to read. Please build each record directly with the on-disk field order and add a comment referencing the LK/AOSP source for the QCDT v2 record layout.Ack - this isn't very readable, I agree. Overhauled in v3.
Quoted 10 lines
tools/binman/etype/qcdt.py line 4
Quoted 7 lines
tools/binman/etype/qcdt.py +4
-0@@ -0,0 +1,160 @@ + def BuildSectionData(self, required): + if not self._node.subnodes: + raise ValueError("Node '%s': Missing required DTB subnodes" % + self._node.path)Redundant with the 'if not dtbs:' check further down (which correctly handles the case where the only subnodes are special). Please drop it.
Ack. v3 refactors this heavily and the redundant check is gone.
Quoted 15 lines
tools/binman/etype/qcdt.py line 5
Quoted 8 lines
tools/binman/etype/qcdt.py +5
-0@@ -0,0 +1,160 @@ + def _GetPageSize(self): + if self._page_size is not None: + return self._page_size + + return getattr(self.section, 'page_size', 2048)The docstring says "defaults to the parent android-boot page size", but in practice this picks it up from the vendor-dt section that
_ReadVendorDtEntries()stamps with apage_sizeattribute. Please update the docstring - or better, but really you should look up the enclosing android-boot section directly rather than relying on an attribute being monkey-patched onto an intermediate generic section.Indeed. v3 refactors this heavily to introduce a shared base class, which prefers a locally set page-size, falling back to traversing the ancestry to find an android-boot preference (and finally falling back to 2048).
Quoted 12 lines
tools/binman/ftest.py fdt fdtmap Extract the devicetree blob from the fdtmap · line 5676
Quoted 7 lines
tools/binman/ftest.py +4
-0@@ -5673,6 +5673,28 @@ fdt fdtmap Extract the devicetree blob from the fdtmap + 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)Only one record is covered. Since the whole point of QCDT is to hold multiple DTBs picked by msm-id/board-id, please add a test with at least two dtb-* records so the offset/size table-walking code is actually exercised.
Agree. Done in v3.
Quoted 7 lines
Quoted 6 lines
tools/binman/ftest.py +5
-0+ binman: Add QCDT support + + 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.
Quoted 4 lines
Quoted 1 line
How abouta Link: to the LK/AOSP reference for the QCDT v2 record format?
Good idea, done in v3.
Regards,
Simon
PATCH v2 5/8 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)
@@ -55,6 +57,7 @@ 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 + - append-seandroid-enforce: Append Samsung SEANDROIDENFORCE trailer, This entry uses the following subnodes: - kernel: section containing the executable payload
@@ -112,6 +115,7 @@ class Entry_android_boot(Entry_section): android-boot { base = <0x80000000>; + append-seandroid-enforce; kernel { u-boot {
@@ -151,6 +155,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):
@@ -174,6 +180,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")
@@ -319,6 +328,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
Re: [PATCH v2 5/8] binman: android_boot: SEANDROIDENFORCE support
Hi Sam,
Quoted 14 lines · On 2026-06-07T23:37:09, Sam Day via B4 Relay…
binman:
android_boot: SEANDROIDENFORCE supportSome older MSM8916-era bootloaders want to see this string appended to the abootimg, or they log an ugly warning to the screen.
Signed-off-by Sam Day <[email protected]>
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 class Entry_android_boot(Entry_section): · line 60
Quoted 4 lines
tools/binman/etype/android_boot.py +1
-0@@ -55,6 +57,7 @@ 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 + - append-seandroid-enforce: Append Samsung SEANDROIDENFORCE trailer,
Calling this 'Samsung' is misleading given the commit message attributes it to MSM8916-era bootloaders - perhaps 'Append the SEANDROIDENFORCE trailer expected by some MSM8916/Samsung bootloaders'.
tools/binman/etype/android_boot.py class Entry_android_boot(Entry_section): · line 185
Quoted 8 lines
tools/binman/etype/android_boot.py +3
-0@@ -174,6 +180,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")
Just to check, is this a hard restriction of the format, or only a reflection of which bootloaders are known to want this trailer? If v2 images can legitimately carry it too, it would be more flexible to allow it. If it really is invalid, please add a short note in the commit message saying why.
tools/binman/ftest.py fdt fdtmap Extract the devicetree blob from the fdtmap · line 5677
Quoted 7 lines
tools/binman/ftest.py +5
-0@@ -5673,6 +5673,12 @@ fdt fdtmap Extract the devicetree blob from the fdtmap + def testAndroidBootSeAndroidEnforce(self): + """Test that binman appends SEANDROIDENFORCE""" + data = self._DoReadFile('vendor/android_boot_seandroidenforce.dts') + + self.assertEqual(b'SEANDROIDENFORCE', data[-16:])
Please add a negative test for the v2 + append-seandroid-enforce combination, to lock in the Raise(). It would also be worth asserting the rest of the image (header, kernel page, ramdisk page) is intact, so a regression that truncates the body but leaves the trailer in place would still be caught.
Regards,
Simon
Re: [PATCH v2 5/8] binman: android_boot: SEANDROIDENFORCE support
Ahoy Simon,
Quoted 43 lines · Simon Glass
Hi Sam,
Quoted 14 lines · On 2026-06-07T23:37:09, Sam Day via B4 Relay…
binman:
android_boot: SEANDROIDENFORCE supportSome older MSM8916-era bootloaders want to see this string appended to the abootimg, or they log an ugly warning to the screen.
Signed-off-by Sam Day <[email protected]>
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 class Entry_android_boot(Entry_section): · line 60
Quoted 4 lines
tools/binman/etype/android_boot.py +1
-0@@ -55,6 +57,7 @@ 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 + - append-seandroid-enforce: Append Samsung SEANDROIDENFORCE trailer,Calling this 'Samsung' is misleading given the commit message attributes it to MSM8916-era bootloaders - perhaps 'Append the SEANDROIDENFORCE trailer expected by some MSM8916/Samsung bootloaders'.
tools/binman/etype/android_boot.py class Entry_android_boot(Entry_section): · line 185
Quoted 8 lines
tools/binman/etype/android_boot.py +3
-0@@ -174,6 +180,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")Just to check, is this a hard restriction of the format, or only a reflection of which bootloaders are known to want this trailer? If v2 images can legitimately carry it too, it would be more flexible to allow it. If it really is invalid, please add a short note in the commit message saying why.
Quoted 13 lines
tools/binman/ftest.py fdt fdtmap Extract the devicetree blob from the fdtmap · line 5677
Quoted 7 lines
tools/binman/ftest.py +5
-0@@ -5673,6 +5673,12 @@ fdt fdtmap Extract the devicetree blob from the fdtmap + def testAndroidBootSeAndroidEnforce(self): + """Test that binman appends SEANDROIDENFORCE""" + data = self._DoReadFile('vendor/android_boot_seandroidenforce.dts') + + self.assertEqual(b'SEANDROIDENFORCE', data[-16:])Please add a negative test for the v2 + append-seandroid-enforce combination, to lock in the
Raise(). It would also be worth asserting the rest of the image (header, kernel page, ramdisk page) is intact, so a regression that truncates the body but leaves the trailer in place would still be caught.
I've since realized that this entire patch is unnecessary, and I've dropped it from v3. Rather than codifying this, we can just take advantage of the flexibility binman already offers through the section etype, in conjunction with the text etype:
binman {
android_boot { ... };
text { text = "SEANDROIDENFORCE"; };
};
Quite awesome, really :)
Thanks,
-Sam
Quoted 4 lines
Regards,
Simon
Re: [PATCH v2 5/8] binman: android_boot: SEANDROIDENFORCE support
Hi Sam,
Quoted 67 lines · Sam Day
Ahoy Simon,
Quoted 43 lines · Simon Glass
Hi Sam,
Quoted 14 lines · On 2026-06-07T23:37:09, Sam Day via B4 Relay…
binman:
android_boot: SEANDROIDENFORCE supportSome older MSM8916-era bootloaders want to see this string appended to the abootimg, or they log an ugly warning to the screen.
Signed-off-by Sam Day <[email protected]>
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 class Entry_android_boot(Entry_section): · line 60
Quoted 4 lines
tools/binman/etype/android_boot.py +1
-0@@ -55,6 +57,7 @@ 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 + - append-seandroid-enforce: Append Samsung SEANDROIDENFORCE trailer,Calling this 'Samsung' is misleading given the commit message attributes it to MSM8916-era bootloaders - perhaps 'Append the SEANDROIDENFORCE trailer expected by some MSM8916/Samsung bootloaders'.
tools/binman/etype/android_boot.py class Entry_android_boot(Entry_section): · line 185
Quoted 8 lines
tools/binman/etype/android_boot.py +3
-0@@ -174,6 +180,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")Just to check, is this a hard restriction of the format, or only a reflection of which bootloaders are known to want this trailer? If v2 images can legitimately carry it too, it would be more flexible to allow it. If it really is invalid, please add a short note in the commit message saying why.
Quoted 13 lines
tools/binman/ftest.py fdt fdtmap Extract the devicetree blob from the fdtmap · line 5677
Quoted 7 lines
tools/binman/ftest.py +5
-0@@ -5673,6 +5673,12 @@ fdt fdtmap Extract the devicetree blob from the fdtmap + def testAndroidBootSeAndroidEnforce(self): + """Test that binman appends SEANDROIDENFORCE""" + data = self._DoReadFile('vendor/android_boot_seandroidenforce.dts') + + self.assertEqual(b'SEANDROIDENFORCE', data[-16:])Please add a negative test for the v2 + append-seandroid-enforce combination, to lock in the
Raise(). It would also be worth asserting the rest of the image (header, kernel page, ramdisk page) is intact, so a regression that truncates the body but leaves the trailer in place would still be caught.I've since realized that this entire patch is unnecessary, and I've dropped it from v3. Rather than codifying this, we can just take advantage of the flexibility binman already offers through the section etype, in conjunction with the text etype:
Quoted 6 lines
binman {
android_boot{ ... };
text { text = "SEANDROIDENFORCE"; };
};Quite awesome, really :)
Ah, yes. Even so, if you want this as its own etype, you could subclass the text one with a default/fixed string string.
Regards,
Simon
PATCH v2 6/8 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 | 20 +++ 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(+)
tools/binman/etype/android_boot.py +20 -0
@@ -141,6 +141,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):
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
Re: [PATCH v2 6/8] binman: Add DTBH support
Hi Sam,
Quoted 25 lines · On 2026-06-07T23:37:09, Sam Day via B4 Relay…
binman: Add DTBH support
DTBH, 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.
Signed-off-by Sam Day <[email protected]>
tools/binman/etype/android_boot.py| 20 +++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(+)tools/binman/etype/dtbh.py new file +0
-0
tools/binman/etype/dtbh.py line 8
Quoted 8 lines
tools/binman/etype/dtbh.py new file +8
-0@@ -0,0 +1,173 @@ +# SPDX-License-Identifier: GPL-2.0+ +# Entry-type module for Samsung Android DTBH tables + +import struct + +from binman.entry import Entry +from binman.etype.section import Entry_section +from dtoc import fdt_util
A lot of duplication between this file and qcdt.py - _align_up(), _pad(), _DtbEntryName(), _GetPayloadSubnodes(), ReadEntries(), _GetPageSize(), _GetDtbData() are essentially identical. Perhaps you can factor the common bits into a helper or even a shared base class (something like Entry_vendor_dt_table), with the two etypes only carrying their format-specific bits.
tools/binman/etype/dtbh.py line 3
Quoted 5 lines
tools/binman/etype/dtbh.py +3
-0@@ -0,0 +1,173 @@ + def BuildSectionData(self, required): +... + header_size = _align_up(12 + len(dtbs) * 32 + 4, page_size)
What is the trailing '+ 4' for? Nothing gets written after the records, and the QCDT calculation uses just '12 + len(dtbs) * 24'. If it's meant to reserve a terminator cell, the code should emit it too; otherwise please drop it (or add a comment explaining the layout invariant from dtbTool-exynos).
tools/binman/etype/dtbh.py line 11
Quoted 13 lines
tools/binman/etype/dtbh.py +11
-0@@ -0,0 +1,173 @@ + @staticmethod + def _GetDtbRootU32(node, data, propname): + import libfdt + + try: + fdt = libfdt.Fdt(data) + root = fdt.path_offset('/') + prop = fdt.getprop(root, propname) + except libfdt.FdtException as exc: + raise ValueError("Node '%s': Missing required DTB root property " + ''%s'' % (node.path, propname)) from exc
Please move 'import libfdt' to module-level imports - that's the convention in binman. Also, catching FdtException to report 'Missing required DTB root property' will mis-report any other libfdt failure (e.g. a malformed FDT). Validate the FDT once up front and only wrap the getprop() call, so genuine parse failures surface with their real cause.
tools/binman/etype/dtbh.py line 5
Quoted 7 lines
tools/binman/etype/dtbh.py +5
-0@@ -0,0 +1,173 @@ +DTBH_MAGIC = b'DTBH' +DTBH_VERSION = 2 +DTBH_PLATFORM_CODE_DEF = 0x50a6 +DTBH_SUBTYPE_CODE_DEF = 0x217584da +DTBH_SPACE = 0x20
DTBH_SPACE is unexplained. Please add a comment describing what this field means in the DTBH record layout (and why 0x20 is the right constant), or make it a documented property like 'platform' and 'subtype' if it varies in the wild.
tools/binman/etype/android_boot.py class Entry_android_boot(Entry_section): · line 145
Quoted 7 lines
tools/binman/etype/android_boot.py +5
-0@@ -141,6 +141,26 @@ class Entry_android_boot(Entry_section): + A legacy DTBH abootimg, the kind some Samsung bootloaders expect: + + android-boot { + header-version = <0>; +...
The QCDT example added in patch 4 does not set header-version explicitly, while this one does. Please make them consistent.
tools/binman/test/vendor/dtbh.dts line 3
Quoted 5 lines
tools/binman/test/vendor/dtbh.dts +3
-0@@ -0,0 +1,29 @@ + model_info-chip = <7870>; + model_info-hw_rev = <6>; + model_info-hw_rev_end = <6>;
These properties end up at the root of the test DTB, which is what 'u-boot-dtb' embeds, so _GetDtbRootU32() picks them back out of the payload. That works but is subtle - a one-line comment at the top of the test DTS noting that the test relies on the binman test DTB being its own DTBH payload would save the next person a few minutes.
Quoted 4 lines
tools/binman/ftest.py +2
-0@@ -5701,6 +5701,30 @@ fdt fdtmap Extract the devicetree blob from the fdtmap + def testAndroidBootDtbh(self): + """Test that binman can produce a DTBH container"""
tools/binman/ftest.py fdt fdtmap Extract the devicetree blob from the fdtmap · line 5712
Quoted 10 lines
tools/binman/ftest.py +10
-0+ 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))
Please also add a test exercising non-default 'platform', 'subtype' and 'page-size', and one with more than one dtb-* subnode - at the moment only the single-record default-everything path is covered, which leaves the multi-record offset arithmetic untested.
Regards,
Simon
Re: [PATCH v2 6/8] binman: Add DTBH support
Greetings Simon,
Quoted 36 lines · Simon Glass
Hi Sam,
Quoted 32 lines · On 2026-06-07T23:37:09, Sam Day via B4 Relay…
binman: Add DTBH support
DTBH, 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.
Signed-off-by Sam Day <[email protected]>
tools/binman/etype/android_boot.py| 20 +++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(+)tools/binman/etype/dtbh.py new file +7
-0@@ -0,0 +1,173 @@ +# SPDX-License-Identifier: GPL-2.0+ +# Entry-type module for Samsung Android DTBH tables + +import struct + +from binman.entry import Entry +from binman.etype.section import Entry_section
Quoted 8 lines
tools/binman/etype/dtbh.py line 8
Quoted 1 line
tools/binman/etype/dtbh.py new file +1
-0+from dtoc import fdt_utilA lot of duplication between this file and
qcdt.py-_align_up(),_pad(),_DtbEntryName(),_GetPayloadSubnodes(),ReadEntries(),_GetPageSize(),_GetDtbData()are essentially identical. Perhaps you can factor the common bits into a helper or even a shared base class (something likeEntry_vendor_dt_table), with the two etypes only carrying their format-specific bits.
Affirmative. v3 introduces a Entry_Android_vendor_dt_table base class to reduce the duplication between QCDT and DTBH impls.
Quoted 12 lines
tools/binman/etype/dtbh.py line 3
Quoted 6 lines
tools/binman/etype/dtbh.py +3
-0@@ -0,0 +1,173 @@ + def BuildSectionData(self, required): +... + header_size = _align_up(12 + len(dtbs) * 32 + 4, page_size)What is the trailing '+ 4' for? Nothing gets written after the records, and the QCDT calculation uses just '12 + len(dtbs) * 24'. If it's meant to reserve a terminator cell, the code should emit it too; otherwise please drop it (or add a comment explaining the layout invariant from dtbTool-exynos).
dtbTool-exynos refers to it as an "end of table marker". v3 introduces named constants with comments to de-mystify this spooky behaviour.
Quoted 13 lines
Quoted 13 lines
tools/binman/etype/dtbh.py +10
-0@@ -0,0 +1,173 @@ + @staticmethod + def _GetDtbRootU32(node, data, propname): + import libfdt + + try: + fdt = libfdt.Fdt(data) + root = fdt.path_offset('/') + prop = fdt.getprop(root, propname) + except libfdt.FdtException as exc: + raise ValueError("Node '%s': Missing required DTB root property "
Quoted 8 lines
tools/binman/etype/dtbh.py line 11
Quoted 1 line
tools/binman/etype/dtbh.py +1
-0+ ''%s'' % (node.path, propname)) from excPlease move 'import libfdt' to module-level imports - that's the convention in binman. Also, catching FdtException to report 'Missing required DTB root property' will mis-report any other libfdt failure (e.g. a malformed FDT). Validate the FDT once up front and only wrap the
getprop()call, so genuine parse failures surface with their real cause.
Fair. Discussed further, below.
Quoted 13 lines
tools/binman/etype/dtbh.py line 5
Quoted 8 lines
tools/binman/etype/dtbh.py +5
-0@@ -0,0 +1,173 @@ +DTBH_MAGIC = b'DTBH' +DTBH_VERSION = 2 +DTBH_PLATFORM_CODE_DEF = 0x50a6 +DTBH_SUBTYPE_CODE_DEF = 0x217584da +DTBH_SPACE = 0x20
DTBH_SPACEis unexplained. Please add a comment describing what this field means in the DTBH record layout (and why0x20is the right constant), or make it a documented property like 'platform' and 'subtype' if it varies in the wild.
It's just a magic 0x20 referred to as a "space delimiter" in dtbTool-exynos. Added a comment to that effect in v3.
Quoted 11 lines
tools/binman/etype/android_boot.py class Entry_android_boot(Entry_section): · line 145
Quoted 8 lines
tools/binman/etype/android_boot.py +5
-0@@ -141,6 +141,26 @@ class Entry_android_boot(Entry_section): + A legacy DTBH abootimg, the kind some Samsung bootloaders expect: + + android-boot { + header-version = <0>; +...The QCDT example added in patch 4 does not set header-version explicitly, while this one does. Please make them consistent.
Fixed in v3.
Quoted 13 lines
tools/binman/test/vendor/dtbh.dts line 3
Quoted 6 lines
tools/binman/test/vendor/dtbh.dts +3
-0@@ -0,0 +1,29 @@ + model_info-chip = <7870>; + model_info-hw_rev = <6>; + model_info-hw_rev_end = <6>;These properties end up at the root of the test DTB, which is what 'u-boot-dtb' embeds, so
_GetDtbRootU32()picks them back out of the payload. That works but is subtle - a one-line comment at the top of the test DTS noting that the test relies on the binman test DTB being its own DTBH payload would save the next person a few minutes.
It's subtle indeed, and also quite confusing. There's no need for these values to leak into the control FDT, I was just following the prior art too closely. v3 opts to pluck these values from the dtbh {} node rather than hunting for them in the root of the DTB.
The end result is that QCDT and DTBH can share even more code, since they're both hunting for these record-level values in the same place and same way.
Quoted 11 lines
Quoted 11 lines
tools/binman/ftest.py +9
-0@@ -5701,6 +5701,30 @@ fdt fdtmap Extract the devicetree blob from the fdtmap + 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))
Quoted 8 lines
tools/binman/ftest.py fdt fdtmap Extract the devicetree blob from the fdtmap · line 5715
Quoted 3 lines
tools/binman/ftest.py +3
-0+ self.assertEqual((7870, 0x50a6, 0x217584da, 6, 6, 0x800, + dtb_size, 0x20), + struct.unpack_from('<8I', data, 12))Please also add a test exercising non-default 'platform', 'subtype' and 'page-size', and one with more than one dtb-* subnode - at the moment only the single-record default-everything path is covered, which leaves the multi-record offset arithmetic untested.
Done and done.
Thanks again Simon,
-Sam
Quoted 4 lines
Regards,
Simon
PATCH v2 7/8 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 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+)
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 { }; + }; + }; + }; + }; + }; +};
Signature · 1 line
2.54.0
Re: [PATCH v2 7/8] arch: arm: exynos: add j7xelte binman config
Hi Sam,
Quoted 15 lines · On 2026-06-07T23:37:09, Sam Day via B4 Relay…
arch: arm: exynos: add j7xelte binman config
Note 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.
Signed-off-by Sam Day <[email protected]>
arch/arm/dts/exynos7870-j7xelte-u-boot.dtsi| 24 ++++++++++++++++++++++++
1 file chang
arch/arm/dts/exynos7870-j7xelte-u-boot.dtsi line 6
Quoted 6 lines
arch/arm/dts/exynos7870-j7xelte-u-boot.dtsi +6
-0@@ -0,0 +1,24 @@ + binman { + filename = 'u-boot-samsung-j7xelte.img'; + android-boot { + kernel { + u-boot-nodtb {}; + };
No 'base' is set, so android_boot falls back to its default of 0x10000000, putting the kernel_addr field in the abootimg header at 0x10008000 - nowhere near Exynos7870 DRAM at 0x40000000. Does S-BOOT on j7xelte ignore the load addresses in the header (so the defaults are harmless), or do you need to set base = <0x40000000> explicitly? A short note in the commit message on what S-BOOT does with those fields would help.
arch/arm/dts/exynos7870-j7xelte-u-boot.dtsi line 7
Quoted 9 lines
arch/arm/dts/exynos7870-j7xelte-u-boot.dtsi +7
-0@@ -0,0 +1,24 @@ + vendor-dt { + dtbh { + dtb-0 { + u-boot-dtb { }; + }; + }; + };
Does this indenting use tabs? It should.
'S-BOOT expects a DTBH with hw-rev == 6' is terse - worth a sentence explaining that this pins both hw_rev and hw_rev_end to 6, contrasting with the wider 0..255 range used by the j6lte overlay, so it's clear why that DTSI's approach wasn't reused.
Regards,
Simon
Re: [PATCH v2 7/8] arch: arm: exynos: add j7xelte binman config
Allow me to chime in and provide some context for discussions below:
Quoted 26 lines · Simon Glass
Hi Sam,
Quoted 15 lines · On 2026-06-07T23:37:09, Sam Day via B4 Relay…
arch: arm: exynos: add j7xelte binman config
Note 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.
Signed-off-by Sam Day <[email protected]>
arch/arm/dts/exynos7870-j7xelte-u-boot.dtsi| 24 ++++++++++++++++++++++++
1 file changarch/arm/dts/exynos7870-j7xelte-u-boot.dtsi line 6
Quoted 6 lines
arch/arm/dts/exynos7870-j7xelte-u-boot.dtsi +6
-0@@ -0,0 +1,24 @@ + binman { + filename = 'u-boot-samsung-j7xelte.img'; + android-boot { + kernel { + u-boot-nodtb {}; + };
Quoted 7 lines
No 'base' is set, so
android_bootfalls back to its default of0x10000000, putting thekernel_addrfield in the abootimg header at0x10008000- nowhere near Exynos7870 DRAM at0x40000000. Does S-BOOT on j7xelte ignore the load addresses in the header (so the defaults are harmless), or do you need to set base = <0x40000000> explicitly? A short note in the commit message on what S-BOOT does with those fields would help.
In my devices (on7xelte, a2corelte, j6lte), S-BOOT does ignore the load address. This is also mentioned in the install guide [1], as it says:
"Offsets are not provided to mkbootimg as S-BOOT ignores them."
Quoted 12 lines
arch/arm/dts/exynos7870-j7xelte-u-boot.dtsi line 7
Quoted 9 lines
arch/arm/dts/exynos7870-j7xelte-u-boot.dtsi +7
-0@@ -0,0 +1,24 @@ + vendor-dt { + dtbh { + dtb-0 { + u-boot-dtb { }; + }; + }; + };Does this indenting use tabs? It should.
Quoted 4 lines
'S-BOOT expects a DTBH with hw-rev == 6' is terse - worth a sentence explaining that this pins both
hw_revandhw_rev_endto 6, contrasting with the wider 0..255 range used by the j6lte overlay, so it's clear why that DTSI's approach wasn't reused.
I also question this approach. In my devices S-BOOT happily accepts dtbs having revisions lower than that of the hardware, but of course, doesn't accept higher ones. Setting hw-rev to 6 means that U-Boot won't work for S-BOOT versions 5 or below.
If this is indeed a quirk of S-BOOT in this device, then do we need to make revision variants for j7xelte, or pass the revision to binman somehow?
Quoted 2 lines
Regards,
Simon
[1] https://docs.u-boot-project.org/en/v2026.04/board/samsung/exynos-mobile/exynos7870.html#preparation.
Re: [PATCH v2 7/8] arch: arm: exynos: add j7xelte binman config
Hey Kaustabh, Simon,
Quoted 37 lines · Kaustabh Chakraborty
Allow me to chime in and provide some context for discussions below:
Quoted 26 lines · Simon Glass
Hi Sam,
Quoted 15 lines · On 2026-06-07T23:37:09, Sam Day via B4 Relay…
arch: arm: exynos: add j7xelte binman config
Note 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.
Signed-off-by Sam Day <[email protected]>
arch/arm/dts/exynos7870-j7xelte-u-boot.dtsi| 24 ++++++++++++++++++++++++
1 file changarch/arm/dts/exynos7870-j7xelte-u-boot.dtsi line 6
Quoted 6 lines
arch/arm/dts/exynos7870-j7xelte-u-boot.dtsi +6
-0@@ -0,0 +1,24 @@ + binman { + filename = 'u-boot-samsung-j7xelte.img'; + android-boot { + kernel { + u-boot-nodtb {}; + };Quoted 7 lines
No 'base' is set, so
android_bootfalls back to its default of0x10000000, putting thekernel_addrfield in the abootimg header at0x10008000- nowhere near Exynos7870 DRAM at0x40000000. Does S-BOOT on j7xelte ignore the load addresses in the header (so the defaults are harmless), or do you need to set base = <0x40000000> explicitly? A short note in the commit message on what S-BOOT does with those fields would help.
Quoted 5 lines
In my devices (on7xelte, a2corelte, j6lte), S-BOOT does ignore the load address. This is also mentioned in the install guide [1], as it says:
"Offsets are not provided to mkbootimg as S-BOOT ignores them."
Right. I forgot to add a comment to the j7xelte carrying along this important quirk. That will be addressed in v3.
Quoted 17 lines
Quoted 12 lines
arch/arm/dts/exynos7870-j7xelte-u-boot.dtsi line 7
Quoted 9 lines
arch/arm/dts/exynos7870-j7xelte-u-boot.dtsi +7
-0@@ -0,0 +1,24 @@ + vendor-dt { + dtbh { + dtb-0 { + u-boot-dtb { }; + }; + }; + };Does this indenting use tabs? It should.
Quoted 4 lines
'S-BOOT expects a DTBH with hw-rev == 6' is terse - worth a sentence explaining that this pins both
hw_revandhw_rev_endto 6, contrasting with the wider 0..255 range used by the j6lte overlay, so it's clear why that DTSI's approach wasn't reused.
Quoted 8 lines
I also question this approach. In my devices S-BOOT happily accepts dtbs having revisions lower than that of the hardware, but of course, doesn't accept higher ones. Setting hw-rev to 6 means that U-Boot won't work for S-BOOT versions 5 or below.
If this is indeed a quirk of S-BOOT in this device, then do we need to make revision variants for j7xelte, or pass the revision to binman somehow?
So, all I was trying to accomplish here is increased specificity. That is, since we're formalizing this process of producing canonical artifacts for un(der-)documented platforms, I felt that nailing down the most precise magic values for a device is preferable to cargo culting around generalized spooky numbers :D
Since it's contentious, I'll make sure that v3 keeps the defaults casting the net as maximally wide as possible and avoid trying to pin down the j7xelte.
Thanks all,
-Sam
Quoted 7 lines
Quoted 3 lines
Regards,
Simon[1] https://docs.u-boot-project.org/en/v2026.04/board/samsung/exynos-mobile/exynos7870.html#preparation.
PATCH v2 8/8 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
Re: [PATCH v2 8/8] configs: exynos-mobile: pull in BINMAN
Quoted 4 lines · On 2026-06-07T23:37:09, Sam Day via B4 Relay…
configs: exynos-mobile: pull in BINMAN
All Exynos7 mobile devices need abootimg+DTBH wrapping to be bootable from the fused S-BOOT bootloader. So we enable BINMAN everywhere.
binman (subject too)
Quoted 10 lines
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.
Signed-off-by Sam Day <[email protected]>
arch/arm/dts/exynos-mobile.dtsi| 5 +++++arch/arm/mach-exynos/Kconfig | 1 + configs/exynos-mobile_defconfig | 1 + 3 files changed, 7 insertions(+)
Hi Sam,
Quoted 9 lines · On 2026-06-07T23:37:09, Sam Day via B4 Relay…
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)
Great to see this and thanks for digging into the binman side! I don't have any exynos7 hardware in my lab, although I do have exynos5. Is there an available kit or device?
That list above needs an update. So far you only have some starting points for qcom. I'd like to unblock that too, but it can be a follow-on.
It feels strange to be replying to [email protected] - presumably this will get to you somehow :-)
I have a lot of comments, mostly about adding tests...if you need help getting 'binman test -T' to work, let me know.
Regards,
Simon