binary-manager 0.0.2__tar.gz → 0.0.4__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (132) hide show
  1. {binary-manager-0.0.2 → binary-manager-0.0.4}/PKG-INFO +216 -7
  2. binary-manager-0.0.2/src/binary_manager.egg-info/PKG-INFO → binary-manager-0.0.4/README.rst +211 -19
  3. {binary-manager-0.0.2 → binary-manager-0.0.4}/pyproject.toml +3 -3
  4. binary-manager-0.0.2/README.rst → binary-manager-0.0.4/src/binary_manager.egg-info/PKG-INFO +228 -5
  5. {binary-manager-0.0.2 → binary-manager-0.0.4}/src/binary_manager.egg-info/SOURCES.txt +15 -1
  6. binary-manager-0.0.4/src/binary_manager.egg-info/requires.txt +3 -0
  7. {binary-manager-0.0.2 → binary-manager-0.0.4}/src/binman/bintool.py +24 -13
  8. binary-manager-0.0.4/src/binman/btool/bootgen.py +137 -0
  9. binary-manager-0.0.4/src/binman/btool/fdt_add_pubkey.py +67 -0
  10. {binary-manager-0.0.2 → binary-manager-0.0.4}/src/binman/btool/fiptool.py +1 -1
  11. {binary-manager-0.0.2 → binary-manager-0.0.4}/src/binman/btool/futility.py +1 -1
  12. binary-manager-0.0.4/src/binman/btool/mkeficapsule.py +127 -0
  13. binary-manager-0.0.4/src/binman/btool/openssl.py +340 -0
  14. {binary-manager-0.0.2 → binary-manager-0.0.4}/src/binman/cbfs_util.py +72 -53
  15. {binary-manager-0.0.2 → binary-manager-0.0.4}/src/binman/cmdline.py +28 -7
  16. {binary-manager-0.0.2 → binary-manager-0.0.4}/src/binman/control.py +128 -21
  17. {binary-manager-0.0.2 → binary-manager-0.0.4}/src/binman/elf.py +17 -6
  18. {binary-manager-0.0.2 → binary-manager-0.0.4}/src/binman/entry.py +39 -6
  19. {binary-manager-0.0.2 → binary-manager-0.0.4}/src/binman/etype/atf_fip.py +1 -1
  20. {binary-manager-0.0.2 → binary-manager-0.0.4}/src/binman/etype/blob.py +1 -1
  21. {binary-manager-0.0.2 → binary-manager-0.0.4}/src/binman/etype/blob_dtb.py +1 -1
  22. {binary-manager-0.0.2 → binary-manager-0.0.4}/src/binman/etype/blob_ext.py +0 -8
  23. {binary-manager-0.0.2 → binary-manager-0.0.4}/src/binman/etype/blob_phase.py +5 -0
  24. {binary-manager-0.0.2 → binary-manager-0.0.4}/src/binman/etype/cbfs.py +1 -1
  25. binary-manager-0.0.4/src/binman/etype/efi_capsule.py +155 -0
  26. binary-manager-0.0.4/src/binman/etype/efi_empty_capsule.py +86 -0
  27. binary-manager-0.0.4/src/binman/etype/encrypted.py +138 -0
  28. {binary-manager-0.0.2 → binary-manager-0.0.4}/src/binman/etype/fit.py +40 -1
  29. {binary-manager-0.0.2 → binary-manager-0.0.4}/src/binman/etype/fmap.py +13 -2
  30. {binary-manager-0.0.2 → binary-manager-0.0.4}/src/binman/etype/mkimage.py +75 -53
  31. {binary-manager-0.0.2 → binary-manager-0.0.4}/src/binman/etype/pre_load.py +3 -3
  32. binary-manager-0.0.4/src/binman/etype/rockchip_tpl.py +20 -0
  33. {binary-manager-0.0.2 → binary-manager-0.0.4}/src/binman/etype/section.py +69 -23
  34. binary-manager-0.0.4/src/binman/etype/ti_board_config.py +259 -0
  35. binary-manager-0.0.4/src/binman/etype/ti_secure.py +78 -0
  36. binary-manager-0.0.4/src/binman/etype/ti_secure_rom.py +256 -0
  37. {binary-manager-0.0.2 → binary-manager-0.0.4}/src/binman/etype/u_boot_spl_bss_pad.py +1 -1
  38. binary-manager-0.0.4/src/binman/etype/u_boot_spl_pubkey_dtb.py +112 -0
  39. {binary-manager-0.0.2 → binary-manager-0.0.4}/src/binman/etype/u_boot_spl_with_ucode_ptr.py +1 -1
  40. {binary-manager-0.0.2 → binary-manager-0.0.4}/src/binman/etype/u_boot_tpl_bss_pad.py +1 -1
  41. {binary-manager-0.0.2 → binary-manager-0.0.4}/src/binman/etype/u_boot_tpl_with_ucode_ptr.py +1 -1
  42. {binary-manager-0.0.2 → binary-manager-0.0.4}/src/binman/etype/u_boot_vpl_bss_pad.py +1 -1
  43. {binary-manager-0.0.2 → binary-manager-0.0.4}/src/binman/etype/u_boot_with_ucode_ptr.py +2 -2
  44. binary-manager-0.0.4/src/binman/etype/x509_cert.py +164 -0
  45. binary-manager-0.0.4/src/binman/etype/xilinx_bootgen.py +225 -0
  46. {binary-manager-0.0.2 → binary-manager-0.0.4}/src/binman/fmap_util.py +3 -0
  47. {binary-manager-0.0.2 → binary-manager-0.0.4}/src/binman/image.py +2 -0
  48. {binary-manager-0.0.2 → binary-manager-0.0.4}/src/binman/state.py +3 -3
  49. binary-manager-0.0.2/src/binary_manager.egg-info/requires.txt +0 -3
  50. {binary-manager-0.0.2 → binary-manager-0.0.4}/LICENSE +0 -0
  51. {binary-manager-0.0.2 → binary-manager-0.0.4}/setup.cfg +0 -0
  52. {binary-manager-0.0.2 → binary-manager-0.0.4}/src/binary_manager.egg-info/dependency_links.txt +0 -0
  53. {binary-manager-0.0.2 → binary-manager-0.0.4}/src/binary_manager.egg-info/entry_points.txt +0 -0
  54. {binary-manager-0.0.2 → binary-manager-0.0.4}/src/binary_manager.egg-info/top_level.txt +0 -0
  55. {binary-manager-0.0.2 → binary-manager-0.0.4}/src/binman/__init__.py +0 -0
  56. {binary-manager-0.0.2 → binary-manager-0.0.4}/src/binman/btool/_testing.py +0 -0
  57. {binary-manager-0.0.2 → binary-manager-0.0.4}/src/binman/btool/btool_gzip.py +0 -0
  58. {binary-manager-0.0.2 → binary-manager-0.0.4}/src/binman/btool/bzip2.py +0 -0
  59. {binary-manager-0.0.2 → binary-manager-0.0.4}/src/binman/btool/cbfstool.py +0 -0
  60. {binary-manager-0.0.2 → binary-manager-0.0.4}/src/binman/btool/ifwitool.py +0 -0
  61. {binary-manager-0.0.2 → binary-manager-0.0.4}/src/binman/btool/lz4.py +0 -0
  62. {binary-manager-0.0.2 → binary-manager-0.0.4}/src/binman/btool/lzma_alone.py +0 -0
  63. {binary-manager-0.0.2 → binary-manager-0.0.4}/src/binman/btool/lzop.py +0 -0
  64. {binary-manager-0.0.2 → binary-manager-0.0.4}/src/binman/btool/mkimage.py +0 -0
  65. {binary-manager-0.0.2 → binary-manager-0.0.4}/src/binman/btool/xz.py +0 -0
  66. {binary-manager-0.0.2 → binary-manager-0.0.4}/src/binman/btool/zstd.py +0 -0
  67. {binary-manager-0.0.2 → binary-manager-0.0.4}/src/binman/etype/_testing.py +0 -0
  68. {binary-manager-0.0.2 → binary-manager-0.0.4}/src/binman/etype/atf_bl31.py +0 -0
  69. {binary-manager-0.0.2 → binary-manager-0.0.4}/src/binman/etype/blob_ext_list.py +0 -0
  70. {binary-manager-0.0.2 → binary-manager-0.0.4}/src/binman/etype/blob_named_by_arg.py +0 -0
  71. {binary-manager-0.0.2 → binary-manager-0.0.4}/src/binman/etype/collection.py +0 -0
  72. {binary-manager-0.0.2 → binary-manager-0.0.4}/src/binman/etype/cros_ec_rw.py +0 -0
  73. {binary-manager-0.0.2 → binary-manager-0.0.4}/src/binman/etype/fdtmap.py +0 -0
  74. {binary-manager-0.0.2 → binary-manager-0.0.4}/src/binman/etype/files.py +0 -0
  75. {binary-manager-0.0.2 → binary-manager-0.0.4}/src/binman/etype/fill.py +0 -0
  76. {binary-manager-0.0.2 → binary-manager-0.0.4}/src/binman/etype/gbb.py +0 -0
  77. {binary-manager-0.0.2 → binary-manager-0.0.4}/src/binman/etype/image_header.py +0 -0
  78. {binary-manager-0.0.2 → binary-manager-0.0.4}/src/binman/etype/intel_cmc.py +0 -0
  79. {binary-manager-0.0.2 → binary-manager-0.0.4}/src/binman/etype/intel_descriptor.py +0 -0
  80. {binary-manager-0.0.2 → binary-manager-0.0.4}/src/binman/etype/intel_fit.py +0 -0
  81. {binary-manager-0.0.2 → binary-manager-0.0.4}/src/binman/etype/intel_fit_ptr.py +0 -0
  82. {binary-manager-0.0.2 → binary-manager-0.0.4}/src/binman/etype/intel_fsp.py +0 -0
  83. {binary-manager-0.0.2 → binary-manager-0.0.4}/src/binman/etype/intel_fsp_m.py +0 -0
  84. {binary-manager-0.0.2 → binary-manager-0.0.4}/src/binman/etype/intel_fsp_s.py +0 -0
  85. {binary-manager-0.0.2 → binary-manager-0.0.4}/src/binman/etype/intel_fsp_t.py +0 -0
  86. {binary-manager-0.0.2 → binary-manager-0.0.4}/src/binman/etype/intel_ifwi.py +0 -0
  87. {binary-manager-0.0.2 → binary-manager-0.0.4}/src/binman/etype/intel_me.py +0 -0
  88. {binary-manager-0.0.2 → binary-manager-0.0.4}/src/binman/etype/intel_mrc.py +0 -0
  89. {binary-manager-0.0.2 → binary-manager-0.0.4}/src/binman/etype/intel_refcode.py +0 -0
  90. {binary-manager-0.0.2 → binary-manager-0.0.4}/src/binman/etype/intel_vbt.py +0 -0
  91. {binary-manager-0.0.2 → binary-manager-0.0.4}/src/binman/etype/intel_vga.py +0 -0
  92. {binary-manager-0.0.2 → binary-manager-0.0.4}/src/binman/etype/null.py +0 -0
  93. {binary-manager-0.0.2 → binary-manager-0.0.4}/src/binman/etype/opensbi.py +0 -0
  94. {binary-manager-0.0.2 → binary-manager-0.0.4}/src/binman/etype/powerpc_mpc85xx_bootpg_resetvec.py +0 -0
  95. {binary-manager-0.0.2 → binary-manager-0.0.4}/src/binman/etype/scp.py +0 -0
  96. {binary-manager-0.0.2 → binary-manager-0.0.4}/src/binman/etype/tee_os.py +0 -0
  97. {binary-manager-0.0.2 → binary-manager-0.0.4}/src/binman/etype/text.py +0 -0
  98. {binary-manager-0.0.2 → binary-manager-0.0.4}/src/binman/etype/u_boot.py +0 -0
  99. {binary-manager-0.0.2 → binary-manager-0.0.4}/src/binman/etype/u_boot_dtb.py +0 -0
  100. {binary-manager-0.0.2 → binary-manager-0.0.4}/src/binman/etype/u_boot_dtb_with_ucode.py +0 -0
  101. {binary-manager-0.0.2 → binary-manager-0.0.4}/src/binman/etype/u_boot_elf.py +0 -0
  102. {binary-manager-0.0.2 → binary-manager-0.0.4}/src/binman/etype/u_boot_env.py +0 -0
  103. {binary-manager-0.0.2 → binary-manager-0.0.4}/src/binman/etype/u_boot_expanded.py +0 -0
  104. {binary-manager-0.0.2 → binary-manager-0.0.4}/src/binman/etype/u_boot_img.py +0 -0
  105. {binary-manager-0.0.2 → binary-manager-0.0.4}/src/binman/etype/u_boot_nodtb.py +0 -0
  106. {binary-manager-0.0.2 → binary-manager-0.0.4}/src/binman/etype/u_boot_spl.py +0 -0
  107. {binary-manager-0.0.2 → binary-manager-0.0.4}/src/binman/etype/u_boot_spl_dtb.py +0 -0
  108. {binary-manager-0.0.2 → binary-manager-0.0.4}/src/binman/etype/u_boot_spl_elf.py +0 -0
  109. {binary-manager-0.0.2 → binary-manager-0.0.4}/src/binman/etype/u_boot_spl_expanded.py +0 -0
  110. {binary-manager-0.0.2 → binary-manager-0.0.4}/src/binman/etype/u_boot_spl_nodtb.py +0 -0
  111. {binary-manager-0.0.2 → binary-manager-0.0.4}/src/binman/etype/u_boot_tpl.py +0 -0
  112. {binary-manager-0.0.2 → binary-manager-0.0.4}/src/binman/etype/u_boot_tpl_dtb.py +0 -0
  113. {binary-manager-0.0.2 → binary-manager-0.0.4}/src/binman/etype/u_boot_tpl_dtb_with_ucode.py +0 -0
  114. {binary-manager-0.0.2 → binary-manager-0.0.4}/src/binman/etype/u_boot_tpl_elf.py +0 -0
  115. {binary-manager-0.0.2 → binary-manager-0.0.4}/src/binman/etype/u_boot_tpl_expanded.py +0 -0
  116. {binary-manager-0.0.2 → binary-manager-0.0.4}/src/binman/etype/u_boot_tpl_nodtb.py +0 -0
  117. {binary-manager-0.0.2 → binary-manager-0.0.4}/src/binman/etype/u_boot_ucode.py +0 -0
  118. {binary-manager-0.0.2 → binary-manager-0.0.4}/src/binman/etype/u_boot_vpl.py +0 -0
  119. {binary-manager-0.0.2 → binary-manager-0.0.4}/src/binman/etype/u_boot_vpl_dtb.py +0 -0
  120. {binary-manager-0.0.2 → binary-manager-0.0.4}/src/binman/etype/u_boot_vpl_elf.py +0 -0
  121. {binary-manager-0.0.2 → binary-manager-0.0.4}/src/binman/etype/u_boot_vpl_expanded.py +0 -0
  122. {binary-manager-0.0.2 → binary-manager-0.0.4}/src/binman/etype/u_boot_vpl_nodtb.py +0 -0
  123. {binary-manager-0.0.2 → binary-manager-0.0.4}/src/binman/etype/vblock.py +0 -0
  124. {binary-manager-0.0.2 → binary-manager-0.0.4}/src/binman/etype/x86_reset16.py +0 -0
  125. {binary-manager-0.0.2 → binary-manager-0.0.4}/src/binman/etype/x86_reset16_spl.py +0 -0
  126. {binary-manager-0.0.2 → binary-manager-0.0.4}/src/binman/etype/x86_reset16_tpl.py +0 -0
  127. {binary-manager-0.0.2 → binary-manager-0.0.4}/src/binman/etype/x86_start16.py +0 -0
  128. {binary-manager-0.0.2 → binary-manager-0.0.4}/src/binman/etype/x86_start16_spl.py +0 -0
  129. {binary-manager-0.0.2 → binary-manager-0.0.4}/src/binman/etype/x86_start16_tpl.py +0 -0
  130. {binary-manager-0.0.2 → binary-manager-0.0.4}/src/binman/fip_util.py +0 -0
  131. {binary-manager-0.0.2 → binary-manager-0.0.4}/src/binman/main.py +0 -0
  132. {binary-manager-0.0.2 → binary-manager-0.0.4}/src/binman/setup.py +0 -0
@@ -1,9 +1,9 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: binary-manager
3
- Version: 0.0.2
3
+ Version: 0.0.4
4
4
  Summary: Binman firmware-packaging tool
5
5
  Author-email: Simon Glass <sjg@chromium.org>
6
- Project-URL: Homepage, https://u-boot.readthedocs.io/en/latest/develop/package/index.html
6
+ Project-URL: Homepage, https://docs.u-boot.org/en/latest/develop/package/index.html
7
7
  Project-URL: Bug Tracker, https://source.denx.de/groups/u-boot/-/issues
8
8
  Classifier: Programming Language :: Python :: 3
9
9
  Classifier: License :: OSI Approved :: GNU General Public License v2 or later (GPLv2+)
@@ -11,6 +11,9 @@ Classifier: Operating System :: OS Independent
11
11
  Requires-Python: >=3.7
12
12
  Description-Content-Type: text/x-rst
13
13
  License-File: LICENSE
14
+ Requires-Dist: pylibfdt
15
+ Requires-Dist: u_boot_pylib>=0.0.4
16
+ Requires-Dist: dtoc>=0.0.4
14
17
 
15
18
  .. SPDX-License-Identifier: GPL-2.0+
16
19
  .. Copyright (c) 2016 Google, Inc
@@ -420,9 +423,9 @@ system-library directory, replace the last line with:
420
423
  Running binman
421
424
  --------------
422
425
 
423
- Type::
426
+ Type:
424
427
 
425
- .. code-block: bash
428
+ .. code-block:: bash
426
429
 
427
430
  make NO_PYTHON=1 PREFIX=/ install
428
431
  binman build -b <board_name>
@@ -741,6 +744,13 @@ optional:
741
744
  Note that missing, optional blobs do not produce a non-zero exit code from
742
745
  binman, although it does show a warning about the missing external blob.
743
746
 
747
+ insert-template:
748
+ This is not strictly speaking an entry property, since it is processed early
749
+ in Binman before the entries are read. It is a list of phandles of nodes to
750
+ include in the current (target) node. For each node, its subnodes and their
751
+ properties are brought into the target node. See Templates_ below for
752
+ more information.
753
+
744
754
  The attributes supported for images and sections are described below. Several
745
755
  are similar to those for entries.
746
756
 
@@ -845,6 +855,13 @@ write-symbols:
845
855
  binman. This is automatic for certain entry types, e.g. `u-boot-spl`. See
846
856
  binman_syms_ for more information.
847
857
 
858
+ no-write-symbols:
859
+ Disables symbol writing for this entry. This can be used in entry types
860
+ where symbol writing is automatic. For example, if `u-boot-spl` refers to
861
+ the `u_boot_any_image_pos` symbol but U-Boot is not available in the image
862
+ containing SPL, this can be used to disable the writing. Quite likely this
863
+ indicates a bug in your setup.
864
+
848
865
  elf-filename:
849
866
  Sets the file name of a blob's associated ELF file. For example, if the
850
867
  blob is `zephyr.bin` then the ELF file may be `zephyr.elf`. This allows
@@ -865,6 +882,14 @@ offset-from-elf:
865
882
  is the symbol to lookup (relative to elf-base-sym) and <offset> is an offset
866
883
  to add to that value.
867
884
 
885
+ preserve:
886
+ Indicates that this entry should be preserved by any firmware updates. This
887
+ flag should be checked by the updater when it is deciding which entries to
888
+ update. This flag is normally attached to sections but can be attached to
889
+ a single entry in a section if the updater supports it. Not that binman
890
+ itself has no control over the updater's behaviour, so this is just a
891
+ signal. It is not enforced by binman.
892
+
868
893
  Examples of the above options can be found in the tests. See the
869
894
  tools/binman/test directory.
870
895
 
@@ -1171,6 +1196,110 @@ If you are having trouble figuring out what is going on, you can use
1171
1196
  arch/arm/dts/u-boot.dtsi ... found: "arch/arm/dts/juno-r2-u-boot.dtsi"
1172
1197
 
1173
1198
 
1199
+ Templates
1200
+ =========
1201
+
1202
+ Sometimes multiple images need to be created which have all have a common
1203
+ part. For example, a board may generate SPI and eMMC images which both include
1204
+ a FIT. Since the FIT includes many entries, it is tedious to repeat them twice
1205
+ in the image description.
1206
+
1207
+ Templates provide a simple way to handle this::
1208
+
1209
+ binman {
1210
+ multiple-images;
1211
+ common_part: template-1 {
1212
+ some-property;
1213
+ fit {
1214
+ ... lots of entries in here
1215
+ };
1216
+
1217
+ text {
1218
+ text = "base image";
1219
+ };
1220
+ };
1221
+
1222
+ spi-image {
1223
+ filename = "image-spi.bin";
1224
+ insert-template = <&fit>;
1225
+
1226
+ /* things specific to SPI follow */
1227
+ footer {
1228
+ ];
1229
+
1230
+ text {
1231
+ text = "SPI image";
1232
+ };
1233
+ };
1234
+
1235
+ mmc-image {
1236
+ filename = "image-mmc.bin";
1237
+ insert-template = <&fit>;
1238
+
1239
+ /* things specific to MMC follow */
1240
+ footer {
1241
+ ];
1242
+
1243
+ text {
1244
+ text = "MMC image";
1245
+ };
1246
+ };
1247
+ };
1248
+
1249
+ The template node name must start with 'template', so it is not considered to be
1250
+ an image itself.
1251
+
1252
+ The mechanism is very simple. For each phandle in the 'insert-templates'
1253
+ property, the source node is looked up. Then the subnodes of that source node
1254
+ are copied into the target node, i.e. the one containing the `insert-template`
1255
+ property.
1256
+
1257
+ If the target node has a node with the same name as a template, its properties
1258
+ override corresponding properties in the template. This allows the template to
1259
+ be uses as a base, with the node providing updates to the properties as needed.
1260
+ The overriding happens recursively.
1261
+
1262
+ Template nodes appear first in each node that they are inserted into and
1263
+ ordering of template nodes is preserved. Other nodes come afterwards. If a
1264
+ template node also appears in the target node, then the template node sets the
1265
+ order. Thus the template can be used to set the ordering, even if the target
1266
+ node provides all the properties. In the above example, `fit` and `text` appear
1267
+ first in the `spi-image` and `mmc-image` images, followed by `footer`.
1268
+
1269
+ Where there are multiple template nodes, they are inserted in that order. so
1270
+ the first template node appears first, then the second.
1271
+
1272
+ Properties in the template node are inserted into the destination node if they
1273
+ do not exist there. In the example above, `some-property` is added to each of
1274
+ `spi-image` and `mmc-image`.
1275
+
1276
+ Note that template nodes are removed from the binman description after
1277
+ processing and before binman builds the image descriptions.
1278
+
1279
+ The initial devicetree produced by the templating process is written to the
1280
+ `u-boot.dtb.tmpl1` file. This can be useful to see what is going on if there is
1281
+ a failure before the final `u-boot.dtb.out` file is written. A second
1282
+ `u-boot.dtb.tmpl2` file is written when the templates themselves are removed.
1283
+
1284
+ Dealing with phandles
1285
+ ---------------------
1286
+
1287
+ Templates can contain phandles and these are copied to the destination node.
1288
+ However this should be used with care, since if a template is instantiated twice
1289
+ then the phandle will be copied twice, resulting in a devicetree with duplicate
1290
+ phandles, i.e. the same phandle used by two different nodes. Binman detects this
1291
+ situation and produces an error, for example::
1292
+
1293
+ Duplicate phandle 1 in nodes /binman/image/fit/images/atf/atf-bl31 and
1294
+ /binman/image-2/fit/images/atf/atf-bl31
1295
+
1296
+ In this case an atf-bl31 node containing a phandle has been copied into two
1297
+ different target nodes, resulting in the same phandle for each. See
1298
+ testTemplatePhandleDup() for the test case.
1299
+
1300
+ The solution is typically to put the phandles in the corresponding target nodes
1301
+ (one for each) and remove the phandle from the template.
1302
+
1174
1303
  Updating an ELF file
1175
1304
  ====================
1176
1305
 
@@ -1352,6 +1481,38 @@ You can also replace just a selection of entries::
1352
1481
 
1353
1482
  $ binman replace -i image.bin "*u-boot*" -I indir
1354
1483
 
1484
+ It is possible to replace whole sections as well, but in that case any
1485
+ information about entries within the section may become outdated. This is
1486
+ because Binman cannot know whether things have moved around or resized within
1487
+ the section, once you have updated its data.
1488
+
1489
+ Technical note: With 'allow-repack', Binman writes information about the
1490
+ original offset and size properties of each entry, if any were specified, in
1491
+ the 'orig-offset' and 'orig-size' properties. This allows Binman to distinguish
1492
+ between an entry which ended up being packed at an offset (or assigned a size)
1493
+ and an entry which had a particular offset / size requested in the Binman
1494
+ configuration. Where are particular offset / size was requested, this is treated
1495
+ as set in stone, so Binman will ensure it doesn't change. Without this feature,
1496
+ repacking an entry might cause it to disobey the original constraints provided
1497
+ when it was created.
1498
+
1499
+
1500
+ Signing FIT container with private key in an image
1501
+ --------------------------------------------------
1502
+
1503
+ You can sign FIT container with private key in your image.
1504
+ For example::
1505
+
1506
+ $ binman sign -i image.bin -k privatekey -a sha256,rsa4096 fit
1507
+
1508
+ binman will extract FIT container, sign and replace it immediately.
1509
+
1510
+ If you want to sign and replace FIT container in place::
1511
+
1512
+ $ binman sign -i image.bin -k privatekey -a sha256,rsa4096 -f fit.fit fit
1513
+
1514
+ which will sign FIT container with private key and replace it immediately
1515
+ inside your image.
1355
1516
 
1356
1517
  .. _`BinmanLogging`:
1357
1518
 
@@ -1433,6 +1594,16 @@ You can also use `--fetch all` to fetch all tools or `--fetch <tool>` to fetch
1433
1594
  a particular tool. Some tools are built from source code, in which case you will
1434
1595
  need to have at least the `build-essential` and `git` packages installed.
1435
1596
 
1597
+ Tools are fetched into the `~/.binman-tools` directory. This directory is
1598
+ automatically added to the toolpath so there is no need to use `--toolpath` to
1599
+ specify it. If you want to use these tools outside binman, you may want to
1600
+ add this directory to your `PATH`. For example, if you use bash, add this to
1601
+ the end of `.bashrc`::
1602
+
1603
+ PATH="$HOME/.binman-tools:$PATH"
1604
+
1605
+ To select a custom directory, use the `--tooldir` option.
1606
+
1436
1607
  Bintool Documentation
1437
1608
  =====================
1438
1609
 
@@ -1450,8 +1621,9 @@ Binman commands and arguments
1450
1621
 
1451
1622
  Usage::
1452
1623
 
1453
- binman [-h] [-B BUILD_DIR] [-D] [-H] [--toolpath TOOLPATH] [-T THREADS]
1454
- [--test-section-timeout] [-v VERBOSITY] [-V]
1624
+ binman [-h] [-B BUILD_DIR] [-D] [--tooldir TOOLDIR] [-H]
1625
+ [--toolpath TOOLPATH] [-T THREADS] [--test-section-timeout]
1626
+ [-v VERBOSITY] [-V]
1455
1627
  {build,bintool-docs,entry-docs,ls,extract,replace,test,tool} ...
1456
1628
 
1457
1629
  Binman provides the following commands:
@@ -1476,11 +1648,13 @@ Options:
1476
1648
  -D, --debug
1477
1649
  Enabling debugging (provides a full traceback on error)
1478
1650
 
1651
+ --tooldir TOOLDIR Set the directory to store tools
1652
+
1479
1653
  -H, --full-help
1480
1654
  Display the README file
1481
1655
 
1482
1656
  --toolpath TOOLPATH
1483
- Add a path to the directories containing tools
1657
+ Add a path to the list of directories containing tools
1484
1658
 
1485
1659
  -T THREADS, --threads THREADS
1486
1660
  Number of threads to use (0=single-thread). Note that -T0 is useful for
@@ -1688,6 +1862,12 @@ Options:
1688
1862
  -m, --map
1689
1863
  Output a map file for the updated image
1690
1864
 
1865
+ -O OUTDIR, --outdir OUTDIR
1866
+ Path to directory to use for intermediate and output files
1867
+
1868
+ -p, --preserve
1869
+ Preserve temporary output directory even if option -O is not given
1870
+
1691
1871
  This replaces one or more entries in an existing image. See
1692
1872
  `Replacing files in an image`_.
1693
1873
 
@@ -1720,6 +1900,35 @@ Options:
1720
1900
  output directory if a single test is run (pass test name at the end of the
1721
1901
  command line
1722
1902
 
1903
+ binman sign
1904
+ -----------
1905
+
1906
+ Usage::
1907
+
1908
+ binman sign [-h] -a ALGO [-f FILE] -i IMAGE -k KEY [paths ...]
1909
+
1910
+ positional arguments:
1911
+
1912
+ paths
1913
+ Paths within file to sign (wildcard)
1914
+
1915
+ options:
1916
+
1917
+ -h, --help
1918
+ show this help message and exit
1919
+
1920
+ -a ALGO, --algo ALGO
1921
+ Hash algorithm e.g. sha256,rsa4096
1922
+
1923
+ -f FILE, --file FILE
1924
+ Input filename to sign
1925
+
1926
+ -i IMAGE, --image IMAGE
1927
+ Image filename to update
1928
+
1929
+ -k KEY, --key KEY
1930
+ Private key file for signing
1931
+
1723
1932
  binman tool
1724
1933
  -----------
1725
1934
 
@@ -1,17 +1,3 @@
1
- Metadata-Version: 2.1
2
- Name: binary-manager
3
- Version: 0.0.2
4
- Summary: Binman firmware-packaging tool
5
- Author-email: Simon Glass <sjg@chromium.org>
6
- Project-URL: Homepage, https://u-boot.readthedocs.io/en/latest/develop/package/index.html
7
- Project-URL: Bug Tracker, https://source.denx.de/groups/u-boot/-/issues
8
- Classifier: Programming Language :: Python :: 3
9
- Classifier: License :: OSI Approved :: GNU General Public License v2 or later (GPLv2+)
10
- Classifier: Operating System :: OS Independent
11
- Requires-Python: >=3.7
12
- Description-Content-Type: text/x-rst
13
- License-File: LICENSE
14
-
15
1
  .. SPDX-License-Identifier: GPL-2.0+
16
2
  .. Copyright (c) 2016 Google, Inc
17
3
 
@@ -420,9 +406,9 @@ system-library directory, replace the last line with:
420
406
  Running binman
421
407
  --------------
422
408
 
423
- Type::
409
+ Type:
424
410
 
425
- .. code-block: bash
411
+ .. code-block:: bash
426
412
 
427
413
  make NO_PYTHON=1 PREFIX=/ install
428
414
  binman build -b <board_name>
@@ -741,6 +727,13 @@ optional:
741
727
  Note that missing, optional blobs do not produce a non-zero exit code from
742
728
  binman, although it does show a warning about the missing external blob.
743
729
 
730
+ insert-template:
731
+ This is not strictly speaking an entry property, since it is processed early
732
+ in Binman before the entries are read. It is a list of phandles of nodes to
733
+ include in the current (target) node. For each node, its subnodes and their
734
+ properties are brought into the target node. See Templates_ below for
735
+ more information.
736
+
744
737
  The attributes supported for images and sections are described below. Several
745
738
  are similar to those for entries.
746
739
 
@@ -845,6 +838,13 @@ write-symbols:
845
838
  binman. This is automatic for certain entry types, e.g. `u-boot-spl`. See
846
839
  binman_syms_ for more information.
847
840
 
841
+ no-write-symbols:
842
+ Disables symbol writing for this entry. This can be used in entry types
843
+ where symbol writing is automatic. For example, if `u-boot-spl` refers to
844
+ the `u_boot_any_image_pos` symbol but U-Boot is not available in the image
845
+ containing SPL, this can be used to disable the writing. Quite likely this
846
+ indicates a bug in your setup.
847
+
848
848
  elf-filename:
849
849
  Sets the file name of a blob's associated ELF file. For example, if the
850
850
  blob is `zephyr.bin` then the ELF file may be `zephyr.elf`. This allows
@@ -865,6 +865,14 @@ offset-from-elf:
865
865
  is the symbol to lookup (relative to elf-base-sym) and <offset> is an offset
866
866
  to add to that value.
867
867
 
868
+ preserve:
869
+ Indicates that this entry should be preserved by any firmware updates. This
870
+ flag should be checked by the updater when it is deciding which entries to
871
+ update. This flag is normally attached to sections but can be attached to
872
+ a single entry in a section if the updater supports it. Not that binman
873
+ itself has no control over the updater's behaviour, so this is just a
874
+ signal. It is not enforced by binman.
875
+
868
876
  Examples of the above options can be found in the tests. See the
869
877
  tools/binman/test directory.
870
878
 
@@ -1171,6 +1179,110 @@ If you are having trouble figuring out what is going on, you can use
1171
1179
  arch/arm/dts/u-boot.dtsi ... found: "arch/arm/dts/juno-r2-u-boot.dtsi"
1172
1180
 
1173
1181
 
1182
+ Templates
1183
+ =========
1184
+
1185
+ Sometimes multiple images need to be created which have all have a common
1186
+ part. For example, a board may generate SPI and eMMC images which both include
1187
+ a FIT. Since the FIT includes many entries, it is tedious to repeat them twice
1188
+ in the image description.
1189
+
1190
+ Templates provide a simple way to handle this::
1191
+
1192
+ binman {
1193
+ multiple-images;
1194
+ common_part: template-1 {
1195
+ some-property;
1196
+ fit {
1197
+ ... lots of entries in here
1198
+ };
1199
+
1200
+ text {
1201
+ text = "base image";
1202
+ };
1203
+ };
1204
+
1205
+ spi-image {
1206
+ filename = "image-spi.bin";
1207
+ insert-template = <&fit>;
1208
+
1209
+ /* things specific to SPI follow */
1210
+ footer {
1211
+ ];
1212
+
1213
+ text {
1214
+ text = "SPI image";
1215
+ };
1216
+ };
1217
+
1218
+ mmc-image {
1219
+ filename = "image-mmc.bin";
1220
+ insert-template = <&fit>;
1221
+
1222
+ /* things specific to MMC follow */
1223
+ footer {
1224
+ ];
1225
+
1226
+ text {
1227
+ text = "MMC image";
1228
+ };
1229
+ };
1230
+ };
1231
+
1232
+ The template node name must start with 'template', so it is not considered to be
1233
+ an image itself.
1234
+
1235
+ The mechanism is very simple. For each phandle in the 'insert-templates'
1236
+ property, the source node is looked up. Then the subnodes of that source node
1237
+ are copied into the target node, i.e. the one containing the `insert-template`
1238
+ property.
1239
+
1240
+ If the target node has a node with the same name as a template, its properties
1241
+ override corresponding properties in the template. This allows the template to
1242
+ be uses as a base, with the node providing updates to the properties as needed.
1243
+ The overriding happens recursively.
1244
+
1245
+ Template nodes appear first in each node that they are inserted into and
1246
+ ordering of template nodes is preserved. Other nodes come afterwards. If a
1247
+ template node also appears in the target node, then the template node sets the
1248
+ order. Thus the template can be used to set the ordering, even if the target
1249
+ node provides all the properties. In the above example, `fit` and `text` appear
1250
+ first in the `spi-image` and `mmc-image` images, followed by `footer`.
1251
+
1252
+ Where there are multiple template nodes, they are inserted in that order. so
1253
+ the first template node appears first, then the second.
1254
+
1255
+ Properties in the template node are inserted into the destination node if they
1256
+ do not exist there. In the example above, `some-property` is added to each of
1257
+ `spi-image` and `mmc-image`.
1258
+
1259
+ Note that template nodes are removed from the binman description after
1260
+ processing and before binman builds the image descriptions.
1261
+
1262
+ The initial devicetree produced by the templating process is written to the
1263
+ `u-boot.dtb.tmpl1` file. This can be useful to see what is going on if there is
1264
+ a failure before the final `u-boot.dtb.out` file is written. A second
1265
+ `u-boot.dtb.tmpl2` file is written when the templates themselves are removed.
1266
+
1267
+ Dealing with phandles
1268
+ ---------------------
1269
+
1270
+ Templates can contain phandles and these are copied to the destination node.
1271
+ However this should be used with care, since if a template is instantiated twice
1272
+ then the phandle will be copied twice, resulting in a devicetree with duplicate
1273
+ phandles, i.e. the same phandle used by two different nodes. Binman detects this
1274
+ situation and produces an error, for example::
1275
+
1276
+ Duplicate phandle 1 in nodes /binman/image/fit/images/atf/atf-bl31 and
1277
+ /binman/image-2/fit/images/atf/atf-bl31
1278
+
1279
+ In this case an atf-bl31 node containing a phandle has been copied into two
1280
+ different target nodes, resulting in the same phandle for each. See
1281
+ testTemplatePhandleDup() for the test case.
1282
+
1283
+ The solution is typically to put the phandles in the corresponding target nodes
1284
+ (one for each) and remove the phandle from the template.
1285
+
1174
1286
  Updating an ELF file
1175
1287
  ====================
1176
1288
 
@@ -1352,6 +1464,38 @@ You can also replace just a selection of entries::
1352
1464
 
1353
1465
  $ binman replace -i image.bin "*u-boot*" -I indir
1354
1466
 
1467
+ It is possible to replace whole sections as well, but in that case any
1468
+ information about entries within the section may become outdated. This is
1469
+ because Binman cannot know whether things have moved around or resized within
1470
+ the section, once you have updated its data.
1471
+
1472
+ Technical note: With 'allow-repack', Binman writes information about the
1473
+ original offset and size properties of each entry, if any were specified, in
1474
+ the 'orig-offset' and 'orig-size' properties. This allows Binman to distinguish
1475
+ between an entry which ended up being packed at an offset (or assigned a size)
1476
+ and an entry which had a particular offset / size requested in the Binman
1477
+ configuration. Where are particular offset / size was requested, this is treated
1478
+ as set in stone, so Binman will ensure it doesn't change. Without this feature,
1479
+ repacking an entry might cause it to disobey the original constraints provided
1480
+ when it was created.
1481
+
1482
+
1483
+ Signing FIT container with private key in an image
1484
+ --------------------------------------------------
1485
+
1486
+ You can sign FIT container with private key in your image.
1487
+ For example::
1488
+
1489
+ $ binman sign -i image.bin -k privatekey -a sha256,rsa4096 fit
1490
+
1491
+ binman will extract FIT container, sign and replace it immediately.
1492
+
1493
+ If you want to sign and replace FIT container in place::
1494
+
1495
+ $ binman sign -i image.bin -k privatekey -a sha256,rsa4096 -f fit.fit fit
1496
+
1497
+ which will sign FIT container with private key and replace it immediately
1498
+ inside your image.
1355
1499
 
1356
1500
  .. _`BinmanLogging`:
1357
1501
 
@@ -1433,6 +1577,16 @@ You can also use `--fetch all` to fetch all tools or `--fetch <tool>` to fetch
1433
1577
  a particular tool. Some tools are built from source code, in which case you will
1434
1578
  need to have at least the `build-essential` and `git` packages installed.
1435
1579
 
1580
+ Tools are fetched into the `~/.binman-tools` directory. This directory is
1581
+ automatically added to the toolpath so there is no need to use `--toolpath` to
1582
+ specify it. If you want to use these tools outside binman, you may want to
1583
+ add this directory to your `PATH`. For example, if you use bash, add this to
1584
+ the end of `.bashrc`::
1585
+
1586
+ PATH="$HOME/.binman-tools:$PATH"
1587
+
1588
+ To select a custom directory, use the `--tooldir` option.
1589
+
1436
1590
  Bintool Documentation
1437
1591
  =====================
1438
1592
 
@@ -1450,8 +1604,9 @@ Binman commands and arguments
1450
1604
 
1451
1605
  Usage::
1452
1606
 
1453
- binman [-h] [-B BUILD_DIR] [-D] [-H] [--toolpath TOOLPATH] [-T THREADS]
1454
- [--test-section-timeout] [-v VERBOSITY] [-V]
1607
+ binman [-h] [-B BUILD_DIR] [-D] [--tooldir TOOLDIR] [-H]
1608
+ [--toolpath TOOLPATH] [-T THREADS] [--test-section-timeout]
1609
+ [-v VERBOSITY] [-V]
1455
1610
  {build,bintool-docs,entry-docs,ls,extract,replace,test,tool} ...
1456
1611
 
1457
1612
  Binman provides the following commands:
@@ -1476,11 +1631,13 @@ Options:
1476
1631
  -D, --debug
1477
1632
  Enabling debugging (provides a full traceback on error)
1478
1633
 
1634
+ --tooldir TOOLDIR Set the directory to store tools
1635
+
1479
1636
  -H, --full-help
1480
1637
  Display the README file
1481
1638
 
1482
1639
  --toolpath TOOLPATH
1483
- Add a path to the directories containing tools
1640
+ Add a path to the list of directories containing tools
1484
1641
 
1485
1642
  -T THREADS, --threads THREADS
1486
1643
  Number of threads to use (0=single-thread). Note that -T0 is useful for
@@ -1688,6 +1845,12 @@ Options:
1688
1845
  -m, --map
1689
1846
  Output a map file for the updated image
1690
1847
 
1848
+ -O OUTDIR, --outdir OUTDIR
1849
+ Path to directory to use for intermediate and output files
1850
+
1851
+ -p, --preserve
1852
+ Preserve temporary output directory even if option -O is not given
1853
+
1691
1854
  This replaces one or more entries in an existing image. See
1692
1855
  `Replacing files in an image`_.
1693
1856
 
@@ -1720,6 +1883,35 @@ Options:
1720
1883
  output directory if a single test is run (pass test name at the end of the
1721
1884
  command line
1722
1885
 
1886
+ binman sign
1887
+ -----------
1888
+
1889
+ Usage::
1890
+
1891
+ binman sign [-h] -a ALGO [-f FILE] -i IMAGE -k KEY [paths ...]
1892
+
1893
+ positional arguments:
1894
+
1895
+ paths
1896
+ Paths within file to sign (wildcard)
1897
+
1898
+ options:
1899
+
1900
+ -h, --help
1901
+ show this help message and exit
1902
+
1903
+ -a ALGO, --algo ALGO
1904
+ Hash algorithm e.g. sha256,rsa4096
1905
+
1906
+ -f FILE, --file FILE
1907
+ Input filename to sign
1908
+
1909
+ -i IMAGE, --image IMAGE
1910
+ Image filename to update
1911
+
1912
+ -k KEY, --key KEY
1913
+ Private key file for signing
1914
+
1723
1915
  binman tool
1724
1916
  -----------
1725
1917
 
@@ -4,11 +4,11 @@ build-backend = "setuptools.build_meta"
4
4
 
5
5
  [project]
6
6
  name = "binary-manager"
7
- version = "0.0.2"
7
+ version = "0.0.4"
8
8
  authors = [
9
9
  { name="Simon Glass", email="sjg@chromium.org" },
10
10
  ]
11
- dependencies = ["pylibfdt", "u_boot_pylib", "dtoc"]
11
+ dependencies = ["pylibfdt", "u_boot_pylib >= 0.0.4", "dtoc >= 0.0.4"]
12
12
  description = "Binman firmware-packaging tool"
13
13
  readme = "README.rst"
14
14
  requires-python = ">=3.7"
@@ -19,7 +19,7 @@ classifiers = [
19
19
  ]
20
20
 
21
21
  [project.urls]
22
- "Homepage" = "https://u-boot.readthedocs.io/en/latest/develop/package/index.html"
22
+ "Homepage" = "https://docs.u-boot.org/en/latest/develop/package/index.html"
23
23
  "Bug Tracker" = "https://source.denx.de/groups/u-boot/-/issues"
24
24
 
25
25
  [project.scripts]