[PATCH v2 5/8] binman: android_boot: SEANDROIDENFORCE support

Sam Day via B4 Relay devnull+me.samcday.com at kernel.org
Mon Jun 8 01:37:14 CEST 2026


From: Sam Day <me at samcday.com>

Some 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 <me at samcday.com>
---
 tools/binman/etype/android_boot.py                 | 11 +++++++++++
 tools/binman/ftest.py                              |  6 ++++++
 .../test/vendor/android_boot_seandroidenforce.dts  | 22 ++++++++++++++++++++++
 3 files changed, 39 insertions(+)

diff --git a/tools/binman/etype/android_boot.py b/tools/binman/etype/android_boot.py
index 0eb59b30312..c7acb2bb66e 100644
--- a/tools/binman/etype/android_boot.py
+++ b/tools/binman/etype/android_boot.py
@@ -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)
 
diff --git a/tools/binman/ftest.py b/tools/binman/ftest.py
index c96748bd1dd..1f3e94908d9 100644
--- a/tools/binman/ftest.py
+++ b/tools/binman/ftest.py
@@ -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(
diff --git a/tools/binman/test/vendor/android_boot_seandroidenforce.dts b/tools/binman/test/vendor/android_boot_seandroidenforce.dts
new file mode 100644
index 00000000000..dc8374f84c7
--- /dev/null
+++ b/tools/binman/test/vendor/android_boot_seandroidenforce.dts
@@ -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>;
+				};
+			};
+		};
+	};
+};

-- 
2.54.0




More information about the U-Boot mailing list