Hi Sam,

On Tue, 9 Jun 2026 at 10:31, Sam Day <[email protected]> wrote:
>
> Ahoy Simon,
>
> On Monday, 8 June 2026 at 11:27 PM, Simon Glass <[email protected]> wrote:
>
> > Hi Sam,
> >
> > On 2026-06-07T23:37:09, Sam Day via B4 Relay
> > <[email protected]> wrote:
> > > binman: android_boot: SEANDROIDENFORCE support
> > >
> > > 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 <[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(+)
> >
> > > diff --git a/tools/binman/etype/android_boot.py 
> > > b/tools/binman/etype/android_boot.py
> > > @@ -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'.
> >
> > > diff --git a/tools/binman/etype/android_boot.py 
> > > b/tools/binman/etype/android_boot.py
> > > @@ -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.
> >
> > > diff --git a/tools/binman/ftest.py b/tools/binman/ftest.py
> > > @@ -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 :)

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

Reply via email to