binman: A tool for creating firmware images
Subsystems (4)
v4 cover binman: A tool for creating firmware images
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, so sunxi and x86 boards are switched over to use it, as examples.
The series is available at u-boot-dm/binman-working
Future work and missing features are documented in the README.
Changes in v4:
- Add an option to bring in an soc .dtsi file also
- Add new patch to support building x86 images with FSP/CMC
- Fix incorrect comments at the top of intel_*.py
- Fix up rule to #include on "/ {" rather than "/dts-v1/;"
- Remove RFC tag
- Rename binman_dtsi variable to u-boot-dtsi
- Update sunxi rule to depend on u-boot.dtb
- Use binman for all sunxi boards
- Use binman for all x86 boards
Changes in v3:
- Add a new patch to automatically include a U-Boot .dtsi file
- Put the binman definition in u-boot.dtsi
- Use a <dts>-u-boot.dtsi file for the binman changes
Changes in v2:
- Add automated test coverage
- Add test for code coverage
- Fix the -b option
- Put the binman definition in a common file for x86
- Various changes and improvements based on using this tool for a while
- drop the unused __len__() method
Simon Glass (11):
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 support for building x86 ROMs with SPL
binman: Add support for building x86 images with FSP/CMC
binman: Add a build rule for binman
binman: Allow configuration options to be used in .dts files
binman: Automatically include a U-Boot .dtsi file
sunxi: Use binman for sunxi boards
x86: Use binman all x86 boards
Makefile | 57 +- arch/arm/dts/sunxi-u-boot.dtsi | 14 + arch/x86/dts/u-boot.dtsi | 62 ++ scripts/Makefile.lib | 22 +- tools/binman/.gitignore | 1 + tools/binman/README | 491 +++++++++++++ tools/binman/binman | 1 + tools/binman/binman.py | 116 +++ tools/binman/cmdline.py | 53 ++ tools/binman/control.py | 118 ++++ tools/binman/entry_test.py | 27 + tools/binman/etype/_testing.py | 26 + tools/binman/etype/blob.py | 37 + tools/binman/etype/entry.py | 190 +++++ tools/binman/etype/intel_cmc.py | 17 + tools/binman/etype/intel_descriptor.py | 55 ++ tools/binman/etype/intel_fsp.py | 17 + 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 | 72 ++ 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_spl_bss_pad.py | 26 + tools/binman/etype/u_boot_spl_with_ucode_ptr.py | 28 + tools/binman/etype/u_boot_ucode.py | 77 ++ tools/binman/etype/u_boot_with_ucode_ptr.py | 73 ++ tools/binman/etype/x86_start16.py | 17 + tools/binman/etype/x86_start16_spl.py | 17 + tools/binman/fdt_test.py | 48 ++ tools/binman/func_test.py | 777 +++++++++++++++++++++ tools/binman/image.py | 229 ++++++ 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/37_x86_no_ucode.dts | 20 + tools/binman/test/38_x86_ucode_missing_node.dts | 26 + tools/binman/test/39_x86_ucode_missing_node2.dts | 23 + tools/binman/test/40_x86_ucode_not_in_image.dts | 28 + tools/binman/test/41_unknown_pos_size.dts | 11 + tools/binman/test/42_intel-fsp.dts | 13 + tools/binman/test/43_intel-cmc.dts | 13 + tools/binman/test/u_boot_no_ucode_ptr | Bin 0 -> 4182 bytes tools/binman/test/u_boot_no_ucode_ptr.c | 15 + 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 + 83 files changed, 3500 insertions(+), 47 deletions(-) create mode 100644 arch/arm/dts/sunxi-u-boot.dtsi create mode 100644 arch/x86/dts/u-boot.dtsi 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/entry_test.py create mode 100644 tools/binman/etype/_testing.py create mode 100644 tools/binman/etype/blob.py create mode 100644 tools/binman/etype/entry.py create mode 100644 tools/binman/etype/intel_cmc.py create mode 100644 tools/binman/etype/intel_descriptor.py create mode 100644 tools/binman/etype/intel_fsp.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_spl_bss_pad.py create mode 100644 tools/binman/etype/u_boot_spl_with_ucode_ptr.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/etype/x86_start16_spl.py create mode 100644 tools/binman/fdt_test.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 100644 tools/binman/test/37_x86_no_ucode.dts create mode 100644 tools/binman/test/38_x86_ucode_missing_node.dts create mode 100644 tools/binman/test/39_x86_ucode_missing_node2.dts create mode 100644 tools/binman/test/40_x86_ucode_not_in_image.dts create mode 100644 tools/binman/test/41_unknown_pos_size.dts create mode 100644 tools/binman/test/42_intel-fsp.dts create mode 100644 tools/binman/test/43_intel-cmc.dts create mode 100755 tools/binman/test/u_boot_no_ucode_ptr create mode 100644 tools/binman/test/u_boot_no_ucode_ptr.c 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
Signature · 1 line
2.8.0.rc3.226.g39d4020
PATCH v4 1/11 binman: Introduce binman, a tool for building binary images
This adds the basic code for binman, including command parsing, processing of entries and generation of images.
So far no entry types are supported. These will be added in future commits as examples of how to add new types.
See the README for documentation.
---
Changes in v4: None
Changes in v3: None
Changes in v2:
- Add test for code coverage
- Fix the -b option
- drop the unused __len__() method
tools/binman/.gitignore | 1 + tools/binman/README | 491 ++++++++++++++++++++++++++++++++++++++++++++ tools/binman/binman | 1 + tools/binman/binman.py | 116 +++++++++++ tools/binman/cmdline.py | 53 +++++ tools/binman/control.py | 118 +++++++++++ tools/binman/etype/entry.py | 190 +++++++++++++++++ tools/binman/fdt_test.py | 48 +++++ tools/binman/image.py | 229 +++++++++++++++++++++ 9 files changed, 1247 insertions(+) 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/entry.py create mode 100644 tools/binman/fdt_test.py create mode 100644 tools/binman/image.py
tools/binman/.gitignore new file +1 -0
@@ -0,0 +1 @@ +*.pyc
tools/binman/README new file +491 -0
491 lines not on this page · raw message
tools/binman/binman new file +1 -0
@@ -0,0 +1 @@ +binman.py
tools/binman/binman.py new file +116 -0
116 lines not on this page · raw message
tools/binman/cmdline.py new file +53 -0
53 lines not on this page · raw message
tools/binman/control.py new file +118 -0
118 lines not on this page · raw message
tools/binman/etype/entry.py new file +190 -0
190 lines not on this page · raw message
tools/binman/fdt_test.py new file +48 -0
48 lines not on this page · raw message
tools/binman/image.py new file +229 -0
229 lines not on this page · raw message
Signature · 1 line
2.8.0.rc3.226.g39d4020
PATCH v4 1/11 binman: Introduce binman, a tool for building binary images
Hi Simon,
Quoted 179 lines · Simon Glass
This adds the basic code for binman, including command parsing, processing of entries and generation of images.
So far no entry types are supported. These will be added in future commits as examples of how to add new types.
See the README for documentation.
Signed-off-by Simon Glass <[email protected]>---
Changes in v4: None
Changes in v3: None
Changes in v2:
- Add test for code coverage
- Fix the -b option
- drop the unused__len__()methodtools/binman/.gitignore | 1 + tools/binman/README | 491 ++++++++++++++++++++++++++++++++++++++++++++ tools/binman/binman | 1 + tools/binman/binman.py | 116 +++++++++++ tools/binman/cmdline.py | 53 +++++ tools/binman/control.py | 118 +++++++++++ tools/binman/etype/entry.py | 190 +++++++++++++++++ tools/binman/fdt_test.py | 48 +++++ tools/binman/image.py | 229 +++++++++++++++++++++ 9 files changed, 1247 insertions(+) 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/entry.py create mode 100644 tools/binman/fdt_test.py create mode 100644 tools/binman/image.pytools/binman/.gitignore new file +1
-0@@ -0,0 +1 @@ +*.pyctools/binman/README new file +128
-0@@ -0,0 +1,491 @@ +# Copyright (c) 2016 Google, Inc +# +# SPDX-License-Identifier: GPL-2.0+ +# + +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 +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. + + +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. + + +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. + +Binman does not yet update the device tree with the final location of +everything when it is done. A simple C structure could be generated for +constrained environments like SPL (using dtoc) but this is also not +implemented. + +Binman can also support incorporating filesystems in the image if required. +For example x86 platforms may use CBFS in some cases. + +Binman is intended for use with U-Boot but is designed to be general enough +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. + +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. + +At present this is handled by manual instructions, different for each board, +on how to create images that will boot. By turning these instructions into a +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 accomodated +- 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 +----------- + +Binman uses the following terms: + +- image - an output file containing a firmware image +- binary - an input binary that goes into the image + + +Relationship to FIT +------------------- + +FIT is U-Boot's official image format. It supports multiple binaries with +load / execution addresses, compression. It also supports verification +through hashing and RSA signatures. + +FIT was originally designed to support booting a Linux kernel (with an +optional ramdisk) and device tree chosen from various options in the FIT. +Now that U-Boot supports configuration via device tree, it is possible to +load U-Boot from a FIT, with the device tree chosen by SPL. + +Binman considers FIT to be one of the binaries it can place in the image. + +Where possible it is best to put as much as possible in the FIT, with binman +used to deal with 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. + +For U-Boot, binman should not be used to create ad-hoc images in place of +FIT. + + +Relationship to mkimage +----------------------- + +The mkimage tool provides a means to create a FIT. Traditionally it has +needed an image description file: a device tree, like binman, but in a +different format. More recently it has started to support a '-f auto' mode +which can generate that automatically. + +More relevant to binman, mkimage also permits creation of many SoC-specific
tools/binman/README line 138
Quoted 10 lines
tools/binman/README new file +10
-0+image types. These can be listed by running 'mkimage -T list'. Examples +include 'rksd', the Rockchip SD/MMC boot format. The mkimage tool is often +called from the U-Boot build system for this reason. + +Binman considers the output files created by mkimage to be binary blobs +which it can place in an image. Binman does not replace the mkimage tool or +this purpose. It would be possible in some situtions to create a new entry +type for the images in mkimage, but this would not add functionality. It +seems better to use the mkiamge tool to generate binaries and avoid blurring +the boundaries between building input files (mkimage) and packaging then
then -> them?
Quoted 145 lines
tools/binman/README new file +145
-0+into a final image (binman). + + +Example use of binman in U-Boot +------------------------------- + +Binman aims to replace some of the ad-hoc image creation in the U-Boot +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. + +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. + +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. + +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 +sunxi-spl.bin (by calling mksunxiboot, or hopefully one day mkimage). In any +case, it would then create the image from the component parts. + +This simplifies the U-Boot Makefile somewhat, since various pieces of logic +can be replaced by a call to binman. + + +Example use of binman for x86 +----------------------------- + +In most cases x86 images have a lot of binary blobs, 'black-box' code +provided by Intel which must be run for the platform to work. Typically +these blobs are not relocatable and must be placed at fixed areas in the +firmare image. + +Currently this is handled by ifdtool, which places microcode, FSP, MRC, VGA +BIOS, reference code and Intel ME binaries into a u-boot.rom file. + +Binman is intended to replace all of this, with ifdtool left to handle only +the configuration of the Intel-format descriptor. + + +Running binman +-------------- + +Type: + + binman -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: + + binman -I <build_path> + +where <build_path> is the build directory containing the output of the U-Boot +build. + +(Future work will make this more configurable) + +In either case, binman picks up the device tree file (u-boot.dtb) and looks +for its instructions in the 'binman' node. + +Binman has a few other options which you can see by running 'binman -h'. + + +Image description format +------------------------ + +The binman node is called 'binman'. An example image description is shown +below: + + binman { + filename = "u-boot-sunxi-with-spl.bin"; + pad-byte = <0xff>; + blob { + filename = "spl/sunxi-spl.bin"; + }; + u-boot { + pos = <CONFIG_SPL_PAD_TO>; + }; + }; + + +This requests binman to create an image file called u-boot-sunxi-with-spl.bin +consisting of a specially formatted SPL (spl/sunxi-spl.bin, built by the +normal U-Boot Makefile), some 0xff padding, and a U-Boot legacy image. The +padding comes from the fact that the second binary is placed at +CONFIG_SPL_PAD_TO. If that line were omitted then the U-Boot binary would +immediately follow the SPL binary. + +The binman node describes an image. The sub-nodes describe entries in the +image. Each entry represents a region within the overall image. The name of +the entry (blob, u-boot) tells binman what to put there. For 'blob' we must +provide a filename. For 'u-boot', binman knows that this means 'u-boot.bin'. + +Entries are normally placed into the image sequentially, one after the other. +The image size is the total size of all entries. As you can see, you can +specify the start position of an entry using the 'pos' property. + +Note that due to a device tree requirement, all entries must have a unique +name. If you want to put the same binary in the image multiple times, you can +use any unique name, with the 'type' property providing the type. + +The attributes supported for entries are described below. + +pos: + This sets the position of an entry within the image. The first byte + of the image is normally at position 0. If 'pos' 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 position is adjusted + so that the entry starts on an aligned boundary within the image. For + example 'align = <16>' means that the entry will start on a 16-byte + boundary. Alignment shold 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. + +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 + offset the entry contents a little. 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. 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. + If 'align-size' is not provided, no alignment is performed. + +align-end:
tools/binman/README line 293
Quoted 10 lines
tools/binman/README new file +10
-0+ This sets the alignment of the end of an entry. Some entries require + that they end on an alignment boundary, regardless of where they + start. If 'align-end' is not provided, no alignment is performed. + + Note: This is not yet implemented in binman. + +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.
u-boot.bin
Quoted 132 lines
tools/binman/README new file +132
-0+ +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. + + +The attributes supported for images 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. + +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. + +pad-before: + This sets the padding before the image entries. The first entry will + be positionad 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. + +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>'. + +filename: + This specifies the image filename. It defaults to 'image.bin'. + +sort-by-pos: + 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 'pos' 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-pos;' 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 { + }; + }; + }; + +end-at-4gb: + For x86 machines the ROM positions 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 position of the first entry would be 0xfff80000 with + this option, instead of 0 without this option. + + +Examples of the above options can be found in the tests. See the +tools/binman/test directory. + + +Order of image creation +----------------------- + +Image creation proceeds in the following order, for each entry in the image. + +1. GetEntryContents() - the contents of each entry are obtained, normally by +reading from a file. This calls the Entry.ObtainContents() to read the +contents. The default version of Entry.ObtainContents() calls +Entry.GetDefaultFilename() and then reads that file. So a common mechanism +to select a file to read is to override that function in the subclass. The +functions must return True when they have read the contents. Binman will +retry calling the functions a few times if False is returned, allowing +dependencies between the contents of different entries. + +2. GetEntryPositions() - calls Entry.GetPositions() for each entry. This can +return a dict containing entries that need updating. The key should be the +entry name and the value is a tuple (pos, size). This allows an entry to +provide the position and size for other entries. The default implementation +of GetEntryPositions() returns {}. + +3. PackEntries() - calls Entry.Pack() which figures out the position and +size of an entry. The 'current' image position is passed in, and the function +returns the position immediately after the entry being packed. The default +implementation of Pack() is usually sufficient. + +4. CheckSize() - checks that the contents of all the entries fits within +the image size. If the image does not have a defined size, the size is set +large enough to hold all the entries. + +5. CheckEntries() - checks that the entries do not overlap, nor extend +outside the image. + +6. ProcessEntryContents() - this calls Entry.ProcessContents() on each entry. +The default implementatoin does nothing. This can be overriden to adjust the +contents of an entry in some way. For example, it would be possible to create +an entry containing a hash of the contents of some other entries. At this +stage the position and size of entries should not be adjusted. + +7. BuildImage() - builds the image and writes it to a file. This is the final +step. + + +Advanced Features / Technical docs +---------------------------------- + +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 +data from a file and places it in the entry. In fact most entry types are +subclasses of Entry_blob. + +Each entry type is a separate file in the tools/binman/etype directory. Each +file contains a class called Entry_<type> where <type> is the entry type. +New entry types can be supported by adding new files in that directory. +These will automatically be detected by binman when needed.
tools/binman/README line 435
Quoted 10 lines
tools/binman/README new file +10
-0+ +Entry properties are documented in entry.py. The entry subclasses are free +to change the values of properties to support special behaviour. For example, +when Entry_blob loads a file, it sets content_size to the size of the file. +Entry classes can adjust other entries. For example, an entry that knows +where other entries should be positioned can set up those entries' positions +so they don't need to be set in the binman decription. It can also adjust +entry contents. + +Most of the time such essoteric behaviour is not needed, but it can be
typo: esoteric
Quoted 46 lines
tools/binman/README new file +46
-0+essential for complex images. + + +History / Credits +----------------- + +Binman takes a lot of inspiration from a Chrome OS tool called +'cros_bundle_firmware', which I wrote some years ago. That tool was based on +a reasonably simple and sound design but has expanded greatly over the +years. In particular its handling of x86 images is convoluted. + +Quite a few lessons have been learned which are hopefully be applied here. + + +Design notes +------------ + +On the face of it, a tool to create firmware images should be fairly simple: +just find all the input binaries and place them at the right place in the +image. The difficulty comes from the wide variety of input types (simple +flat binaries containing code, packaged data with various headers), packing +requirments (alignment, spacing, device boundaries) and other required +features such as hierarchical images. + +The design challenge is to make it easy to create simple images, while +allowing the more complex cases to be supported. For example, for most +images we don't much care exactly where each binary ends up, so we should +not have to specify that unnecessarily. + +New entry types should aim to provide simple usage where possible. If new +core features are needed, they can be added in the Entry base class. + + +To do +----- + +Some ideas: +- Fill out the device tree to include the final position and size of each + entry (since the input file may not always specify these) +- Use of-platdata to make the information available to code that is unable + to use device tree (such as a very small SPL image) +- Write an image map to a text file +- Allow easy building of images by specifying just the board name +- Produce a full Python binding for libfdt (for upstream) +- Add an option to decode an image into the constituent binaries +- Suppoort hierarchical images (packing of binaries into another binary
tools/binman/README line 491
Quoted 10 lines
tools/binman/README new file +10
-0+ which is then placed in the image) +- Support building an image for a board (-b) more completely, with a + configurable build directory +- Consider making binman work with buildman, although if it is used in the + Makefile, this will be automatic +- Implement align-end + +-- +Simon Glass <[email protected]> +7/7/2016
Only reviewed the doc. Will do some testing.
[snip]
Regards,
Bin
PATCH v4 2/11 binman: Add basic entry types for U-Boot
In reply to Simon GlassAdd entries to support some standard U-Boot binaries, such as u-boot.bin, u-boot.dtb, etc. Also add some tests for these.
---
Changes in v4: None
Changes in v3: None
Changes in v2: None
tools/binman/entry_test.py | 27 + tools/binman/etype/_testing.py | 26 + tools/binman/etype/blob.py | 37 ++ tools/binman/etype/u_boot.py | 17 + tools/binman/etype/u_boot_dtb.py | 17 + tools/binman/etype/u_boot_nodtb.py | 17 + tools/binman/etype/u_boot_spl.py | 17 + tools/binman/func_test.py | 542 +++++++++++++++++++++ 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 + 34 files changed, 1080 insertions(+) create mode 100644 tools/binman/entry_test.py create mode 100644 tools/binman/etype/_testing.py create mode 100644 tools/binman/etype/blob.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_nodtb.py create mode 100644 tools/binman/etype/u_boot_spl.py create mode 100644 tools/binman/func_test.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
tools/binman/entry_test.py new file +27 -0
@@ -0,0 +1,27 @@ +# +# Copyright (c) 2016 Google, Inc +# Written by Simon Glass <[email protected]> +# +# SPDX-License-Identifier: GPL-2.0+ +# +# Test for the Entry class + +import collections +import unittest + +import entry + +class TestEntry(unittest.TestCase): + def testEntryContents(self): + """Test the Entry bass class""" + base_entry = entry.Entry(None, None, None, read_node=False) + self.assertEqual(True, base_entry.ObtainContents()) + + def testUnknownEntry(self): + """Test that unknown entry types are detected""" + Node = collections.namedtuple('Node', ['name', 'path']) + node = Node('invalid-name', 'invalid-path') + with self.assertRaises(ValueError) as e: + entry.Entry.Create(None, node, node.name) + self.assertIn("Unknown entry type 'invalid-name' in node " + "'invalid-path'", str(e.exception))
tools/binman/etype/_testing.py new file +26 -0
@@ -0,0 +1,26 @@ +# Copyright (c) 2016 Google, Inc +# Written by Simon Glass <[email protected]> +# +# SPDX-License-Identifier: GPL-2.0+ +# +# Entry-type module for testing purposes. Not used in real images. +# + +from entry import Entry +import fdt_util +import tools + +class Entry__testing(Entry): + def __init__(self, image, etype, node): + Entry.__init__(self, image, etype, node) + + def ObtainContents(self): + self.data = 'a' + self.contents_size = len(self.data) + return True + + def ReadContents(self): + return True + + def GetPositions(self): + return {'invalid-entry': [1, 2]}
tools/binman/etype/blob.py new file +37 -0
@@ -0,0 +1,37 @@ +# Copyright (c) 2016 Google, Inc +# Written by Simon Glass <[email protected]> +# +# SPDX-License-Identifier: GPL-2.0+ +# +# Entry-type module for blobs, which are binary objects read from files +# + +from entry import Entry +import fdt_util +import tools + +class Entry_blob(Entry): + def __init__(self, image, etype, node): + Entry.__init__(self, image, etype, node) + self._filename = fdt_util.GetString(self._node, "filename", self.etype) + + def ObtainContents(self): + self._filename = self.GetDefaultFilename() + self._pathname = tools.GetInputFilename(self._filename) + self.ReadContents() + return True + + def ReadContents(self): + with open(self._pathname) as fd: + # We assume the data is small enough to fit into memory. If this + # is used for large filesystem image that might not be true. + # In that case, Image.BuildImage() could be adjusted to use a + # new Entry method which can read in chunks. Then we could copy + # the data in chunks and avoid reading it all at once. For now + # this seems like an unnecessary complication. + self.data = fd.read() + self.contents_size = len(self.data) + return True + + def GetDefaultFilename(self): + return self._filename
tools/binman/etype/u_boot.py new file +17 -0
@@ -0,0 +1,17 @@ +# Copyright (c) 2016 Google, Inc +# Written by Simon Glass <[email protected]> +# +# SPDX-License-Identifier: GPL-2.0+ +# +# Entry-type module for U-Boot binary +# + +from entry import Entry +from blob import Entry_blob + +class Entry_u_boot(Entry_blob): + def __init__(self, image, etype, node): + Entry_blob.__init__(self, image, etype, node) + + def GetDefaultFilename(self): + return 'u-boot.bin'
tools/binman/etype/u_boot_dtb.py new file +17 -0
@@ -0,0 +1,17 @@ +# Copyright (c) 2016 Google, Inc +# Written by Simon Glass <[email protected]> +# +# SPDX-License-Identifier: GPL-2.0+ +# +# Entry-type module for U-Boot device tree +# + +from entry import Entry +from blob import Entry_blob + +class Entry_u_boot_dtb(Entry_blob): + def __init__(self, image, etype, node): + Entry_blob.__init__(self, image, etype, node) + + def GetDefaultFilename(self): + return 'u-boot.dtb'
tools/binman/etype/u_boot_nodtb.py new file +17 -0
@@ -0,0 +1,17 @@ +# Copyright (c) 2016 Google, Inc +# Written by Simon Glass <[email protected]> +# +# SPDX-License-Identifier: GPL-2.0+ +# +# Entry-type module for 'u-boot-nodtb.bin' +# + +from entry import Entry +from blob import Entry_blob + +class Entry_u_boot_nodtb(Entry_blob): + def __init__(self, image, etype, node): + Entry_blob.__init__(self, image, etype, node) + + def GetDefaultFilename(self): + return 'u-boot-nodtb.bin'
tools/binman/etype/u_boot_spl.py new file +17 -0
@@ -0,0 +1,17 @@ +# Copyright (c) 2016 Google, Inc +# Written by Simon Glass <[email protected]> +# +# SPDX-License-Identifier: GPL-2.0+ +# +# Entry-type module for spl/u-boot-spl.bin +# + +from entry import Entry +from blob import Entry_blob + +class Entry_u_boot_spl(Entry_blob): + def __init__(self, image, etype, node): + Entry_blob.__init__(self, image, etype, node) + + def GetDefaultFilename(self): + return 'spl/u-boot-spl.bin'
tools/binman/func_test.py new file +542 -0
542 lines not on this page · raw message
tools/binman/test/01_invalid.dts new file +5 -0
@@ -0,0 +1,5 @@ +/dts-v1/; + +/ { + #address-cells = <1>; + #size-cells = <1>;
tools/binman/test/02_missing_node.dts new file +6 -0
@@ -0,0 +1,6 @@ +/dts-v1/; + +/ { + #address-cells = <1>; + #size-cells = <1>; +};
tools/binman/test/03_empty.dts new file +9 -0
@@ -0,0 +1,9 @@ +/dts-v1/; + +/ { + #address-cells = <1>; + #size-cells = <1>; + + binman { + }; +};
tools/binman/test/04_invalid_entry.dts new file +11 -0
@@ -0,0 +1,11 @@ +/dts-v1/; + +/ { + #address-cells = <1>; + #size-cells = <1>; + + binman { + not-a-valid-type { + }; + }; +};
tools/binman/test/05_simple.dts new file +11 -0
@@ -0,0 +1,11 @@ +/dts-v1/; + +/ { + #address-cells = <1>; + #size-cells = <1>; + + binman { + u-boot { + }; + }; +};
tools/binman/test/06_dual_image.dts new file +22 -0
@@ -0,0 +1,22 @@ +/dts-v1/; + +/ { + #address-cells = <1>; + #size-cells = <1>; + + binman { + multiple-images; + image1 { + u-boot { + }; + }; + + image2 { + pad-before = <3>; + pad-after = <5>; + + u-boot { + }; + }; + }; +};
tools/binman/test/07_bad_align.dts new file +12 -0
@@ -0,0 +1,12 @@ +/dts-v1/; + +/ { + #address-cells = <1>; + #size-cells = <1>; + + binman { + u-boot { + align = <23>; + }; + }; +};
tools/binman/test/08_pack.dts new file +30 -0
@@ -0,0 +1,30 @@ +/dts-v1/; + +/ { + #address-cells = <1>; + #size-cells = <1>; + + binman { + u-boot { + }; + + u-boot-align { + type = "u-boot"; + align = <16>; + }; + + u-boot-size { + type = "u-boot"; + size = <23>; + }; + + u-boot-next { + type = "u-boot"; + }; + + u-boot-fixed { + type = "u-boot"; + pos = <61>; + }; + }; +};
tools/binman/test/09_pack_extra.dts new file +35 -0
@@ -0,0 +1,35 @@ +/dts-v1/; + +/ { + #address-cells = <1>; + #size-cells = <1>; + + binman { + u-boot { + pad-before = <3>; + pad-after = <5>; + }; + + u-boot-align-size-nop { + type = "u-boot"; + align-size = <4>; + }; + + u-boot-align-size { + type = "u-boot"; + align = <16>; + align-size = <32>; + }; + + u-boot-align-end { + type = "u-boot"; + align-end = <64>; + }; + + u-boot-align-both { + type = "u-boot"; + align= <64>; + align-end = <128>; + }; + }; +};
tools/binman/test/10_pack_align_power2.dts new file +12 -0
@@ -0,0 +1,12 @@ +/dts-v1/; + +/ { + #address-cells = <1>; + #size-cells = <1>; + + binman { + u-boot { + align = <5>; + }; + }; +};
tools/binman/test/11_pack_align_size_power2.dts new file +12 -0
@@ -0,0 +1,12 @@ +/dts-v1/; + +/ { + #address-cells = <1>; + #size-cells = <1>; + + binman { + u-boot { + align-size = <55>; + }; + }; +};
tools/binman/test/12_pack_inv_align.dts new file +13 -0
@@ -0,0 +1,13 @@ +/dts-v1/; + +/ { + #address-cells = <1>; + #size-cells = <1>; + + binman { + u-boot { + pos = <5>; + align = <4>; + }; + }; +};
tools/binman/test/13_pack_inv_size_align.dts new file +13 -0
@@ -0,0 +1,13 @@ +/dts-v1/; + +/ { + #address-cells = <1>; + #size-cells = <1>; + + binman { + u-boot { + size = <5>; + align-size = <4>; + }; + }; +};
tools/binman/test/14_pack_overlap.dts new file +16 -0
@@ -0,0 +1,16 @@ +/dts-v1/; + +/ { + #address-cells = <1>; + #size-cells = <1>; + + binman { + u-boot { + }; + + u-boot-align { + type = "u-boot"; + pos = <3>; + }; + }; +};
tools/binman/test/15_pack_overflow.dts new file +12 -0
@@ -0,0 +1,12 @@ +/dts-v1/; + +/ { + #address-cells = <1>; + #size-cells = <1>; + + binman { + u-boot { + size = <3>; + }; + }; +};
tools/binman/test/16_pack_image_overflow.dts new file +13 -0
@@ -0,0 +1,13 @@ +/dts-v1/; + +/ { + #address-cells = <1>; + #size-cells = <1>; + + binman { + size = <3>; + + u-boot { + }; + }; +};
tools/binman/test/17_pack_image_size.dts new file +13 -0
@@ -0,0 +1,13 @@ +/dts-v1/; + +/ { + #address-cells = <1>; + #size-cells = <1>; + + binman { + size = <7>; + + u-boot { + }; + }; +};
tools/binman/test/18_pack_image_align.dts new file +13 -0
@@ -0,0 +1,13 @@ +/dts-v1/; + +/ { + #address-cells = <1>; + #size-cells = <1>; + + binman { + align-size = <16>; + + u-boot { + }; + }; +};
tools/binman/test/19_pack_inv_image_align.dts new file +14 -0
@@ -0,0 +1,14 @@ +/dts-v1/; + +/ { + #address-cells = <1>; + #size-cells = <1>; + + binman { + size = <7>; + align-size = <8>; + + u-boot { + }; + }; +};
tools/binman/test/20_pack_inv_image_align_power2.dts new file +13 -0
@@ -0,0 +1,13 @@ +/dts-v1/; + +/ { + #address-cells = <1>; + #size-cells = <1>; + + binman { + align-size = <131>; + + u-boot { + }; + }; +};
tools/binman/test/21_image_pad.dts new file +16 -0
@@ -0,0 +1,16 @@ +/dts-v1/; + +/ { + #address-cells = <1>; + #size-cells = <1>; + + binman { + pad-byte = <0xff>; + u-boot-spl { + }; + + u-boot { + pos = <12>; + }; + }; +};
tools/binman/test/22_image_name.dts new file +21 -0
@@ -0,0 +1,21 @@ +/dts-v1/; + +/ { + #address-cells = <1>; + #size-cells = <1>; + + binman { + multiple-images; + image1 { + filename = "test-name"; + u-boot { + }; + }; + + image2 { + filename = "test-name.xx"; + u-boot { + }; + }; + }; +};
tools/binman/test/23_blob.dts new file +12 -0
@@ -0,0 +1,12 @@ +/dts-v1/; + +/ { + #address-cells = <1>; + #size-cells = <1>; + + binman { + blob { + filename = "blobfile"; + }; + }; +};
tools/binman/test/24_sorted.dts new file +17 -0
@@ -0,0 +1,17 @@ +/dts-v1/; + +/ { + #address-cells = <1>; + #size-cells = <1>; + + binman { + sort-by-pos; + u-boot { + pos = <10>; + }; + + u-boot-spl { + pos = <5>; + }; + }; +};
tools/binman/test/25_pack_zero_size.dts new file +15 -0
@@ -0,0 +1,15 @@ +/dts-v1/; + +/ { + #address-cells = <1>; + #size-cells = <1>; + + binman { + u-boot { + }; + + u-boot-spl { + pos = <0>; + }; + }; +};
tools/binman/test/26_pack_u_boot_dtb.dts new file +14 -0
@@ -0,0 +1,14 @@ +/dts-v1/; + +/ { + #address-cells = <1>; + #size-cells = <1>; + + binman { + u-boot-nodtb { + }; + + u-boot-dtb { + }; + }; +};
Signature · 1 line
2.8.0.rc3.226.g39d4020
PATCH v4 3/11 binman: Add support for building x86 ROMs
In reply to Simon GlassThe structure of x86 ROMs is pretty complex. There are various binary blobs to place in the image. Microcode requires special handling so that it is available to very early code and can be used without any memory whatsoever.
Add support for the various entry types that are currently needed, along with some tests.
---
Changes in v4:
- Fix incorrect comments at the top of intel_*.py
Changes in v3: None
Changes in v2: None
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_dtb_with_ucode.py | 72 ++++++++++++++ tools/binman/etype/u_boot_ucode.py | 77 +++++++++++++++ tools/binman/etype/u_boot_with_ucode_ptr.py | 73 ++++++++++++++ tools/binman/etype/x86_start16.py | 17 ++++ tools/binman/func_test.py | 145 ++++++++++++++++++++++++++++ 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/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 ++++ 21 files changed, 693 insertions(+) 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_dtb_with_ucode.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/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 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
tools/binman/etype/intel_descriptor.py new file +55 -0
@@ -0,0 +1,55 @@ +# Copyright (c) 2016 Google, Inc +# Written by Simon Glass <[email protected]> +# +# SPDX-License-Identifier: GPL-2.0+ +# +# Entry-type module for 'u-boot' +# + +import struct + +from entry import Entry +from blob import Entry_blob + +FD_SIGNATURE = struct.pack('<L', 0x0ff0a55a) +MAX_REGIONS = 5 + +(REGION_DESCRIPTOR, REGION_BIOS, REGION_ME, REGION_GBE, + REGION_PDATA) = range(5) + +class Region: + def __init__(self, data, frba, region_num): + pos = frba + region_num * 4 + val = struct.unpack('<L', data[pos:pos + 4])[0] + self.base = (val & 0xfff) << 12 + self.limit = ((val & 0x0fff0000) >> 4) | 0xfff + self.size = self.limit - self.base + 1 + +class Entry_intel_descriptor(Entry_blob): + """Intel flash descriptor block (4KB) + + This is placed at the start of flash and provides information about + the SPI flash regions. In particular it provides the base address and + size of the ME region, allowing us to place the ME binary in the right + place. + """ + def __init__(self, image, etype, node): + Entry_blob.__init__(self, image, etype, node) + self._regions = [] + + def GetDefaultFilename(self): + return 'descriptor.bin' + + def GetPositions(self): + pos = self.data.find(FD_SIGNATURE) + if pos == -1: + self.Raise('Cannot find FD signature') + flvalsig, flmap0, flmap1, flmap2 = struct.unpack('<LLLL', + self.data[pos:pos + 16]) + frba = ((flmap0 >> 16) & 0xff) << 4 + for i in range(MAX_REGIONS): + self._regions.append(Region(self.data, frba, i)) + + # Set the offset for ME only, for now, since the others are not used + return {'intel-me': [self._regions[REGION_ME].base, + self._regions[REGION_ME].size]}
tools/binman/etype/intel_me.py new file +17 -0
@@ -0,0 +1,17 @@ +# Copyright (c) 2016 Google, Inc +# Written by Simon Glass <[email protected]> +# +# SPDX-License-Identifier: GPL-2.0+ +# +# Entry-type module for Intel Management Engine binary blob +# + +from entry import Entry +from blob import Entry_blob + +class Entry_intel_me(Entry_blob): + def __init__(self, image, etype, node): + Entry_blob.__init__(self, image, etype, node) + + def GetDefaultFilename(self): + return 'me.bin'
tools/binman/etype/intel_mrc.py new file +17 -0
@@ -0,0 +1,17 @@ +# Copyright (c) 2016 Google, Inc +# Written by Simon Glass <[email protected]> +# +# SPDX-License-Identifier: GPL-2.0+ +# +# Entry-type module for Intel Memory Reference Code binary blob +# + +from entry import Entry +from blob import Entry_blob + +class Entry_intel_mrc(Entry_blob): + def __init__(self, image, etype, node): + Entry_blob.__init__(self, image, etype, node) + + def GetDefaultFilename(self): + return 'mrc.bin'
tools/binman/etype/intel_vga.py new file +17 -0
@@ -0,0 +1,17 @@ +# Copyright (c) 2016 Google, Inc +# Written by Simon Glass <[email protected]> +# +# SPDX-License-Identifier: GPL-2.0+ +# +# Entry-type module for x86 VGA ROM binary blob +# + +from entry import Entry +from blob import Entry_blob + +class Entry_intel_vga(Entry_blob): + def __init__(self, image, etype, node): + Entry_blob.__init__(self, image, etype, node) + + def GetDefaultFilename(self): + return 'vga.bin'
tools/binman/etype/u_boot_dtb_with_ucode.py new file +72 -0
72 lines not on this page · raw message
tools/binman/etype/u_boot_ucode.py new file +77 -0
77 lines not on this page · raw message
tools/binman/etype/u_boot_with_ucode_ptr.py new file +73 -0
73 lines not on this page · raw message
tools/binman/etype/x86_start16.py new file +17 -0
@@ -0,0 +1,17 @@ +# Copyright (c) 2016 Google, Inc +# Written by Simon Glass <[email protected]> +# +# SPDX-License-Identifier: GPL-2.0+ +# +# Entry-type module for the 16-bit x86 start-up code for U-Boot +# + +from entry import Entry +from blob import Entry_blob + +class Entry_x86_start16(Entry_blob): + def __init__(self, image, etype, node): + Entry_blob.__init__(self, image, etype, node) + + def GetDefaultFilename(self): + return 'u-boot-x86-16bit.bin'
tools/binman/func_test.py +145 -0
158 lines not on this page · raw message
tools/binman/test/27_pack_4gb_no_size.dts new file +18 -0
@@ -0,0 +1,18 @@ +/dts-v1/; + +/ { + #address-cells = <1>; + #size-cells = <1>; + + binman { + sort-by-pos; + end-at-4gb; + u-boot { + pos = <0xfffffff0>; + }; + + u-boot-spl { + pos = <0xfffffff7>; + }; + }; +};
tools/binman/test/28_pack_4gb_outside.dts new file +19 -0
@@ -0,0 +1,19 @@ +/dts-v1/; + +/ { + #address-cells = <1>; + #size-cells = <1>; + + binman { + sort-by-pos; + end-at-4gb; + size = <16>; + u-boot { + pos = <0>; + }; + + u-boot-spl { + pos = <0xfffffff7>; + }; + }; +};
tools/binman/test/29_x86-rom.dts new file +19 -0
@@ -0,0 +1,19 @@ +/dts-v1/; + +/ { + #address-cells = <1>; + #size-cells = <1>; + + binman { + sort-by-pos; + end-at-4gb; + size = <16>; + u-boot { + pos = <0xfffffff0>; + }; + + u-boot-spl { + pos = <0xfffffff7>; + }; + }; +};
tools/binman/test/30_x86-rom-me-no-desc.dts new file +15 -0
@@ -0,0 +1,15 @@ +/dts-v1/; + +/ { + #address-cells = <1>; + #size-cells = <1>; + + binman { + sort-by-pos; + end-at-4gb; + size = <16>; + intel-me { + pos-unset; + }; + }; +};
tools/binman/test/31_x86-rom-me.dts new file +18 -0
@@ -0,0 +1,18 @@ +/dts-v1/; + +/ { + #address-cells = <1>; + #size-cells = <1>; + + binman { + sort-by-pos; + end-at-4gb; + size = <0x800000>; + intel-descriptor { + }; + + intel-me { + pos-unset; + }; + }; +};
tools/binman/test/32_intel-vga.dts new file +13 -0
@@ -0,0 +1,13 @@ +/dts-v1/; + +/ { + #address-cells = <1>; + #size-cells = <1>; + + binman { + size = <16>; + + intel-vga { + }; + }; +};
tools/binman/test/33_x86-start16.dts new file +13 -0
@@ -0,0 +1,13 @@ +/dts-v1/; + +/ { + #address-cells = <1>; + #size-cells = <1>; + + binman { + size = <16>; + + x86-start16 { + }; + }; +};
tools/binman/test/34_x86_ucode.dts new file +29 -0
@@ -0,0 +1,29 @@ +/dts-v1/; + +/ { + #address-cells = <1>; + #size-cells = <1>; + + binman { + sort-by-pos; + end-at-4gb; + size = <0x200>; + u-boot-with-ucode-ptr { + }; + + u-boot-dtb-with-ucode { + }; + + u-boot-ucode { + }; + }; + + microcode { + update at 0 { + data = <0x12345678 0x12345679>; + }; + update at 1 { + data = <0xabcd0000 0x78235609>; + }; + }; +};
tools/binman/test/35_x86_single_ucode.dts new file +26 -0
@@ -0,0 +1,26 @@ +/dts-v1/; + +/ { + #address-cells = <1>; + #size-cells = <1>; + + binman { + sort-by-pos; + end-at-4gb; + size = <0x200>; + u-boot-with-ucode-ptr { + }; + + u-boot-dtb-with-ucode { + }; + + u-boot-ucode { + }; + }; + + microcode { + update at 0 { + data = <0x12345678 0x12345679>; + }; + }; +};
tools/binman/test/u_boot_ucode_ptr new file binary +0 -0
zgM)i3QgG0CU(yE=7YE1p!Ew2t at 9xWVH@o|LsZ@#-(v%@sqt7rjSl=(i5rZlmsZoxy zQ9SaF!jM>&I0rHVXMs3_>*wPh=u>4I0zc&NRXVJG0rgz2p&8H&Xa+OngPv#W<WEb z8PE)91~dczzyR*A5=(}qebAw|qP00Wx+^}sOy2XS&mWD8@+0oQG~%t+cBR&_15XAO zLu?77z7|AQ^SWt>h9TCMV?U7?UiPJBvzCKcpQta-m##SW0$~TeGpF8jNCaKqaY=Oj ze&6*ZKlNvnIWxzCEXm}&a5V?u^%8<um|=meT89(@6%cSR#15x>_A>)8o(X9qLQXD z#1~o6OQFqqJIY{<8~_@#DLmzgZrQ+Xi@EVGZrnMRWWNeKSJ|ha`YAi9u{Z4aQjhnG z?c~ddtBklhOXCp#9(;g{)Q?Fq+c>PTU-d6wo4~YvUz*V$GtcEfbjfs-ZCgXv9QLkU KGKbO{NcskUZF7hK
literal 0
HcmV?d00001
tools/binman/test/u_boot_ucode_ptr.c new file +15 -0
@@ -0,0 +1,15 @@ +/* +* Copyright (c) 2016 Google, Inc +* +* SPDX-License-Identifier: GPL-2.0+ +* +* Simple program to create a _dt_ucode_base_size symbol which can be read +* by 'nm'. This is used by binman tests. +* +* Build with: +* cc -march=i386 -m32 -o u_boot_ucode_ptr -T u_boot_ucode_ptr.lds -nostdlib \ +u_boot_ucode_ptr.c +*/ + +static unsigned long _dt_ucode_base_size[2] + __attribute__((section(".ucode"))) = {1, 2};
tools/binman/test/u_boot_ucode_ptr.lds new file +18 -0
@@ -0,0 +1,18 @@ +/* + * Copyright (c) 2016 Google, Inc + * + * SPDX-License-Identifier: GPL-2.0+ + */ + +OUTPUT_FORMAT("elf32-i386", "elf32-i386", "elf32-i386") +OUTPUT_ARCH(i386) +ENTRY(_start) + +SECTIONS +{ + . = 0xfffffdf0; + _start = .; + .ucode : { + *(.ucode) + } +}
Signature · 1 line
2.8.0.rc3.226.g39d4020
PATCH v4 4/11 binman: Add support for u-boot.img as an input binary
In reply to Simon GlassAdd an entry type for u-boot.img (a legacy U-Boot image) and a simple test.
---
Changes in v4: None
Changes in v3: None
Changes in v2: None
tools/binman/etype/u_boot_img.py | 17 +++++++++++++++++ tools/binman/func_test.py | 5 +++++ tools/binman/test/36_u_boot_img.dts | 11 +++++++++++ 3 files changed, 33 insertions(+) create mode 100644 tools/binman/etype/u_boot_img.py create mode 100644 tools/binman/test/36_u_boot_img.dts
tools/binman/etype/u_boot_img.py new file +17 -0
@@ -0,0 +1,17 @@ +# Copyright (c) 2016 Google, Inc +# Written by Simon Glass <[email protected]> +# +# SPDX-License-Identifier: GPL-2.0+ +# +# Entry-type module for U-Boot binary +# + +from entry import Entry +from blob import Entry_blob + +class Entry_u_boot_img(Entry_blob): + def __init__(self, image, etype, node): + Entry_blob.__init__(self, image, etype, node) + + def GetDefaultFilename(self): + return 'u-boot.img'
tools/binman/func_test.py +5 -0
@@ -685,3 +685,8 @@ class TestFunctional(unittest.TestCase): first = data[:len(U_BOOT_NODTB_DATA)] self.assertEqual('nodtb with microcode' + pos_and_size + ' somewhere in here', first) + + def testUBootImg(self): + """Test that u-boot.img can be put in a file""" + data = self._DoReadFile('36_u_boot_img.dts') + self.assertEqual(U_BOOT_IMG_DATA, data)
tools/binman/test/36_u_boot_img.dts new file +11 -0
@@ -0,0 +1,11 @@ +/dts-v1/; + +/ { + #address-cells = <1>; + #size-cells = <1>; + + binman { + u-boot-img { + }; + }; +};
Signature · 1 line
2.8.0.rc3.226.g39d4020
PATCH v4 5/11 binman: Add support for building x86 ROMs with SPL
In reply to Simon GlassWhen building for 64-bit x86 we need an SPL binary in the ROM. Add support for this. Also increase entry test code coverage to 100%.
---
Changes in v4: None
Changes in v3: None
Changes in v2: None
tools/binman/etype/u_boot_spl_bss_pad.py | 26 +++++++++ tools/binman/etype/u_boot_spl_with_ucode_ptr.py | 28 +++++++++ tools/binman/etype/x86_start16_spl.py | 17 ++++++ tools/binman/func_test.py | 71 +++++++++++++++++++++++ tools/binman/test/37_x86_no_ucode.dts | 20 +++++++ tools/binman/test/38_x86_ucode_missing_node.dts | 26 +++++++++ tools/binman/test/39_x86_ucode_missing_node2.dts | 23 ++++++++ tools/binman/test/40_x86_ucode_not_in_image.dts | 28 +++++++++ tools/binman/test/41_unknown_pos_size.dts | 11 ++++ tools/binman/test/u_boot_no_ucode_ptr | Bin 0 -> 4182 bytes tools/binman/test/u_boot_no_ucode_ptr.c | 15 +++++ 11 files changed, 265 insertions(+) create mode 100644 tools/binman/etype/u_boot_spl_bss_pad.py create mode 100644 tools/binman/etype/u_boot_spl_with_ucode_ptr.py create mode 100644 tools/binman/etype/x86_start16_spl.py create mode 100644 tools/binman/test/37_x86_no_ucode.dts create mode 100644 tools/binman/test/38_x86_ucode_missing_node.dts create mode 100644 tools/binman/test/39_x86_ucode_missing_node2.dts create mode 100644 tools/binman/test/40_x86_ucode_not_in_image.dts create mode 100644 tools/binman/test/41_unknown_pos_size.dts create mode 100755 tools/binman/test/u_boot_no_ucode_ptr create mode 100644 tools/binman/test/u_boot_no_ucode_ptr.c
tools/binman/etype/u_boot_spl_bss_pad.py new file +26 -0
@@ -0,0 +1,26 @@ +# Copyright (c) 2016 Google, Inc +# Written by Simon Glass <[email protected]> +# +# SPDX-License-Identifier: GPL-2.0+ +# +# Entry-type module for BSS padding for spl/u-boot-spl.bin. This padding +# can be added after the SPL binary to ensure that anything concatenated +# to it will appear to SPL to be at the end of BSS rather than the start. +# + +import command +from entry import Entry +from blob import Entry_blob +import tools + +class Entry_u_boot_spl_bss_pad(Entry_blob): + def __init__(self, image, etype, node): + Entry_blob.__init__(self, image, etype, node) + + def ObtainContents(self): + fname = tools.GetInputFilename('spl/u-boot-spl') + args = [['nm', fname], ['grep', '__bss_size']] + out = command.RunPipe(args, capture=True).stdout.splitlines() + bss_size = int(out[0].split()[0], 16) + self.data = chr(0) * bss_size + self.contents_size = bss_size
tools/binman/etype/u_boot_spl_with_ucode_ptr.py new file +28 -0
@@ -0,0 +1,28 @@ +# Copyright (c) 2016 Google, Inc +# Written by Simon Glass <[email protected]> +# +# SPDX-License-Identifier: GPL-2.0+ +# +# Entry-type module for an SPL binary with an embedded microcode pointer +# + +import struct + +import command +from entry import Entry +from blob import Entry_blob +from u_boot_with_ucode_ptr import Entry_u_boot_with_ucode_ptr +import tools + +class Entry_u_boot_spl_with_ucode_ptr(Entry_u_boot_with_ucode_ptr): + """U-Boot SPL with embedded microcode pointer + + See Entry_u_boot_ucode for full details of the entries involved in this + process. + """ + def __init__(self, image, etype, node): + Entry_blob.__init__(self, image, etype, node) + self.elf_fname = 'spl/u-boot-spl' + + def GetDefaultFilename(self): + return 'spl/u-boot-spl.bin'
tools/binman/etype/x86_start16_spl.py new file +17 -0
@@ -0,0 +1,17 @@ +# Copyright (c) 2016 Google, Inc +# Written by Simon Glass <[email protected]> +# +# SPDX-License-Identifier: GPL-2.0+ +# +# Entry-type module for the 16-bit x86 start-up code for U-Boot SPL +# + +from entry import Entry +from blob import Entry_blob + +class Entry_x86_start16_spl(Entry_blob): + def __init__(self, image, etype, node): + Entry_blob.__init__(self, image, etype, node) + + def GetDefaultFilename(self): + return 'spl/u-boot-x86-16bit-spl.bin'
tools/binman/func_test.py +71 -0
78 lines not on this page · raw message
tools/binman/test/37_x86_no_ucode.dts new file +20 -0
@@ -0,0 +1,20 @@ +/dts-v1/; + +/ { + #address-cells = <1>; + #size-cells = <1>; + + binman { + sort-by-pos; + end-at-4gb; + size = <0x200>; + u-boot-with-ucode-ptr { + }; + + u-boot-dtb-with-ucode { + }; + + u-boot-ucode { + }; + }; +};
tools/binman/test/38_x86_ucode_missing_node.dts new file +26 -0
@@ -0,0 +1,26 @@ +/dts-v1/; + +/ { + #address-cells = <1>; + #size-cells = <1>; + + binman { + sort-by-pos; + end-at-4gb; + size = <0x200>; + u-boot-with-ucode-ptr { + }; + + u-boot-ucode { + }; + }; + + microcode { + update at 0 { + data = <0x12345678 0x12345679>; + }; + update at 1 { + data = <0xabcd0000 0x78235609>; + }; + }; +};
tools/binman/test/39_x86_ucode_missing_node2.dts new file +23 -0
@@ -0,0 +1,23 @@ +/dts-v1/; + +/ { + #address-cells = <1>; + #size-cells = <1>; + + binman { + sort-by-pos; + end-at-4gb; + size = <0x200>; + u-boot-with-ucode-ptr { + }; + }; + + microcode { + update at 0 { + data = <0x12345678 0x12345679>; + }; + update at 1 { + data = <0xabcd0000 0x78235609>; + }; + }; +};
tools/binman/test/40_x86_ucode_not_in_image.dts new file +28 -0
@@ -0,0 +1,28 @@ +/dts-v1/; + +/ { + #address-cells = <1>; + #size-cells = <1>; + + binman { + sort-by-pos; + size = <0x200>; + u-boot-with-ucode-ptr { + }; + + u-boot-dtb-with-ucode { + }; + + u-boot-ucode { + }; + }; + + microcode { + update at 0 { + data = <0x12345678 0x12345679>; + }; + update at 1 { + data = <0xabcd0000 0x78235609>; + }; + }; +};
tools/binman/test/41_unknown_pos_size.dts new file +11 -0
@@ -0,0 +1,11 @@ +/dts-v1/; + +/ { + #address-cells = <1>; + #size-cells = <1>; + + binman { + _testing { + }; + }; +};
tools/binman/test/u_boot_no_ucode_ptr new file binary +0 -0
zpFw;En;;05iM_7#<+2d5v9R2MkJ<U%oo}nTIXF5 at Bod@0NhyLgc%qheYX at xY_d2~ zpbVua@rie&6fxF02bhC1OPs;=i*XP1$+Hc>51hV9kJT?hJ(n9X3>XFs1BL;^fMLKe zU>GnA7zPXjhJk-z0Q*;tkz&+O8uWhlJbWr0zYHsC1(-IehePl*#DA<*J^uKq2We> zj4WGJg<af^CRX{nY>SdDb~a)^k?3D_Wz%IXd$B&(ry!KRXa|vSqt1m_?06)iR_OU8 zT4A^A2a>P)v#fDuhJp8Cx5S>ApQ*-t5W&D4m^1gKRF3!4c|L2=dAsaDUTGS at 9=oZN zrZL1<80e*?&UyRVV2vCIG~TA=ewpZ&4eYjfH}1ubyTF+3XR))wJ}tVRwr4fwh8=I} z at qDp8do$uXBd$)<SgrCAe1MC@kC)<YW3|P8-9L+IBF7Cw=>(xO84NJ_C$;LPaVgT TQ=i-H%b?z at X6`RW>3;L6WVxU
literal 0
HcmV?d00001
tools/binman/test/u_boot_no_ucode_ptr.c new file +15 -0
@@ -0,0 +1,15 @@ +/* +* Copyright (c) 2016 Google, Inc +* +* SPDX-License-Identifier: GPL-2.0+ +* +* Simple program to create a bad _dt_ucode_base_size symbol to create an +* error when it is used. This is used by binman tests. +* +* Build with: +* cc -march=i386 -m32 -o u_boot_no_ucode_ptr -T u_boot_ucode_ptr.lds \ +-nostdlib u_boot_no_ucode_ptr.c +*/ + +static unsigned long not__dt_ucode_base_size[2] + __attribute__((section(".ucode"))) = {1, 2};
Signature · 1 line
2.8.0.rc3.226.g39d4020
PATCH v4 6/11 binman: Add support for building x86 images with FSP/CMC
In reply to Simon GlassAdd support for two more from the inexhaustible supply of x86 binary blob types.
---
Changes in v4:
- Add new patch to support building x86 images with FSP/CMC
Changes in v3: None
Changes in v2: None
tools/binman/etype/intel_cmc.py | 17 +++++++++++++++++ tools/binman/etype/intel_fsp.py | 17 +++++++++++++++++ tools/binman/func_test.py | 14 ++++++++++++++ tools/binman/test/42_intel-fsp.dts | 13 +++++++++++++ tools/binman/test/43_intel-cmc.dts | 13 +++++++++++++ 5 files changed, 74 insertions(+) create mode 100644 tools/binman/etype/intel_cmc.py create mode 100644 tools/binman/etype/intel_fsp.py create mode 100644 tools/binman/test/42_intel-fsp.dts create mode 100644 tools/binman/test/43_intel-cmc.dts
tools/binman/etype/intel_cmc.py new file +17 -0
@@ -0,0 +1,17 @@ +# Copyright (c) 2016 Google, Inc +# Written by Simon Glass <[email protected]> +# +# SPDX-License-Identifier: GPL-2.0+ +# +# Entry-type module for Intel Chip Microcode binary blob +# + +from entry import Entry +from blob import Entry_blob + +class Entry_intel_cmc(Entry_blob): + def __init__(self, image, etype, node): + Entry_blob.__init__(self, image, etype, node) + + def GetDefaultFilename(self): + return 'cmc.bin'
tools/binman/etype/intel_fsp.py new file +17 -0
@@ -0,0 +1,17 @@ +# Copyright (c) 2016 Google, Inc +# Written by Simon Glass <[email protected]> +# +# SPDX-License-Identifier: GPL-2.0+ +# +# Entry-type module for Intel Firmware Support Package binary blob +# + +from entry import Entry +from blob import Entry_blob + +class Entry_intel_fsp(Entry_blob): + def __init__(self, image, etype, node): + Entry_blob.__init__(self, image, etype, node) + + def GetDefaultFilename(self): + return 'fsp.bin'
tools/binman/func_test.py +14 -0
@@ -36,6 +36,8 @@ VGA_DATA = 'vga' U_BOOT_DTB_DATA = 'udtb' X86_START16_DATA = 'start16' U_BOOT_NODTB_DATA = 'nodtb with microcode pointer somewhere in here' +FSP_DATA = 'fsp' +CMC_DATA = 'cmc' class TestFunctional(unittest.TestCase): """Functional tests for binman
@@ -70,6 +72,8 @@ class TestFunctional(unittest.TestCase): TestFunctional._MakeInputFile('u-boot.dtb', U_BOOT_DTB_DATA) TestFunctional._MakeInputFile('u-boot-x86-16bit.bin', X86_START16_DATA) TestFunctional._MakeInputFile('u-boot-nodtb.bin', U_BOOT_NODTB_DATA) + TestFunctional._MakeInputFile('fsp.bin', FSP_DATA) + TestFunctional._MakeInputFile('cmc.bin', CMC_DATA) self._output_setup = False # ELF file with a '_dt_ucode_base_size' symbol
@@ -761,3 +765,13 @@ class TestFunctional(unittest.TestCase): self._DoReadFile('41_unknown_pos_size.dts', True) self.assertIn("Image '/binman': Unable to set pos/size for unknown " "entry 'invalid-entry'", str(e.exception)) + + def testPackFsp(self): + """Test that an image with a FSP binary can be created""" + data = self._DoReadFile('42_intel-fsp.dts') + self.assertEqual(FSP_DATA, data[:len(FSP_DATA)]) + + def testPackCmc(self): + """Test that an image with a FSP binary can be created""" + data = self._DoReadFile('43_intel-cmc.dts') + self.assertEqual(CMC_DATA, data[:len(CMC_DATA)])
tools/binman/test/42_intel-fsp.dts new file +13 -0
@@ -0,0 +1,13 @@ +/dts-v1/; + +/ { + #address-cells = <1>; + #size-cells = <1>; + + binman { + size = <16>; + + intel-fsp { + }; + }; +};
tools/binman/test/43_intel-cmc.dts new file +13 -0
@@ -0,0 +1,13 @@ +/dts-v1/; + +/ { + #address-cells = <1>; + #size-cells = <1>; + + binman { + size = <16>; + + intel-cmc { + }; + }; +};
Signature · 1 line
2.8.0.rc3.226.g39d4020
PATCH v4 7/11 binman: Add a build rule for binman
In reply to Simon GlassAdd a standard command definition for binman so that it can be used in makefiles.
---
Changes in v4: None
Changes in v3: None
Changes in v2: None
Makefile | 6 ++++++ 1 file changed, 6 insertions(+)
Makefile +6 -0
@@ -889,6 +889,12 @@ u-boot.ldr: u-boot $(LDR) -T $(CONFIG_CPU) -c $@ $< $(LDR_FLAGS) $(BOARD_SIZE_CHECK) +# binman +# --------------------------------------------------------------------------- +quiet_cmd_binman = BINMAN $@ +cmd_binman = $(srctree)/tools/binman/binman -d u-boot.dtb -O . \ + -I . -I $(srctree)/board/$(BOARDDIR) $< + OBJCOPYFLAGS_u-boot.ldr.hex := -I binary -O ihex OBJCOPYFLAGS_u-boot.ldr.srec := -I binary -O srec
Signature · 1 line
2.8.0.rc3.226.g39d4020
PATCH v4 7/11 binman: Add a build rule for binman
Quoted 4 lines · Simon Glass
Add a standard command definition for binman so that it can be used in makefiles.
Signed-off-by Simon Glass <[email protected]>
Quoted 9 lines
---
Changes in v4: None
Changes in v3: None
Changes in v2: NoneMakefile | 6 ++++++ 1 file changed, 6 insertions(+)
PATCH v4 8/11 binman: Allow configuration options to be used in .dts files
In reply to Simon GlassIt is sometimes useful to be able to reference configuration options in a device tree source file. Add the necessary includes so that this works.
---
Changes in v4: None
Changes in v3: None
Changes in v2: None
scripts/Makefile.lib | 5 +++++ 1 file changed, 5 insertions(+)
scripts/Makefile.lib +5 -0
@@ -168,6 +168,11 @@ ld_flags = $(LDFLAGS) $(ldflags-y) dtc_cpp_flags = -Wp,-MD,$(depfile).pre.tmp -nostdinc \ -I$(srctree)/arch/$(ARCH)/dts \ -I$(srctree)/arch/$(ARCH)/dts/include \ + -Iinclude \ + -I$(srctree)/include \ + -I$(srctree)/arch/$(ARCH)/include \ + -include $(srctree)/include/linux/kconfig.h \ + -D__ASSEMBLY__ \ -undef -D__DTS__ # Finds the multi-part object the current object will be linked into
Signature · 1 line
2.8.0.rc3.226.g39d4020
PATCH v4 8/11 binman: Allow configuration options to be used in .dts files
Hi Simon,
Quoted 18 lines · Simon Glass
It is sometimes useful to be able to reference configuration options in a device tree source file. Add the necessary includes so that this works.
Signed-off-by Simon Glass <[email protected]>---
Changes in v4: None
Changes in v3: None
Changes in v2: Nonescripts/Makefile.lib | 5 +++++ 1 file changed, 5 insertions(+)scripts/Makefile.lib +0
-0
scripts/Makefile.lib ld_flags = $(LDFLAGS) $(ldflags-y) · line 171
Quoted 4 lines
scripts/Makefile.lib +1
-0@@ -168,6 +168,11 @@ ld_flags = $(LDFLAGS) $(ldflags-y) dtc_cpp_flags = -Wp,-MD,$(depfile).pre.tmp -nostdinc \ -I$(srctree)/arch/$(ARCH)/dts \ -I$(srctree)/arch/$(ARCH)/dts/include \ + -Iinclude \
Is this needed? Should it be the same as -I$(srctree)/include?
scripts/Makefile.lib ld_flags = $(LDFLAGS) $(ldflags-y)
Quoted 8 lines
scripts/Makefile.lib +4
-1+ -I$(srctree)/include \ + -I$(srctree)/arch/$(ARCH)/include \ + -include $(srctree)/include/linux/kconfig.h \ + -D__ASSEMBLY__ \ -undef -D__DTS__ # Finds the multi-part object the current object will be linked into --
Regards,
Bin
PATCH v4 8/11 binman: Allow configuration options to be used in .dts files
Hi Bin,
Quoted 16 lines · Bin Meng
Hi Simon,
Quoted 13 lines · Simon Glass
It is sometimes useful to be able to reference configuration options in a device tree source file. Add the necessary includes so that this works.
Signed-off-by Simon Glass <[email protected]>---
Changes in v4: None
Changes in v3: None
Changes in v2: Nonescripts/Makefile.lib | 5 +++++ 1 file changed, 5 insertions(+)
Quoted 11 lines
scripts/Makefile.lib ld_flags = $(LDFLAGS) $(ldflags-y) · line 171
Quoted 9 lines
scripts/Makefile.lib +1
-0@@ -168,6 +168,11 @@ ld_flags = $(LDFLAGS) $(ldflags-y) dtc_cpp_flags = -Wp,-MD,$(depfile).pre.tmp -nostdinc \ -I$(srctree)/arch/$(ARCH)/dts \ -I$(srctree)/arch/$(ARCH)/dts/include \ + -Iinclude \Is this needed? Should it be the same as -I$(srctree)/include?
When build the current directory is the build directory, so 'include' refers to the include directory there.
Quoted 9 lines
scripts/Makefile.lib ld_flags = $(LDFLAGS) $(ldflags-y)
Quoted 9 lines
scripts/Makefile.lib +4
-1+ -I$(srctree)/include \ + -I$(srctree)/arch/$(ARCH)/include \ + -include $(srctree)/include/linux/kconfig.h \ + -D__ASSEMBLY__ \ -undef -D__DTS__ # Finds the multi-part object the current object will be linked into --
Regards,
Simon
PATCH v4 9/11 binman: Automatically include a U-Boot .dtsi file
In reply to Simon GlassFor boards that need U-Boot-specific additions to the device tree, it is a minor annoyance to have to add these each time the tree is synced with upstream.
Add a means to include a file (e.g. u-boot.dtsi) automatically into the .dts file before it is compiled.
The file uses is the first one that exists in this list:
arch/<arch>/dts/<board.dts>-u-boot.dtsi
arch/<arch>/dts/<soc>-u-boot.dtsi
arch/<arch>/dts/<cpu>-u-boot.dtsi
arch/<arch>/dts/<vendor>-u-boot.dtsi
arch/<arch>/dts/u-boot.dtsi
---
Changes in v4:
- Add an option to bring in an soc .dtsi file also
- Fix up rule to #include on "/ {" rather than "/dts-v1/;"
- Rename binman_dtsi variable to u-boot-dtsi
Changes in v3:
- Add a new patch to automatically include a U-Boot .dtsi file
Changes in v2: None
scripts/Makefile.lib | 17 ++++++++++++++++- 1 file changed, 16 insertions(+), 1 deletion(-)
scripts/Makefile.lib +16 -1
@@ -164,6 +164,18 @@ cpp_flags = -Wp,-MD,$(depfile) $(NOSTDINC_FLAGS) $(UBOOTINCLUDE) \ ld_flags = $(LDFLAGS) $(ldflags-y) +dts_dir = $(srctree)/arch/$(ARCH)/dts + +# Try these files in order to find the U-Boot-specific .dtsi include file +u-boot-dtsi_options = $(wildcard $(dts_dir)/$(basename $(notdir $<))-u-boot.dtsi) \ + $(wildcard $(dts_dir)/$(subst $\",,$(CONFIG_SYS_SOC))-u-boot.dtsi) \ + $(wildcard $(dts_dir)/$(subst $\",,$(CONFIG_SYS_CPU))-u-boot.dtsi) \ + $(wildcard $(dts_dir)/$(subst $\",,$(CONFIG_SYS_VENDOR))-u-boot.dtsi) \ + $(wildcard $(dts_dir)/u-boot.dtsi) + +# We use the first match +u-boot-dtsi = $(firstword $(u-boot-dtsi_options)) + # Modified for U-Boot dtc_cpp_flags = -Wp,-MD,$(depfile).pre.tmp -nostdinc \ -I$(srctree)/arch/$(ARCH)/dts \
@@ -293,8 +305,11 @@ $(obj)/%.dtb.S: $(obj)/%.dtb quiet_cmd_dtc = DTC $@ # Modified for U-Boot +# Bring in any U-Boot-specific include after the '/dts-v1/;' header cmd_dtc = mkdir -p $(dir ${dtc-tmp}) ; \ - $(CPP) $(dtc_cpp_flags) -x assembler-with-cpp -o $(dtc-tmp) $< ; \ + cat $< $(if $(u-boot-dtsi),\ + | sed 's%^/ {$$%\#include \"$(u-boot-dtsi)\"\n&%') | \ + $(CPP) $(dtc_cpp_flags) -x assembler-with-cpp -o $(dtc-tmp) - ; \ $(DTC) -O dtb -o $@ -b 0 \ -i $(dir $<) $(DTC_FLAGS) \ -d $(depfile).dtc.tmp $(dtc-tmp) ; \
Signature · 1 line
2.8.0.rc3.226.g39d4020
PATCH v4 10/11 sunxi: Use binman for sunxi boards
In reply to Simon GlassMove sunxi boards to use binman. This involves adding the image definition to the device tree and using it in the Makefile.
---
Changes in v4:
- Remove RFC tag
- Update sunxi rule to depend on u-boot.dtb
- Use binman for all sunxi boards
Changes in v3:
- Use a <dts>-u-boot.dtsi file for the binman changes
Changes in v2: None
Makefile | 6 ++---- arch/arm/dts/sunxi-u-boot.dtsi | 14 ++++++++++++++ 2 files changed, 16 insertions(+), 4 deletions(-) create mode 100644 arch/arm/dts/sunxi-u-boot.dtsi
Makefile +2 -4
@@ -1121,10 +1121,8 @@ u-boot-x86-16bit.bin: u-boot FORCE endif ifneq ($(CONFIG_SUNXI),) -OBJCOPYFLAGS_u-boot-sunxi-with-spl.bin = -I binary -O binary \ - --pad-to=$(CONFIG_SPL_PAD_TO) --gap-fill=0xff -u-boot-sunxi-with-spl.bin: spl/sunxi-spl.bin u-boot.img FORCE - $(call if_changed,pad_cat) +u-boot-sunxi-with-spl.bin: spl/sunxi-spl.bin u-boot.img u-boot.dtb FORCE + $(call if_changed,binman) endif ifneq ($(CONFIG_TEGRA),)
arch/arm/dts/sunxi-u-boot.dtsi new file +14 -0
@@ -0,0 +1,14 @@ +#include <config.h> + +/ { + binman { + filename = "u-boot-sunxi-with-spl.bin"; + pad-byte = <0xff>; + blob { + filename = "spl/sunxi-spl.bin"; + }; + u-boot-img { + pos = <CONFIG_SPL_PAD_TO>; + }; + }; +};
Signature · 1 line
2.8.0.rc3.226.g39d4020
PATCH v4 11/11 x86: Use binman all x86 boards
In reply to Simon GlassChange x86 boards to use binman to produce the ROM. This involves adding the image definition to the device tree and using it in the Makefile. The existing ifdtool features are no-longer needed.
Note that the .dtsi file is common and is used for all x86 boards.
---
Changes in v4:
- Remove RFC tag
- Use binman for all x86 boards
Changes in v3:
- Put the binman definition in u-boot.dtsi
Changes in v2:
- Add automated test coverage
- Put the binman definition in a common file for x86
- Various changes and improvements based on using this tool for a while
Makefile | 45 +++-------------------------------- arch/x86/dts/u-boot.dtsi | 62 ++++++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 65 insertions(+), 42 deletions(-) create mode 100644 arch/x86/dts/u-boot.dtsi
Makefile +3 -42
@@ -1060,50 +1060,11 @@ endif # x86 uses a large ROM. We fill it with 0xff, put the 16-bit stuff (including # reset vector) at the top, Intel ME descriptor at the bottom, and U-Boot in -# the middle. +# the middle. This is handled by binman based on an image description in the +# board's device tree. ifneq ($(CONFIG_X86_RESET_VECTOR),) rom: u-boot.rom FORCE -IFDTOOL=$(objtree)/tools/ifdtool -IFDTOOL_FLAGS = -f 0:$(objtree)/u-boot.dtb -IFDTOOL_FLAGS += -m 0x$(shell $(NM) u-boot |grep _dt_ucode_base_size |cut -d' ' -f1) -IFDTOOL_FLAGS += -U $(CONFIG_SYS_TEXT_BASE):$(objtree)/u-boot-nodtb.bin -IFDTOOL_FLAGS += -w $(CONFIG_SYS_X86_START16):$(objtree)/u-boot-x86-16bit.bin -IFDTOOL_FLAGS += -C - -ifneq ($(CONFIG_HAVE_INTEL_ME),) -IFDTOOL_ME_FLAGS = -D $(srctree)/board/$(BOARDDIR)/descriptor.bin -IFDTOOL_ME_FLAGS += -i ME:$(srctree)/board/$(BOARDDIR)/me.bin -endif - -ifneq ($(CONFIG_HAVE_MRC),) -IFDTOOL_FLAGS += -w $(CONFIG_X86_MRC_ADDR):$(srctree)/board/$(BOARDDIR)/mrc.bin -endif - -ifneq ($(CONFIG_HAVE_FSP),) -IFDTOOL_FLAGS += -w $(CONFIG_FSP_ADDR):$(srctree)/board/$(BOARDDIR)/$(CONFIG_FSP_FILE) -endif - -ifneq ($(CONFIG_HAVE_CMC),) -IFDTOOL_FLAGS += -w $(CONFIG_CMC_ADDR):$(srctree)/board/$(BOARDDIR)/$(CONFIG_CMC_FILE) -endif - -ifneq ($(CONFIG_HAVE_VGA_BIOS),) -IFDTOOL_FLAGS += -w $(CONFIG_VGA_BIOS_ADDR):$(srctree)/board/$(BOARDDIR)/$(CONFIG_VGA_BIOS_FILE) -endif - -ifneq ($(CONFIG_HAVE_REFCODE),) -IFDTOOL_FLAGS += -w $(CONFIG_X86_REFCODE_ADDR):refcode.bin -endif - -quiet_cmd_ifdtool = IFDTOOL $@ -cmd_ifdtool = $(IFDTOOL) -c -r $(CONFIG_ROM_SIZE) u-boot.tmp; -ifneq ($(CONFIG_HAVE_INTEL_ME),) -cmd_ifdtool += $(IFDTOOL) $(IFDTOOL_ME_FLAGS) u-boot.tmp; -endif -cmd_ifdtool += $(IFDTOOL) $(IFDTOOL_FLAGS) u-boot.tmp; -cmd_ifdtool += mv u-boot.tmp $@ - refcode.bin: $(srctree)/board/$(BOARDDIR)/refcode.bin FORCE $(call if_changed,copy)
@@ -1113,7 +1074,7 @@ cmd_ldr = $(LD) $(LDFLAGS_$(@F)) \ u-boot.rom: u-boot-x86-16bit.bin u-boot.bin FORCE \ $(if $(CONFIG_HAVE_REFCODE),refcode.bin) - $(call if_changed,ifdtool) + $(call if_changed,binman) OBJCOPYFLAGS_u-boot-x86-16bit.bin := -O binary -j .start16 -j .resetvec u-boot-x86-16bit.bin: u-boot FORCE
arch/x86/dts/u-boot.dtsi new file +62 -0
62 lines not on this page · raw message
Signature · 1 line
2.8.0.rc3.226.g39d4020
PATCH v4 11/11 x86: Use binman all x86 boards
Hi Bin,
Quoted 21 lines · Simon Glass
Change x86 boards to use binman to produce the ROM. This involves adding the image definition to the device tree and using it in the
Makefile. The existing ifdtool features are no-longer needed.Note that the .dtsi file is common and is used for all x86 boards.
Signed-off-by Simon Glass <[email protected]>---
Changes in v4:
- Remove RFC tag
- Use binman for all x86 boardsChanges in v3:
- Put the binman definition inu-boot.dtsiChanges in v2:
- Add automated test coverage
- Put the binman definition in a common file for x86
- Various changes and improvements based on using this tool for a while
Quoted 4 lines
Makefile | 45 +++-------------------------------- arch/x86/dts/u-boot.dtsi | 62 ++++++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 65 insertions(+), 42 deletions(-) create mode 100644 arch/x86/dts/u-boot.dtsi
What do you think of this patch?
Regards,
Simon
PATCH v4 11/11 x86: Use binman all x86 boards
Hi Simon,
Quoted 24 lines · Simon Glass
Hi Bin,
Quoted 21 lines · Simon Glass
Change x86 boards to use binman to produce the ROM. This involves adding the image definition to the device tree and using it in the
Makefile. The existing ifdtool features are no-longer needed.Note that the .dtsi file is common and is used for all x86 boards.
Signed-off-by Simon Glass <[email protected]>---
Changes in v4:
- Remove RFC tag
- Use binman for all x86 boardsChanges in v3:
- Put the binman definition inu-boot.dtsiChanges in v2:
- Add automated test coverage
- Put the binman definition in a common file for x86
- Various changes and improvements based on using this tool for a while
Quoted 7 lines
Quoted 4 lines
Makefile | 45 +++-------------------------------- arch/x86/dts/u-boot.dtsi | 62 ++++++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 65 insertions(+), 42 deletions(-) create mode 100644 arch/x86/dts/u-boot.dtsiWhat do you think of this patch?
Sorry, I will try to look at this in a day or two.
Regards,
Bin
PATCH v4 11/11 x86: Use binman all x86 boards
Hi Bin,
Quoted 32 lines · Bin Meng
Hi Simon,
Quoted 29 lines · Simon Glass
Hi Bin,
Quoted 25 lines · Simon Glass
Change x86 boards to use binman to produce the ROM. This involves adding the image definition to the device tree and using it in the
Makefile. The existing ifdtool features are no-longer needed.Note that the .dtsi file is common and is used for all x86 boards.
Signed-off-by Simon Glass <[email protected]>---
Changes in v4:
- Remove RFC tag
- Use binman for all x86 boardsChanges in v3:
- Put the binman definition inu-boot.dtsiChanges in v2:
- Add automated test coverage
- Put the binman definition in a common file for x86
- Various changes and improvements based on using this tool for a whileMakefile | 45 +++-------------------------------- arch/x86/dts/u-boot.dtsi | 62 ++++++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 65 insertions(+), 42 deletions(-) create mode 100644 arch/x86/dts/u-boot.dtsi
Quoted 4 lines
Quoted 2 lines
What do you think of this patch?
Sorry, I will try to look at this in a day or two.
Did you get a chance to take a look at this?
Regards,
Simon
PATCH v4 11/11 x86: Use binman all x86 boards
Hi Simon,
Quoted 35 lines · Simon Glass
Hi Bin,
Quoted 32 lines · Bin Meng
Hi Simon,
Quoted 29 lines · Simon Glass
Hi Bin,
Quoted 25 lines · Simon Glass
Change x86 boards to use binman to produce the ROM. This involves adding the image definition to the device tree and using it in the
Makefile. The existing ifdtool features are no-longer needed.Note that the .dtsi file is common and is used for all x86 boards.
Signed-off-by Simon Glass <[email protected]>---
Changes in v4:
- Remove RFC tag
- Use binman for all x86 boardsChanges in v3:
- Put the binman definition inu-boot.dtsiChanges in v2:
- Add automated test coverage
- Put the binman definition in a common file for x86
- Various changes and improvements based on using this tool for a whileMakefile | 45 +++-------------------------------- arch/x86/dts/u-boot.dtsi | 62 ++++++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 65 insertions(+), 42 deletions(-) create mode 100644 arch/x86/dts/u-boot.dtsi
Quoted 7 lines
Quoted 4 lines
Quoted 2 lines
What do you think of this patch?
Sorry, I will try to look at this in a day or two.
Did you get a chance to take a look at this?
Looks the python import error was caused by an incorrect installation of python. I will try to have a look tomorrow.
Regards,
Bin
PATCH v4 11/11 x86: Use binman all x86 boards
Hi Bin,
Quoted 41 lines · Bin Meng
Hi Simon,
Quoted 38 lines · Simon Glass
Hi Bin,
Quoted 35 lines · Bin Meng
Hi Simon,
Quoted 31 lines · Simon Glass
Hi Bin,
Quoted 21 lines · Simon Glass
Change x86 boards to use binman to produce the ROM. This involves adding the image definition to the device tree and using it in the
Makefile. The existing ifdtool features are no-longer needed.Note that the .dtsi file is common and is used for all x86 boards.
Signed-off-by Simon Glass <[email protected]>---
Changes in v4:
- Remove RFC tag
- Use binman for all x86 boardsChanges in v3:
- Put the binman definition inu-boot.dtsiChanges in v2:
- Add automated test coverage
- Put the binman definition in a common file for x86
- Various changes and improvements based on using this tool for a whileQuoted 4 lines
Makefile | 45 +++-------------------------------- arch/x86/dts/u-boot.dtsi | 62 ++++++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 65 insertions(+), 42 deletions(-) create mode 100644 arch/x86/dts/u-boot.dtsiWhat do you think of this patch?
Quoted 7 lines
Quoted 4 lines
Quoted 1 line
Sorry, I will try to look at this in a day or two.
Did you get a chance to take a look at this?
Looks the python import error was caused by an incorrect installation of python. I will try to have a look tomorrow.
OK, that's odd!
- Simon
PATCH v4 11/11 x86: Use binman all x86 boards
Hi Simon,
Quoted 46 lines · Simon Glass
Hi Bin,
Quoted 43 lines · Bin Meng
Hi Simon,
Quoted 40 lines · Simon Glass
Hi Bin,
Quoted 36 lines · Bin Meng
Hi Simon,
Quoted 24 lines · Simon Glass
Hi Bin,
Quoted 21 lines · Simon Glass
Change x86 boards to use binman to produce the ROM. This involves adding the image definition to the device tree and using it in the
Makefile. The existing ifdtool features are no-longer needed.Note that the .dtsi file is common and is used for all x86 boards.
Signed-off-by Simon Glass <[email protected]>---
Changes in v4:
- Remove RFC tag
- Use binman for all x86 boardsChanges in v3:
- Put the binman definition inu-boot.dtsiChanges in v2:
- Add automated test coverage
- Put the binman definition in a common file for x86
- Various changes and improvements based on using this tool for a whileQuoted 7 lines
Quoted 4 lines
Makefile | 45 +++-------------------------------- arch/x86/dts/u-boot.dtsi | 62 ++++++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 65 insertions(+), 42 deletions(-) create mode 100644 arch/x86/dts/u-boot.dtsiWhat do you think of this patch?
Sorry, I will try to look at this in a day or two.
Quoted 7 lines
Quoted 5 lines
Quoted 2 lines
Did you get a chance to take a look at this?
Looks the python import error was caused by an incorrect installation of python. I will try to have a look tomorrow.
OK, that's odd!
I am getting another error with fdtput
fdtput: invalid option -- 'd'
Usage: write a property value to a device tree
fdtput <options> <dt file> <node> <property> [<value>...]
fdtput -c <options> <dt file> [<node>...]The command line arguments are joined together into a single value. <type> s=string, i=int, u=unsigned, x=hex
Optional modifier prefix:
hh or b=byte, h=2 byte, l=4 byte (default)
My fdtput version is 1.4.0. I suspect I will need to update to latest version 1.4.2? This tool version requirement should be documented.
Regards,
Bin
PATCH v4 11/11 x86: Use binman all x86 boards
In reply to Simon GlassHi Simon,
Quoted 116 lines · Simon Glass
Change x86 boards to use binman to produce the ROM. This involves adding the image definition to the device tree and using it in the
Makefile. The existing ifdtool features are no-longer needed.Note that the .dtsi file is common and is used for all x86 boards.
Signed-off-by Simon Glass <[email protected]>---
Changes in v4:
- Remove RFC tag
- Use binman for all x86 boardsChanges in v3:
- Put the binman definition inu-boot.dtsiChanges in v2:
- Add automated test coverage
- Put the binman definition in a common file for x86
- Various changes and improvements based on using this tool for a whileMakefile | 45 +++-------------------------------- arch/x86/dts/u-boot.dtsi | 62 ++++++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 65 insertions(+), 42 deletions(-) create mode 100644 arch/x86/dts/u-boot.dtsiMakefile +3
-42@@ -1060,50 +1060,11 @@ endif # x86 uses a large ROM. We fill it with 0xff, put the 16-bit stuff (including # reset vector) at the top, Intel ME descriptor at the bottom, and U-Boot in -# the middle. +# the middle. This is handled by binman based on an image description in the +# board's device tree. ifneq ($(CONFIG_X86_RESET_VECTOR),) rom: u-boot.rom FORCE -IFDTOOL=$(objtree)/tools/ifdtool -IFDTOOL_FLAGS = -f 0:$(objtree)/u-boot.dtb -IFDTOOL_FLAGS += -m 0x$(shell $(NM) u-boot |grep _dt_ucode_base_size |cut -d' ' -f1) -IFDTOOL_FLAGS += -U $(CONFIG_SYS_TEXT_BASE):$(objtree)/u-boot-nodtb.bin -IFDTOOL_FLAGS += -w $(CONFIG_SYS_X86_START16):$(objtree)/u-boot-x86-16bit.bin -IFDTOOL_FLAGS += -C - -ifneq ($(CONFIG_HAVE_INTEL_ME),) -IFDTOOL_ME_FLAGS = -D $(srctree)/board/$(BOARDDIR)/descriptor.bin -IFDTOOL_ME_FLAGS += -i ME:$(srctree)/board/$(BOARDDIR)/me.bin -endif - -ifneq ($(CONFIG_HAVE_MRC),) -IFDTOOL_FLAGS += -w $(CONFIG_X86_MRC_ADDR):$(srctree)/board/$(BOARDDIR)/mrc.bin -endif - -ifneq ($(CONFIG_HAVE_FSP),) -IFDTOOL_FLAGS += -w $(CONFIG_FSP_ADDR):$(srctree)/board/$(BOARDDIR)/$(CONFIG_FSP_FILE) -endif - -ifneq ($(CONFIG_HAVE_CMC),) -IFDTOOL_FLAGS += -w $(CONFIG_CMC_ADDR):$(srctree)/board/$(BOARDDIR)/$(CONFIG_CMC_FILE) -endif - -ifneq ($(CONFIG_HAVE_VGA_BIOS),) -IFDTOOL_FLAGS += -w $(CONFIG_VGA_BIOS_ADDR):$(srctree)/board/$(BOARDDIR)/$(CONFIG_VGA_BIOS_FILE) -endif - -ifneq ($(CONFIG_HAVE_REFCODE),) -IFDTOOL_FLAGS += -w $(CONFIG_X86_REFCODE_ADDR):refcode.bin -endif - -quiet_cmd_ifdtool = IFDTOOL $@ -cmd_ifdtool = $(IFDTOOL) -c -r $(CONFIG_ROM_SIZE) u-boot.tmp; -ifneq ($(CONFIG_HAVE_INTEL_ME),) -cmd_ifdtool += $(IFDTOOL) $(IFDTOOL_ME_FLAGS) u-boot.tmp; -endif -cmd_ifdtool += $(IFDTOOL) $(IFDTOOL_FLAGS) u-boot.tmp; -cmd_ifdtool += mv u-boot.tmp $@ - refcode.bin: $(srctree)/board/$(BOARDDIR)/refcode.bin FORCE $(call if_changed,copy)@@ -1113,7 +1074,7 @@ cmd_ldr = $(LD) $(LDFLAGS_$(@F)) \ u-boot.rom: u-boot-x86-16bit.bin u-boot.bin FORCE \ $(if $(CONFIG_HAVE_REFCODE),refcode.bin) - $(call if_changed,ifdtool) + $(call if_changed,binman) OBJCOPYFLAGS_u-boot-x86-16bit.bin := -O binary -j .start16 -j .resetvec u-boot-x86-16bit.bin: u-boot FORCEarch/x86/dts/u-boot.dtsi new file +18
-0@@ -0,0 +1,62 @@ +/* + * Copyright (C) 2016 Google, Inc + * Written by Simon Glass <[email protected]> + * + * SPDX-License-Identifier: GPL-2.0+ + */ + +#include <config.h> + +#ifdef CONFIG_ROM_SIZE +/ { + binman { + filename = "u-boot.rom"; + end-at-4gb; + sort-by-pos; + pad-byte = <0xff>; + size = <CONFIG_ROM_SIZE>; +#ifdef CONFIG_HAVE_INTEL_ME
arch/x86/dts/u-boot.dtsi line 28
Quoted 10 lines
arch/x86/dts/u-boot.dtsi new file +10
-0+ intel-descriptor { + }; + intel-me { + }; +#endif + u-boot-with-ucode-ptr { + pos = <CONFIG_SYS_TEXT_BASE>; + }; + u-boot-dtb-with-ucode { + };
This causes build error for QEMU.
BINMAN u-boot.rom
Node '/binman/u-boot-dtb-with-ucode': No /microcode node found in './u-boot-dtb-with-ucode.dtb'
make: *** [u-boot.rom] Error 1
Quoted 24 lines
arch/x86/dts/u-boot.dtsi new file +24
-0+ u-boot-ucode { + align = <16>; + }; +#ifdef CONFIG_HAVE_MRC + intel-mrc { + pos = <CONFIG_X86_MRC_ADDR>; + }; +#endif +#ifdef CONFIG_HAVE_FSP + intel-fsp { + pos = <CONFIG_FSP_ADDR>; + }; +#endif +#ifdef CONFIG_HAVE_CMC + intel-cmc { + pos = <CONFIG_CMC_ADDR>; + }; +#endif +#ifdef CONFIG_HAVE_VGA_BIOS + intel-vga { + pos = <CONFIG_VGA_BIOS_ADDR>; + }; +#endif +#ifdef CONFIG_HAVE_REFCODE
arch/x86/dts/u-boot.dtsi line 62
Quoted 10 lines
arch/x86/dts/u-boot.dtsi new file +10
-0+ intel-refcode { + pos = <CONFIG_X86_REFCODE_ADDR>; + }; +#endif + x86-start16 { + pos = <CONFIG_SYS_X86_START16>; + }; + }; +}; +#endif
Regards,
Bin
PATCH v4 11/11 x86: Use binman all x86 boards
Hi Bin,
Quoted 132 lines · Bin Meng
Hi Simon,
Quoted 116 lines · Simon Glass
Change x86 boards to use binman to produce the ROM. This involves adding the image definition to the device tree and using it in the
Makefile. The existing ifdtool features are no-longer needed.Note that the .dtsi file is common and is used for all x86 boards.
Signed-off-by Simon Glass <[email protected]>---
Changes in v4:
- Remove RFC tag
- Use binman for all x86 boardsChanges in v3:
- Put the binman definition inu-boot.dtsiChanges in v2:
- Add automated test coverage
- Put the binman definition in a common file for x86
- Various changes and improvements based on using this tool for a whileMakefile | 45 +++-------------------------------- arch/x86/dts/u-boot.dtsi | 62 ++++++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 65 insertions(+), 42 deletions(-) create mode 100644 arch/x86/dts/u-boot.dtsiMakefile +3
-42@@ -1060,50 +1060,11 @@ endif # x86 uses a large ROM. We fill it with 0xff, put the 16-bit stuff (including # reset vector) at the top, Intel ME descriptor at the bottom, and U-Boot in -# the middle. +# the middle. This is handled by binman based on an image description in the +# board's device tree. ifneq ($(CONFIG_X86_RESET_VECTOR),) rom: u-boot.rom FORCE -IFDTOOL=$(objtree)/tools/ifdtool -IFDTOOL_FLAGS = -f 0:$(objtree)/u-boot.dtb -IFDTOOL_FLAGS += -m 0x$(shell $(NM) u-boot |grep _dt_ucode_base_size |cut -d' ' -f1) -IFDTOOL_FLAGS += -U $(CONFIG_SYS_TEXT_BASE):$(objtree)/u-boot-nodtb.bin -IFDTOOL_FLAGS += -w $(CONFIG_SYS_X86_START16):$(objtree)/u-boot-x86-16bit.bin -IFDTOOL_FLAGS += -C - -ifneq ($(CONFIG_HAVE_INTEL_ME),) -IFDTOOL_ME_FLAGS = -D $(srctree)/board/$(BOARDDIR)/descriptor.bin -IFDTOOL_ME_FLAGS += -i ME:$(srctree)/board/$(BOARDDIR)/me.bin -endif - -ifneq ($(CONFIG_HAVE_MRC),) -IFDTOOL_FLAGS += -w $(CONFIG_X86_MRC_ADDR):$(srctree)/board/$(BOARDDIR)/mrc.bin -endif - -ifneq ($(CONFIG_HAVE_FSP),) -IFDTOOL_FLAGS += -w $(CONFIG_FSP_ADDR):$(srctree)/board/$(BOARDDIR)/$(CONFIG_FSP_FILE) -endif - -ifneq ($(CONFIG_HAVE_CMC),) -IFDTOOL_FLAGS += -w $(CONFIG_CMC_ADDR):$(srctree)/board/$(BOARDDIR)/$(CONFIG_CMC_FILE) -endif - -ifneq ($(CONFIG_HAVE_VGA_BIOS),) -IFDTOOL_FLAGS += -w $(CONFIG_VGA_BIOS_ADDR):$(srctree)/board/$(BOARDDIR)/$(CONFIG_VGA_BIOS_FILE) -endif - -ifneq ($(CONFIG_HAVE_REFCODE),) -IFDTOOL_FLAGS += -w $(CONFIG_X86_REFCODE_ADDR):refcode.bin -endif - -quiet_cmd_ifdtool = IFDTOOL $@ -cmd_ifdtool = $(IFDTOOL) -c -r $(CONFIG_ROM_SIZE) u-boot.tmp; -ifneq ($(CONFIG_HAVE_INTEL_ME),) -cmd_ifdtool += $(IFDTOOL) $(IFDTOOL_ME_FLAGS) u-boot.tmp; -endif -cmd_ifdtool += $(IFDTOOL) $(IFDTOOL_FLAGS) u-boot.tmp; -cmd_ifdtool += mv u-boot.tmp $@ - refcode.bin: $(srctree)/board/$(BOARDDIR)/refcode.bin FORCE $(call if_changed,copy)@@ -1113,7 +1074,7 @@ cmd_ldr = $(LD) $(LDFLAGS_$(@F)) \ u-boot.rom: u-boot-x86-16bit.bin u-boot.bin FORCE \ $(if $(CONFIG_HAVE_REFCODE),refcode.bin) - $(call if_changed,ifdtool) + $(call if_changed,binman) OBJCOPYFLAGS_u-boot-x86-16bit.bin := -O binary -j .start16 -j .resetvec u-boot-x86-16bit.bin: u-boot FORCEarch/x86/dts/u-boot.dtsi new file +18
-0@@ -0,0 +1,62 @@ +/* + * Copyright (C) 2016 Google, Inc + * Written by Simon Glass <[email protected]> + * + * SPDX-License-Identifier: GPL-2.0+ + */ + +#include <config.h> + +#ifdef CONFIG_ROM_SIZE +/ { + binman { + filename = "u-boot.rom"; + end-at-4gb; + sort-by-pos; + pad-byte = <0xff>; + size = <CONFIG_ROM_SIZE>; +#ifdef CONFIG_HAVE_INTEL_MEarch/x86/dts/u-boot.dtsi line 28
Quoted 10 lines
arch/x86/dts/u-boot.dtsi new file +10
-0+ intel-descriptor { + }; + intel-me { + }; +#endif + u-boot-with-ucode-ptr { + pos = <CONFIG_SYS_TEXT_BASE>; + }; + u-boot-dtb-with-ucode { + };This causes build error for QEMU.
Quoted 4 lines
BINMAN u-boot.rom
Node '/binman/u-boot-dtb-with-ucode': No /microcode node found in './u-boot-dtb-with-ucode.dtb'
make: *** [u-boot.rom] Error 1
OK, I've fixed that. It's because that board has no microcode, so I've made it optional.
Regards,
Simon
v4 cover binman: A tool for creating firmware images
In reply to Simon GlassHi Simon
That sounds somewhat similar to the new OpenEmbedded Image Creator tool called WIC (e.g. see slide 27ff here?https://www.yoctoproject.org/sites /default/files/yocto_devday_advanced_class_berlin_1.pdf).
Cheers
Marcel
Quoted 277 lines · Simon Glass
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, so sunxi and x86 boards
are switched over to use it, as examples.The series is available at u-boot-dm/binman-working
Future work and missing features are documented in the README.
Changes in v4:
- Add an option to bring in an soc .dtsi file also
- Add new patch to support building x86 images with FSP/CMC
- Fix incorrect comments at the top of intel_*.py
- Fix up rule to #include on "/ {" rather than "/dts-v1/;"
- Remove RFC tag
- Renamebinman_dtsivariable to u-boot-dtsi
- Update sunxi rule to depend on u-boot.dtb
- Use binman for all sunxi boards
- Use binman for all x86 boardsChanges in v3:
- Add a new patch to automatically include a U-Boot .dtsi file
- Put the binman definition inu-boot.dtsi
- Use a <dts>-u-boot.dtsi file for the binman changesChanges in v2:
- Add automated test coverage
- Add test for code coverage
- Fix the -b option
- Put the binman definition in a common file for x86
- Various changes and improvements based on using this tool for a while
- drop the unused__len__()methodSimon Glass (11):
? 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 support for building x86 ROMs with SPL ? binman: Add support for building x86 images with FSP/CMC ? binman: Add a build rule for binman
? binman: Allow configuration options to be used in .dts files ? binman: Automatically include a U-Boot .dtsi file ? sunxi: Use binman for sunxi boards
? x86: Use binman all x86 boards?Makefile???????????????????????????????????????????|??57 +- ?arch/arm/dts/sunxi-u-boot.dtsi?????????????????????|??14 + ?arch/x86/dts/u-boot.dtsi???????????????????????????|??62 ++ ?scripts/Makefile.lib???????????????????????????????|??22 +- ?tools/binman/.gitignore????????????????????????????|???1 + ?tools/binman/README????????????????????????????????| 491 +++++++++++++ ?tools/binman/binman????????????????????????????????|???1 + ?tools/binman/binman.py?????????????????????????????| 116 +++ ?tools/binman/cmdline.py????????????????????????????|??53 ++ ?tools/binman/control.py????????????????????????????| 118 ++++ ?tools/binman/entry_test.py?????????????????????????|??27 + ?tools/binman/etype/_testing.py?????????????????????|??26 + ?tools/binman/etype/blob.py?????????????????????????|??37 + ?tools/binman/etype/entry.py????????????????????????| 190 +++++ ?tools/binman/etype/intel_cmc.py????????????????????|??17 + ?tools/binman/etype/intel_descriptor.py?????????????|??55 ++ ?tools/binman/etype/intel_fsp.py????????????????????|??17 + ?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????????|??72 ++ ?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_spl_bss_pad.py???????????|??26 + ?tools/binman/etype/u_boot_spl_with_ucode_ptr.py????|??28 + ?tools/binman/etype/u_boot_ucode.py?????????????????|??77 ++ ?tools/binman/etype/u_boot_with_ucode_ptr.py????????|??73 ++ ?tools/binman/etype/x86_start16.py??????????????????|??17 + ?tools/binman/etype/x86_start16_spl.py??????????????|??17 + ?tools/binman/fdt_test.py???????????????????????????|??48 ++ ?tools/binman/func_test.py??????????????????????????| 777 +++++++++++++++++++++ ?tools/binman/image.py??????????????????????????????| 229 ++++++ ?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/37_x86_no_ucode.dts??????????????|??20 + ?tools/binman/test/38_x86_ucode_missing_node.dts????|??26 + ?tools/binman/test/39_x86_ucode_missing_node2.dts???|??23 + ?tools/binman/test/40_x86_ucode_not_in_image.dts????|??28 + ?tools/binman/test/41_unknown_pos_size.dts??????????|??11 + ?tools/binman/test/42_intel-fsp.dts?????????????????|??13 + ?tools/binman/test/43_intel-cmc.dts?????????????????|??13 + ?tools/binman/test/u_boot_no_ucode_ptr??????????????| Bin 0 -> 4182bytes ?tools/binman/test/u_boot_no_ucode_ptr.c????????????|??15 + ?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 + ?83 files changed, 3500 insertions(+), 47 deletions(-) ?create mode 100644
arch/arm/dts/sunxi-u-boot.dtsi?create mode 100644arch/x86/dts/u-boot.dtsi
?create mode 100644tools/binman/.gitignore
?create mode 100644tools/binman/README
?create mode 120000tools/binman/binman
?create mode 100755tools/binman/binman.py
?create mode 100644tools/binman/cmdline.py
?create mode 100644tools/binman/control.py
?create mode 100644tools/binman/entry_test.py
?create mode 100644tools/binman/etype/_testing.py?create mode 100644tools/binman/etype/blob.py
?create mode 100644tools/binman/etype/entry.py
?create mode 100644tools/binman/etype/intel_cmc.py?create mode 100644tools/binman/etype/intel_descriptor.py?create mode 100644tools/binman/etype/intel_fsp.py?create mode 100644tools/binman/etype/intel_me.py?create mode 100644tools/binman/etype/intel_mrc.py?create mode 100644tools/binman/etype/intel_vga.py?create mode 100644tools/binman/etype/u_boot.py
?create mode 100644tools/binman/etype/u_boot_dtb.py?create mode 100644tools/binman/etype/u_boot_dtb_with_ucode.py?create mode 100644tools/binman/etype/u_boot_img.py?create mode 100644tools/binman/etype/u_boot_nodtb.py?create mode 100644tools/binman/etype/u_boot_spl.py?create mode 100644tools/binman/etype/u_boot_spl_bss_pad.py?create mode 100644tools/binman/etype/u_boot_spl_with_ucode_ptr.py?create mode 100644tools/binman/etype/u_boot_ucode.py?create mode 100644tools/binman/etype/u_boot_with_ucode_ptr.py?create mode 100644tools/binman/etype/x86_start16.py?create mode 100644tools/binman/etype/x86_start16_spl.py?create mode 100644tools/binman/fdt_test.py
?create mode 100644tools/binman/func_test.py
?create mode 100644tools/binman/image.py
?create mode 100644tools/binman/test/01_invalid.dts?create mode 100644tools/binman/test/02_missing_node.dts?create mode 100644tools/binman/test/03_empty.dts?create mode 100644tools/binman/test/04_invalid_entry.dts?create mode 100644tools/binman/test/05_simple.dts?create mode 100644tools/binman/test/06_dual_image.dts?create mode 100644tools/binman/test/07_bad_align.dts?create mode 100644tools/binman/test/08_pack.dts
?create mode 100644tools/binman/test/09_pack_extra.dts?create mode 100644tools/binman/test/10_pack_align_power2.dts?create mode 100644tools/binman/test/11_pack_align_size_power2.dts?create mode 100644tools/binman/test/12_pack_inv_align.dts?create mode 100644tools/binman/test/13_pack_inv_size_align.dts?create mode 100644tools/binman/test/14_pack_overlap.dts?create mode 100644tools/binman/test/15_pack_overflow.dts?create mode 100644tools/binman/test/16_pack_image_overflow.dts?create mode 100644tools/binman/test/17_pack_image_size.dts?create mode 100644tools/binman/test/18_pack_image_align.dts?create mode 100644tools/binman/test/19_pack_inv_image_align.dts?create mode 100644tools/binman/test/20_pack_inv_image_align_power2.dts?create mode 100644tools/binman/test/21_image_pad.dts?create mode 100644tools/binman/test/22_image_name.dts?create mode 100644tools/binman/test/23_blob.dts
?create mode 100644tools/binman/test/24_sorted.dts?create mode 100644tools/binman/test/25_pack_zero_size.dts?create mode 100644tools/binman/test/26_pack_u_boot_dtb.dts?create mode 100644tools/binman/test/27_pack_4gb_no_size.dts?create mode 100644tools/binman/test/28_pack_4gb_outside.dts?create mode 100644tools/binman/test/29_x86-rom.dts?create mode 100644tools/binman/test/30_x86-rom-me-no-desc.dts?create mode 100644tools/binman/test/31_x86-rom-me.dts?create mode 100644tools/binman/test/32_intel-vga.dts?create mode 100644tools/binman/test/33_x86-start16.dts?create mode 100644tools/binman/test/34_x86_ucode.dts?create mode 100644tools/binman/test/35_x86_single_ucode.dts?create mode 100644tools/binman/test/36_u_boot_img.dts?create mode 100644tools/binman/test/37_x86_no_ucode.dts?create mode 100644tools/binman/test/38_x86_ucode_missing_node.dts?create mode 100644tools/binman/test/39_x86_ucode_missing_node2.dts?create mode 100644tools/binman/test/40_x86_ucode_not_in_image.dts?create mode 100644tools/binman/test/41_unknown_pos_size.dts?create mode 100644tools/binman/test/42_intel-fsp.dts?create mode 100644tools/binman/test/43_intel-cmc.dts?create mode 100755tools/binman/test/u_boot_no_ucode_ptr?create mode 100644tools/binman/test/u_boot_no_ucode_ptr.c?create mode 100755tools/binman/test/u_boot_ucode_ptr?create mode 100644tools/binman/test/u_boot_ucode_ptr.c?create mode 100644tools/binman/test/u_boot_ucode_ptr.lds
v4 cover binman: A tool for creating firmware images
Hi Marcel,
Quoted 5 lines · Marcel Ziswiler
Hi Simon
That sounds somewhat similar to the new OpenEmbedded Image Creator tool called WIC (e.g. see slide 27ff here https://www.yoctoproject.org/sites
/default/files/yocto_devday_advanced_class_berlin_1.pdf).
Thanks for the link. Yes there are definitely similarities, one operations on firmware images and one operates on disk images. I suppose that makes sense since with U-Boot we are mostly interested in generating a valid firmware binary, whereas OpenEmbedded is concerned with creating a disk image with various partitions, etc.
I suspect that the U-Boot image may end up providing one of the inputs into OpenEmbedded. However all the examples (on p35) refer to EFI so I'm not sure if that is too low-level for WIC?
Regards,
Simon
[...]