binman: Support devicetree update in all entries
cover binman: Support devicetree update in all entries
U-Boot's various phase binaries actually comprise two or three pieces. For example, u-boot.bin has the executable followed by a devicetree.
With binman we want to be able to update that devicetree with full image information so that it is accessible to the executable. This is tricky if it is not clear where the devicetree starts.
At present this is handled manually, by creating two separate nodes in the binman definition, u-boot-nodtb and u-boot-dtb, so that binman sees them separately and can easily update the devicetree. But this is not very convenient.
Of course we could try to detect the devicetree in the binary, which is easy enough for binman to do. But this approach rapidly gets out of hand. When listing an existing image, should we show the devicetree separately? If we don't then binman cannot extract it by itself, only the whole binary. With SPL and TPL we may have BSS padding and this is harder to detect reliably. Also, a design goal of binman is to provide full information about what is in the image. The detection approach goes against that.
So instead it seems best to convert these multi-part binaries into a section with the component parts inside. We can do this automatically without affecting the operation of binman very much.
One implementation option for this feature would be to update the entries to behave in two different ways, i.e. either to act as a section containing sub-entries, or as a simple blob. However this is tricky because each entry has to use a particular base class. It is not reasonably possible for an entry to choose between using one base class (e.g. blob) or another (e.g. section), depending on a flag.
Instead, the approach taken in this series is to replace an entry type with an expanded version, so 'u-boot' becomes 'u-boot-expanded', for example. The new entry is a section containing two or three sub-entries.
A similar approach could be take to reduce the complexity of the x86 binman definition. The microcode is either in TPL, SPL or U-Boot proper, so an entryarg could control which of those is expanded to include microcode. That possibility is left for future consideration.
Simon Glass (20):
binman: Allow extracting to current directory
binman: Document ExpandEntries() in the base class
binman: Update entry help for files-align
binman: Tidy up underscores in entry documentation
binman: Correct the documentation for u-boot-spl-bss-pad
binman: Add support for u-boot-tpl-nodtb
binman: Add support for u-boot-tpl-bss-bad
binman: Allow using an an 'expanded' entry type
binman: Allow a way to select expanded entries
binman: Plumb expanded entries through fully
binman: Automatically expand phase binaries into sections
Makefile: Pass new entry args to binman
x86: Make use of binman expanded entries
x86: dts: Drop unused CONFIG_SPL
doc: Move UEFI down a bit
binman: doc: Add documentation to htmldocs
binman: Rearrange documentation into headings
binman: Incorporate entry documentation
binman: Drop repetitive heading for each entry
binman: Update various pieces of the documentation
Makefile | 8 +
arch/x86/dts/u-boot.dtsi | 17 +-
doc/index.rst | 25 +-
doc/package/binman | 1 +
doc/package/fit.rst | 8 +
doc/package/index.rst | 20 +
tools/binman/{README => README.rst} | 955 ++++++++++---------
tools/binman/cmdline.py | 5 +-
tools/binman/control.py | 28 +-
tools/binman/{README.entries => entries.rst} | 318 ++++--
tools/binman/entry.py | 71 +-
tools/binman/entry_test.py | 12 +
tools/binman/etype/atf_bl31.py | 2 +-
tools/binman/etype/blob.py | 4 +-
tools/binman/etype/blob_ext.py | 2 +-
tools/binman/etype/blob_phase.py | 51 +
tools/binman/etype/cbfs.py | 12 +-
tools/binman/etype/fdtmap.py | 30 +-
tools/binman/etype/files.py | 2 +-
tools/binman/etype/fit.py | 21 +-
tools/binman/etype/intel_cmc.py | 2 +-
tools/binman/etype/intel_fsp.py | 2 +-
tools/binman/etype/intel_fsp_m.py | 2 +-
tools/binman/etype/intel_fsp_s.py | 2 +-
tools/binman/etype/intel_fsp_t.py | 2 +-
tools/binman/etype/intel_ifwi.py | 10 +-
tools/binman/etype/intel_me.py | 2 +-
tools/binman/etype/intel_mrc.py | 2 +-
tools/binman/etype/intel_refcode.py | 2 +-
tools/binman/etype/intel_vbt.py | 2 +-
tools/binman/etype/intel_vga.py | 2 +-
tools/binman/etype/mkimage.py | 4 +-
tools/binman/etype/scp.py | 2 +-
tools/binman/etype/section.py | 15 +-
tools/binman/etype/text.py | 6 +-
tools/binman/etype/u_boot.py | 8 +-
tools/binman/etype/u_boot_dtb_with_ucode.py | 4 +-
tools/binman/etype/u_boot_expanded.py | 24 +
tools/binman/etype/u_boot_nodtb.py | 8 +-
tools/binman/etype/u_boot_spl.py | 3 +
tools/binman/etype/u_boot_spl_bss_pad.py | 17 +-
tools/binman/etype/u_boot_spl_expanded.py | 45 +
tools/binman/etype/u_boot_spl_nodtb.py | 10 +-
tools/binman/etype/u_boot_tpl.py | 3 +
tools/binman/etype/u_boot_tpl_bss_pad.py | 44 +
tools/binman/etype/u_boot_tpl_expanded.py | 45 +
tools/binman/etype/u_boot_tpl_nodtb.py | 28 +
tools/binman/etype/u_boot_with_ucode_ptr.py | 2 +-
tools/binman/ftest.py | 219 ++++-
tools/binman/image.py | 17 +-
tools/binman/index.rst | 9 +
tools/binman/setup.py | 2 +-
tools/binman/state.py | 19 +-
tools/binman/test/192_u_boot_tpl_nodtb.dts | 13 +
tools/binman/test/193_tpl_bss_pad.dts | 19 +
tools/binman/test/194_fdt_incl.dts | 17 +
tools/binman/test/195_fdt_incl_tpl.dts | 13 +
57 files changed, 1547 insertions(+), 671 deletions(-)
create mode 120000 doc/package/binman
create mode 100644 doc/package/fit.rst
create mode 100644 doc/package/index.rst
rename tools/binman/{README => README.rst} (64%)
rename tools/binman/{README.entries => entries.rst} (83%)
create mode 100644 tools/binman/etype/blob_phase.py
create mode 100644 tools/binman/etype/u_boot_expanded.py
create mode 100644 tools/binman/etype/u_boot_spl_expanded.py
create mode 100644 tools/binman/etype/u_boot_tpl_bss_pad.py
create mode 100644 tools/binman/etype/u_boot_tpl_expanded.py
create mode 100644 tools/binman/etype/u_boot_tpl_nodtb.py
create mode 100644 tools/binman/index.rst
create mode 100644 tools/binman/test/192_u_boot_tpl_nodtb.dts
create mode 100644 tools/binman/test/193_tpl_bss_pad.dts
create mode 100644 tools/binman/test/194_fdt_incl.dts
create mode 100644 tools/binman/test/195_fdt_incl_tpl.dtsSignature · 1 line
2.30.1.766.gb4fecdf3b7-goog
PATCH 1/20 binman: Allow extracting to current directory
Extracting files to the current directory is not normally a very friendly thing to do, but it can be warranted, e.g. in a new temporary dir. At present binman reports an error when such an attempt is made. Fix it.
---
tools/binman/control.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
tools/binman/control.py +1 -1
@@ -241,7 +241,7 @@ def ExtractEntries(image_fname, output_fname, outdir, entry_paths, # If this entry has children, create a directory for it and put its # data in a file called 'root' in that directory if entry.GetEntries(): - if not os.path.exists(fname): + if fname and not os.path.exists(fname): os.makedirs(fname) fname = os.path.join(fname, 'root') tout.Notice("Write entry '%s' size %x to '%s'" %
Signature · 1 line
2.30.1.766.gb4fecdf3b7-goog
PATCH 2/20 binman: Document ExpandEntries() in the base class
In reply to Simon GlassMove the documentation to the base method as it is with other methods. Also update it a little while we are here.
---
tools/binman/entry.py | 11 +++++++++++ tools/binman/etype/section.py | 6 ------ 2 files changed, 11 insertions(+), 6 deletions(-)
tools/binman/entry.py +11 -0
@@ -211,6 +211,17 @@ class Entry(object): return {} def ExpandEntries(self): + """Expand out entries which produce other entries + + Some entries generate subnodes automatically, from which sub-entries + are then created. This method allows those to be added to the binman + definition for the current image. An entry which implements this method + should call state.AddSubnode() to add a subnode and can add properties + with state.AddString(), etc. + + An example is 'files', which produces a section containing a list of + files. + """ pass def AddMissingProperties(self, have_image_pos):
tools/binman/etype/section.py +0 -6
@@ -126,12 +126,6 @@ class Entry_section(Entry): return True def ExpandEntries(self): - """Expand out any entries which have calculated sub-entries - - Some entries are expanded out at runtime, e.g. 'files', which produces - a section containing a list of files. Process these entries so that - this information is added to the device tree. - """ super().ExpandEntries() for entry in self._entries.values(): entry.ExpandEntries()
Signature · 1 line
2.30.1.766.gb4fecdf3b7-goog
PATCH 3/20 binman: Update entry help for files-align
In reply to Simon GlassRegenerate the entry documentation, which step was missed when the files-align feature was added.
---
tools/binman/README.entries | 1 + 1 file changed, 1 insertion(+)
tools/binman/README.entries +1 -0
@@ -302,6 +302,7 @@ Properties / Entry arguments: - files-compress: Compression algorithm to use: none: No compression lz4: Use lz4 compression (via 'lz4' command-line utility) + - files-align: Align each file to the given alignment This entry reads a number of files and places each in a separate sub-entry within this entry. To access these you need to enable device-tree updates
Signature · 1 line
2.30.1.766.gb4fecdf3b7-goog
PATCH 4/20 binman: Tidy up underscores in entry documentation
In reply to Simon GlassSeveral entries currently use an underscore in the entry-type name, but in fact a hyphen is used. Update the docs to fix this as it might be confusing.
Also simplify the 'filename' comment and fix the 'operation' typo.
---
tools/binman/README.entries | 23 ++++++++++----------- tools/binman/etype/blob.py | 2 +- tools/binman/etype/u_boot.py | 2 +- tools/binman/etype/u_boot_dtb_with_ucode.py | 4 ++-- tools/binman/etype/u_boot_nodtb.py | 6 +++--- tools/binman/etype/u_boot_spl_nodtb.py | 7 +++---- tools/binman/etype/u_boot_with_ucode_ptr.py | 2 +- 7 files changed, 22 insertions(+), 24 deletions(-)
tools/binman/README.entries +11 -12
@@ -39,7 +39,7 @@ Properties / Entry arguments: This entry reads data from a file and places it in the entry. The default filename is often specified specified by the subclass. See for -example the 'u_boot' entry which provides the filename 'u-boot.bin'. +example the 'u-boot' entry which provides the filename 'u-boot.bin'. If compression is enabled, an extra 'uncomp-size' property is written to the node (if enabled with -u) which provides the uncompressed size of the
@@ -840,7 +840,7 @@ Properties / Entry arguments: This is the U-Boot binary, containing relocation information to allow it to relocate itself at runtime. The binary typically includes a device tree -blob at the end of it. Use u_boot_nodtb if you want to package the device +blob at the end of it. Use u-boot-nodtb if you want to package the device tree separately. U-Boot can access binman symbols at runtime. See:
@@ -876,9 +876,9 @@ See Entry_u_boot_ucode for full details of the three entries involved in this process. This entry provides the U-Boot device-tree file, which contains the microcode. If the microcode is not being collated into one place then the offset and size of the microcode is recorded by this entry, -for use by u_boot_with_ucode_ptr. If it is being collated, then this +for use by u-boot-with-ucode_ptr. If it is being collated, then this entry deletes the microcode from the device tree (to save space) and makes -it available to u_boot_ucode. +it available to u-boot-ucode.
@@ -920,12 +920,12 @@ Entry: u-boot-nodtb: U-Boot flat binary without device tree appended -------------------------------------------------------------------- Properties / Entry arguments: - - filename: Filename of u-boot.bin (default 'u-boot-nodtb.bin') + - filename: Filename to include (default 'u-boot-nodtb.bin') This is the U-Boot binary, containing relocation information to allow it to relocate itself at runtime. It does not include a device tree blob at -the end of it so normally cannot work without it. You can add a u_boot_dtb -entry after this one, or use a u_boot entry instead (which contains both +the end of it so normally cannot work without it. You can add a u-boot-dtb +entry after this one, or use a u-boot entry instead (which contains both U-Boot and the device tree).
@@ -1000,13 +1000,12 @@ Entry: u-boot-spl-nodtb: SPL binary without device tree appended ---------------------------------------------------------------- Properties / Entry arguments: - - filename: Filename of spl/u-boot-spl-nodtb.bin (default - 'spl/u-boot-spl-nodtb.bin') + - filename: Filename to include (default 'spl/u-boot-spl-nodtb.bin') This is the U-Boot SPL binary, It does not include a device tree blob at the end of it so may not be able to work without it, assuming SPL needs -a device tree to operation on your platform. You can add a u_boot_spl_dtb -entry after this one, or use a u_boot_spl entry instead (which contains +a device tree to operate on your platform. You can add a u-boot-spl-dtb +entry after this one, or use a u-boot-spl entry instead (which contains both SPL and the device tree).
@@ -1148,7 +1147,7 @@ Properties / Entry arguments: See Entry_u_boot_ucode for full details of the three entries involved in this process. This entry updates U-Boot with the offset and size of the microcode, to allow early x86 boot code to find it without doing anything -complicated. Otherwise it is the same as the u_boot entry. +complicated. Otherwise it is the same as the u-boot entry.
tools/binman/etype/blob.py +1 -1
@@ -24,7 +24,7 @@ class Entry_blob(Entry): This entry reads data from a file and places it in the entry. The default filename is often specified specified by the subclass. See for - example the 'u_boot' entry which provides the filename 'u-boot.bin'. + example the 'u-boot' entry which provides the filename 'u-boot.bin'. If compression is enabled, an extra 'uncomp-size' property is written to the node (if enabled with -u) which provides the uncompressed size of the
tools/binman/etype/u_boot.py +1 -1
@@ -16,7 +16,7 @@ class Entry_u_boot(Entry_blob): This is the U-Boot binary, containing relocation information to allow it to relocate itself at runtime. The binary typically includes a device tree - blob at the end of it. Use u_boot_nodtb if you want to package the device + blob at the end of it. Use u-boot-nodtb if you want to package the device tree separately. U-Boot can access binman symbols at runtime. See:
tools/binman/etype/u_boot_dtb_with_ucode.py +2 -2
@@ -19,9 +19,9 @@ class Entry_u_boot_dtb_with_ucode(Entry_blob_dtb): this process. This entry provides the U-Boot device-tree file, which contains the microcode. If the microcode is not being collated into one place then the offset and size of the microcode is recorded by this entry, - for use by u_boot_with_ucode_ptr. If it is being collated, then this + for use by u-boot-with-ucode_ptr. If it is being collated, then this entry deletes the microcode from the device tree (to save space) and makes - it available to u_boot_ucode. + it available to u-boot-ucode. """ def __init__(self, section, etype, node): # Put this here to allow entry-docs and help to work without libfdt
tools/binman/etype/u_boot_nodtb.py +3 -3
@@ -12,12 +12,12 @@ class Entry_u_boot_nodtb(Entry_blob): """U-Boot flat binary without device tree appended Properties / Entry arguments: - - filename: Filename of u-boot.bin (default 'u-boot-nodtb.bin') + - filename: Filename to include (default 'u-boot-nodtb.bin') This is the U-Boot binary, containing relocation information to allow it to relocate itself at runtime. It does not include a device tree blob at - the end of it so normally cannot work without it. You can add a u_boot_dtb - entry after this one, or use a u_boot entry instead (which contains both + the end of it so normally cannot work without it. You can add a u-boot-dtb + entry after this one, or use a u-boot entry instead (which contains both U-Boot and the device tree). """ def __init__(self, section, etype, node):
tools/binman/etype/u_boot_spl_nodtb.py +3 -4
@@ -12,13 +12,12 @@ class Entry_u_boot_spl_nodtb(Entry_blob): """SPL binary without device tree appended Properties / Entry arguments: - - filename: Filename of spl/u-boot-spl-nodtb.bin (default - 'spl/u-boot-spl-nodtb.bin') + - filename: Filename to include (default 'spl/u-boot-spl-nodtb.bin') This is the U-Boot SPL binary, It does not include a device tree blob at the end of it so may not be able to work without it, assuming SPL needs - a device tree to operation on your platform. You can add a u_boot_spl_dtb - entry after this one, or use a u_boot_spl entry instead (which contains + a device tree to operate on your platform. You can add a u-boot-spl-dtb + entry after this one, or use a u-boot-spl entry instead (which contains both SPL and the device tree). """ def __init__(self, section, etype, node):
tools/binman/etype/u_boot_with_ucode_ptr.py +1 -1
@@ -26,7 +26,7 @@ class Entry_u_boot_with_ucode_ptr(Entry_blob): See Entry_u_boot_ucode for full details of the three entries involved in this process. This entry updates U-Boot with the offset and size of the microcode, to allow early x86 boot code to find it without doing anything - complicated. Otherwise it is the same as the u_boot entry. + complicated. Otherwise it is the same as the u-boot entry. """ def __init__(self, section, etype, node): super().__init__(section, etype, node)
Signature · 1 line
2.30.1.766.gb4fecdf3b7-goog
PATCH 5/20 binman: Correct the documentation for u-boot-spl-bss-pad
In reply to Simon GlassThe documentation for this entry indicates that the SPL binary is included along with the padding. It is not, so update it to correct the error.
---
tools/binman/README.entries | 17 ++++++++++------- tools/binman/etype/u_boot_spl_bss_pad.py | 17 ++++++++++------- 2 files changed, 20 insertions(+), 14 deletions(-)
tools/binman/README.entries +10 -7
@@ -960,13 +960,16 @@ Entry: u-boot-spl-bss-pad: U-Boot SPL binary padded with a BSS region Properties / Entry arguments: None -This is similar to u_boot_spl except that padding is added after the SPL -binary to cover the BSS (Block Started by Symbol) region. This region holds -the various used by SPL. It is set to 0 by SPL when it starts up. If you -want to append data to the SPL image (such as a device tree file), you must -pad out the BSS region to avoid the data overlapping with U-Boot variables. -This entry is useful in that case. It automatically pads out the entry size -to cover both the code, data and BSS. +This holds the padding added after the SPL binary to cover the BSS (Block +Started by Symbol) region. This region holds the various variables used by +SPL. It is set to 0 by SPL when it starts up. If you want to append data to +the SPL image (such as a device tree file), you must pad out the BSS region +to avoid the data overlapping with U-Boot variables. This entry is useful in +that case. It automatically pads out the entry size to cover both the code, +data and BSS. + +The contents of this entry will a certain number of zero bytes, determined +by __bss_size The ELF file 'spl/u-boot-spl' must also be available for this to work, since binman uses that to look up the BSS address.
tools/binman/etype/u_boot_spl_bss_pad.py +10 -7
@@ -18,13 +18,16 @@ class Entry_u_boot_spl_bss_pad(Entry_blob): Properties / Entry arguments: None - This is similar to u_boot_spl except that padding is added after the SPL - binary to cover the BSS (Block Started by Symbol) region. This region holds - the various used by SPL. It is set to 0 by SPL when it starts up. If you - want to append data to the SPL image (such as a device tree file), you must - pad out the BSS region to avoid the data overlapping with U-Boot variables. - This entry is useful in that case. It automatically pads out the entry size - to cover both the code, data and BSS. + This holds the padding added after the SPL binary to cover the BSS (Block + Started by Symbol) region. This region holds the various variables used by + SPL. It is set to 0 by SPL when it starts up. If you want to append data to + the SPL image (such as a device tree file), you must pad out the BSS region + to avoid the data overlapping with U-Boot variables. This entry is useful in + that case. It automatically pads out the entry size to cover both the code, + data and BSS. + + The contents of this entry will a certain number of zero bytes, determined + by __bss_size The ELF file 'spl/u-boot-spl' must also be available for this to work, since binman uses that to look up the BSS address.
Signature · 1 line
2.30.1.766.gb4fecdf3b7-goog
PATCH 6/20 binman: Add support for u-boot-tpl-nodtb
In reply to Simon GlassAllow this entry type to be placed in an image. This is the TPL binary, without a devicetree appended.
---
tools/binman/README.entries | 14 +++++++++++ tools/binman/etype/u_boot_tpl_nodtb.py | 27 ++++++++++++++++++++++ tools/binman/ftest.py | 6 +++++ tools/binman/test/192_u_boot_tpl_nodtb.dts | 13 +++++++++++ 4 files changed, 60 insertions(+) create mode 100644 tools/binman/etype/u_boot_tpl_nodtb.py create mode 100644 tools/binman/test/192_u_boot_tpl_nodtb.dts
tools/binman/README.entries +14 -0
@@ -1080,6 +1080,20 @@ be relocated to any address for execution. +Entry: u-boot-tpl-nodtb: TPL binary without device tree appended +---------------------------------------------------------------- + +Properties / Entry arguments: + - filename: Filename to include (default 'tpl/u-boot-tpl-nodtb.bin') + +This is the U-Boot TPL binary, It does not include a device tree blob at +the end of it so may not be able to work without it, assuming TPL needs +a device tree to operate on your platform. You can add a u-boot-tpl-dtb +entry after this one, or use a u-boot-tpl entry instead (which contains +both TPL and the device tree). + + + Entry: u-boot-tpl-with-ucode-ptr: U-Boot TPL with embedded microcode pointer ----------------------------------------------------------------------------
tools/binman/etype/u_boot_tpl_nodtb.py new file +27 -0
@@ -0,0 +1,27 @@ +# SPDX-License-Identifier: GPL-2.0+ +# Copyright 2021 Google LLC +# Written by Simon Glass <[email protected]> +# +# Entry-type module for 'u-boot-tpl-nodtb.bin' +# + +from binman.entry import Entry +from binman.etype.blob import Entry_blob + +class Entry_u_boot_tpl_nodtb(Entry_blob): + """TPL binary without device tree appended + + Properties / Entry arguments: + - filename: Filename to include (default 'tpl/u-boot-tpl-nodtb.bin') + + This is the U-Boot TPL binary, It does not include a device tree blob at + the end of it so may not be able to work without it, assuming TPL needs + a device tree to operate on your platform. You can add a u-boot-tpl-dtb + entry after this one, or use a u-boot-tpl entry instead (which contains + both TPL and the device tree). + """ + def __init__(self, section, etype, node): + super().__init__(section, etype, node) + + def GetDefaultFilename(self): + return 'tpl/u-boot-tpl-nodtb.bin'
tools/binman/ftest.py +6 -0
@@ -4245,6 +4245,12 @@ class TestFunctional(unittest.TestCase): self.assertEquals(U_BOOT_DATA, u_boot.ReadData()) + def testTplNoDtb(self): + """Test that an image with tpl/u-boot-tpl-nodtb.bin can be created""" + data = self._DoReadFile('192_u_boot_tpl_nodtb.dts') + self.assertEqual(U_BOOT_TPL_NODTB_DATA, + data[:len(U_BOOT_TPL_NODTB_DATA)]) + if __name__ == "__main__": unittest.main()
tools/binman/test/192_u_boot_tpl_nodtb.dts new file +13 -0
@@ -0,0 +1,13 @@ +// SPDX-License-Identifier: GPL-2.0+ + +/dts-v1/; + +/ { + #address-cells = <1>; + #size-cells = <1>; + + binman { + u-boot-tpl-nodtb { + }; + }; +};
Signature · 1 line
2.30.1.766.gb4fecdf3b7-goog
PATCH 7/20 binman: Add support for u-boot-tpl-bss-bad
In reply to Simon GlassThis entry holds the padding between the end of of TPL binary and the end of BSS. This region must be left empty so that the devicetree can be appended correctly and remain accessible without interfering with BSS.
---
tools/binman/README.entries | 22 ++++++++++++ tools/binman/etype/u_boot_tpl_bss_pad.py | 44 ++++++++++++++++++++++++ tools/binman/ftest.py | 16 +++++++++ tools/binman/test/193_tpl_bss_pad.dts | 19 ++++++++++ 4 files changed, 101 insertions(+) create mode 100644 tools/binman/etype/u_boot_tpl_bss_pad.py create mode 100644 tools/binman/test/193_tpl_bss_pad.dts
tools/binman/README.entries +22 -0
@@ -1047,6 +1047,28 @@ binman uses that to look up symbols to write into the TPL binary. +Entry: u-boot-tpl-bss-pad: U-Boot TPL binary padded with a BSS region +--------------------------------------------------------------------- + +Properties / Entry arguments: + None + +This holds the padding added after the TPL binary to cover the BSS (Block +Started by Symbol) region. This region holds the various variables used by +TPL. It is set to 0 by TPL when it starts up. If you want to append data to +the TPL image (such as a device tree file), you must pad out the BSS region +to avoid the data overlapping with U-Boot variables. This entry is useful in +that case. It automatically pads out the entry size to cover both the code, +data and BSS. + +The contents of this entry will a certain number of zero bytes, determined +by __bss_size + +The ELF file 'tpl/u-boot-tpl' must also be available for this to work, since +binman uses that to look up the BSS address. + + + Entry: u-boot-tpl-dtb: U-Boot TPL device tree ---------------------------------------------
tools/binman/etype/u_boot_tpl_bss_pad.py new file +44 -0
44 lines not on this page · raw message
tools/binman/ftest.py +16 -0
@@ -4251,6 +4251,22 @@ class TestFunctional(unittest.TestCase): self.assertEqual(U_BOOT_TPL_NODTB_DATA, data[:len(U_BOOT_TPL_NODTB_DATA)]) + def testTplBssPad(self): + """Test that we can pad TPL's BSS with zeros""" + # ELF file with a '__bss_size' symbol + self._SetupTplElf() + data = self._DoReadFile('193_tpl_bss_pad.dts') + self.assertEqual(U_BOOT_TPL_DATA + tools.GetBytes(0, 10) + U_BOOT_DATA, + data) + + def testTplBssPadMissing(self): + """Test that a missing symbol is detected""" + self._SetupTplElf('u_boot_ucode_ptr') + with self.assertRaises(ValueError) as e: + self._DoReadFile('193_tpl_bss_pad.dts') + self.assertIn('Expected __bss_size symbol in tpl/u-boot-tpl', + str(e.exception)) + if __name__ == "__main__": unittest.main()
tools/binman/test/193_tpl_bss_pad.dts new file +19 -0
@@ -0,0 +1,19 @@ +// SPDX-License-Identifier: GPL-2.0+ + +/dts-v1/; + +/ { + #address-cells = <1>; + #size-cells = <1>; + + binman { + u-boot-tpl { + }; + + u-boot-tpl-bss-pad { + }; + + u-boot { + }; + }; +};
Signature · 1 line
2.30.1.766.gb4fecdf3b7-goog
PATCH 8/20 binman: Allow using an an 'expanded' entry type
In reply to Simon GlassAs the first step in supporting expanded entries, add a way for binman to automatically select an 'expanded' version of an entry type, if requested. This is controlled by a class method.
---
tools/binman/entry.py | 60 ++++++++++++++++++++++++++++++++------ tools/binman/entry_test.py | 12 ++++++++ 2 files changed, 63 insertions(+), 9 deletions(-)
tools/binman/entry.py +51 -9
@@ -102,22 +102,30 @@ class Entry(object): self.allow_missing = False @staticmethod - def Lookup(node_path, etype): + def Lookup(node_path, etype, expanded): """Look up the entry class for a node. Args: node_node: Path name of Node object containing information about the entry to create (used for errors) etype: Entry type to use + expanded: Use the expanded version of etype Returns: - The entry class object if found, else None + The entry class object if found, else None if not found and expanded + is True + + Raise: + ValueError if expanded is False and the class is not found """ # Convert something like 'u-boot at 0' to 'u_boot' since we are only # interested in the type. module_name = etype.replace('-', '_') + if '@' in module_name: module_name = module_name.split('@')[0] + if expanded: + module_name += '_expanded' module = modules.get(module_name) # Also allow entry-type modules to be brought in from the etype directory.
@@ -127,6 +135,8 @@ class Entry(object): try: module = importlib.import_module('binman.etype.' + module_name) except ImportError as e: + if expanded: + return None raise ValueError("Unknown entry type '%s' in node '%s' (expected etype/%s.py, error '%s'" % (etype, node_path, module_name, e)) modules[module_name] = module
@@ -135,21 +145,31 @@ class Entry(object): return getattr(module, 'Entry_%s' % module_name) @staticmethod - def Create(section, node, etype=None): + def Create(section, node, etype=None, expanded=False): """Create a new entry for a node. Args: - section: Section object containing this node - node: Node object containing information about the entry to - create - etype: Entry type to use, or None to work it out (used for tests) + section: Section object containing this node + node: Node object containing information about the entry to + create + etype: Entry type to use, or None to work it out (used for tests) + expanded: True to use expanded versions of entries, where available Returns: A new Entry object of the correct type (a subclass of Entry) """ if not etype: etype = fdt_util.GetString(node, 'type', node.name) - obj = Entry.Lookup(node.path, etype) + obj = Entry.Lookup(node.path, etype, expanded) + if obj and expanded: + # Check whether to use the expanded entry + new_etype = etype + '-expanded' + if obj.UseExpanded(node, etype, new_etype): + etype = new_etype + else: + obj = None + if not obj: + obj = Entry.Lookup(node.path, etype, False) # Call its constructor to get the object we want. return obj(section, etype, node)
@@ -648,7 +668,7 @@ features to produce new behaviours. modules.remove('_testing') missing = [] for name in modules: - module = Entry.Lookup('WriteDocs', name) + module = Entry.Lookup('WriteDocs', name, False) docs = getattr(module, '__doc__') if test_missing == name: docs = None
@@ -907,3 +927,25 @@ features to produce new behaviours. self.uncomp_size = len(indata) data = tools.Compress(indata, self.compress) return data + + @classmethod + def UseExpanded(cls, node, etype, new_etype): + """Check whether to use an expanded entry type + + This is called by Entry.Create() when it finds an expanded version of + an entry type (e.g. 'u-boot-expanded'). If this method returns True then + it will be used (e.g. in place of 'u-boot'). If it returns False, it is + ignored. + + Args: + node: Node object containing information about the entry to + create + etype: Original entry type being used + new_etype: New entry type proposed + + Returns: + True to use this entry type, False to use the original one + """ + tout.Info("Node '%s': etype '%s': %s selected" % + (node.path, etype, new_etype)) + return True
tools/binman/entry_test.py +12 -0
@@ -87,6 +87,18 @@ class TestEntry(unittest.TestCase): base = entry.Entry.Create(None, self.GetNode(), 'blob-dtb') self.assertIsNone(base.ReadChildData(base)) + def testExpandedEntry(self): + """Test use of an expanded entry when available""" + base = entry.Entry.Create(None, self.GetNode()) + self.assertEqual('u-boot', base.etype) + + expanded = entry.Entry.Create(None, self.GetNode(), expanded=True) + self.assertEqual('u-boot-expanded', expanded.etype) + + with self.assertRaises(ValueError) as e: + entry.Entry.Create(None, self.GetNode(), 'missing', expanded=True) + self.assertIn("Unknown entry type 'missing' in node '/binman/u-boot'", + str(e.exception)) if __name__ == "__main__": unittest.main()
Signature · 1 line
2.30.1.766.gb4fecdf3b7-goog
PATCH 9/20 binman: Allow a way to select expanded entries
In reply to Simon GlassAdd a new command-line option to disable expanded entries. This is needed for most tests, since it is much easier to 'factor out' this function into a separate test and keep the existing packing tests simple.
Add the option and select it by default from tests.
---
tools/binman/cmdline.py | 3 +++ tools/binman/ftest.py | 19 +++++++++++++------ 2 files changed, 16 insertions(+), 6 deletions(-)
tools/binman/cmdline.py +3 -0
@@ -56,6 +56,9 @@ controlled by a description in the board device tree.''' default=False, help='Output a map file for each image') build_parser.add_argument('-M', '--allow-missing', action='store_true', default=False, help='Allow external blobs to be missing') + build_parser.add_argument('-n', '--no-expanded', action='store_true', + help="Don't use 'expanded' versions of entries where available; " + "normally 'u-boot' becomes 'u-boot-expanded', for example") build_parser.add_argument('-O', '--outdir', type=str, action='store', help='Path to directory to use for intermediate and ' 'output files')
tools/binman/ftest.py +13 -6
@@ -305,7 +305,8 @@ class TestFunctional(unittest.TestCase): def _DoTestFile(self, fname, debug=False, map=False, update_dtb=False, entry_args=None, images=None, use_real_dtb=False, - verbosity=None, allow_missing=False, extra_indirs=None): + use_expanded=False, verbosity=None, allow_missing=False, + extra_indirs=None): """Run binman with a given test file Args:
@@ -322,6 +323,8 @@ class TestFunctional(unittest.TestCase): the u-boot-dtb entry. Normally this is not needed and the test contents (the U_BOOT_DTB_DATA string) can be used. But in some test we need the real contents. + use_expanded: True to use expanded entries where available, e.g. + 'u-boot-expanded' instead of 'u-boot' verbosity: Verbosity level to use (0-3, None=don't set it) allow_missing: Set the '--allow-missing' flag so that missing external binaries just produce a warning instead of an error
@@ -344,6 +347,8 @@ class TestFunctional(unittest.TestCase): args.append('-u') if not use_real_dtb: args.append('--fake-dtb') + if not use_expanded: + args.append('--no-expanded') if entry_args: for arg, value in entry_args.items(): args.append('-a%s=%s' % (arg, value))
@@ -403,9 +408,9 @@ class TestFunctional(unittest.TestCase): dtb.Pack() return dtb.GetContents() - def _DoReadFileDtb(self, fname, use_real_dtb=False, map=False, - update_dtb=False, entry_args=None, reset_dtbs=True, - extra_indirs=None): + def _DoReadFileDtb(self, fname, use_real_dtb=False, use_expanded=False, + map=False, update_dtb=False, entry_args=None, + reset_dtbs=True, extra_indirs=None): """Run binman and return the resulting image This runs binman with a given test file and then reads the resulting
@@ -420,6 +425,8 @@ class TestFunctional(unittest.TestCase): the u-boot-dtb entry. Normally this is not needed and the test contents (the U_BOOT_DTB_DATA string) can be used. But in some test we need the real contents. + use_expanded: True to use expanded entries where available, e.g. + 'u-boot-expanded' instead of 'u-boot' map: True to output map files for the images update_dtb: Update the offset and size of each entry in the device tree before packing it into the image
@@ -454,7 +461,7 @@ class TestFunctional(unittest.TestCase): try: retcode = self._DoTestFile(fname, map=map, update_dtb=update_dtb, entry_args=entry_args, use_real_dtb=use_real_dtb, - extra_indirs=extra_indirs) + use_expanded=use_expanded, extra_indirs=extra_indirs) self.assertEqual(0, retcode) out_dtb_fname = tools.GetOutputFilename('u-boot.dtb.out')
@@ -652,7 +659,7 @@ class TestFunctional(unittest.TestCase): """Test that we can run it with a specific board""" self._SetupDtb('005_simple.dts', 'sandbox/u-boot.dtb') TestFunctional._MakeInputFile('sandbox/u-boot.bin', U_BOOT_DATA) - result = self._DoBinman('build', '-b', 'sandbox') + result = self._DoBinman('build', '-n', '-b', 'sandbox') self.assertEqual(0, result) def testNeedBoard(self):
Signature · 1 line
2.30.1.766.gb4fecdf3b7-goog
PATCH 10/20 binman: Plumb expanded entries through fully
In reply to Simon GlassAdd support for this feature in the control, image and section modules, so that expanded entries will be selected by default. So far there are no expanded entry types, so this is a nop.
---
tools/binman/control.py | 24 ++++++++++++++++++------ tools/binman/etype/section.py | 3 ++- tools/binman/image.py | 17 ++++++++++++++++- 3 files changed, 36 insertions(+), 8 deletions(-)
tools/binman/control.py +18 -6
@@ -28,7 +28,7 @@ images = OrderedDict() # value: Text for the help missing_blob_help = {} -def _ReadImageDesc(binman_node): +def _ReadImageDesc(binman_node, use_expanded): """Read the image descriptions from the /binman node This normally produces a single Image object called 'image'. But if
@@ -36,15 +36,17 @@ def _ReadImageDesc(binman_node): Args: binman_node: Node object of the /binman node + use_expanded: True if the FDT will be updated with the entry information Returns: OrderedDict of Image objects, each of which describes an image """ images = OrderedDict() if 'multiple-images' in binman_node.props: for node in binman_node.subnodes: - images[node.name] = Image(node.name, node) + images[node.name] = Image(node.name, node, + use_expanded=use_expanded) else: - images['image'] = Image('image', binman_node) + images['image'] = Image('image', binman_node, use_expanded=use_expanded) return images def _FindBinmanNode(dtb):
@@ -399,7 +401,7 @@ def ReplaceEntries(image_fname, input_fname, indir, entry_paths, return image -def PrepareImagesAndDtbs(dtb_fname, select_images, update_fdt): +def PrepareImagesAndDtbs(dtb_fname, select_images, update_fdt, use_expanded): """Prepare the images to be processed and select the device tree This function:
@@ -413,6 +415,9 @@ def PrepareImagesAndDtbs(dtb_fname, select_images, update_fdt): dtb_fname: Filename of the device tree file to use (.dts or .dtb) selected_images: List of images to output, or None for all update_fdt: True to update the FDT wth entry offsets, etc. + use_expanded: True to use expanded versions of entries, if available. + So if 'u-boot' is called for, we use 'u-boot-expanded' instead. This + is needed if update_fdt is True (although tests may disable it) Returns: OrderedDict of images:
@@ -438,7 +443,7 @@ def PrepareImagesAndDtbs(dtb_fname, select_images, update_fdt): raise ValueError("Device tree '%s' does not have a 'binman' " "node" % dtb_fname) - images = _ReadImageDesc(node) + images = _ReadImageDesc(node, use_expanded) if select_images: skip = []
@@ -611,6 +616,13 @@ def Binman(args): elf.debug = args.debug cbfs_util.VERBOSE = args.verbosity > 2 state.use_fake_dtb = args.fake_dtb + + # Normally we replace the 'u-boot' etype with 'u-boot-expanded', etc. + # When running tests this can be disabled using this flag. When not + # updating the FDT in image, it is not needed by binman, but we use it + # for consistency, so that the images look the same to U-Boot at + # runtime. + use_expanded = not args.no_expanded try: tools.SetInputDirs(args.indir) tools.PrepareOutputDir(args.outdir, args.preserve)
@@ -618,7 +630,7 @@ def Binman(args): state.SetEntryArgs(args.entry_arg) images = PrepareImagesAndDtbs(dtb_fname, args.image, - args.update_fdt) + args.update_fdt, use_expanded) missing = False for image in images.values(): missing |= ProcessImage(image, args.update_fdt, args.map,
tools/binman/etype/section.py +2 -1
@@ -84,7 +84,8 @@ class Entry_section(Entry): for node in self._node.subnodes: if node.name.startswith('hash') or node.name.startswith('signature'): continue - entry = Entry.Create(self, node) + entry = Entry.Create(self, node, + expanded=self.GetImage().use_expanded) entry.ReadNode() entry.SetPrefix(self._name_prefix) self._entries[node.name] = entry
tools/binman/image.py +16 -1
@@ -47,9 +47,23 @@ class Image(section.Entry_section): exception). This should be used if the Image is being loaded from a file rather than generated. In that case we obviously don't need the entry arguments since the contents already exists. + use_expanded: True if we are updating the FDT wth entry offsets, etc. + and should use the expanded versions of the U-Boot entries. + Any entry type that includes a devicetree must put it in a + separate entry so that it will be updated. For example. 'u-boot' + normally just picks up 'u-boot.bin' which includes the + devicetree, but this is not updateable, since it comes into + binman as one piece and binman doesn't know that it is actually + an executable followed by a devicetree. Of course it could be + taught this, but then when reading an image (e.g. 'binman ls') + it may need to be able to split the devicetree out of the image + in order to determine the location of things. Instead we choose + to ignore 'u-boot-bin' in this case, and build it ourselves in + binman with 'u-boot-dtb.bin' and 'u-boot.dtb'. See + Entry_u_boot_expanded and Entry_blob_phase for details. """ def __init__(self, name, node, copy_to_orig=True, test=False, - ignore_missing=False): + ignore_missing=False, use_expanded=False): super().__init__(None, 'section', node, test=test) self.copy_to_orig = copy_to_orig self.name = 'main-section'
@@ -59,6 +73,7 @@ class Image(section.Entry_section): self.fdtmap_data = None self.allow_repack = False self._ignore_missing = ignore_missing + self.use_expanded = use_expanded if not test: self.ReadNode()
Signature · 1 line
2.30.1.766.gb4fecdf3b7-goog
PATCH 11/20 binman: Automatically expand phase binaries into sections
In reply to Simon GlassWhen creating an entry, check for an expanded version of that entry, then use it instead. This allows, for example use of:
u-boot {
};instead of having to write out in full:
u-boot {
type = "section"; u-boot-nodtb {
};
u-boot-dtb {
};};
Add an implementaion of this and associated documentation.
---
tools/binman/README | 77 ++++++++++ tools/binman/README.entries | 96 +++++++++++- tools/binman/etype/blob_phase.py | 51 +++++++ tools/binman/etype/u_boot.py | 8 +- tools/binman/etype/u_boot_expanded.py | 24 +++ tools/binman/etype/u_boot_nodtb.py | 4 +- tools/binman/etype/u_boot_spl.py | 3 + tools/binman/etype/u_boot_spl_expanded.py | 45 ++++++ tools/binman/etype/u_boot_spl_nodtb.py | 5 +- tools/binman/etype/u_boot_tpl.py | 3 + tools/binman/etype/u_boot_tpl_expanded.py | 45 ++++++ tools/binman/etype/u_boot_tpl_nodtb.py | 5 +- tools/binman/ftest.py | 174 ++++++++++++++++++++++ tools/binman/state.py | 19 ++- tools/binman/test/194_fdt_incl.dts | 17 +++ tools/binman/test/195_fdt_incl_tpl.dts | 13 ++ 16 files changed, 571 insertions(+), 18 deletions(-) create mode 100644 tools/binman/etype/blob_phase.py create mode 100644 tools/binman/etype/u_boot_expanded.py create mode 100644 tools/binman/etype/u_boot_spl_expanded.py create mode 100644 tools/binman/etype/u_boot_tpl_expanded.py create mode 100644 tools/binman/test/194_fdt_incl.dts create mode 100644 tools/binman/test/195_fdt_incl_tpl.dts
tools/binman/README +77 -0
@@ -840,6 +840,83 @@ of the image) can be used to point to the FDT map. See fdtmap and image-header entries for more information. +Expanded entries +---------------- + +Binman automatically replaces 'u-boot' with an expanded version of that, i.e. +'u-boot-expanded'. This means that when you write: + + u-boot { + }; + +you actually get: + + u-boot { + type = "u-boot-expanded'; + }; + +which in turn expands to: + + u-boot { + type = "section"; + + u-boot-nodtb { + }; + + u-boot-dtb { + }; + }; + +U-Boot's various phase binaries actually comprise two or three pieces. +For example, u-boot.bin has the executable followed by a devicetree. + +With binman we want to be able to update that devicetree with full image +information so that it is accessible to the executable. This is tricky +if it is not clear where the devicetree starts. + +The above feature ensures that the devicetree is clearly separated from the +U-Boot executable and can be updated separately by binman as needed. It can be +disabled with the --no-expanded flag if required. + +The same applies for u-boot-spl and u-boot-spl. In those cases, the expansion +includes the BSS padding, so for example: + + spl { + type = "u-boot-spl" + }; + +you actually get: + + spl { + type = "u-boot-expanded'; + }; + +which in turn expands to: + + spl { + type = "section"; + + u-boot-spl-nodtb { + }; + + u-boot-spl-bss-pad { + }; + + u-boot-spl-dtb { + }; + }; + + +Of course we should not expand SPL if it has no devicetree. Also if the BSS +padding is not needed (because BSS is in RAM as with CONFIG_SPL_SEPARATE_BSS), +the 'u-boot-spl-bss-pad' subnode should not be created. The use of the expaned +entry type is controlled by the UseExpanded() method. In the SPL case it checks +the 'spl-dtb' entry arg, which is 'y' or '1' if SPL has a devicetree. + +For the BSS case, a 'spl-bss-pad' entry arg controls whether it is present. All +entry args are provided by the U-Boot Makefile. + + Compression -----------
tools/binman/README.entries +88 -8
162 lines not on this page · raw message
tools/binman/etype/blob_phase.py new file +51 -0
51 lines not on this page · raw message
tools/binman/etype/u_boot.py +5 -3
@@ -2,7 +2,7 @@ # Copyright (c) 2016 Google, Inc # Written by Simon Glass <[email protected]> # -# Entry-type module for U-Boot binary +# Entry-type module for the expanded U-Boot binary # from binman.entry import Entry
@@ -16,14 +16,16 @@ class Entry_u_boot(Entry_blob): This is the U-Boot binary, containing relocation information to allow it to relocate itself at runtime. The binary typically includes a device tree - blob at the end of it. Use u-boot-nodtb if you want to package the device - tree separately. + blob at the end of it. U-Boot can access binman symbols at runtime. See: 'Access to binman entry offsets at run time (fdt)' in the binman README for more information. + + Note that this entry is automatically replaced with u-boot-expanded unless + --no-expanded is used. """ def __init__(self, section, etype, node): super().__init__(section, etype, node)
tools/binman/etype/u_boot_expanded.py new file +24 -0
@@ -0,0 +1,24 @@ +# SPDX-License-Identifier: GPL-2.0+ +# Copyright 2021 Google LLC +# Written by Simon Glass <[email protected]> +# +# Entry-type module for U-Boot binary +# + +from binman.etype.blob_phase import Entry_blob_phase + +class Entry_u_boot_expanded(Entry_blob_phase): + """U-Boot flat binary broken out into its component parts + + This is a section containing the U-Boot binary and a devicetree. Using this + entry type automatically creates this section, with the following entries + in it: + + u-boot-nodtb + u-boot-dtb + + Having the devicetree separate allows binman to update it in the final + image, so that the entries positions are provided to the running U-Boot. + """ + def __init__(self, section, etype, node): + super().__init__(section, etype, node, 'u-boot', 'u-boot-dtb', False)
tools/binman/etype/u_boot_nodtb.py +2 -2
@@ -17,8 +17,8 @@ class Entry_u_boot_nodtb(Entry_blob): This is the U-Boot binary, containing relocation information to allow it to relocate itself at runtime. It does not include a device tree blob at the end of it so normally cannot work without it. You can add a u-boot-dtb - entry after this one, or use a u-boot entry instead (which contains both - U-Boot and the device tree). + entry after this one, or use a u-boot entry instead, normally expands to a + section containing u-boot and u-boot-dtb """ def __init__(self, section, etype, node): super().__init__(section, etype, node)
tools/binman/etype/u_boot_spl.py +3 -0
@@ -30,6 +30,9 @@ class Entry_u_boot_spl(Entry_blob): The ELF file 'spl/u-boot-spl' must also be available for this to work, since binman uses that to look up symbols to write into the SPL binary. + + Note that this entry is automatically replaced with u-boot-spl-expanded + unless --no-expanded is used. """ def __init__(self, section, etype, node): super().__init__(section, etype, node)
tools/binman/etype/u_boot_spl_expanded.py new file +45 -0
45 lines not on this page · raw message
tools/binman/etype/u_boot_spl_nodtb.py +3 -2
@@ -17,8 +17,9 @@ class Entry_u_boot_spl_nodtb(Entry_blob): This is the U-Boot SPL binary, It does not include a device tree blob at the end of it so may not be able to work without it, assuming SPL needs a device tree to operate on your platform. You can add a u-boot-spl-dtb - entry after this one, or use a u-boot-spl entry instead (which contains - both SPL and the device tree). + entry after this one, or use a u-boot-spl entry instead' which normally + expands to a section containing u-boot-spl-dtb, u-boot-spl-bss-pad and + u-boot-spl-dtb """ def __init__(self, section, etype, node): super().__init__(section, etype, node)
tools/binman/etype/u_boot_tpl.py +3 -0
@@ -30,6 +30,9 @@ class Entry_u_boot_tpl(Entry_blob): The ELF file 'tpl/u-boot-tpl' must also be available for this to work, since binman uses that to look up symbols to write into the TPL binary. + + Note that this entry is automatically replaced with u-boot-tpl-expanded + unless --no-expanded is used. """ def __init__(self, section, etype, node): super().__init__(section, etype, node)
tools/binman/etype/u_boot_tpl_expanded.py new file +45 -0
45 lines not on this page · raw message
tools/binman/etype/u_boot_tpl_nodtb.py +3 -2
@@ -17,8 +17,9 @@ class Entry_u_boot_tpl_nodtb(Entry_blob): This is the U-Boot TPL binary, It does not include a device tree blob at the end of it so may not be able to work without it, assuming TPL needs a device tree to operate on your platform. You can add a u-boot-tpl-dtb - entry after this one, or use a u-boot-tpl entry instead (which contains - both TPL and the device tree). + entry after this one, or use a u-boot-tpl entry instead, which normally + expands to a section containing u-boot-tpl-dtb, u-boot-tpl-bss-pad and + u-boot-tpl-dtb """ def __init__(self, section, etype, node): super().__init__(section, etype, node)
tools/binman/ftest.py +174 -0
180 lines not on this page · raw message
tools/binman/state.py +18 -1
@@ -136,12 +136,16 @@ def SetEntryArgs(args): global entry_args entry_args = {} + tout.Debug('Processing entry args:') if args: for arg in args: m = re.match('([^=]*)=(.*)', arg) if not m: raise ValueError("Invalid entry arguemnt '%s'" % arg) - entry_args[m.group(1)] = m.group(2) + name, value = m.groups() + tout.Debug(' %20s = %s' % (name, value)) + entry_args[name] = value + tout.Debug('Processing entry args done') def GetEntryArg(name): """Get the value of an entry argument
@@ -154,6 +158,19 @@ def GetEntryArg(name): """ return entry_args.get(name) +def GetEntryArgBool(name): + """Get the value of an entry argument as a boolean + + Args: + name: Name of argument to retrieve + + Returns: + False if the entry argument is consider False (empty, '0' or 'n'), else + True + """ + val = GetEntryArg(name) + return val and val not in ['n', '0'] + def Prepare(images, dtb): """Get device tree files ready for use
tools/binman/test/194_fdt_incl.dts new file +17 -0
@@ -0,0 +1,17 @@ +// SPDX-License-Identifier: GPL-2.0+ + +/dts-v1/; + +/ { + #address-cells = <1>; + #size-cells = <1>; + + binman { + u-boot { + }; + u-boot-spl { + }; + u-boot-tpl { + }; + }; +};
tools/binman/test/195_fdt_incl_tpl.dts new file +13 -0
@@ -0,0 +1,13 @@ +// SPDX-License-Identifier: GPL-2.0+ + +/dts-v1/; + +/ { + #address-cells = <1>; + #size-cells = <1>; + + binman { + u-boot-tpl { + }; + }; +};
Signature · 1 line
2.30.1.766.gb4fecdf3b7-goog
PATCH 12/20 Makefile: Pass new entry args to binman
In reply to Simon GlassTo support the use of 'expanded' entries, binman needs to be told whether SPL and TPL have a devicetree and whether they need BSS padding. Add these to the Makefile.
---
Makefile | 8 ++++++++ 1 file changed, 8 insertions(+)
Makefile +8 -0
@@ -1332,6 +1332,11 @@ u-boot.ldr: u-boot # Use 'make BINMAN_DEBUG=1' to enable debugging # Use 'make BINMAN_VERBOSE=3' to set vebosity level default_dt := $(if $(DEVICE_TREE),$(DEVICE_TREE),$(CONFIG_DEFAULT_DEVICE_TREE)) + +# Tell binman whether we have a devicetree for SPL and TPL +have_spl_dt := $(if $(CONFIG_SPL_OF_PLATDATA),,$(CONFIG_SPL_OF_CONTROL)) +have_tpl_dt := $(if $(CONFIG_TPL_OF_PLATDATA),,$(CONFIG_TPL_OF_CONTROL)) + quiet_cmd_binman = BINMAN $@ cmd_binman = $(srctree)/tools/binman/binman $(if $(BINMAN_DEBUG),-D) \ --toolpath $(objtree)/tools \
@@ -1342,6 +1347,9 @@ cmd_binman = $(srctree)/tools/binman/binman $(if $(BINMAN_DEBUG),-D) \ -a atf-bl31-path=${BL31} \ -a default-dt=$(default_dt) \ -a scp-path=$(SCP) \ + -a spl-bss-pad=$(if $(CONFIG_SPL_SEPARATE_BSS),,1) \ + -a tpl-bss-pad=$(if $(CONFIG_TPL_SEPARATE_BSS),,1) \ + -a spl-dtb=$(have_spl_dt) -a tpl-dtb=$(have_tpl_dt) \ $(BINMAN_$(@F)) OBJCOPYFLAGS_u-boot.ldr.hex := -I binary -O ihex
Signature · 1 line
2.30.1.766.gb4fecdf3b7-goog
PATCH 13/20 x86: Make use of binman expanded entries
In reply to Simon GlassWe don't need to spell out the separate pieces of U-Boot phase binaries anymore. Revert to using the simple entry and let binman do the expansion itself as needed.
---
arch/x86/dts/u-boot.dtsi | 11 +---------- 1 file changed, 1 insertion(+), 10 deletions(-)
arch/x86/dts/u-boot.dtsi +1 -10
@@ -38,20 +38,11 @@ }; #endif spl { - type = "section"; + type = "u-boot-spl"; offset = <CONFIG_X86_OFFSET_SPL>; - u-boot-spl { - }; - u-boot-spl-dtb { - }; }; u-boot { - type = "section"; offset = <CONFIG_X86_OFFSET_U_BOOT>; - u-boot-nodtb { - }; - u-boot-dtb { - }; }; #elif defined(CONFIG_SPL) u-boot-spl-with-ucode-ptr {
Signature · 1 line
2.30.1.766.gb4fecdf3b7-goog
PATCH 14/20 x86: dts: Drop unused CONFIG_SPL
In reply to Simon GlassThis cannot be used since the previous #elif has already dealt with SPL. Drop it.
---
arch/x86/dts/u-boot.dtsi | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-)
arch/x86/dts/u-boot.dtsi +1 -5
@@ -55,11 +55,7 @@ offset = <CONFIG_X86_OFFSET_U_BOOT>; }; #else -# ifdef CONFIG_SPL - u-boot { - offset = <CONFIG_SYS_TEXT_BASE>; - }; -# elif defined(CONFIG_HAVE_MICROCODE) +# ifdef CONFIG_HAVE_MICROCODE /* If there is no SPL then we need to put microcode in U-Boot */ u-boot-with-ucode-ptr { offset = <CONFIG_X86_OFFSET_U_BOOT>;
Signature · 1 line
2.30.1.766.gb4fecdf3b7-goog
PATCH 15/20 doc: Move UEFI down a bit
In reply to Simon GlassThis features a little too prominently in the contents at present. It seems more important to talk about driver model and the API (which includes some UEFI notes).
Reposition it below those.
---
doc/index.rst | 24 ++++++++++++------------ 1 file changed, 12 insertions(+), 12 deletions(-)
doc/index.rst +12 -12
@@ -38,18 +38,6 @@ want to contribute to U-Boot. develop/index -Unified Extensible Firmware (UEFI) ----------------------------------- - -U-Boot provides an implementation of the UEFI API allowing to run UEFI -compliant software like Linux, GRUB, and iPXE. Furthermore U-Boot itself -can be run an UEFI payload. - -.. toctree:: - :maxdepth: 2 - - uefi/index - Driver-Model documentation --------------------------
@@ -76,6 +64,18 @@ needed). api/index +Unified Extensible Firmware (UEFI) +---------------------------------- + +U-Boot provides an implementation of the UEFI API allowing to run UEFI +compliant software like Linux, GRUB, and iPXE. Furthermore U-Boot itself +can be run an UEFI payload. + +.. toctree:: + :maxdepth: 2 + + uefi/index + Architecture-specific doc -------------------------
Signature · 1 line
2.30.1.766.gb4fecdf3b7-goog
PATCH 15/20 doc: Move UEFI down a bit
Quoted 3 lines · Simon Glass
This features a little too prominently in the contents at present. It seems more important to talk about driver model and the API (which includes some UEFI notes).
The driver model is only relevant for developers. So it should be moved to "Develop U-Boot".
The UEFI part should be split up into a development related part under /doc/develop/ and a usage related part under /doc/usage. But as a first step simply move it to /doc/develop together with the driver model, please.
Best regards
Heinrich
Quoted 52 lines
Reposition it below those.
Signed-off-by Simon Glass <[email protected]>---
doc/index.rst | 24 ++++++++++++------------ 1 file changed, 12 insertions(+), 12 deletions(-)doc/index.rst +12
-12@@ -38,18 +38,6 @@ want to contribute to U-Boot. develop/index -Unified Extensible Firmware (UEFI) ----------------------------------- - -U-Boot provides an implementation of the UEFI API allowing to run UEFI -compliant software like Linux, GRUB, and iPXE. Furthermore U-Boot itself -can be run an UEFI payload. - -.. toctree:: - :maxdepth: 2 - - uefi/index - Driver-Model documentation --------------------------@@ -76,6 +64,18 @@ needed). api/index +Unified Extensible Firmware (UEFI) +---------------------------------- + +U-Boot provides an implementation of the UEFI API allowing to run UEFI +compliant software like Linux, GRUB, and iPXE. Furthermore U-Boot itself +can be run an UEFI payload. + +.. toctree:: + :maxdepth: 2 + + uefi/index + Architecture-specific doc -------------------------
PATCH 16/20 binman: doc: Add documentation to htmldocs
In reply to Simon GlassAdd a link to binman's documentation and adjust the files so that it is accessible. Use the name README.rst so it is easy to discover when binman is installed without U-Boot.
---
doc/index.rst | 1 +
doc/package/binman | 1 +
doc/package/fit.rst | 8 +
doc/package/index.rst | 20 ++
tools/binman/{README => README.rst} | 480 ++++++++++++++--------------
tools/binman/control.py | 2 +-
tools/binman/ftest.py | 4 +-
tools/binman/index.rst | 9 +
tools/binman/setup.py | 2 +-
9 files changed, 284 insertions(+), 243 deletions(-)
create mode 120000 doc/package/binman
create mode 100644 doc/package/fit.rst
create mode 100644 doc/package/index.rst
rename tools/binman/{README => README.rst} (73%)
create mode 100644 tools/binman/index.rstdoc/index.rst +1 -0
@@ -25,6 +25,7 @@ trying to get it to work optimally on a given system. :maxdepth: 2 build/index + package/index usage/index Developer-oriented documentation
doc/package/binman new file +1 -0
@@ -0,0 +1 @@ +../../tools/binman
doc/package/fit.rst new file +8 -0
@@ -0,0 +1,8 @@ +.. SPDX-License-Identifier: GPL-2.0+ + +Flat Image Tree (FIT) +===================== + +U-Boot uses Flat Image Tree (FIT) as a standard file format for packaging +images that it it reads and boots. Documentation about FIT is available at +doc/uImage.FIT
doc/package/index.rst new file +20 -0
@@ -0,0 +1,20 @@ +.. SPDX-License-Identifier: GPL-2.0+ + +Package U-Boot +============== + +U-Boot uses Flat Image Tree (FIT) as a standard file format for packaging +images that it it reads and boots. Documentation about FIT is available at +doc/uImage.FIT + +U-Boot also provides binman for cases not covered by FIT. Examples include +initial execution (since FIT itself does not have an executable header) and +dealing with device boundaries, such as the read-only/read-write separation in +SPI flash. + + +.. toctree:: + :maxdepth: 2 + + fit + binman/index
tools/binman/README.rst renamed from tools/binman/README +241 -239
783 lines not on this page · raw message
tools/binman/control.py +1 -1
@@ -569,7 +569,7 @@ def Binman(args): if not pager: pager = 'more' fname = os.path.join(os.path.dirname(os.path.realpath(sys.argv[0])), - 'README') + 'README.rst') command.Run(pager, fname) return 0
tools/binman/ftest.py +2 -2
@@ -631,7 +631,7 @@ class TestFunctional(unittest.TestCase): def testFullHelp(self): """Test that the full help is displayed with -H""" result = self._RunBinman('-H') - help_file = os.path.join(self._binman_dir, 'README') + help_file = os.path.join(self._binman_dir, 'README.rst') # Remove possible extraneous strings extra = '::::::::::::::\n' + help_file + '\n::::::::::::::\n' gothelp = result.stdout.replace(extra, '')
@@ -644,7 +644,7 @@ class TestFunctional(unittest.TestCase): try: command.test_result = command.CommandResult() result = self._DoBinman('-H') - help_file = os.path.join(self._binman_dir, 'README') + help_file = os.path.join(self._binman_dir, 'README.rst') finally: command.test_result = None
tools/binman/index.rst new file +9 -0
@@ -0,0 +1,9 @@ +.. SPDX-License-Identifier: GPL-2.0+ + +Binman +====== + +.. toctree:: + :maxdepth: 2 + + README
tools/binman/setup.py +1 -1
@@ -7,6 +7,6 @@ setup(name='binman', scripts=['binman'], packages=['binman', 'binman.etype'], package_dir={'binman': ''}, - package_data={'binman': ['README', 'README.entries']}, + package_data={'binman': ['README.rst', 'README.entries']}, classifiers=['Environment :: Console', 'Topic :: Software Development :: Embedded Systems'])
Signature · 1 line
2.30.1.766.gb4fecdf3b7-goog
PATCH 16/20 binman: doc: Add documentation to htmldocs
Quoted 10 lines · Simon Glass
Add a link to binman's documentation and adjust the files so that it is accessible. Use the name
README.rstso it is easy to discover when binman is installed without U-Boot.Signed-off-by Simon Glass <[email protected]>---
doc/index.rst | 1 + doc/package/binman | 1 + doc/package/fit.rst | 8 +
This information is only of interest for developers, not for end-users. Please, place that information in /doc/develop/.
Quoted 2 lines
doc/package/index.rst | 20 ++
tools/binman/{README => README.rst} | 480 ++++++++++++++--------------tools/binman/ is the wrong path for documentation. Please, put the file in /doc/develop/binman.rst or /doc/develop/tools/binman.rst so that it becomes available online.
Best regards
Heinrich
Quoted 952 lines
tools/binman/control.py | 2 +- tools/binman/ftest.py | 4 +- tools/binman/index.rst | 9 + tools/binman/setup.py | 2 +- 9 files changed, 284 insertions(+), 243 deletions(-)create mode 120000 doc/package/binman create mode 100644
doc/package/fit.rstcreate mode 100644doc/package/index.rstrenametools/binman/{README=>README.rst} (73%) create mode 100644tools/binman/index.rstdoc/index.rst +1
-0@@ -25,6 +25,7 @@ trying to get it to work optimally on a given system. :maxdepth: 2 build/index + package/index usage/index Developer-oriented documentationdoc/package/binman new file +1
-0@@ -0,0 +1 @@ +../../tools/binmandoc/package/fit.rst new file +8
-0@@ -0,0 +1,8 @@ +.. SPDX-License-Identifier: GPL-2.0+ + +Flat Image Tree (FIT) +===================== + +U-Boot uses Flat Image Tree (FIT) as a standard file format for packaging +images that it it reads and boots. Documentation about FIT is available at +doc/uImage.FITdoc/package/index.rst new file +20
-0@@ -0,0 +1,20 @@ +.. SPDX-License-Identifier: GPL-2.0+ + +Package U-Boot +============== + +U-Boot uses Flat Image Tree (FIT) as a standard file format for packaging +images that it it reads and boots. Documentation about FIT is available at +doc/uImage.FIT + +U-Boot also provides binman for cases not covered by FIT. Examples include +initial execution (since FIT itself does not have an executable header) and +dealing with device boundaries, such as the read-only/read-write separation in +SPI flash. + + +.. toctree:: + :maxdepth: 2 + + fit + binman/indextools/binman/README.rst renamed from tools/binman/README +241
-239@@ -67,18 +67,19 @@ standard format, we can support making valid images for any board without manual effort, lots of READMEs, etc. Benefits: -- Each binary can have its own build system and tool chain without creating -any dependencies between them -- Avoids the need for a single-shot build: individual parts can be updated -and brought in as needed -- Provides for a standard image description available in the build and at -run-time -- SoC-specific image-signing tools can be accommodated -- Avoids cluttering the U-Boot build system with image-building code -- The image description is automatically available at run-time in U-Boot, -SPL. It can be made available to other software also -- The image description is easily readable (it's a text file in device-tree -format) and permits flexible packing of binaries + + - Each binary can have its own build system and tool chain without creating + any dependencies between them + - Avoids the need for a single-shot build: individual parts can be updated + and brought in as needed + - Provides for a standard image description available in the build and at + run-time + - SoC-specific image-signing tools can be accommodated + - Avoids cluttering the U-Boot build system with image-building code + - The image description is automatically available at run-time in U-Boot, + SPL. It can be made available to other software also + - The image description is easily readable (it's a text file in device-tree + format) and permits flexible packing of binaries Terminology@@ -144,14 +145,14 @@ build system. Consider sunxi. It has the following steps: -1. It uses a custom mksunxiboot tool to build an SPL image called -sunxi-spl.bin. This should probably move into mkimage. + #. It uses a custom mksunxiboot tool to build an SPL image called + sunxi-spl.bin. This should probably move into mkimage. -2. It uses mkimage to package U-Boot into a legacy image file (so that it can -hold the load and execution address) called u-boot.img. + #. It uses mkimage to package U-Boot into a legacy image file (so that it can + hold the load and execution address) called u-boot.img. -3. It builds a final output image called u-boot-sunxi-with-spl.bin which -consists of sunxi-spl.bin, some padding and u-boot.img. + #. It builds a final output image called u-boot-sunxi-with-spl.bin which + consists of sunxi-spl.bin, some padding and u-boot.img. Binman is intended to replace the last step. The U-Boot build system builds u-boot.bin and sunxi-spl.bin. Binman can then take over creation of@@ -180,22 +181,22 @@ the configuration of the Intel-format descriptor. Running binman -------------- -First install prerequisites, e.g. +First install prerequisites, e.g:: - sudo apt-get install python-pyelftools python3-pyelftools lzma-alone \ - liblz4-tool + sudo apt-get install python-pyelftools python3-pyelftools lzma-alone \ + liblz4-tool -Type: +Type:: - binman build -b <board_name> + binman build -b <board_name> to build an image for a board. The board name is the same name used when configuring U-Boot (e.g. for sandbox_defconfig the board name is 'sandbox'). Binman assumes that the input files for the build are in ../b/<board_name>. -Or you can specify this explicitly: +Or you can specify this explicitly:: - binman build -I <build_path> + binman build -I <build_path> where <build_path> is the build directory containing the output of the U-Boot build.@@ -212,12 +213,12 @@ Enabling binman for a board --------------------------- At present binman is invoked from a rule in the main Makefile. Typically you -will have a rule like: +will have a rule like:: -ifneq ($(CONFIG_ARCH_<something>),) -u-boot-<your_suffix>.bin: <input_file_1> <input_file_2> checkbinman FORCE - $(call if_changed,binman) -endif + ifneq ($(CONFIG_ARCH_<something>),) + u-boot-<your_suffix>.bin: <input_file_1> <input_file_2> checkbinman FORCE + $(call if_changed,binman) + endif This assumes that u-boot-<your_suffix>.bin is a target, and is the final file that you need to produce. You can make it a target by adding it to INPUTS-y@@ -233,18 +234,18 @@ Image description format ------------------------ The binman node is called 'binman'. An example image description is shown -below: +below:: - binman { - filename = "u-boot-sunxi-with-spl.bin"; - pad-byte = <0xff>; - blob { - filename = "spl/sunxi-spl.bin"; - }; - u-boot { - offset = <CONFIG_SPL_PAD_TO>; - }; - }; + binman { + filename = "u-boot-sunxi-with-spl.bin"; + pad-byte = <0xff>; + blob { + filename = "spl/sunxi-spl.bin"; + }; + u-boot { + offset = <CONFIG_SPL_PAD_TO>; + }; + }; This requests binman to create an image file called u-boot-sunxi-with-spl.bin@@ -270,184 +271,184 @@ use any unique name, with the 'type' property providing the type. The attributes supported for entries are described below. offset: - This sets the offset of an entry within the image or section containing - it. The first byte of the image is normally at offset 0. If 'offset' is - not provided, binman sets it to the end of the previous region, or the - start of the image's entry area (normally 0) if there is no previous - region. + This sets the offset of an entry within the image or section containing + it. The first byte of the image is normally at offset 0. If 'offset' is + not provided, binman sets it to the end of the previous region, or the + start of the image's entry area (normally 0) if there is no previous + region. align: - This sets the alignment of the entry. The entry offset is adjusted - so that the entry starts on an aligned boundary within the containing - section or image. For example 'align = <16>' means that the entry will - start on a 16-byte boundary. This may mean that padding is added before - the entry. The padding is part of the containing section but is not - included in the entry, meaning that an empty space may be created before - the entry starts. Alignment should be a power of 2. If 'align' is not - provided, no alignment is performed. + This sets the alignment of the entry. The entry offset is adjusted + so that the entry starts on an aligned boundary within the containing + section or image. For example 'align = <16>' means that the entry will + start on a 16-byte boundary. This may mean that padding is added before + the entry. The padding is part of the containing section but is not + included in the entry, meaning that an empty space may be created before + the entry starts. Alignment should be a power of 2. If 'align' is not + provided, no alignment is performed. size: - This sets the size of the entry. The contents will be padded out to - this size. If this is not provided, it will be set to the size of the - contents. + This sets the size of the entry. The contents will be padded out to + this size. If this is not provided, it will be set to the size of the + contents. pad-before: - Padding before the contents of the entry. Normally this is 0, meaning - that the contents start at the beginning of the entry. This can be used - to offset the entry contents a little. While this does not affect the - contents of the entry within binman itself (the padding is performed - only when its parent section is assembled), the end result will be that - the entry starts with the padding bytes, so may grow. Defaults to 0. + Padding before the contents of the entry. Normally this is 0, meaning + that the contents start at the beginning of the entry. This can be used + to offset the entry contents a little. While this does not affect the + contents of the entry within binman itself (the padding is performed + only when its parent section is assembled), the end result will be that + the entry starts with the padding bytes, so may grow. Defaults to 0. pad-after: - Padding after the contents of the entry. Normally this is 0, meaning - that the entry ends at the last byte of content (unless adjusted by - other properties). This allows room to be created in the image for - this entry to expand later. While this does not affect the contents of - the entry within binman itself (the padding is performed only when its - parent section is assembled), the end result will be that the entry ends - with the padding bytes, so may grow. Defaults to 0. + Padding after the contents of the entry. Normally this is 0, meaning + that the entry ends at the last byte of content (unless adjusted by + other properties). This allows room to be created in the image for + this entry to expand later. While this does not affect the contents of + the entry within binman itself (the padding is performed only when its + parent section is assembled), the end result will be that the entry ends + with the padding bytes, so may grow. Defaults to 0. align-size: - This sets the alignment of the entry size. For example, to ensure - that the size of an entry is a multiple of 64 bytes, set this to 64. - While this does not affect the contents of the entry within binman - itself (the padding is performed only when its parent section is - assembled), the end result is that the entry ends with the padding - bytes, so may grow. If 'align-size' is not provided, no alignment is - performed. + This sets the alignment of the entry size. For example, to ensure + that the size of an entry is a multiple of 64 bytes, set this to 64. + While this does not affect the contents of the entry within binman + itself (the padding is performed only when its parent section is + assembled), the end result is that the entry ends with the padding + bytes, so may grow. If 'align-size' is not provided, no alignment is + performed. align-end: - This sets the alignment of the end of an entry with respect to the - containing section. Some entries require that they end on an alignment - boundary, regardless of where they start. This does not move the start - of the entry, so the contents of the entry will still start at the - beginning. But there may be padding at the end. While this does not - affect the contents of the entry within binman itself (the padding is - performed only when its parent section is assembled), the end result - is that the entry ends with the padding bytes, so may grow. - If 'align-end' is not provided, no alignment is performed. + This sets the alignment of the end of an entry with respect to the + containing section. Some entries require that they end on an alignment + boundary, regardless of where they start. This does not move the start + of the entry, so the contents of the entry will still start at the + beginning. But there may be padding at the end. While this does not + affect the contents of the entry within binman itself (the padding is + performed only when its parent section is assembled), the end result + is that the entry ends with the padding bytes, so may grow. + If 'align-end' is not provided, no alignment is performed. filename: - For 'blob' types this provides the filename containing the binary to - put into the entry. If binman knows about the entry type (like - u-boot-bin), then there is no need to specify this. + For 'blob' types this provides the filename containing the binary to + put into the entry. If binman knows about the entry type (like + u-boot-bin), then there is no need to specify this. type: - Sets the type of an entry. This defaults to the entry name, but it is - possible to use any name, and then add (for example) 'type = "u-boot"' - to specify the type. + Sets the type of an entry. This defaults to the entry name, but it is + possible to use any name, and then add (for example) 'type = "u-boot"' + to specify the type. offset-unset: - Indicates that the offset of this entry should not be set by placing - it immediately after the entry before. Instead, is set by another - entry which knows where this entry should go. When this boolean - property is present, binman will give an error if another entry does - not set the offset (with the GetOffsets() method). + Indicates that the offset of this entry should not be set by placing + it immediately after the entry before. Instead, is set by another + entry which knows where this entry should go. When this boolean + property is present, binman will give an error if another entry does + not set the offset (with the GetOffsets() method). image-pos: - This cannot be set on entry (or at least it is ignored if it is), but - with the -u option, binman will set it to the absolute image position - for each entry. This makes it easy to find out exactly where the entry - ended up in the image, regardless of parent sections, etc. + This cannot be set on entry (or at least it is ignored if it is), but + with the -u option, binman will set it to the absolute image position + for each entry. This makes it easy to find out exactly where the entry + ended up in the image, regardless of parent sections, etc. expand-size: - Expand the size of this entry to fit available space. This space is only - limited by the size of the image/section and the position of the next - entry. + Expand the size of this entry to fit available space. This space is only + limited by the size of the image/section and the position of the next + entry. compress: - Sets the compression algortihm to use (for blobs only). See the entry - documentation for details. + Sets the compression algortihm to use (for blobs only). See the entry + documentation for details. missing-msg: - Sets the tag of the message to show if this entry is missing. This is - used for external blobs. When they are missing it is helpful to show - information about what needs to be fixed. See missing-blob-help for the - message for each tag. + Sets the tag of the message to show if this entry is missing. This is + used for external blobs. When they are missing it is helpful to show + information about what needs to be fixed. See missing-blob-help for the + message for each tag. The attributes supported for images and sections are described below. Several are similar to those for entries. size: - Sets the image size in bytes, for example 'size = <0x100000>' for a - 1MB image. + Sets the image size in bytes, for example 'size = <0x100000>' for a + 1MB image. offset: - This is similar to 'offset' in entries, setting the offset of a section - within the image or section containing it. The first byte of the section - is normally at offset 0. If 'offset' is not provided, binman sets it to - the end of the previous region, or the start of the image's entry area - (normally 0) if there is no previous region. + This is similar to 'offset' in entries, setting the offset of a section + within the image or section containing it. The first byte of the section + is normally at offset 0. If 'offset' is not provided, binman sets it to + the end of the previous region, or the start of the image's entry area + (normally 0) if there is no previous region. align-size: - This sets the alignment of the image size. For example, to ensure - that the image ends on a 512-byte boundary, use 'align-size = <512>'. - If 'align-size' is not provided, no alignment is performed. + This sets the alignment of the image size. For example, to ensure + that the image ends on a 512-byte boundary, use 'align-size = <512>'. + If 'align-size' is not provided, no alignment is performed. pad-before: - This sets the padding before the image entries. The first entry will - be positioned after the padding. This defaults to 0. + This sets the padding before the image entries. The first entry will + be positioned after the padding. This defaults to 0. pad-after: - This sets the padding after the image entries. The padding will be - placed after the last entry. This defaults to 0. + This sets the padding after the image entries. The padding will be + placed after the last entry. This defaults to 0. pad-byte: - This specifies the pad byte to use when padding in the image. It - defaults to 0. To use 0xff, you would add 'pad-byte = <0xff>'. + This specifies the pad byte to use when padding in the image. It + defaults to 0. To use 0xff, you would add 'pad-byte = <0xff>'. filename: - This specifies the image filename. It defaults to 'image.bin'. + This specifies the image filename. It defaults to 'image.bin'. sort-by-offset: - This causes binman to reorder the entries as needed to make sure they - are in increasing positional order. This can be used when your entry - order may not match the positional order. A common situation is where - the 'offset' properties are set by CONFIG options, so their ordering is - not known a priori. + This causes binman to reorder the entries as needed to make sure they + are in increasing positional order. This can be used when your entry + order may not match the positional order. A common situation is where + the 'offset' properties are set by CONFIG options, so their ordering is + not known a priori. - This is a boolean property so needs no value. To enable it, add a - line 'sort-by-offset;' to your description. + This is a boolean property so needs no value. To enable it, add a + line 'sort-by-offset;' to your description. multiple-images: - Normally only a single image is generated. To create more than one - image, put this property in the binman node. For example, this will - create image1.bin containing u-boot.bin, and image2.bin containing - both spl/u-boot-spl.bin and u-boot.bin: - - binman { - multiple-images; - image1 { - u-boot { - }; - }; - - image2 { - spl { - }; - u-boot { - }; - }; - }; + Normally only a single image is generated. To create more than one + image, put this property in the binman node. For example, this will + create image1.bin containing u-boot.bin, and image2.bin containing + both spl/u-boot-spl.bin and u-boot.bin:: + + binman { + multiple-images; + image1 { + u-boot { + }; + }; + + image2 { + spl { + }; + u-boot { + }; + }; + }; end-at-4gb: - For x86 machines the ROM offsets start just before 4GB and extend - up so that the image finished at the 4GB boundary. This boolean - option can be enabled to support this. The image size must be - provided so that binman knows when the image should start. For an - 8MB ROM, the offset of the first entry would be 0xfff80000 with - this option, instead of 0 without this option. + For x86 machines the ROM offsets start just before 4GB and extend + up so that the image finished at the 4GB boundary. This boolean + option can be enabled to support this. The image size must be + provided so that binman knows when the image should start. For an + 8MB ROM, the offset of the first entry would be 0xfff80000 with + this option, instead of 0 without this option. skip-at-start: - This property specifies the entry offset of the first entry. + This property specifies the entry offset of the first entry. - For PowerPC mpc85xx based CPU, CONFIG_SYS_TEXT_BASE is the entry - offset of the first entry. It can be 0xeff40000 or 0xfff40000 for - nor flash boot, 0x201000 for sd boot etc. + For PowerPC mpc85xx based CPU, CONFIG_SYS_TEXT_BASE is the entry + offset of the first entry. It can be 0xeff40000 or 0xfff40000 for + nor flash boot, 0x201000 for sd boot etc. - 'end-at-4gb' property is not applicable where CONFIG_SYS_TEXT_BASE + - Image size != 4gb. + 'end-at-4gb' property is not applicable where CONFIG_SYS_TEXT_BASE + + Image size != 4gb. Examples of the above options can be found in the tests. See the tools/binman/test directory.@@ -470,23 +471,23 @@ This feature provides a way of creating hierarchical images. For example here is an example image with two copies of U-Boot. One is read-only (ro), intended to be written only in the factory. Another is read-write (rw), so that it can be upgraded in the field. The sizes are fixed so that the ro/rw boundary is known -and can be programmed: - - binman { - section at 0 { - read-only; - name-prefix = "ro-"; - size = <0x100000>; - u-boot { - }; - }; - section at 1 { - name-prefix = "rw-"; - size = <0x100000>; - u-boot { - }; - }; - }; +and can be programmed:: + + binman { + section at 0 { + read-only; + name-prefix = "ro-"; + size = <0x100000>; + u-boot { + }; + }; + section at 1 { + name-prefix = "rw-"; + size = <0x100000>; + u-boot { + }; + }; + }; This image could be placed into a SPI flash chip, with the protection boundary set at 1MB.@@ -494,14 +495,14 @@ set at 1MB. A few special properties are provided for sections: read-only: - Indicates that this section is read-only. This has no impact on binman's - operation, but his property can be read at run time. + Indicates that this section is read-only. This has no impact on binman's + operation, but his property can be read at run time. name-prefix: - This string is prepended to all the names of the binaries in the - section. In the example above, the 'u-boot' binaries which actually be - renamed to 'ro-u-boot' and 'rw-u-boot'. This can be useful to - distinguish binaries with otherwise identical names. + This string is prepended to all the names of the binaries in the + section. In the example above, the 'u-boot' binaries which actually be + renamed to 'ro-u-boot' and 'rw-u-boot'. This can be useful to + distinguish binaries with otherwise identical names. Image Properties@@ -510,21 +511,21 @@ Image Properties Image nodes act like sections but also have a few extra properties: filename: - Output filename for the image. This defaults to image.bin (or in the - case of multiple images <nodename>.bin where <nodename> is the name of - the image node. + Output filename for the image. This defaults to image.bin (or in the + case of multiple images <nodename>.bin where <nodename> is the name of + the image node. allow-repack: - Create an image that can be repacked. With this option it is possible - to change anything in the image after it is created, including updating - the position and size of image components. By default this is not - permitted since it is not possibly to know whether this might violate a - constraint in the image description. For example, if a section has to - increase in size to hold a larger binary, that might cause the section - to fall out of its allow region (e.g. read-only portion of flash). + Create an image that can be repacked. With this option it is possible + to change anything in the image after it is created, including updating + the position and size of image components. By default this is not + permitted since it is not possibly to know whether this might violate a + constraint in the image description. For example, if a section has to + increase in size to hold a larger binary, that might cause the section + to fall out of its allow region (e.g. read-only portion of flash). - Adding this property causes the original offset and size values in the - image description to be stored in the FDT and fdtmap. + Adding this property causes the original offset and size values in the + image description to be stored in the FDT and fdtmap. Entry Documentation@@ -533,14 +534,14 @@ Entry Documentation For details on the various entry types supported by binman and how to use them, see README.entries. This is generated from the source code using: - binman entry-docs >tools/binman/README.entries + binman entry-docs >tools/binman/README.entries Listing images -------------- It is possible to list the entries in an existing firmware image created by -binman, provided that there is an 'fdtmap' entry in the image. For example: +binman, provided that there is an 'fdtmap' entry in the image. For example:: $ binman ls -i image.bin Name Image-pos Size Entry-type Offset Uncomp-size@@ -559,7 +560,7 @@ This shows the hierarchy of the image, the position, size and type of each entry, the offset of each entry within its parent and the uncompressed size if the entry is compressed. -It is also possible to list just some files in an image, e.g. +It is also possible to list just some files in an image, e.g.:: $ binman ls -i image.bin section/cbfs Name Image-pos Size Entry-type Offset Uncomp-size@@ -568,7 +569,7 @@ It is also possible to list just some files in an image, e.g. u-boot 138 4 u-boot 38 u-boot-dtb 180 108 u-boot-dtb 80 3b5 -or with wildcards: +or with wildcards:: $ binman ls -i image.bin "*cb*" "*head*" Name Image-pos Size Entry-type Offset Uncomp-size@@ -583,22 +584,22 @@ Extracting files from images ---------------------------- You can extract files from an existing firmware image created by binman, -provided that there is an 'fdtmap' entry in the image. For example: +provided that there is an 'fdtmap' entry in the image. For example:: $ binman extract -i image.bin section/cbfs/u-boot which will write the uncompressed contents of that entry to the file 'u-boot' in the current directory. You can also extract to a particular file, in this case -u-boot.bin: +u-boot.bin:: $ binman extract -i image.bin section/cbfs/u-boot -f u-boot.bin It is possible to extract all files into a destination directory, which will -put files in subdirectories matching the entry hierarchy: +put files in subdirectories matching the entry hierarchy:: $ binman extract -i image.bin -O outdir -or just a selection: +or just a selection:: $ binman extract -i image.bin "*u-boot*" -O outdir@@ -616,18 +617,18 @@ to the that entry, compressing if necessary. If the entry size changes, you must add the 'allow-repack' property to the original image before generating it (see above), otherwise you will get an error. -You can also use a particular file, in this case u-boot.bin: +You can also use a particular file, in this case u-boot.bin:: $ binman replace -i image.bin section/cbfs/u-boot -f u-boot.bin It is possible to replace all files from a source directory which uses the same -hierarchy as the entries: +hierarchy as the entries:: $ binman replace -i image.bin -I indir Files that are missing will generate a warning. -You can also replace just a selection of entries: +You can also replace just a selection of entries:: $ binman replace -i image.bin "*u-boot*" -I indir@@ -656,15 +657,15 @@ Hashing Entries --------------- It is possible to ask binman to hash the contents of an entry and write that -value back to the device-tree node. For example: +value back to the device-tree node. For example:: - binman { - u-boot { - hash { - algo = "sha256"; - }; - }; - }; + binman { + u-boot { + hash { + algo = "sha256"; + }; + }; + }; Here, a new 'value' property will be written to the 'hash' node containing the hash of the 'u-boot' entry. Only SHA256 is supported at present. Whole@@ -759,7 +760,7 @@ a common header. You can then put the binman node (and anything else that is specific to U-Boot, such as u-boot,dm-pre-reloc properies) in that header file. -Binman will search for the following files in arch/<arch>/dts: +Binman will search for the following files in arch/<arch>/dts:: <dts>-u-boot.dtsi where <dts> is the base name of the .dts file <CONFIG_SYS_SOC>-u-boot.dtsi@@ -770,7 +771,7 @@ Binman will search for the following files in arch/<arch>/dts: U-Boot will only use the first one that it finds. If you need to include a more general file you can do that from the more specific file using #include. If you are having trouble figuring out what is going on, you can uncomment -the 'warning' line in scripts/Makefile.lib to see what it has found: +the 'warning' line in scripts/Makefile.lib to see what it has found:: # Uncomment for debugging # This shows all the files that were considered and the one that we chose.@@ -786,13 +787,13 @@ is useful to be able to find the location of U-Boot so that it can be executed when SPL is finished. Binman allows you to declare symbols in the SPL image which are filled in -with their correct values during the build. For example: +with their correct values during the build. For example:: binman_sym_declare(ulong, u_boot_any, image_pos); declares a ulong value which will be assigned to the image-pos of any U-Boot image (u-boot.bin, u-boot.img, u-boot-nodtb.bin) that is present in the image. -You can access this value with something like: +You can access this value with something like:: ulong u_boot_offset = binman_sym(ulong, u_boot_any, image_pos);@@ -844,18 +845,18 @@ Expanded entries ---------------- Binman automatically replaces 'u-boot' with an expanded version of that, i.e. -'u-boot-expanded'. This means that when you write: +'u-boot-expanded'. This means that when you write:: u-boot { }; -you actually get: +you actually get:: u-boot { type = "u-boot-expanded'; }; -which in turn expands to: +which in turn expands to:: u-boot { type = "section";@@ -879,19 +880,19 @@ U-Boot executable and can be updated separately by binman as needed. It can be disabled with the --no-expanded flag if required. The same applies for u-boot-spl and u-boot-spl. In those cases, the expansion -includes the BSS padding, so for example: +includes the BSS padding, so for example:: spl { type = "u-boot-spl" }; -you actually get: +you actually get:: spl { type = "u-boot-expanded'; }; -which in turn expands to: +which in turn expands to:: spl { type = "section";@@ -921,7 +922,7 @@ Compression ----------- Binman support compression for 'blob' entries (those of type 'blob' and -derivatives). To enable this for an entry, add a 'compress' property: +derivatives). To enable this for an entry, add a 'compress' property:: blob { filename = "datafile";@@ -946,7 +947,7 @@ Map files --------- The -m option causes binman to output a .map file for each image that it -generates. This shows the offset and size of each entry. For example: +generates. This shows the offset and size of each entry. For example:: Offset Size Name 00000000 00000028 main-section@@ -969,11 +970,11 @@ Sometimes it is useful to pass binman the value of an entry property from the command line. For example some entries need access to files and it is not always convenient to put these filenames in the image definition (device tree). -The-a option supports this: +The-a option supports this:: -a<prop>=<value> -where +where:: <prop> is the property to set <value> is the value to set it to@@ -1004,7 +1005,7 @@ Code coverage Binman is a critical tool and is designed to be very testable. Entry implementations target 100% test coverage. Run 'binman test -T' to check this. -To enable Python test coverage on Debian-type distributions (e.g. Ubuntu): +To enable Python test coverage on Debian-type distributions (e.g. Ubuntu):: $ sudo apt-get install python-coverage python3-coverage python-pytest@@ -1015,7 +1016,7 @@ Concurrent tests Binman tries to run tests concurrently. This means that the tests make use of all available CPUs to run. - To enable this: + To enable this:: $ sudo apt-get install python-subunit python3-subunit@@ -1038,11 +1039,11 @@ Binman's tests have been written under the assumption that they'll be run on a x86-like host and there hasn't been an attempt to make them portable yet. However, it's possible to run the tests by cross-compiling to x86. -To install an x86 cross-compiler on Debian-type distributions (e.g. Ubuntu): +To install an x86 cross-compiler on Debian-type distributions (e.g. Ubuntu):: $ sudo apt-get install gcc-x86-64-linux-gnu -Then, you can run the tests under cross-compilation: +Then, you can run the tests under cross-compilation:: $ CROSS_COMPILE=x86_64-linux-gnu- binman test -T@@ -1078,13 +1079,13 @@ the DTC environment variable. This can be useful when the system dtc is too old. To enable a full backtrace and other debugging features in binman, pass -BINMAN_DEBUG=1 to your build: +BINMAN_DEBUG=1 to your build:: make qemu-x86_defconfig make BINMAN_DEBUG=1 To enable verbose logging from binman, base BINMAN_VERBOSE to your build, which -adds a -v<level> option to the call to binman: +adds a -v<level> option to the call to binman:: make qemu-x86_defconfig make BINMAN_VERBOSE=5@@ -1124,6 +1125,7 @@ To do ----- Some ideas: + - Use of-platdata to make the information available to code that is unable to use device tree (such as a very small SPL image) - Allow easy building of images by specifying just the board nametools/binman/control.py +1
-1@@ -569,7 +569,7 @@ def Binman(args): if not pager: pager = 'more' fname = os.path.join(os.path.dirname(os.path.realpath(sys.argv[0])), - 'README') + 'README.rst') command.Run(pager, fname) return 0tools/binman/ftest.py +2
-2@@ -631,7 +631,7 @@ class TestFunctional(unittest.TestCase): def testFullHelp(self): """Test that the full help is displayed with -H""" result = self._RunBinman('-H') - help_file = os.path.join(self._binman_dir, 'README') + help_file = os.path.join(self._binman_dir, 'README.rst') # Remove possible extraneous strings extra = '::::::::::::::\n' + help_file + '\n::::::::::::::\n' gothelp = result.stdout.replace(extra, '')@@ -644,7 +644,7 @@ class TestFunctional(unittest.TestCase): try: command.test_result = command.CommandResult() result = self._DoBinman('-H') - help_file = os.path.join(self._binman_dir, 'README') + help_file = os.path.join(self._binman_dir, 'README.rst') finally: command.test_result = Nonetools/binman/index.rst new file +9
-0@@ -0,0 +1,9 @@ +.. SPDX-License-Identifier: GPL-2.0+ + +Binman +====== + +.. toctree:: + :maxdepth: 2 + + READMEtools/binman/setup.py +1
-1@@ -7,6 +7,6 @@ setup(name='binman', scripts=['binman'], packages=['binman', 'binman.etype'], package_dir={'binman': ''}, - package_data={'binman': ['README', 'README.entries']}, + package_data={'binman': ['README.rst', 'README.entries']}, classifiers=['Environment :: Console', 'Topic :: Software Development :: Embedded Systems'])
PATCH 16/20 binman: doc: Add documentation to htmldocs
Hi Heinrich,
Quoted 9 lines · Heinrich Schuchardt
Quoted 7 lines · Simon Glass
Add a link to binman's documentation and adjust the files so that it is accessible. Use the name
README.rstso it is easy to discover when binman is installed without U-Boot.Signed-off-by Simon Glass <[email protected]>---
Quoted 6 lines
Quoted 3 lines
doc/index.rst | 1 + doc/package/binman | 1 + doc/package/fit.rst | 8 +This information is only of interest for developers, not for end-users. Please, place that information in /doc/develop/.
What is the difference between this and building? The build stuff is at the top level. People presumably need to package U-Boot as well, in order to use it.
Quoted 7 lines
Quoted 3 lines
doc/package/index.rst | 20 ++ tools/binman/{README => README.rst} | 480 ++++++++++++++--------------
tools/binman/is the wrong path for documentation. Please, put the file in /doc/develop/binman.rst or /doc/develop/tools/binman.rst so that it becomes available online.
Does this mean that README.rst would not appear? Why not?
See the commit message for why I chose this. I suppose I could add a separate README if needed.
Regards,
Simon
PATCH 16/20 binman: doc: Add documentation to htmldocs
Quoted 16 lines · Simon Glass
Hi Heinrich,
Quoted 13 lines · Heinrich Schuchardt
Quoted 10 lines · Simon Glass
Add a link to binman's documentation and adjust the files so that it is accessible. Use the name
README.rstso it is easy to discover when binman is installed without U-Boot.Signed-off-by Simon Glass <[email protected]>---
doc/index.rst | 1 + doc/package/binman | 1 + doc/package/fit.rst | 8 +
Quoted 6 lines
Quoted 2 lines
This information is only of interest for developers, not for end-users. Please, place that information in /doc/develop/.
What is the difference between this and building? The build stuff is at the top level. People presumably need to package U-Boot as well, in order to use it.
I never needed to use binman directly to build U-Boot and deploy it. That is why I say it should be described in /doc/develop/
FIT images to containing a kernel are a different story. Those should be described in /doc/usage/
Quoted 10 lines
Quoted 8 lines
Quoted 4 lines
doc/package/index.rst | 20 ++ tools/binman/{README => README.rst} | 480 ++++++++++++++--------------
tools/binman/is the wrong path for documentation. Please, put the file in /doc/develop/binman.rst or /doc/develop/tools/binman.rst so that it becomes available online.Does this mean that
README.rstwould not appear? Why not?
All documentation should reside in doc
--------------------------------------
You added a symbolic link
doc/package/binman=>../../tools/binman
including a whole bunch of unrelated files into doc.
To me this is chaos. I want to have one directory with all documentation.
A filename called README.rst does not convey what it is about. So it is unsuitable inside doc/
Binman is useless outside U-Boot as it needs the board device-trees coming with U-Boot. There is no reason to install it without U-Boot.
The patch creates a bug
-----------------------
$ tools/binman/binman -H more: cannot open tools/binman/README: No such file or directory
The patch is not applicable to origin/master
--------------------------------------------
Applying: binman: doc: Add documentation to htmldocs
error: patch failed: tools/binman/README:844
error: tools/binman/README: patch does not apply
doc/package/binman/README.rst does not build
--------------------------------------------
Warning, treated as error:
doc/package/binman/README.rst:851:Definition list ends without a blank line; unexpected unindent.
So I suggest that you put a binman.rst into /doc/devel and fix binman to find its documentation.
Best regards
Heinrich
Quoted 7 lines
See the commit message for why I chose this. I suppose I could add a separate README if needed.
Regards,
Simon
PATCH 16/20 binman: doc: Add documentation to htmldocs
Hi Heinrich,
Quoted 25 lines · Heinrich Schuchardt
Quoted 16 lines · Simon Glass
Hi Heinrich,
Quoted 13 lines · Heinrich Schuchardt
Quoted 10 lines · Simon Glass
Add a link to binman's documentation and adjust the files so that it is accessible. Use the name
README.rstso it is easy to discover when binman is installed without U-Boot.Signed-off-by Simon Glass <[email protected]>---
doc/index.rst | 1 + doc/package/binman | 1 + doc/package/fit.rst | 8 +Quoted 6 lines
Quoted 2 lines
This information is only of interest for developers, not for end-users. Please, place that information in /doc/develop/.
What is the difference between this and building? The build stuff is at the top level. People presumably need to package U-Boot as well, in order to use it.
Quoted 5 lines
I never needed to use binman directly to build U-Boot and deploy it. That is why I say it should be described in /doc/develop/
FIT images to containing a kernel are a different story. Those should be described in /doc/usage/
OK well I'll put it under develop.
Quoted 21 lines
Quoted 11 lines
Quoted 9 lines
Quoted 5 lines
doc/package/index.rst | 20 ++ tools/binman/{README => README.rst} | 480 ++++++++++++++--------------
tools/binman/is the wrong path for documentation. Please, put the file in /doc/develop/binman.rst or /doc/develop/tools/binman.rst so that it becomes available online.Does this mean that
README.rstwould not appear? Why not?All documentation should reside in doc
--------------------------------------You added a symbolic link
doc/package/binman=>../../tools/binmanincluding a whole bunch of unrelated files into doc.
Quoted 7 lines
To me this is chaos. I want to have one directory with all documentation.
A filename called
README.rstdoes not convey what it is about. So it is unsuitable inside doc/Binman is useless outside U-Boot as it needs the board device-trees coming with U-Boot. There is no reason to install it without U-Boot.
Actually it doesn't. We are using it with Zephyr, for example. I do want to support installing it on a system, just like patman.
Quoted 8 lines
The patch creates a bug
-----------------------$ tools/binman/binman -H more: cannot open tools/binman/README: No such file or directoryThe patch is not applicable to origin/master
It is based on us/next....the background here is that a whole load of patches got punted to -next so everything I am doing now is on -next.
Quoted 9 lines
--------------------------------------------
Applying: binman: doc: Add documentation to htmldocs
error: patch failed:tools/binman/README:844
error:tools/binman/README: patch does not apply
doc/package/binman/README.rstdoes not build
--------------------------------------------
Quoted 6 lines
Warning, treated as error:
doc/package/binman/README.rst:851:Definition list ends without a blank line; unexpected unindent.So I suggest that you put a
binman.rstinto /doc/devel and fix binman to find its documentation.
I cannot simply copy the docs into that directory. Then we end up with two copies. What exactly is wrong with a symlink?
Regards,
Simon
PATCH 16/20 binman: doc: Add documentation to htmldocs
Quoted 59 lines · Simon Glass
Hi Heinrich,
Quoted 25 lines · Heinrich Schuchardt
Quoted 16 lines · Simon Glass
Hi Heinrich,
Quoted 13 lines · Heinrich Schuchardt
Quoted 10 lines · Simon Glass
Add a link to binman's documentation and adjust the files so that it is accessible. Use the name
README.rstso it is easy to discover when binman is installed without U-Boot.Signed-off-by Simon Glass <[email protected]>---
doc/index.rst | 1 + doc/package/binman | 1 + doc/package/fit.rst | 8 +Quoted 6 lines
Quoted 2 lines
This information is only of interest for developers, not for end-users. Please, place that information in /doc/develop/.
What is the difference between this and building? The build stuff is at the top level. People presumably need to package U-Boot as well, in order to use it.
Quoted 5 lines
I never needed to use binman directly to build U-Boot and deploy it. That is why I say it should be described in /doc/develop/
FIT images to containing a kernel are a different story. Those should be described in /doc/usage/
OK well I'll put it under develop.
Quoted 23 lines
Quoted 11 lines
Quoted 9 lines
Quoted 5 lines
doc/package/index.rst | 20 ++ tools/binman/{README => README.rst} | 480 ++++++++++++++--------------
tools/binman/is the wrong path for documentation. Please, put the file in /doc/develop/binman.rst or /doc/develop/tools/binman.rst so that it becomes available online.Does this mean that
README.rstwould not appear? Why not?All documentation should reside in doc
--------------------------------------You added a symbolic link
doc/package/binman=>../../tools/binmanincluding a whole bunch of unrelated files into doc.
To me this is chaos. I want to have one directory with all documentation.
Quoted 7 lines
Quoted 5 lines
A filename called
README.rstdoes not convey what it is about. So it is unsuitable inside doc/Binman is useless outside U-Boot as it needs the board device-trees coming with U-Boot. There is no reason to install it without U-Boot.
Actually it doesn't. We are using it with Zephyr, for example. I do
The README says it uses the board device-trees. But I guess you know better where it could be used.
Zephyr test management?
https://www.getzephyr.com/
Zephyr RTOS?
https://www.zephyrproject.org/
Quoted 28 lines
want to support installing it on a system, just like patman.
Quoted 8 lines
The patch creates a bug
-----------------------$ tools/binman/binman -H more: cannot open tools/binman/README: No such file or directoryThe patch is not applicable to origin/master
It is based on us/next....the background here is that a whole load of patches got punted to -next so everything I am doing now is on -next.
Quoted 13 lines
--------------------------------------------
Applying: binman: doc: Add documentation to htmldocs
error: patch failed:tools/binman/README:844
error:tools/binman/README: patch does not apply
doc/package/binman/README.rstdoes not build
--------------------------------------------Warning, treated as error:
doc/package/binman/README.rst:851:Definition list ends without a blank line; unexpected unindent.
Quoted 5 lines
Quoted 2 lines
So I suggest that you put a
binman.rstinto /doc/devel and fix binman to find its documentation.I cannot simply copy the docs into that directory. Then we end up with two copies. What exactly is wrong with a symlink?
If you want to symlink, please, only symlink the single file and not the directory and in /doc call it binman.rst.
Best regards
Heinrich
Quoted 4 lines
Regards,
Simon
PATCH 16/20 binman: doc: Add documentation to htmldocs
Hi Heinrich,
Quoted 69 lines · Heinrich Schuchardt
Quoted 59 lines · Simon Glass
Hi Heinrich,
Quoted 25 lines · Heinrich Schuchardt
Quoted 16 lines · Simon Glass
Hi Heinrich,
Quoted 13 lines · Heinrich Schuchardt
Quoted 10 lines · Simon Glass
Add a link to binman's documentation and adjust the files so that it is accessible. Use the name
README.rstso it is easy to discover when binman is installed without U-Boot.Signed-off-by Simon Glass <[email protected]>---
doc/index.rst | 1 + doc/package/binman | 1 + doc/package/fit.rst | 8 +Quoted 6 lines
Quoted 2 lines
This information is only of interest for developers, not for end-users. Please, place that information in /doc/develop/.
What is the difference between this and building? The build stuff is at the top level. People presumably need to package U-Boot as well, in order to use it.
Quoted 5 lines
I never needed to use binman directly to build U-Boot and deploy it. That is why I say it should be described in /doc/develop/
FIT images to containing a kernel are a different story. Those should be described in /doc/usage/
OK well I'll put it under develop.
Quoted 23 lines
Quoted 11 lines
Quoted 9 lines
Quoted 5 lines
doc/package/index.rst | 20 ++ tools/binman/{README => README.rst} | 480 ++++++++++++++--------------
tools/binman/is the wrong path for documentation. Please, put the file in /doc/develop/binman.rst or /doc/develop/tools/binman.rst so that it becomes available online.Does this mean that
README.rstwould not appear? Why not?All documentation should reside in doc
--------------------------------------You added a symbolic link
doc/package/binman=>../../tools/binmanincluding a whole bunch of unrelated files into doc.
To me this is chaos. I want to have one directory with all documentation.
Quoted 7 lines
Quoted 5 lines
A filename called
README.rstdoes not convey what it is about. So it is unsuitable inside doc/Binman is useless outside U-Boot as it needs the board device-trees coming with U-Boot. There is no reason to install it without U-Boot.
Actually it doesn't. We are using it with Zephyr, for example. I do
Quoted 8 lines
The README says it uses the board device-trees. But I guess you know better where it could be used.
Zephyr test management?
https://www.getzephyr.com/Zephyr RTOS?
https://www.zephyrproject.org/
That one.
Quoted 29 lines
Quoted 29 lines
want to support installing it on a system, just like patman.
Quoted 8 lines
The patch creates a bug
-----------------------$ tools/binman/binman -H more: cannot open tools/binman/README: No such file or directoryThe patch is not applicable to origin/master
It is based on us/next....the background here is that a whole load of patches got punted to -next so everything I am doing now is on -next.
Quoted 13 lines
--------------------------------------------
Applying: binman: doc: Add documentation to htmldocs
error: patch failed:tools/binman/README:844
error:tools/binman/README: patch does not apply
doc/package/binman/README.rstdoes not build
--------------------------------------------Warning, treated as error:
doc/package/binman/README.rst:851:Definition list ends without a blank line; unexpected unindent.
Quoted 8 lines
Quoted 5 lines
Quoted 2 lines
So I suggest that you put a
binman.rstinto /doc/devel and fix binman to find its documentation.I cannot simply copy the docs into that directory. Then we end up with two copies. What exactly is wrong with a symlink?
If you want to symlink, please, only symlink the single file and not the directory and in /doc call it
binman.rst.
OK I can symlink each file individually.
Regards,
Simon
PATCH 17/20 binman: Rearrange documentation into headings
In reply to Simon GlassCollect the material into different top-level headings to make it easier to read.
---
tools/binman/README.rst | 523 ++++++++++++++++++++-------------------- 1 file changed, 266 insertions(+), 257 deletions(-)
tools/binman/README.rst +266 -257
@@ -2,7 +2,7 @@ # Copyright (c) 2016 Google, Inc Introduction ------------- +============ Firmware often consists of several components which must be packaged together. For example, we may have SPL, U-Boot, a device tree and an environment area
@@ -137,6 +137,9 @@ the boundaries between building input files (mkimage) and packaging then into a final image (binman). +Using binman +============ + Example use of binman in U-Boot -------------------------------
@@ -230,8 +233,111 @@ You can use other, more specific CONFIG options - see 'Automatic .dtsi inclusion' below. +Access to binman entry offsets at run time (symbols) +---------------------------------------------------- + +Binman assembles images and determines where each entry is placed in the image. +This information may be useful to U-Boot at run time. For example, in SPL it +is useful to be able to find the location of U-Boot so that it can be executed +when SPL is finished. + +Binman allows you to declare symbols in the SPL image which are filled in +with their correct values during the build. For example:: + + binman_sym_declare(ulong, u_boot_any, image_pos); + +declares a ulong value which will be assigned to the image-pos of any U-Boot +image (u-boot.bin, u-boot.img, u-boot-nodtb.bin) that is present in the image. +You can access this value with something like:: + + ulong u_boot_offset = binman_sym(ulong, u_boot_any, image_pos); + +Thus u_boot_offset will be set to the image-pos of U-Boot in memory, assuming +that the whole image has been loaded, or is available in flash. You can then +jump to that address to start U-Boot. + +At present this feature is only supported in SPL and TPL. In principle it is +possible to fill in such symbols in U-Boot proper, as well, but a future C +library is planned for this instead, to read from the device tree. + +As well as image-pos, it is possible to read the size of an entry and its +offset (which is the start position of the entry within its parent). + +A small technical note: Binman automatically adds the base address of the image +(i.e. __image_copy_start) to the value of the image-pos symbol, so that when the +image is loaded to its linked address, the value will be correct and actually +point into the image. + +For example, say SPL is at the start of the image and linked to start at address +80108000. If U-Boot's image-pos is 0x8000 then binman will write an image-pos +for U-Boot of 80110000 into the SPL binary, since it assumes the image is loaded +to 80108000, with SPL at 80108000 and U-Boot at 80110000. + +For x86 devices (with the end-at-4gb property) this base address is not added +since it is assumed that images are XIP and the offsets already include the +address. + + +Access to binman entry offsets at run time (fdt) +------------------------------------------------ + +Binman can update the U-Boot FDT to include the final position and size of +each entry in the images it processes. The option to enable this is -u and it +causes binman to make sure that the 'offset', 'image-pos' and 'size' properties +are set correctly for every entry. Since it is not necessary to specify these in +the image definition, binman calculates the final values and writes these to +the device tree. These can be used by U-Boot at run-time to find the location +of each entry. + +Alternatively, an FDT map entry can be used to add a special FDT containing +just the information about the image. This is preceded by a magic string so can +be located anywhere in the image. An image header (typically at the start or end +of the image) can be used to point to the FDT map. See fdtmap and image-header +entries for more information. + + +Map files +--------- + +The -m option causes binman to output a .map file for each image that it +generates. This shows the offset and size of each entry. For example:: + + Offset Size Name + 00000000 00000028 main-section + 00000000 00000010 section at 0 + 00000000 00000004 u-boot + 00000010 00000010 section at 1 + 00000000 00000004 u-boot + +This shows a hierarchical image with two sections, each with a single entry. The +offsets of the sections are absolute hex byte offsets within the image. The +offsets of the entries are relative to their respective sections. The size of +each entry is also shown, in bytes (hex). The indentation shows the entries +nested inside their sections. + + +Passing command-line arguments to entries +----------------------------------------- + +Sometimes it is useful to pass binman the value of an entry property from the +command line. For example some entries need access to files and it is not +always convenient to put these filenames in the image definition (device tree). + +The-a option supports this:: + + -a<prop>=<value> + +where:: + + <prop> is the property to set + <value> is the value to set it to + +Not all properties can be provided this way. Only some entries support it, +typically for filenames. + + Image description format ------------------------- +======================== The binman node is called 'binman'. An example image description is shown below::
@@ -528,6 +634,157 @@ allow-repack: image description to be stored in the FDT and fdtmap. +Hashing Entries +--------------- + +It is possible to ask binman to hash the contents of an entry and write that +value back to the device-tree node. For example:: + + binman { + u-boot { + hash { + algo = "sha256"; + }; + }; + }; + +Here, a new 'value' property will be written to the 'hash' node containing +the hash of the 'u-boot' entry. Only SHA256 is supported at present. Whole +sections can be hased if desired, by adding the 'hash' node to the section. + +The has value can be chcked at runtime by hashing the data actually read and +comparing this has to the value in the device tree. + + +Expanded entries +---------------- + +Binman automatically replaces 'u-boot' with an expanded version of that, i.e. +'u-boot-expanded'. This means that when you write:: + + u-boot { + }; + +you actually get:: + + u-boot { + type = "u-boot-expanded'; + }; + +which in turn expands to:: + + u-boot { + type = "section"; + + u-boot-nodtb { + }; + + u-boot-dtb { + }; + }; + +U-Boot's various phase binaries actually comprise two or three pieces. +For example, u-boot.bin has the executable followed by a devicetree. + +With binman we want to be able to update that devicetree with full image +information so that it is accessible to the executable. This is tricky +if it is not clear where the devicetree starts. + +The above feature ensures that the devicetree is clearly separated from the +U-Boot executable and can be updated separately by binman as needed. It can be +disabled with the --no-expanded flag if required. + +The same applies for u-boot-spl and u-boot-spl. In those cases, the expansion +includes the BSS padding, so for example:: + + spl { + type = "u-boot-spl" + }; + +you actually get:: + + spl { + type = "u-boot-expanded'; + }; + +which in turn expands to:: + + spl { + type = "section"; + + u-boot-spl-nodtb { + }; + + u-boot-spl-bss-pad { + }; + + u-boot-spl-dtb { + }; + }; + +Of course we should not expand SPL if it has no devicetree. Also if the BSS +padding is not needed (because BSS is in RAM as with CONFIG_SPL_SEPARATE_BSS), +the 'u-boot-spl-bss-pad' subnode should not be created. The use of the expaned +entry type is controlled by the UseExpanded() method. In the SPL case it checks +the 'spl-dtb' entry arg, which is 'y' or '1' if SPL has a devicetree. + +For the BSS case, a 'spl-bss-pad' entry arg controls whether it is present. All +entry args are provided by the U-Boot Makefile. + + +Compression +----------- + +Binman support compression for 'blob' entries (those of type 'blob' and +derivatives). To enable this for an entry, add a 'compress' property:: + + blob { + filename = "datafile"; + compress = "lz4"; + }; + +The entry will then contain the compressed data, using the 'lz4' compression +algorithm. Currently this is the only one that is supported. The uncompressed +size is written to the node in an 'uncomp-size' property, if -u is used. + +Compression is also supported for sections. In that case the entire section is +compressed in one block, including all its contents. This means that accessing +an entry from the section required decompressing the entire section. Also, the +size of a section indicates the space that it consumes in its parent section +(and typically the image). With compression, the section may contain more data, +and the uncomp-size property indicates that, as above. The contents of the +section is compressed first, before any padding is added. This ensures that the +padding itself is not compressed, which would be a waste of time. + + +Automatic .dtsi inclusion +------------------------- + +It is sometimes inconvenient to add a 'binman' node to the .dts file for each +board. This can be done by using #include to bring in a common file. Another +approach supported by the U-Boot build system is to automatically include +a common header. You can then put the binman node (and anything else that is +specific to U-Boot, such as u-boot,dm-pre-reloc properies) in that header +file. + +Binman will search for the following files in arch/<arch>/dts:: + + <dts>-u-boot.dtsi where <dts> is the base name of the .dts file + <CONFIG_SYS_SOC>-u-boot.dtsi + <CONFIG_SYS_CPU>-u-boot.dtsi + <CONFIG_SYS_VENDOR>-u-boot.dtsi + u-boot.dtsi + +U-Boot will only use the first one that it finds. If you need to include a +more general file you can do that from the more specific file using #include. +If you are having trouble figuring out what is going on, you can uncomment +the 'warning' line in scripts/Makefile.lib to see what it has found:: + + # Uncomment for debugging + # This shows all the files that were considered and the one that we chose. + # u_boot_dtsi_options_debug = $(u_boot_dtsi_options_raw) + + Entry Documentation -------------------
@@ -537,6 +794,9 @@ see README.entries. This is generated from the source code using: binman entry-docs >tools/binman/README.entries +Managing images +=============== + Listing images --------------
@@ -653,27 +913,9 @@ by increasing the -v/--verbosity from the default of 1: You can use BINMAN_VERBOSE=5 (for example) when building to select this. -Hashing Entries ---------------- - -It is possible to ask binman to hash the contents of an entry and write that -value back to the device-tree node. For example:: - - binman { - u-boot { - hash { - algo = "sha256"; - }; - }; - }; - -Here, a new 'value' property will be written to the 'hash' node containing -the hash of the 'u-boot' entry. Only SHA256 is supported at present. Whole -sections can be hased if desired, by adding the 'hash' node to the section. - -The has value can be chcked at runtime by hashing the data actually read and -comparing this has to the value in the device tree. +Technical details +================= Order of image creation -----------------------
@@ -750,239 +992,6 @@ what happens in this stage. final step. -Automatic .dtsi inclusion -------------------------- - -It is sometimes inconvenient to add a 'binman' node to the .dts file for each -board. This can be done by using #include to bring in a common file. Another -approach supported by the U-Boot build system is to automatically include -a common header. You can then put the binman node (and anything else that is -specific to U-Boot, such as u-boot,dm-pre-reloc properies) in that header -file. - -Binman will search for the following files in arch/<arch>/dts:: - - <dts>-u-boot.dtsi where <dts> is the base name of the .dts file - <CONFIG_SYS_SOC>-u-boot.dtsi - <CONFIG_SYS_CPU>-u-boot.dtsi - <CONFIG_SYS_VENDOR>-u-boot.dtsi - u-boot.dtsi - -U-Boot will only use the first one that it finds. If you need to include a -more general file you can do that from the more specific file using #include. -If you are having trouble figuring out what is going on, you can uncomment -the 'warning' line in scripts/Makefile.lib to see what it has found:: - - # Uncomment for debugging - # This shows all the files that were considered and the one that we chose. - # u_boot_dtsi_options_debug = $(u_boot_dtsi_options_raw) - - -Access to binman entry offsets at run time (symbols) ----------------------------------------------------- - -Binman assembles images and determines where each entry is placed in the image. -This information may be useful to U-Boot at run time. For example, in SPL it -is useful to be able to find the location of U-Boot so that it can be executed -when SPL is finished. - -Binman allows you to declare symbols in the SPL image which are filled in -with their correct values during the build. For example:: - - binman_sym_declare(ulong, u_boot_any, image_pos); - -declares a ulong value which will be assigned to the image-pos of any U-Boot -image (u-boot.bin, u-boot.img, u-boot-nodtb.bin) that is present in the image. -You can access this value with something like:: - - ulong u_boot_offset = binman_sym(ulong, u_boot_any, image_pos); - -Thus u_boot_offset will be set to the image-pos of U-Boot in memory, assuming -that the whole image has been loaded, or is available in flash. You can then -jump to that address to start U-Boot. - -At present this feature is only supported in SPL and TPL. In principle it is -possible to fill in such symbols in U-Boot proper, as well, but a future C -library is planned for this instead, to read from the device tree. - -As well as image-pos, it is possible to read the size of an entry and its -offset (which is the start position of the entry within its parent). - -A small technical note: Binman automatically adds the base address of the image -(i.e. __image_copy_start) to the value of the image-pos symbol, so that when the -image is loaded to its linked address, the value will be correct and actually -point into the image. - -For example, say SPL is at the start of the image and linked to start at address -80108000. If U-Boot's image-pos is 0x8000 then binman will write an image-pos -for U-Boot of 80110000 into the SPL binary, since it assumes the image is loaded -to 80108000, with SPL at 80108000 and U-Boot at 80110000. - -For x86 devices (with the end-at-4gb property) this base address is not added -since it is assumed that images are XIP and the offsets already include the -address. - - -Access to binman entry offsets at run time (fdt) ------------------------------------------------- - -Binman can update the U-Boot FDT to include the final position and size of -each entry in the images it processes. The option to enable this is -u and it -causes binman to make sure that the 'offset', 'image-pos' and 'size' properties -are set correctly for every entry. Since it is not necessary to specify these in -the image definition, binman calculates the final values and writes these to -the device tree. These can be used by U-Boot at run-time to find the location -of each entry. - -Alternatively, an FDT map entry can be used to add a special FDT containing -just the information about the image. This is preceded by a magic string so can -be located anywhere in the image. An image header (typically at the start or end -of the image) can be used to point to the FDT map. See fdtmap and image-header -entries for more information. - - -Expanded entries ----------------- - -Binman automatically replaces 'u-boot' with an expanded version of that, i.e. -'u-boot-expanded'. This means that when you write:: - - u-boot { - }; - -you actually get:: - - u-boot { - type = "u-boot-expanded'; - }; - -which in turn expands to:: - - u-boot { - type = "section"; - - u-boot-nodtb { - }; - - u-boot-dtb { - }; - }; - -U-Boot's various phase binaries actually comprise two or three pieces. -For example, u-boot.bin has the executable followed by a devicetree. - -With binman we want to be able to update that devicetree with full image -information so that it is accessible to the executable. This is tricky -if it is not clear where the devicetree starts. - -The above feature ensures that the devicetree is clearly separated from the -U-Boot executable and can be updated separately by binman as needed. It can be -disabled with the --no-expanded flag if required. - -The same applies for u-boot-spl and u-boot-spl. In those cases, the expansion -includes the BSS padding, so for example:: - - spl { - type = "u-boot-spl" - }; - -you actually get:: - - spl { - type = "u-boot-expanded'; - }; - -which in turn expands to:: - - spl { - type = "section"; - - u-boot-spl-nodtb { - }; - - u-boot-spl-bss-pad { - }; - - u-boot-spl-dtb { - }; - }; - - -Of course we should not expand SPL if it has no devicetree. Also if the BSS -padding is not needed (because BSS is in RAM as with CONFIG_SPL_SEPARATE_BSS), -the 'u-boot-spl-bss-pad' subnode should not be created. The use of the expaned -entry type is controlled by the UseExpanded() method. In the SPL case it checks -the 'spl-dtb' entry arg, which is 'y' or '1' if SPL has a devicetree. - -For the BSS case, a 'spl-bss-pad' entry arg controls whether it is present. All -entry args are provided by the U-Boot Makefile. - - -Compression ------------ - -Binman support compression for 'blob' entries (those of type 'blob' and -derivatives). To enable this for an entry, add a 'compress' property:: - - blob { - filename = "datafile"; - compress = "lz4"; - }; - -The entry will then contain the compressed data, using the 'lz4' compression -algorithm. Currently this is the only one that is supported. The uncompressed -size is written to the node in an 'uncomp-size' property, if -u is used. - -Compression is also supported for sections. In that case the entire section is -compressed in one block, including all its contents. This means that accessing -an entry from the section required decompressing the entire section. Also, the -size of a section indicates the space that it consumes in its parent section -(and typically the image). With compression, the section may contain more data, -and the uncomp-size property indicates that, as above. The contents of the -section is compressed first, before any padding is added. This ensures that the -padding itself is not compressed, which would be a waste of time. - - -Map files ---------- - -The -m option causes binman to output a .map file for each image that it -generates. This shows the offset and size of each entry. For example:: - - Offset Size Name - 00000000 00000028 main-section - 00000000 00000010 section at 0 - 00000000 00000004 u-boot - 00000010 00000010 section at 1 - 00000000 00000004 u-boot - -This shows a hierarchical image with two sections, each with a single entry. The -offsets of the sections are absolute hex byte offsets within the image. The -offsets of the entries are relative to their respective sections. The size of -each entry is also shown, in bytes (hex). The indentation shows the entries -nested inside their sections. - - -Passing command-line arguments to entries ------------------------------------------ - -Sometimes it is useful to pass binman the value of an entry property from the -command line. For example some entries need access to files and it is not -always convenient to put these filenames in the image definition (device tree). - -The-a option supports this:: - - -a<prop>=<value> - -where:: - - <prop> is the property to set - <value> is the value to set it to - -Not all properties can be provided this way. Only some entries support it, -typically for filenames. - - External tools --------------
@@ -1050,8 +1059,8 @@ Then, you can run the tests under cross-compilation:: You can also use gcc-i686-linux-gnu similar to the above. -Advanced Features / Technical docs ----------------------------------- +Writing new entries and debugging +--------------------------------- The behaviour of entries is defined by the Entry class. All other entries are a subclass of this. An important subclass is Entry_blob which takes binary
Signature · 1 line
2.30.1.766.gb4fecdf3b7-goog
PATCH 18/20 binman: Incorporate entry documentation
In reply to Simon GlassUpdate this to avoid sphinx warnings and incorporate it into the new documentaiton tree.
---
tools/binman/README.rst | 11 ++-
tools/binman/cmdline.py | 2 +-
tools/binman/{README.entries => entries.rst} | 79 +++++++++++---------
tools/binman/etype/cbfs.py | 10 +--
tools/binman/etype/fdtmap.py | 30 ++++----
tools/binman/etype/fit.py | 19 +++--
tools/binman/etype/intel_ifwi.py | 8 +-
tools/binman/etype/mkimage.py | 2 +-
tools/binman/etype/section.py | 6 +-
tools/binman/etype/text.py | 6 +-
tools/binman/setup.py | 2 +-
11 files changed, 95 insertions(+), 80 deletions(-)
rename tools/binman/{README.entries => entries.rst} (97%)tools/binman/README.rst +8 -3
@@ -786,12 +786,17 @@ the 'warning' line in scripts/Makefile.lib to see what it has found:: Entry Documentation -------------------- +=================== For details on the various entry types supported by binman and how to use them, -see README.entries. This is generated from the source code using: +see entries.rst which is generated from the source code using: + + binman entry-docs >tools/binman/entries.rst + +.. toctree:: + :maxdepth: 2 - binman entry-docs >tools/binman/README.entries + entries.rst Managing images
tools/binman/cmdline.py +1 -1
@@ -69,7 +69,7 @@ controlled by a description in the board device tree.''' default=False, help='Update the binman node with offset/size info') entry_parser = subparsers.add_parser('entry-docs', - help='Write out entry documentation (see README.entries)') + help='Write out entry documentation (see entries.rst)') list_parser = subparsers.add_parser('ls', help='List files in an image') list_parser.add_argument('-i', '--image', type=str, required=True,
tools/binman/entries.rst renamed from tools/binman/README.entries +42 -37
189 lines not on this page · raw message
tools/binman/etype/cbfs.py +5 -5
@@ -22,7 +22,7 @@ class Entry_cbfs(Entry): CBFS is used by coreboot as its way of orgnanising SPI-flash contents. - The contents of the CBFS are defined by subnodes of the cbfs entry, e.g.: + The contents of the CBFS are defined by subnodes of the cbfs entry, e.g.:: cbfs { size = <0x100000>;
@@ -38,7 +38,7 @@ class Entry_cbfs(Entry): Note that the size is required since binman does not support calculating it. The contents of each entry is just what binman would normally provide if it were not a CBFS node. A blob type can be used to import arbitrary files as - with the second subnode below: + with the second subnode below:: cbfs { size = <0x100000>;
@@ -84,7 +84,7 @@ class Entry_cbfs(Entry): This is an ELF file that has been loaded (i.e. mapped to memory), so appears in the CBFS as a flat binary. The input file must be an ELF image, for example this puts "u-boot" (the ELF image) into a 'stage' - entry: + entry:: cbfs { size = <0x100000>;
@@ -94,7 +94,7 @@ class Entry_cbfs(Entry): }; }; - You can use your own ELF file with something like: + You can use your own ELF file with something like:: cbfs { size = <0x100000>;
@@ -127,7 +127,7 @@ class Entry_cbfs(Entry): particular offset in the CBFS and a few other things. Of course binman can create images containing multiple CBFSs, simply by - defining these in the binman config: + defining these in the binman config:: binman {
tools/binman/etype/fdtmap.py +15 -15
@@ -53,24 +53,24 @@ class Entry_fdtmap(Entry): Note that the -u option must be provided to ensure that binman updates the FDT with the position of each entry. - Example output for a simple image with U-Boot and an FDT map: - - / { - image-name = "binman"; - size = <0x00000112>; - image-pos = <0x00000000>; - offset = <0x00000000>; - u-boot { - size = <0x00000004>; + Example output for a simple image with U-Boot and an FDT map:: + + / { + image-name = "binman"; + size = <0x00000112>; image-pos = <0x00000000>; offset = <0x00000000>; + u-boot { + size = <0x00000004>; + image-pos = <0x00000000>; + offset = <0x00000000>; + }; + fdtmap { + size = <0x0000010e>; + image-pos = <0x00000004>; + offset = <0x00000004>; + }; }; - fdtmap { - size = <0x0000010e>; - image-pos = <0x00000004>; - offset = <0x00000004>; - }; - }; If allow-repack is used then 'orig-offset' and 'orig-size' properties are added as necessary. See the binman README.
tools/binman/etype/fit.py +11 -8
@@ -22,7 +22,7 @@ class Entry_fit(Entry): Nodes for the FIT should be written out in the binman configuration just as they would be in a file passed to mkimage. - For example, this creates an image containing a FIT with U-Boot SPL: + For example, this creates an image containing a FIT with U-Boot SPL:: binman { fit {
@@ -52,7 +52,7 @@ class Entry_fit(Entry): The fit,fdt-list property (see above) indicates that of-list should be used. If the property is missing you will get an error. - Then add a 'generator node', a node with a name starting with '@': + Then add a 'generator node', a node with a name starting with '@':: images { @fdt-SEQ {
@@ -67,7 +67,7 @@ class Entry_fit(Entry): node acts like a template to generate the nodes. The generator node itself does not appear in the output - it is replaced with what binman generates. - You can create config nodes in a similar way: + You can create config nodes in a similar way:: configurations { default = "@config-DEFAULT-SEQ";
@@ -84,8 +84,10 @@ class Entry_fit(Entry): Available substitutions for '@' nodes are: - SEQ Sequence number of the generated fdt (1, 2, ...) - NAME Name of the dtb as provided (i.e. without adding '.dtb') + SEQ: + Sequence number of the generated fdt (1, 2, ...) + NAME + Name of the dtb as provided (i.e. without adding '.dtb') Note that if no devicetree files are provided (with '-a of-list' as above) then no nodes will be generated.
@@ -94,10 +96,11 @@ class Entry_fit(Entry): if of configuration whose devicetree matches the 'default-dt' entry argument, e.g. with '-a default-dt=sun50i-a64-pine64-lts'. - Available substitutions for '@' property values are: + Available substitutions for '@' property values are - DEFAULT-SEQ Sequence number of the default fdt,as provided by the - 'default-dt' entry argument + DEFAULT-SEQ: + Sequence number of the default fdt,as provided by the 'default-dt' entry + argument Properties (in the 'fit' node itself): fit,external-offset: Indicates that the contents of the FIT are external
tools/binman/etype/intel_ifwi.py +4 -4
@@ -37,10 +37,10 @@ class Entry_intel_ifwi(Entry_blob_ext): sub-partition (and optional entry name). Properties for subnodes: - ifwi-subpart - sub-parition to put this entry into, e.g. "IBBP" - ifwi-entry - entry name t use, e.g. "IBBL" - ifwi-replace - if present, indicates that the item should be replaced - in the IFWI. Otherwise it is added. + - ifwi-subpart: sub-parition to put this entry into, e.g. "IBBP" + - ifwi-entry: entry name t use, e.g. "IBBL" + - ifwi-replace: if present, indicates that the item should be replaced + in the IFWI. Otherwise it is added. See README.x86 for information about x86 binary blobs. """
tools/binman/etype/mkimage.py +1 -1
@@ -19,7 +19,7 @@ class Entry_mkimage(Entry): - args: Other arguments to pass The data passed to mkimage is collected from subnodes of the mkimage node, - e.g.: + e.g.:: mkimage { args = "-n test -T imximage";
tools/binman/etype/section.py +4 -2
@@ -22,11 +22,13 @@ from patman.tools import ToHexSize class Entry_section(Entry): """Entry that contains other entries - Properties / Entry arguments: (see binman README for more information) + Properties / Entry arguments: (see binman README for more information): pad-byte: Pad byte to use when padding sort-by-offset: True if entries should be sorted by offset, False if - they must be in-order in the device tree description + they must be in-order in the device tree description + end-at-4gb: Used to build an x86 ROM which ends at 4GB (2^32) + skip-at-start: Number of bytes before the first entry starts. These effectively adjust the starting offset of entries. For example, if this is 16, then the first entry would start at 16. An entry
tools/binman/etype/text.py +3 -3
@@ -25,7 +25,7 @@ class Entry_text(Entry): <text>: The text to place in the entry (overrides the above mechanism). This is useful when the text is constant. - Example node: + Example node:: text { size = <50>;
@@ -38,7 +38,7 @@ class Entry_text(Entry): and binman will insert that string into the entry. - It is also possible to put the string directly in the node: + It is also possible to put the string directly in the node:: text { size = <8>;
@@ -46,7 +46,7 @@ class Entry_text(Entry): message = "a message directly in the node" }; - or just: + or just:: text { size = <8>;
tools/binman/setup.py +1 -1
@@ -7,6 +7,6 @@ setup(name='binman', scripts=['binman'], packages=['binman', 'binman.etype'], package_dir={'binman': ''}, - package_data={'binman': ['README.rst', 'README.entries']}, + package_data={'binman': ['README.rst', 'entries.rst']}, classifiers=['Environment :: Console', 'Topic :: Software Development :: Embedded Systems'])
Signature · 1 line
2.30.1.766.gb4fecdf3b7-goog
PATCH 19/20 binman: Drop repetitive heading for each entry
In reply to Simon GlassMany entries start 'Entry containing a'. This looks fine in the source code but is annoying when viewed in the htmldocs table of contents. Drop these unnecessary words.
---
tools/binman/entries.rst | 76 ++++++++++++++--------------- tools/binman/etype/atf_bl31.py | 2 +- tools/binman/etype/blob.py | 2 +- tools/binman/etype/blob_ext.py | 2 +- tools/binman/etype/cbfs.py | 2 +- tools/binman/etype/files.py | 2 +- tools/binman/etype/fit.py | 2 +- tools/binman/etype/intel_cmc.py | 2 +- tools/binman/etype/intel_fsp.py | 2 +- tools/binman/etype/intel_fsp_m.py | 2 +- tools/binman/etype/intel_fsp_s.py | 2 +- tools/binman/etype/intel_fsp_t.py | 2 +- tools/binman/etype/intel_ifwi.py | 2 +- tools/binman/etype/intel_me.py | 2 +- tools/binman/etype/intel_mrc.py | 2 +- tools/binman/etype/intel_refcode.py | 2 +- tools/binman/etype/intel_vbt.py | 2 +- tools/binman/etype/intel_vga.py | 2 +- tools/binman/etype/mkimage.py | 2 +- tools/binman/etype/scp.py | 2 +- 20 files changed, 57 insertions(+), 57 deletions(-)
tools/binman/entries.rst +38 -38
@@ -11,8 +11,8 @@ features to produce new behaviours. -Entry: atf-bl31: Entry containing an ARM Trusted Firmware (ATF) BL31 blob -------------------------------------------------------------------------- +Entry: atf-bl31: ARM Trusted Firmware (ATF) BL31 blob +----------------------------------------------------- Properties / Entry arguments: - atf-bl31-path: Filename of file to read into entry. This is typically
@@ -25,8 +25,8 @@ about ATF. -Entry: blob: Entry containing an arbitrary binary blob ------------------------------------------------------- +Entry: blob: Arbitrary binary blob +---------------------------------- Note: This should not be used by itself. It is normally used as a parent class by other entry types.
@@ -56,8 +56,8 @@ obtained from the list of available device-tree files, managed by the -Entry: blob-ext: Entry containing an externally built binary blob ------------------------------------------------------------------ +Entry: blob-ext: Externally built binary blob +--------------------------------------------- Note: This should not be used by itself. It is normally used as a parent class by other entry types.
@@ -96,8 +96,8 @@ entry; similarly for SPL. -Entry: cbfs: Entry containing a Coreboot Filesystem (CBFS) ----------------------------------------------------------- +Entry: cbfs: Coreboot Filesystem (CBFS) +--------------------------------------- A CBFS provides a way to group files into a group. It has a simple directory structure and allows the position of individual files to be set, since it is
@@ -303,8 +303,8 @@ added as necessary. See the binman README. -Entry: files: Entry containing a set of files ---------------------------------------------- +Entry: files: A set of files arranged in a section +-------------------------------------------------- Properties / Entry arguments: - pattern: Filename pattern to match the files to include
@@ -335,8 +335,8 @@ byte value of a region. -Entry: fit: Entry containing a FIT ----------------------------------- +Entry: fit: FIT +--------------- This calls mkimage to create a FIT (U-Boot Flat Image Tree) based on the input provided.
@@ -491,8 +491,8 @@ first/last in the entry list. -Entry: intel-cmc: Entry containing an Intel Chipset Micro Code (CMC) file -------------------------------------------------------------------------- +Entry: intel-cmc: Intel Chipset Micro Code (CMC) file +----------------------------------------------------- Properties / Entry arguments: - filename: Filename of file to read into entry
@@ -544,8 +544,8 @@ This entry contains a pointer to the FIT. It is required to be at address -Entry: intel-fsp: Entry containing an Intel Firmware Support Package (FSP) file -------------------------------------------------------------------------------- +Entry: intel-fsp: Intel Firmware Support Package (FSP) file +----------------------------------------------------------- Properties / Entry arguments: - filename: Filename of file to read into entry
@@ -561,8 +561,8 @@ See README.x86 for information about x86 binary blobs. -Entry: intel-fsp-m: Entry containing Intel Firmware Support Package (FSP) memory init -------------------------------------------------------------------------------------- +Entry: intel-fsp-m: Intel Firmware Support Package (FSP) memory init +-------------------------------------------------------------------- Properties / Entry arguments: - filename: Filename of file to read into entry
@@ -578,8 +578,8 @@ See README.x86 for information about x86 binary blobs. -Entry: intel-fsp-s: Entry containing Intel Firmware Support Package (FSP) silicon init --------------------------------------------------------------------------------------- +Entry: intel-fsp-s: Intel Firmware Support Package (FSP) silicon init +--------------------------------------------------------------------- Properties / Entry arguments: - filename: Filename of file to read into entry
@@ -595,8 +595,8 @@ See README.x86 for information about x86 binary blobs. -Entry: intel-fsp-t: Entry containing Intel Firmware Support Package (FSP) temp ram init ---------------------------------------------------------------------------------------- +Entry: intel-fsp-t: Intel Firmware Support Package (FSP) temp ram init +---------------------------------------------------------------------- Properties / Entry arguments: - filename: Filename of file to read into entry
@@ -611,8 +611,8 @@ See README.x86 for information about x86 binary blobs. -Entry: intel-ifwi: Entry containing an Intel Integrated Firmware Image (IFWI) file ----------------------------------------------------------------------------------- +Entry: intel-ifwi: Intel Integrated Firmware Image (IFWI) file +-------------------------------------------------------------- Properties / Entry arguments: - filename: Filename of file to read into entry. This is either the
@@ -645,8 +645,8 @@ See README.x86 for information about x86 binary blobs. -Entry: intel-me: Entry containing an Intel Management Engine (ME) file ----------------------------------------------------------------------- +Entry: intel-me: Intel Management Engine (ME) file +-------------------------------------------------- Properties / Entry arguments: - filename: Filename of file to read into entry
@@ -665,8 +665,8 @@ See README.x86 for information about x86 binary blobs. -Entry: intel-mrc: Entry containing an Intel Memory Reference Code (MRC) file ----------------------------------------------------------------------------- +Entry: intel-mrc: Intel Memory Reference Code (MRC) file +-------------------------------------------------------- Properties / Entry arguments: - filename: Filename of file to read into entry
@@ -679,8 +679,8 @@ See README.x86 for information about x86 binary blobs. -Entry: intel-refcode: Entry containing an Intel Reference Code file -------------------------------------------------------------------- +Entry: intel-refcode: Intel Reference Code file +----------------------------------------------- Properties / Entry arguments: - filename: Filename of file to read into entry
@@ -693,8 +693,8 @@ See README.x86 for information about x86 binary blobs. -Entry: intel-vbt: Entry containing an Intel Video BIOS Table (VBT) file ------------------------------------------------------------------------ +Entry: intel-vbt: Intel Video BIOS Table (VBT) file +--------------------------------------------------- Properties / Entry arguments: - filename: Filename of file to read into entry
@@ -706,8 +706,8 @@ See README.x86 for information about Intel binary blobs. -Entry: intel-vga: Entry containing an Intel Video Graphics Adaptor (VGA) file ------------------------------------------------------------------------------ +Entry: intel-vga: Intel Video Graphics Adaptor (VGA) file +--------------------------------------------------------- Properties / Entry arguments: - filename: Filename of file to read into entry
@@ -721,8 +721,8 @@ See README.x86 for information about Intel binary blobs. -Entry: mkimage: Entry containing a binary produced by mkimage -------------------------------------------------------------- +Entry: mkimage: Binary produced by mkimage +------------------------------------------ Properties / Entry arguments: - datafile: Filename for -d argument
@@ -756,8 +756,8 @@ placed at offset 'RESET_VECTOR_ADDRESS - 0xffc'. -Entry: scp: Entry containing a System Control Processor (SCP) firmware blob ---------------------------------------------------------------------------- +Entry: scp: System Control Processor (SCP) firmware blob +-------------------------------------------------------- Properties / Entry arguments: - scp-path: Filename of file to read into the entry, typically scp.bin
tools/binman/etype/atf_bl31.py +1 -1
@@ -8,7 +8,7 @@ from binman.etype.blob_named_by_arg import Entry_blob_named_by_arg class Entry_atf_bl31(Entry_blob_named_by_arg): - """Entry containing an ARM Trusted Firmware (ATF) BL31 blob + """ARM Trusted Firmware (ATF) BL31 blob Properties / Entry arguments: - atf-bl31-path: Filename of file to read into entry. This is typically
tools/binman/etype/blob.py +1 -1
@@ -11,7 +11,7 @@ from patman import tools from patman import tout class Entry_blob(Entry): - """Entry containing an arbitrary binary blob + """Arbitrary binary blob Note: This should not be used by itself. It is normally used as a parent class by other entry types.
tools/binman/etype/blob_ext.py +1 -1
@@ -13,7 +13,7 @@ from patman import tools from patman import tout class Entry_blob_ext(Entry_blob): - """Entry containing an externally built binary blob + """Externally built binary blob Note: This should not be used by itself. It is normally used as a parent class by other entry types.
tools/binman/etype/cbfs.py +1 -1
@@ -13,7 +13,7 @@ from binman.entry import Entry from dtoc import fdt_util class Entry_cbfs(Entry): - """Entry containing a Coreboot Filesystem (CBFS) + """Coreboot Filesystem (CBFS) A CBFS provides a way to group files into a group. It has a simple directory structure and allows the position of individual files to be set, since it is
tools/binman/etype/files.py +1 -1
@@ -15,7 +15,7 @@ from patman import tools class Entry_files(Entry_section): - """Entry containing a set of files + """A set of files arranged in a section Properties / Entry arguments: - pattern: Filename pattern to match the files to include
tools/binman/etype/fit.py +1 -1
@@ -14,7 +14,7 @@ from dtoc.fdt import Fdt from patman import tools class Entry_fit(Entry): - """Entry containing a FIT + """Flat Image Tree (FIT) This calls mkimage to create a FIT (U-Boot Flat Image Tree) based on the input provided.
tools/binman/etype/intel_cmc.py +1 -1
@@ -8,7 +8,7 @@ from binman.etype.blob_ext import Entry_blob_ext class Entry_intel_cmc(Entry_blob_ext): - """Entry containing an Intel Chipset Micro Code (CMC) file + """Intel Chipset Micro Code (CMC) file Properties / Entry arguments: - filename: Filename of file to read into entry
tools/binman/etype/intel_fsp.py +1 -1
@@ -8,7 +8,7 @@ from binman.etype.blob_ext import Entry_blob_ext class Entry_intel_fsp(Entry_blob_ext): - """Entry containing an Intel Firmware Support Package (FSP) file + """Intel Firmware Support Package (FSP) file Properties / Entry arguments: - filename: Filename of file to read into entry
tools/binman/etype/intel_fsp_m.py +1 -1
@@ -8,7 +8,7 @@ from binman.etype.blob_ext import Entry_blob_ext class Entry_intel_fsp_m(Entry_blob_ext): - """Entry containing Intel Firmware Support Package (FSP) memory init + """Intel Firmware Support Package (FSP) memory init Properties / Entry arguments: - filename: Filename of file to read into entry
tools/binman/etype/intel_fsp_s.py +1 -1
@@ -8,7 +8,7 @@ from binman.etype.blob_ext import Entry_blob_ext class Entry_intel_fsp_s(Entry_blob_ext): - """Entry containing Intel Firmware Support Package (FSP) silicon init + """Intel Firmware Support Package (FSP) silicon init Properties / Entry arguments: - filename: Filename of file to read into entry
tools/binman/etype/intel_fsp_t.py +1 -1
@@ -8,7 +8,7 @@ from binman.etype.blob_ext import Entry_blob_ext class Entry_intel_fsp_t(Entry_blob_ext): - """Entry containing Intel Firmware Support Package (FSP) temp ram init + """Intel Firmware Support Package (FSP) temp ram init Properties / Entry arguments: - filename: Filename of file to read into entry
tools/binman/etype/intel_ifwi.py +1 -1
@@ -13,7 +13,7 @@ from dtoc import fdt_util from patman import tools class Entry_intel_ifwi(Entry_blob_ext): - """Entry containing an Intel Integrated Firmware Image (IFWI) file + """Intel Integrated Firmware Image (IFWI) file Properties / Entry arguments: - filename: Filename of file to read into entry. This is either the
tools/binman/etype/intel_me.py +1 -1
@@ -8,7 +8,7 @@ from binman.etype.blob_ext import Entry_blob_ext class Entry_intel_me(Entry_blob_ext): - """Entry containing an Intel Management Engine (ME) file + """Intel Management Engine (ME) file Properties / Entry arguments: - filename: Filename of file to read into entry
tools/binman/etype/intel_mrc.py +1 -1
@@ -8,7 +8,7 @@ from binman.etype.blob_ext import Entry_blob_ext class Entry_intel_mrc(Entry_blob_ext): - """Entry containing an Intel Memory Reference Code (MRC) file + """Intel Memory Reference Code (MRC) file Properties / Entry arguments: - filename: Filename of file to read into entry
tools/binman/etype/intel_refcode.py +1 -1
@@ -8,7 +8,7 @@ from binman.etype.blob_ext import Entry_blob_ext class Entry_intel_refcode(Entry_blob_ext): - """Entry containing an Intel Reference Code file + """Intel Reference Code file Properties / Entry arguments: - filename: Filename of file to read into entry
tools/binman/etype/intel_vbt.py +1 -1
@@ -7,7 +7,7 @@ from binman.etype.blob_ext import Entry_blob_ext class Entry_intel_vbt(Entry_blob_ext): - """Entry containing an Intel Video BIOS Table (VBT) file + """Intel Video BIOS Table (VBT) file Properties / Entry arguments: - filename: Filename of file to read into entry
tools/binman/etype/intel_vga.py +1 -1
@@ -8,7 +8,7 @@ from binman.etype.blob_ext import Entry_blob_ext class Entry_intel_vga(Entry_blob_ext): - """Entry containing an Intel Video Graphics Adaptor (VGA) file + """Intel Video Graphics Adaptor (VGA) file Properties / Entry arguments: - filename: Filename of file to read into entry
tools/binman/etype/mkimage.py +1 -1
@@ -12,7 +12,7 @@ from dtoc import fdt_util from patman import tools class Entry_mkimage(Entry): - """Entry containing a binary produced by mkimage + """Binary produced by mkimage Properties / Entry arguments: - datafile: Filename for -d argument
tools/binman/etype/scp.py +1 -1
@@ -7,7 +7,7 @@ from binman.etype.blob_named_by_arg import Entry_blob_named_by_arg class Entry_scp(Entry_blob_named_by_arg): - """Entry containing a System Control Processor (SCP) firmware blob + """System Control Processor (SCP) firmware blob Properties / Entry arguments: - scp-path: Filename of file to read into the entry, typically scp.bin
Signature · 1 line
2.30.1.766.gb4fecdf3b7-goog
PATCH 20/20 binman: Update various pieces of the documentation
In reply to Simon GlassA few sections are a little out of date now. Update them.
---
tools/binman/README.rst | 72 ++++++++++++++++++++--------------------- 1 file changed, 36 insertions(+), 36 deletions(-)
tools/binman/README.rst +36 -36
@@ -9,39 +9,43 @@ For example, we may have SPL, U-Boot, a device tree and an environment area grouped together and placed in MMC flash. When the system starts, it must be able to find these pieces. -So far U-Boot has not provided a way to handle creating such images in a -general way. Each SoC does what it needs to build an image, often packing or -concatenating images in the U-Boot build system. - -Binman aims to provide a mechanism for building images, from simple -SPL + U-Boot combinations, to more complex arrangements with many parts. +Building firmware should be separate from packaging it. Many of the complexities +of modern firmware build systems come from trying to do both at once. With +binman, you build all the pieces that are needed, using whatever assortment of +projects and build systems are needed, then use binman to stitch everything +together. What it does ------------ Binman reads your board's device tree and finds a node which describes the -required image layout. It uses this to work out what to place where. The -output file normally contains the device tree, so it is in principle possible -to read an image and extract its constituent parts. +required image layout. It uses this to work out what to place where. + +Binman provides a mechanism for building images, from simple SPL + U-Boot +combinations, to more complex arrangements with many parts. It also allows +users to inspect images, extract and replace binaries within them, repacking if +needed. Features -------- -So far binman is pretty simple. It supports binary blobs, such as 'u-boot', -'spl' and 'fdt'. It supports empty entries (such as setting to 0xff). It can -place entries at a fixed location in the image, or fit them together with -suitable padding and alignment. It provides a way to process binaries before -they are included, by adding a Python plug-in. The device tree is available -to U-Boot at run-time so that the images can be interpreted. +Apart from basic padding, alignment and positioning features, Binman supports +hierarchical images, compression, hashing and dealing with the binary blobs +which are a sad trend in open-source firmware at present. -Binman can update the device tree with the final location of everything when it -is done. Entry positions can be provided to U-Boot SPL as run-time symbols, -avoiding device-tree code overhead. +Executable binaries can access the location of other binaries in an image by +using special linker symbols (zero-overhead but somewhat limited) or by reading +the devicetree description of the image. -Binman can also support incorporating filesystems in the image if required. -For example x86 platforms may use CBFS in some cases. +Binman is designed primarily for use with U-Boot and associated binaries such +as ARM Trusted Firmware, but it is suitable for use with other projects, such +as Zephyr. Binman also provides facilities useful in Chromium OS, such as CBFS, +vblocks and and the like. + +Binman provides a way to process binaries before they are included, by adding a +Python plug-in. Binman is intended for use with U-Boot but is designed to be general enough to be useful in other image-packaging situations.
@@ -50,11 +54,11 @@ to be useful in other image-packaging situations. Motivation ---------- -Packaging of firmware is quite a different task from building the various -parts. In many cases the various binaries which go into the image come from -separate build systems. For example, ARM Trusted Firmware is used on ARMv8 -devices but is not built in the U-Boot tree. If a Linux kernel is included -in the firmware image, it is built elsewhere. +As mentioned above, packaging of firmware is quite a different task from +building the various parts. In many cases the various binaries which go into +the image come from separate build systems. For example, ARM Trusted Firmware +is used on ARMv8 devices but is not built in the U-Boot tree. If a Linux kernel +is included in the firmware image, it is built elsewhere. It is of course possible to add more and more build rules to the U-Boot build system to cover these cases. It can shell out to other Makefiles and
@@ -215,17 +219,12 @@ Binman has a few other options which you can see by running 'binman -h'. Enabling binman for a board --------------------------- -At present binman is invoked from a rule in the main Makefile. Typically you -will have a rule like:: - - ifneq ($(CONFIG_ARCH_<something>),) - u-boot-<your_suffix>.bin: <input_file_1> <input_file_2> checkbinman FORCE - $(call if_changed,binman) - endif +At present binman is invoked from a rule in the main Makefile. You should be +able to enable CONFIG_BINMAN to enable this rule. -This assumes that u-boot-<your_suffix>.bin is a target, and is the final file -that you need to produce. You can make it a target by adding it to INPUTS-y -either in the main Makefile or in a config.mk file in your arch subdirectory. +The output file is typically named image.bin and is located in the output +directory. If input files are needed to you add these to INPUTS-y either in the +main Makefile or in a config.mk file in your arch subdirectory. Once binman is executed it will pick up its instructions from a device-tree file, typically <soc>-u-boot.dtsi, where <soc> is your CONFIG_SYS_SOC value.
@@ -1141,7 +1140,8 @@ To do Some ideas: - Use of-platdata to make the information available to code that is unable - to use device tree (such as a very small SPL image) + to use device tree (such as a very small SPL image). For now, limited info is + available via linker symbols - Allow easy building of images by specifying just the board name - Support building an image for a board (-b) more completely, with a configurable build directory
Signature · 1 line
2.30.1.766.gb4fecdf3b7-goog