[U-Boot] [PATCH 00/30] binman: A tool for creating firmware images

Simon Glass sjg at chromium.org
Tue Jul 26 02:58:56 CEST 2016


This series introduces binman, a tool designed to create firmware images.
It provides a way to bring together various binaries and place them in an
image, at particular positions and with configurable alignment.

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
build scripts. But it seems better to create a clear divide between building
software and packaging it.

U-Boot supports a very large number of boards. Many of these have their own
specific rules for how an image should be put together so that it boots
correctly. At present these rules are described by manual instructions,
different for each board. By turning these instructions into a standard
format, we can support making valid images for any board without manual
effort, lots of READMEs, etc.

Images consist of a number of entries which are combined to make up the
final image. The image is described in the device tree for the board, meaning
that it can be accessed at run-time if desired.

Binman is an extensible tool. A set of standard entries is provides, but
new entries can be created fairly easily. Entries can be as simple as
providing the name of a file to include. They can also handle more complex
requirements, such as adjusting the input file or reading header information
from one entry to control the position of another.

U-Boot's mkimage builds FIT images and various other binaries. Binman
augments this by allowing these binaries to be packed together. While FIT
should be used where possible, it cannot be used everywhere. For example,
many devices require executable code at a particular offset in the image.
X86 machines require lots of binary blobs at particular places, and a
microcode collection easily accessible at boot.

So far binman has enough functionality to be useful, but apart from a few RFC
patches, no attempt is made to switch boards over to use it. There should be
enough material to permit review and comments.

The series is available at u-boot-dm/binman-working

Future work and missing features are documented in the README.


Simon Glass (30):
  x86: Add debugging when a microcode update fails
  x86: ivybridge: Allow microcode to be collated
  x86: Add debugging when cpu_common_init() fails
  patman: Adjust command.Output() to raise an error by default
  dtoc: Move the struct import into the correct order
  dtoc: Move the fdt library selection into fdt_select
  dtoc: Rename fdt.py to fdt_normal.py
  dtoc: Create a base class for Fdt
  dtoc: Move BytesToValue() and GetEmpty() into PropBase
  dtoc: Move Widen() and GetPhandle() into the base class
  dtoc: Move a few more common functions into fdt.py
  patman: Add a tools library for using temporary files
  patman: Add a library to handle logging and progress
  dtoc: Allow the device tree to be compiled from source
  dtoc: Drop the convert_dash parameter to GetProps()
  dtoc: Prepare for supporting changing of device trees
  dtoc: Move to using bytearray
  dtoc: Support deleting device tree properties
  dtoc: Support packing the device tree
  dtoc: Support finding the offset of a property
  dtoc: Correct quotes in fdt_util
  dtoc: Add methods for reading data from properties
  binman: Introduce binman, a tool for building binary images
  binman: Add basic entry types for U-Boot
  binman: Add support for building x86 ROMs
  binman: Add support for u-boot.img as an input binary
  binman: Add a build rule for binman
  binman: Allow configuration options to be used in .dts files
  RFC: Use binman for a sunxi board
  RFC: Use binman for an x86 board

 Makefile                                           |  55 +-
 arch/arm/dts/sun7i-a20-pcduino3.dts                |  12 +
 arch/x86/cpu/intel_common/cpu.c                    |   4 +-
 arch/x86/cpu/intel_common/microcode.c              |  12 +-
 arch/x86/cpu/ivybridge/cpu.c                       |   4 +-
 arch/x86/dts/chromebook_link.dts                   |  52 ++
 lib/libfdt/libfdt.swig                             |  24 +
 scripts/Makefile.lib                               |   5 +
 tools/binman/.gitignore                            |   1 +
 tools/binman/README                                | 491 ++++++++++++++++
 tools/binman/binman                                |   1 +
 tools/binman/binman.py                             |  96 +++
 tools/binman/cmdline.py                            |  48 ++
 tools/binman/control.py                            | 106 ++++
 tools/binman/etype/blob.py                         |  37 ++
 tools/binman/etype/entry.py                        | 186 ++++++
 tools/binman/etype/intel_descriptor.py             |  55 ++
 tools/binman/etype/intel_me.py                     |  17 +
 tools/binman/etype/intel_mrc.py                    |  17 +
 tools/binman/etype/intel_vga.py                    |  17 +
 tools/binman/etype/u_boot.py                       |  17 +
 tools/binman/etype/u_boot_dtb.py                   |  17 +
 tools/binman/etype/u_boot_dtb_with_ucode.py        |  69 +++
 tools/binman/etype/u_boot_img.py                   |  17 +
 tools/binman/etype/u_boot_nodtb.py                 |  17 +
 tools/binman/etype/u_boot_spl.py                   |  17 +
 tools/binman/etype/u_boot_ucode.py                 |  77 +++
 tools/binman/etype/u_boot_with_ucode_ptr.py        |  71 +++
 tools/binman/etype/x86_start16.py                  |  17 +
 tools/binman/func_test.py                          | 652 +++++++++++++++++++++
 tools/binman/image.py                              | 233 ++++++++
 tools/binman/test/01_invalid.dts                   |   5 +
 tools/binman/test/02_missing_node.dts              |   6 +
 tools/binman/test/03_empty.dts                     |   9 +
 tools/binman/test/04_invalid_entry.dts             |  11 +
 tools/binman/test/05_simple.dts                    |  11 +
 tools/binman/test/06_dual_image.dts                |  22 +
 tools/binman/test/07_bad_align.dts                 |  12 +
 tools/binman/test/08_pack.dts                      |  30 +
 tools/binman/test/09_pack_extra.dts                |  35 ++
 tools/binman/test/10_pack_align_power2.dts         |  12 +
 tools/binman/test/11_pack_align_size_power2.dts    |  12 +
 tools/binman/test/12_pack_inv_align.dts            |  13 +
 tools/binman/test/13_pack_inv_size_align.dts       |  13 +
 tools/binman/test/14_pack_overlap.dts              |  16 +
 tools/binman/test/15_pack_overflow.dts             |  12 +
 tools/binman/test/16_pack_image_overflow.dts       |  13 +
 tools/binman/test/17_pack_image_size.dts           |  13 +
 tools/binman/test/18_pack_image_align.dts          |  13 +
 tools/binman/test/19_pack_inv_image_align.dts      |  14 +
 .../binman/test/20_pack_inv_image_align_power2.dts |  13 +
 tools/binman/test/21_image_pad.dts                 |  16 +
 tools/binman/test/22_image_name.dts                |  21 +
 tools/binman/test/23_blob.dts                      |  12 +
 tools/binman/test/24_sorted.dts                    |  17 +
 tools/binman/test/25_pack_zero_size.dts            |  15 +
 tools/binman/test/26_pack_u_boot_dtb.dts           |  14 +
 tools/binman/test/27_pack_4gb_no_size.dts          |  18 +
 tools/binman/test/28_pack_4gb_outside.dts          |  19 +
 tools/binman/test/29_x86-rom.dts                   |  19 +
 tools/binman/test/30_x86-rom-me-no-desc.dts        |  15 +
 tools/binman/test/31_x86-rom-me.dts                |  18 +
 tools/binman/test/32_intel-vga.dts                 |  13 +
 tools/binman/test/33_x86-start16.dts               |  13 +
 tools/binman/test/34_x86_ucode.dts                 |  29 +
 tools/binman/test/35_x86_single_ucode.dts          |  26 +
 tools/binman/test/36_u_boot_img.dts                |  11 +
 tools/binman/test/u_boot_ucode_ptr                 | Bin 0 -> 4175 bytes
 tools/binman/test/u_boot_ucode_ptr.c               |  15 +
 tools/binman/test/u_boot_ucode_ptr.lds             |  18 +
 tools/buildman/control.py                          |   2 +-
 tools/dtoc/dtoc.py                                 |  38 +-
 tools/dtoc/fdt.py                                  | 219 +++++--
 tools/dtoc/fdt_fallback.py                         | 133 ++---
 tools/dtoc/fdt_normal.py                           | 228 +++++++
 tools/dtoc/fdt_select.py                           |  26 +
 tools/dtoc/fdt_util.py                             | 126 ++--
 tools/patman/checkpatch.py                         |   3 +-
 tools/patman/command.py                            |   5 +-
 tools/patman/gitutil.py                            |   3 +-
 tools/patman/tools.py                              | 120 ++++
 tools/patman/tout.py                               | 166 ++++++
 82 files changed, 3821 insertions(+), 286 deletions(-)
 create mode 100644 tools/binman/.gitignore
 create mode 100644 tools/binman/README
 create mode 120000 tools/binman/binman
 create mode 100755 tools/binman/binman.py
 create mode 100644 tools/binman/cmdline.py
 create mode 100644 tools/binman/control.py
 create mode 100644 tools/binman/etype/blob.py
 create mode 100644 tools/binman/etype/entry.py
 create mode 100644 tools/binman/etype/intel_descriptor.py
 create mode 100644 tools/binman/etype/intel_me.py
 create mode 100644 tools/binman/etype/intel_mrc.py
 create mode 100644 tools/binman/etype/intel_vga.py
 create mode 100644 tools/binman/etype/u_boot.py
 create mode 100644 tools/binman/etype/u_boot_dtb.py
 create mode 100644 tools/binman/etype/u_boot_dtb_with_ucode.py
 create mode 100644 tools/binman/etype/u_boot_img.py
 create mode 100644 tools/binman/etype/u_boot_nodtb.py
 create mode 100644 tools/binman/etype/u_boot_spl.py
 create mode 100644 tools/binman/etype/u_boot_ucode.py
 create mode 100644 tools/binman/etype/u_boot_with_ucode_ptr.py
 create mode 100644 tools/binman/etype/x86_start16.py
 create mode 100644 tools/binman/func_test.py
 create mode 100644 tools/binman/image.py
 create mode 100644 tools/binman/test/01_invalid.dts
 create mode 100644 tools/binman/test/02_missing_node.dts
 create mode 100644 tools/binman/test/03_empty.dts
 create mode 100644 tools/binman/test/04_invalid_entry.dts
 create mode 100644 tools/binman/test/05_simple.dts
 create mode 100644 tools/binman/test/06_dual_image.dts
 create mode 100644 tools/binman/test/07_bad_align.dts
 create mode 100644 tools/binman/test/08_pack.dts
 create mode 100644 tools/binman/test/09_pack_extra.dts
 create mode 100644 tools/binman/test/10_pack_align_power2.dts
 create mode 100644 tools/binman/test/11_pack_align_size_power2.dts
 create mode 100644 tools/binman/test/12_pack_inv_align.dts
 create mode 100644 tools/binman/test/13_pack_inv_size_align.dts
 create mode 100644 tools/binman/test/14_pack_overlap.dts
 create mode 100644 tools/binman/test/15_pack_overflow.dts
 create mode 100644 tools/binman/test/16_pack_image_overflow.dts
 create mode 100644 tools/binman/test/17_pack_image_size.dts
 create mode 100644 tools/binman/test/18_pack_image_align.dts
 create mode 100644 tools/binman/test/19_pack_inv_image_align.dts
 create mode 100644 tools/binman/test/20_pack_inv_image_align_power2.dts
 create mode 100644 tools/binman/test/21_image_pad.dts
 create mode 100644 tools/binman/test/22_image_name.dts
 create mode 100644 tools/binman/test/23_blob.dts
 create mode 100644 tools/binman/test/24_sorted.dts
 create mode 100644 tools/binman/test/25_pack_zero_size.dts
 create mode 100644 tools/binman/test/26_pack_u_boot_dtb.dts
 create mode 100644 tools/binman/test/27_pack_4gb_no_size.dts
 create mode 100644 tools/binman/test/28_pack_4gb_outside.dts
 create mode 100644 tools/binman/test/29_x86-rom.dts
 create mode 100644 tools/binman/test/30_x86-rom-me-no-desc.dts
 create mode 100644 tools/binman/test/31_x86-rom-me.dts
 create mode 100644 tools/binman/test/32_intel-vga.dts
 create mode 100644 tools/binman/test/33_x86-start16.dts
 create mode 100644 tools/binman/test/34_x86_ucode.dts
 create mode 100644 tools/binman/test/35_x86_single_ucode.dts
 create mode 100644 tools/binman/test/36_u_boot_img.dts
 create mode 100755 tools/binman/test/u_boot_ucode_ptr
 create mode 100644 tools/binman/test/u_boot_ucode_ptr.c
 create mode 100644 tools/binman/test/u_boot_ucode_ptr.lds
 create mode 100644 tools/dtoc/fdt_normal.py
 create mode 100644 tools/dtoc/fdt_select.py
 create mode 100644 tools/patman/tools.py
 create mode 100644 tools/patman/tout.py

-- 
2.8.0.rc3.226.g39d4020



More information about the U-Boot mailing list