diff mbox series

[v6,05/21] binman: Collect bintools before usage

Message ID 20220819142538.24847-6-stefan.herbrechtsmeier-oss@weidmueller.com
State Accepted
Commit 917b3c37ae10cc2a965cfc7d7eb701e5f0b75c39
Delegated to: Simon Glass
Headers show
Series binman: Rework compression support | expand

Commit Message

Stefan Herbrechtsmeier Aug. 19, 2022, 2:25 p.m. UTC
From: Stefan Herbrechtsmeier <stefan.herbrechtsmeier@weidmueller.com>

Collect and thereby initialize bintools before any usage but after
generation of entries. This is needed to handle bintools for compress
and decompress like other bintools.

Signed-off-by: Stefan Herbrechtsmeier <stefan.herbrechtsmeier@weidmueller.com>

---

(no changes since v5)

Changes in v5:
- Add commit to collect bintools before usage

 tools/binman/control.py | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

Comments

Simon Glass Aug. 20, 2022, 9:33 p.m. UTC | #1
On Fri, 19 Aug 2022 at 08:26, Stefan Herbrechtsmeier
<stefan.herbrechtsmeier-oss@weidmueller.com> wrote:
>
> From: Stefan Herbrechtsmeier <stefan.herbrechtsmeier@weidmueller.com>
>
> Collect and thereby initialize bintools before any usage but after
> generation of entries. This is needed to handle bintools for compress
> and decompress like other bintools.
>
> Signed-off-by: Stefan Herbrechtsmeier <stefan.herbrechtsmeier@weidmueller.com>
>
> ---
>
> (no changes since v5)
>
> Changes in v5:
> - Add commit to collect bintools before usage
>
>  tools/binman/control.py | 5 ++++-
>  1 file changed, 4 insertions(+), 1 deletion(-)
>

Reviewed-by: Simon Glass <sjg@chromium.org>
Simon Glass Aug. 21, 2022, 12:10 a.m. UTC | #2
On Fri, 19 Aug 2022 at 08:26, Stefan Herbrechtsmeier
<stefan.herbrechtsmeier-oss@weidmueller.com> wrote:
>
> From: Stefan Herbrechtsmeier <stefan.herbrechtsmeier@weidmueller.com>
>
> Collect and thereby initialize bintools before any usage but after
> generation of entries. This is needed to handle bintools for compress
> and decompress like other bintools.
>
> Signed-off-by: Stefan Herbrechtsmeier <stefan.herbrechtsmeier@weidmueller.com>
>
> ---
>
> (no changes since v5)
>
> Changes in v5:
> - Add commit to collect bintools before usage
>
>  tools/binman/control.py | 5 ++++-
>  1 file changed, 4 insertions(+), 1 deletion(-)
>

Reviewed-by: Simon Glass <sjg@chromium.org>

Applied to u-boot-dm, thanks!
diff mbox series

Patch

diff --git a/tools/binman/control.py b/tools/binman/control.py
index ce57dc7efc..f8b1733b14 100644
--- a/tools/binman/control.py
+++ b/tools/binman/control.py
@@ -215,6 +215,7 @@  def ReadEntry(image_fname, entry_path, decomp=True):
     from binman.image import Image
 
     image = Image.FromFile(image_fname)
+    image.CollectBintools()
     entry = image.FindEntryPath(entry_path)
     return entry.ReadData(decomp)
 
@@ -251,6 +252,7 @@  def ExtractEntries(image_fname, output_fname, outdir, entry_paths,
         List of EntryInfo records that were written
     """
     image = Image.FromFile(image_fname)
+    image.CollectBintools()
 
     if alt_format == 'list':
         ShowAltFormats(image)
@@ -370,6 +372,7 @@  def WriteEntry(image_fname, entry_path, data, do_compress=True,
     """
     tout.info("Write entry '%s', file '%s'" % (entry_path, image_fname))
     image = Image.FromFile(image_fname)
+    image.CollectBintools()
     entry = image.FindEntryPath(entry_path)
     WriteEntryToImage(image, entry, data, do_compress=do_compress,
                       allow_resize=allow_resize, write_map=write_map)
@@ -507,8 +510,8 @@  def PrepareImagesAndDtbs(dtb_fname, select_images, update_fdt, use_expanded):
     # without changing the device-tree size, thus ensuring that our
     # entry offsets remain the same.
     for image in images.values():
-        image.CollectBintools()
         image.gen_entries()
+        image.CollectBintools()
         if update_fdt:
             image.AddMissingProperties(True)
         image.ProcessFdt(dtb)