1. 11 Oct, 2017 1 commit
    • Evan Lloyd's avatar
      fiptool: Precursor changes for Visual Studio · 96851114
      Evan Lloyd authored
      
      
      In order to compile the source of Fiptool using Visual Studio a number
      of adjustments are required to the source.  This commit modifies the
      source with changes that will be required, but makes no functional
      modification.  The intent is to allow confirmation that the GCC build
      is unaffected.
      
      Change-Id: I4055bd941c646dd0a1aa2e24b940a1db3bf629ce
      Signed-off-by: default avatarEvan Lloyd <evan.lloyd@arm.com>
      96851114
  2. 30 Aug, 2017 1 commit
  3. 09 Aug, 2017 1 commit
  4. 31 Jul, 2017 1 commit
  5. 26 Jul, 2017 1 commit
  6. 12 Jul, 2017 1 commit
    • Isla Mitchell's avatar
      Fix order of #includes · 2a4b4b71
      Isla Mitchell authored
      
      
      This fix modifies the order of system includes to meet the ARM TF coding
      standard. There are some exceptions in order to retain header groupings,
      minimise changes to imported headers, and where there are headers within
      the #if and #ifndef statements.
      
      Change-Id: I65085a142ba6a83792b26efb47df1329153f1624
      Signed-off-by: default avatarIsla Mitchell <isla.mitchell@arm.com>
      2a4b4b71
  7. 12 Jun, 2017 1 commit
  8. 24 May, 2017 1 commit
  9. 23 May, 2017 1 commit
    • Masahiro Yamada's avatar
      fip: move headers shared between TF and fiptool to include/tools_share · 2a6c1a8f
      Masahiro Yamada authored
      
      
      Some header files need to be shared between TF and host programs.
      For fiptool, two headers are copied to the tools/fiptool directory,
      but it looks clumsy.
      
      This commit introduces a new directory, include/tools_share, which
      collects headers that should be shared between TF and host programs.
      
      This will clarify the interface exposed to host tools.  We should
      add new headers to this directory only when we really need to do so.
      
      For clarification, I inserted a blank line between headers from the
      include/ directory (#include <...>) and ones from a local directory
      (#include "..." ).
      Signed-off-by: default avatarMasahiro Yamada <yamada.masahiro@socionext.com>
      2a6c1a8f
  10. 03 May, 2017 1 commit
  11. 24 Apr, 2017 1 commit
  12. 27 Feb, 2017 1 commit
    • dp-arm's avatar
      fiptool: Embed a pointer to an image within the image descriptor · b9589fe5
      dp-arm authored
      
      
      Currently, fiptool uses two linked lists.  One to chain together all
      the images and one for all the image descriptors.  Initially this was
      done because not all images had a corresponding image descriptor.
      This was the case for unknown images which existed in the FIP but
      there was no descriptor in the builtin table for them.  When support
      for the --blob option came in, we started building descriptors for the
      unknown images on the fly.  As a result every image now has a
      corresponding image descriptor and therefore it is no longer necessary
      to keep track of them separately.
      
      To simplify the design, maintain only a single linked list of image
      descriptors.  An image descriptor contains a pointer to the
      corresponding image.  If the pointer is NULL, then the descriptor is
      skipped in all the operations.  This approach simplifies the traversal
      code and avoids redundant lookups.
      
      The linked list of image descriptors is populated based on the
      `toc_entries` array.  This means that the order of the images in the
      FIP file remains the same across add/remove or create/update
      operations.  This is true for all standard images (those specified in
      `toc_entries`) but not for those specified via the --blob option.
      
      Change-Id: Ic29a263c86c8f1efdad322b430368c7623782e2d
      Signed-off-by: default avatardp-arm <dimitris.papastamos@arm.com>
      b9589fe5
  13. 11 Feb, 2017 3 commits
  14. 28 Jan, 2017 2 commits
    • Masahiro Yamada's avatar
      fiptool: support --align option to add desired alignment to image offset · 1c75d5df
      Masahiro Yamada authored
      
      
      The current fiptool packs all the images without any padding between
      them.  So, the offset to each image has no alignment.  This is not
      efficient, for example, when the FIP is read from a block-oriented
      device.
      
      For example, (e)MMC is accessed by block-addressing.  The block size
      is 512 byte.  So, the best case is each image is aligned by 512 byte
      since the DMA engine can transfer the whole of the image to its load
      address directly.  The worst case is the offset does not have even
      DMA-capable alignment (this is where we stand now).  In this case,
      we need to transfer every block to a bounce buffer, then do memcpy()
      from the bounce buffer to our final destination.  At least, this
      should work with the abstraction by the block I/O layer, but the
      CPU-intervention for the whole data transfer makes it really slow.
      
      This commit adds a new option --align to the fiptool.  This option,
      if given, requests the tool to align each component in the FIP file
      by the specified byte.  Also, add a new Make option FIP_ALIGN for
      easier access to this feature; users can give something like
      FIP_ALIGN=512 from the command line, or add "FIP_ALIGN := 512" to
      their platform.mk file.
      Signed-off-by: default avatarMasahiro Yamada <yamada.masahiro@socionext.com>
      1c75d5df
    • Masahiro Yamada's avatar
      fiptool: embed fip_toc_entry in struct image · 65caa3d0
      Masahiro Yamada authored
      
      
      The struct image has "uuid" and "size" to memorize the field values
      they had in the TOC entry.  So, parse_fip() copies them from struct
      fip_toc_entry to struct image, then pack_images() copies them back
      to struct fip_toc_entry.
      
      The next commit (support --align option) will require to save the
      "offset" field as well.  This makes me realize that struct image
      can embed struct fip_toc_entry.
      
      This commit will allow the "flags" field to persevere the "update"
      command.  At this moment, the "flags" is not used in a useful way.
      (Yet, platforms can save their own parameters in the flags field.)
      It makes sense to save it unless users explicitly replace the image.
      Signed-off-by: default avatarMasahiro Yamada <yamada.masahiro@socionext.com>
      65caa3d0
  15. 27 Jan, 2017 8 commits
  16. 14 Jan, 2017 2 commits
    • Masahiro Yamada's avatar
      fiptool: fix add_image() and add_image_desc() implementation · 11c0a4ff
      Masahiro Yamada authored
      The "make fip" shows the content of the generated FIP at the end of
      the build.  (This is shown by "fiptool info" command.)
      
      Prior to commit e0f083a0 ("fiptool: Prepare ground for expanding
      the set of images at runtime"), the last part of the build log of
       make CROSS_COMPILE=aarch64-linux-gnu- BL33=../u-boot/u-boot.bin fip
      was like follows:
      
       Trusted Boot Firmware BL2: offset=0xB0, size=0x4188, cmdline="--tb-fw"
       EL3 Runtime Firmware BL31: offset=0x4238, size=0x6090, cmdline="--soc-fw"
       Non-Trusted Firmware BL33: offset=0xA2C8, size=0x58B51, cmdline="--nt-fw"
      
      With that commit, now it is displayed like follows:
      
       Non-Trusted Firmware BL33: offset=0xB0, size=0x58B51, cmdline="--nt-fw"
       EL3 Runtime Firmware BL31: offset=0x58C01, size=0x6090, cmdline="--soc-fw"
       Trusted Boot Firmware BL2: offset=0x5EC91, size=0x4188, cmdline="--tb-fw"
      
      You will notice two differences:
        - the contents are displayed in BL33, BL31, BL2 order
        - the offset values are wrong
      
      The latter is more serious, and means "fiptool info" is broken.
      
      Another interesting change is "fiptool update" every time reverses
      the image order.  For example, if you input FIP with BL2, BL31, BL33
      in this order, the command will pack BL33, BL31, BL2 into FIP, in
      this order.  Of course, the order of components is not a big deal
      except that users will have poor impression about this.
      
      The root cause is in the implementation of add_image(); the
      image_head points to the last added image.  For example, if you call
      add_image() for BL2, BL31, BL33 in this order, the resulted image
      chain is:
      
        image_head -> BL33 -> BL31 -> BL2
      
      Then, they are processed from the image_head in "for" loops:
      
        for (image = image_head; image != NULL; image = image->next) {
      
      This means images are handled in Last-In First-Out manner.
      
      Interestingly, "fiptool create" is still correct because
      add_image_desc() also reverses the descriptor order and the command
      works as before due to the double reverse.
      
      The implementation of add_image() is efficient, but it made the
      situation too complicated.
      
      Let's make image_head point to the first added image.  This will
      add_image() inefficient because every call of add_image() follows
      the ->next chain to get the tail.  We can solve it by adopting a
      nicer linked list structure, but I am not doing as far as that
      because we handle only limited number of images anyway.
      
      Do likewise for add_image_desc().
      
      Fixes: e0f083a0
      
       ("fiptool: Prepare ground for expanding the set of images at runtime")
      Signed-off-by: default avatarMasahiro Yamada <yamada.masahiro@socionext.com>
      11c0a4ff
    • Masahiro Yamada's avatar
      fiptool: introduce xzalloc() helper function · 696ccba6
      Masahiro Yamada authored
      
      
      We often want to zero out allocated memory.
      
      My main motivation for this commit is to set image::next and
      image_desc::next to NULL automatically in the next commit.
      Signed-off-by: default avatarMasahiro Yamada <yamada.masahiro@socionext.com>
      696ccba6
  17. 30 Dec, 2016 5 commits
  18. 05 Dec, 2016 4 commits
  19. 26 Oct, 2016 1 commit
  20. 18 Oct, 2016 1 commit
    • dp-arm's avatar
      fiptool: Link `toc_entry` and `image` structures via UUID · b04efcce
      dp-arm authored
      
      
      The `toc_entry` and `image` data structures had a cyclic
      relationship.  This patch removes the explicit dependencies and introduces
      functions to link them via the UUID.
      
      This change highlights the intent of the code better and makes it more
      flexible for future enhancements.
      
      Change-Id: I0c3dd7bfda2a631a3827c8ba4831849c500affe9
      Signed-off-by: default avatardp-arm <dimitris.papastamos@arm.com>
      b04efcce
  21. 15 Sep, 2016 1 commit
    • dp-arm's avatar
      fiptool: Invoke command specific usage function · 85ee2778
      dp-arm authored
      Instead of always calling the top level usage function when an
      error is detected, call the command-specific usage function.
      
      For example running `fiptool create` will produce the same output
      as `fiptool help create`.  This is more convenient for the user
      when they make a mistake.
      
      Change-Id: I60178ab89d47adf93cdfe6d8b5d5f778a5ea3bca
      85ee2778
  22. 12 Sep, 2016 1 commit
    • dp-arm's avatar
      fiptool: Add support for printing the sha256 digest with info command · 9df69ba3
      dp-arm authored
      This feature allows one to quickly verify that the expected
      image is contained in the FIP without extracting the image and
      running sha256sum(1) on it.
      
      The sha256 digest is only shown when the verbose flag is used.
      
      This change requires libssl-dev to be installed in order to build
      Trusted Firmware. Previously, libssl-dev was optionally needed only
      to support Trusted Board Boot configurations.
      
      Fixes ARM-Software/tf-issues#124
      
      Change-Id: Ifb1408d17f483d482bb270a589ee74add25ec5a6
      9df69ba3