Skip to content
Snippets Groups Projects
  1. Apr 25, 2022
    • Alper Nebi Yasak's avatar
      binman: Refuse to replace sections for now · 82337bb6
      Alper Nebi Yasak authored and Tom Rini's avatar Tom Rini committed
      
      Binman interfaces allow attempts to replace any entry in the image with
      arbitrary data. When trying to replace sections, the changes in the
      section entry's data are not propagated to its child entries. This,
      combined with how sections rebuild their contents from its children,
      eventually causes the replaced contents to be silently overwritten by
      rebuilt contents equivalent to the original data.
      
      Add a simple test for replacing a section that is currently failing due
      to this behaviour, and mark it as an expected failure. Also, raise an
      error when replacing a section instead of silently pretending it was
      replaced.
      
      Signed-off-by: default avatarAlper Nebi Yasak <alpernebiyasak@gmail.com>
      Reviewed-by: Simon Glass's avatarSimon Glass <sjg@chromium.org>
      82337bb6
    • Alper Nebi Yasak's avatar
      binman: Test replacing non-section entries in FIT subsections · 99283e53
      Alper Nebi Yasak authored and Tom Rini's avatar Tom Rini committed
      
      A previous patch fixes binman to correctly extract FIT subentries. This
      makes it easier to test replacing these entries as we can write tests
      using an existing helper function that relies on extracting the replaced
      entry.
      
      Add tests that replace leaf entries in FIT subsections with data of
      various sizes. Replacing the subsections or the whole FIT section does
      not work yet due to the section contents being re-built from unreplaced
      subentries' data.
      
      Signed-off-by: default avatarAlper Nebi Yasak <alpernebiyasak@gmail.com>
      Reviewed-by: Simon Glass's avatarSimon Glass <sjg@chromium.org>
      99283e53
    • Alper Nebi Yasak's avatar
      binman: Create FIT subentries in the FIT section, not its parent · 74d3b231
      Alper Nebi Yasak authored and Tom Rini's avatar Tom Rini committed
      
      When reading images from a file, each entry's data is read from its
      parent section as specified in the Entry.Create() call that created it.
      The FIT entry type has been creating its subentries under its parent
      (their grandparent), as creating them under the FIT entry resulted in an
      error until FIT was converted into a proper section.
      
      FIT subentries have their offsets relative to the FIT section, and
      reading those offsets in the parent section results in wrong data. The
      subentries rightfully belong under the FIT entries, so create them
      there. Add tests checking that we can extract the correct data for a FIT
      entry and its subentries.
      
      Signed-off-by: default avatarAlper Nebi Yasak <alpernebiyasak@gmail.com>
      Reviewed-by: Simon Glass's avatarSimon Glass <sjg@chromium.org>
      74d3b231
    • Alper Nebi Yasak's avatar
      binman: Remove '/images/' fragment from FIT subentry paths · e736878b
      Alper Nebi Yasak authored and Tom Rini's avatar Tom Rini committed
      
      Binman FIT entry nodes describe their subentries in an 'images' subnode,
      same as how they would be written for the mkimage executable. The entry
      type initially manually managed its subentries keyed by their node paths
      relative to its base node. It was later converted to a proper section
      while still keeping the same keys for subentries.
      
      These subentry keys of sections are used as path fragments, so they must
      not contain the path separator character '/'. Otherwise, they won't be
      addressable by binman extract/replace commands. Change these keys from
      the '/images/foo' forms to the subentry node names. Extend the simple
      FIT tests to check for this.
      
      Signed-off-by: default avatarAlper Nebi Yasak <alpernebiyasak@gmail.com>
      e736878b
    • Alper Nebi Yasak's avatar
      binman: Don't reset offset/size if image doesn't allow repacking · e2ce4fb9
      Alper Nebi Yasak authored and Tom Rini's avatar Tom Rini committed
      
      When an image has the 'allow-repack' property, binman includes the
      original offset and size properties from the image description in the
      fdtmap. These are later used as the packing constraints when replacing
      entries in an image, so other unconstrained entries can be freely
      positioned.
      
      Replacing an entry in an image without 'allow-repack' (and therefore the
      original offsets) follows the same logic and results in entries being
      merely concatenated. Instead, skip resetting the calculated offsets and
      sizes to the missing originals for these images so that every entry is
      constrained to its existing offset/size.
      
      Add tests that replace an entry with smaller or equal-sized data, in an
      image that doesn't allow repacking. Attempting to do so with bigger-size
      data is already an error that is already being tested.
      
      Signed-off-by: default avatarAlper Nebi Yasak <alpernebiyasak@gmail.com>
      Reviewed-by: Simon Glass's avatarSimon Glass <sjg@chromium.org>
      e2ce4fb9
    • Alper Nebi Yasak's avatar
      binman: Collect bintools for images when replacing entries · 8ee4ec9b
      Alper Nebi Yasak authored and Tom Rini's avatar Tom Rini committed
      
      Binman entries can use other executables to compute their data, usually
      in their ObtainContents() methods. Subclasses of Entry_section would use
      bintools in their BuildSectionData() method instead, which is called
      from several places including their Pack().
      
      These binary tools are resolved correctly while building an image from a
      device-tree description so that they can be used from these methods.
      However, this is not being done when replacing entries in an image,
      which can result in an error as the Pack() methods attempt to use them.
      
      Collect and resolve entries' bintools also when replacing entries to fix
      Pack() errors. Add a way to mock bintool usage in the testing entry type
      and tests that check bintools are being resolved for such an entry.
      
      Signed-off-by: default avatarAlper Nebi Yasak <alpernebiyasak@gmail.com>
      Reviewed-by: Simon Glass's avatarSimon Glass <sjg@chromium.org>
      8ee4ec9b
    • Alper Nebi Yasak's avatar
      binman: Fix unique names having '/.' for images read from files · 67bf2c8d
      Alper Nebi Yasak authored and Tom Rini's avatar Tom Rini committed
      
      Binman can embed a copy of the image description into the images it
      builds as a fdtmap entry, but it omits the /binman/<image-name> prefix
      from the node paths while doing so. When reading an already-built image
      file, entries are reconstructed using this fdtmap and their associated
      nodes still lack that prefix.
      
      Some entries like fit and vblock create intermediate files whose names
      are based on an entry unique name. This name is constructed from their
      node's path by concatenating the parents with dots up to the binman
      node, e.g. /binman/image/foo/bar becomes 'image.foo.bar'.
      
      However, we don't have this /binman/image prefix when replacing entries
      in such an image. The /foo/bar entry we read when doing so erroneously
      has the unique name of '/.foo.bar', causing permission errors when the
      entry attempts to create files based on that.
      
      Fix the unique-name generation by stopping at the '/' node like how it
      stops at the binman node. As the unique names are used as filenames, add
      tests that check if they're safe to use as filenames.
      
      Signed-off-by: default avatarAlper Nebi Yasak <alpernebiyasak@gmail.com>
      Reviewed-by: Simon Glass's avatarSimon Glass <sjg@chromium.org>
      67bf2c8d
  2. Apr 23, 2022
    • Tom Rini's avatar
      Merge branch '2022-04-22-assorted-updates' · 9bb99fa9
      Tom Rini authored
      - Add "-q" to fdt addr and use it in distro_bootcmd to make the user
        experience less scary reading in normal try/fail cases.
      - Let the adc update an environment variable like many other commands do
      - Fix TPL SEPARATE_BSS check when locating DTB
      - Allow ":" in PXE file names again
      - Two Apple M1 fixes
      9bb99fa9
  3. Apr 22, 2022
  4. Apr 21, 2022
Loading