[U-Boot,00/53] binman: Support replacing entries in an existing image
mbox series

Message ID 20190720182416.183626-1-sjg@chromium.org
Headers show
Series
  • binman: Support replacing entries in an existing image
Related show

Message

Simon Glass July 20, 2019, 6:23 p.m. UTC
At present binman allows existing images to be listed, so long as they
have an fdtmap entry inside them.

This series extends that to permit changing the contents of an existing
image, by replacing the contents of entries with other files or
directories. It is not possible to add new entries.

This feature works by reading in the original data, repacking the image
if necessary (e.g. an entry size has changed) and writing it back out.

This series includes quite a few clean-ups and refactoring to improve the
code a little.


Simon Glass (53):
  dtoc: Return a non-zero exit code when tests fail
  binman: Move image-processing code into a function
  binman: Move GetFdtSet() into blob_dtb
  binman: Use print() to print output
  binman: Move image/fdt code into PrepareImagesAndDtbs()
  binman: Convert GetFdtSet() to use a dict
  binman: Rename state.GetFdts()
  binman: Rename state.GetFdt()
  binman: Adjust GetFdt() to be keyed by etype
  binman: Adjust state.fdt_files to be keyed by entry type
  binman: Simplify state.fdt_subset
  binman: Drop state.fdt_set as this is not needed
  patman: Update tout to avoid open-coding the debug levels
  binman: Add a bit of logging in entries when packing
  binman: Show a helpful error when a DT property is missing
  dtoc: Update Fdt.FromData() to allow a name
  dtoc: Update Fdt.GetNode() to handle the root node
  binman: Store image fdtmap when loading from a file
  binman: Support loading entry data from a file
  binman: Allow state functions to fail to return data
  binman: Store the entry in output_fdt_files
  binman: Add an image name into the fdtmap
  binman: Adjust Entry to read the node in a separate call
  binman: Add a function to obtain the image for an Entry
  binman: Add a constant for common entry properties
  binman: Allow the fdtmap to remain unchanged
  binman: Tidy up _SetupDtb() to use its own temporary file
  binman: Support updating entries in an existing image
  binman: Add info to allow safely repacking an image later
  binman: Update documentation for image creation
  binman: Write the original input fdtmap to a file
  binman: Move Image.BuildImage() into a single function
  binman: Add more tests for image header position
  binman: Allow updating entries that change size
  binman: Update the _testing entry to support shrinkage
  binman: Support shrinking a entry after packing
  libfdt: Copy the struct region in fdt_resize()
  binman: Adjust fmap to ignore CBFS files
  binman: Place Intel descriptor at image start
  binman: Add a few more features to the wishlist
  binman: Add a prefix before CBFS hex offsets
  binman: Update Entry.ReadEntry() to work through classes
  binman: Update Entry.WriteData() to handle special sections
  binman: Support replacing data in a cbfs
  patman: Reset the output directory when it is removed
  binman: Update state when replacing device-tree entries
  binman: Add a test function to clean up the output dir
  binman: Clean up all output directories in tests
  binman: Move control.WriteEntry further down the file
  binman: Update control.WriteEntry() to support writing the map
  binman: Split control.WriteEntryToImage() into separate functions
  binman: Correct the error message for invalid path
  binman: Add command-line support for replacing entries

 scripts/dtc/libfdt/fdt_sw.c                   |   2 +-
 tools/binman/README                           |  79 ++-
 tools/binman/README.entries                   |  11 +-
 tools/binman/cbfs_util.py                     |  14 +-
 tools/binman/cbfs_util_test.py                |   4 +-
 tools/binman/cmdline.py                       |  17 +
 tools/binman/control.py                       | 408 ++++++++----
 tools/binman/elf.py                           |   9 +-
 tools/binman/elf_test.py                      |  19 +-
 tools/binman/entry.py                         | 162 ++++-
 tools/binman/entry_test.py                    |  22 +-
 tools/binman/etype/_testing.py                |  28 +-
 tools/binman/etype/blob.py                    |  12 -
 tools/binman/etype/blob_dtb.py                |  35 +-
 tools/binman/etype/cbfs.py                    |  24 +-
 tools/binman/etype/fdtmap.py                  |  60 +-
 tools/binman/etype/fill.py                    |   3 +
 tools/binman/etype/fmap.py                    |  11 +-
 tools/binman/etype/image_header.py            |  16 +-
 tools/binman/etype/intel_descriptor.py        |   6 +-
 tools/binman/etype/intel_ifwi.py              |   1 +
 tools/binman/etype/section.py                 | 105 +++-
 tools/binman/etype/u_boot_dtb.py              |   3 +
 tools/binman/etype/u_boot_dtb_with_ucode.py   |   9 +-
 tools/binman/etype/u_boot_spl_dtb.py          |   3 +
 tools/binman/etype/u_boot_tpl_dtb.py          |   3 +
 .../binman/etype/u_boot_tpl_dtb_with_ucode.py |   3 +
 tools/binman/ftest.py                         | 589 ++++++++++++++++--
 tools/binman/image.py                         |  52 +-
 tools/binman/state.py                         | 207 ++++--
 tools/binman/test/132_replace.dts             |  21 +
 tools/binman/test/133_replace_multi.dts       |  33 +
 .../binman/test/134_fdt_update_all_repack.dts |  23 +
 tools/binman/test/135_fdtmap_hdr_middle.dts   |  16 +
 tools/binman/test/136_fdtmap_hdr_startbad.dts |  16 +
 tools/binman/test/137_fdtmap_hdr_endbad.dts   |  16 +
 tools/binman/test/138_fdtmap_hdr_nosize.dts   |  16 +
 tools/binman/test/139_replace_repack.dts      |  22 +
 tools/binman/test/140_entry_shrink.dts        |  20 +
 tools/binman/test/141_descriptor_offset.dts   |  20 +
 tools/binman/test/142_replace_cbfs.dts        |  37 ++
 tools/binman/test/143_replace_all.dts         |  28 +
 tools/dtoc/dtoc.py                            |   7 +-
 tools/dtoc/fdt.py                             |  41 +-
 tools/dtoc/fdt_util.py                        |  12 +-
 tools/dtoc/test_fdt.py                        |  48 +-
 tools/patman/tools.py                         |  29 +-
 tools/patman/tout.py                          |  22 +-
 48 files changed, 1979 insertions(+), 365 deletions(-)
 create mode 100644 tools/binman/test/132_replace.dts
 create mode 100644 tools/binman/test/133_replace_multi.dts
 create mode 100644 tools/binman/test/134_fdt_update_all_repack.dts
 create mode 100644 tools/binman/test/135_fdtmap_hdr_middle.dts
 create mode 100644 tools/binman/test/136_fdtmap_hdr_startbad.dts
 create mode 100644 tools/binman/test/137_fdtmap_hdr_endbad.dts
 create mode 100644 tools/binman/test/138_fdtmap_hdr_nosize.dts
 create mode 100644 tools/binman/test/139_replace_repack.dts
 create mode 100644 tools/binman/test/140_entry_shrink.dts
 create mode 100644 tools/binman/test/141_descriptor_offset.dts
 create mode 100644 tools/binman/test/142_replace_cbfs.dts
 create mode 100644 tools/binman/test/143_replace_all.dts