[PATCH v3 3/6] binman: rework dropping absent entries from packaged image
Tom Rini
trini at konsulko.com
Thu Jul 10 15:53:54 CEST 2025
On Thu, Jul 10, 2025 at 05:53:22AM +0000, Yannic Moog wrote:
> Hi Tim
>
> Am Mittwoch, dem 09.07.2025 um 10:50 -0700 schrieb Tim Harvey:
> > On Fri, Jun 13, 2025 at 5:04 AM Yannic Moog <y.moog at phytec.de> wrote:
> > >
> > > When blobs are absent and are marked as optional, they can be safely
> > > dropped from the binman tree. Use the drop_absent function for that.
> > > Rename drop_absent to drop_absent_optional as we do not want to drop any
> > > entries that are absent; they should be reported by binman as errors
> > > when they are missing.
> > > We also reorder the processing of the image the following:
> > > - We call the CheckForProblems function before the image is built.
> > > - We drop entries after we checked for problems with the image.
> > > This is okay because CheckForProblems does not look at the file we have
> > > written but rather queries the data structure (image) built with binman.
> > > This also allows us to get all error and warning messages that we want
> > > to report while avoiding putting missing optional entries in the final
> > > image.
> > > As only the blobs are dropped, the sections still remain in the
> > > assembled image. Thus add them to the expected test case checks where
> > > necessary.
> > >
> > > In addition, a rework of testPackTeeOsOptional test case is necessary.
> > >
> > > The test did not really do what it was supposed to. The description said
> > > that optional binary is tested, but the binary is not marked as
> > > optional. Further, the tee.elf file, when included in the image
> > > properly, also shows up in the image data. This must be added as well.
> > >
> > > As there is no global variable for the elf data, set the pathname to the
> > > elf file that was created when setting up the test suite.
> > > For the test case get the filename and read the contents, comparing them
> > > to the contents of the created binman image.
> > >
> > > Signed-off-by: Yannic Moog <y.moog at phytec.de>
> > > ---
> > > tools/binman/control.py | 5 ++---
> > > tools/binman/entry.py | 6 +++++-
> > > tools/binman/etype/cbfs.py | 3 ++-
> > > tools/binman/etype/mkimage.py | 2 +-
> > > tools/binman/etype/section.py | 16 ++++++++++++----
> > > tools/binman/ftest.py | 14 ++++++++------
> > > tools/binman/image.py | 2 ++
> > > 7 files changed, 32 insertions(+), 16 deletions(-)
> > >
> > >
>
> [...]
>
> > > diff --git a/tools/binman/etype/section.py b/tools/binman/etype/section.py
> > > index
> > > 1d50bb477534702019502d08f8648d4c9a367c0f..03c4f7c6ec74c6fa75c9362e2fecdb0e6a
> > > b568cb 100644
> > > --- a/tools/binman/etype/section.py
> > > +++ b/tools/binman/etype/section.py
> > > @@ -537,7 +537,7 @@ class Entry_section(Entry):
> > > for entry in self._entries.values():
> > > entry.WriteMap(fd, indent + 1)
> > >
> > > - def GetEntries(self):
> > > + def GetEntries(self) -> dict[str, Entry]:
> > >
>
> the problem is that I forgot to "packport" typing support for older python
> versions < 3.9.
> Thank you for bringing this to my attention.
>
> >
> > Hi Yannic,
> >
> > This series just got merged to master and I noticed it failing
> > building imx8mm_venice on my Ubuntu 20.04 dev host which has Python
> > 3.8.10.
> >
> > make imx8mm_venice_defconfig
> > make
> > ...
> > BINMAN .binman_stamp
> > binman: 'type' object is not subscriptable
> > make: *** [Makefile:1336: .binman_stamp] Error 1
> >
> > Do you know what the minimum version of python required is or what
> > would need to be changed here to support the previous version of
> > python that worked?
>
> Absolute minimum version is 3.5. That is when typing got introduced.
>
> Quoting from binman pyproject.toml:
>
> > description = "Binman firmware-packaging tool"
> > readme = "README.rst"
> > requires-python = ">=3.7"
> >
>
> But there has been a patch that tried to make binman work for 3.6.
> de65b122a2534 ("tools: Fall back to importlib_resources on Python 3.6")
>
> Should I create a solution for python >= 3.5 or >= 3.7?
I think we should aim for >= 3.5, since the toml file is out of date if
someone else fixed it for 3.6 (and so I assume some other LTS distro
uses 3.6). Thanks!
--
Tom
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 659 bytes
Desc: not available
URL: <https://lists.denx.de/pipermail/u-boot/attachments/20250710/627f496d/attachment.sig>
More information about the U-Boot
mailing list