binman: A tool for creating firmware images
Subsystems (5)
v6 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 v6:
- Deal with optional microcode in SPL
- Drop unwanted root-node properties from tegra20-u-boot.dtsi
- Use __import__() when importlib is not available
Changes in v5:
- Add a Makefile 'warning' line for debugging
- Add a dependency on u-boot.dtb for buildman
- Add a new for optional microcode
- Add a new patch to drop microcode features from ifdtool
- Add a new tegra patch to use an automatically included .dtsi file
- Add documentation for the 'optional-ucode' property
- Add documentation for this feature
- Add instructions on how to generate html code coverage
- Add missing 'descriptor.bin' file
- Allow microcode to be optional
- Allow the compiled device tree to be returned from _DoReadFileDtb()
- Change the Makefile variable from binman_... to u_boot_...
- Print 'binman' before all errors
- Put the code to calculate dtb total length in a function
- Remove commented-out PYTHONPATH code which is not needed now
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
- Remove RFC tag
- 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 (13):
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
tegra: Use a U-Boot-specific .dtsi file
sunxi: Use binman for sunxi boards
x86: Use binman all x86 boards
binman: Drop microcode features from ifdtool
Makefile | 57 +- arch/arm/dts/sunxi-u-boot.dtsi | 14 + arch/arm/dts/tegra124-nyan-big-u-boot.dtsi | 15 + arch/arm/dts/tegra124-nyan-big.dts | 2 - arch/arm/dts/tegra20-u-boot.dtsi | 8 + arch/arm/dts/tegra20.dtsi | 2 - arch/x86/dts/emulation-u-boot.dtsi | 18 + arch/x86/dts/u-boot.dtsi | 62 ++ scripts/Makefile.lib | 25 +- tools/binman/.gitignore | 1 + tools/binman/README | 541 ++++++++++++++ tools/binman/binman | 1 + tools/binman/binman.py | 114 +++ 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 | 200 +++++ 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 | 78 ++ 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 | 84 +++ tools/binman/etype/u_boot_with_ucode_ptr.py | 87 +++ 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 | 822 +++++++++++++++++++++ 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/44_x86_optional_ucode.dts | 30 + tools/binman/test/descriptor.bin | Bin 0 -> 4096 bytes 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 + tools/ifdtool.c | 254 +------ 91 files changed, 3709 insertions(+), 300 deletions(-) create mode 100644 arch/arm/dts/sunxi-u-boot.dtsi create mode 100644 arch/arm/dts/tegra124-nyan-big-u-boot.dtsi create mode 100644 arch/arm/dts/tegra20-u-boot.dtsi create mode 100644 arch/x86/dts/emulation-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 100644 tools/binman/test/44_x86_optional_ucode.dts create mode 100644 tools/binman/test/descriptor.bin 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 v6 1/13 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 v6:
- Use __import__() when importlib is not available
Changes in v5:
- Add instructions on how to generate html code coverage
- Print 'binman' before all errors
- Remove commented-out PYTHONPATH code which is not needed now
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 | 114 ++++++++++ tools/binman/cmdline.py | 53 +++++ tools/binman/control.py | 118 +++++++++++ tools/binman/etype/entry.py | 200 ++++++++++++++++++ tools/binman/fdt_test.py | 48 +++++ tools/binman/image.py | 229 +++++++++++++++++++++ 9 files changed, 1255 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 +114 -0
114 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 +200 -0
200 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 v6 1/13 binman: Introduce binman, a tool for building binary images
Quoted 37 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 v6:
- Use__import__()when importlib is not availableChanges in v5:
- Add instructions on how to generate html code coverage
- Print 'binman' before all errors
- Remove commented-out PYTHONPATH code which is not needed nowChanges 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 | 114 ++++++++++ tools/binman/cmdline.py | 53 +++++ tools/binman/control.py | 118 +++++++++++ tools/binman/etype/entry.py | 200 ++++++++++++++++++ tools/binman/fdt_test.py | 48 +++++ tools/binman/image.py | 229 +++++++++++++++++++++ 9 files changed, 1255 insertions(+) create mode 100644 tools/binman/.gitignore
Quoted 9 lines
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
PATCH v6 1/13 binman: Introduce binman, a tool for building binary images
Quoted 48 lines · Bin Meng
Quoted 37 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 v6:
- Use__import__()when importlib is not availableChanges in v5:
- Add instructions on how to generate html code coverage
- Print 'binman' before all errors
- Remove commented-out PYTHONPATH code which is not needed nowChanges 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 | 114 ++++++++++ tools/binman/cmdline.py | 53 +++++ tools/binman/control.py | 118 +++++++++++ tools/binman/etype/entry.py | 200 ++++++++++++++++++ tools/binman/fdt_test.py | 48 +++++ tools/binman/image.py | 229 +++++++++++++++++++++ 9 files changed, 1255 insertions(+) create mode 100644 tools/binman/.gitignoreQuoted 9 lines
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
Quoted 1 line
Tested-by Bin Meng <[email protected]>
Applied to u-boot-dm and now in mainline.
PATCH v6 1/13 binman: Introduce binman, a tool for building binary images
In reply to Simon GlassHi,
Quoted 13 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]>---
[snip]
Quoted 16 lines
tools/binman/README new file +6
-0+ +To do +----- + +Some ideas: +- Fill out the device tree to include the final position and size ofeach
+??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
Quoted 8 lines
binary
+??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
Any plans to add support for Python 3 as it is done for patman?
Best regards,
J?rg Krause
PATCH v6 1/13 binman: Introduce binman, a tool for building binary images
Hi,
Quoted 37 lines · J?rg Krause
Hi,
Quoted 13 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]>---
[snip]
Quoted 18 lines
tools/binman/README new file +6
-0+ +To do +----- + +Some ideas: +- Fill out the device tree to include the final position and size ofeach
+ 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 anotherbinary
+ which is then placed in the image)
Quoted 8 lines
Quoted 6 lines
+- 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 usedin the
+Makefile, this will be automatic
+- Implement align-endAny plans to add support for Python 3 as it is done for patman?
Yes that would be good...
Regards,
Simon
PATCH v6 2/13 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 v6: None
Changes in v5: None
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 v6 2/13 binman: Add basic entry types for U-Boot
Quoted 73 lines · Simon Glass
Add entries to support some standard U-Boot binaries, such as u-boot.bin, u-boot.dtb, etc. Also add some tests for these.
Signed-off-by Simon Glass <[email protected]>---
Changes in v6: None
Changes in v5: None
Changes in v4: None
Changes in v3: None
Changes in v2: Nonetools/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
Quoted 9 lines
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
PATCH v6 2/13 binman: Add basic entry types for U-Boot
Quoted 84 lines · Bin Meng
Quoted 73 lines · Simon Glass
Add entries to support some standard U-Boot binaries, such as u-boot.bin, u-boot.dtb, etc. Also add some tests for these.
Signed-off-by Simon Glass <[email protected]>---
Changes in v6: None
Changes in v5: None
Changes in v4: None
Changes in v3: None
Changes in v2: Nonetools/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.dtsQuoted 9 lines
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
Quoted 1 line
Tested-by Bin Meng <[email protected]>
Applied to u-boot-dm and now in mainline.
PATCH v6 3/13 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 v6: None
Changes in v5:
- Add documentation for the 'optional-ucode' property
- Add missing 'descriptor.bin' file
- Allow microcode to be optional
- Allow the compiled device tree to be returned from _DoReadFileDtb()
- Put the code to calculate dtb total length in a function
Changes in v4:
- Fix incorrect comments at the top of intel_*.py
Changes in v3: None
Changes in v2: None
tools/binman/README | 11 ++ 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 | 76 ++++++++++++ tools/binman/etype/u_boot_ucode.py | 84 +++++++++++++ tools/binman/etype/u_boot_with_ucode_ptr.py | 87 ++++++++++++++ tools/binman/etype/x86_start16.py | 17 +++ tools/binman/func_test.py | 179 +++++++++++++++++++++++++++- 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/descriptor.bin | Bin 0 -> 4096 bytes 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 +++ 23 files changed, 760 insertions(+), 3 deletions(-) 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 100644 tools/binman/test/descriptor.bin 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/README +11 -0
@@ -369,6 +369,17 @@ Examples of the above options can be found in the tests. See the tools/binman/test directory. +Special properties +------------------ + +Some entries support special properties, documented here: + +u-boot-with-ucode-ptr: + optional-ucode: boolean property to make microcode optional. If the + u-boot.bin image does not include microcode, no error will + be generated. + + Order of image creation -----------------------
tools/binman/etype/intel_descriptor.py new file +55 -0
55 lines not on this page · raw message
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 +76 -0
76 lines not on this page · raw message
tools/binman/etype/u_boot_ucode.py new file +84 -0
84 lines not on this page · raw message
tools/binman/etype/u_boot_with_ucode_ptr.py new file +87 -0
87 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 +176 -3
231 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/descriptor.bin new file binary +0 -0
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 v6 3/13 binman: Add support for building x86 ROMs
Quoted 61 lines · Simon Glass
The 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.
Signed-off-by Simon Glass <[email protected]>---
Changes in v6: None
Changes in v5:
- Add documentation for the 'optional-ucode' property
- Add missing 'descriptor.bin' file
- Allow microcode to be optional
- Allow the compiled device tree to be returned from_DoReadFileDtb()
- Put the code to calculate dtb total length in a functionChanges in v4:
- Fix incorrect comments at the top of intel_*.pyChanges in v3: None
Changes in v2: Nonetools/binman/README | 11 ++ 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 | 76 ++++++++++++ tools/binman/etype/u_boot_ucode.py | 84 +++++++++++++ tools/binman/etype/u_boot_with_ucode_ptr.py | 87 ++++++++++++++ tools/binman/etype/x86_start16.py | 17 +++ tools/binman/func_test.py | 179 +++++++++++++++++++++++++++- 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/descriptor.bin | Bin 0 -> 4096 bytes 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 +++ 23 files changed, 760 insertions(+), 3 deletions(-) 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
Quoted 9 lines
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/descriptor.bin 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
PATCH v6 3/13 binman: Add support for building x86 ROMs
Quoted 72 lines · Bin Meng
Quoted 61 lines · Simon Glass
The 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.
Signed-off-by Simon Glass <[email protected]>---
Changes in v6: None
Changes in v5:
- Add documentation for the 'optional-ucode' property
- Add missing 'descriptor.bin' file
- Allow microcode to be optional
- Allow the compiled device tree to be returned from_DoReadFileDtb()
- Put the code to calculate dtb total length in a functionChanges in v4:
- Fix incorrect comments at the top of intel_*.pyChanges in v3: None
Changes in v2: Nonetools/binman/README | 11 ++ 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 | 76 ++++++++++++ tools/binman/etype/u_boot_ucode.py | 84 +++++++++++++ tools/binman/etype/u_boot_with_ucode_ptr.py | 87 ++++++++++++++ tools/binman/etype/x86_start16.py | 17 +++ tools/binman/func_test.py | 179 +++++++++++++++++++++++++++- 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/descriptor.bin | Bin 0 -> 4096 bytes 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 +++ 23 files changed, 760 insertions(+), 3 deletions(-) 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.dtsQuoted 9 lines
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/descriptor.bin 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
Quoted 1 line
Tested-by Bin Meng <[email protected]>
Applied to u-boot-dm and now in mainline.
PATCH v6 4/13 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 v6: None
Changes in v5: None
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
@@ -713,3 +713,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 v6 4/13 binman: Add support for u-boot.img as an input binary
Quoted 11 lines · Simon Glass
Add an entry type for u-boot.img (a legacy U-Boot image) and a simple test.
Signed-off-by Simon Glass <[email protected]>---
Changes in v6: None
Changes in v5: None
Changes in v4: None
Changes in v3: None
Changes in v2: None
Quoted 7 lines
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
PATCH v6 4/13 binman: Add support for u-boot.img as an input binary
Quoted 20 lines · Bin Meng
Quoted 11 lines · Simon Glass
Add an entry type for u-boot.img (a legacy U-Boot image) and a simple test.
Signed-off-by Simon Glass <[email protected]>---
Changes in v6: None
Changes in v5: None
Changes in v4: None
Changes in v3: None
Changes in v2: NoneQuoted 7 lines
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
Quoted 1 line
Tested-by Bin Meng <[email protected]>
Applied to u-boot-dm and now in mainline.
PATCH v6 5/13 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 v6:
- Deal with optional microcode in SPL
Changes in v5:
- Add a new for optional microcode
Changes in v4: None
Changes in v3: None
Changes in v2: None
tools/binman/etype/u_boot_dtb_with_ucode.py | 4 +- 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 | 88 +++++++++++++++++++++++ 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/44_x86_optional_ucode.dts | 30 ++++++++ tools/binman/test/u_boot_no_ucode_ptr | Bin 0 -> 4182 bytes tools/binman/test/u_boot_no_ucode_ptr.c | 15 ++++ 13 files changed, 315 insertions(+), 1 deletion(-) 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 100644 tools/binman/test/44_x86_optional_ucode.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_dtb_with_ucode.py +3 -1
@@ -31,7 +31,9 @@ class Entry_u_boot_dtb_with_ucode(Entry_blob): Entry_blob.ObtainContents(self) # If the image does not need microcode, there is nothing to do - ucode_dest_entry = self.image.FindEntryType('u-boot-with-ucode-ptr') + ucode_dest_entry = self.image.FindEntryType('u-boot-spl-with-ucode-ptr') + if not ucode_dest_entry or not ucode_dest_entry.target_pos: + ucode_dest_entry = self.image.FindEntryType('u-boot-with-ucode-ptr') if not ucode_dest_entry or not ucode_dest_entry.target_pos: return True
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 +88 -0
95 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/44_x86_optional_ucode.dts new file +30 -0
@@ -0,0 +1,30 @@ +/dts-v1/; + +/ { + #address-cells = <1>; + #size-cells = <1>; + + binman { + sort-by-pos; + end-at-4gb; + size = <0x200>; + u-boot-with-ucode-ptr { + optional-ucode; + }; + + u-boot-dtb-with-ucode { + }; + + u-boot-ucode { + }; + }; + + microcode { + update at 0 { + data = <0x12345678 0x12345679>; + }; + update at 1 { + data = <0xabcd0000 0x78235609>; + }; + }; +};
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 v6 5/13 binman: Add support for building x86 ROMs with SPL
Quoted 33 lines · Simon Glass
When 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%.
Signed-off-by Simon Glass <[email protected]>---
Changes in v6:
- Deal with optional microcode in SPLChanges in v5:
- Add a new for optional microcodeChanges in v4: None
Changes in v3: None
Changes in v2: Nonetools/binman/etype/u_boot_dtb_with_ucode.py | 4 +- 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 | 88 +++++++++++++++++++++++ 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/44_x86_optional_ucode.dts | 30 ++++++++ tools/binman/test/u_boot_no_ucode_ptr | Bin 0 -> 4182 bytes tools/binman/test/u_boot_no_ucode_ptr.c | 15 ++++ 13 files changed, 315 insertions(+), 1 deletion(-) 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
Quoted 9 lines
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/44_x86_optional_ucode.dts create mode 100755 tools/binman/test/u_boot_no_ucode_ptr create mode 100644 tools/binman/test/u_boot_no_ucode_ptr.c
PATCH v6 5/13 binman: Add support for building x86 ROMs with SPL
Quoted 44 lines · Bin Meng
Quoted 33 lines · Simon Glass
When 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%.
Signed-off-by Simon Glass <[email protected]>---
Changes in v6:
- Deal with optional microcode in SPLChanges in v5:
- Add a new for optional microcodeChanges in v4: None
Changes in v3: None
Changes in v2: Nonetools/binman/etype/u_boot_dtb_with_ucode.py | 4 +- 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 | 88 +++++++++++++++++++++++ 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/44_x86_optional_ucode.dts | 30 ++++++++ tools/binman/test/u_boot_no_ucode_ptr | Bin 0 -> 4182 bytes tools/binman/test/u_boot_no_ucode_ptr.c | 15 ++++ 13 files changed, 315 insertions(+), 1 deletion(-) 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.pyQuoted 9 lines
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/44_x86_optional_ucode.dts create mode 100755 tools/binman/test/u_boot_no_ucode_ptr create mode 100644 tools/binman/test/u_boot_no_ucode_ptr.c
Quoted 1 line
Tested-by Bin Meng <[email protected]>
Applied to u-boot-dm and now in mainline.
PATCH v6 6/13 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 v6: None
Changes in v5: None
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
@@ -806,3 +810,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 v6 6/13 binman: Add support for building x86 images with FSP/CMC
Quoted 14 lines · Simon Glass
Add support for two more from the inexhaustible supply of x86 binary blob types.
Signed-off-by Simon Glass <[email protected]>---
Changes in v6: None
Changes in v5: None
Changes in v4:
- Add new patch to support building x86 images with FSP/CMCChanges in v3: None
Changes in v2: None
Quoted 11 lines
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
PATCH v6 6/13 binman: Add support for building x86 images with FSP/CMC
Quoted 27 lines · Bin Meng
Quoted 14 lines · Simon Glass
Add support for two more from the inexhaustible supply of x86 binary blob types.
Signed-off-by Simon Glass <[email protected]>---
Changes in v6: None
Changes in v5: None
Changes in v4:
- Add new patch to support building x86 images with FSP/CMCChanges in v3: None
Changes in v2: NoneQuoted 11 lines
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
Quoted 1 line
Tested-by Bin Meng <[email protected]>
Applied to u-boot-dm and now in mainline.
PATCH v6 7/13 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 v6: None
Changes in v5: None
Changes in v4: None
Changes in v3: None
Changes in v2: None
Makefile | 6 ++++++ 1 file changed, 6 insertions(+)
Makefile +6 -0
@@ -903,6 +903,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 v6 7/13 binman: Add a build rule for binman
Quoted 6 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 v6: None
Changes in v5: None
Changes in v4: None
Changes in v3: None
Changes in v2: NoneMakefile | 6 ++++++ 1 file changed, 6 insertions(+)
PATCH v6 7/13 binman: Add a build rule for binman
Quoted 13 lines · Bin Meng
Quoted 12 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]>---
Changes in v6: None
Changes in v5: None
Changes in v4: None
Changes in v3: None
Changes in v2: None
Quoted 6 lines
Quoted 3 lines
Makefile | 6 ++++++ 1 file changed, 6 insertions(+)Reviewed-by Bin Meng <[email protected]>Tested-by Bin Meng <[email protected]>
Applied to u-boot-dm and now in mainline.
PATCH v6 8/13 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 v6: None
Changes in v5: None
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 v6 8/13 binman: Allow configuration options to be used in .dts files
Quoted 6 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]>---
Quoted 9 lines
Changes in v6: None
Changes in v5: None
Changes in v4: None
Changes in v3: None
Changes in v2: Nonescripts/Makefile.lib | 5 +++++ 1 file changed, 5 insertions(+)
PATCH v6 8/13 binman: Allow configuration options to be used in .dts files
Quoted 13 lines · Bin Meng
Quoted 12 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 v6: None
Changes in v5: None
Changes in v4: None
Changes in v3: None
Changes in v2: None
Quoted 6 lines
Quoted 3 lines
scripts/Makefile.lib | 5 +++++ 1 file changed, 5 insertions(+)Reviewed-by Bin Meng <[email protected]>Tested-by Bin Meng <[email protected]>
Applied to u-boot-dm and now in mainline.
PATCH v6 9/13 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 v6: None
Changes in v5:
- Add a Makefile 'warning' line for debugging
- Add documentation for this feature
- Change the Makefile variable from binman_... to u_boot_...
Changes in v4:
- Add an option to bring in an soc .dtsi file also
Changes in v3:
- Add a new patch to automatically include a U-Boot .dtsi file
Changes in v2: None
scripts/Makefile.lib | 20 +++++++++++++++++++- tools/binman/README | 39 +++++++++++++++++++++++++++++++++++++++ 2 files changed, 58 insertions(+), 1 deletion(-)
scripts/Makefile.lib +19 -1
@@ -164,6 +164,21 @@ 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) + +# Uncomment for debugging +# $(warning u_boot_dtsi_options: $(u_boot_dtsi_options)) + +# 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 +308,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) ; \
tools/binman/README +39 -0
@@ -422,6 +422,45 @@ stage the position and size of entries should not be adjusted. step. +Automatic .dtsi inclusion +------------------------- + +It is sometimes inconvenient to add a 'binman' node to the .dts file for each +board. This can be done by using #include to bring in a common file. Another +approach supported by the U-Boot build system is to automatically include +a common header. You can then put the binman node (and anything else that is +specific to U-Boot, such as u-boot,dm-pre-reloc properies) in that header +file. + +Binman will search for the following files in arch/<arch>/dts: + + <dts>-u-boot.dtsi where <dts> is the base name of the .dts file + <CONFIG_SYS_SOC>-u-boot.dtsi + <CONFIG_SYS_CPU>-u-boot.dtsi + <CONFIG_SYS_VENDOR>-u-boot.dtsi + u-boot.dtsi + +U-Boot will only use the first one that it finds. If you need to include a +more general file you can do that from the more specific file using #include. +If you are having trouble figuring out what is going on, you can uncomment +the 'warning' line in scripts/Makefile.lib to see what it has found: + + # Uncomment for debugging + # $(warning binman_dtsi_options: $(binman_dtsi_options)) + + +Code coverage +------------- + +Binman is a critical tool and is designed to be very testable. Entry +implementations target 100% test coverage. Run 'binman -T' to check this. + +To enable Python test coverage on Debian-type distributions (e.g. Ubuntu): + + $ sudo apt-get install python-pip python-pytest + $ sudo pip install coverage + + Advanced Features / Technical docs ----------------------------------
Signature · 1 line
2.8.0.rc3.226.g39d4020
PATCH v6 9/13 binman: Automatically include a U-Boot .dtsi file
Quoted 28 lines · Simon Glass
For 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.dtsiSigned-off-by Simon Glass <[email protected]>Suggested-by Tom Rini <[email protected]>---
Changes in v6: None
Changes in v5:
- Add aMakefile'warning' line for debugging
- Add documentation for this feature
- Change theMakefilevariable frombinman_... tou_boot_...Changes in v4:
- Add an option to bring in an soc .dtsi file also
Quoted 9 lines
Changes in v3:
- Add a new patch to automatically include a U-Boot .dtsi fileChanges in v2: None
scripts/Makefile.lib | 20 +++++++++++++++++++- tools/binman/README | 39 +++++++++++++++++++++++++++++++++++++++ 2 files changed, 58 insertions(+), 1 deletion(-)
PATCH v6 9/13 binman: Automatically include a U-Boot .dtsi file
Quoted 34 lines · Bin Meng
Quoted 33 lines · Simon Glass
For 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.dtsiSigned-off-by Simon Glass <[email protected]>Suggested-by Tom Rini <[email protected]>---
Changes in v6: None
Changes in v5:
- Add aMakefile'warning' line for debugging
- Add documentation for this feature
- Change theMakefilevariable frombinman_... tou_boot_...Changes in v4:
- Add an option to bring in an soc .dtsi file alsoChanges in v3:
- Add a new patch to automatically include a U-Boot .dtsi fileChanges in v2: None
Quoted 7 lines
Quoted 4 lines
scripts/Makefile.lib | 20 +++++++++++++++++++- tools/binman/README | 39 +++++++++++++++++++++++++++++++++++++++ 2 files changed, 58 insertions(+), 1 deletion(-)Reviewed-by Bin Meng <[email protected]>Tested-by Bin Meng <[email protected]>
Applied to u-boot-dm and now in mainline.
PATCH v6 10/13 tegra: Use a U-Boot-specific .dtsi file
In reply to Simon GlassWith the new device-tree rules it is possible to put device-tree changes needed by U-Boot into their own file. As an example of this approach, move Tegra over to use it.
---
Changes in v6:
- Drop unwanted root-node properties from tegra20-u-boot.dtsi
Changes in v5:
- Add a new tegra patch to use an automatically included .dtsi file
Changes in v4: None
Changes in v3: None
Changes in v2: None
arch/arm/dts/tegra124-nyan-big-u-boot.dtsi | 15 +++++++++++++++ arch/arm/dts/tegra124-nyan-big.dts | 2 -- arch/arm/dts/tegra20-u-boot.dtsi | 8 ++++++++ arch/arm/dts/tegra20.dtsi | 2 -- 4 files changed, 23 insertions(+), 4 deletions(-) create mode 100644 arch/arm/dts/tegra124-nyan-big-u-boot.dtsi create mode 100644 arch/arm/dts/tegra20-u-boot.dtsi
arch/arm/dts/tegra124-nyan-big-u-boot.dtsi new file +15 -0
@@ -0,0 +1,15 @@ +/* + * Copyright (C) 2016 Google, Inc + * Written by Simon Glass <[email protected]> + * + * SPDX-License-Identifier: GPL-2.0+ + */ + +/ { + host1x at 50000000 { + u-boot,dm-pre-reloc; + dc at 54200000 { + u-boot,dm-pre-reloc; + }; + }; +};
arch/arm/dts/tegra124-nyan-big.dts +0 -2
@@ -27,9 +27,7 @@ }; host1x at 50000000 { - u-boot,dm-pre-reloc; dc at 54200000 { - u-boot,dm-pre-reloc; display-timings { timing at 0 { clock-frequency = <69500000>;
arch/arm/dts/tegra20-u-boot.dtsi new file +8 -0
@@ -0,0 +1,8 @@ +/ { + host1x at 50000000 { + u-boot,dm-pre-reloc; + dc at 54200000 { + u-boot,dm-pre-reloc; + }; + }; +};
arch/arm/dts/tegra20.dtsi +0 -2
@@ -10,7 +10,6 @@ interrupt-parent = <&lic>; host1x at 50000000 { - u-boot,dm-pre-reloc; compatible = "nvidia,tegra20-host1x", "simple-bus"; reg = <0x50000000 0x00024000>; interrupts = <GIC_SPI 65 IRQ_TYPE_LEVEL_HIGH>, /* syncpt */
@@ -78,7 +77,6 @@ }; dc at 54200000 { - u-boot,dm-pre-reloc; compatible = "nvidia,tegra20-dc"; reg = <0x54200000 0x00040000>; interrupts = <GIC_SPI 73 IRQ_TYPE_LEVEL_HIGH>;
Signature · 1 line
2.8.0.rc3.226.g39d4020
PATCH v6 10/13 tegra: Use a U-Boot-specific .dtsi file
Quoted 17 lines · Simon Glass
With the new device-tree rules it is possible to put device-tree changes needed by U-Boot into their own file. As an example of this approach, move Tegra over to use it.
Signed-off-by Simon Glass <[email protected]>---
Changes in v6:
- Drop unwanted root-node properties fromtegra20-u-boot.dtsiChanges in v5:
- Add a new tegra patch to use an automatically included .dtsi fileChanges in v4: None
Changes in v3: None
Changes in v2: None
Quoted 7 lines
arch/arm/dts/tegra124-nyan-big-u-boot.dtsi | 15 +++++++++++++++ arch/arm/dts/tegra124-nyan-big.dts | 2 -- arch/arm/dts/tegra20-u-boot.dtsi | 8 ++++++++ arch/arm/dts/tegra20.dtsi | 2 -- 4 files changed, 23 insertions(+), 4 deletions(-) create mode 100644 arch/arm/dts/tegra124-nyan-big-u-boot.dtsi create mode 100644 arch/arm/dts/tegra20-u-boot.dtsi
Applied to u-boot-dm and now in mainline.
PATCH v6 11/13 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 v6: None
Changes in v5:
- Add a dependency on u-boot.dtb for buildman
Changes in v4:
- Remove RFC tag
- 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 ++++++++++++++ scripts/Makefile.lib | 4 ++-- 3 files changed, 18 insertions(+), 6 deletions(-) create mode 100644 arch/arm/dts/sunxi-u-boot.dtsi
Makefile +2 -4
@@ -1114,10 +1114,8 @@ u-boot-x86-16bit.bin: u-boot FORCE endif ifneq ($(CONFIG_ARCH_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>; + }; + }; +};
scripts/Makefile.lib +2 -2
@@ -310,8 +310,8 @@ 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}) ; \ - cat $< $(if $(u-boot-dtsi),\ - | sed 's%^/ {$$%\#include \"$(u-boot-dtsi)\"\n&%') | \ + 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) \
Signature · 1 line
2.8.0.rc3.226.g39d4020
PATCH v6 11/13 sunxi: Use binman for sunxi boards
Quoted 4 lines · Simon Glass
Move sunxi boards to use binman. This involves adding the image definition to the device tree and using it in the
Makefile.Signed-off-by Simon Glass <[email protected]>
Signature · 8 lines
Tom -------------- next part -------------- A non-text attachment was scrubbed... Name: signature.asc Type: application/pgp-signature Size: 819 bytes Desc: Digital signature URL: <http://lists.denx.de/pipermail/u-boot/attachments/20161218/3e5799da/attachment.sig>
PATCH v6 11/13 sunxi: Use binman for sunxi boards
Quoted 11 lines · Tom Rini
Quoted 4 lines · Simon Glass
Move sunxi boards to use binman. This involves adding the image definition to the device tree and using it in the
Makefile.Signed-off-by Simon Glass <[email protected]>Reviewed-by Tom Rini <[email protected]>--
Tom
Applied to u-boot-dm and now in mainline.
PATCH v6 11/13 sunxi: Use binman for sunxi boards
Hello Simon,
Quoted 6 lines · On Fri, 23 Dec 2016 01:39:06 -0700 Simon Glass <[email protected]> wrote:
Quoted 5 lines · Tom Rini
Quoted 3 lines · Simon Glass
Move sunxi boards to use binman. This involves adding the image definition to the device tree and using it in the
Makefile.
Quoted 8 lines
Quoted 6 lines
Quoted 1 line
Signed-off-by Simon Glass <[email protected]>Reviewed-by Tom Rini <[email protected]>--
TomApplied to u-boot-dm and now in mainline.
Shouldn't all the config for sunxi board definesCONFIG_SPL_OF_PLATDATA=y now so libfdt.so will be built ?
Signature · 1 line
Emmanuel Vadot <[email protected]> <[email protected]>
PATCH v6 11/13 sunxi: Use binman for sunxi boards
Quoted 16 lines · On Wed, 28 Dec 2016 11:30:10 +0100 Emmanuel Vadot <[email protected]> wrote:
Hello Simon,
Quoted 10 lines · On Fri, 23 Dec 2016 01:39:06 -0700 Simon Glass <[email protected]> wrote:
Quoted 9 lines · Tom Rini
Quoted 4 lines · Simon Glass
Move sunxi boards to use binman. This involves adding the image definition to the device tree and using it in the
Makefile.Signed-off-by Simon Glass <[email protected]>Reviewed-by Tom Rini <[email protected]>
Quoted 8 lines
Quoted 4 lines
Quoted 2 lines
--
TomApplied to u-boot-dm and now in mainline.
Shouldn't all the config for sunxi board defines
CONFIG_SPL_OF_PLATDATA=ynow so libfdt.so will be built ?
Sorry, I meant the python module.
Signature · 1 line
Emmanuel Vadot <[email protected]> <[email protected]>
PATCH v6 11/13 sunxi: Use binman for sunxi boards
Hi Emmanuel,
Quoted 22 lines · Emmanuel Vadot
Quoted 19 lines · On Wed, 28 Dec 2016 11:30:10 +0100 Emmanuel Vadot <[email protected]> wrote:
Hello Simon,
Quoted 13 lines · On Fri, 23 Dec 2016 01:39:06 -0700 Simon Glass <[email protected]> wrote:
Quoted 11 lines · Tom Rini
Quoted 4 lines · Simon Glass
Move sunxi boards to use binman. This involves adding the image definition to the device tree and using it in the
Makefile.Signed-off-by Simon Glass <[email protected]>Reviewed-by Tom Rini <[email protected]>--
Tom
Quoted 7 lines
Quoted 5 lines
Quoted 1 line
Applied to u-boot-dm and now in mainline.
Shouldn't all the config for sunxi board defines
CONFIG_SPL_OF_PLATDATA=ynow so libfdt.so will be built ?Sorry, I meant the python module.
Well for now an easier solution is to build sandbox_spl once. My plan is to upstream the Python bindings to libfdt, but it's slow going. There should be no major consequence to not having the module. It is just fractionally slower.
Regards,
Simon
PATCH v6 11/13 sunxi: Use binman for sunxi boards
Quoted 33 lines · On Wed, 11 Jan 2017 22:08:03 -0700 Simon Glass <[email protected]> wrote:
Hi Emmanuel,
Quoted 22 lines · Emmanuel Vadot
Quoted 19 lines · On Wed, 28 Dec 2016 11:30:10 +0100 Emmanuel Vadot <[email protected]> wrote:
Hello Simon,
Quoted 13 lines · On Fri, 23 Dec 2016 01:39:06 -0700 Simon Glass <[email protected]> wrote:
Quoted 11 lines · Tom Rini
Quoted 4 lines · Simon Glass
Move sunxi boards to use binman. This involves adding the image definition to the device tree and using it in the
Makefile.Signed-off-by Simon Glass <[email protected]>Reviewed-by Tom Rini <[email protected]>--
TomQuoted 7 lines
Quoted 5 lines
Quoted 1 line
Applied to u-boot-dm and now in mainline.
Shouldn't all the config for sunxi board defines
CONFIG_SPL_OF_PLATDATA=ynow so libfdt.so will be built ?Sorry, I meant the python module.
Quoted 7 lines
Well for now an easier solution is to build
sandbox_splonce. My plan is to upstream the Python bindings to libfdt, but it's slow going. There should be no major consequence to not having the module. It is just fractionally slower.Regards,
Simon
On FreeBSD we don't have fdtget as part as our base system and it's
not available in the ports (well now it is).
For now we simply don't depend on CONFIG_SPL_OF_PLATDATA to compile
the swig bindings as it's faster to compile/use it than using fdtget.
Maybe this patch
https://people.freebsd.org/~manu/uboot/2017.01/0001-build-Always-build-the-libfdt-python-module.patch
make sense to be upstream in u-boot ?
It doesn't take that long to compile the bindings and there is still
the check on the presence of the swig binary.
Thanks,
Signature · 1 line
Emmanuel Vadot <[email protected]> <[email protected]>
PATCH v6 11/13 sunxi: Use binman for sunxi boards
Quoted 44 lines · Emmanuel Vadot
Quoted 33 lines · On Wed, 11 Jan 2017 22:08:03 -0700 Simon Glass <[email protected]> wrote:
Hi Emmanuel,
Quoted 22 lines · Emmanuel Vadot
Quoted 19 lines · On Wed, 28 Dec 2016 11:30:10 +0100 Emmanuel Vadot <[email protected]> wrote:
Hello Simon,
Quoted 13 lines · On Fri, 23 Dec 2016 01:39:06 -0700 Simon Glass <[email protected]> wrote:
Quoted 11 lines · Tom Rini
Quoted 4 lines · Simon Glass
Move sunxi boards to use binman. This involves adding the image definition to the device tree and using it in the
Makefile.Signed-off-by Simon Glass <[email protected]>Reviewed-by Tom Rini <[email protected]>--
TomQuoted 7 lines
Quoted 5 lines
Quoted 1 line
Applied to u-boot-dm and now in mainline.
Shouldn't all the config for sunxi board defines
CONFIG_SPL_OF_PLATDATA=ynow so libfdt.so will be built ?Sorry, I meant the python module.
Quoted 7 lines
Well for now an easier solution is to build
sandbox_splonce. My plan is to upstream the Python bindings to libfdt, but it's slow going. There should be no major consequence to not having the module. It is just fractionally slower.Regards,
Simon
Quoted 9 lines
On FreeBSD we don't have fdtget as part as our base system and it's
not available in the ports (well now it is).
For now we simply don't depend onCONFIG_SPL_OF_PLATDATAto compile
the swig bindings as it's faster to compile/use it than using fdtget.
Maybe this patch
https://people.freebsd.org/~manu/uboot/2017.01/0001-build-Always-build-the-libfdt-python-module.patch
make sense to be upstream in u-boot ?
It doesn't take that long to compile the bindings and there is still
the check on the presence of the swig binary.
Yes, I think the FreeBSD patch there should be upstream, it seems reasonable enough for portability.
Signature · 8 lines
Tom -------------- next part -------------- A non-text attachment was scrubbed... Name: signature.asc Type: application/pgp-signature Size: 819 bytes Desc: Digital signature URL: <http://lists.denx.de/pipermail/u-boot/attachments/20170114/1d275f4b/attachment.sig>
PATCH v6 12/13 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 u-boot.dtsi file is common and is used for all x86 boards which use microcode. A separate emulation-u-boot-dtsi is used for the others.
---
Changes in v6: None
Changes in v5: None
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/emulation-u-boot.dtsi | 18 +++++++++++ arch/x86/dts/u-boot.dtsi | 62 ++++++++++++++++++++++++++++++++++++++ 3 files changed, 83 insertions(+), 42 deletions(-) create mode 100644 arch/x86/dts/emulation-u-boot.dtsi create mode 100644 arch/x86/dts/u-boot.dtsi
Makefile +3 -42
@@ -1053,50 +1053,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)
@@ -1106,7 +1067,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/emulation-u-boot.dtsi new file +18 -0
@@ -0,0 +1,18 @@ +/* + * Copyright (C) 2016 Google, Inc + * Written by Simon Glass <[email protected]> + * + * SPDX-License-Identifier: GPL-2.0+ + */ + +#include <u-boot.dtsi> + +#ifdef CONFIG_ROM_SIZE +/ { + binman { + u-boot-with-ucode-ptr { + optional-ucode; + }; + }; +}; +#endif
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 v6 12/13 x86: Use binman all x86 boards
Quoted 24 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
u-boot.dtsifile is common and is used for all x86 boards which use microcode. A separate emulation-u-boot-dtsi is used for the others.Signed-off-by Simon Glass <[email protected]>---
Changes in v6: None
Changes in v5: None
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
Makefile | 45 ++------------------------- arch/x86/dts/emulation-u-boot.dtsi | 18 +++++++++++ arch/x86/dts/u-boot.dtsi | 62 ++++++++++++++++++++++++++++++++++++++ 3 files changed, 83 insertions(+), 42 deletions(-) create mode 100644 arch/x86/dts/emulation-u-boot.dtsi create mode 100644 arch/x86/dts/u-boot.dtsi
PATCH v6 12/13 x86: Use binman all x86 boards
Quoted 33 lines · Bin Meng
Quoted 24 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
u-boot.dtsifile is common and is used for all x86 boards which use microcode. A separate emulation-u-boot-dtsi is used for the others.Signed-off-by Simon Glass <[email protected]>---
Changes in v6: None
Changes in v5: None
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
Makefile | 45 ++------------------------- arch/x86/dts/emulation-u-boot.dtsi | 18 +++++++++++ arch/x86/dts/u-boot.dtsi | 62 ++++++++++++++++++++++++++++++++++++++ 3 files changed, 83 insertions(+), 42 deletions(-) create mode 100644 arch/x86/dts/emulation-u-boot.dtsi create mode 100644 arch/x86/dts/u-boot.dtsi
Quoted 2 lines
Reviewed-by Bin Meng <[email protected]>Tested-by Bin Meng <[email protected]>
Applied to u-boot-dm and now in mainline.
PATCH v6 13/13 binman: Drop microcode features from ifdtool
In reply to Simon GlassNow that binman supports creating images with microcode, drop the code from ifdtool.
---
Changes in v6: None
Changes in v5:
- Add a new patch to drop microcode features from ifdtool
Changes in v4: None
Changes in v3: None
Changes in v2: None
tools/ifdtool.c | 254 ++------------------------------------------------------ 1 file changed, 5 insertions(+), 249 deletions(-)
tools/ifdtool.c +5 -249
@@ -33,16 +33,9 @@#define FLREG_BASE (reg) ((reg & 0x00000fff) << 12);#define FLREG_LIMIT (reg) (((reg & 0x0fff0000) >> 4) | 0xfff); -enum input_file_type_t { - IF_normal, - IF_fdt, - IF_uboot, -}; -struct input_file {char *fname;unsigned int addr; -enum input_file_type_t type; };/**
@@ -760,219 +753,6 @@ static int write_data(char *image, int size, unsigned int addr,return write_size; } -static int scan_ucode (const void *blob,char *ucode_base,int *countp, -const char **datap,int *data_sizep) -{ -const char *data =NULL ; -int node, count; -int data_size; -char *ucode; - -for (node =0 , count =0 , ucode = ucode_base; node >=0 ; count++) { - node =fdt_node_offset_by_compatible (blob, node, -"intel,microcode" ); -if (node <0 ) -break ; - - data =fdt_getprop (blob, node,"data" , &data_size); -if (!data) { -debug ("Missing microcode data in FDT '%s': %s\n" , -fdt_get_name (blob, node,NULL ), -fdt_strerror (data_size)); -return -ENOENT ; - } - -if (ucode_base) -memcpy (ucode, data, data_size); - ucode += data_size; - } - -if (countp) - *countp = count; -if (datap) - *datap = data; -if (data_sizep) - *data_sizep = data_size; - -return ucode - ucode_base; -} - -static int remove_ucode (char *blob) -{ -int node, count; -int ret; - -/* Keep going until we find no more microcode to remove */ -do { -for (node =0 , count =0 ; node >=0 ;) { -int ret; - - node =fdt_node_offset_by_compatible (blob, node, -"intel,microcode" ); -if (node <0 ) -break ; - - ret =fdt_delprop (blob, node,"data" ); - -/* -* -FDT_ERR_NOTFOUND means we already removed the -* data for this one, so we just continue. -* 0 means we did remove it, so offsets may have -* changed and we need to restart our scan. -* Anything else indicates an error we should report. -*/ -if (ret == -FDT_ERR_NOTFOUND ) -continue ; -else if (!ret) - node =0 ; -else -return ret; - } - }while (count); - -/* Pack down to remove excees space */ - ret =fdt_pack (blob); -if (ret) -return ret; - -return fdt_totalsize (blob); -} - -static int write_ucode (char *image,int size,struct input_file *fdt, -int fdt_size,unsigned int ucode_ptr, -int collate_ucode) -{ -const char *data =NULL ; -char *ucode_buf; -const void *blob; -char *ucode_base; -uint32_t *ptr; -int ucode_size; -int data_size; -int offset; -int count; -int ret; - - blob = (void *)image + (uint32_t )(fdt->addr + size); - -debug ("DTB at %lx\n" , (char *)blob - image); - -/* Find out about the micrcode we have */ - ucode_size =scan_ucode (blob,NULL , &count, &data, &data_size); -if (ucode_size <0 ) -return ucode_size; -if (!count) { -debug ("No microcode found in FDT\n" ); -return -ENOENT ; - } - -if (count >1 && !collate_ucode) { -fprintf (stderr, -"Cannot handle multiple microcode blocks - please use -C flag to collate them\n" ); -return -EMLINK ; - } - -/* -* Collect the microcode into a buffer, remove it from the device -* tree and place it immediately above the (now smaller) device tree. -*/ -if (collate_ucode && count >1 ) { - ucode_buf =malloc (ucode_size); -if (!ucode_buf) { -fprintf (stderr, -"Out of memory for microcode (%d bytes)\n" , - ucode_size); -return -ENOMEM ; - } - ret =scan_ucode (blob, ucode_buf,NULL ,NULL ,NULL ); -if (ret <0 ) -return ret; - -/* Remove the microcode from the device tree */ - ret =remove_ucode ((char *)blob); -if (ret <0 ) { -debug ("Could not remove FDT microcode: %s\n" , -fdt_strerror (ret)); -return -EINVAL ; - } -debug ("Collated %d microcode block(s)\n" , count); -debug ("Device tree reduced from %x to %x bytes\n" , - fdt_size, ret); - fdt_size = ret; - -/* -* Place microcode area immediately above the FDT, aligned -* to a 16-byte boundary. -*/ - ucode_base = (char *)(((unsigned long )blob + fdt_size +15 ) & - ~15 ); - - data = ucode_base; - data_size = ucode_size; -memcpy (ucode_base, ucode_buf, ucode_size); -free (ucode_buf); - } - - offset = (uint32_t )(ucode_ptr + size); - ptr = (void *)image + offset; - - ptr[0 ] = (data - image) - size; - ptr[1 ] = data_size; -debug ("Wrote microcode pointer@%x: addr=%x, size=%x\n" , ucode_ptr, - ptr[0 ], ptr[1 ]); - -return (collate_ucode ? data + data_size : (char *)blob + fdt_size) - - image; -} - -/** -* write_uboot() - Write U-Boot, device tree and microcode pointer -* -* This writes U-Boot into a place in the flash, followed by its device tree. -* The microcode pointer is written so that U-Boot can find the microcode in -* the device tree very early in boot. -* -* @image: Pointer to image -* @size: Size of image in bytes -* @uboot: Input file information for u-boot.bin -* @fdt: Input file information for u-boot.dtb -* @ucode_ptr: Address in U-Boot where the microcode pointer should be placed -* @return 0 if OK, -ve on error -*/ -static int write_uboot (char *image,int size,struct input_file *uboot, -struct input_file *fdt,unsigned int ucode_ptr, -int collate_ucode,int *offset_uboot_top, -int *offset_uboot_start) -{ -int uboot_size, fdt_size; -int uboot_top; - - uboot_size =write_data (image, size, uboot->addr, uboot->fname,0 ,0 ); -if (uboot_size <0 ) -return uboot_size; - fdt->addr = uboot->addr + uboot_size; -debug ("U-Boot size %#x, FDT at %#x\n" , uboot_size, fdt->addr); - fdt_size =write_data (image, size, fdt->addr, fdt->fname,0 ,0 ); -if (fdt_size <0 ) -return fdt_size; - - uboot_top = (uint32_t )(fdt->addr + size) + fdt_size; - -if (ucode_ptr) { - uboot_top =write_ucode (image, size, fdt, fdt_size, ucode_ptr, - collate_ucode); -if (uboot_top <0 ) -return uboot_top; - } - -if (offset_uboot_top && offset_uboot_start) { - *offset_uboot_top = uboot_top; - *offset_uboot_start = (uint32_t )(uboot->addr + size); - } - -return 0 ; -} -static void print_version (void ) {printf ("ifdtool v%s -- " ,IFDTOOL_VERSION );
@@ -1034,7 +814,7 @@ int main(int argc, char *argv[])int mode_dump =0 , mode_extract =0 , mode_inject =0 ;int mode_spifreq =0 , mode_em100 =0 , mode_locked =0 ;int mode_unlocked =0 , mode_write =0 , mode_write_descriptor =0 ; -int create =0 , collate_ucode =0 ; +int create =0 ;char *region_type_string =NULL , *inject_fname =NULL ;char *desc_fname =NULL , *addr_str =NULL ;int region_type =-1 , inputfreq =0 ;
@@ -1047,14 +827,12 @@ int main(int argc, char *argv[])char *outfile =NULL ;struct stat buf;int size =0 ; -unsigned int ucode_ptr =0 ;bool have_uboot = false;int bios_fd;char *image;int ret;static struct option long_options[] = { {"create" ,0 ,NULL ,'c' }, - {"collate-microcode" ,0 ,NULL ,'C' }, {"dump" ,0 ,NULL ,'d' }, {"descriptor" ,1 ,NULL ,'D' }, {"em100" ,0 ,NULL ,'e' },
@@ -1062,7 +840,6 @@ int main(int argc, char *argv[]) {"fdt", 1, NULL, 'f'}, {"inject", 1, NULL, 'i'}, {"lock", 0, NULL, 'l'}, - {"microcode", 1, NULL, 'm'}, {"romsize", 1, NULL, 'r'}, {"spifreq", 1, NULL, 's'}, {"unlock", 0, NULL, 'u'},
@@ -1073,15 +850,12 @@ int main(int argc, char *argv[]) {0, 0, 0, 0} }; -while ((opt =getopt_long (argc, argv,"cCdD:ef:hi:lm:r:s:uU:vw:x?" , +while ((opt =getopt_long (argc, argv,"cdD:ef:hi:lr:s:uU:vw:x?" , long_options, &option_index)) !=EOF ) {switch (opt) {case 'c' : create =1 ;break ; -case 'C' : - collate_ucode =1 ; -break ;case 'd' : mode_dump =1 ;break ;
@@ -1119,9 +893,6 @@ int main(int argc, char *argv[])case 'l' : mode_locked =1 ;break ; -case 'm' : - ucode_ptr =strtoul (optarg,NULL ,0 ); -break ;case 'r' : rom_size =strtol (optarg,NULL ,0 );debug ("ROM size %d\n" , rom_size);
@@ -1166,12 +937,6 @@ int main(int argc, char *argv[])exit (EXIT_FAILURE ); } ifile->addr =strtoll (optarg,NULL ,0 ); - ifile->type = opt =='f' ? IF_fdt : - opt =='U' ? IF_uboot : IF_normal; -if (ifile->type == IF_fdt) - fdt = ifile; -else if (ifile->type == IF_uboot) - have_uboot = true; wr_num++; }else { fprintf(stderr,
@@ -1302,18 +1067,9 @@ int main(int argc, char *argv[])for (wr_idx =0 ; wr_idx < wr_num; wr_idx++) { ifile = &input_file[wr_idx]; -if (ifile->type == IF_fdt) { -continue ; - }else if (ifile->type == IF_uboot) { - ret =write_uboot (image, size, ifile, fdt, - ucode_ptr, collate_ucode, - &offset_uboot_top, - &offset_uboot_start); - }else { - ret =write_data (image, size, ifile->addr, - ifile->fname, offset_uboot_top, - offset_uboot_start); - } + ret =write_data (image, size, ifile->addr, + ifile->fname, offset_uboot_top, + offset_uboot_start);if (ret <0 )break ; }
Signature · 1 line
2.8.0.rc3.226.g39d4020
PATCH v6 13/13 binman: Drop microcode features from ifdtool
Quoted 10 lines · Simon Glass
Now that binman supports creating images with microcode, drop the code from ifdtool.
Signed-off-by Simon Glass <[email protected]>---
Changes in v6: None
Changes in v5:
- Add a new patch to drop microcode features from ifdtool
Quoted 7 lines
Changes in v4: None
Changes in v3: None
Changes in v2: Nonetools/ifdtool.c | 254 ++------------------------------------------------------ 1 file changed, 5 insertions(+), 249 deletions(-)
PATCH v6 13/13 binman: Drop microcode features from ifdtool
Quoted 15 lines · Bin Meng
Quoted 14 lines · Simon Glass
Now that binman supports creating images with microcode, drop the code from ifdtool.
Signed-off-by Simon Glass <[email protected]>---
Changes in v6: None
Changes in v5:
- Add a new patch to drop microcode features from ifdtoolChanges in v4: None
Changes in v3: None
Changes in v2: None
Quoted 6 lines
Quoted 3 lines
tools/ifdtool.c | 254 ++------------------------------------------------------ 1 file changed, 5 insertions(+), 249 deletions(-)Reviewed-by Bin Meng <[email protected]>Tested-by Bin Meng <[email protected]>
Applied to u-boot-dm and now in mainline.
v6 cover binman: A tool for creating firmware images
In reply to Simon GlassHi Bin,
Quoted 42 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.
Quoted 8 lines
The series is available at u-boot-dm/binman-working
Future work and missing features are documented in the README.
Changes in v6:
- Deal with optional microcode in SPL
- Drop unwanted root-node properties fromtegra20-u-boot.dtsi
- Use__import__()when importlib is not available
Does this work OK for you now?
[...]
Regards,
Simon