binman: A tool for creating firmware images
Subsystems (4)
v3 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, but apart from a few RFC patches, no attempt is made to switch boards over to use it. There should be enough material to permit review and comments.
The series is available at u-boot-dm/binman-working
Future work and missing features are documented in the README.
Changes in v3:
- Add a new patch to automatically include a U-Boot .dtsi file
- Use a <dts>-u-boot.dtsi file for the binman changes
- Put the binman definition in u-boot.dtsi
Changes in v2:
- Add test for code coverage
- drop the unused __len__() method
- Fix the -b option
- Add automated test coverage
- Various changes and improvements based on using this tool for a while
- Put the binman definition in a common file for x86
Simon Glass (10):
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 a build rule for binman
binman: Allow configuration options to be used in .dts files
binman: Automatically include a U-Boot .dtsi file
RFC: Use binman for a sunxi board
RFC: Use binman for an x86 board
Makefile | 55 +- arch/arm/dts/sun7i-a20-pcduino3-u-boot.dtsi | 14 + arch/x86/dts/u-boot.dtsi | 62 ++ scripts/Makefile.lib | 20 +- tools/binman/.gitignore | 1 + tools/binman/README | 491 +++++++++++++ tools/binman/binman | 1 + tools/binman/binman.py | 116 ++++ tools/binman/cmdline.py | 53 ++ tools/binman/control.py | 118 ++++ tools/binman/entry_test.py | 27 + tools/binman/etype/_testing.py | 26 + tools/binman/etype/blob.py | 37 + tools/binman/etype/entry.py | 190 +++++ tools/binman/etype/intel_descriptor.py | 55 ++ tools/binman/etype/intel_me.py | 17 + tools/binman/etype/intel_mrc.py | 17 + tools/binman/etype/intel_vga.py | 17 + tools/binman/etype/u_boot.py | 17 + tools/binman/etype/u_boot_dtb.py | 17 + tools/binman/etype/u_boot_dtb_with_ucode.py | 72 ++ tools/binman/etype/u_boot_img.py | 17 + tools/binman/etype/u_boot_nodtb.py | 17 + tools/binman/etype/u_boot_spl.py | 17 + tools/binman/etype/u_boot_spl_bss_pad.py | 26 + tools/binman/etype/u_boot_spl_with_ucode_ptr.py | 28 + tools/binman/etype/u_boot_ucode.py | 77 +++ tools/binman/etype/u_boot_with_ucode_ptr.py | 73 ++ tools/binman/etype/x86_start16.py | 17 + tools/binman/etype/x86_start16_spl.py | 17 + tools/binman/fdt_test.py | 48 ++ tools/binman/func_test.py | 763 +++++++++++++++++++++ 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/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 + 79 files changed, 3423 insertions(+), 46 deletions(-) create mode 100644 arch/arm/dts/sun7i-a20-pcduino3-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_descriptor.py create mode 100644 tools/binman/etype/intel_me.py create mode 100644 tools/binman/etype/intel_mrc.py create mode 100644 tools/binman/etype/intel_vga.py create mode 100644 tools/binman/etype/u_boot.py create mode 100644 tools/binman/etype/u_boot_dtb.py create mode 100644 tools/binman/etype/u_boot_dtb_with_ucode.py create mode 100644 tools/binman/etype/u_boot_img.py create mode 100644 tools/binman/etype/u_boot_nodtb.py create mode 100644 tools/binman/etype/u_boot_spl.py create mode 100644 tools/binman/etype/u_boot_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 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 v3 1/10 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 v3: None
Changes in v2:
- Add test for code coverage
- drop the unused __len__() method
- Fix the -b option
tools/binman/.gitignore | 1 + tools/binman/README | 491 ++++++++++++++++++++++++++++++++++++++++++++ tools/binman/binman | 1 + tools/binman/binman.py | 116 +++++++++++ tools/binman/cmdline.py | 53 +++++ tools/binman/control.py | 118 +++++++++++ tools/binman/etype/entry.py | 190 +++++++++++++++++ tools/binman/fdt_test.py | 48 +++++ tools/binman/image.py | 229 +++++++++++++++++++++ 9 files changed, 1247 insertions(+) create mode 100644 tools/binman/.gitignore create mode 100644 tools/binman/README create mode 120000 tools/binman/binman create mode 100755 tools/binman/binman.py create mode 100644 tools/binman/cmdline.py create mode 100644 tools/binman/control.py create mode 100644 tools/binman/etype/entry.py create mode 100644 tools/binman/fdt_test.py create mode 100644 tools/binman/image.py
tools/binman/.gitignore new file +1 -0
@@ -0,0 +1 @@ +*.pyc
tools/binman/README new file +491 -0
491 lines not on this page · raw message
tools/binman/binman new file +1 -0
@@ -0,0 +1 @@ +binman.py
tools/binman/binman.py new file +116 -0
116 lines not on this page · raw message
tools/binman/cmdline.py new file +53 -0
53 lines not on this page · raw message
tools/binman/control.py new file +118 -0
118 lines not on this page · raw message
tools/binman/etype/entry.py new file +190 -0
190 lines not on this page · raw message
tools/binman/fdt_test.py new file +48 -0
48 lines not on this page · raw message
tools/binman/image.py new file +229 -0
229 lines not on this page · raw message
Signature · 1 line
2.8.0.rc3.226.g39d4020
PATCH v3 1/10 binman: Introduce binman, a tool for building binary images
Hi Simon,
2016-10-05 9:25 GMT+09:00 Simon Glass <[email protected]>:
Quoted 7 lines
tools/binman/README new file +7
-0+ +Image description format +------------------------ + +The binman node is called 'binman'. An example image description is shown +below: +
tools/binman/README line 224
Quoted 10 lines
tools/binman/README new file +10
-0+ binman { + filename = "u-boot-sunxi-with-spl.bin"; + pad-byte = <0xff>; + blob { + filename = "spl/sunxi-spl.bin"; + }; + u-boot { + pos = <CONFIG_SPL_PAD_TO>; + }; + };
Oh my, finally CONFIG_ in device tree.
If CONFIG_SPL_OF_CONTROL is enabled, SPL can parse "/binman/u-boot/pos" property to know which offset address SPL should load U-Boot proper from, then remove CONFIG_SPL_PAD_TO.
Otherwise, I have no idea to avoid this.
Signature · 2 lines
Best Regards Masahiro Yamada
PATCH v3 1/10 binman: Introduce binman, a tool for building binary images
Hi Masahiro,
Quoted 26 lines · Masahiro Yamada
Hi Simon,
2016-10-05 9:25 GMT+09:00 Simon Glass <[email protected]>:
Quoted 7 lines
tools/binman/README new file +7
-0+ +Image description format +------------------------ + +The binman node is called 'binman'. An example image description is shown +below: +tools/binman/README line 224
Quoted 10 lines
tools/binman/README new file +10
-0+ binman { + filename = "u-boot-sunxi-with-spl.bin"; + pad-byte = <0xff>; + blob { + filename = "spl/sunxi-spl.bin"; + }; + u-boot { + pos = <CONFIG_SPL_PAD_TO>; + }; + };Oh my, finally
CONFIG_in device tree.
Quoted 4 lines
If
CONFIG_SPL_OF_CONTROLis enabled, SPL can parse "/binman/u-boot/pos" property to know which offset address SPL should load U-Boot proper from, then removeCONFIG_SPL_PAD_TO.
Otherwise, I have no idea to avoid this.
Yes we can do that. but in any case we need this CONFIG in the DT. I think this CONFIG (or one depending on it) is also used in the build to provide the link address for U-Boot.
Regards,
Simon
PATCH v3 2/10 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 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 v3 3/10 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 v3: None
Changes in v2: None
tools/binman/etype/intel_descriptor.py | 55 +++++++++++ tools/binman/etype/intel_me.py | 17 ++++ tools/binman/etype/intel_mrc.py | 17 ++++ tools/binman/etype/intel_vga.py | 17 ++++ tools/binman/etype/u_boot_dtb_with_ucode.py | 72 ++++++++++++++ tools/binman/etype/u_boot_ucode.py | 77 +++++++++++++++ tools/binman/etype/u_boot_with_ucode_ptr.py | 73 ++++++++++++++ tools/binman/etype/x86_start16.py | 17 ++++ tools/binman/func_test.py | 145 ++++++++++++++++++++++++++++ tools/binman/test/27_pack_4gb_no_size.dts | 18 ++++ tools/binman/test/28_pack_4gb_outside.dts | 19 ++++ tools/binman/test/29_x86-rom.dts | 19 ++++ tools/binman/test/30_x86-rom-me-no-desc.dts | 15 +++ tools/binman/test/31_x86-rom-me.dts | 18 ++++ tools/binman/test/32_intel-vga.dts | 13 +++ tools/binman/test/33_x86-start16.dts | 13 +++ tools/binman/test/34_x86_ucode.dts | 29 ++++++ tools/binman/test/35_x86_single_ucode.dts | 26 +++++ tools/binman/test/u_boot_ucode_ptr | Bin 0 -> 4175 bytes tools/binman/test/u_boot_ucode_ptr.c | 15 +++ tools/binman/test/u_boot_ucode_ptr.lds | 18 ++++ 21 files changed, 693 insertions(+) create mode 100644 tools/binman/etype/intel_descriptor.py create mode 100644 tools/binman/etype/intel_me.py create mode 100644 tools/binman/etype/intel_mrc.py create mode 100644 tools/binman/etype/intel_vga.py create mode 100644 tools/binman/etype/u_boot_dtb_with_ucode.py create mode 100644 tools/binman/etype/u_boot_ucode.py create mode 100644 tools/binman/etype/u_boot_with_ucode_ptr.py create mode 100644 tools/binman/etype/x86_start16.py create mode 100644 tools/binman/test/27_pack_4gb_no_size.dts create mode 100644 tools/binman/test/28_pack_4gb_outside.dts create mode 100644 tools/binman/test/29_x86-rom.dts create mode 100644 tools/binman/test/30_x86-rom-me-no-desc.dts create mode 100644 tools/binman/test/31_x86-rom-me.dts create mode 100644 tools/binman/test/32_intel-vga.dts create mode 100644 tools/binman/test/33_x86-start16.dts create mode 100644 tools/binman/test/34_x86_ucode.dts create mode 100644 tools/binman/test/35_x86_single_ucode.dts create mode 100755 tools/binman/test/u_boot_ucode_ptr create mode 100644 tools/binman/test/u_boot_ucode_ptr.c create mode 100644 tools/binman/test/u_boot_ucode_ptr.lds
tools/binman/etype/intel_descriptor.py new file +55 -0
@@ -0,0 +1,55 @@ +# Copyright (c) 2016 Google, Inc +# Written by Simon Glass <[email protected]> +# +# SPDX-License-Identifier: GPL-2.0+ +# +# Entry-type module for 'u-boot' +# + +import struct + +from entry import Entry +from blob import Entry_blob + +FD_SIGNATURE = struct.pack('<L', 0x0ff0a55a) +MAX_REGIONS = 5 + +(REGION_DESCRIPTOR, REGION_BIOS, REGION_ME, REGION_GBE, + REGION_PDATA) = range(5) + +class Region: + def __init__(self, data, frba, region_num): + pos = frba + region_num * 4 + val = struct.unpack('<L', data[pos:pos + 4])[0] + self.base = (val & 0xfff) << 12 + self.limit = ((val & 0x0fff0000) >> 4) | 0xfff + self.size = self.limit - self.base + 1 + +class Entry_intel_descriptor(Entry_blob): + """Intel flash descriptor block (4KB) + + This is placed at the start of flash and provides information about + the SPI flash regions. In particular it provides the base address and + size of the ME region, allowing us to place the ME binary in the right + place. + """ + def __init__(self, image, etype, node): + Entry_blob.__init__(self, image, etype, node) + self._regions = [] + + def GetDefaultFilename(self): + return 'descriptor.bin' + + def GetPositions(self): + pos = self.data.find(FD_SIGNATURE) + if pos == -1: + self.Raise('Cannot find FD signature') + flvalsig, flmap0, flmap1, flmap2 = struct.unpack('<LLLL', + self.data[pos:pos + 16]) + frba = ((flmap0 >> 16) & 0xff) << 4 + for i in range(MAX_REGIONS): + self._regions.append(Region(self.data, frba, i)) + + # Set the offset for ME only, for now, since the others are not used + return {'intel-me': [self._regions[REGION_ME].base, + self._regions[REGION_ME].size]}
tools/binman/etype/intel_me.py new file +17 -0
@@ -0,0 +1,17 @@ +# Copyright (c) 2016 Google, Inc +# Written by Simon Glass <[email protected]> +# +# SPDX-License-Identifier: GPL-2.0+ +# +# Entry-type module for 'u-boot' +# + +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 'u-boot' +# + +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 'u-boot' +# + +from entry import Entry +from blob import Entry_blob + +class Entry_intel_vga(Entry_blob): + def __init__(self, image, etype, node): + Entry_blob.__init__(self, image, etype, node) + + def GetDefaultFilename(self): + return 'vga.bin'
tools/binman/etype/u_boot_dtb_with_ucode.py new file +72 -0
72 lines not on this page · raw message
tools/binman/etype/u_boot_ucode.py new file +77 -0
77 lines not on this page · raw message
tools/binman/etype/u_boot_with_ucode_ptr.py new file +73 -0
73 lines not on this page · raw message
tools/binman/etype/x86_start16.py new file +17 -0
@@ -0,0 +1,17 @@ +# Copyright (c) 2016 Google, Inc +# Written by Simon Glass <[email protected]> +# +# SPDX-License-Identifier: GPL-2.0+ +# +# Entry-type module for the 16-bit x86 start-up code for U-Boot +# + +from entry import Entry +from blob import Entry_blob + +class Entry_x86_start16(Entry_blob): + def __init__(self, image, etype, node): + Entry_blob.__init__(self, image, etype, node) + + def GetDefaultFilename(self): + return 'u-boot-x86-16bit.bin'
tools/binman/func_test.py +145 -0
158 lines not on this page · raw message
tools/binman/test/27_pack_4gb_no_size.dts new file +18 -0
@@ -0,0 +1,18 @@ +/dts-v1/; + +/ { + #address-cells = <1>; + #size-cells = <1>; + + binman { + sort-by-pos; + end-at-4gb; + u-boot { + pos = <0xfffffff0>; + }; + + u-boot-spl { + pos = <0xfffffff7>; + }; + }; +};
tools/binman/test/28_pack_4gb_outside.dts new file +19 -0
@@ -0,0 +1,19 @@ +/dts-v1/; + +/ { + #address-cells = <1>; + #size-cells = <1>; + + binman { + sort-by-pos; + end-at-4gb; + size = <16>; + u-boot { + pos = <0>; + }; + + u-boot-spl { + pos = <0xfffffff7>; + }; + }; +};
tools/binman/test/29_x86-rom.dts new file +19 -0
@@ -0,0 +1,19 @@ +/dts-v1/; + +/ { + #address-cells = <1>; + #size-cells = <1>; + + binman { + sort-by-pos; + end-at-4gb; + size = <16>; + u-boot { + pos = <0xfffffff0>; + }; + + u-boot-spl { + pos = <0xfffffff7>; + }; + }; +};
tools/binman/test/30_x86-rom-me-no-desc.dts new file +15 -0
@@ -0,0 +1,15 @@ +/dts-v1/; + +/ { + #address-cells = <1>; + #size-cells = <1>; + + binman { + sort-by-pos; + end-at-4gb; + size = <16>; + intel-me { + pos-unset; + }; + }; +};
tools/binman/test/31_x86-rom-me.dts new file +18 -0
@@ -0,0 +1,18 @@ +/dts-v1/; + +/ { + #address-cells = <1>; + #size-cells = <1>; + + binman { + sort-by-pos; + end-at-4gb; + size = <0x800000>; + intel-descriptor { + }; + + intel-me { + pos-unset; + }; + }; +};
tools/binman/test/32_intel-vga.dts new file +13 -0
@@ -0,0 +1,13 @@ +/dts-v1/; + +/ { + #address-cells = <1>; + #size-cells = <1>; + + binman { + size = <16>; + + intel-vga { + }; + }; +};
tools/binman/test/33_x86-start16.dts new file +13 -0
@@ -0,0 +1,13 @@ +/dts-v1/; + +/ { + #address-cells = <1>; + #size-cells = <1>; + + binman { + size = <16>; + + x86-start16 { + }; + }; +};
tools/binman/test/34_x86_ucode.dts new file +29 -0
@@ -0,0 +1,29 @@ +/dts-v1/; + +/ { + #address-cells = <1>; + #size-cells = <1>; + + binman { + sort-by-pos; + end-at-4gb; + size = <0x200>; + u-boot-with-ucode-ptr { + }; + + u-boot-dtb-with-ucode { + }; + + u-boot-ucode { + }; + }; + + microcode { + update at 0 { + data = <0x12345678 0x12345679>; + }; + update at 1 { + data = <0xabcd0000 0x78235609>; + }; + }; +};
tools/binman/test/35_x86_single_ucode.dts new file +26 -0
@@ -0,0 +1,26 @@ +/dts-v1/; + +/ { + #address-cells = <1>; + #size-cells = <1>; + + binman { + sort-by-pos; + end-at-4gb; + size = <0x200>; + u-boot-with-ucode-ptr { + }; + + u-boot-dtb-with-ucode { + }; + + u-boot-ucode { + }; + }; + + microcode { + update at 0 { + data = <0x12345678 0x12345679>; + }; + }; +};
tools/binman/test/u_boot_ucode_ptr new file binary +0 -0
zgM)i3QgG0CU(yE=7YE1p!Ew2t at 9xWVH@o|LsZ@#-(v%@sqt7rjSl=(i5rZlmsZoxy zQ9SaF!jM>&I0rHVXMs3_>*wPh=u>4I0zc&NRXVJG0rgz2p&8H&Xa+OngPv#W<WEb z8PE)91~dczzyR*A5=(}qebAw|qP00Wx+^}sOy2XS&mWD8@+0oQG~%t+cBR&_15XAO zLu?77z7|AQ^SWt>h9TCMV?U7?UiPJBvzCKcpQta-m##SW0$~TeGpF8jNCaKqaY=Oj ze&6*ZKlNvnIWxzCEXm}&a5V?u^%8<um|=meT89(@6%cSR#15x>_A>)8o(X9qLQXD z#1~o6OQFqqJIY{<8~_@#DLmzgZrQ+Xi@EVGZrnMRWWNeKSJ|ha`YAi9u{Z4aQjhnG z?c~ddtBklhOXCp#9(;g{)Q?Fq+c>PTU-d6wo4~YvUz*V$GtcEfbjfs-ZCgXv9QLkU KGKbO{NcskUZF7hK
literal 0
HcmV?d00001
tools/binman/test/u_boot_ucode_ptr.c new file +15 -0
@@ -0,0 +1,15 @@ +/* +* Copyright (c) 2016 Google, Inc +* +* SPDX-License-Identifier: GPL-2.0+ +* +* Simple program to create a _dt_ucode_base_size symbol which can be read +* by 'nm'. This is used by binman tests. +* +* Build with: +* cc -march=i386 -m32 -o u_boot_ucode_ptr -T u_boot_ucode_ptr.lds -nostdlib \ +u_boot_ucode_ptr.c +*/ + +static unsigned long _dt_ucode_base_size[2] + __attribute__((section(".ucode"))) = {1, 2};
tools/binman/test/u_boot_ucode_ptr.lds new file +18 -0
@@ -0,0 +1,18 @@ +/* + * Copyright (c) 2016 Google, Inc + * + * SPDX-License-Identifier: GPL-2.0+ + */ + +OUTPUT_FORMAT("elf32-i386", "elf32-i386", "elf32-i386") +OUTPUT_ARCH(i386) +ENTRY(_start) + +SECTIONS +{ + . = 0xfffffdf0; + _start = .; + .ucode : { + *(.ucode) + } +}
Signature · 1 line
2.8.0.rc3.226.g39d4020
PATCH v3 4/10 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 v3: None
Changes in v2: None
tools/binman/etype/u_boot_img.py | 17 +++++++++++++++++ tools/binman/func_test.py | 5 +++++ tools/binman/test/36_u_boot_img.dts | 11 +++++++++++ 3 files changed, 33 insertions(+) create mode 100644 tools/binman/etype/u_boot_img.py create mode 100644 tools/binman/test/36_u_boot_img.dts
tools/binman/etype/u_boot_img.py new file +17 -0
@@ -0,0 +1,17 @@ +# Copyright (c) 2016 Google, Inc +# Written by Simon Glass <[email protected]> +# +# SPDX-License-Identifier: GPL-2.0+ +# +# Entry-type module for U-Boot binary +# + +from entry import Entry +from blob import Entry_blob + +class Entry_u_boot_img(Entry_blob): + def __init__(self, image, etype, node): + Entry_blob.__init__(self, image, etype, node) + + def GetDefaultFilename(self): + return 'u-boot.img'
tools/binman/func_test.py +5 -0
@@ -685,3 +685,8 @@ class TestFunctional(unittest.TestCase): first = data[:len(U_BOOT_NODTB_DATA)] self.assertEqual('nodtb with microcode' + pos_and_size + ' somewhere in here', first) + + def testUBootImg(self): + """Test that u-boot.img can be put in a file""" + data = self._DoReadFile('36_u_boot_img.dts') + self.assertEqual(U_BOOT_IMG_DATA, data)
tools/binman/test/36_u_boot_img.dts new file +11 -0
@@ -0,0 +1,11 @@ +/dts-v1/; + +/ { + #address-cells = <1>; + #size-cells = <1>; + + binman { + u-boot-img { + }; + }; +};
Signature · 1 line
2.8.0.rc3.226.g39d4020
PATCH v3 5/10 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 v3: None
Changes in v2: None
tools/binman/etype/u_boot_spl_bss_pad.py | 26 +++++++++ tools/binman/etype/u_boot_spl_with_ucode_ptr.py | 28 +++++++++ tools/binman/etype/x86_start16_spl.py | 17 ++++++ tools/binman/func_test.py | 71 +++++++++++++++++++++++ tools/binman/test/37_x86_no_ucode.dts | 20 +++++++ tools/binman/test/38_x86_ucode_missing_node.dts | 26 +++++++++ tools/binman/test/39_x86_ucode_missing_node2.dts | 23 ++++++++ tools/binman/test/40_x86_ucode_not_in_image.dts | 28 +++++++++ tools/binman/test/41_unknown_pos_size.dts | 11 ++++ tools/binman/test/u_boot_no_ucode_ptr | Bin 0 -> 4182 bytes tools/binman/test/u_boot_no_ucode_ptr.c | 15 +++++ 11 files changed, 265 insertions(+) create mode 100644 tools/binman/etype/u_boot_spl_bss_pad.py create mode 100644 tools/binman/etype/u_boot_spl_with_ucode_ptr.py create mode 100644 tools/binman/etype/x86_start16_spl.py create mode 100644 tools/binman/test/37_x86_no_ucode.dts create mode 100644 tools/binman/test/38_x86_ucode_missing_node.dts create mode 100644 tools/binman/test/39_x86_ucode_missing_node2.dts create mode 100644 tools/binman/test/40_x86_ucode_not_in_image.dts create mode 100644 tools/binman/test/41_unknown_pos_size.dts create mode 100755 tools/binman/test/u_boot_no_ucode_ptr create mode 100644 tools/binman/test/u_boot_no_ucode_ptr.c
tools/binman/etype/u_boot_spl_bss_pad.py new file +26 -0
@@ -0,0 +1,26 @@ +# Copyright (c) 2016 Google, Inc +# Written by Simon Glass <[email protected]> +# +# SPDX-License-Identifier: GPL-2.0+ +# +# Entry-type module for BSS padding for spl/u-boot-spl.bin. This padding +# can be added after the SPL binary to ensure that anything concatenated +# to it will appear to SPL to be at the end of BSS rather than the start. +# + +import command +from entry import Entry +from blob import Entry_blob +import tools + +class Entry_u_boot_spl_bss_pad(Entry_blob): + def __init__(self, image, etype, node): + Entry_blob.__init__(self, image, etype, node) + + def ObtainContents(self): + fname = tools.GetInputFilename('spl/u-boot-spl') + args = [['nm', fname], ['grep', '__bss_size']] + out = command.RunPipe(args, capture=True).stdout.splitlines() + bss_size = int(out[0].split()[0], 16) + self.data = chr(0) * bss_size + self.contents_size = bss_size
tools/binman/etype/u_boot_spl_with_ucode_ptr.py new file +28 -0
@@ -0,0 +1,28 @@ +# Copyright (c) 2016 Google, Inc +# Written by Simon Glass <[email protected]> +# +# SPDX-License-Identifier: GPL-2.0+ +# +# Entry-type module for an SPL binary with an embedded microcode pointer +# + +import struct + +import command +from entry import Entry +from blob import Entry_blob +from u_boot_with_ucode_ptr import Entry_u_boot_with_ucode_ptr +import tools + +class Entry_u_boot_spl_with_ucode_ptr(Entry_u_boot_with_ucode_ptr): + """U-Boot SPL with embedded microcode pointer + + See Entry_u_boot_ucode for full details of the entries involved in this + process. + """ + def __init__(self, image, etype, node): + Entry_blob.__init__(self, image, etype, node) + self.elf_fname = 'spl/u-boot-spl' + + def GetDefaultFilename(self): + return 'spl/u-boot-spl.bin'
tools/binman/etype/x86_start16_spl.py new file +17 -0
@@ -0,0 +1,17 @@ +# Copyright (c) 2016 Google, Inc +# Written by Simon Glass <[email protected]> +# +# SPDX-License-Identifier: GPL-2.0+ +# +# Entry-type module for the 16-bit x86 start-up code for U-Boot SPL +# + +from entry import Entry +from blob import Entry_blob + +class Entry_x86_start16_spl(Entry_blob): + def __init__(self, image, etype, node): + Entry_blob.__init__(self, image, etype, node) + + def GetDefaultFilename(self): + return 'spl/u-boot-x86-16bit-spl.bin'
tools/binman/func_test.py +71 -0
78 lines not on this page · raw message
tools/binman/test/37_x86_no_ucode.dts new file +20 -0
@@ -0,0 +1,20 @@ +/dts-v1/; + +/ { + #address-cells = <1>; + #size-cells = <1>; + + binman { + sort-by-pos; + end-at-4gb; + size = <0x200>; + u-boot-with-ucode-ptr { + }; + + u-boot-dtb-with-ucode { + }; + + u-boot-ucode { + }; + }; +};
tools/binman/test/38_x86_ucode_missing_node.dts new file +26 -0
@@ -0,0 +1,26 @@ +/dts-v1/; + +/ { + #address-cells = <1>; + #size-cells = <1>; + + binman { + sort-by-pos; + end-at-4gb; + size = <0x200>; + u-boot-with-ucode-ptr { + }; + + u-boot-ucode { + }; + }; + + microcode { + update at 0 { + data = <0x12345678 0x12345679>; + }; + update at 1 { + data = <0xabcd0000 0x78235609>; + }; + }; +};
tools/binman/test/39_x86_ucode_missing_node2.dts new file +23 -0
@@ -0,0 +1,23 @@ +/dts-v1/; + +/ { + #address-cells = <1>; + #size-cells = <1>; + + binman { + sort-by-pos; + end-at-4gb; + size = <0x200>; + u-boot-with-ucode-ptr { + }; + }; + + microcode { + update at 0 { + data = <0x12345678 0x12345679>; + }; + update at 1 { + data = <0xabcd0000 0x78235609>; + }; + }; +};
tools/binman/test/40_x86_ucode_not_in_image.dts new file +28 -0
@@ -0,0 +1,28 @@ +/dts-v1/; + +/ { + #address-cells = <1>; + #size-cells = <1>; + + binman { + sort-by-pos; + size = <0x200>; + u-boot-with-ucode-ptr { + }; + + u-boot-dtb-with-ucode { + }; + + u-boot-ucode { + }; + }; + + microcode { + update at 0 { + data = <0x12345678 0x12345679>; + }; + update at 1 { + data = <0xabcd0000 0x78235609>; + }; + }; +};
tools/binman/test/41_unknown_pos_size.dts new file +11 -0
@@ -0,0 +1,11 @@ +/dts-v1/; + +/ { + #address-cells = <1>; + #size-cells = <1>; + + binman { + _testing { + }; + }; +};
tools/binman/test/u_boot_no_ucode_ptr new file binary +0 -0
zpFw;En;;05iM_7#<+2d5v9R2MkJ<U%oo}nTIXF5 at Bod@0NhyLgc%qheYX at xY_d2~ zpbVua@rie&6fxF02bhC1OPs;=i*XP1$+Hc>51hV9kJT?hJ(n9X3>XFs1BL;^fMLKe zU>GnA7zPXjhJk-z0Q*;tkz&+O8uWhlJbWr0zYHsC1(-IehePl*#DA<*J^uKq2We> zj4WGJg<af^CRX{nY>SdDb~a)^k?3D_Wz%IXd$B&(ry!KRXa|vSqt1m_?06)iR_OU8 zT4A^A2a>P)v#fDuhJp8Cx5S>ApQ*-t5W&D4m^1gKRF3!4c|L2=dAsaDUTGS at 9=oZN zrZL1<80e*?&UyRVV2vCIG~TA=ewpZ&4eYjfH}1ubyTF+3XR))wJ}tVRwr4fwh8=I} z at qDp8do$uXBd$)<SgrCAe1MC@kC)<YW3|P8-9L+IBF7Cw=>(xO84NJ_C$;LPaVgT TQ=i-H%b?z at X6`RW>3;L6WVxU
literal 0
HcmV?d00001
tools/binman/test/u_boot_no_ucode_ptr.c new file +15 -0
@@ -0,0 +1,15 @@ +/* +* Copyright (c) 2016 Google, Inc +* +* SPDX-License-Identifier: GPL-2.0+ +* +* Simple program to create a bad _dt_ucode_base_size symbol to create an +* error when it is used. This is used by binman tests. +* +* Build with: +* cc -march=i386 -m32 -o u_boot_no_ucode_ptr -T u_boot_ucode_ptr.lds \ +-nostdlib u_boot_no_ucode_ptr.c +*/ + +static unsigned long not__dt_ucode_base_size[2] + __attribute__((section(".ucode"))) = {1, 2};
Signature · 1 line
2.8.0.rc3.226.g39d4020
PATCH v3 6/10 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 v3: None
Changes in v2: None
Makefile | 6 ++++++ 1 file changed, 6 insertions(+)
Makefile +6 -0
@@ -889,6 +889,12 @@ u-boot.ldr: u-boot $(LDR) -T $(CONFIG_CPU) -c $@ $< $(LDR_FLAGS) $(BOARD_SIZE_CHECK) +# binman +# --------------------------------------------------------------------------- +quiet_cmd_binman = BINMAN $@ +cmd_binman = $(srctree)/tools/binman/binman -d u-boot.dtb -O . \ + -I . -I $(srctree)/board/$(BOARDDIR) $< + OBJCOPYFLAGS_u-boot.ldr.hex := -I binary -O ihex OBJCOPYFLAGS_u-boot.ldr.srec := -I binary -O srec
Signature · 1 line
2.8.0.rc3.226.g39d4020
PATCH v3 7/10 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 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 v3 8/10 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/<cpu>-u-boot.dtsi
arch/<arch>/dts/<vendor>-u-boot.dtsi
arch/<arch>/dts/u-boot.dtsi
---
Changes in v3:
- Add a new patch to automatically include a U-Boot .dtsi file
Changes in v2: None
scripts/Makefile.lib | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-)
scripts/Makefile.lib +14 -1
@@ -164,6 +164,17 @@ 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 +binman_dtsi_options = $(wildcard $(dts_dir)/$(basename $(notdir $<))-u-boot.dtsi) \ + $(wildcard $(dts_dir)/$(subst $\",,$(CONFIG_SYS_CPU))-u-boot.dtsi) \ + $(wildcard $(dts_dir)/$(subst $\",,$(CONFIG_SYS_VENDOR))-u-boot.dtsi) \ + $(wildcard $(dts_dir)/u-boot.dtsi) + +# We use the first match +binman_dtsi = $(firstword $(binman_dtsi_options)) + # Modified for U-Boot dtc_cpp_flags = -Wp,-MD,$(depfile).pre.tmp -nostdinc \ -I$(srctree)/arch/$(ARCH)/dts \
@@ -293,8 +304,10 @@ $(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 $(binman_dtsi),| sed '/dts-v1/a\#include \"$(binman_dtsi)\"') | \ + $(CPP) $(dtc_cpp_flags) -x assembler-with-cpp -o $(dtc-tmp) - ; \ $(DTC) -O dtb -o $@ -b 0 \ -i $(dir $<) $(DTC_FLAGS) \ -d $(depfile).dtc.tmp $(dtc-tmp) ; \
Signature · 1 line
2.8.0.rc3.226.g39d4020
PATCH v3 8/10 binman: Automatically include a U-Boot .dtsi file
2016-10-05 9:25 GMT+09:00 Simon Glass <[email protected]>:
Quoted 35 lines
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/<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 v3:
- Add a new patch to automatically include a U-Boot .dtsi fileChanges in v2: None
scripts/Makefile.lib | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-)scripts/Makefile.lib +1
-0@@ -164,6 +164,17 @@ cpp_flags = -Wp,-MD,$(depfile) $(NOSTDINC_FLAGS) $(UBOOTINCLUDE) \ ld_flags = $(LDFLAGS) $(ldflags-y) +dts_dir = $(srctree)/arch/$(ARCH)/dts
scripts/Makefile.lib cpp_flags = -Wp,-MD,$(depfile) $(NOSTDINC_FLAGS) $(UBOOTINCLUDE) \ · line 177
Quoted 10 lines
scripts/Makefile.lib +10
-0+ +# Try these files in order to find the U-Boot-specific .dtsi include file +binman_dtsi_options = $(wildcard $(dts_dir)/$(basename $(notdir $<))-u-boot.dtsi) \ + $(wildcard $(dts_dir)/$(subst $\",,$(CONFIG_SYS_CPU))-u-boot.dtsi) \ + $(wildcard $(dts_dir)/$(subst $\",,$(CONFIG_SYS_VENDOR))-u-boot.dtsi) \ + $(wildcard $(dts_dir)/u-boot.dtsi) + +# We use the first match +binman_dtsi = $(firstword $(binman_dtsi_options)) +
I do not think this feature is binman-specific.
Perhaps u_boot_dtsi?
We are already suffering from U-Boot specific properties like "u-boot,dm-pre-reloc", which make it difficult to simply copy DT files from the kernel tree.
So, my first guess was this feature might be useful to split such properties out to *-u-boot.dtsi.
(it is a trade-off of more and more DT files, though.)
Signature · 2 lines
Best Regards Masahiro Yamada
PATCH v3 8/10 binman: Automatically include a U-Boot .dtsi file
Hi Masahiro,
Quoted 51 lines · Masahiro Yamada
2016-10-05 9:25 GMT+09:00 Simon Glass <[email protected]>:
Quoted 35 lines
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/<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 v3:
- Add a new patch to automatically include a U-Boot .dtsi fileChanges in v2: None
scripts/Makefile.lib | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-)scripts/Makefile.lib +1
-0@@ -164,6 +164,17 @@ cpp_flags = -Wp,-MD,$(depfile) $(NOSTDINC_FLAGS) $(UBOOTINCLUDE) \ ld_flags = $(LDFLAGS) $(ldflags-y) +dts_dir = $(srctree)/arch/$(ARCH)/dtsscripts/Makefile.lib cpp_flags = -Wp,-MD,$(depfile) $(NOSTDINC_FLAGS) $(UBOOTINCLUDE) \ · line 177
Quoted 10 lines
scripts/Makefile.lib +10
-0+ +# Try these files in order to find the U-Boot-specific .dtsi include file +binman_dtsi_options = $(wildcard $(dts_dir)/$(basename $(notdir $<))-u-boot.dtsi) \ + $(wildcard $(dts_dir)/$(subst $\",,$(CONFIG_SYS_CPU))-u-boot.dtsi) \ + $(wildcard $(dts_dir)/$(subst $\",,$(CONFIG_SYS_VENDOR))-u-boot.dtsi) \ + $(wildcard $(dts_dir)/u-boot.dtsi) + +# We use the first match +binman_dtsi = $(firstword $(binman_dtsi_options)) +I do not think this feature is binman-specific.
Quoted 8 lines
Perhaps
u_boot_dtsi?We are already suffering from U-Boot specific properties like "u-boot,dm-pre-reloc", which make it difficult to simply copy DT files from the kernel tree.
So, my first guess was this feature might be useful to split such properties out to *-u-boot.dtsi.
(it is a trade-off of more and more DT files, though.)
Yes that was Tom's intent. True, it is not binman-specific and I'm happy to change the variable, but let's see if this solves the problem first.
Regards,
Simon
PATCH v3 8/10 binman: Automatically include a U-Boot .dtsi file
Quoted 11 lines · On Mittwoch, 5. Oktober 2016 10:51:04 CEST Simon Glass wrote:
Hi Masahiro,
On 4 October 2016 at 21:51, Masahiro Yamada
Quoted 7 lines
We are already suffering from U-Boot specific properties like "u-boot,dm-pre-reloc", which make it difficult to simply copy DT files from the kernel tree.
So, my first guess was this feature might be useful to split such properties out to *-u-boot.dtsi.
(it is a trade-off of more and more DT files, though.)
Quoted 3 lines
Yes that was Tom's intent. True, it is not binman-specific and I'm happy to change the variable, but let's see if this solves the problem first.
Is it possible to use a device tree overlay for this?
Kind regards,
Stefan
Signature · 3 lines
Stefan Br?ns / Bergstra?e 21 / 52062 Aachen home: +49 241 53809034 mobile: +49 151 50412019 work: +49 2405 49936-424
PATCH v3 8/10 binman: Automatically include a U-Boot .dtsi file
In reply to Simon GlassQuoted 64 lines · Simon Glass
Hi Masahiro,
Quoted 51 lines · Masahiro Yamada
2016-10-05 9:25 GMT+09:00 Simon Glass <[email protected]>:
Quoted 35 lines
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/<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 v3:
- Add a new patch to automatically include a U-Boot .dtsi fileChanges in v2: None
scripts/Makefile.lib | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-)scripts/Makefile.lib +1
-0@@ -164,6 +164,17 @@ cpp_flags = -Wp,-MD,$(depfile) $(NOSTDINC_FLAGS) $(UBOOTINCLUDE) \ ld_flags = $(LDFLAGS) $(ldflags-y) +dts_dir = $(srctree)/arch/$(ARCH)/dtsscripts/Makefile.lib cpp_flags = -Wp,-MD,$(depfile) $(NOSTDINC_FLAGS) $(UBOOTINCLUDE) \ · line 177
Quoted 10 lines
scripts/Makefile.lib +10
-0+ +# Try these files in order to find the U-Boot-specific .dtsi include file +binman_dtsi_options = $(wildcard $(dts_dir)/$(basename $(notdir $<))-u-boot.dtsi) \ + $(wildcard $(dts_dir)/$(subst $\",,$(CONFIG_SYS_CPU))-u-boot.dtsi) \ + $(wildcard $(dts_dir)/$(subst $\",,$(CONFIG_SYS_VENDOR))-u-boot.dtsi) \ + $(wildcard $(dts_dir)/u-boot.dtsi) + +# We use the first match +binman_dtsi = $(firstword $(binman_dtsi_options)) +I do not think this feature is binman-specific.
Quoted 8 lines
Perhaps
u_boot_dtsi?We are already suffering from U-Boot specific properties like "u-boot,dm-pre-reloc", which make it difficult to simply copy DT files from the kernel tree.
So, my first guess was this feature might be useful to split such properties out to *-u-boot.dtsi.
(it is a trade-off of more and more DT files, though.)
Quoted 3 lines
Yes that was Tom's intent. True, it is not binman-specific and I'm happy to change the variable, but let's see if this solves the problem first.
It certainly looks like it, thanks! Perhaps a 11/10 patch to migrate some platforms u-boot,dm-pre-reloc flags? :)
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/20161005/73895662/attachment.sig>
PATCH v3 8/10 binman: Automatically include a U-Boot .dtsi file
Hi Tom,
Quoted 65 lines · Tom Rini
Quoted 64 lines · Simon Glass
Hi Masahiro,
Quoted 59 lines · Masahiro Yamada
2016-10-05 9:25 GMT+09:00 Simon Glass <[email protected]>:
Quoted 35 lines
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/<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 v3:
- Add a new patch to automatically include a U-Boot .dtsi fileChanges in v2: None
scripts/Makefile.lib | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-)scripts/Makefile.lib +1
-0@@ -164,6 +164,17 @@ cpp_flags = -Wp,-MD,$(depfile) $(NOSTDINC_FLAGS) $(UBOOTINCLUDE) \ ld_flags = $(LDFLAGS) $(ldflags-y) +dts_dir = $(srctree)/arch/$(ARCH)/dtsscripts/Makefile.lib cpp_flags = -Wp,-MD,$(depfile) $(NOSTDINC_FLAGS) $(UBOOTINCLUDE) \ · line 177
Quoted 10 lines
scripts/Makefile.lib +10
-0+ +# Try these files in order to find the U-Boot-specific .dtsi include file +binman_dtsi_options = $(wildcard $(dts_dir)/$(basename $(notdir $<))-u-boot.dtsi) \ + $(wildcard $(dts_dir)/$(subst $\",,$(CONFIG_SYS_CPU))-u-boot.dtsi) \ + $(wildcard $(dts_dir)/$(subst $\",,$(CONFIG_SYS_VENDOR))-u-boot.dtsi) \ + $(wildcard $(dts_dir)/u-boot.dtsi) + +# We use the first match +binman_dtsi = $(firstword $(binman_dtsi_options)) +I do not think this feature is binman-specific.
Perhaps
u_boot_dtsi?We are already suffering from U-Boot specific properties like "u-boot,dm-pre-reloc", which make it difficult to simply copy DT files from the kernel tree.
So, my first guess was this feature might be useful to split such properties out to *-u-boot.dtsi.
(it is a trade-off of more and more DT files, though.)
Quoted 6 lines
Quoted 3 lines
Yes that was Tom's intent. True, it is not binman-specific and I'm happy to change the variable, but let's see if this solves the problem first.
It certainly looks like it, thanks! Perhaps a 11/10 patch to migrate some platforms u-boot,dm-pre-reloc flags? :)
OK I have done this for tegra and it seems to work fine.
Regard,
Simon
PATCH v3 9/10 RFC: Use binman for a sunxi board
In reply to Simon GlassAdd an example usage of binman for a sunxi board. This involves adding the image definition to the device tree and using it in the Makefile.
This is for example only.
---
Changes in v3:
- Use a <dts>-u-boot.dtsi file for the binman changes
Changes in v2: None
Makefile | 4 +--- arch/arm/dts/sun7i-a20-pcduino3-u-boot.dtsi | 14 ++++++++++++++ 2 files changed, 15 insertions(+), 3 deletions(-) create mode 100644 arch/arm/dts/sun7i-a20-pcduino3-u-boot.dtsi
Makefile +1 -3
@@ -1121,10 +1121,8 @@ u-boot-x86-16bit.bin: u-boot FORCE endif ifneq ($(CONFIG_SUNXI),) -OBJCOPYFLAGS_u-boot-sunxi-with-spl.bin = -I binary -O binary \ - --pad-to=$(CONFIG_SPL_PAD_TO) --gap-fill=0xff u-boot-sunxi-with-spl.bin: spl/sunxi-spl.bin u-boot.img FORCE - $(call if_changed,pad_cat) + $(call if_changed,binman) endif ifneq ($(CONFIG_TEGRA),)
arch/arm/dts/sun7i-a20-pcduino3-u-boot.dtsi new file +14 -0
@@ -0,0 +1,14 @@ +#include <config.h> + +/ { + binman { + filename = "u-boot-sunxi-with-spl.bin"; + pad-byte = <0xff>; + blob { + filename = "spl/sunxi-spl.bin"; + }; + u-boot-img { + pos = <CONFIG_SPL_PAD_TO>; + }; + }; +};
Signature · 1 line
2.8.0.rc3.226.g39d4020
PATCH v3 9/10 RFC: Use binman for a sunxi board
Quoted 11 lines · Simon Glass
Add an example usage of binman for a sunxi board. This involves adding the image definition to the device tree and using it in the
Makefile.This is for example only.
Signed-off-by Simon Glass <[email protected]>---
Changes in v3:
- Use a <dts>-u-boot.dtsi file for the binman changes
Quoted 6 lines
Changes in v2: None
Makefile | 4 +--- arch/arm/dts/sun7i-a20-pcduino3-u-boot.dtsi | 14 ++++++++++++++ 2 files changed, 15 insertions(+), 3 deletions(-) create mode 100644 arch/arm/dts/sun7i-a20-pcduino3-u-boot.dtsi
OK, we have a board example for arm and a platform example for x86. But lets move this to non-RFC and provide the sunxi example above as the vendor one (the sunxi rule that you remove is for all sunxi).
Perhaps one of the am335x vboot examples would be the right place to find a board-specific use for binman?
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/20161005/fbd23b7a/attachment.sig>
PATCH v3 10/10 RFC: Use binman for an x86 board
In reply to Simon GlassAdd an example usage of binman for an x86 board. This involves adding the image definition to the device tree and using it in the Makefile. The existing ifdtool features are no-longer needed.
This is for example only. Note that the binman.dtsi file is common and could be used for all x86 boards. However, FSP support is missing.
---
Changes in v3:
- Put the binman definition in u-boot.dtsi
Changes in v2:
- Add automated test coverage
- Various changes and improvements based on using this tool for a while
- Put the binman definition in a common file for x86
Makefile | 45 +++-------------------------------- arch/x86/dts/u-boot.dtsi | 62 ++++++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 65 insertions(+), 42 deletions(-) create mode 100644 arch/x86/dts/u-boot.dtsi
Makefile +3 -42
@@ -1060,50 +1060,11 @@ endif # x86 uses a large ROM. We fill it with 0xff, put the 16-bit stuff (including # reset vector) at the top, Intel ME descriptor at the bottom, and U-Boot in -# the middle. +# the middle. This is handled by binman based on an image description in the +# board's device tree. ifneq ($(CONFIG_X86_RESET_VECTOR),) rom: u-boot.rom FORCE -IFDTOOL=$(objtree)/tools/ifdtool -IFDTOOL_FLAGS = -f 0:$(objtree)/u-boot.dtb -IFDTOOL_FLAGS += -m 0x$(shell $(NM) u-boot |grep _dt_ucode_base_size |cut -d' ' -f1) -IFDTOOL_FLAGS += -U $(CONFIG_SYS_TEXT_BASE):$(objtree)/u-boot-nodtb.bin -IFDTOOL_FLAGS += -w $(CONFIG_SYS_X86_START16):$(objtree)/u-boot-x86-16bit.bin -IFDTOOL_FLAGS += -C - -ifneq ($(CONFIG_HAVE_INTEL_ME),) -IFDTOOL_ME_FLAGS = -D $(srctree)/board/$(BOARDDIR)/descriptor.bin -IFDTOOL_ME_FLAGS += -i ME:$(srctree)/board/$(BOARDDIR)/me.bin -endif - -ifneq ($(CONFIG_HAVE_MRC),) -IFDTOOL_FLAGS += -w $(CONFIG_X86_MRC_ADDR):$(srctree)/board/$(BOARDDIR)/mrc.bin -endif - -ifneq ($(CONFIG_HAVE_FSP),) -IFDTOOL_FLAGS += -w $(CONFIG_FSP_ADDR):$(srctree)/board/$(BOARDDIR)/$(CONFIG_FSP_FILE) -endif - -ifneq ($(CONFIG_HAVE_CMC),) -IFDTOOL_FLAGS += -w $(CONFIG_CMC_ADDR):$(srctree)/board/$(BOARDDIR)/$(CONFIG_CMC_FILE) -endif - -ifneq ($(CONFIG_HAVE_VGA_BIOS),) -IFDTOOL_FLAGS += -w $(CONFIG_VGA_BIOS_ADDR):$(srctree)/board/$(BOARDDIR)/$(CONFIG_VGA_BIOS_FILE) -endif - -ifneq ($(CONFIG_HAVE_REFCODE),) -IFDTOOL_FLAGS += -w $(CONFIG_X86_REFCODE_ADDR):refcode.bin -endif - -quiet_cmd_ifdtool = IFDTOOL $@ -cmd_ifdtool = $(IFDTOOL) -c -r $(CONFIG_ROM_SIZE) u-boot.tmp; -ifneq ($(CONFIG_HAVE_INTEL_ME),) -cmd_ifdtool += $(IFDTOOL) $(IFDTOOL_ME_FLAGS) u-boot.tmp; -endif -cmd_ifdtool += $(IFDTOOL) $(IFDTOOL_FLAGS) u-boot.tmp; -cmd_ifdtool += mv u-boot.tmp $@ - refcode.bin: $(srctree)/board/$(BOARDDIR)/refcode.bin FORCE $(call if_changed,copy)
@@ -1113,7 +1074,7 @@ cmd_ldr = $(LD) $(LDFLAGS_$(@F)) \ u-boot.rom: u-boot-x86-16bit.bin u-boot.bin FORCE \ $(if $(CONFIG_HAVE_REFCODE),refcode.bin) - $(call if_changed,ifdtool) + $(call if_changed,binman) OBJCOPYFLAGS_u-boot-x86-16bit.bin := -O binary -j .start16 -j .resetvec u-boot-x86-16bit.bin: u-boot FORCE
arch/x86/dts/u-boot.dtsi new file +62 -0
62 lines not on this page · raw message
Signature · 1 line
2.8.0.rc3.226.g39d4020