[PATCH v3 00/49] rockchip: x86: Support building ROM files automatically with binman

Rockchip-based Chromebooks support booting from SPI flash. It is annoying to have to manually build the SPI image when the SD image is built automatically.
This feature is already available for x86 devices, so the existing mechanism is reused. Briefly, this allows a BUILD_ROM environment variable to be provided to indicate that any required binary blobs are present and it is safe to build the ROM.
A new 'mkimage' type is added to binman to support building binaries containing mkimagem using a binman definition to configure it. This avoids Makefile/shell/Python code to do the same thing.
This series also migrates some rockchip boards to use binman to produce their FIT as well, resulting in removing the fit_spl_optee.sh script.
Other archs and the rest of rockchip could be migrated too.
This series uses binman to produce a ROM image on two selected Chromebooks, Bob (RK3399) and Jerry (RK3388).
Changes in v3: - Set a default toolpath for ease of use - Fix the code rather than breaking the README - Update commit message to explain cros_ec_rw and mention dropping Entry - Move the SetAllowMissing() function into this patch - Keep the _allow_missing property to sections only - Move the SetAllowMissing() function into an earlier patch - Add a comment about CONFIG_SPL_FRAMEWORK - Drop rockchip changes which should not be in this patch - Move in the rockchip changes mistakenly in the earlier x86 patch - Drop use of rk322x.dtsi - Add changes to rk3288-u-boot.dtsi instead - Drop leftover debugging
Changes in v2: - Add new binman patch to output errors to stderr - Leave the old (object-directory) path in place - Drop 'rockchip' tag since this commit no-longer affects rockchip yet - Drop ROM_NEEDS_BLOBS for baytrail since HAVE_FSP already selects it - Add patches to partially migrate rockchip to use binman
Simon Glass (49): dm: core Fix long line in device_bind_common() .gitignore: Ignore Python 3 cache directories binman: Output errors to stderr binman: cbfs: Fix IFWI typo binman: Correct the search patch for pylibfdt binman: Specify the toolpath when running test coverage binman: Set a default toolpath binman: Add support for calling mkimage binman: Fix a few typos in the entry docs binman: Adjust pylibfdt for incremental build binman: Re-enable concurrent tests binman: Use super() instead of specifying parent type binman: Add an etype for external binary blobs binman: Convert existing binary blobs to blob_ext binman: Allow external binaries to be missing patman: Update errors and warnings to use stderr binman: Detect when valid images are not produced binman: Allow missing Intel blobs binman: Allow zero-length entries to overlap mkimage: Allow updating the FIT timestamp dtoc: Allow adding variable-sized data to a dtb binman: Add support for generating a FIT x86: Change how selection of ROMs works rockchip: Allow Bob to use SPI boot Makefile: Allow building .rom files for non-x86 boards rockchip: jerry: Add serial support rockchip: bob: Support SPI-flash booting rockchip: Enable building a SPI ROM image on jerry rockchip: Enable building a SPI ROM image on bob tegra: Drop the unused non-binman code tegra: Don't enable binman on ARMv8 SoCs Makefile: Rename ALL-y to INPUTS-y powerpc: mpc85xx: Only enable binman when it is needed x86: Makefile: Drop explicit targets built by binman x86: Drop CONFIG_BUILD_ROM and repurpose BUILD_ROM sunxi: Makefile: Drop explicit targets built by binman tegra: Makefile: Drop explicit targets built by binman mediatek: Makefile: Drop explicit targets built by binman Makefile: Move CONFIG_TOOLS_DEBUG check to later Makefile: Fix a long line in cmd_mkfitimage Makefile: Allow CONFIG_SPL_FIT_GENERATOR to be empty Makefile: Warn against using CONFIG_SPL_FIT_GENERATOR rockchip: Convert evb-rk3288 over to use binman rockchip: Convert evb-rk3229 over to use binman rockchip: Drop the fit_spl_optee.sh script x86: Move the fdtmap away from the binary blobs x86: chromebook_link64: Correct the image layout x86: chromebook_panther: Correct the image layout x86: chromebook_samus_tpl: Correct the image layout
.gitignore | 3 + Kconfig | 29 ++- Makefile | 169 ++++++++---------- arch/Kconfig | 1 + arch/arm/config.mk | 10 +- arch/arm/dts/rk3288-u-boot.dtsi | 78 ++++++++ arch/arm/dts/rk3399-gru-u-boot.dtsi | 4 + arch/arm/dts/rk3399-gru.dtsi | 2 +- arch/arm/dts/rk3399-u-boot.dtsi | 27 +++ arch/arm/dts/rockchip-u-boot.dtsi | 10 +- arch/arm/mach-at91/config.mk | 2 +- arch/arm/mach-davinci/config.mk | 2 +- arch/arm/mach-k3/config.mk | 10 +- arch/arm/mach-keystone/config.mk | 4 +- arch/arm/mach-omap2/config.mk | 28 +-- arch/arm/mach-rmobile/Makefile | 2 +- arch/arm/mach-rockchip/fit_spl_optee.sh | 84 --------- arch/arm/mach-rockchip/rk3288/Kconfig | 1 + arch/arm/mach-rockchip/rk3399/Kconfig | 1 + arch/arm/mach-rockchip/spl.c | 3 +- arch/arm/mach-stm32mp/config.mk | 4 +- arch/arm/mach-tegra/Kconfig | 2 +- arch/powerpc/Kconfig | 2 +- arch/x86/Kconfig | 11 +- arch/x86/cpu/quark/Kconfig | 1 + arch/x86/dts/u-boot.dtsi | 10 +- board/BuR/brppt1/config.mk | 4 +- board/BuR/brppt2/config.mk | 4 +- board/BuR/brsmarc1/config.mk | 6 +- board/imgtec/boston/config.mk | 2 +- board/intel/edison/config.mk | 2 +- configs/am335x_evm_defconfig | 1 + configs/am335x_hs_evm_defconfig | 1 + configs/am335x_hs_evm_uart_defconfig | 1 + configs/am43xx_evm_defconfig | 1 + configs/am43xx_evm_rtconly_defconfig | 1 + configs/am43xx_evm_usbhost_boot_defconfig | 1 + configs/am43xx_hs_evm_defconfig | 1 + configs/am57xx_evm_defconfig | 1 + configs/am57xx_hs_evm_defconfig | 1 + configs/am57xx_hs_evm_usb_defconfig | 1 + configs/am65x_evm_a53_defconfig | 1 + configs/am65x_evm_r5_defconfig | 1 + configs/am65x_hs_evm_a53_defconfig | 1 + configs/am65x_hs_evm_r5_defconfig | 1 + configs/chromebook_bob_defconfig | 4 +- configs/chromebook_jerry_defconfig | 1 + configs/chromebook_link64_defconfig | 2 + configs/chromebook_samus_tpl_defconfig | 2 +- configs/chromebox_panther_defconfig | 2 + configs/dh_imx6_defconfig | 1 + configs/display5_defconfig | 1 + configs/display5_factory_defconfig | 1 + configs/dra7xx_evm_defconfig | 1 + configs/dra7xx_hs_evm_defconfig | 1 + configs/dra7xx_hs_evm_usb_defconfig | 1 + configs/evb-rk3229_defconfig | 2 +- configs/evb-rk3288_defconfig | 2 +- configs/imx6qdl_icore_mipi_defconfig | 1 + configs/imx6qdl_icore_mmc_defconfig | 1 + configs/imx6qdl_icore_rqs_defconfig | 1 + configs/j721e_evm_a72_defconfig | 1 + configs/j721e_evm_r5_defconfig | 1 + configs/j721e_hs_evm_a72_defconfig | 1 + configs/j721e_hs_evm_r5_defconfig | 1 + configs/ls1046ardb_qspi_spl_defconfig | 1 + configs/mccmon6_nor_defconfig | 1 + configs/mccmon6_sd_defconfig | 1 + configs/mx6sabreauto_defconfig | 1 + configs/mx6sabresd_defconfig | 1 + configs/pico-imx6_defconfig | 1 + configs/qemu-x86_64_defconfig | 2 +- configs/qemu-x86_defconfig | 1 - configs/sandbox_spl_defconfig | 1 + configs/socfpga_arria10_defconfig | 1 + configs/stm32mp15_dhcom_basic_defconfig | 1 + configs/stm32mp15_dhcor_basic_defconfig | 1 + configs/wandboard_defconfig | 1 + configs/xilinx_zynq_virt_defconfig | 1 + doc/mkimage.1 | 9 + drivers/core/device.c | 3 +- scripts/Makefile.spl | 24 +-- scripts/dtc/pylibfdt/Makefile | 3 + tools/binman/README | 2 +- tools/binman/README.entries | 76 ++++++++ tools/binman/cmdline.py | 2 + tools/binman/control.py | 19 +- tools/binman/entry.py | 21 +++ tools/binman/etype/_testing.py | 9 +- tools/binman/etype/blob.py | 2 +- tools/binman/etype/blob_dtb.py | 6 +- tools/binman/etype/blob_ext.py | 39 ++++ tools/binman/etype/blob_named_by_arg.py | 2 +- tools/binman/etype/cbfs.py | 16 +- tools/binman/etype/cros_ec_rw.py | 4 +- tools/binman/etype/fdtmap.py | 2 +- tools/binman/etype/files.py | 2 +- tools/binman/etype/fill.py | 4 +- tools/binman/etype/fit.py | 164 +++++++++++++++++ tools/binman/etype/fmap.py | 2 +- tools/binman/etype/gbb.py | 2 +- tools/binman/etype/image_header.py | 4 +- tools/binman/etype/intel_cmc.py | 7 +- tools/binman/etype/intel_descriptor.py | 15 +- tools/binman/etype/intel_fit.py | 8 +- tools/binman/etype/intel_fit_ptr.py | 8 +- tools/binman/etype/intel_fsp.py | 7 +- tools/binman/etype/intel_fsp_m.py | 7 +- tools/binman/etype/intel_fsp_s.py | 7 +- tools/binman/etype/intel_fsp_t.py | 7 +- tools/binman/etype/intel_ifwi.py | 25 ++- tools/binman/etype/intel_me.py | 9 +- tools/binman/etype/intel_mrc.py | 7 +- tools/binman/etype/intel_refcode.py | 7 +- tools/binman/etype/intel_vbt.py | 7 +- tools/binman/etype/intel_vga.py | 7 +- tools/binman/etype/mkimage.py | 62 +++++++ .../etype/powerpc_mpc85xx_bootpg_resetvec.py | 5 +- tools/binman/etype/section.py | 58 ++++-- tools/binman/etype/text.py | 2 +- tools/binman/etype/u_boot.py | 2 +- tools/binman/etype/u_boot_dtb.py | 2 +- tools/binman/etype/u_boot_dtb_with_ucode.py | 4 +- tools/binman/etype/u_boot_elf.py | 4 +- tools/binman/etype/u_boot_img.py | 2 +- tools/binman/etype/u_boot_nodtb.py | 2 +- tools/binman/etype/u_boot_spl.py | 2 +- tools/binman/etype/u_boot_spl_bss_pad.py | 2 +- tools/binman/etype/u_boot_spl_dtb.py | 2 +- tools/binman/etype/u_boot_spl_elf.py | 2 +- tools/binman/etype/u_boot_spl_nodtb.py | 2 +- .../binman/etype/u_boot_spl_with_ucode_ptr.py | 2 +- tools/binman/etype/u_boot_tpl.py | 2 +- tools/binman/etype/u_boot_tpl_dtb.py | 2 +- .../binman/etype/u_boot_tpl_dtb_with_ucode.py | 2 +- tools/binman/etype/u_boot_tpl_elf.py | 2 +- .../binman/etype/u_boot_tpl_with_ucode_ptr.py | 2 +- tools/binman/etype/u_boot_ucode.py | 2 +- tools/binman/etype/u_boot_with_ucode_ptr.py | 2 +- tools/binman/etype/vblock.py | 2 +- tools/binman/etype/x86_reset16.py | 2 +- tools/binman/etype/x86_reset16_spl.py | 2 +- tools/binman/etype/x86_reset16_tpl.py | 2 +- tools/binman/etype/x86_start16.py | 2 +- tools/binman/etype/x86_start16_spl.py | 2 +- tools/binman/etype/x86_start16_tpl.py | 2 +- tools/binman/ftest.py | 140 ++++++++++++++- tools/binman/image.py | 12 +- tools/binman/main.py | 18 +- tools/binman/test/156_mkimage.dts | 23 +++ tools/binman/test/157_blob_ext.dts | 14 ++ tools/binman/test/158_blob_ext_missing.dts | 16 ++ .../binman/test/159_blob_ext_missing_sect.dts | 23 +++ tools/binman/test/160_pack_overlap_zero.dts | 18 ++ tools/binman/test/161_fit.dts | 62 +++++++ tools/binman/test/162_fit_external.dts | 64 +++++++ tools/dtoc/fdt.py | 17 +- tools/dtoc/test_fdt.py | 4 + tools/fit_image.c | 2 +- tools/imagetool.h | 1 + tools/mkimage.c | 5 +- tools/patman/test_util.py | 13 +- tools/patman/tools.py | 8 +- tools/patman/tout.py | 6 +- 164 files changed, 1338 insertions(+), 411 deletions(-) delete mode 100755 arch/arm/mach-rockchip/fit_spl_optee.sh create mode 100644 tools/binman/etype/blob_ext.py create mode 100644 tools/binman/etype/fit.py create mode 100644 tools/binman/etype/mkimage.py create mode 100644 tools/binman/test/156_mkimage.dts create mode 100644 tools/binman/test/157_blob_ext.dts create mode 100644 tools/binman/test/158_blob_ext_missing.dts create mode 100644 tools/binman/test/159_blob_ext_missing_sect.dts create mode 100644 tools/binman/test/160_pack_overlap_zero.dts create mode 100644 tools/binman/test/161_fit.dts create mode 100644 tools/binman/test/162_fit_external.dts

Fix an over-length line in this function.
Signed-off-by: Simon Glass sjg@chromium.org Reviewed-by: Bin Meng bmeng.cn@gmail.com ---
(no changes since v1)
drivers/core/device.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/drivers/core/device.c b/drivers/core/device.c index 476133f172..355dbd147a 100644 --- a/drivers/core/device.c +++ b/drivers/core/device.c @@ -82,7 +82,8 @@ static int device_bind_common(struct udevice *parent, const struct driver *drv, * This is just a 'requested' sequence, and will be * resolved (and ->seq updated) when the device is probed. */ - if (CONFIG_IS_ENABLED(OF_CONTROL) && !CONFIG_IS_ENABLED(OF_PLATDATA)) { + if (CONFIG_IS_ENABLED(OF_CONTROL) && + !CONFIG_IS_ENABLED(OF_PLATDATA)) { if (uc->uc_drv->name && ofnode_valid(node)) dev_read_alias_seq(dev, &dev->req_seq); #if CONFIG_IS_ENABLED(OF_PRIOR_STAGE)

Fix an over-length line in this function.
Signed-off-by: Simon Glass sjg@chromium.org Reviewed-by: Bin Meng bmeng.cn@gmail.com ---
(no changes since v1)
drivers/core/device.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
Applied to u-boot-dm

These can appear when moving between branches that have different tools in the tree. Ignore them.
Signed-off-by: Simon Glass sjg@chromium.org Reviewed-by: Bin Meng bmeng.cn@gmail.com ---
(no changes since v1)
.gitignore | 3 +++ 1 file changed, 3 insertions(+)
diff --git a/.gitignore b/.gitignore index 2e1c8bf2bf..e66aa864da 100644 --- a/.gitignore +++ b/.gitignore @@ -92,3 +92,6 @@ GTAGS *.orig *~ #*# + +# Python cache +__pycache__

These can appear when moving between branches that have different tools in the tree. Ignore them.
Signed-off-by: Simon Glass sjg@chromium.org Reviewed-by: Bin Meng bmeng.cn@gmail.com ---
(no changes since v1)
.gitignore | 3 +++ 1 file changed, 3 insertions(+)
Applied to u-boot-dm

At present binman outputs errors to stdout which means that fails are effectively silent when printed by buildman, for example. Fix this by outputing errors to stderr.
Signed-off-by: Simon Glass sjg@chromium.org Reviewed-by: Bin Meng bmeng.cn@gmail.com ---
(no changes since v2)
Changes in v2: - Add new binman patch to output errors to stderr
tools/binman/main.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/tools/binman/main.py b/tools/binman/main.py index efa7fa8386..0ab2bb6206 100755 --- a/tools/binman/main.py +++ b/tools/binman/main.py @@ -123,7 +123,7 @@ def RunBinman(args): try: ret_code = control.Binman(args) except Exception as e: - print('binman: %s' % e) + print('binman: %s' % e, file=sys.stderr) if args.debug: print() traceback.print_exc()

At present binman outputs errors to stdout which means that fails are effectively silent when printed by buildman, for example. Fix this by outputing errors to stderr.
Signed-off-by: Simon Glass sjg@chromium.org Reviewed-by: Bin Meng bmeng.cn@gmail.com ---
(no changes since v2)
Changes in v2: - Add new binman patch to output errors to stderr
tools/binman/main.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
Applied to u-boot-dm

This comment references the wrong thing. Fix it.
Signed-off-by: Simon Glass sjg@chromium.org Reviewed-by: Bin Meng bmeng.cn@gmail.com ---
(no changes since v1)
tools/binman/etype/cbfs.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/tools/binman/etype/cbfs.py b/tools/binman/etype/cbfs.py index e9aed8310c..744a32fa0c 100644 --- a/tools/binman/etype/cbfs.py +++ b/tools/binman/etype/cbfs.py @@ -204,7 +204,7 @@ class Entry_cbfs(Entry): return True
def _ReadSubnodes(self): - """Read the subnodes to find out what should go in this IFWI""" + """Read the subnodes to find out what should go in this CBFS""" for node in self._node.subnodes: entry = Entry.Create(self, node) entry.ReadNode()

This comment references the wrong thing. Fix it.
Signed-off-by: Simon Glass sjg@chromium.org Reviewed-by: Bin Meng bmeng.cn@gmail.com ---
(no changes since v1)
tools/binman/etype/cbfs.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
Applied to u-boot-dm

Now that binman uses tools/ as its base directory for importing modules, the path to the pylibfdt build by U-Boot is incorrect. Fix it with a new path.
Signed-off-by: Simon Glass sjg@chromium.org Reviewed-by: Bin Meng bmeng.cn@gmail.com ---
(no changes since v2)
Changes in v2: - Leave the old (object-directory) path in place
tools/binman/main.py | 1 + 1 file changed, 1 insertion(+)
diff --git a/tools/binman/main.py b/tools/binman/main.py index 0ab2bb6206..6f5a9d1ca2 100755 --- a/tools/binman/main.py +++ b/tools/binman/main.py @@ -26,6 +26,7 @@ from patman import test_util
# Bring in the libfdt module sys.path.insert(2, 'scripts/dtc/pylibfdt') +sys.path.insert(2, os.path.join(our_path, '../../scripts/dtc/pylibfdt')) sys.path.insert(2, os.path.join(our_path, '../../build-sandbox_spl/scripts/dtc/pylibfdt'))

Now that binman uses tools/ as its base directory for importing modules, the path to the pylibfdt build by U-Boot is incorrect. Fix it with a new path.
Signed-off-by: Simon Glass sjg@chromium.org Reviewed-by: Bin Meng bmeng.cn@gmail.com ---
(no changes since v2)
Changes in v2: - Leave the old (object-directory) path in place
tools/binman/main.py | 1 + 1 file changed, 1 insertion(+)
Applied to u-boot-dm

At present binman's test coverage runs without a toolpath set. This means that the system tools will be used. That may not be correct if they are out of date or missing and this can result in a reduction in test coverage below 100%.
Provide the toolpath to binman in this case.
Signed-off-by: Simon Glass sjg@chromium.org ---
(no changes since v1)
tools/binman/main.py | 10 +++++++--- tools/patman/test_util.py | 9 ++++++--- 2 files changed, 13 insertions(+), 6 deletions(-)
diff --git a/tools/binman/main.py b/tools/binman/main.py index 6f5a9d1ca2..a5793d5d23 100755 --- a/tools/binman/main.py +++ b/tools/binman/main.py @@ -89,14 +89,18 @@ def GetEntryModules(include_testing=True): for item in glob_list if include_testing or '_testing' not in item])
-def RunTestCoverage(): +def RunTestCoverage(toolpath): """Run the tests and check that we get 100% coverage""" glob_list = GetEntryModules(False) all_set = set([os.path.splitext(os.path.basename(item))[0] for item in glob_list if '_testing' not in item]) + extra_args = '' + if toolpath: + for path in toolpath: + extra_args += ' --toolpath %s' % path test_util.RunTestCoverage('tools/binman/binman', None, ['*test*', '*main.py', 'tools/patman/*', 'tools/dtoc/*'], - args.build_dir, all_set) + args.build_dir, all_set, extra_args or None)
def RunBinman(args): """Main entry point to binman once arguments are parsed @@ -111,7 +115,7 @@ def RunBinman(args):
if args.cmd == 'test': if args.test_coverage: - RunTestCoverage() + RunTestCoverage(args.toolpath) else: ret_code = RunTests(args.debug, args.verbosity, args.processes, args.test_preserve_dirs, args.tests, diff --git a/tools/patman/test_util.py b/tools/patman/test_util.py index aac58fb72f..5eed461995 100644 --- a/tools/patman/test_util.py +++ b/tools/patman/test_util.py @@ -21,7 +21,8 @@ except: use_concurrent = False
-def RunTestCoverage(prog, filter_fname, exclude_list, build_dir, required=None): +def RunTestCoverage(prog, filter_fname, exclude_list, build_dir, required=None, + extra_args=None): """Run tests and check that we get 100% coverage
Args: @@ -34,6 +35,8 @@ def RunTestCoverage(prog, filter_fname, exclude_list, build_dir, required=None): calculation build_dir: Build directory, used to locate libfdt.py required: List of modules which must be in the coverage report + extra_args (str): Extra arguments to pass to the tool before the -t/test + arg
Raises: ValueError if the code coverage is not 100% @@ -52,8 +55,8 @@ def RunTestCoverage(prog, filter_fname, exclude_list, build_dir, required=None): if build_dir: prefix = 'PYTHONPATH=$PYTHONPATH:%s/sandbox_spl/tools ' % build_dir cmd = ('%spython3-coverage run ' - '--omit "%s" %s %s -P1' % (prefix, ','.join(glob_list), - prog, test_cmd)) + '--omit "%s" %s %s %s -P1' % (prefix, ','.join(glob_list), + prog, extra_args or '', test_cmd)) os.system(cmd) stdout = command.Output('python3-coverage', 'report') lines = stdout.splitlines()

At present binman's test coverage runs without a toolpath set. This means that the system tools will be used. That may not be correct if they are out of date or missing and this can result in a reduction in test coverage below 100%.
Provide the toolpath to binman in this case.
Signed-off-by: Simon Glass sjg@chromium.org ---
(no changes since v1)
tools/binman/main.py | 10 +++++++--- tools/patman/test_util.py | 9 ++++++--- 2 files changed, 13 insertions(+), 6 deletions(-)
Applied to u-boot-dm

When binman is run from 'make check' it is given a toolpath so that the latest tools (e.g. mkimage) are used. When run manually with no toolpath, it relies on the system mkimage. But this may be missing or old.
Make some effort to find the built-from-soruce version by looking in the current directory and in the builds created by 'make check'.
Signed-off-by: Simon Glass sjg@chromium.org ---
Changes in v3: - Set a default toolpath for ease of use
tools/binman/main.py | 5 +++++ 1 file changed, 5 insertions(+)
diff --git a/tools/binman/main.py b/tools/binman/main.py index a5793d5d23..e543a7d06a 100755 --- a/tools/binman/main.py +++ b/tools/binman/main.py @@ -113,6 +113,11 @@ def RunBinman(args): if not args.debug: sys.tracebacklimit = 0
+ # Provide a default toolpath in the hope of finding a mkimage built from + # current source + if not args.toolpath: + args.toolpath = ['./tools', 'build-sandbox/tools'] + if args.cmd == 'test': if args.test_coverage: RunTestCoverage(args.toolpath)

When binman is run from 'make check' it is given a toolpath so that the latest tools (e.g. mkimage) are used. When run manually with no toolpath, it relies on the system mkimage. But this may be missing or old.
Make some effort to find the built-from-soruce version by looking in the current directory and in the builds created by 'make check'.
Signed-off-by: Simon Glass sjg@chromium.org ---
Changes in v3: - Set a default toolpath for ease of use
tools/binman/main.py | 5 +++++ 1 file changed, 5 insertions(+)
Applied to u-boot-dm

As a first step to integrating mkimage into binman, add a new entry type that feeds data into mkimage for processing and incorporates that output into the image.
Signed-off-by: Simon Glass sjg@chromium.org ---
(no changes since v1)
tools/binman/README.entries | 23 ++++++++++++ tools/binman/etype/_testing.py | 5 +++ tools/binman/etype/mkimage.py | 62 +++++++++++++++++++++++++++++++ tools/binman/ftest.py | 7 ++++ tools/binman/test/156_mkimage.dts | 23 ++++++++++++ 5 files changed, 120 insertions(+) create mode 100644 tools/binman/etype/mkimage.py create mode 100644 tools/binman/test/156_mkimage.dts
diff --git a/tools/binman/README.entries b/tools/binman/README.entries index 6a816bba6b..4f2c48fdc2 100644 --- a/tools/binman/README.entries +++ b/tools/binman/README.entries @@ -587,6 +587,29 @@ See README.x86 for information about Intel binary blobs.
+Entry: mkimage: Entry containing a binary produced by mkimage +------------------------------------------------------------- + +Properties / Entry arguments: + - datafile: Filename for -d argument + - args: Other arguments to pass + +The data passed to mkimage is collected from subnodes of the mkimage node, +e.g.: + + mkimage { + args = "-n test -T imximage"; + + u-boot-spl { + }; + }; + +This calls mkimage to create an imximage with u-boot-spl.bin as the input +file. The output from mkimage then becomes part of the image produced by +binman. + + + Entry: powerpc-mpc85xx-bootpg-resetvec: PowerPC mpc85xx bootpg + resetvec code for U-Boot -----------------------------------------------------------------------------------------
diff --git a/tools/binman/etype/_testing.py b/tools/binman/etype/_testing.py index ed718eed14..ea60561adb 100644 --- a/tools/binman/etype/_testing.py +++ b/tools/binman/etype/_testing.py @@ -57,6 +57,8 @@ class Entry__testing(Entry): 'return-contents-once') self.bad_update_contents_twice = fdt_util.GetBool(self._node, 'bad-update-contents-twice') + self.return_contents_later = fdt_util.GetBool(self._node, + 'return-contents-later')
# Set to True when the entry is ready to process the FDT. self.process_fdt_ready = False @@ -83,6 +85,9 @@ class Entry__testing(Entry): def ObtainContents(self): if self.return_unknown_contents or not self.return_contents: return False + if self.return_contents_later: + self.return_contents_later = False + return False self.data = self.contents self.contents_size = len(self.data) if self.return_contents_once: diff --git a/tools/binman/etype/mkimage.py b/tools/binman/etype/mkimage.py new file mode 100644 index 0000000000..1aa563963a --- /dev/null +++ b/tools/binman/etype/mkimage.py @@ -0,0 +1,62 @@ +# SPDX-License-Identifier: GPL-2.0+ +# Copyright (c) 2016 Google, Inc +# Written by Simon Glass sjg@chromium.org +# +# Entry-type module for producing an image using mkimage +# + +from collections import OrderedDict + +from binman.entry import Entry +from dtoc import fdt_util +from patman import tools + +class Entry_mkimage(Entry): + """Entry containing a binary produced by mkimage + + Properties / Entry arguments: + - datafile: Filename for -d argument + - args: Other arguments to pass + + The data passed to mkimage is collected from subnodes of the mkimage node, + e.g.: + + mkimage { + args = "-n test -T imximage"; + + u-boot-spl { + }; + }; + + This calls mkimage to create an imximage with u-boot-spl.bin as the input + file. The output from mkimage then becomes part of the image produced by + binman. + """ + def __init__(self, section, etype, node): + Entry.__init__(self, section, etype, node) + self._args = fdt_util.GetString(self._node, 'args').split(' ') + self._mkimage_entries = OrderedDict() + self._ReadSubnodes() + + def ObtainContents(self): + data = b'' + for entry in self._mkimage_entries.values(): + # First get the input data and put it in a file. If not available, + # try later. + if not entry.ObtainContents(): + return False + data += entry.GetData() + uniq = self.GetUniqueName() + input_fname = tools.GetOutputFilename('mkimage.%s' % uniq) + tools.WriteFile(input_fname, data) + output_fname = tools.GetOutputFilename('mkimage-out.%s' % uniq) + tools.Run('mkimage', '-d', input_fname, *self._args, output_fname) + self.SetContents(tools.ReadFile(output_fname)) + return True + + def _ReadSubnodes(self): + """Read the subnodes to find out what should go in this image""" + for node in self._node.subnodes: + entry = Entry.Create(self, node) + entry.ReadNode() + self._mkimage_entries[entry.name] = entry diff --git a/tools/binman/ftest.py b/tools/binman/ftest.py index 5e24920088..39e67b9042 100644 --- a/tools/binman/ftest.py +++ b/tools/binman/ftest.py @@ -3357,6 +3357,13 @@ class TestFunctional(unittest.TestCase): data = self._DoReadFile('154_intel_fsp_t.dts') self.assertEqual(FSP_T_DATA, data[:len(FSP_T_DATA)])
+ def testMkimage(self): + """Test using mkimage to build an image""" + data = self._DoReadFile('156_mkimage.dts') + + # Just check that the data appears in the file somewhere + self.assertIn(U_BOOT_SPL_DATA, data) +
if __name__ == "__main__": unittest.main() diff --git a/tools/binman/test/156_mkimage.dts b/tools/binman/test/156_mkimage.dts new file mode 100644 index 0000000000..933b13143a --- /dev/null +++ b/tools/binman/test/156_mkimage.dts @@ -0,0 +1,23 @@ +// SPDX-License-Identifier: GPL-2.0+ + +/dts-v1/; + +/ { + #address-cells = <1>; + #size-cells = <1>; + + binman { + size = <0x80>; + + mkimage { + args = "-n test -T script"; + + u-boot-spl { + }; + + _testing { + return-contents-later; + }; + }; + }; +};

As a first step to integrating mkimage into binman, add a new entry type that feeds data into mkimage for processing and incorporates that output into the image.
Signed-off-by: Simon Glass sjg@chromium.org ---
(no changes since v1)
tools/binman/README.entries | 23 ++++++++++++ tools/binman/etype/_testing.py | 5 +++ tools/binman/etype/mkimage.py | 62 +++++++++++++++++++++++++++++++ tools/binman/ftest.py | 7 ++++ tools/binman/test/156_mkimage.dts | 23 ++++++++++++ 5 files changed, 120 insertions(+) create mode 100644 tools/binman/etype/mkimage.py create mode 100644 tools/binman/test/156_mkimage.dts
Applied to u-boot-dm

Some typos have been fixed in the generated entry docs but the code was not updated. Fix this.
Signed-off-by: Simon Glass sjg@chromium.org ---
Changes in v3: - Fix the code rather than breaking the README
tools/binman/etype/intel_me.py | 2 +- tools/binman/etype/powerpc_mpc85xx_bootpg_resetvec.py | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-)
diff --git a/tools/binman/etype/intel_me.py b/tools/binman/etype/intel_me.py index 41c9c6b920..2707ca6912 100644 --- a/tools/binman/etype/intel_me.py +++ b/tools/binman/etype/intel_me.py @@ -16,7 +16,7 @@ class Entry_intel_me(Entry_blob):
This file contains code used by the SoC that is required to make it work. The Management Engine is like a background task that runs things that are - not clearly documented, but may include keyboard, deplay and network + not clearly documented, but may include keyboard, display and network access. For platform that use ME it is not possible to disable it. U-Boot does not directly execute code in the ME binary.
diff --git a/tools/binman/etype/powerpc_mpc85xx_bootpg_resetvec.py b/tools/binman/etype/powerpc_mpc85xx_bootpg_resetvec.py index cefd425a5d..28005c60b3 100644 --- a/tools/binman/etype/powerpc_mpc85xx_bootpg_resetvec.py +++ b/tools/binman/etype/powerpc_mpc85xx_bootpg_resetvec.py @@ -13,7 +13,7 @@ class Entry_powerpc_mpc85xx_bootpg_resetvec(Entry_blob): Properties / Entry arguments: - filename: Filename of u-boot-br.bin (default 'u-boot-br.bin')
- This enrty is valid for PowerPC mpc85xx cpus. This entry holds + This entry is valid for PowerPC mpc85xx cpus. This entry holds 'bootpg + resetvec' code for PowerPC mpc85xx CPUs which needs to be placed at offset 'RESET_VECTOR_ADDRESS - 0xffc'. """

Some typos have been fixed in the generated entry docs but the code was not updated. Fix this.
Signed-off-by: Simon Glass sjg@chromium.org ---
Changes in v3: - Fix the code rather than breaking the README
tools/binman/etype/intel_me.py | 2 +- tools/binman/etype/powerpc_mpc85xx_bootpg_resetvec.py | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-)
Applied to u-boot-dm

If the pylibfdt shared-object file is detected, then Python assumes that the libfdt.py file exists also.
Sometimes when an incremental build aborts, the shared-object file is built but the libfdt.py is not. The only way out at this point is to use 'make mkproper', or similar.
Fix this by removing the .so file before it is built. This seems to make Python rebuild everything.
Signed-off-by: Simon Glass sjg@chromium.org Reviewed-by: Bin Meng bmeng.cn@gmail.com ---
(no changes since v1)
scripts/dtc/pylibfdt/Makefile | 3 +++ 1 file changed, 3 insertions(+)
diff --git a/scripts/dtc/pylibfdt/Makefile b/scripts/dtc/pylibfdt/Makefile index 42342c75bb..80b6ad2ae7 100644 --- a/scripts/dtc/pylibfdt/Makefile +++ b/scripts/dtc/pylibfdt/Makefile @@ -24,6 +24,9 @@ quiet_cmd_pymod = PYMOD $@ $(PYTHON3) $< --quiet build_ext --inplace
$(obj)/_libfdt.so: $(src)/setup.py $(PYLIBFDT_srcs) FORCE + @# Remove the library since otherwise Python doesn't seem to regenerate + @# the libfdt.py file if it is missing. + rm -f $(obj)/_libfdt*.so $(call if_changed,pymod)
always += _libfdt.so

If the pylibfdt shared-object file is detected, then Python assumes that the libfdt.py file exists also.
Sometimes when an incremental build aborts, the shared-object file is built but the libfdt.py is not. The only way out at this point is to use 'make mkproper', or similar.
Fix this by removing the .so file before it is built. This seems to make Python rebuild everything.
Signed-off-by: Simon Glass sjg@chromium.org Reviewed-by: Bin Meng bmeng.cn@gmail.com ---
(no changes since v1)
scripts/dtc/pylibfdt/Makefile | 3 +++ 1 file changed, 3 insertions(+)
Applied to u-boot-dm

With the change to absolute imports the concurrent tests feature unfortunately broke. Fix it.
We cannot easy add a warning, since the output messes up tests which check the output.
Signed-off-by: Simon Glass sjg@chromium.org ---
(no changes since v1)
tools/patman/test_util.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-)
diff --git a/tools/patman/test_util.py b/tools/patman/test_util.py index 5eed461995..92e96f9159 100644 --- a/tools/patman/test_util.py +++ b/tools/patman/test_util.py @@ -16,7 +16,8 @@ from io import StringIO
use_concurrent = True try: - from concurrencytest import ConcurrentTestSuite, fork_for_tests + from concurrencytest.concurrencytest import ConcurrentTestSuite + from concurrencytest.concurrencytest import fork_for_tests except: use_concurrent = False
@@ -50,6 +51,7 @@ def RunTestCoverage(prog, filter_fname, exclude_list, build_dir, required=None, glob_list = [] glob_list += exclude_list glob_list += ['*libfdt.py', '*site-packages*', '*dist-packages*'] + glob_list += ['*concurrencytest*'] test_cmd = 'test' if 'binman' in prog else '-t' prefix = '' if build_dir:

With the change to absolute imports the concurrent tests feature unfortunately broke. Fix it.
We cannot easy add a warning, since the output messes up tests which check the output.
Signed-off-by: Simon Glass sjg@chromium.org ---
(no changes since v1)
tools/patman/test_util.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-)
Applied to u-boot-dm

It is easier and less error-prone to use super() when the parent type is needed. Update binman to remove the type names.
Signed-off-by: Simon Glass sjg@chromium.org Reviewed-by: Bin Meng bmeng.cn@gmail.com ---
(no changes since v1)
tools/binman/etype/_testing.py | 4 ++-- tools/binman/etype/blob.py | 2 +- tools/binman/etype/blob_dtb.py | 6 +++--- tools/binman/etype/blob_named_by_arg.py | 2 +- tools/binman/etype/cbfs.py | 14 +++++++------- tools/binman/etype/cros_ec_rw.py | 3 +-- tools/binman/etype/fdtmap.py | 2 +- tools/binman/etype/files.py | 2 +- tools/binman/etype/fill.py | 4 ++-- tools/binman/etype/fmap.py | 2 +- tools/binman/etype/gbb.py | 2 +- tools/binman/etype/image_header.py | 4 ++-- tools/binman/etype/intel_cmc.py | 2 +- tools/binman/etype/intel_descriptor.py | 4 ++-- tools/binman/etype/intel_fit.py | 4 ++-- tools/binman/etype/intel_fit_ptr.py | 4 ++-- tools/binman/etype/intel_fsp.py | 2 +- tools/binman/etype/intel_fsp_m.py | 2 +- tools/binman/etype/intel_fsp_s.py | 2 +- tools/binman/etype/intel_fsp_t.py | 2 +- tools/binman/etype/intel_ifwi.py | 4 ++-- tools/binman/etype/intel_me.py | 2 +- tools/binman/etype/intel_mrc.py | 2 +- tools/binman/etype/intel_refcode.py | 2 +- tools/binman/etype/intel_vbt.py | 2 +- tools/binman/etype/intel_vga.py | 2 +- tools/binman/etype/mkimage.py | 2 +- .../etype/powerpc_mpc85xx_bootpg_resetvec.py | 2 +- tools/binman/etype/section.py | 16 ++++++++-------- tools/binman/etype/text.py | 2 +- tools/binman/etype/u_boot.py | 2 +- tools/binman/etype/u_boot_dtb.py | 2 +- tools/binman/etype/u_boot_dtb_with_ucode.py | 4 ++-- tools/binman/etype/u_boot_elf.py | 4 ++-- tools/binman/etype/u_boot_img.py | 2 +- tools/binman/etype/u_boot_nodtb.py | 2 +- tools/binman/etype/u_boot_spl.py | 2 +- tools/binman/etype/u_boot_spl_bss_pad.py | 2 +- tools/binman/etype/u_boot_spl_dtb.py | 2 +- tools/binman/etype/u_boot_spl_elf.py | 2 +- tools/binman/etype/u_boot_spl_nodtb.py | 2 +- tools/binman/etype/u_boot_spl_with_ucode_ptr.py | 2 +- tools/binman/etype/u_boot_tpl.py | 2 +- tools/binman/etype/u_boot_tpl_dtb.py | 2 +- tools/binman/etype/u_boot_tpl_dtb_with_ucode.py | 2 +- tools/binman/etype/u_boot_tpl_elf.py | 2 +- tools/binman/etype/u_boot_tpl_with_ucode_ptr.py | 2 +- tools/binman/etype/u_boot_ucode.py | 2 +- tools/binman/etype/u_boot_with_ucode_ptr.py | 2 +- tools/binman/etype/vblock.py | 2 +- tools/binman/etype/x86_reset16.py | 2 +- tools/binman/etype/x86_reset16_spl.py | 2 +- tools/binman/etype/x86_reset16_tpl.py | 2 +- tools/binman/etype/x86_start16.py | 2 +- tools/binman/etype/x86_start16_spl.py | 2 +- tools/binman/etype/x86_start16_tpl.py | 2 +- tools/binman/image.py | 12 ++++++------ 57 files changed, 86 insertions(+), 87 deletions(-)
diff --git a/tools/binman/etype/_testing.py b/tools/binman/etype/_testing.py index ea60561adb..0800c25899 100644 --- a/tools/binman/etype/_testing.py +++ b/tools/binman/etype/_testing.py @@ -41,10 +41,10 @@ class Entry__testing(Entry): data type (generating an error) """ def __init__(self, section, etype, node): - Entry.__init__(self, section, etype, node) + super().__init__(section, etype, node)
def ReadNode(self): - Entry.ReadNode(self) + super().ReadNode() self.return_invalid_entry = fdt_util.GetBool(self._node, 'return-invalid-entry') self.return_unknown_contents = fdt_util.GetBool(self._node, diff --git a/tools/binman/etype/blob.py b/tools/binman/etype/blob.py index ede7a7a68c..e507203709 100644 --- a/tools/binman/etype/blob.py +++ b/tools/binman/etype/blob.py @@ -31,7 +31,7 @@ class Entry_blob(Entry): data. """ def __init__(self, section, etype, node): - Entry.__init__(self, section, etype, node) + super().__init__(section, etype, node) self._filename = fdt_util.GetString(self._node, 'filename', self.etype) self.compress = fdt_util.GetString(self._node, 'compress', 'none')
diff --git a/tools/binman/etype/blob_dtb.py b/tools/binman/etype/blob_dtb.py index 6c06943763..724647a7bb 100644 --- a/tools/binman/etype/blob_dtb.py +++ b/tools/binman/etype/blob_dtb.py @@ -20,13 +20,13 @@ class Entry_blob_dtb(Entry_blob): global state from binman import state
- Entry_blob.__init__(self, section, etype, node) + super().__init__(section, etype, node)
def ObtainContents(self): """Get the device-tree from the list held by the 'state' module""" self._filename = self.GetDefaultFilename() self._pathname, _ = state.GetFdtContents(self.GetFdtEtype()) - return Entry_blob.ReadBlobContents(self) + return super().ReadBlobContents()
def ProcessContents(self): """Re-read the DTB contents so that we get any calculated properties""" @@ -57,7 +57,7 @@ class Entry_blob_dtb(Entry_blob): return {self.GetFdtEtype(): [self, fname]}
def WriteData(self, data, decomp=True): - ok = Entry_blob.WriteData(self, data, decomp) + ok = super().WriteData(data, decomp)
# Update the state module, since it has the authoritative record of the # device trees used. If we don't do this, then state.GetFdtContents() diff --git a/tools/binman/etype/blob_named_by_arg.py b/tools/binman/etype/blob_named_by_arg.py index 3b4593f071..e95dabe4d0 100644 --- a/tools/binman/etype/blob_named_by_arg.py +++ b/tools/binman/etype/blob_named_by_arg.py @@ -29,6 +29,6 @@ class Entry_blob_named_by_arg(Entry_blob): See cros_ec_rw for an example of this. """ def __init__(self, section, etype, node, blob_fname): - Entry_blob.__init__(self, section, etype, node) + super().__init__(section, etype, node) self._filename, = self.GetEntryArgsOrProps( [EntryArg('%s-path' % blob_fname, str)]) diff --git a/tools/binman/etype/cbfs.py b/tools/binman/etype/cbfs.py index 744a32fa0c..650ab2c292 100644 --- a/tools/binman/etype/cbfs.py +++ b/tools/binman/etype/cbfs.py @@ -167,7 +167,7 @@ class Entry_cbfs(Entry): global state from binman import state
- Entry.__init__(self, section, etype, node) + super().__init__(section, etype, node) self._cbfs_arg = fdt_util.GetString(node, 'cbfs-arch', 'x86') self._cbfs_entries = OrderedDict() self._ReadSubnodes() @@ -226,7 +226,7 @@ class Entry_cbfs(Entry): Args: image_pos: Position of this entry in the image """ - Entry.SetImagePos(self, image_pos) + super().SetImagePos(image_pos)
# Now update the entries with info from the CBFS entries for entry in self._cbfs_entries.values(): @@ -238,7 +238,7 @@ class Entry_cbfs(Entry): entry.uncomp_size = cfile.memlen
def AddMissingProperties(self): - Entry.AddMissingProperties(self) + super().AddMissingProperties() for entry in self._cbfs_entries.values(): entry.AddMissingProperties() if entry._cbfs_compress: @@ -250,7 +250,7 @@ class Entry_cbfs(Entry):
def SetCalculatedProperties(self): """Set the value of device-tree properties calculated by binman""" - Entry.SetCalculatedProperties(self) + super().SetCalculatedProperties() for entry in self._cbfs_entries.values(): state.SetInt(entry._node, 'offset', entry.offset) state.SetInt(entry._node, 'size', entry.size) @@ -260,7 +260,7 @@ class Entry_cbfs(Entry):
def ListEntries(self, entries, indent): """Override this method to list all files in the section""" - Entry.ListEntries(self, entries, indent) + super().ListEntries(entries, indent) for entry in self._cbfs_entries.values(): entry.ListEntries(entries, indent + 1)
@@ -268,12 +268,12 @@ class Entry_cbfs(Entry): return self._cbfs_entries
def ReadData(self, decomp=True): - data = Entry.ReadData(self, True) + data = super().ReadData(True) return data
def ReadChildData(self, child, decomp=True): if not self.reader: - data = Entry.ReadData(self, True) + data = super().ReadData(True) self.reader = cbfs_util.CbfsReader(data) reader = self.reader cfile = reader.files.get(child.name) diff --git a/tools/binman/etype/cros_ec_rw.py b/tools/binman/etype/cros_ec_rw.py index 0dbe14b342..7ad62d0265 100644 --- a/tools/binman/etype/cros_ec_rw.py +++ b/tools/binman/etype/cros_ec_rw.py @@ -18,5 +18,4 @@ class Entry_cros_ec_rw(Entry_blob_named_by_arg): updating the EC on startup via software sync. """ def __init__(self, section, etype, node): - Entry_blob_named_by_arg.__init__(self, section, etype, node, - 'cros-ec-rw') + super().__init__(section, etype, node, 'cros-ec-rw') diff --git a/tools/binman/etype/fdtmap.py b/tools/binman/etype/fdtmap.py index aa8807990b..6ca88a100e 100644 --- a/tools/binman/etype/fdtmap.py +++ b/tools/binman/etype/fdtmap.py @@ -85,7 +85,7 @@ class Entry_fdtmap(Entry): from binman import state from dtoc.fdt import Fdt
- Entry.__init__(self, section, etype, node) + super().__init__(section, etype, node)
def _GetFdtmap(self): """Build an FDT map from the entries in the current image diff --git a/tools/binman/etype/files.py b/tools/binman/etype/files.py index 10ab585f0e..9adb3afeb1 100644 --- a/tools/binman/etype/files.py +++ b/tools/binman/etype/files.py @@ -32,7 +32,7 @@ class Entry_files(Entry_section): global state from binman import state
- Entry_section.__init__(self, section, etype, node) + super().__init__(section, etype, node) self._pattern = fdt_util.GetString(self._node, 'pattern') if not self._pattern: self.Raise("Missing 'pattern' property") diff --git a/tools/binman/etype/fill.py b/tools/binman/etype/fill.py index 860410ed6e..efb2d13e91 100644 --- a/tools/binman/etype/fill.py +++ b/tools/binman/etype/fill.py @@ -22,10 +22,10 @@ class Entry_fill(Entry): byte value of a region. """ def __init__(self, section, etype, node): - Entry.__init__(self, section, etype, node) + super().__init__(section, etype, node)
def ReadNode(self): - Entry.ReadNode(self) + super().ReadNode() if self.size is None: self.Raise("'fill' entry must have a size property") self.fill_value = fdt_util.GetByte(self._node, 'fill-byte', 0) diff --git a/tools/binman/etype/fmap.py b/tools/binman/etype/fmap.py index a43fac38de..3e9b815d11 100644 --- a/tools/binman/etype/fmap.py +++ b/tools/binman/etype/fmap.py @@ -32,7 +32,7 @@ class Entry_fmap(Entry): the sub-entries are ignored. """ def __init__(self, section, etype, node): - Entry.__init__(self, section, etype, node) + super().__init__(section, etype, node)
def _GetFmap(self): """Build an FMAP from the entries in the current image diff --git a/tools/binman/etype/gbb.py b/tools/binman/etype/gbb.py index dd10599717..41554eba8f 100644 --- a/tools/binman/etype/gbb.py +++ b/tools/binman/etype/gbb.py @@ -54,7 +54,7 @@ class Entry_gbb(Entry): README.chromium for how to obtain the required keys and tools. """ def __init__(self, section, etype, node): - Entry.__init__(self, section, etype, node) + super().__init__(section, etype, node) self.hardware_id, self.keydir, self.bmpblk = self.GetEntryArgsOrProps( [EntryArg('hardware-id', str), EntryArg('keydir', str), diff --git a/tools/binman/etype/image_header.py b/tools/binman/etype/image_header.py index 176bdeb29b..2401188495 100644 --- a/tools/binman/etype/image_header.py +++ b/tools/binman/etype/image_header.py @@ -57,7 +57,7 @@ class Entry_image_header(Entry): first/last in the entry list. """ def __init__(self, section, etype, node): - Entry.__init__(self, section, etype, node) + super().__init__(section, etype, node) self.location = fdt_util.GetString(self._node, 'location')
def _GetHeader(self): @@ -101,7 +101,7 @@ class Entry_image_header(Entry): else: offset = image_size - IMAGE_HEADER_LEN offset += self.section.GetStartOffset() - return Entry.Pack(self, offset) + return super().Pack(offset)
def ProcessContents(self): """Write an updated version of the FDT map to this entry diff --git a/tools/binman/etype/intel_cmc.py b/tools/binman/etype/intel_cmc.py index 5e6edbe4df..9ab471e7b6 100644 --- a/tools/binman/etype/intel_cmc.py +++ b/tools/binman/etype/intel_cmc.py @@ -20,4 +20,4 @@ class Entry_intel_cmc(Entry_blob): See README.x86 for information about x86 binary blobs. """ def __init__(self, section, etype, node): - Entry_blob.__init__(self, section, etype, node) + super().__init__(section, etype, node) diff --git a/tools/binman/etype/intel_descriptor.py b/tools/binman/etype/intel_descriptor.py index d4d7a26901..6afc42ece5 100644 --- a/tools/binman/etype/intel_descriptor.py +++ b/tools/binman/etype/intel_descriptor.py @@ -45,14 +45,14 @@ class Entry_intel_descriptor(Entry_blob): See README.x86 for information about x86 binary blobs. """ def __init__(self, section, etype, node): - Entry_blob.__init__(self, section, etype, node) + super().__init__(section, etype, node) self._regions = []
def Pack(self, offset): """Put this entry at the start of the image""" if self.offset is None: offset = self.section.GetStartOffset() - return Entry_blob.Pack(self, offset) + return super().Pack(offset)
def GetOffsets(self): offset = self.data.find(FD_SIGNATURE) diff --git a/tools/binman/etype/intel_fit.py b/tools/binman/etype/intel_fit.py index ea482a6125..ad6c1caa85 100644 --- a/tools/binman/etype/intel_fit.py +++ b/tools/binman/etype/intel_fit.py @@ -19,11 +19,11 @@ class Entry_intel_fit(Entry_blob): At present binman only supports a basic FIT with no microcode. """ def __init__(self, section, etype, node): - Entry_blob.__init__(self, section, etype, node) + super().__init__(section, etype, node)
def ReadNode(self): """Force 16-byte alignment as required by FIT pointer""" - Entry_blob.ReadNode(self) + super().ReadNode() self.align = 16
def ObtainContents(self): diff --git a/tools/binman/etype/intel_fit_ptr.py b/tools/binman/etype/intel_fit_ptr.py index df118a68f2..a06d12e740 100644 --- a/tools/binman/etype/intel_fit_ptr.py +++ b/tools/binman/etype/intel_fit_ptr.py @@ -16,7 +16,7 @@ class Entry_intel_fit_ptr(Entry_blob): 0xffffffc0 in the image. """ def __init__(self, section, etype, node): - Entry_blob.__init__(self, section, etype, node) + super().__init__(section, etype, node) if self.HasSibling('intel-fit') is False: self.Raise("'intel-fit-ptr' section must have an 'intel-fit' sibling")
@@ -38,4 +38,4 @@ class Entry_intel_fit_ptr(Entry_blob):
def Pack(self, offset): """Special pack method to set the offset to the right place""" - return Entry_blob.Pack(self, 0xffffffc0) + return super().Pack(0xffffffc0) diff --git a/tools/binman/etype/intel_fsp.py b/tools/binman/etype/intel_fsp.py index 7db3d96b43..a1c89adcea 100644 --- a/tools/binman/etype/intel_fsp.py +++ b/tools/binman/etype/intel_fsp.py @@ -24,4 +24,4 @@ class Entry_intel_fsp(Entry_blob): See README.x86 for information about x86 binary blobs. """ def __init__(self, section, etype, node): - Entry_blob.__init__(self, section, etype, node) + super().__init__(section, etype, node) diff --git a/tools/binman/etype/intel_fsp_m.py b/tools/binman/etype/intel_fsp_m.py index 51b4e7e1ac..4c225b24d3 100644 --- a/tools/binman/etype/intel_fsp_m.py +++ b/tools/binman/etype/intel_fsp_m.py @@ -24,4 +24,4 @@ class Entry_intel_fsp_m(Entry_blob): See README.x86 for information about x86 binary blobs. """ def __init__(self, section, etype, node): - Entry_blob.__init__(self, section, etype, node) + super().__init__(section, etype, node) diff --git a/tools/binman/etype/intel_fsp_s.py b/tools/binman/etype/intel_fsp_s.py index b3683e476a..9e1107182a 100644 --- a/tools/binman/etype/intel_fsp_s.py +++ b/tools/binman/etype/intel_fsp_s.py @@ -24,4 +24,4 @@ class Entry_intel_fsp_s(Entry_blob): See README.x86 for information about x86 binary blobs. """ def __init__(self, section, etype, node): - Entry_blob.__init__(self, section, etype, node) + super().__init__(section, etype, node) diff --git a/tools/binman/etype/intel_fsp_t.py b/tools/binman/etype/intel_fsp_t.py index 0f196f0f1c..5dca145a3f 100644 --- a/tools/binman/etype/intel_fsp_t.py +++ b/tools/binman/etype/intel_fsp_t.py @@ -23,4 +23,4 @@ class Entry_intel_fsp_t(Entry_blob): See README.x86 for information about x86 binary blobs. """ def __init__(self, section, etype, node): - Entry_blob.__init__(self, section, etype, node) + super().__init__(section, etype, node) diff --git a/tools/binman/etype/intel_ifwi.py b/tools/binman/etype/intel_ifwi.py index 6a96f6be55..ba63f6574f 100644 --- a/tools/binman/etype/intel_ifwi.py +++ b/tools/binman/etype/intel_ifwi.py @@ -45,13 +45,13 @@ class Entry_intel_ifwi(Entry_blob): See README.x86 for information about x86 binary blobs. """ def __init__(self, section, etype, node): - Entry_blob.__init__(self, section, etype, node) + super().__init__(section, etype, node) self._convert_fit = fdt_util.GetBool(self._node, 'convert-fit') self._ifwi_entries = OrderedDict()
def ReadNode(self): self._ReadSubnodes() - Entry_blob.ReadNode(self) + super().ReadNode()
def _BuildIfwi(self): """Build the contents of the IFWI and write it to the 'data' property""" diff --git a/tools/binman/etype/intel_me.py b/tools/binman/etype/intel_me.py index 2707ca6912..6b3803819e 100644 --- a/tools/binman/etype/intel_me.py +++ b/tools/binman/etype/intel_me.py @@ -27,4 +27,4 @@ class Entry_intel_me(Entry_blob): See README.x86 for information about x86 binary blobs. """ def __init__(self, section, etype, node): - Entry_blob.__init__(self, section, etype, node) + super().__init__(section, etype, node) diff --git a/tools/binman/etype/intel_mrc.py b/tools/binman/etype/intel_mrc.py index 854a4dda61..74781848e2 100644 --- a/tools/binman/etype/intel_mrc.py +++ b/tools/binman/etype/intel_mrc.py @@ -21,7 +21,7 @@ class Entry_intel_mrc(Entry_blob): See README.x86 for information about x86 binary blobs. """ def __init__(self, section, etype, node): - Entry_blob.__init__(self, section, etype, node) + super().__init__(section, etype, node)
def GetDefaultFilename(self): return 'mrc.bin' diff --git a/tools/binman/etype/intel_refcode.py b/tools/binman/etype/intel_refcode.py index a1059f787e..5754fec4f8 100644 --- a/tools/binman/etype/intel_refcode.py +++ b/tools/binman/etype/intel_refcode.py @@ -21,7 +21,7 @@ class Entry_intel_refcode(Entry_blob): See README.x86 for information about x86 binary blobs. """ def __init__(self, section, etype, node): - Entry_blob.__init__(self, section, etype, node) + super().__init__(section, etype, node)
def GetDefaultFilename(self): return 'refcode.bin' diff --git a/tools/binman/etype/intel_vbt.py b/tools/binman/etype/intel_vbt.py index 4d465ad017..f6d7b466ea 100644 --- a/tools/binman/etype/intel_vbt.py +++ b/tools/binman/etype/intel_vbt.py @@ -19,4 +19,4 @@ class Entry_intel_vbt(Entry_blob): See README.x86 for information about Intel binary blobs. """ def __init__(self, section, etype, node): - Entry_blob.__init__(self, section, etype, node) + super().__init__(section, etype, node) diff --git a/tools/binman/etype/intel_vga.py b/tools/binman/etype/intel_vga.py index 04cd72f3dc..6b87c01b4c 100644 --- a/tools/binman/etype/intel_vga.py +++ b/tools/binman/etype/intel_vga.py @@ -22,4 +22,4 @@ class Entry_intel_vga(Entry_blob): See README.x86 for information about Intel binary blobs. """ def __init__(self, section, etype, node): - Entry_blob.__init__(self, section, etype, node) + super().__init__(section, etype, node) diff --git a/tools/binman/etype/mkimage.py b/tools/binman/etype/mkimage.py index 1aa563963a..8fddc88118 100644 --- a/tools/binman/etype/mkimage.py +++ b/tools/binman/etype/mkimage.py @@ -33,7 +33,7 @@ class Entry_mkimage(Entry): binman. """ def __init__(self, section, etype, node): - Entry.__init__(self, section, etype, node) + super().__init__(section, etype, node) self._args = fdt_util.GetString(self._node, 'args').split(' ') self._mkimage_entries = OrderedDict() self._ReadSubnodes() diff --git a/tools/binman/etype/powerpc_mpc85xx_bootpg_resetvec.py b/tools/binman/etype/powerpc_mpc85xx_bootpg_resetvec.py index 28005c60b3..b0fa75fbf8 100644 --- a/tools/binman/etype/powerpc_mpc85xx_bootpg_resetvec.py +++ b/tools/binman/etype/powerpc_mpc85xx_bootpg_resetvec.py @@ -19,7 +19,7 @@ class Entry_powerpc_mpc85xx_bootpg_resetvec(Entry_blob): """
def __init__(self, section, etype, node): - Entry_blob.__init__(self, section, etype, node) + super().__init__(section, etype, node)
def GetDefaultFilename(self): return 'u-boot-br.bin' diff --git a/tools/binman/etype/section.py b/tools/binman/etype/section.py index 91b8e0c110..f108121c3a 100644 --- a/tools/binman/etype/section.py +++ b/tools/binman/etype/section.py @@ -43,7 +43,7 @@ class Entry_section(Entry): """ def __init__(self, section, etype, node, test=False): if not test: - Entry.__init__(self, section, etype, node) + super().__init__(section, etype, node) self._entries = OrderedDict() self._pad_byte = 0 self._sort = False @@ -52,7 +52,7 @@ class Entry_section(Entry):
def ReadNode(self): """Read properties from the image node""" - Entry.ReadNode(self) + super().ReadNode() self._pad_byte = fdt_util.GetInt(self._node, 'pad-byte', 0) self._sort = fdt_util.GetBool(self._node, 'sort-by-offset') self._end_4gb = fdt_util.GetBool(self._node, 'end-at-4gb') @@ -126,13 +126,13 @@ class Entry_section(Entry): a section containing a list of files. Process these entries so that this information is added to the device tree. """ - Entry.ExpandEntries(self) + super().ExpandEntries() for entry in self._entries.values(): entry.ExpandEntries()
def AddMissingProperties(self): """Add new properties to the device tree as needed for this entry""" - Entry.AddMissingProperties(self) + super().AddMissingProperties() for entry in self._entries.values(): entry.AddMissingProperties()
@@ -168,14 +168,14 @@ class Entry_section(Entry):
def ResetForPack(self): """Reset offset/size fields so that packing can be done again""" - Entry.ResetForPack(self) + super().ResetForPack() for entry in self._entries.values(): entry.ResetForPack()
def Pack(self, offset): """Pack all entries into the section""" self._PackEntries() - return Entry.Pack(self, offset) + return super().Pack(offset)
def _PackEntries(self): """Pack all entries into the image""" @@ -232,12 +232,12 @@ class Entry_section(Entry): entry.WriteSymbols(self)
def SetCalculatedProperties(self): - Entry.SetCalculatedProperties(self) + super().SetCalculatedProperties() for entry in self._entries.values(): entry.SetCalculatedProperties()
def SetImagePos(self, image_pos): - Entry.SetImagePos(self, image_pos) + super().SetImagePos(image_pos) for entry in self._entries.values(): entry.SetImagePos(image_pos + self.offset)
diff --git a/tools/binman/etype/text.py b/tools/binman/etype/text.py index 3577135adb..a69c2a4ec4 100644 --- a/tools/binman/etype/text.py +++ b/tools/binman/etype/text.py @@ -57,7 +57,7 @@ class Entry_text(Entry): by setting the size of the entry to something larger than the text. """ def __init__(self, section, etype, node): - Entry.__init__(self, section, etype, node) + super().__init__(section, etype, node) value = fdt_util.GetString(self._node, 'text') if value: value = tools.ToBytes(value) diff --git a/tools/binman/etype/u_boot.py b/tools/binman/etype/u_boot.py index ab1019b00c..4767197e13 100644 --- a/tools/binman/etype/u_boot.py +++ b/tools/binman/etype/u_boot.py @@ -26,7 +26,7 @@ class Entry_u_boot(Entry_blob): in the binman README for more information. """ def __init__(self, section, etype, node): - Entry_blob.__init__(self, section, etype, node) + super().__init__(section, etype, node)
def GetDefaultFilename(self): return 'u-boot.bin' diff --git a/tools/binman/etype/u_boot_dtb.py b/tools/binman/etype/u_boot_dtb.py index e98350088f..65e71291d2 100644 --- a/tools/binman/etype/u_boot_dtb.py +++ b/tools/binman/etype/u_boot_dtb.py @@ -22,7 +22,7 @@ class Entry_u_boot_dtb(Entry_blob_dtb): binman to know which entries contain a device tree. """ def __init__(self, section, etype, node): - Entry_blob_dtb.__init__(self, section, etype, node) + super().__init__(section, etype, node)
def GetDefaultFilename(self): return 'u-boot.dtb' diff --git a/tools/binman/etype/u_boot_dtb_with_ucode.py b/tools/binman/etype/u_boot_dtb_with_ucode.py index aec145533e..66a9db55ca 100644 --- a/tools/binman/etype/u_boot_dtb_with_ucode.py +++ b/tools/binman/etype/u_boot_dtb_with_ucode.py @@ -28,7 +28,7 @@ class Entry_u_boot_dtb_with_ucode(Entry_blob_dtb): global state from binman import state
- Entry_blob_dtb.__init__(self, section, etype, node) + super().__init__(section, etype, node) self.ucode_data = b'' self.collate = False self.ucode_offset = None @@ -78,7 +78,7 @@ class Entry_u_boot_dtb_with_ucode(Entry_blob_dtb):
def ObtainContents(self): # Call the base class just in case it does something important. - Entry_blob_dtb.ObtainContents(self) + super().ObtainContents() if self.ucode and not self.collate: for node in self.ucode.subnodes: data_prop = node.props.get('data') diff --git a/tools/binman/etype/u_boot_elf.py b/tools/binman/etype/u_boot_elf.py index 5f906e520c..6614a75faf 100644 --- a/tools/binman/etype/u_boot_elf.py +++ b/tools/binman/etype/u_boot_elf.py @@ -21,7 +21,7 @@ class Entry_u_boot_elf(Entry_blob): relocated to any address for execution. """ def __init__(self, section, etype, node): - Entry_blob.__init__(self, section, etype, node) + super().__init__(section, etype, node) self._strip = fdt_util.GetBool(self._node, 'strip')
def ReadBlobContents(self): @@ -31,7 +31,7 @@ class Entry_u_boot_elf(Entry_blob): tools.WriteFile(out_fname, tools.ReadFile(self._pathname)) tools.Run('strip', out_fname) self._pathname = out_fname - Entry_blob.ReadBlobContents(self) + super().ReadBlobContents() return True
def GetDefaultFilename(self): diff --git a/tools/binman/etype/u_boot_img.py b/tools/binman/etype/u_boot_img.py index 50cc71d3ce..8a739d8edb 100644 --- a/tools/binman/etype/u_boot_img.py +++ b/tools/binman/etype/u_boot_img.py @@ -21,7 +21,7 @@ class Entry_u_boot_img(Entry_blob): applications. """ def __init__(self, section, etype, node): - Entry_blob.__init__(self, section, etype, node) + super().__init__(section, etype, node)
def GetDefaultFilename(self): return 'u-boot.img' diff --git a/tools/binman/etype/u_boot_nodtb.py b/tools/binman/etype/u_boot_nodtb.py index e8c0e1a1d6..e84df490f6 100644 --- a/tools/binman/etype/u_boot_nodtb.py +++ b/tools/binman/etype/u_boot_nodtb.py @@ -21,7 +21,7 @@ class Entry_u_boot_nodtb(Entry_blob): U-Boot and the device tree). """ def __init__(self, section, etype, node): - Entry_blob.__init__(self, section, etype, node) + super().__init__(section, etype, node)
def GetDefaultFilename(self): return 'u-boot-nodtb.bin' diff --git a/tools/binman/etype/u_boot_spl.py b/tools/binman/etype/u_boot_spl.py index a6fddbe8f1..d66e46140b 100644 --- a/tools/binman/etype/u_boot_spl.py +++ b/tools/binman/etype/u_boot_spl.py @@ -32,7 +32,7 @@ class Entry_u_boot_spl(Entry_blob): binman uses that to look up symbols to write into the SPL binary. """ def __init__(self, section, etype, node): - Entry_blob.__init__(self, section, etype, node) + super().__init__(section, etype, node) self.elf_fname = 'spl/u-boot-spl'
def GetDefaultFilename(self): diff --git a/tools/binman/etype/u_boot_spl_bss_pad.py b/tools/binman/etype/u_boot_spl_bss_pad.py index a6a177a128..596b2bed97 100644 --- a/tools/binman/etype/u_boot_spl_bss_pad.py +++ b/tools/binman/etype/u_boot_spl_bss_pad.py @@ -31,7 +31,7 @@ class Entry_u_boot_spl_bss_pad(Entry_blob): binman uses that to look up the BSS address. """ def __init__(self, section, etype, node): - Entry_blob.__init__(self, section, etype, node) + super().__init__(section, etype, node)
def ObtainContents(self): fname = tools.GetInputFilename('spl/u-boot-spl') diff --git a/tools/binman/etype/u_boot_spl_dtb.py b/tools/binman/etype/u_boot_spl_dtb.py index a0761eeacd..eefc4a44aa 100644 --- a/tools/binman/etype/u_boot_spl_dtb.py +++ b/tools/binman/etype/u_boot_spl_dtb.py @@ -19,7 +19,7 @@ class Entry_u_boot_spl_dtb(Entry_blob_dtb): to activate. """ def __init__(self, section, etype, node): - Entry_blob_dtb.__init__(self, section, etype, node) + super().__init__(section, etype, node)
def GetDefaultFilename(self): return 'spl/u-boot-spl.dtb' diff --git a/tools/binman/etype/u_boot_spl_elf.py b/tools/binman/etype/u_boot_spl_elf.py index f99f74abab..7f1236bcbb 100644 --- a/tools/binman/etype/u_boot_spl_elf.py +++ b/tools/binman/etype/u_boot_spl_elf.py @@ -18,7 +18,7 @@ class Entry_u_boot_spl_elf(Entry_blob): be relocated to any address for execution. """ def __init__(self, section, etype, node): - Entry_blob.__init__(self, section, etype, node) + super().__init__(section, etype, node)
def GetDefaultFilename(self): return 'spl/u-boot-spl' diff --git a/tools/binman/etype/u_boot_spl_nodtb.py b/tools/binman/etype/u_boot_spl_nodtb.py index 072b915ff3..6f4529396d 100644 --- a/tools/binman/etype/u_boot_spl_nodtb.py +++ b/tools/binman/etype/u_boot_spl_nodtb.py @@ -22,7 +22,7 @@ class Entry_u_boot_spl_nodtb(Entry_blob): both SPL and the device tree). """ def __init__(self, section, etype, node): - Entry_blob.__init__(self, section, etype, node) + super().__init__(section, etype, node)
def GetDefaultFilename(self): return 'spl/u-boot-spl-nodtb.bin' diff --git a/tools/binman/etype/u_boot_spl_with_ucode_ptr.py b/tools/binman/etype/u_boot_spl_with_ucode_ptr.py index b1543a5ef3..72739a5eb6 100644 --- a/tools/binman/etype/u_boot_spl_with_ucode_ptr.py +++ b/tools/binman/etype/u_boot_spl_with_ucode_ptr.py @@ -18,7 +18,7 @@ class Entry_u_boot_spl_with_ucode_ptr(Entry_u_boot_with_ucode_ptr): process. """ def __init__(self, section, etype, node): - Entry_u_boot_with_ucode_ptr.__init__(self, section, etype, node) + super().__init__(section, etype, node) self.elf_fname = 'spl/u-boot-spl'
def GetDefaultFilename(self): diff --git a/tools/binman/etype/u_boot_tpl.py b/tools/binman/etype/u_boot_tpl.py index 6562457c9a..02287ab327 100644 --- a/tools/binman/etype/u_boot_tpl.py +++ b/tools/binman/etype/u_boot_tpl.py @@ -32,7 +32,7 @@ class Entry_u_boot_tpl(Entry_blob): binman uses that to look up symbols to write into the TPL binary. """ def __init__(self, section, etype, node): - Entry_blob.__init__(self, section, etype, node) + super().__init__(section, etype, node) self.elf_fname = 'tpl/u-boot-tpl'
def GetDefaultFilename(self): diff --git a/tools/binman/etype/u_boot_tpl_dtb.py b/tools/binman/etype/u_boot_tpl_dtb.py index 890155f271..2ff1d7ced1 100644 --- a/tools/binman/etype/u_boot_tpl_dtb.py +++ b/tools/binman/etype/u_boot_tpl_dtb.py @@ -19,7 +19,7 @@ class Entry_u_boot_tpl_dtb(Entry_blob_dtb): to activate. """ def __init__(self, section, etype, node): - Entry_blob_dtb.__init__(self, section, etype, node) + super().__init__(section, etype, node)
def GetDefaultFilename(self): return 'tpl/u-boot-tpl.dtb' diff --git a/tools/binman/etype/u_boot_tpl_dtb_with_ucode.py b/tools/binman/etype/u_boot_tpl_dtb_with_ucode.py index ca1bf85ace..066f18dfef 100644 --- a/tools/binman/etype/u_boot_tpl_dtb_with_ucode.py +++ b/tools/binman/etype/u_boot_tpl_dtb_with_ucode.py @@ -16,7 +16,7 @@ class Entry_u_boot_tpl_dtb_with_ucode(Entry_u_boot_dtb_with_ucode): process. """ def __init__(self, section, etype, node): - Entry_u_boot_dtb_with_ucode.__init__(self, section, etype, node) + super().__init__(section, etype, node)
def GetDefaultFilename(self): return 'tpl/u-boot-tpl.dtb' diff --git a/tools/binman/etype/u_boot_tpl_elf.py b/tools/binman/etype/u_boot_tpl_elf.py index 7fa8e96364..3f24d3aa7b 100644 --- a/tools/binman/etype/u_boot_tpl_elf.py +++ b/tools/binman/etype/u_boot_tpl_elf.py @@ -18,7 +18,7 @@ class Entry_u_boot_tpl_elf(Entry_blob): be relocated to any address for execution. """ def __init__(self, section, etype, node): - Entry_blob.__init__(self, section, etype, node) + super().__init__(section, etype, node)
def GetDefaultFilename(self): return 'tpl/u-boot-tpl' diff --git a/tools/binman/etype/u_boot_tpl_with_ucode_ptr.py b/tools/binman/etype/u_boot_tpl_with_ucode_ptr.py index 7f7fab7105..c7f3f9dedb 100644 --- a/tools/binman/etype/u_boot_tpl_with_ucode_ptr.py +++ b/tools/binman/etype/u_boot_tpl_with_ucode_ptr.py @@ -20,7 +20,7 @@ class Entry_u_boot_tpl_with_ucode_ptr(Entry_u_boot_with_ucode_ptr): process. """ def __init__(self, section, etype, node): - Entry_u_boot_with_ucode_ptr.__init__(self, section, etype, node) + super().__init__(section, etype, node) self.elf_fname = 'tpl/u-boot-tpl'
def GetDefaultFilename(self): diff --git a/tools/binman/etype/u_boot_ucode.py b/tools/binman/etype/u_boot_ucode.py index d9e1a605ef..4462293618 100644 --- a/tools/binman/etype/u_boot_ucode.py +++ b/tools/binman/etype/u_boot_ucode.py @@ -58,7 +58,7 @@ class Entry_u_boot_ucode(Entry_blob): contents of this entry. """ def __init__(self, section, etype, node): - Entry_blob.__init__(self, section, etype, node) + super().__init__(section, etype, node)
def ObtainContents(self): # If the section does not need microcode, there is nothing to do diff --git a/tools/binman/etype/u_boot_with_ucode_ptr.py b/tools/binman/etype/u_boot_with_ucode_ptr.py index 06047b654d..92d2fc6853 100644 --- a/tools/binman/etype/u_boot_with_ucode_ptr.py +++ b/tools/binman/etype/u_boot_with_ucode_ptr.py @@ -29,7 +29,7 @@ class Entry_u_boot_with_ucode_ptr(Entry_blob): complicated. Otherwise it is the same as the u_boot entry. """ def __init__(self, section, etype, node): - Entry_blob.__init__(self, section, etype, node) + super().__init__(section, etype, node) self.elf_fname = 'u-boot' self.target_offset = None
diff --git a/tools/binman/etype/vblock.py b/tools/binman/etype/vblock.py index 5753de7ec7..f734fbaec4 100644 --- a/tools/binman/etype/vblock.py +++ b/tools/binman/etype/vblock.py @@ -36,7 +36,7 @@ class Entry_vblock(Entry): and kernel are genuine. """ def __init__(self, section, etype, node): - Entry.__init__(self, section, etype, node) + super().__init__(section, etype, node) self.content = fdt_util.GetPhandleList(self._node, 'content') if not self.content: self.Raise("Vblock must have a 'content' property") diff --git a/tools/binman/etype/x86_reset16.py b/tools/binman/etype/x86_reset16.py index ad864e5442..5d49f16e21 100644 --- a/tools/binman/etype/x86_reset16.py +++ b/tools/binman/etype/x86_reset16.py @@ -23,7 +23,7 @@ class Entry_x86_reset16(Entry_blob): For 64-bit U-Boot, the 'x86_reset16_spl' entry type is used instead. """ def __init__(self, section, etype, node): - Entry_blob.__init__(self, section, etype, node) + super().__init__(section, etype, node)
def GetDefaultFilename(self): return 'u-boot-x86-reset16.bin' diff --git a/tools/binman/etype/x86_reset16_spl.py b/tools/binman/etype/x86_reset16_spl.py index 9a663f0ae2..775b90699b 100644 --- a/tools/binman/etype/x86_reset16_spl.py +++ b/tools/binman/etype/x86_reset16_spl.py @@ -23,7 +23,7 @@ class Entry_x86_reset16_spl(Entry_blob): For 32-bit U-Boot, the 'x86_reset_spl' entry type is used instead. """ def __init__(self, section, etype, node): - Entry_blob.__init__(self, section, etype, node) + super().__init__(section, etype, node)
def GetDefaultFilename(self): return 'spl/u-boot-x86-reset16-spl.bin' diff --git a/tools/binman/etype/x86_reset16_tpl.py b/tools/binman/etype/x86_reset16_tpl.py index 864508f367..52d3f4869a 100644 --- a/tools/binman/etype/x86_reset16_tpl.py +++ b/tools/binman/etype/x86_reset16_tpl.py @@ -23,7 +23,7 @@ class Entry_x86_reset16_tpl(Entry_blob): For 32-bit U-Boot, the 'x86_reset_tpl' entry type is used instead. """ def __init__(self, section, etype, node): - Entry_blob.__init__(self, section, etype, node) + super().__init__(section, etype, node)
def GetDefaultFilename(self): return 'tpl/u-boot-x86-reset16-tpl.bin' diff --git a/tools/binman/etype/x86_start16.py b/tools/binman/etype/x86_start16.py index d8345f6722..18fdd95d37 100644 --- a/tools/binman/etype/x86_start16.py +++ b/tools/binman/etype/x86_start16.py @@ -25,7 +25,7 @@ class Entry_x86_start16(Entry_blob): For 64-bit U-Boot, the 'x86_start16_spl' entry type is used instead. """ def __init__(self, section, etype, node): - Entry_blob.__init__(self, section, etype, node) + super().__init__(section, etype, node)
def GetDefaultFilename(self): return 'u-boot-x86-start16.bin' diff --git a/tools/binman/etype/x86_start16_spl.py b/tools/binman/etype/x86_start16_spl.py index ad520d3c6d..ac8e90f2e0 100644 --- a/tools/binman/etype/x86_start16_spl.py +++ b/tools/binman/etype/x86_start16_spl.py @@ -25,7 +25,7 @@ class Entry_x86_start16_spl(Entry_blob): For 32-bit U-Boot, the 'x86-start16' entry type is used instead. """ def __init__(self, section, etype, node): - Entry_blob.__init__(self, section, etype, node) + super().__init__(section, etype, node)
def GetDefaultFilename(self): return 'spl/u-boot-x86-start16-spl.bin' diff --git a/tools/binman/etype/x86_start16_tpl.py b/tools/binman/etype/x86_start16_tpl.py index ccc8727d1d..72d4608bb7 100644 --- a/tools/binman/etype/x86_start16_tpl.py +++ b/tools/binman/etype/x86_start16_tpl.py @@ -26,7 +26,7 @@ class Entry_x86_start16_tpl(Entry_blob): may be used instead. """ def __init__(self, section, etype, node): - Entry_blob.__init__(self, section, etype, node) + super().__init__(section, etype, node)
def GetDefaultFilename(self): return 'tpl/u-boot-x86-start16-tpl.bin' diff --git a/tools/binman/image.py b/tools/binman/image.py index 523b274c31..a8772c3763 100644 --- a/tools/binman/image.py +++ b/tools/binman/image.py @@ -45,7 +45,7 @@ class Image(section.Entry_section): we create a section manually. """ def __init__(self, name, node, copy_to_orig=True, test=False): - section.Entry_section.__init__(self, None, 'section', node, test=test) + super().__init__(None, 'section', node, test=test) self.copy_to_orig = copy_to_orig self.name = 'main-section' self.image_name = name @@ -57,7 +57,7 @@ class Image(section.Entry_section): self.ReadNode()
def ReadNode(self): - section.Entry_section.ReadNode(self) + super().ReadNode() filename = fdt_util.GetString(self._node, 'filename') if filename: self._filename = filename @@ -116,11 +116,11 @@ class Image(section.Entry_section):
def PackEntries(self): """Pack all entries into the image""" - section.Entry_section.Pack(self, 0) + super().Pack(0)
def SetImagePos(self): # This first section in the image so it starts at 0 - section.Entry_section.SetImagePos(self, 0) + super().SetImagePos(0)
def ProcessEntryContents(self): """Call the ProcessContents() method for each entry @@ -139,7 +139,7 @@ class Image(section.Entry_section):
def WriteSymbols(self): """Write symbol values into binary files for access at run time""" - section.Entry_section.WriteSymbols(self, self) + super().WriteSymbols(self)
def BuildImage(self): """Write the image to a file""" @@ -161,7 +161,7 @@ class Image(section.Entry_section): with open(fname, 'w') as fd: print('%8s %8s %8s %s' % ('ImagePos', 'Offset', 'Size', 'Name'), file=fd) - section.Entry_section.WriteMap(self, fd, 0) + super().WriteMap(fd, 0) return fname
def BuildEntryList(self):

It is easier and less error-prone to use super() when the parent type is needed. Update binman to remove the type names.
Signed-off-by: Simon Glass sjg@chromium.org Reviewed-by: Bin Meng bmeng.cn@gmail.com ---
(no changes since v1)
tools/binman/etype/_testing.py | 4 ++-- tools/binman/etype/blob.py | 2 +- tools/binman/etype/blob_dtb.py | 6 +++--- tools/binman/etype/blob_named_by_arg.py | 2 +- tools/binman/etype/cbfs.py | 14 +++++++------- tools/binman/etype/cros_ec_rw.py | 3 +-- tools/binman/etype/fdtmap.py | 2 +- tools/binman/etype/files.py | 2 +- tools/binman/etype/fill.py | 4 ++-- tools/binman/etype/fmap.py | 2 +- tools/binman/etype/gbb.py | 2 +- tools/binman/etype/image_header.py | 4 ++-- tools/binman/etype/intel_cmc.py | 2 +- tools/binman/etype/intel_descriptor.py | 4 ++-- tools/binman/etype/intel_fit.py | 4 ++-- tools/binman/etype/intel_fit_ptr.py | 4 ++-- tools/binman/etype/intel_fsp.py | 2 +- tools/binman/etype/intel_fsp_m.py | 2 +- tools/binman/etype/intel_fsp_s.py | 2 +- tools/binman/etype/intel_fsp_t.py | 2 +- tools/binman/etype/intel_ifwi.py | 4 ++-- tools/binman/etype/intel_me.py | 2 +- tools/binman/etype/intel_mrc.py | 2 +- tools/binman/etype/intel_refcode.py | 2 +- tools/binman/etype/intel_vbt.py | 2 +- tools/binman/etype/intel_vga.py | 2 +- tools/binman/etype/mkimage.py | 2 +- .../etype/powerpc_mpc85xx_bootpg_resetvec.py | 2 +- tools/binman/etype/section.py | 16 ++++++++-------- tools/binman/etype/text.py | 2 +- tools/binman/etype/u_boot.py | 2 +- tools/binman/etype/u_boot_dtb.py | 2 +- tools/binman/etype/u_boot_dtb_with_ucode.py | 4 ++-- tools/binman/etype/u_boot_elf.py | 4 ++-- tools/binman/etype/u_boot_img.py | 2 +- tools/binman/etype/u_boot_nodtb.py | 2 +- tools/binman/etype/u_boot_spl.py | 2 +- tools/binman/etype/u_boot_spl_bss_pad.py | 2 +- tools/binman/etype/u_boot_spl_dtb.py | 2 +- tools/binman/etype/u_boot_spl_elf.py | 2 +- tools/binman/etype/u_boot_spl_nodtb.py | 2 +- tools/binman/etype/u_boot_spl_with_ucode_ptr.py | 2 +- tools/binman/etype/u_boot_tpl.py | 2 +- tools/binman/etype/u_boot_tpl_dtb.py | 2 +- tools/binman/etype/u_boot_tpl_dtb_with_ucode.py | 2 +- tools/binman/etype/u_boot_tpl_elf.py | 2 +- tools/binman/etype/u_boot_tpl_with_ucode_ptr.py | 2 +- tools/binman/etype/u_boot_ucode.py | 2 +- tools/binman/etype/u_boot_with_ucode_ptr.py | 2 +- tools/binman/etype/vblock.py | 2 +- tools/binman/etype/x86_reset16.py | 2 +- tools/binman/etype/x86_reset16_spl.py | 2 +- tools/binman/etype/x86_reset16_tpl.py | 2 +- tools/binman/etype/x86_start16.py | 2 +- tools/binman/etype/x86_start16_spl.py | 2 +- tools/binman/etype/x86_start16_tpl.py | 2 +- tools/binman/image.py | 12 ++++++------ 57 files changed, 86 insertions(+), 87 deletions(-)
Applied to u-boot-dm

It is useful to be able to distinguish between ordinary blobs such as u-boot.bin and external blobs that cannot be build by the U-Boot build system. If the external blobs are not available for some reason, then we know that a value image cannot be built.
Introduce a new 'blob-ext' entry type for that.
Signed-off-by: Simon Glass sjg@chromium.org Reviewed-by: Bin Meng bmeng.cn@gmail.com ---
(no changes since v1)
tools/binman/README.entries | 10 +++++++ tools/binman/etype/blob_ext.py | 31 ++++++++++++++++++++++ tools/binman/ftest.py | 12 +++++++++ tools/binman/test/157_blob_ext.dts | 14 ++++++++++ tools/binman/test/158_blob_ext_missing.dts | 16 +++++++++++ 5 files changed, 83 insertions(+) create mode 100644 tools/binman/etype/blob_ext.py create mode 100644 tools/binman/test/157_blob_ext.dts create mode 100644 tools/binman/test/158_blob_ext_missing.dts
diff --git a/tools/binman/README.entries b/tools/binman/README.entries index 4f2c48fdc2..46f6ab1899 100644 --- a/tools/binman/README.entries +++ b/tools/binman/README.entries @@ -42,6 +42,16 @@ obtained from the list of available device-tree files, managed by the
+Entry: blob-ext: Entry containing an externally built binary blob +----------------------------------------------------------------- + +Note: This should not be used by itself. It is normally used as a parent +class by other entry types. + +See 'blob' for Properties / Entry arguments. + + + Entry: blob-named-by-arg: A blob entry which gets its filename property from its subclass -----------------------------------------------------------------------------------------
diff --git a/tools/binman/etype/blob_ext.py b/tools/binman/etype/blob_ext.py new file mode 100644 index 0000000000..cc8d91bb59 --- /dev/null +++ b/tools/binman/etype/blob_ext.py @@ -0,0 +1,31 @@ +# SPDX-License-Identifier: GPL-2.0+ +# Copyright (c) 2016 Google, Inc +# Written by Simon Glass sjg@chromium.org +# +# Entry-type module for external blobs, not built by U-Boot +# + +import os + +from binman.etype.blob import Entry_blob +from dtoc import fdt_util +from patman import tools +from patman import tout + +class Entry_blob_ext(Entry_blob): + """Entry containing an externally built binary blob + + Note: This should not be used by itself. It is normally used as a parent + class by other entry types. + + See 'blob' for Properties / Entry arguments. + """ + def __init__(self, section, etype, node): + Entry_blob.__init__(self, section, etype, node) + self.external = True + + def ObtainContents(self): + self._filename = self.GetDefaultFilename() + self._pathname = tools.GetInputFilename(self._filename) + self.ReadBlobContents() + return True diff --git a/tools/binman/ftest.py b/tools/binman/ftest.py index 39e67b9042..f8d5191672 100644 --- a/tools/binman/ftest.py +++ b/tools/binman/ftest.py @@ -3364,6 +3364,18 @@ class TestFunctional(unittest.TestCase): # Just check that the data appears in the file somewhere self.assertIn(U_BOOT_SPL_DATA, data)
+ def testExtblob(self): + """Test an image with an external blob""" + data = self._DoReadFile('157_blob_ext.dts') + self.assertEqual(REFCODE_DATA, data) + + def testExtblobMissing(self): + """Test an image with a missing external blob""" + with self.assertRaises(ValueError) as e: + self._DoReadFile('158_blob_ext_missing.dts') + self.assertIn("Filename 'missing-file' not found in input path", + str(e.exception)) +
if __name__ == "__main__": unittest.main() diff --git a/tools/binman/test/157_blob_ext.dts b/tools/binman/test/157_blob_ext.dts new file mode 100644 index 0000000000..8afdd5339e --- /dev/null +++ b/tools/binman/test/157_blob_ext.dts @@ -0,0 +1,14 @@ +// SPDX-License-Identifier: GPL-2.0+ + +/dts-v1/; + +/ { + #address-cells = <1>; + #size-cells = <1>; + + binman { + blob-ext { + filename = "refcode.bin"; + }; + }; +}; diff --git a/tools/binman/test/158_blob_ext_missing.dts b/tools/binman/test/158_blob_ext_missing.dts new file mode 100644 index 0000000000..d315e5592e --- /dev/null +++ b/tools/binman/test/158_blob_ext_missing.dts @@ -0,0 +1,16 @@ +// SPDX-License-Identifier: GPL-2.0+ + +/dts-v1/; + +/ { + #address-cells = <1>; + #size-cells = <1>; + + binman { + size = <0x80>; + + blob-ext { + filename = "missing-file"; + }; + }; +};

It is useful to be able to distinguish between ordinary blobs such as u-boot.bin and external blobs that cannot be build by the U-Boot build system. If the external blobs are not available for some reason, then we know that a value image cannot be built.
Introduce a new 'blob-ext' entry type for that.
Signed-off-by: Simon Glass sjg@chromium.org Reviewed-by: Bin Meng bmeng.cn@gmail.com ---
(no changes since v1)
tools/binman/README.entries | 10 +++++++ tools/binman/etype/blob_ext.py | 31 ++++++++++++++++++++++ tools/binman/ftest.py | 12 +++++++++ tools/binman/test/157_blob_ext.dts | 14 ++++++++++ tools/binman/test/158_blob_ext_missing.dts | 16 +++++++++++ 5 files changed, 83 insertions(+) create mode 100644 tools/binman/etype/blob_ext.py create mode 100644 tools/binman/test/157_blob_ext.dts create mode 100644 tools/binman/test/158_blob_ext_missing.dts
Applied to u-boot-dm

Many of the existing blobs rely on external binaries which may not be available. Move them over to use blob_ext to indicate this.
Unfortunately cros-ec-rw cannot use this class because it inherits another. So set the 'external' value for that class.
While we are here, drop the import of Entry since it is not used (and pylint3 complains).
Signed-off-by: Simon Glass sjg@chromium.org ---
Changes in v3: - Update commit message to explain cros_ec_rw and mention dropping Entry
tools/binman/etype/cros_ec_rw.py | 1 + tools/binman/etype/intel_cmc.py | 5 ++--- tools/binman/etype/intel_descriptor.py | 4 ++-- tools/binman/etype/intel_fit.py | 4 ++-- tools/binman/etype/intel_fit_ptr.py | 4 ++-- tools/binman/etype/intel_fsp.py | 5 ++--- tools/binman/etype/intel_fsp_m.py | 5 ++--- tools/binman/etype/intel_fsp_s.py | 5 ++--- tools/binman/etype/intel_fsp_t.py | 5 ++--- tools/binman/etype/intel_ifwi.py | 4 ++-- tools/binman/etype/intel_me.py | 5 ++--- tools/binman/etype/intel_mrc.py | 5 ++--- tools/binman/etype/intel_refcode.py | 5 ++--- tools/binman/etype/intel_vbt.py | 5 ++--- tools/binman/etype/intel_vga.py | 5 ++--- tools/binman/etype/powerpc_mpc85xx_bootpg_resetvec.py | 1 - 16 files changed, 29 insertions(+), 39 deletions(-)
diff --git a/tools/binman/etype/cros_ec_rw.py b/tools/binman/etype/cros_ec_rw.py index 7ad62d0265..741372e1af 100644 --- a/tools/binman/etype/cros_ec_rw.py +++ b/tools/binman/etype/cros_ec_rw.py @@ -19,3 +19,4 @@ class Entry_cros_ec_rw(Entry_blob_named_by_arg): """ def __init__(self, section, etype, node): super().__init__(section, etype, node, 'cros-ec-rw') + self.external = True diff --git a/tools/binman/etype/intel_cmc.py b/tools/binman/etype/intel_cmc.py index 9ab471e7b6..644fa421d3 100644 --- a/tools/binman/etype/intel_cmc.py +++ b/tools/binman/etype/intel_cmc.py @@ -5,10 +5,9 @@ # Entry-type module for Intel Chip Microcode binary blob #
-from binman.entry import Entry -from binman.etype.blob import Entry_blob +from binman.etype.blob_ext import Entry_blob_ext
-class Entry_intel_cmc(Entry_blob): +class Entry_intel_cmc(Entry_blob_ext): """Entry containing an Intel Chipset Micro Code (CMC) file
Properties / Entry arguments: diff --git a/tools/binman/etype/intel_descriptor.py b/tools/binman/etype/intel_descriptor.py index 6afc42ece5..5b18893ccd 100644 --- a/tools/binman/etype/intel_descriptor.py +++ b/tools/binman/etype/intel_descriptor.py @@ -8,7 +8,7 @@ import struct
from binman.entry import Entry -from binman.etype.blob import Entry_blob +from binman.etype.blob_ext import Entry_blob_ext
FD_SIGNATURE = struct.pack('<L', 0x0ff0a55a) MAX_REGIONS = 5 @@ -25,7 +25,7 @@ class Region: self.limit = ((val & 0x0fff0000) >> 4) | 0xfff self.size = self.limit - self.base + 1
-class Entry_intel_descriptor(Entry_blob): +class Entry_intel_descriptor(Entry_blob_ext): """Intel flash descriptor block (4KB)
Properties / Entry arguments: diff --git a/tools/binman/etype/intel_fit.py b/tools/binman/etype/intel_fit.py index ad6c1caa85..f1a10c55a6 100644 --- a/tools/binman/etype/intel_fit.py +++ b/tools/binman/etype/intel_fit.py @@ -7,9 +7,9 @@
import struct
-from binman.etype.blob import Entry_blob +from binman.etype.blob_ext import Entry_blob_ext
-class Entry_intel_fit(Entry_blob): +class Entry_intel_fit(Entry_blob_ext): """Intel Firmware Image Table (FIT)
This entry contains a dummy FIT as required by recent Intel CPUs. The FIT diff --git a/tools/binman/etype/intel_fit_ptr.py b/tools/binman/etype/intel_fit_ptr.py index a06d12e740..01f082281c 100644 --- a/tools/binman/etype/intel_fit_ptr.py +++ b/tools/binman/etype/intel_fit_ptr.py @@ -7,9 +7,9 @@
import struct
-from binman.etype.blob import Entry_blob +from binman.etype.blob_ext import Entry_blob_ext
-class Entry_intel_fit_ptr(Entry_blob): +class Entry_intel_fit_ptr(Entry_blob_ext): """Intel Firmware Image Table (FIT) pointer
This entry contains a pointer to the FIT. It is required to be at address diff --git a/tools/binman/etype/intel_fsp.py b/tools/binman/etype/intel_fsp.py index a1c89adcea..2ac012bce1 100644 --- a/tools/binman/etype/intel_fsp.py +++ b/tools/binman/etype/intel_fsp.py @@ -5,10 +5,9 @@ # Entry-type module for Intel Firmware Support Package binary blob #
-from binman.entry import Entry -from binman.etype.blob import Entry_blob +from binman.etype.blob_ext import Entry_blob_ext
-class Entry_intel_fsp(Entry_blob): +class Entry_intel_fsp(Entry_blob_ext): """Entry containing an Intel Firmware Support Package (FSP) file
Properties / Entry arguments: diff --git a/tools/binman/etype/intel_fsp_m.py b/tools/binman/etype/intel_fsp_m.py index 4c225b24d3..434b0f1856 100644 --- a/tools/binman/etype/intel_fsp_m.py +++ b/tools/binman/etype/intel_fsp_m.py @@ -5,10 +5,9 @@ # Entry-type module for Intel Firmware Support Package binary blob (M section) #
-from binman.entry import Entry -from binman.etype.blob import Entry_blob +from binman.etype.blob_ext import Entry_blob_ext
-class Entry_intel_fsp_m(Entry_blob): +class Entry_intel_fsp_m(Entry_blob_ext): """Entry containing Intel Firmware Support Package (FSP) memory init
Properties / Entry arguments: diff --git a/tools/binman/etype/intel_fsp_s.py b/tools/binman/etype/intel_fsp_s.py index 9e1107182a..564e1228bb 100644 --- a/tools/binman/etype/intel_fsp_s.py +++ b/tools/binman/etype/intel_fsp_s.py @@ -5,10 +5,9 @@ # Entry-type module for Intel Firmware Support Package binary blob (S section) #
-from binman.entry import Entry -from binman.etype.blob import Entry_blob +from binman.etype.blob_ext import Entry_blob_ext
-class Entry_intel_fsp_s(Entry_blob): +class Entry_intel_fsp_s(Entry_blob_ext): """Entry containing Intel Firmware Support Package (FSP) silicon init
Properties / Entry arguments: diff --git a/tools/binman/etype/intel_fsp_t.py b/tools/binman/etype/intel_fsp_t.py index 5dca145a3f..df0c5fbee0 100644 --- a/tools/binman/etype/intel_fsp_t.py +++ b/tools/binman/etype/intel_fsp_t.py @@ -5,10 +5,9 @@ # Entry-type module for Intel Firmware Support Package binary blob (T section) #
-from binman.entry import Entry -from binman.etype.blob import Entry_blob +from binman.etype.blob_ext import Entry_blob_ext
-class Entry_intel_fsp_t(Entry_blob): +class Entry_intel_fsp_t(Entry_blob_ext): """Entry containing Intel Firmware Support Package (FSP) temp ram init
Properties / Entry arguments: diff --git a/tools/binman/etype/intel_ifwi.py b/tools/binman/etype/intel_ifwi.py index ba63f6574f..b0c2b1aaa3 100644 --- a/tools/binman/etype/intel_ifwi.py +++ b/tools/binman/etype/intel_ifwi.py @@ -8,11 +8,11 @@ from collections import OrderedDict
from binman.entry import Entry -from binman.etype.blob import Entry_blob +from binman.etype.blob_ext import Entry_blob_ext from dtoc import fdt_util from patman import tools
-class Entry_intel_ifwi(Entry_blob): +class Entry_intel_ifwi(Entry_blob_ext): """Entry containing an Intel Integrated Firmware Image (IFWI) file
Properties / Entry arguments: diff --git a/tools/binman/etype/intel_me.py b/tools/binman/etype/intel_me.py index 6b3803819e..a6fe5427f3 100644 --- a/tools/binman/etype/intel_me.py +++ b/tools/binman/etype/intel_me.py @@ -5,10 +5,9 @@ # Entry-type module for Intel Management Engine binary blob #
-from binman.entry import Entry -from binman.etype.blob import Entry_blob +from binman.etype.blob_ext import Entry_blob_ext
-class Entry_intel_me(Entry_blob): +class Entry_intel_me(Entry_blob_ext): """Entry containing an Intel Management Engine (ME) file
Properties / Entry arguments: diff --git a/tools/binman/etype/intel_mrc.py b/tools/binman/etype/intel_mrc.py index 74781848e2..ccbb046519 100644 --- a/tools/binman/etype/intel_mrc.py +++ b/tools/binman/etype/intel_mrc.py @@ -5,10 +5,9 @@ # Entry-type module for Intel Memory Reference Code binary blob #
-from binman.entry import Entry -from binman.etype.blob import Entry_blob +from binman.etype.blob_ext import Entry_blob_ext
-class Entry_intel_mrc(Entry_blob): +class Entry_intel_mrc(Entry_blob_ext): """Entry containing an Intel Memory Reference Code (MRC) file
Properties / Entry arguments: diff --git a/tools/binman/etype/intel_refcode.py b/tools/binman/etype/intel_refcode.py index 5754fec4f8..5ead08b2be 100644 --- a/tools/binman/etype/intel_refcode.py +++ b/tools/binman/etype/intel_refcode.py @@ -5,10 +5,9 @@ # Entry-type module for Intel Memory Reference Code binary blob #
-from binman.entry import Entry -from binman.etype.blob import Entry_blob +from binman.etype.blob_ext import Entry_blob_ext
-class Entry_intel_refcode(Entry_blob): +class Entry_intel_refcode(Entry_blob_ext): """Entry containing an Intel Reference Code file
Properties / Entry arguments: diff --git a/tools/binman/etype/intel_vbt.py b/tools/binman/etype/intel_vbt.py index f6d7b466ea..2a98c12368 100644 --- a/tools/binman/etype/intel_vbt.py +++ b/tools/binman/etype/intel_vbt.py @@ -4,10 +4,9 @@ # Entry-type module for Intel Video BIOS Table binary blob #
-from binman.entry import Entry -from binman.etype.blob import Entry_blob +from binman.etype.blob_ext import Entry_blob_ext
-class Entry_intel_vbt(Entry_blob): +class Entry_intel_vbt(Entry_blob_ext): """Entry containing an Intel Video BIOS Table (VBT) file
Properties / Entry arguments: diff --git a/tools/binman/etype/intel_vga.py b/tools/binman/etype/intel_vga.py index 6b87c01b4c..a103f1ce0e 100644 --- a/tools/binman/etype/intel_vga.py +++ b/tools/binman/etype/intel_vga.py @@ -5,10 +5,9 @@ # Entry-type module for x86 VGA ROM binary blob #
-from binman.entry import Entry -from binman.etype.blob import Entry_blob +from binman.etype.blob_ext import Entry_blob_ext
-class Entry_intel_vga(Entry_blob): +class Entry_intel_vga(Entry_blob_ext): """Entry containing an Intel Video Graphics Adaptor (VGA) file
Properties / Entry arguments: diff --git a/tools/binman/etype/powerpc_mpc85xx_bootpg_resetvec.py b/tools/binman/etype/powerpc_mpc85xx_bootpg_resetvec.py index b0fa75fbf8..3a92fa399f 100644 --- a/tools/binman/etype/powerpc_mpc85xx_bootpg_resetvec.py +++ b/tools/binman/etype/powerpc_mpc85xx_bootpg_resetvec.py @@ -4,7 +4,6 @@ # Entry-type module for the PowerPC mpc85xx bootpg and resetvec code for U-Boot #
-from binman.entry import Entry from binman.etype.blob import Entry_blob
class Entry_powerpc_mpc85xx_bootpg_resetvec(Entry_blob):

Many of the existing blobs rely on external binaries which may not be available. Move them over to use blob_ext to indicate this.
Unfortunately cros-ec-rw cannot use this class because it inherits another. So set the 'external' value for that class.
While we are here, drop the import of Entry since it is not used (and pylint3 complains).
Signed-off-by: Simon Glass sjg@chromium.org ---
Changes in v3: - Update commit message to explain cros_ec_rw and mention dropping Entry
tools/binman/etype/cros_ec_rw.py | 1 + tools/binman/etype/intel_cmc.py | 5 ++--- tools/binman/etype/intel_descriptor.py | 4 ++-- tools/binman/etype/intel_fit.py | 4 ++-- tools/binman/etype/intel_fit_ptr.py | 4 ++-- tools/binman/etype/intel_fsp.py | 5 ++--- tools/binman/etype/intel_fsp_m.py | 5 ++--- tools/binman/etype/intel_fsp_s.py | 5 ++--- tools/binman/etype/intel_fsp_t.py | 5 ++--- tools/binman/etype/intel_ifwi.py | 4 ++-- tools/binman/etype/intel_me.py | 5 ++--- tools/binman/etype/intel_mrc.py | 5 ++--- tools/binman/etype/intel_refcode.py | 5 ++--- tools/binman/etype/intel_vbt.py | 5 ++--- tools/binman/etype/intel_vga.py | 5 ++--- tools/binman/etype/powerpc_mpc85xx_bootpg_resetvec.py | 1 - 16 files changed, 29 insertions(+), 39 deletions(-)
Applied to u-boot-dm

Sometimes it is useful to build an image even though external binaries are not present. This allows the build system to continue to function without these files, albeit not producing valid images.
U-Boot does with with ATF (ARM Trusted Firmware) today.
Add a new flag to binman to request this behaviour.
Signed-off-by: Simon Glass sjg@chromium.org Reviewed-by: Bin Meng bmeng.cn@gmail.com ---
Changes in v3: - Move the SetAllowMissing() function into this patch - Keep the _allow_missing property to sections only
tools/binman/README.entries | 3 +++ tools/binman/cmdline.py | 2 ++ tools/binman/control.py | 7 +++++-- tools/binman/entry.py | 9 +++++++++ tools/binman/etype/blob_ext.py | 13 ++++++++++--- tools/binman/etype/section.py | 24 ++++++++++++++++++++++++ tools/binman/ftest.py | 8 +++++++- tools/patman/tools.py | 8 ++++++-- 8 files changed, 66 insertions(+), 8 deletions(-)
diff --git a/tools/binman/README.entries b/tools/binman/README.entries index 46f6ab1899..f45f51428a 100644 --- a/tools/binman/README.entries +++ b/tools/binman/README.entries @@ -48,6 +48,9 @@ Entry: blob-ext: Entry containing an externally built binary blob Note: This should not be used by itself. It is normally used as a parent class by other entry types.
+If the file providing this blob is missing, binman can optionally ignore it +and produce a broken image with a warning. + See 'blob' for Properties / Entry arguments.
diff --git a/tools/binman/cmdline.py b/tools/binman/cmdline.py index 1e38593579..bb4d9d1288 100644 --- a/tools/binman/cmdline.py +++ b/tools/binman/cmdline.py @@ -53,6 +53,8 @@ controlled by a description in the board device tree.''' help='Add a path to the list of directories to use for input files') build_parser.add_argument('-m', '--map', action='store_true', default=False, help='Output a map file for each image') + build_parser.add_argument('-M', '--allow-missing', action='store_true', + default=False, help='Allow external blobs to be missing') build_parser.add_argument('-O', '--outdir', type=str, action='store', help='Path to directory to use for intermediate and ' 'output files') diff --git a/tools/binman/control.py b/tools/binman/control.py index dc1dd2a7dc..8c6eae83f1 100644 --- a/tools/binman/control.py +++ b/tools/binman/control.py @@ -387,7 +387,7 @@ def PrepareImagesAndDtbs(dtb_fname, select_images, update_fdt):
def ProcessImage(image, update_fdt, write_map, get_contents=True, - allow_resize=True): + allow_resize=True, allow_missing=False): """Perform all steps for this image, including checking and # writing it.
This means that errors found with a later image will be reported after @@ -402,8 +402,10 @@ def ProcessImage(image, update_fdt, write_map, get_contents=True, the contents is already present allow_resize: True to allow entries to change size (this does a re-pack of the entries), False to raise an exception + allow_missing: Allow blob_ext objects to be missing """ if get_contents: + image.SetAllowMissing(allow_missing) image.GetEntryContents() image.GetEntryOffsets()
@@ -523,7 +525,8 @@ def Binman(args): images = PrepareImagesAndDtbs(dtb_fname, args.image, args.update_fdt) for image in images.values(): - ProcessImage(image, args.update_fdt, args.map) + ProcessImage(image, args.update_fdt, args.map, + allow_missing=args.allow_missing)
# Write the updated FDTs to our output files for dtb_item in state.GetAllFdts(): diff --git a/tools/binman/entry.py b/tools/binman/entry.py index 90ffd27617..9388586e7c 100644 --- a/tools/binman/entry.py +++ b/tools/binman/entry.py @@ -794,3 +794,12 @@ features to produce new behaviours. elif self == entries[-1]: return 'end' return 'middle' + + def SetAllowMissing(self, allow_missing): + """Set whether a section allows missing external blobs + + Args: + allow_missing: True if allowed, False if not allowed + """ + # This is meaningless for anything other than sections + pass diff --git a/tools/binman/etype/blob_ext.py b/tools/binman/etype/blob_ext.py index cc8d91bb59..51779c88c9 100644 --- a/tools/binman/etype/blob_ext.py +++ b/tools/binman/etype/blob_ext.py @@ -18,6 +18,9 @@ class Entry_blob_ext(Entry_blob): Note: This should not be used by itself. It is normally used as a parent class by other entry types.
+ If the file providing this blob is missing, binman can optionally ignore it + and produce a broken image with a warning. + See 'blob' for Properties / Entry arguments. """ def __init__(self, section, etype, node): @@ -26,6 +29,10 @@ class Entry_blob_ext(Entry_blob):
def ObtainContents(self): self._filename = self.GetDefaultFilename() - self._pathname = tools.GetInputFilename(self._filename) - self.ReadBlobContents() - return True + self._pathname = tools.GetInputFilename(self._filename, + self.section.GetAllowMissing()) + # Allow the file to be missing + if not self._pathname: + self.SetContents(b'') + return True + return super().ObtainContents() diff --git a/tools/binman/etype/section.py b/tools/binman/etype/section.py index f108121c3a..9b718f1fa7 100644 --- a/tools/binman/etype/section.py +++ b/tools/binman/etype/section.py @@ -34,6 +34,11 @@ class Entry_section(Entry): name-prefix: Adds a prefix to the name of every entry in the section when writing out the map
+ Properties: + _allow_missing: True if this section permits external blobs to be + missing their contents. The second will produce an image but of + course it will not work. + Since a section is also an entry, it inherits all the properies of entries too.
@@ -49,6 +54,7 @@ class Entry_section(Entry): self._sort = False self._skip_at_start = None self._end_4gb = False + self._allow_missing = False
def ReadNode(self): """Read properties from the image node""" @@ -535,3 +541,21 @@ class Entry_section(Entry):
def WriteChildData(self, child): return True + + def SetAllowMissing(self, allow_missing): + """Set whether a section allows missing external blobs + + Args: + allow_missing: True if allowed, False if not allowed + """ + self._allow_missing = allow_missing + for entry in self._entries.values(): + entry.SetAllowMissing(allow_missing) + + def GetAllowMissing(self): + """Get whether a section allows missing external blobs + + Returns: + True if allowed, False if not allowed + """ + return self._allow_missing diff --git a/tools/binman/ftest.py b/tools/binman/ftest.py index f8d5191672..7c8b3eb3a0 100644 --- a/tools/binman/ftest.py +++ b/tools/binman/ftest.py @@ -285,7 +285,7 @@ class TestFunctional(unittest.TestCase):
def _DoTestFile(self, fname, debug=False, map=False, update_dtb=False, entry_args=None, images=None, use_real_dtb=False, - verbosity=None): + verbosity=None, allow_missing=False): """Run binman with a given test file
Args: @@ -319,6 +319,8 @@ class TestFunctional(unittest.TestCase): if entry_args: for arg, value in entry_args.items(): args.append('-a%s=%s' % (arg, value)) + if allow_missing: + args.append('-M') if images: for image in images: args += ['-i', image] @@ -3376,6 +3378,10 @@ class TestFunctional(unittest.TestCase): self.assertIn("Filename 'missing-file' not found in input path", str(e.exception))
+ def testExtblobMissingOk(self): + """Test an image with an missing external blob that is allowed""" + self._DoTestFile('158_blob_ext_missing.dts', allow_missing=True) +
if __name__ == "__main__": unittest.main() diff --git a/tools/patman/tools.py b/tools/patman/tools.py index b50370dfe8..7d92e20afa 100644 --- a/tools/patman/tools.py +++ b/tools/patman/tools.py @@ -114,14 +114,16 @@ def SetInputDirs(dirname): indir = dirname tout.Debug("Using input directories %s" % indir)
-def GetInputFilename(fname): +def GetInputFilename(fname, allow_missing=False): """Return a filename for use as input.
Args: fname: Filename to use for new file + allow_missing: True if the filename can be missing
Returns: - The full path of the filename, within the input directory + The full path of the filename, within the input directory, or + None on error """ if not indir or fname[:1] == '/': return fname @@ -130,6 +132,8 @@ def GetInputFilename(fname): if os.path.exists(pathname): return pathname
+ if allow_missing: + return None raise ValueError("Filename '%s' not found in input path (%s) (cwd='%s')" % (fname, ','.join(indir), os.getcwd()))

Sometimes it is useful to build an image even though external binaries are not present. This allows the build system to continue to function without these files, albeit not producing valid images.
U-Boot does with with ATF (ARM Trusted Firmware) today.
Add a new flag to binman to request this behaviour.
Signed-off-by: Simon Glass sjg@chromium.org Reviewed-by: Bin Meng bmeng.cn@gmail.com ---
Changes in v3: - Move the SetAllowMissing() function into this patch - Keep the _allow_missing property to sections only
tools/binman/README.entries | 3 +++ tools/binman/cmdline.py | 2 ++ tools/binman/control.py | 7 +++++-- tools/binman/entry.py | 9 +++++++++ tools/binman/etype/blob_ext.py | 13 ++++++++++--- tools/binman/etype/section.py | 24 ++++++++++++++++++++++++ tools/binman/ftest.py | 8 +++++++- tools/patman/tools.py | 8 ++++++-- 8 files changed, 66 insertions(+), 8 deletions(-)
Applied to u-boot-dm

When warnings and errors are produced by tools they should be written to stderr. Update the tout implementation to handle this.
Signed-off-by: Simon Glass sjg@chromium.org Reviewed-by: Bin Meng bmeng.cn@gmail.com ---
(no changes since v1)
tools/binman/ftest.py | 2 +- tools/patman/tout.py | 5 ++++- 2 files changed, 5 insertions(+), 2 deletions(-)
diff --git a/tools/binman/ftest.py b/tools/binman/ftest.py index 7c8b3eb3a0..928d3608a3 100644 --- a/tools/binman/ftest.py +++ b/tools/binman/ftest.py @@ -3232,7 +3232,7 @@ class TestFunctional(unittest.TestCase): with test_util.capture_sys_output() as (stdout, stderr): control.ReplaceEntries(updated_fname, None, outdir, []) self.assertIn("Skipping entry '/u-boot' from missing file", - stdout.getvalue()) + stderr.getvalue())
def testReplaceCmdMap(self): """Test replacing a file fron an image on the command line""" diff --git a/tools/patman/tout.py b/tools/patman/tout.py index c7e3272096..91a53f4073 100644 --- a/tools/patman/tout.py +++ b/tools/patman/tout.py @@ -83,7 +83,10 @@ def _Output(level, msg, color=None): ClearProgress() if color: msg = _color.Color(color, msg) - print(msg) + if level < NOTICE: + print(msg, file=sys.stderr) + else: + print(msg)
def DoOutput(level, msg): """Output a message to the terminal.

When warnings and errors are produced by tools they should be written to stderr. Update the tout implementation to handle this.
Signed-off-by: Simon Glass sjg@chromium.org Reviewed-by: Bin Meng bmeng.cn@gmail.com ---
(no changes since v1)
tools/binman/ftest.py | 2 +- tools/patman/tout.py | 5 ++++- 2 files changed, 5 insertions(+), 2 deletions(-)
Applied to u-boot-dm

When external blobs are missing, show a message indicating that the images are not functional.
Signed-off-by: Simon Glass sjg@chromium.org ---
Changes in v3: - Move the SetAllowMissing() function into an earlier patch
tools/binman/control.py | 16 +++++++++++-- tools/binman/entry.py | 12 ++++++++++ tools/binman/etype/blob_ext.py | 1 + tools/binman/etype/section.py | 12 ++++++++++ tools/binman/ftest.py | 14 ++++++++++- .../binman/test/159_blob_ext_missing_sect.dts | 23 +++++++++++++++++++ tools/patman/tout.py | 1 + 7 files changed, 76 insertions(+), 3 deletions(-) create mode 100644 tools/binman/test/159_blob_ext_missing_sect.dts
diff --git a/tools/binman/control.py b/tools/binman/control.py index 8c6eae83f1..343b0a0c35 100644 --- a/tools/binman/control.py +++ b/tools/binman/control.py @@ -403,6 +403,9 @@ def ProcessImage(image, update_fdt, write_map, get_contents=True, allow_resize: True to allow entries to change size (this does a re-pack of the entries), False to raise an exception allow_missing: Allow blob_ext objects to be missing + + Returns: + True if one or more external blobs are missing, False if all are present """ if get_contents: image.SetAllowMissing(allow_missing) @@ -450,6 +453,12 @@ def ProcessImage(image, update_fdt, write_map, get_contents=True, image.BuildImage() if write_map: image.WriteMap() + missing_list = [] + image.CheckMissing(missing_list) + if missing_list: + tout.Warning("Image '%s' is missing external blobs and is non-functional: %s" % + (image.name, ' '.join([e.name for e in missing_list]))) + return bool(missing_list)
def Binman(args): @@ -524,14 +533,17 @@ def Binman(args):
images = PrepareImagesAndDtbs(dtb_fname, args.image, args.update_fdt) + missing = False for image in images.values(): - ProcessImage(image, args.update_fdt, args.map, - allow_missing=args.allow_missing) + missing |= ProcessImage(image, args.update_fdt, args.map, + allow_missing=args.allow_missing)
# Write the updated FDTs to our output files for dtb_item in state.GetAllFdts(): tools.WriteFile(dtb_item._fname, dtb_item.GetContents())
+ if missing: + tout.Warning("Some images are invalid") finally: tools.FinaliseOutputDir() finally: diff --git a/tools/binman/entry.py b/tools/binman/entry.py index 9388586e7c..3434a3f804 100644 --- a/tools/binman/entry.py +++ b/tools/binman/entry.py @@ -84,6 +84,7 @@ class Entry(object): self.image_pos = None self._expand_size = False self.compress = 'none' + self.missing = False
@staticmethod def Lookup(node_path, etype): @@ -803,3 +804,14 @@ features to produce new behaviours. """ # This is meaningless for anything other than sections pass + + def CheckMissing(self, missing_list): + """Check if any entries in this section have missing external blobs + + If there are missing blobs, the entries are added to the list + + Args: + missing_list: List of Entry objects to be added to + """ + if self.missing: + missing_list.append(self) diff --git a/tools/binman/etype/blob_ext.py b/tools/binman/etype/blob_ext.py index 51779c88c9..8d641001a9 100644 --- a/tools/binman/etype/blob_ext.py +++ b/tools/binman/etype/blob_ext.py @@ -34,5 +34,6 @@ class Entry_blob_ext(Entry_blob): # Allow the file to be missing if not self._pathname: self.SetContents(b'') + self.missing = True return True return super().ObtainContents() diff --git a/tools/binman/etype/section.py b/tools/binman/etype/section.py index 9b718f1fa7..dd7f1ccd09 100644 --- a/tools/binman/etype/section.py +++ b/tools/binman/etype/section.py @@ -55,6 +55,7 @@ class Entry_section(Entry): self._skip_at_start = None self._end_4gb = False self._allow_missing = False + self.missing = False
def ReadNode(self): """Read properties from the image node""" @@ -559,3 +560,14 @@ class Entry_section(Entry): True if allowed, False if not allowed """ return self._allow_missing + + def CheckMissing(self, missing_list): + """Check if any entries in this section have missing external blobs + + If there are missing blobs, the entries are added to the list + + Args: + missing_list: List of Entry objects to be added to + """ + for entry in self._entries.values(): + entry.CheckMissing(missing_list) diff --git a/tools/binman/ftest.py b/tools/binman/ftest.py index 928d3608a3..cc551c9f17 100644 --- a/tools/binman/ftest.py +++ b/tools/binman/ftest.py @@ -3380,7 +3380,19 @@ class TestFunctional(unittest.TestCase):
def testExtblobMissingOk(self): """Test an image with an missing external blob that is allowed""" - self._DoTestFile('158_blob_ext_missing.dts', allow_missing=True) + with test_util.capture_sys_output() as (stdout, stderr): + self._DoTestFile('158_blob_ext_missing.dts', allow_missing=True) + err = stderr.getvalue() + self.assertRegex(err, "Image 'main-section'.*missing.*: blob-ext") + + def testExtblobMissingOkSect(self): + """Test an image with an missing external blob that is allowed""" + with test_util.capture_sys_output() as (stdout, stderr): + self._DoTestFile('159_blob_ext_missing_sect.dts', + allow_missing=True) + err = stderr.getvalue() + self.assertRegex(err, "Image 'main-section'.*missing.*: " + "blob-ext blob-ext2")
if __name__ == "__main__": diff --git a/tools/binman/test/159_blob_ext_missing_sect.dts b/tools/binman/test/159_blob_ext_missing_sect.dts new file mode 100644 index 0000000000..5f14c54138 --- /dev/null +++ b/tools/binman/test/159_blob_ext_missing_sect.dts @@ -0,0 +1,23 @@ +// SPDX-License-Identifier: GPL-2.0+ + +/dts-v1/; + +/ { + #address-cells = <1>; + #size-cells = <1>; + + binman { + size = <0x80>; + + section { + blob-ext { + filename = "missing-file"; + }; + }; + + blob-ext2 { + type = "blob-ext"; + filename = "missing-file2"; + }; + }; +}; diff --git a/tools/patman/tout.py b/tools/patman/tout.py index 91a53f4073..33305263d8 100644 --- a/tools/patman/tout.py +++ b/tools/patman/tout.py @@ -171,6 +171,7 @@ def Init(_verbose=WARNING, stdout=sys.stdout):
# TODO(sjg): Move this into Chromite libraries when we have them stdout_is_tty = hasattr(sys.stdout, 'isatty') and sys.stdout.isatty() + stderr_is_tty = hasattr(sys.stderr, 'isatty') and sys.stderr.isatty()
def Uninit(): ClearProgress()

When external blobs are missing, show a message indicating that the images are not functional.
Signed-off-by: Simon Glass sjg@chromium.org ---
Changes in v3: - Move the SetAllowMissing() function into an earlier patch
tools/binman/control.py | 16 +++++++++++-- tools/binman/entry.py | 12 ++++++++++ tools/binman/etype/blob_ext.py | 1 + tools/binman/etype/section.py | 12 ++++++++++ tools/binman/ftest.py | 14 ++++++++++- .../binman/test/159_blob_ext_missing_sect.dts | 23 +++++++++++++++++++ tools/patman/tout.py | 1 + 7 files changed, 76 insertions(+), 3 deletions(-) create mode 100644 tools/binman/test/159_blob_ext_missing_sect.dts
Applied to u-boot-dm

Update the Intel blob entries to support missing binaries.
Signed-off-by: Simon Glass sjg@chromium.org Reviewed-by: Bin Meng bmeng.cn@gmail.com ---
(no changes since v1)
tools/binman/etype/intel_descriptor.py | 7 ++++- tools/binman/etype/intel_ifwi.py | 17 ++++++++--- tools/binman/etype/section.py | 4 +-- tools/binman/ftest.py | 41 +++++++++++++++++++++----- 4 files changed, 55 insertions(+), 14 deletions(-)
diff --git a/tools/binman/etype/intel_descriptor.py b/tools/binman/etype/intel_descriptor.py index 5b18893ccd..7fe88a9ec1 100644 --- a/tools/binman/etype/intel_descriptor.py +++ b/tools/binman/etype/intel_descriptor.py @@ -55,6 +55,12 @@ class Entry_intel_descriptor(Entry_blob_ext): return super().Pack(offset)
def GetOffsets(self): + info = {} + if self.missing: + # Return zero offsets so that these entries get placed somewhere + if self.HasSibling('intel-me'): + info['intel-me'] = [0, None] + return info offset = self.data.find(FD_SIGNATURE) if offset == -1: self.Raise('Cannot find Intel Flash Descriptor (FD) signature') @@ -66,7 +72,6 @@ class Entry_intel_descriptor(Entry_blob_ext):
# Set the offset for ME (Management Engine) and IFWI (Integrated # Firmware Image), for now, since the others are not used. - info = {} if self.HasSibling('intel-me'): info['intel-me'] = [self._regions[REGION_ME].base, self._regions[REGION_ME].size] diff --git a/tools/binman/etype/intel_ifwi.py b/tools/binman/etype/intel_ifwi.py index b0c2b1aaa3..76b3357c25 100644 --- a/tools/binman/etype/intel_ifwi.py +++ b/tools/binman/etype/intel_ifwi.py @@ -84,7 +84,7 @@ class Entry_intel_ifwi(Entry_blob_ext): return True
def ObtainContents(self): - """Get the contects for the IFWI + """Get the contents for the IFWI
Unfortunately we cannot create anything from scratch here, as Intel has tools which create precursor binaries with lots of data and settings, @@ -97,13 +97,21 @@ class Entry_intel_ifwi(Entry_blob_ext): After that we delete the OBBP sub-partition and add each of the files that we want in the IFWI file, one for each sub-entry of the IWFI node. """ - self._pathname = tools.GetInputFilename(self._filename) + self._pathname = tools.GetInputFilename(self._filename, + self.section.GetAllowMissing()) + # Allow the file to be missing + if not self._pathname: + self.SetContents(b'') + self.missing = True + return True for entry in self._ifwi_entries.values(): if not entry.ObtainContents(): return False return self._BuildIfwi()
def ProcessContents(self): + if self.missing: + return True orig_data = self.data self._BuildIfwi() same = orig_data == self.data @@ -121,5 +129,6 @@ class Entry_intel_ifwi(Entry_blob_ext):
def WriteSymbols(self, section): """Write symbol values into binary files for access at run time""" - for entry in self._ifwi_entries.values(): - entry.WriteSymbols(self) + if not self.missing: + for entry in self._ifwi_entries.values(): + entry.WriteSymbols(self) diff --git a/tools/binman/etype/section.py b/tools/binman/etype/section.py index dd7f1ccd09..7cd12c0204 100644 --- a/tools/binman/etype/section.py +++ b/tools/binman/etype/section.py @@ -442,8 +442,8 @@ class Entry_section(Entry): if not entry: self._Raise("Unable to set offset/size for unknown entry '%s'" % name) - entry.SetOffsetSize(self._skip_at_start + offset if offset else None, - size) + entry.SetOffsetSize(self._skip_at_start + offset if offset is not None + else None, size)
def GetEntryOffsets(self): """Handle entries that want to set the offset/size of other entries diff --git a/tools/binman/ftest.py b/tools/binman/ftest.py index cc551c9f17..146d4c51d3 100644 --- a/tools/binman/ftest.py +++ b/tools/binman/ftest.py @@ -160,8 +160,7 @@ class TestFunctional(unittest.TestCase): tools.ReadFile(cls.ElfTestFile('u_boot_ucode_ptr')))
# Intel flash descriptor file - with open(cls.TestFile('descriptor.bin'), 'rb') as fd: - TestFunctional._MakeInputFile('descriptor.bin', fd.read()) + cls._SetupDescriptor()
shutil.copytree(cls.TestFile('files'), os.path.join(cls._indir, 'files')) @@ -507,6 +506,11 @@ class TestFunctional(unittest.TestCase): TestFunctional._MakeInputFile('tpl/u-boot-tpl', tools.ReadFile(cls.ElfTestFile(src_fname)))
+ @classmethod + def _SetupDescriptor(cls): + with open(cls.TestFile('descriptor.bin'), 'rb') as fd: + TestFunctional._MakeInputFile('descriptor.bin', fd.read()) + @classmethod def TestFile(cls, fname): return os.path.join(cls._binman_dir, 'test', fname) @@ -933,11 +937,14 @@ class TestFunctional(unittest.TestCase):
def testPackX86RomMeNoDesc(self): """Test that an invalid Intel descriptor entry is detected""" - TestFunctional._MakeInputFile('descriptor.bin', b'') - with self.assertRaises(ValueError) as e: - self._DoTestFile('031_x86_rom_me.dts') - self.assertIn("Node '/binman/intel-descriptor': Cannot find Intel Flash Descriptor (FD) signature", - str(e.exception)) + try: + TestFunctional._MakeInputFile('descriptor.bin', b'') + with self.assertRaises(ValueError) as e: + self._DoTestFile('031_x86_rom_me.dts') + self.assertIn("Node '/binman/intel-descriptor': Cannot find Intel Flash Descriptor (FD) signature", + str(e.exception)) + finally: + self._SetupDescriptor()
def testPackX86RomBadDesc(self): """Test that the Intel requires a descriptor entry""" @@ -3394,6 +3401,26 @@ class TestFunctional(unittest.TestCase): self.assertRegex(err, "Image 'main-section'.*missing.*: " "blob-ext blob-ext2")
+ def testPackX86RomMeMissingDesc(self): + """Test that an missing Intel descriptor entry is allowed""" + pathname = os.path.join(self._indir, 'descriptor.bin') + os.remove(pathname) + with test_util.capture_sys_output() as (stdout, stderr): + self._DoTestFile('031_x86_rom_me.dts', allow_missing=True) + err = stderr.getvalue() + self.assertRegex(err, + "Image 'main-section'.*missing.*: intel-descriptor") + + def testPackX86RomMissingIfwi(self): + """Test that an x86 ROM with Integrated Firmware Image can be created""" + self._SetupIfwi('fitimage.bin') + pathname = os.path.join(self._indir, 'fitimage.bin') + os.remove(pathname) + with test_util.capture_sys_output() as (stdout, stderr): + self._DoTestFile('111_x86_rom_ifwi.dts', allow_missing=True) + err = stderr.getvalue() + self.assertRegex(err, "Image 'main-section'.*missing.*: intel-ifwi") +
if __name__ == "__main__": unittest.main()

Update the Intel blob entries to support missing binaries.
Signed-off-by: Simon Glass sjg@chromium.org Reviewed-by: Bin Meng bmeng.cn@gmail.com ---
(no changes since v1)
tools/binman/etype/intel_descriptor.py | 7 ++++- tools/binman/etype/intel_ifwi.py | 17 ++++++++--- tools/binman/etype/section.py | 4 +-- tools/binman/ftest.py | 41 +++++++++++++++++++++----- 4 files changed, 55 insertions(+), 14 deletions(-)
Applied to u-boot-dm

Some binary blobs unfortunately obtain their position in the image from other binary blobs, such as Intel's 'descriptor'. In this case we cannot rely on packing to work. It is not possible to produce a valid image in any case, due to the missing blobs.
Allow zero-length overlaps so that this does not cause any problems.
Signed-off-by: Simon Glass sjg@chromium.org Reviewed-by: Bin Meng bmeng.cn@gmail.com ---
(no changes since v1)
tools/binman/etype/section.py | 2 +- tools/binman/ftest.py | 4 ++++ tools/binman/test/160_pack_overlap_zero.dts | 18 ++++++++++++++++++ 3 files changed, 23 insertions(+), 1 deletion(-) create mode 100644 tools/binman/test/160_pack_overlap_zero.dts
diff --git a/tools/binman/etype/section.py b/tools/binman/etype/section.py index 7cd12c0204..73c5553c81 100644 --- a/tools/binman/etype/section.py +++ b/tools/binman/etype/section.py @@ -226,7 +226,7 @@ class Entry_section(Entry): "at %#x (%d)" % (entry.offset, entry.offset, self._skip_at_start, self._skip_at_start)) - if entry.offset < offset: + if entry.offset < offset and entry.size: entry.Raise("Offset %#x (%d) overlaps with previous entry '%s' " "ending at %#x (%d)" % (entry.offset, entry.offset, prev_name, offset, offset)) diff --git a/tools/binman/ftest.py b/tools/binman/ftest.py index 146d4c51d3..614ac4ed39 100644 --- a/tools/binman/ftest.py +++ b/tools/binman/ftest.py @@ -3421,6 +3421,10 @@ class TestFunctional(unittest.TestCase): err = stderr.getvalue() self.assertRegex(err, "Image 'main-section'.*missing.*: intel-ifwi")
+ def testPackOverlap(self): + """Test that zero-size overlapping regions are ignored""" + self._DoTestFile('160_pack_overlap_zero.dts') +
if __name__ == "__main__": unittest.main() diff --git a/tools/binman/test/160_pack_overlap_zero.dts b/tools/binman/test/160_pack_overlap_zero.dts new file mode 100644 index 0000000000..731aa1cbe6 --- /dev/null +++ b/tools/binman/test/160_pack_overlap_zero.dts @@ -0,0 +1,18 @@ +// SPDX-License-Identifier: GPL-2.0+ + +/dts-v1/; + +/ { + #address-cells = <1>; + #size-cells = <1>; + + binman { + u-boot { + }; + + fill { + size = <0>; + offset = <3>; + }; + }; +};

Some binary blobs unfortunately obtain their position in the image from other binary blobs, such as Intel's 'descriptor'. In this case we cannot rely on packing to work. It is not possible to produce a valid image in any case, due to the missing blobs.
Allow zero-length overlaps so that this does not cause any problems.
Signed-off-by: Simon Glass sjg@chromium.org Reviewed-by: Bin Meng bmeng.cn@gmail.com ---
(no changes since v1)
tools/binman/etype/section.py | 2 +- tools/binman/ftest.py | 4 ++++ tools/binman/test/160_pack_overlap_zero.dts | 18 ++++++++++++++++++ 3 files changed, 23 insertions(+), 1 deletion(-) create mode 100644 tools/binman/test/160_pack_overlap_zero.dts
Applied to u-boot-dm

Normally the FIT timestamp is created the first time mkimage is run on a FIT, when converting the source .its to the binary .fit file. This corresponds to using the -f flag. But if the original input to mkimage is a binary file (already compiled) then the timestamp is assumed to have been set previously.
Add a -t flag to allow setting the timestamp in this case.
Signed-off-by: Simon Glass sjg@chromium.org Reviewed-by: Bin Meng bmeng.cn@gmail.com ---
(no changes since v1)
doc/mkimage.1 | 9 +++++++++ tools/fit_image.c | 2 +- tools/imagetool.h | 1 + tools/mkimage.c | 5 ++++- 4 files changed, 15 insertions(+), 2 deletions(-)
diff --git a/doc/mkimage.1 b/doc/mkimage.1 index 3dcdcedcef..fea5288784 100644 --- a/doc/mkimage.1 +++ b/doc/mkimage.1 @@ -167,6 +167,15 @@ Specifies that keys used to sign the FIT are required. This means that they must be verified for the image to boot. Without this option, the verification will be optional (useful for testing but not for release).
+.TP +.BI "-t +Update the timestamp in the FIT. + +Normally the FIT timestamp is created the first time mkimage is run on a FIT, +when converting the source .its to the binary .fit file. This corresponds to +using the -f flag. But if the original input to mkimage is a binary file +(already compiled) then the timestamp is assumed to have been set previously. + .SH EXAMPLES
List image information: diff --git a/tools/fit_image.c b/tools/fit_image.c index a082d9386d..df310b53da 100644 --- a/tools/fit_image.c +++ b/tools/fit_image.c @@ -53,7 +53,7 @@ static int fit_add_file_data(struct image_tool_params *params, size_t size_inc, }
/* for first image creation, add a timestamp at offset 0 i.e., root */ - if (params->datafile) { + if (params->datafile || params->reset_timestamp) { time_t time = imagetool_get_source_date(params->cmdname, sbuf.st_mtime); ret = fit_set_timestamp(ptr, 0, time); diff --git a/tools/imagetool.h b/tools/imagetool.h index f54809cd57..acbc48e9be 100644 --- a/tools/imagetool.h +++ b/tools/imagetool.h @@ -81,6 +81,7 @@ struct image_tool_params { unsigned int external_offset; /* Add padding to external data */ int bl_len; /* Block length in byte for external data */ const char *engine_id; /* Engine to use for signing */ + bool reset_timestamp; /* Reset the timestamp on an existing image */ };
/* diff --git a/tools/mkimage.c b/tools/mkimage.c index d2cd191787..a7eb4d4360 100644 --- a/tools/mkimage.c +++ b/tools/mkimage.c @@ -145,7 +145,7 @@ static void process_args(int argc, char **argv) int opt;
while ((opt = getopt(argc, argv, - "a:A:b:B:c:C:d:D:e:Ef:Fk:i:K:ln:N:p:O:rR:qsT:vVx")) != -1) { + "a:A:b:B:c:C:d:D:e:Ef:Fk:i:K:ln:N:p:O:rR:qstT:vVx")) != -1) { switch (opt) { case 'a': params.addr = strtoull(optarg, &ptr, 16); @@ -269,6 +269,9 @@ static void process_args(int argc, char **argv) case 's': params.skipcpy = 1; break; + case 't': + params.reset_timestamp = 1; + break; case 'T': if (strcmp(optarg, "list") == 0) { show_valid_options(IH_TYPE);

Normally the FIT timestamp is created the first time mkimage is run on a FIT, when converting the source .its to the binary .fit file. This corresponds to using the -f flag. But if the original input to mkimage is a binary file (already compiled) then the timestamp is assumed to have been set previously.
Add a -t flag to allow setting the timestamp in this case.
Signed-off-by: Simon Glass sjg@chromium.org Reviewed-by: Bin Meng bmeng.cn@gmail.com ---
(no changes since v1)
doc/mkimage.1 | 9 +++++++++ tools/fit_image.c | 2 +- tools/imagetool.h | 1 + tools/mkimage.c | 5 ++++- 4 files changed, 15 insertions(+), 2 deletions(-)
Applied to u-boot-dm

Add a method for adding a property containing arbitrary bytes. Make sure that the tree can expand as needed in this case.
Signed-off-by: Simon Glass sjg@chromium.org ---
(no changes since v1)
tools/dtoc/fdt.py | 17 +++++++++++++++-- tools/dtoc/test_fdt.py | 4 ++++ 2 files changed, 19 insertions(+), 2 deletions(-)
diff --git a/tools/dtoc/fdt.py b/tools/dtoc/fdt.py index 188490b728..d058c59e92 100644 --- a/tools/dtoc/fdt.py +++ b/tools/dtoc/fdt.py @@ -207,7 +207,8 @@ class Prop: if auto_resize: while fdt_obj.setprop(node.Offset(), self.name, self.bytes, (libfdt.NOSPACE,)) == -libfdt.NOSPACE: - fdt_obj.resize(fdt_obj.totalsize() + 1024) + fdt_obj.resize(fdt_obj.totalsize() + 1024 + + len(self.bytes)) fdt_obj.setprop(node.Offset(), self.name, self.bytes) else: fdt_obj.setprop(node.Offset(), self.name, self.bytes) @@ -410,6 +411,18 @@ class Node: val = val.encode('utf-8') self._CheckProp(prop_name).props[prop_name].SetData(val + b'\0')
+ def AddData(self, prop_name, val): + """Add a new property to a node + + The device tree is marked dirty so that the value will be written to + the blob on the next sync. + + Args: + prop_name: Name of property to add + val: Bytes value of property + """ + self.props[prop_name] = Prop(self, None, prop_name, val) + def AddString(self, prop_name, val): """Add a new string property to a node
@@ -422,7 +435,7 @@ class Node: """ if sys.version_info[0] >= 3: # pragma: no cover val = bytes(val, 'utf-8') - self.props[prop_name] = Prop(self, None, prop_name, val + b'\0') + self.AddData(prop_name, val + b'\0')
def AddSubnode(self, name): """Add a new subnode to the node diff --git a/tools/dtoc/test_fdt.py b/tools/dtoc/test_fdt.py index 375e906424..b4f9b7f498 100755 --- a/tools/dtoc/test_fdt.py +++ b/tools/dtoc/test_fdt.py @@ -417,6 +417,10 @@ class TestProp(unittest.TestCase): self.node.SetData('empty', b'123') self.assertEqual(b'123', prop.bytes)
+ # Trying adding a lot of data at once + self.node.AddData('data', tools.GetBytes(65, 20000)) + self.dtb.Sync(auto_resize=True) + def testFromData(self): dtb2 = fdt.Fdt.FromData(self.dtb.GetContents()) self.assertEqual(dtb2.GetContents(), self.dtb.GetContents())

Add a method for adding a property containing arbitrary bytes. Make sure that the tree can expand as needed in this case.
Signed-off-by: Simon Glass sjg@chromium.org ---
(no changes since v1)
tools/dtoc/fdt.py | 17 +++++++++++++++-- tools/dtoc/test_fdt.py | 4 ++++ 2 files changed, 19 insertions(+), 2 deletions(-)
Applied to u-boot-dm

FIT (Flat Image Tree) is the main image format used by U-Boot. In some cases scripts are used to create FITs within the U-Boot build system. This is not ideal for various reasons:
- Each architecture has its own slightly different script - There are no tests - Some are written in shell, some in Python
To help address this, add support for FIT generation to binman. This works by putting the FIT source directly in the binman definition, with the ability to adjust parameters, etc. The contents of each FIT image come from sub-entries of the image, as is normal with binman.
Signed-off-by: Simon Glass sjg@chromium.org ---
(no changes since v1)
tools/binman/README.entries | 40 ++++++ tools/binman/etype/fit.py | 164 +++++++++++++++++++++++++ tools/binman/ftest.py | 54 ++++++++ tools/binman/test/161_fit.dts | 62 ++++++++++ tools/binman/test/162_fit_external.dts | 64 ++++++++++ 5 files changed, 384 insertions(+) create mode 100644 tools/binman/etype/fit.py create mode 100644 tools/binman/test/161_fit.dts create mode 100644 tools/binman/test/162_fit_external.dts
diff --git a/tools/binman/README.entries b/tools/binman/README.entries index f45f51428a..bf8edce02b 100644 --- a/tools/binman/README.entries +++ b/tools/binman/README.entries @@ -311,6 +311,46 @@ byte value of a region.
+Entry: fit: Entry containing a FIT +---------------------------------- + +This calls mkimage to create a FIT (U-Boot Flat Image Tree) based on the +input provided. + +Nodes for the FIT should be written out in the binman configuration just as +they would be in a file passed to mkimage. + +For example, this creates an image containing a FIT with U-Boot SPL: + + binman { + fit { + description = "Test FIT"; + + images { + kernel@1 { + description = "SPL"; + os = "u-boot"; + type = "rkspi"; + arch = "arm"; + compression = "none"; + load = <0>; + entry = <0>; + + u-boot-spl { + }; + }; + }; + }; + }; + +Properties: + fit,external-offset: Indicates that the contents of the FIT are external + and provides the external offset. This is passsed to mkimage via + the -E and -p flags. + + + + Entry: fmap: An entry which contains an Fmap section ----------------------------------------------------
diff --git a/tools/binman/etype/fit.py b/tools/binman/etype/fit.py new file mode 100644 index 0000000000..75712f4409 --- /dev/null +++ b/tools/binman/etype/fit.py @@ -0,0 +1,164 @@ +# SPDX-License-Identifier: GPL-2.0+ +# Copyright (c) 2016 Google, Inc +# Written by Simon Glass sjg@chromium.org +# +# Entry-type module for producing a FIT +# + +from collections import defaultdict, OrderedDict +import libfdt + +from binman.entry import Entry +from dtoc import fdt_util +from dtoc.fdt import Fdt +from patman import tools + +class Entry_fit(Entry): + """Entry containing a FIT + + This calls mkimage to create a FIT (U-Boot Flat Image Tree) based on the + input provided. + + Nodes for the FIT should be written out in the binman configuration just as + they would be in a file passed to mkimage. + + For example, this creates an image containing a FIT with U-Boot SPL: + + binman { + fit { + description = "Test FIT"; + + images { + kernel@1 { + description = "SPL"; + os = "u-boot"; + type = "rkspi"; + arch = "arm"; + compression = "none"; + load = <0>; + entry = <0>; + + u-boot-spl { + }; + }; + }; + }; + }; + + Properties: + fit,external-offset: Indicates that the contents of the FIT are external + and provides the external offset. This is passsed to mkimage via + the -E and -p flags. + + """ + def __init__(self, section, etype, node): + """ + Members: + _fit: FIT file being built + _fit_content: dict: + key: relative path to entry Node (from the base of the FIT) + value: List of Entry objects comprising the contents of this + node + """ + super().__init__(section, etype, node) + self._fit = None + self._fit_content = defaultdict(list) + self._fit_props = {} + + def ReadNode(self): + self._ReadSubnodes() + super().ReadNode() + + def _ReadSubnodes(self): + def _AddNode(base_node, depth, node): + """Add a node to the FIT + + Args: + base_node: Base Node of the FIT (with 'description' property) + depth: Current node depth (0 is the base node) + node: Current node to process + + There are two cases to deal with: + - hash and signature nodes which become part of the FIT + - binman entries which are used to define the 'data' for each + image + """ + for pname, prop in node.props.items(): + if pname.startswith('fit,'): + self._fit_props[pname] = prop + else: + fsw.property(pname, prop.bytes) + + rel_path = node.path[len(base_node.path):] + has_images = depth == 2 and rel_path.startswith('/images/') + for subnode in node.subnodes: + if has_images and not (subnode.name.startswith('hash') or + subnode.name.startswith('signature')): + # This is a content node. We collect all of these together + # and put them in the 'data' property. They do not appear + # in the FIT. + entry = Entry.Create(self.section, subnode) + entry.ReadNode() + self._fit_content[rel_path].append(entry) + else: + with fsw.add_node(subnode.name): + _AddNode(base_node, depth + 1, subnode) + + # Build a new tree with all nodes and properties starting from the + # entry node + fsw = libfdt.FdtSw() + fsw.finish_reservemap() + with fsw.add_node(''): + _AddNode(self._node, 0, self._node) + fdt = fsw.as_fdt() + + # Pack this new FDT and scan it so we can add the data later + fdt.pack() + self._fdt = Fdt.FromData(fdt.as_bytearray()) + self._fdt.Scan() + + def ObtainContents(self): + """Obtain the contents of the FIT + + This adds the 'data' properties to the input ITB (Image-tree Binary) + then runs mkimage to process it. + """ + data = self._BuildInput(self._fdt) + if data == False: + return False + uniq = self.GetUniqueName() + input_fname = tools.GetOutputFilename('%s.itb' % uniq) + output_fname = tools.GetOutputFilename('%s.fit' % uniq) + tools.WriteFile(input_fname, data) + tools.WriteFile(output_fname, data) + + args = [] + ext_offset = self._fit_props.get('fit,external-offset') + if ext_offset is not None: + args += ['-E', '-p', '%x' % fdt_util.fdt32_to_cpu(ext_offset.value)] + tools.Run('mkimage', '-t', '-F', output_fname, *args) + + self.SetContents(tools.ReadFile(output_fname)) + return True + + def _BuildInput(self, fdt): + """Finish the FIT by adding the 'data' properties to it + + Arguments: + fdt: FIT to update + + Returns: + New fdt contents (bytes) + """ + for path, entries in self._fit_content.items(): + node = fdt.GetNode(path) + data = b'' + for entry in entries: + if not entry.ObtainContents(): + return False + data += entry.GetData() + node.AddData('data', data) + + fdt.Sync(auto_resize=True) + data = fdt.GetContents() + return data diff --git a/tools/binman/ftest.py b/tools/binman/ftest.py index 614ac4ed39..ea72eff8c5 100644 --- a/tools/binman/ftest.py +++ b/tools/binman/ftest.py @@ -6,10 +6,12 @@ # # python -m unittest func_test.TestFunctional.testHelp
+import collections import gzip import hashlib from optparse import OptionParser import os +import re import shutil import struct import sys @@ -3425,6 +3427,58 @@ class TestFunctional(unittest.TestCase): """Test that zero-size overlapping regions are ignored""" self._DoTestFile('160_pack_overlap_zero.dts')
+ def testSimpleFit(self): + """Test an image with a FIT inside""" + data = self._DoReadFile('161_fit.dts') + self.assertEqual(U_BOOT_DATA, data[:len(U_BOOT_DATA)]) + self.assertEqual(U_BOOT_NODTB_DATA, data[-len(U_BOOT_NODTB_DATA):]) + fit_data = data[len(U_BOOT_DATA):-len(U_BOOT_NODTB_DATA)] + + # The data should be inside the FIT + dtb = fdt.Fdt.FromData(fit_data) + dtb.Scan() + fnode = dtb.GetNode('/images/kernel') + self.assertIn('data', fnode.props) + + fname = os.path.join(self._indir, 'fit_data.fit') + tools.WriteFile(fname, fit_data) + out = tools.Run('dumpimage', '-l', fname) + + # Check a few features to make sure the plumbing works. We don't need + # to test the operation of mkimage or dumpimage here. First convert the + # output into a dict where the keys are the fields printed by dumpimage + # and the values are a list of values for each field + lines = out.splitlines() + + # Converts "Compression: gzip compressed" into two groups: + # 'Compression' and 'gzip compressed' + re_line = re.compile(r'^ *([^:]*)(?:: *(.*))?$') + vals = collections.defaultdict(list) + for line in lines: + mat = re_line.match(line) + vals[mat.group(1)].append(mat.group(2)) + + self.assertEquals('FIT description: test-desc', lines[0]) + self.assertIn('Created:', lines[1]) + self.assertIn('Image 0 (kernel)', vals) + self.assertIn('Hash value', vals) + data_sizes = vals.get('Data Size') + self.assertIsNotNone(data_sizes) + self.assertEqual(2, len(data_sizes)) + # Format is "4 Bytes = 0.00 KiB = 0.00 MiB" so take the first word + self.assertEqual(len(U_BOOT_DATA), int(data_sizes[0].split()[0])) + self.assertEqual(len(U_BOOT_SPL_DTB_DATA), int(data_sizes[1].split()[0])) + + def testFitExternal(self): + """Test an image with an FIT""" + data = self._DoReadFile('162_fit_external.dts') + fit_data = data[len(U_BOOT_DATA):-2] # _testing is 2 bytes + + # The data should be outside the FIT + dtb = fdt.Fdt.FromData(fit_data) + dtb.Scan() + fnode = dtb.GetNode('/images/kernel') + self.assertNotIn('data', fnode.props)
if __name__ == "__main__": unittest.main() diff --git a/tools/binman/test/161_fit.dts b/tools/binman/test/161_fit.dts new file mode 100644 index 0000000000..c52d760b73 --- /dev/null +++ b/tools/binman/test/161_fit.dts @@ -0,0 +1,62 @@ +// SPDX-License-Identifier: GPL-2.0+ + +/dts-v1/; + +/ { + #address-cells = <1>; + #size-cells = <1>; + + binman { + u-boot { + }; + fit { + description = "test-desc"; + #address-cells = <1>; + + images { + kernel { + description = "Vanilla Linux kernel"; + type = "kernel"; + arch = "ppc"; + os = "linux"; + compression = "gzip"; + load = <00000000>; + entry = <00000000>; + hash-1 { + algo = "crc32"; + }; + hash-2 { + algo = "sha1"; + }; + u-boot { + }; + }; + fdt-1 { + description = "Flattened Device Tree blob"; + type = "flat_dt"; + arch = "ppc"; + compression = "none"; + hash-1 { + algo = "crc32"; + }; + hash-2 { + algo = "sha1"; + }; + u-boot-spl-dtb { + }; + }; + }; + + configurations { + default = "conf-1"; + conf-1 { + description = "Boot Linux kernel with FDT blob"; + kernel = "kernel"; + fdt = "fdt-1"; + }; + }; + }; + u-boot-nodtb { + }; + }; +}; diff --git a/tools/binman/test/162_fit_external.dts b/tools/binman/test/162_fit_external.dts new file mode 100644 index 0000000000..19518e05a5 --- /dev/null +++ b/tools/binman/test/162_fit_external.dts @@ -0,0 +1,64 @@ +// SPDX-License-Identifier: GPL-2.0+ + +/dts-v1/; + +/ { + #address-cells = <1>; + #size-cells = <1>; + + binman { + u-boot { + }; + fit { + fit,external-offset = <0>; + description = "test-desc"; + #address-cells = <1>; + + images { + kernel { + description = "Vanilla Linux kernel"; + type = "kernel"; + arch = "ppc"; + os = "linux"; + compression = "gzip"; + load = <00000000>; + entry = <00000000>; + hash-1 { + algo = "crc32"; + }; + hash-2 { + algo = "sha1"; + }; + u-boot { + }; + }; + fdt-1 { + description = "Flattened Device Tree blob"; + type = "flat_dt"; + arch = "ppc"; + compression = "none"; + hash-1 { + algo = "crc32"; + }; + hash-2 { + algo = "sha1"; + }; + _testing { + return-contents-later; + }; + }; + }; + + configurations { + default = "conf-1"; + conf-1 { + description = "Boot Linux kernel with FDT blob"; + kernel = "kernel"; + fdt = "fdt-1"; + }; + }; + }; + u-boot-nodtb { + }; + }; +};

FIT (Flat Image Tree) is the main image format used by U-Boot. In some cases scripts are used to create FITs within the U-Boot build system. This is not ideal for various reasons:
- Each architecture has its own slightly different script - There are no tests - Some are written in shell, some in Python
To help address this, add support for FIT generation to binman. This works by putting the FIT source directly in the binman definition, with the ability to adjust parameters, etc. The contents of each FIT image come from sub-entries of the image, as is normal with binman.
Signed-off-by: Simon Glass sjg@chromium.org ---
(no changes since v1)
tools/binman/README.entries | 40 ++++++ tools/binman/etype/fit.py | 164 +++++++++++++++++++++++++ tools/binman/ftest.py | 54 ++++++++ tools/binman/test/161_fit.dts | 62 ++++++++++ tools/binman/test/162_fit_external.dts | 64 ++++++++++ 5 files changed, 384 insertions(+) create mode 100644 tools/binman/etype/fit.py create mode 100644 tools/binman/test/161_fit.dts create mode 100644 tools/binman/test/162_fit_external.dts
Applied to u-boot-dm

Most x86 boards build a u-boot.rom which is programmed into SPI flash. But this is not unique to x86. For example some rockchip boards can also boot from SPI flash.
Also, at least on x86, binary blobs are sadly quite common. It is not possible to build a functional image without them, and U-Boot needs to know this at build time.
Introduce a new CONFIG_HAS_ROM option which selects whether u-boot.rom is built and a new CONFIG_ROM_NEEDS_BLOBS option to indicate whether binary blobs are also needed. If they are not needed, it is safe to build the ROM always. Otherwise we still require the BUILD_ROM environment variable.
For now this affects only x86, but future patches will enable this for rockchip too.
Signed-off-by: Simon Glass sjg@chromium.org ---
(no changes since v2)
Changes in v2: - Drop 'rockchip' tag since this commit no-longer affects rockchip yet - Drop ROM_NEEDS_BLOBS for baytrail since HAVE_FSP already selects it
Kconfig | 18 +++++++++++++++++- Makefile | 18 +++++++++++++----- arch/Kconfig | 1 + arch/x86/Kconfig | 4 ++++ arch/x86/cpu/quark/Kconfig | 1 + 5 files changed, 36 insertions(+), 6 deletions(-)
diff --git a/Kconfig b/Kconfig index 99bc5fab02..7f469748e8 100644 --- a/Kconfig +++ b/Kconfig @@ -276,9 +276,25 @@ config PHYS_64BIT This can be used not only for 64bit SoCs, but also for large physical address extension on 32bit SoCs.
+config HAS_ROM + bool + select BINMAN + help + Enables building of a u-boot.rom target. This collects U-Boot and + any necessary binary blobs. + +config ROM_NEEDS_BLOBS + bool + depends on HAS_ROM + help + Enable this if building the u-boot.rom target needs binary blobs, and + so cannot be done normally. In this case, pass BUILD_ROM=1 to make + to tell U-Boot to build the ROM. + config BUILD_ROM bool "Build U-Boot as BIOS replacement" - depends on X86 + depends on HAS_ROM + default y if !ROM_NEEDS_BLOBS help This option allows to build a ROM version of U-Boot. The build process generally requires several binary blobs diff --git a/Makefile b/Makefile index 6ae2a9e06c..685a7a2796 100644 --- a/Makefile +++ b/Makefile @@ -919,9 +919,12 @@ ALL-$(CONFIG_REMAKE_ELF) += u-boot.elf ALL-$(CONFIG_EFI_APP) += u-boot-app.efi ALL-$(CONFIG_EFI_STUB) += u-boot-payload.efi
+ifneq ($(CONFIG_HAS_ROM),) ifneq ($(BUILD_ROM)$(CONFIG_BUILD_ROM),) -ALL-$(CONFIG_X86_RESET_VECTOR) += u-boot.rom +ALL-y += u-boot.rom endif +endif + ifeq ($(CONFIG_SYS_COREBOOT)$(CONFIG_SPL),yy) ALL-$(CONFIG_BINMAN) += u-boot-x86-with-spl.bin endif @@ -1583,7 +1586,7 @@ endif # reset vector) at the top, Intel ME descriptor at the bottom, and U-Boot in # the middle. This is handled by binman based on an image description in the # board's device tree. -ifneq ($(CONFIG_X86_RESET_VECTOR),) +ifneq ($(CONFIG_HAS_ROM),) rom: u-boot.rom FORCE
refcode.bin: $(srctree)/board/$(BOARDDIR)/refcode.bin FORCE @@ -1593,11 +1596,12 @@ quiet_cmd_ldr = LD $@ cmd_ldr = $(LD) $(LDFLAGS_$(@F)) \ $(filter-out FORCE,$^) -o $@
-u-boot.rom: u-boot-x86-start16.bin u-boot-x86-reset16.bin u-boot.bin \ +rom-deps := u-boot.bin +ifdef CONFIG_X86 +rom-deps += u-boot-x86-start16.bin u-boot-x86-reset16.bin \ $(if $(CONFIG_SPL_X86_16BIT_INIT),spl/u-boot-spl.bin) \ $(if $(CONFIG_TPL_X86_16BIT_INIT),tpl/u-boot-tpl.bin) \ - $(if $(CONFIG_HAVE_REFCODE),refcode.bin) FORCE - $(call if_changed,binman) + $(if $(CONFIG_HAVE_REFCODE),refcode.bin)
OBJCOPYFLAGS_u-boot-x86-start16.bin := -O binary -j .start16 u-boot-x86-start16.bin: u-boot FORCE @@ -1608,6 +1612,10 @@ u-boot-x86-reset16.bin: u-boot FORCE $(call if_changed,objcopy) endif
+u-boot.rom: $(rom-deps) FORCE + $(call if_changed,binman) +endif + ifneq ($(CONFIG_ARCH_SUNXI),) ifeq ($(CONFIG_ARM64),) u-boot-sunxi-with-spl.bin: spl/sunxi-spl.bin u-boot.img u-boot.dtb FORCE diff --git a/arch/Kconfig b/arch/Kconfig index a11f872938..ff417d40fd 100644 --- a/arch/Kconfig +++ b/arch/Kconfig @@ -160,6 +160,7 @@ config X86 select TIMER select USE_PRIVATE_LIBGCC select X86_TSC_TIMER + imply HAS_ROM if X86_RESET_VECTOR imply BLK imply CMD_DM imply CMD_FPGA_LOADMK diff --git a/arch/x86/Kconfig b/arch/x86/Kconfig index c8eae24c07..c688c46475 100644 --- a/arch/x86/Kconfig +++ b/arch/x86/Kconfig @@ -360,6 +360,8 @@ config HAVE_FSP bool "Add an Firmware Support Package binary" depends on !EFI select USE_HOB + select HAS_ROM + select ROM_NEEDS_BLOBS help Select this option to add an Firmware Support Package binary to the resulting U-Boot image. It is a binary blob which U-Boot uses @@ -519,6 +521,8 @@ config ENABLE_MRC_CACHE
config HAVE_MRC bool "Add a System Agent binary" + select HAS_ROM + select ROM_NEEDS_BLOBS depends on !HAVE_FSP help Select this option to add a System Agent binary to diff --git a/arch/x86/cpu/quark/Kconfig b/arch/x86/cpu/quark/Kconfig index 430cce184d..2fee38aed7 100644 --- a/arch/x86/cpu/quark/Kconfig +++ b/arch/x86/cpu/quark/Kconfig @@ -24,6 +24,7 @@ if INTEL_QUARK
config HAVE_RMU bool "Add a Remote Management Unit (RMU) binary" + select ROM_NEEDS_BLOBS help Select this option to add a Remote Management Unit (RMU) binary to the resulting U-Boot image. It is a data block (up to 64K) of

Bob is a Chromebook and can boot from SPI flash. Add it to the condition check for this.
Signed-off-by: Simon Glass sjg@chromium.org ---
(no changes since v1)
arch/arm/mach-rockchip/spl.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/arch/arm/mach-rockchip/spl.c b/arch/arm/mach-rockchip/spl.c index cddf4fd3d5..f148d48b6a 100644 --- a/arch/arm/mach-rockchip/spl.c +++ b/arch/arm/mach-rockchip/spl.c @@ -54,7 +54,8 @@ u32 spl_boot_device(void) #if defined(CONFIG_TARGET_CHROMEBOOK_JERRY) || \ defined(CONFIG_TARGET_CHROMEBIT_MICKEY) || \ defined(CONFIG_TARGET_CHROMEBOOK_MINNIE) || \ - defined(CONFIG_TARGET_CHROMEBOOK_SPEEDY) + defined(CONFIG_TARGET_CHROMEBOOK_SPEEDY) || \ + defined(CONFIG_TARGET_CHROMEBOOK_BOB) return BOOT_DEVICE_SPI; #endif if (CONFIG_IS_ENABLED(ROCKCHIP_BACK_TO_BROM))

Some non-x86 devices can use SPI flash to boot and need to produce images of a fixed size to program the flash.
Add a way to handle this for non-x86 boards.
Signed-off-by: Simon Glass sjg@chromium.org ---
Changes in v3: - Add a comment about CONFIG_SPL_FRAMEWORK
Makefile | 14 ++++++++++++++ 1 file changed, 14 insertions(+)
diff --git a/Makefile b/Makefile index 685a7a2796..11744559c4 100644 --- a/Makefile +++ b/Makefile @@ -1610,6 +1610,20 @@ u-boot-x86-start16.bin: u-boot FORCE OBJCOPYFLAGS_u-boot-x86-reset16.bin := -O binary -j .resetvec u-boot-x86-reset16.bin: u-boot FORCE $(call if_changed,objcopy) + +else # !CONFIG_X86 + +ifdef CONFIG_SPL +rom-deps += spl/u-boot-spl.bin + +# We can rely on CONFIG_SPL_FRAMEWORK being set for boards that use binman +rom-deps += u-boot.img +endif + +ifdef CONFIG_TPL +rom-deps += tpl/u-boot-tpl.bin +endif + endif
u-boot.rom: $(rom-deps) FORCE

This option allows the serial console to work correctly. Add it.
Signed-off-by: Simon Glass sjg@chromium.org ---
(no changes since v1)
configs/chromebook_jerry_defconfig | 1 + 1 file changed, 1 insertion(+)
diff --git a/configs/chromebook_jerry_defconfig b/configs/chromebook_jerry_defconfig index e32de90843..c410b844d5 100644 --- a/configs/chromebook_jerry_defconfig +++ b/configs/chromebook_jerry_defconfig @@ -85,6 +85,7 @@ CONFIG_PWM_ROCKCHIP=y CONFIG_RAM=y CONFIG_SPL_RAM=y CONFIG_DEBUG_UART_SHIFT=2 +CONFIG_ROCKCHIP_SERIAL=y CONFIG_SOUND=y CONFIG_I2S=y CONFIG_I2S_ROCKCHIP=y

Update the config for chromebook_bob to support booting from SPI flash. The existing SPL size is too small since ATF is needed, so double it.
Signed-off-by: Simon Glass sjg@chromium.org ---
(no changes since v1)
configs/chromebook_bob_defconfig | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-)
diff --git a/configs/chromebook_bob_defconfig b/configs/chromebook_bob_defconfig index dad96d2ad1..4ffc33398a 100644 --- a/configs/chromebook_bob_defconfig +++ b/configs/chromebook_bob_defconfig @@ -3,7 +3,7 @@ CONFIG_ARCH_ROCKCHIP=y CONFIG_SYS_TEXT_BASE=0x00200000 CONFIG_SPL_GPIO_SUPPORT=y CONFIG_ENV_OFFSET=0x3F8000 -CONFIG_SYS_SPI_U_BOOT_OFFS=0x20000 +CONFIG_SYS_SPI_U_BOOT_OFFS=0x40000 CONFIG_SPL_TEXT_BASE=0xff8c2000 CONFIG_ROCKCHIP_RK3399=y CONFIG_ROCKCHIP_BOOT_MODE_REG=0 @@ -40,6 +40,7 @@ CONFIG_SPL_OF_CONTROL=y CONFIG_OF_SPL_REMOVE_PROPS="pinctrl-0 pinctrl-names clock-names interrupt-parent assigned-clocks assigned-clock-rates assigned-clock-parents" CONFIG_ENV_IS_IN_MMC=y CONFIG_SYS_RELOC_GD_ENV_ADDR=y +CONFIG_SPL_DM_SEQ_ALIAS=y CONFIG_ROCKCHIP_GPIO=y CONFIG_I2C_CROS_EC_TUNNEL=y CONFIG_SYS_I2C_ROCKCHIP=y @@ -53,6 +54,7 @@ CONFIG_MMC_DW=y CONFIG_MMC_DW_ROCKCHIP=y CONFIG_MMC_SDHCI=y CONFIG_MMC_SDHCI_ROCKCHIP=y +CONFIG_SF_DEFAULT_BUS=1 CONFIG_SF_DEFAULT_SPEED=20000000 CONFIG_SPI_FLASH_GIGADEVICE=y CONFIG_DM_ETH=y

Add a simple binman config and enable CONFIG_HAS_ROM so that U-Boot produces a ROM for jerry.
Change the binman image definition to support multiple images, since it may be used to build both u-boot-rockchip.bin and u-boot.rom
Signed-off-by: Simon Glass sjg@chromium.org ---
(no changes since v1)
arch/arm/dts/rk3288-u-boot.dtsi | 24 ++++++++++++++++++++++++ arch/arm/dts/rockchip-u-boot.dtsi | 8 +++++++- arch/arm/mach-rockchip/rk3288/Kconfig | 1 + 3 files changed, 32 insertions(+), 1 deletion(-)
diff --git a/arch/arm/dts/rk3288-u-boot.dtsi b/arch/arm/dts/rk3288-u-boot.dtsi index 51b6e018bd..e4e762aabf 100644 --- a/arch/arm/dts/rk3288-u-boot.dtsi +++ b/arch/arm/dts/rk3288-u-boot.dtsi @@ -12,6 +12,30 @@ }; };
+#ifdef CONFIG_HAS_ROM +&binman { + rom { + filename = "u-boot.rom"; + size = <0x400000>; + pad-byte = <0xff>; + + mkimage { + args = "-n rk3288 -T rkspi"; + u-boot-spl { + }; + }; + u-boot-img { + offset = <0x20000>; + }; + u-boot { + offset = <0x300000>; + }; + fdtmap { + }; + }; +}; +#endif + &dmc { u-boot,dm-pre-reloc; }; diff --git a/arch/arm/dts/rockchip-u-boot.dtsi b/arch/arm/dts/rockchip-u-boot.dtsi index a2559e2db0..0451db735e 100644 --- a/arch/arm/dts/rockchip-u-boot.dtsi +++ b/arch/arm/dts/rockchip-u-boot.dtsi @@ -6,7 +6,13 @@ #include <config.h>
/ { - binman { + binman: binman { + multiple-images; + }; +}; + +&binman { + simple-bin { filename = "u-boot-rockchip.bin"; pad-byte = <0xff>;
diff --git a/arch/arm/mach-rockchip/rk3288/Kconfig b/arch/arm/mach-rockchip/rk3288/Kconfig index afb62fca78..dfc9da9238 100644 --- a/arch/arm/mach-rockchip/rk3288/Kconfig +++ b/arch/arm/mach-rockchip/rk3288/Kconfig @@ -5,6 +5,7 @@ choice
config TARGET_CHROMEBOOK_JERRY bool "Google/Rockchip Veyron-Jerry Chromebook" + select HAS_ROM select BOARD_LATE_INIT help Jerry is a RK3288-based clamshell device with 2 USB 3.0 ports,

Add a simple binman config and enable CONFIG_HAS_ROM so that U-Boot produces a ROM for bob.
Signed-off-by: Simon Glass sjg@chromium.org ---
(no changes since v1)
arch/arm/dts/rk3399-gru-u-boot.dtsi | 4 ++++ arch/arm/dts/rk3399-gru.dtsi | 2 +- arch/arm/dts/rk3399-u-boot.dtsi | 27 +++++++++++++++++++++++++++ arch/arm/mach-rockchip/rk3399/Kconfig | 1 + 4 files changed, 33 insertions(+), 1 deletion(-)
diff --git a/arch/arm/dts/rk3399-gru-u-boot.dtsi b/arch/arm/dts/rk3399-gru-u-boot.dtsi index 7bddc3acdb..390ac2bb5a 100644 --- a/arch/arm/dts/rk3399-gru-u-boot.dtsi +++ b/arch/arm/dts/rk3399-gru-u-boot.dtsi @@ -4,3 +4,7 @@ */
#include "rk3399-u-boot.dtsi" + +&spi_flash { + u-boot,dm-pre-reloc; +}; diff --git a/arch/arm/dts/rk3399-gru.dtsi b/arch/arm/dts/rk3399-gru.dtsi index 7ac88392f2..f9c5bb607b 100644 --- a/arch/arm/dts/rk3399-gru.dtsi +++ b/arch/arm/dts/rk3399-gru.dtsi @@ -537,7 +537,7 @@ ap_i2c_audio: &i2c8 { pinctrl-names = "default", "sleep"; pinctrl-1 = <&spi1_sleep>;
- spiflash@0 { + spi_flash: spiflash@0 { compatible = "jedec,spi-nor"; reg = <0>;
diff --git a/arch/arm/dts/rk3399-u-boot.dtsi b/arch/arm/dts/rk3399-u-boot.dtsi index 8237782408..a76bbea730 100644 --- a/arch/arm/dts/rk3399-u-boot.dtsi +++ b/arch/arm/dts/rk3399-u-boot.dtsi @@ -4,11 +4,14 @@ */ #define USB_CLASS_HUB 9
+#include "rockchip-u-boot.dtsi" + / { aliases { mmc0 = &sdhci; mmc1 = &sdmmc; pci0 = &pcie0; + spi1 = &spi1; };
cic: syscon@ff620000 { @@ -57,6 +60,30 @@
};
+#ifdef CONFIG_HAS_ROM +&binman { + rom { + filename = "u-boot.rom"; + size = <0x400000>; + pad-byte = <0xff>; + + mkimage { + args = "-n rk3399 -T rkspi"; + u-boot-spl { + }; + }; + u-boot-img { + offset = <0x40000>; + }; + u-boot { + offset = <0x300000>; + }; + fdtmap { + }; + }; +}; +#endif + &cru { u-boot,dm-pre-reloc; }; diff --git a/arch/arm/mach-rockchip/rk3399/Kconfig b/arch/arm/mach-rockchip/rk3399/Kconfig index 254b9c5b4d..8b91d4713d 100644 --- a/arch/arm/mach-rockchip/rk3399/Kconfig +++ b/arch/arm/mach-rockchip/rk3399/Kconfig @@ -5,6 +5,7 @@ choice
config TARGET_CHROMEBOOK_BOB bool "Asus Flip C101PA Chromebook (RK3399)" + select HAS_ROM help Bob is a small RK3299-based device similar in apperance to Minnie. It has two USB 3.0 type-C ports, 4GB of SDRAM, WiFi and a 10.1",

On Fri, Jul 10, 2020 at 6:11 AM Simon Glass sjg@chromium.org wrote:
Add a simple binman config and enable CONFIG_HAS_ROM so that U-Boot produces a ROM for bob.
Signed-off-by: Simon Glass sjg@chromium.org
(no changes since v1)
arch/arm/dts/rk3399-gru-u-boot.dtsi | 4 ++++ arch/arm/dts/rk3399-gru.dtsi | 2 +- arch/arm/dts/rk3399-u-boot.dtsi | 27 +++++++++++++++++++++++++++ arch/arm/mach-rockchip/rk3399/Kconfig | 1 + 4 files changed, 33 insertions(+), 1 deletion(-)
diff --git a/arch/arm/dts/rk3399-gru-u-boot.dtsi b/arch/arm/dts/rk3399-gru-u-boot.dtsi index 7bddc3acdb..390ac2bb5a 100644 --- a/arch/arm/dts/rk3399-gru-u-boot.dtsi +++ b/arch/arm/dts/rk3399-gru-u-boot.dtsi @@ -4,3 +4,7 @@ */
#include "rk3399-u-boot.dtsi"
+&spi_flash {
u-boot,dm-pre-reloc;
+}; diff --git a/arch/arm/dts/rk3399-gru.dtsi b/arch/arm/dts/rk3399-gru.dtsi index 7ac88392f2..f9c5bb607b 100644 --- a/arch/arm/dts/rk3399-gru.dtsi +++ b/arch/arm/dts/rk3399-gru.dtsi @@ -537,7 +537,7 @@ ap_i2c_audio: &i2c8 { pinctrl-names = "default", "sleep"; pinctrl-1 = <&spi1_sleep>;
spiflash@0 {
spi_flash: spiflash@0 { compatible = "jedec,spi-nor"; reg = <0>;
diff --git a/arch/arm/dts/rk3399-u-boot.dtsi b/arch/arm/dts/rk3399-u-boot.dtsi index 8237782408..a76bbea730 100644 --- a/arch/arm/dts/rk3399-u-boot.dtsi +++ b/arch/arm/dts/rk3399-u-boot.dtsi @@ -4,11 +4,14 @@ */ #define USB_CLASS_HUB 9
+#include "rockchip-u-boot.dtsi"
/ { aliases { mmc0 = &sdhci; mmc1 = &sdmmc; pci0 = &pcie0;
spi1 = &spi1; }; cic: syscon@ff620000 {
@@ -57,6 +60,30 @@
};
+#ifdef CONFIG_HAS_ROM +&binman {
rom {
filename = "u-boot.rom";
size = <0x400000>;
pad-byte = <0xff>;
mkimage {
args = "-n rk3399 -T rkspi";
u-boot-spl {
};
};
How could attach u-boot-spl for TPL builds where TPL has to args with ROM header. right now we are doing in a monolithic way.
./tools/mkimage -n rk3399 -T rkspi -d tpl/u-boot-tpl.bin:spl/u-boot-spl.bin idbloader.img

Hi Jagan,
On Mon, 13 Jul 2020 at 09:36, Jagan Teki jagan@amarulasolutions.com wrote:
On Fri, Jul 10, 2020 at 6:11 AM Simon Glass sjg@chromium.org wrote:
Add a simple binman config and enable CONFIG_HAS_ROM so that U-Boot produces a ROM for bob.
Signed-off-by: Simon Glass sjg@chromium.org
(no changes since v1)
arch/arm/dts/rk3399-gru-u-boot.dtsi | 4 ++++ arch/arm/dts/rk3399-gru.dtsi | 2 +- arch/arm/dts/rk3399-u-boot.dtsi | 27 +++++++++++++++++++++++++++ arch/arm/mach-rockchip/rk3399/Kconfig | 1 + 4 files changed, 33 insertions(+), 1 deletion(-)
diff --git a/arch/arm/dts/rk3399-gru-u-boot.dtsi b/arch/arm/dts/rk3399-gru-u-boot.dtsi index 7bddc3acdb..390ac2bb5a 100644 --- a/arch/arm/dts/rk3399-gru-u-boot.dtsi +++ b/arch/arm/dts/rk3399-gru-u-boot.dtsi @@ -4,3 +4,7 @@ */
#include "rk3399-u-boot.dtsi"
+&spi_flash {
u-boot,dm-pre-reloc;
+}; diff --git a/arch/arm/dts/rk3399-gru.dtsi b/arch/arm/dts/rk3399-gru.dtsi index 7ac88392f2..f9c5bb607b 100644 --- a/arch/arm/dts/rk3399-gru.dtsi +++ b/arch/arm/dts/rk3399-gru.dtsi @@ -537,7 +537,7 @@ ap_i2c_audio: &i2c8 { pinctrl-names = "default", "sleep"; pinctrl-1 = <&spi1_sleep>;
spiflash@0 {
spi_flash: spiflash@0 { compatible = "jedec,spi-nor"; reg = <0>;
diff --git a/arch/arm/dts/rk3399-u-boot.dtsi b/arch/arm/dts/rk3399-u-boot.dtsi index 8237782408..a76bbea730 100644 --- a/arch/arm/dts/rk3399-u-boot.dtsi +++ b/arch/arm/dts/rk3399-u-boot.dtsi @@ -4,11 +4,14 @@ */ #define USB_CLASS_HUB 9
+#include "rockchip-u-boot.dtsi"
/ { aliases { mmc0 = &sdhci; mmc1 = &sdmmc; pci0 = &pcie0;
spi1 = &spi1; }; cic: syscon@ff620000 {
@@ -57,6 +60,30 @@
};
+#ifdef CONFIG_HAS_ROM +&binman {
rom {
filename = "u-boot.rom";
size = <0x400000>;
pad-byte = <0xff>;
mkimage {
args = "-n rk3399 -T rkspi";
u-boot-spl {
};
};
How could attach u-boot-spl for TPL builds where TPL has to args with ROM header. right now we are doing in a monolithic way.
./tools/mkimage -n rk3399 -T rkspi -d tpl/u-boot-tpl.bin:spl/u-boot-spl.bin idbloader.img
I don't really follow this question and I have read it many times over the past few days,
Are you asking how binman can run mkimage and incorporate the output in an image?
Regards, Simon

Hi Simon,
On Thu, Jul 16, 2020 at 12:10 AM Simon Glass sjg@chromium.org wrote:
Hi Jagan,
On Mon, 13 Jul 2020 at 09:36, Jagan Teki jagan@amarulasolutions.com wrote:
On Fri, Jul 10, 2020 at 6:11 AM Simon Glass sjg@chromium.org wrote:
Add a simple binman config and enable CONFIG_HAS_ROM so that U-Boot produces a ROM for bob.
Signed-off-by: Simon Glass sjg@chromium.org
(no changes since v1)
arch/arm/dts/rk3399-gru-u-boot.dtsi | 4 ++++ arch/arm/dts/rk3399-gru.dtsi | 2 +- arch/arm/dts/rk3399-u-boot.dtsi | 27 +++++++++++++++++++++++++++ arch/arm/mach-rockchip/rk3399/Kconfig | 1 + 4 files changed, 33 insertions(+), 1 deletion(-)
diff --git a/arch/arm/dts/rk3399-gru-u-boot.dtsi b/arch/arm/dts/rk3399-gru-u-boot.dtsi index 7bddc3acdb..390ac2bb5a 100644 --- a/arch/arm/dts/rk3399-gru-u-boot.dtsi +++ b/arch/arm/dts/rk3399-gru-u-boot.dtsi @@ -4,3 +4,7 @@ */
#include "rk3399-u-boot.dtsi"
+&spi_flash {
u-boot,dm-pre-reloc;
+}; diff --git a/arch/arm/dts/rk3399-gru.dtsi b/arch/arm/dts/rk3399-gru.dtsi index 7ac88392f2..f9c5bb607b 100644 --- a/arch/arm/dts/rk3399-gru.dtsi +++ b/arch/arm/dts/rk3399-gru.dtsi @@ -537,7 +537,7 @@ ap_i2c_audio: &i2c8 { pinctrl-names = "default", "sleep"; pinctrl-1 = <&spi1_sleep>;
spiflash@0 {
spi_flash: spiflash@0 { compatible = "jedec,spi-nor"; reg = <0>;
diff --git a/arch/arm/dts/rk3399-u-boot.dtsi b/arch/arm/dts/rk3399-u-boot.dtsi index 8237782408..a76bbea730 100644 --- a/arch/arm/dts/rk3399-u-boot.dtsi +++ b/arch/arm/dts/rk3399-u-boot.dtsi @@ -4,11 +4,14 @@ */ #define USB_CLASS_HUB 9
+#include "rockchip-u-boot.dtsi"
/ { aliases { mmc0 = &sdhci; mmc1 = &sdmmc; pci0 = &pcie0;
spi1 = &spi1; }; cic: syscon@ff620000 {
@@ -57,6 +60,30 @@
};
+#ifdef CONFIG_HAS_ROM +&binman {
rom {
filename = "u-boot.rom";
size = <0x400000>;
pad-byte = <0xff>;
mkimage {
args = "-n rk3399 -T rkspi";
u-boot-spl {
};
};
How could attach u-boot-spl for TPL builds where TPL has to args with ROM header. right now we are doing in a monolithic way.
./tools/mkimage -n rk3399 -T rkspi -d tpl/u-boot-tpl.bin:spl/u-boot-spl.bin idbloader.img
I don't really follow this question and I have read it many times over the past few days,
Sorry for the confusion. What I'm trying to ask here is about binman node syntax for TPL based images?
Jagan.

Hi Jagan,
On Wed, 15 Jul 2020 at 13:14, Jagan Teki jagan@amarulasolutions.com wrote:
Hi Simon,
On Thu, Jul 16, 2020 at 12:10 AM Simon Glass sjg@chromium.org wrote:
Hi Jagan,
On Mon, 13 Jul 2020 at 09:36, Jagan Teki jagan@amarulasolutions.com wrote:
On Fri, Jul 10, 2020 at 6:11 AM Simon Glass sjg@chromium.org wrote:
Add a simple binman config and enable CONFIG_HAS_ROM so that U-Boot produces a ROM for bob.
Signed-off-by: Simon Glass sjg@chromium.org
(no changes since v1)
arch/arm/dts/rk3399-gru-u-boot.dtsi | 4 ++++ arch/arm/dts/rk3399-gru.dtsi | 2 +- arch/arm/dts/rk3399-u-boot.dtsi | 27 +++++++++++++++++++++++++++ arch/arm/mach-rockchip/rk3399/Kconfig | 1 + 4 files changed, 33 insertions(+), 1 deletion(-)
diff --git a/arch/arm/dts/rk3399-gru-u-boot.dtsi b/arch/arm/dts/rk3399-gru-u-boot.dtsi index 7bddc3acdb..390ac2bb5a 100644 --- a/arch/arm/dts/rk3399-gru-u-boot.dtsi +++ b/arch/arm/dts/rk3399-gru-u-boot.dtsi @@ -4,3 +4,7 @@ */
#include "rk3399-u-boot.dtsi"
+&spi_flash {
u-boot,dm-pre-reloc;
+}; diff --git a/arch/arm/dts/rk3399-gru.dtsi b/arch/arm/dts/rk3399-gru.dtsi index 7ac88392f2..f9c5bb607b 100644 --- a/arch/arm/dts/rk3399-gru.dtsi +++ b/arch/arm/dts/rk3399-gru.dtsi @@ -537,7 +537,7 @@ ap_i2c_audio: &i2c8 { pinctrl-names = "default", "sleep"; pinctrl-1 = <&spi1_sleep>;
spiflash@0 {
spi_flash: spiflash@0 { compatible = "jedec,spi-nor"; reg = <0>;
diff --git a/arch/arm/dts/rk3399-u-boot.dtsi b/arch/arm/dts/rk3399-u-boot.dtsi index 8237782408..a76bbea730 100644 --- a/arch/arm/dts/rk3399-u-boot.dtsi +++ b/arch/arm/dts/rk3399-u-boot.dtsi @@ -4,11 +4,14 @@ */ #define USB_CLASS_HUB 9
+#include "rockchip-u-boot.dtsi"
/ { aliases { mmc0 = &sdhci; mmc1 = &sdmmc; pci0 = &pcie0;
spi1 = &spi1; }; cic: syscon@ff620000 {
@@ -57,6 +60,30 @@
};
+#ifdef CONFIG_HAS_ROM +&binman {
rom {
filename = "u-boot.rom";
size = <0x400000>;
pad-byte = <0xff>;
mkimage {
args = "-n rk3399 -T rkspi";
u-boot-spl {
};
};
How could attach u-boot-spl for TPL builds where TPL has to args with ROM header. right now we are doing in a monolithic way.
./tools/mkimage -n rk3399 -T rkspi -d tpl/u-boot-tpl.bin:spl/u-boot-spl.bin idbloader.img
I don't really follow this question and I have read it many times over the past few days,
Sorry for the confusion. What I'm trying to ask here is about binman node syntax for TPL based images?
OK, that would be:
mkimage { args = "-n rk3399 -T rkspi"; u-boot-tpl { }; };
Regards, Simon

This has been in the Makefile long enough to ensure migration is complete. Drop it.
Signed-off-by: Simon Glass sjg@chromium.org ---
(no changes since v1)
Makefile | 16 +--------------- 1 file changed, 1 insertion(+), 15 deletions(-)
diff --git a/Makefile b/Makefile index 11744559c4..1d3182caf7 100644 --- a/Makefile +++ b/Makefile @@ -1644,23 +1644,9 @@ u-boot-x86-with-spl.bin: spl/u-boot-spl.bin u-boot.bin FORCE $(call if_changed,binman)
ifneq ($(CONFIG_ARCH_TEGRA),) -ifneq ($(CONFIG_BINMAN),) # Makes u-boot-dtb-tegra.bin u-boot-tegra.bin u-boot-nodtb-tegra.bin -%-dtb-tegra.bin %-tegra.bin %-nodtb-tegra.bin: \ - spl/%-spl %.bin FORCE +%-dtb-tegra.bin %-tegra.bin %-nodtb-tegra.bin: spl/%-spl %.bin FORCE $(call if_changed,binman) -else -OBJCOPYFLAGS_u-boot-nodtb-tegra.bin = -O binary --pad-to=$(CONFIG_SYS_TEXT_BASE) -u-boot-nodtb-tegra.bin: spl/u-boot-spl u-boot-nodtb.bin FORCE - $(call if_changed,pad_cat) - -OBJCOPYFLAGS_u-boot-tegra.bin = -O binary --pad-to=$(CONFIG_SYS_TEXT_BASE) -u-boot-tegra.bin: spl/u-boot-spl u-boot.bin FORCE - $(call if_changed,pad_cat) - -u-boot-dtb-tegra.bin: u-boot-tegra.bin FORCE - $(call if_changed,copy) -endif # binman endif
OBJCOPYFLAGS_u-boot-app.efi := $(OBJCOPYFLAGS_EFI)

At present only the ARMv7 tegra SoCs actually use binman to create an image. Change the config to reflect this, since otherwise running binman will produce an error.
Signed-off-by: Simon Glass sjg@chromium.org ---
(no changes since v1)
arch/arm/mach-tegra/Kconfig | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/arch/arm/mach-tegra/Kconfig b/arch/arm/mach-tegra/Kconfig index 15e7684028..a397748b72 100644 --- a/arch/arm/mach-tegra/Kconfig +++ b/arch/arm/mach-tegra/Kconfig @@ -41,7 +41,6 @@ config TEGRA_PMC_SECURE
config TEGRA_COMMON bool "Tegra common options" - select BINMAN select BOARD_EARLY_INIT_F select CLK select DM @@ -69,6 +68,7 @@ config TEGRA_NO_BPMP
config TEGRA_ARMV7_COMMON bool "Tegra 32-bit common options" + select BINMAN select CPU_V7A select SPL select SPL_BOARD_INIT if SPL

When binman is in use, most of the targets built by the Makefile are inputs to binman. We then need a final rule to run binman to produce the final outputs.
Rename the variable to indicate this, and add a new 'inputs' target.
Signed-off-by: Simon Glass sjg@chromium.org Reviewed-by: Bin Meng bmeng.cn@gmail.com ---
(no changes since v1)
Makefile | 60 +++++++++++++++++--------------- arch/arm/config.mk | 10 +++--- arch/arm/mach-at91/config.mk | 2 +- arch/arm/mach-davinci/config.mk | 2 +- arch/arm/mach-k3/config.mk | 10 +++--- arch/arm/mach-keystone/config.mk | 4 +-- arch/arm/mach-omap2/config.mk | 28 +++++++-------- arch/arm/mach-rmobile/Makefile | 2 +- arch/arm/mach-stm32mp/config.mk | 4 +-- board/BuR/brppt1/config.mk | 4 +-- board/BuR/brppt2/config.mk | 4 +-- board/BuR/brsmarc1/config.mk | 6 ++-- board/imgtec/boston/config.mk | 2 +- board/intel/edison/config.mk | 2 +- scripts/Makefile.spl | 24 ++++++------- tools/binman/README | 2 +- 16 files changed, 85 insertions(+), 81 deletions(-)
diff --git a/Makefile b/Makefile index 1d3182caf7..29175fb104 100644 --- a/Makefile +++ b/Makefile @@ -883,80 +883,80 @@ else DO_STATIC_RELA = endif
-# Always append ALL so that arch config.mk's can add custom ones -ALL-y += u-boot.srec u-boot.bin u-boot.sym System.map binary_size_check +# Always append INPUTS so that arch config.mk's can add custom ones +INPUTS-y += u-boot.srec u-boot.bin u-boot.sym System.map binary_size_check
-ALL-$(CONFIG_ONENAND_U_BOOT) += u-boot-onenand.bin +INPUTS-$(CONFIG_ONENAND_U_BOOT) += u-boot-onenand.bin ifeq ($(CONFIG_SPL_FSL_PBL),y) -ALL-$(CONFIG_RAMBOOT_PBL) += u-boot-with-spl-pbl.bin +INPUTS-$(CONFIG_RAMBOOT_PBL) += u-boot-with-spl-pbl.bin else ifneq ($(CONFIG_NXP_ESBC), y) # For Secure Boot The Image needs to be signed and Header must also # be included. So The image has to be built explicitly -ALL-$(CONFIG_RAMBOOT_PBL) += u-boot.pbl +INPUTS-$(CONFIG_RAMBOOT_PBL) += u-boot.pbl endif endif -ALL-$(CONFIG_SPL) += spl/u-boot-spl.bin +INPUTS-$(CONFIG_SPL) += spl/u-boot-spl.bin ifeq ($(CONFIG_MX6)$(CONFIG_IMX_HAB), yy) -ALL-$(CONFIG_SPL_FRAMEWORK) += u-boot-ivt.img +INPUTS-$(CONFIG_SPL_FRAMEWORK) += u-boot-ivt.img else ifeq ($(CONFIG_MX7)$(CONFIG_IMX_HAB), yy) -ALL-$(CONFIG_SPL_FRAMEWORK) += u-boot-ivt.img +INPUTS-$(CONFIG_SPL_FRAMEWORK) += u-boot-ivt.img else -ALL-$(CONFIG_SPL_FRAMEWORK) += u-boot.img +INPUTS-$(CONFIG_SPL_FRAMEWORK) += u-boot.img endif endif -ALL-$(CONFIG_TPL) += tpl/u-boot-tpl.bin -ALL-$(CONFIG_OF_SEPARATE) += u-boot.dtb +INPUTS-$(CONFIG_TPL) += tpl/u-boot-tpl.bin +INPUTS-$(CONFIG_OF_SEPARATE) += u-boot.dtb ifeq ($(CONFIG_SPL_FRAMEWORK),y) -ALL-$(CONFIG_OF_SEPARATE) += u-boot-dtb.img +INPUTS-$(CONFIG_OF_SEPARATE) += u-boot-dtb.img endif -ALL-$(CONFIG_OF_HOSTFILE) += u-boot.dtb +INPUTS-$(CONFIG_OF_HOSTFILE) += u-boot.dtb ifneq ($(CONFIG_SPL_TARGET),) -ALL-$(CONFIG_SPL) += $(CONFIG_SPL_TARGET:"%"=%) +INPUTS-$(CONFIG_SPL) += $(CONFIG_SPL_TARGET:"%"=%) endif -ALL-$(CONFIG_REMAKE_ELF) += u-boot.elf -ALL-$(CONFIG_EFI_APP) += u-boot-app.efi -ALL-$(CONFIG_EFI_STUB) += u-boot-payload.efi +INPUTS-$(CONFIG_REMAKE_ELF) += u-boot.elf +INPUTS-$(CONFIG_EFI_APP) += u-boot-app.efi +INPUTS-$(CONFIG_EFI_STUB) += u-boot-payload.efi
ifneq ($(CONFIG_HAS_ROM),) ifneq ($(BUILD_ROM)$(CONFIG_BUILD_ROM),) -ALL-y += u-boot.rom +INPUTS-$(CONFIG_X86_RESET_VECTOR) += u-boot.rom endif endif
ifeq ($(CONFIG_SYS_COREBOOT)$(CONFIG_SPL),yy) -ALL-$(CONFIG_BINMAN) += u-boot-x86-with-spl.bin +INPUTS-$(CONFIG_BINMAN) += u-boot-x86-with-spl.bin endif
# Build a combined spl + u-boot image for sunxi ifeq ($(CONFIG_ARCH_SUNXI)$(CONFIG_SPL),yy) -ALL-y += u-boot-sunxi-with-spl.bin +INPUTS-y += u-boot-sunxi-with-spl.bin endif
# enable combined SPL/u-boot/dtb rules for tegra ifeq ($(CONFIG_ARCH_TEGRA)$(CONFIG_SPL),yy) -ALL-y += u-boot-tegra.bin u-boot-nodtb-tegra.bin -ALL-$(CONFIG_OF_SEPARATE) += u-boot-dtb-tegra.bin +INPUTS-y += u-boot-tegra.bin u-boot-nodtb-tegra.bin +INPUTS-$(CONFIG_OF_SEPARATE) += u-boot-dtb-tegra.bin endif
-ALL-$(CONFIG_ARCH_MEDIATEK) += u-boot-mtk.bin +INPUTS-$(CONFIG_ARCH_MEDIATEK) += u-boot-mtk.bin
# Add optional build target if defined in board/cpu/soc headers ifneq ($(CONFIG_BUILD_TARGET),) -ALL-y += $(CONFIG_BUILD_TARGET:"%"=%) +INPUTS-y += $(CONFIG_BUILD_TARGET:"%"=%) endif
ifeq ($(CONFIG_INIT_SP_RELATIVE)$(CONFIG_OF_SEPARATE),yy) -ALL-y += init_sp_bss_offset_check +INPUTS-y += init_sp_bss_offset_check endif
ifeq ($(CONFIG_MPC85xx)$(CONFIG_OF_SEPARATE),yy) -ALL-y += u-boot-with-dtb.bin +INPUTS-y += u-boot-with-dtb.bin endif
ifeq ($(CONFIG_ARCH_ROCKCHIP)$(CONFIG_SPL),yy) -ALL-y += u-boot-rockchip.bin +INPUTS-y += u-boot-rockchip.bin endif
LDFLAGS_u-boot += $(LDFLAGS_FINAL) @@ -1013,7 +1013,11 @@ quiet_cmd_cfgcheck = CFGCHK $2 cmd_cfgcheck = $(srctree)/scripts/check-config.sh $2 \ $(srctree)/scripts/config_whitelist.txt $(srctree)
-all: $(ALL-y) +PHONY += inputs +inputs: $(INPUTS-y) + +all: inputs + ifeq ($(CONFIG_DEPRECATED),y) $(warning "You have deprecated configuration options enabled in your .config! Please check your configuration.") ifeq ($(CONFIG_SPI),y) diff --git a/arch/arm/config.mk b/arch/arm/config.mk index f25603109e..4153f7e371 100644 --- a/arch/arm/config.mk +++ b/arch/arm/config.mk @@ -122,7 +122,7 @@ endif
ifneq ($(CONFIG_SPL_BUILD),y) # Check that only R_ARM_RELATIVE relocations are generated. -ALL-y += checkarmreloc +INPUTS-y += checkarmreloc # The movt / movw can hardcode 16 bit parts of the addresses in the # instruction. Relocation is not supported for that case, so disable # such usage by requiring word relocations. @@ -154,17 +154,17 @@ endif ifneq ($(CONFIG_IMX_CONFIG),) ifdef CONFIG_SPL ifndef CONFIG_SPL_BUILD -ALL-y += SPL +INPUTS-y += SPL endif else ifeq ($(CONFIG_OF_SEPARATE),y) -ALL-y += u-boot-dtb.imx +INPUTS-y += u-boot-dtb.imx else -ALL-y += u-boot.imx +INPUTS-y += u-boot.imx endif endif ifneq ($(CONFIG_VF610),) -ALL-y += u-boot.vyb +INPUTS-y += u-boot.vyb endif endif
diff --git a/arch/arm/mach-at91/config.mk b/arch/arm/mach-at91/config.mk index 9a023efb19..5426394651 100644 --- a/arch/arm/mach-at91/config.mk +++ b/arch/arm/mach-at91/config.mk @@ -4,6 +4,6 @@ endif
ifeq ($(CONFIG_CPU_V7A),y) ifndef CONFIG_SPL_BUILD -ALL-y += u-boot.img +INPUTS-y += u-boot.img endif endif diff --git a/arch/arm/mach-davinci/config.mk b/arch/arm/mach-davinci/config.mk index 5a33982e2d..4674cae43b 100644 --- a/arch/arm/mach-davinci/config.mk +++ b/arch/arm/mach-davinci/config.mk @@ -2,5 +2,5 @@ # # Copyright (C) 2012, Texas Instruments, Incorporated - http://www.ti.com/ ifndef CONFIG_SPL_BUILD -ALL-$(CONFIG_SPL_FRAMEWORK) += u-boot.ais +INPUTS-$(CONFIG_SPL_FRAMEWORK) += u-boot.ais endif diff --git a/arch/arm/mach-k3/config.mk b/arch/arm/mach-k3/config.mk index f6b63db349..aca7a37009 100644 --- a/arch/arm/mach-k3/config.mk +++ b/arch/arm/mach-k3/config.mk @@ -44,7 +44,7 @@ tiboot3.bin: image_check FORCE $(srctree)/tools/k3_gen_x509_cert.sh -c 16 -b $(obj)/u-boot-spl.bin \ -o $@ -l $(CONFIG_SPL_TEXT_BASE) -k $(KEY)
-ALL-y += tiboot3.bin +INPUTS-y += tiboot3.bin endif
ifdef CONFIG_ARM64 @@ -55,23 +55,23 @@ $(SPL_ITS): FORCE $(srctree)/tools/k3_fit_atf.sh \ $(patsubst %,$(obj)/dts/%.dtb,$(subst ",,$(CONFIG_SPL_OF_LIST))) > $@
-ALL-y += tispl.bin_HS +INPUTS-y += tispl.bin_HS else SPL_ITS := u-boot-spl-k3.its $(SPL_ITS): FORCE $(srctree)/tools/k3_fit_atf.sh \ $(patsubst %,$(obj)/dts/%.dtb,$(subst ",,$(CONFIG_SPL_OF_LIST))) > $@
-ALL-y += tispl.bin +INPUTS-y += tispl.bin endif endif
else
ifeq ($(CONFIG_TI_SECURE_DEVICE),y) -ALL-y += u-boot.img_HS +INPUTS-y += u-boot.img_HS else -ALL-y += u-boot.img +INPUTS-y += u-boot.img endif endif
diff --git a/arch/arm/mach-keystone/config.mk b/arch/arm/mach-keystone/config.mk index 5806f8f5d1..5a16891f23 100644 --- a/arch/arm/mach-keystone/config.mk +++ b/arch/arm/mach-keystone/config.mk @@ -9,9 +9,9 @@ include $(srctree)/arch/arm/mach-omap2/config_secure.mk
ifndef CONFIG_SPL_BUILD ifeq ($(CONFIG_TI_SECURE_DEVICE),y) -ALL-y += u-boot_HS_MLO +INPUTS-y += u-boot_HS_MLO else -ALL-y += MLO +INPUTS-y += MLO endif endif
diff --git a/arch/arm/mach-omap2/config.mk b/arch/arm/mach-omap2/config.mk index af455366ed..4f0d2598fa 100644 --- a/arch/arm/mach-omap2/config.mk +++ b/arch/arm/mach-omap2/config.mk @@ -18,9 +18,9 @@ ifeq ($(CONFIG_TI_SECURE_DEVICE),y) # Refer to README.ti-secure for more info # For booting spl from QSPI or NOR use # u-boot-spl_HS_X-LOADER ifeq ($(CONFIG_OMAP54XX),y) -ALL-y += u-boot-spl_HS_MLO -ALL-y += u-boot-spl_HS_ULO -ALL-y += u-boot-spl_HS_X-LOADER +INPUTS-y += u-boot-spl_HS_MLO +INPUTS-y += u-boot-spl_HS_ULO +INPUTS-y += u-boot-spl_HS_X-LOADER endif # On AM43XX: # @@ -30,8 +30,8 @@ endif # For booting spl from all other media use # u-boot-spl_HS_ISSW ifeq ($(CONFIG_AM43XX),y) -ALL-y += u-boot-spl_HS_SPI_X-LOADER -ALL-y += u-boot-spl_HS_ISSW +INPUTS-y += u-boot-spl_HS_SPI_X-LOADER +INPUTS-y += u-boot-spl_HS_ISSW endif # On AM33XX: # @@ -47,21 +47,21 @@ endif # For booting spl over UART, USB, or Ethernet use # u-boot-spl_HS_2ND ifeq ($(CONFIG_AM33XX),y) -ALL-y += u-boot-spl_HS_SPI_X-LOADER -ALL-y += u-boot-spl_HS_X-LOADER -ALL-y += u-boot-spl_HS_MLO -ALL-y += u-boot-spl_HS_2ND +INPUTS-y += u-boot-spl_HS_SPI_X-LOADER +INPUTS-y += u-boot-spl_HS_X-LOADER +INPUTS-y += u-boot-spl_HS_MLO +INPUTS-y += u-boot-spl_HS_2ND endif else -ALL-y += MLO +INPUTS-y += MLO ifeq ($(CONFIG_AM33XX),y) -ALL-y += MLO.byteswap +INPUTS-y += MLO.byteswap endif endif else ifeq ($(CONFIG_TI_SECURE_DEVICE),y) -ALL-$(CONFIG_QSPI_BOOT) += u-boot_HS_XIP_X-LOADER -ALL-$(CONFIG_SPL_LOAD_FIT) += u-boot_HS.img +INPUTS-$(CONFIG_QSPI_BOOT) += u-boot_HS_XIP_X-LOADER +INPUTS-$(CONFIG_SPL_LOAD_FIT) += u-boot_HS.img endif -ALL-y += u-boot.img +INPUTS-y += u-boot.img endif diff --git a/arch/arm/mach-rmobile/Makefile b/arch/arm/mach-rmobile/Makefile index a3fdcc3bc0..3206bce722 100644 --- a/arch/arm/mach-rmobile/Makefile +++ b/arch/arm/mach-rmobile/Makefile @@ -84,5 +84,5 @@ spl/u-boot-spl.scif: spl/u-boot-spl.srec spl/u-boot-spl.bin
# if srec_cat is present build u-boot-spl.scif by default has_srec_cat = $(call try-run,srec_cat -VERSion,y,n) -ALL-$(has_srec_cat) += u-boot-spl.scif +INPUTS-$(has_srec_cat) += u-boot-spl.scif CLEAN_FILES += u-boot-spl.scif diff --git a/arch/arm/mach-stm32mp/config.mk b/arch/arm/mach-stm32mp/config.mk index 403af2a225..c30bf482f7 100644 --- a/arch/arm/mach-stm32mp/config.mk +++ b/arch/arm/mach-stm32mp/config.mk @@ -4,10 +4,10 @@ #
ifndef CONFIG_SPL -ALL-y += u-boot.stm32 +INPUTS-y += u-boot.stm32 else ifdef CONFIG_SPL_BUILD -ALL-y += u-boot-spl.stm32 +INPUTS-y += u-boot-spl.stm32 endif endif
diff --git a/board/BuR/brppt1/config.mk b/board/BuR/brppt1/config.mk index b11b544c37..6853135f83 100644 --- a/board/BuR/brppt1/config.mk +++ b/board/BuR/brppt1/config.mk @@ -25,8 +25,8 @@ cmd_prodzip = \ zip -9 -r $@ misc/* >/dev/null $<
ifeq ($(hw-platform-y),brppt1-spi) -ALL-y += $(hw-platform-y)_prog.bin -ALL-y += $(hw-platform-y)_prod.zip +INPUTS-y += $(hw-platform-y)_prog.bin +INPUTS-y += $(hw-platform-y)_prod.zip endif
$(hw-platform-y)_prog.bin: u-boot-dtb.img spl/u-boot-spl.bin diff --git a/board/BuR/brppt2/config.mk b/board/BuR/brppt2/config.mk index fa973db762..0d1638a97a 100644 --- a/board/BuR/brppt2/config.mk +++ b/board/BuR/brppt2/config.mk @@ -24,8 +24,8 @@ cmd_prodzip = \
ifeq ($(hw-platform-y),brppt2) ifneq ($(CONFIG_SPL_BUILD),y) -ALL-y += $(hw-platform-y)_prog.bin -ALL-y += $(hw-platform-y)_prod.zip +INPUTS-y += $(hw-platform-y)_prog.bin +INPUTS-y += $(hw-platform-y)_prod.zip endif endif
diff --git a/board/BuR/brsmarc1/config.mk b/board/BuR/brsmarc1/config.mk index 0692988507..1de971876c 100644 --- a/board/BuR/brsmarc1/config.mk +++ b/board/BuR/brsmarc1/config.mk @@ -23,11 +23,11 @@ cmd_prodzip = \ cp u-boot-dtb.img misc/ && \ zip -9 -r $@ misc/* >/dev/null $<
-ALL-y += $(hw-platform-y)_prog.bin -ALL-y += $(hw-platform-y)_prod.zip +INPUTS-y += $(hw-platform-y)_prog.bin +INPUTS-y += $(hw-platform-y)_prod.zip
$(hw-platform-y)_prog.bin: u-boot-dtb.img spl/u-boot-spl.bin $(call if_changed,prodbin)
$(hw-platform-y)_prod.zip: $(hw-platform-y)_prog.bin - $(call if_changed,prodzip) \ No newline at end of file + $(call if_changed,prodzip) diff --git a/board/imgtec/boston/config.mk b/board/imgtec/boston/config.mk index 8cfc9c6894..c1e242f108 100644 --- a/board/imgtec/boston/config.mk +++ b/board/imgtec/boston/config.mk @@ -11,5 +11,5 @@ u-boot.mcs: u-boot.bin
# if srec_cat is present build u-boot.mcs by default has_srec_cat = $(call try-run,srec_cat -VERSion,y,n) -ALL-$(has_srec_cat) += u-boot.mcs +INPUTS-$(has_srec_cat) += u-boot.mcs CLEAN_FILES += u-boot.mcs diff --git a/board/intel/edison/config.mk b/board/intel/edison/config.mk index fdcbbdf3b1..8c6087e290 100644 --- a/board/intel/edison/config.mk +++ b/board/intel/edison/config.mk @@ -10,7 +10,7 @@ cmd_mkalign_eds = \ dd if=$^ of=$@ bs=4k seek=1 2>/dev/null && \ mv $@ $^
-ALL-y += u-boot-align.bin +INPUTS-y += u-boot-align.bin u-boot-align.bin: u-boot.bin $(call if_changed,mkalign_eds)
diff --git a/scripts/Makefile.spl b/scripts/Makefile.spl index e6d56a1286..d528c994ff 100644 --- a/scripts/Makefile.spl +++ b/scripts/Makefile.spl @@ -213,42 +213,42 @@ spl/boot.bin: $(obj)/$(SPL_BIN)-align.bin FORCE $(call if_changed,mkimage) endif
-ALL-y += $(obj)/$(SPL_BIN).bin +INPUTS-y += $(obj)/$(SPL_BIN).bin
ifdef CONFIG_SAMSUNG -ALL-y += $(obj)/$(BOARD)-spl.bin +INPUTS-y += $(obj)/$(BOARD)-spl.bin endif
ifneq ($(CONFIG_TARGET_SOCFPGA_GEN5)$(CONFIG_TARGET_SOCFPGA_ARRIA10),) -ALL-y += $(obj)/$(SPL_BIN).sfp +INPUTS-y += $(obj)/$(SPL_BIN).sfp endif
ifdef CONFIG_ARCH_SUNXI -ALL-y += $(obj)/sunxi-spl.bin +INPUTS-y += $(obj)/sunxi-spl.bin
ifdef CONFIG_NAND_SUNXI -ALL-y += $(obj)/sunxi-spl-with-ecc.bin +INPUTS-y += $(obj)/sunxi-spl-with-ecc.bin endif endif
ifeq ($(CONFIG_SYS_SOC),"at91") -ALL-y += $(obj)/boot.bin +INPUTS-y += $(obj)/boot.bin endif
ifdef CONFIG_TPL_BUILD -ALL-$(CONFIG_TPL_X86_16BIT_INIT) += $(obj)/u-boot-x86-start16-tpl.bin \ +INPUTS-$(CONFIG_TPL_X86_16BIT_INIT) += $(obj)/u-boot-x86-start16-tpl.bin \ $(obj)/u-boot-x86-reset16-tpl.bin else -ALL-$(CONFIG_SPL_X86_16BIT_INIT) += $(obj)/u-boot-x86-start16-spl.bin \ +INPUTS-$(CONFIG_SPL_X86_16BIT_INIT) += $(obj)/u-boot-x86-start16-spl.bin \ $(obj)/u-boot-x86-reset16-spl.bin endif
-ALL-$(CONFIG_ARCH_ZYNQ) += $(obj)/boot.bin -ALL-$(CONFIG_ARCH_ZYNQMP) += $(obj)/boot.bin +INPUTS-$(CONFIG_ARCH_ZYNQ) += $(obj)/boot.bin +INPUTS-$(CONFIG_ARCH_ZYNQMP) += $(obj)/boot.bin
-ALL-$(CONFIG_ARCH_MEDIATEK) += $(obj)/u-boot-spl-mtk.bin +INPUTS-$(CONFIG_ARCH_MEDIATEK) += $(obj)/u-boot-spl-mtk.bin
-all: $(ALL-y) +all: $(INPUTS-y)
quiet_cmd_cat = CAT $@ cmd_cat = cat $(filter-out $(PHONY), $^) > $@ diff --git a/tools/binman/README b/tools/binman/README index a6a3ee48aa..37ee3fc2d3 100644 --- a/tools/binman/README +++ b/tools/binman/README @@ -220,7 +220,7 @@ u-boot-<your_suffix>.bin: <input_file_1> <input_file_2> checkbinman FORCE endif
This assumes that u-boot-<your_suffix>.bin is a target, and is the final file -that you need to produce. You can make it a target by adding it to ALL-y +that you need to produce. You can make it a target by adding it to INPUTS-y either in the main Makefile or in a config.mk file in your arch subdirectory.
Once binman is executed it will pick up its instructions from a device-tree

Quite a few boards using this SoC family don't use binman, yet CONFIG_BINMAN is enabled for all of them. But the option should only be enabled if we expect binman to produce an image. Calling binman when the device tree is missing, etc. will cause failer.
Add a condition so that CONFIG_BINMAN is only enabled as needed.
Signed-off-by: Simon Glass sjg@chromium.org Reviewed-by: Bin Meng bmeng.cn@gmail.com ---
(no changes since v1)
arch/powerpc/Kconfig | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/arch/powerpc/Kconfig b/arch/powerpc/Kconfig index c2c577f60c..6a2e88fed2 100644 --- a/arch/powerpc/Kconfig +++ b/arch/powerpc/Kconfig @@ -20,7 +20,7 @@ config MPC85xx select CREATE_ARCH_SYMLINK select SYS_FSL_DDR select SYS_FSL_DDR_BE - select BINMAN + select BINMAN if OF_SEPARATE imply CMD_HASH imply CMD_IRQ imply USB_EHCI_HCD if USB

On x86 various files that need to be created by binman. It does not make sense to enumerate these in the Makefile. They are described in the configuration (devicetree) for each board and we can simply run binman (always) to generate them.
Update the Makefile to have a separate, final step which runs binman, once all input dependencies are present.
This avoid sprinkling the Makefile with arch-specific code.
Signed-off-by: Simon Glass sjg@chromium.org ---
Changes in v3: - Drop rockchip changes which should not be in this patch
Makefile | 63 +++++++++++++------------------------------------------- 1 file changed, 14 insertions(+), 49 deletions(-)
diff --git a/Makefile b/Makefile index 29175fb104..5929c50aea 100644 --- a/Makefile +++ b/Makefile @@ -919,16 +919,6 @@ INPUTS-$(CONFIG_REMAKE_ELF) += u-boot.elf INPUTS-$(CONFIG_EFI_APP) += u-boot-app.efi INPUTS-$(CONFIG_EFI_STUB) += u-boot-payload.efi
-ifneq ($(CONFIG_HAS_ROM),) -ifneq ($(BUILD_ROM)$(CONFIG_BUILD_ROM),) -INPUTS-$(CONFIG_X86_RESET_VECTOR) += u-boot.rom -endif -endif - -ifeq ($(CONFIG_SYS_COREBOOT)$(CONFIG_SPL),yy) -INPUTS-$(CONFIG_BINMAN) += u-boot-x86-with-spl.bin -endif - # Build a combined spl + u-boot image for sunxi ifeq ($(CONFIG_ARCH_SUNXI)$(CONFIG_SPL),yy) INPUTS-y += u-boot-sunxi-with-spl.bin @@ -959,6 +949,10 @@ ifeq ($(CONFIG_ARCH_ROCKCHIP)$(CONFIG_SPL),yy) INPUTS-y += u-boot-rockchip.bin endif
+INPUTS-$(CONFIG_X86) += u-boot-x86-start16.bin u-boot-x86-reset16.bin \ + $(if $(CONFIG_SPL_X86_16BIT_INIT),spl/u-boot-spl.bin) \ + $(if $(CONFIG_TPL_X86_16BIT_INIT),tpl/u-boot-tpl.bin) + LDFLAGS_u-boot += $(LDFLAGS_FINAL)
# Avoid 'Not enough room for program headers' error on binutils 2.28 onwards. @@ -1016,7 +1010,14 @@ cmd_cfgcheck = $(srctree)/scripts/check-config.sh $2 \ PHONY += inputs inputs: $(INPUTS-y)
-all: inputs +all: .binman_stamp inputs +ifeq ($(CONFIG_BINMAN),y) + $(call if_changed,binman) +endif + +# Timestamp file to make sure that binman always runs +.binman_stamp: FORCE + @touch $@
ifeq ($(CONFIG_DEPRECATED),y) $(warning "You have deprecated configuration options enabled in your .config! Please check your configuration.") @@ -1309,7 +1310,7 @@ quiet_cmd_binman = BINMAN $@ cmd_binman = $(srctree)/tools/binman/binman $(if $(BINMAN_DEBUG),-D) \ --toolpath $(objtree)/tools \ $(if $(BINMAN_VERBOSE),-v$(BINMAN_VERBOSE)) \ - build -u -d u-boot.dtb -O . -m \ + build -u -d u-boot.dtb -O . -m --allow-missing \ -I . -I $(srctree) -I $(srctree)/board/$(BOARDDIR) \ $(BINMAN_$(@F))
@@ -1586,27 +1587,11 @@ u-boot-br.bin: u-boot FORCE endif 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. This is handled by binman based on an image description in the -# board's device tree. -ifneq ($(CONFIG_HAS_ROM),) -rom: u-boot.rom FORCE - -refcode.bin: $(srctree)/board/$(BOARDDIR)/refcode.bin FORCE - $(call if_changed,copy) - quiet_cmd_ldr = LD $@ cmd_ldr = $(LD) $(LDFLAGS_$(@F)) \ $(filter-out FORCE,$^) -o $@
-rom-deps := u-boot.bin ifdef CONFIG_X86 -rom-deps += u-boot-x86-start16.bin u-boot-x86-reset16.bin \ - $(if $(CONFIG_SPL_X86_16BIT_INIT),spl/u-boot-spl.bin) \ - $(if $(CONFIG_TPL_X86_16BIT_INIT),tpl/u-boot-tpl.bin) \ - $(if $(CONFIG_HAVE_REFCODE),refcode.bin) - OBJCOPYFLAGS_u-boot-x86-start16.bin := -O binary -j .start16 u-boot-x86-start16.bin: u-boot FORCE $(call if_changed,objcopy) @@ -1615,24 +1600,7 @@ OBJCOPYFLAGS_u-boot-x86-reset16.bin := -O binary -j .resetvec u-boot-x86-reset16.bin: u-boot FORCE $(call if_changed,objcopy)
-else # !CONFIG_X86 - -ifdef CONFIG_SPL -rom-deps += spl/u-boot-spl.bin - -# We can rely on CONFIG_SPL_FRAMEWORK being set for boards that use binman -rom-deps += u-boot.img -endif - -ifdef CONFIG_TPL -rom-deps += tpl/u-boot-tpl.bin -endif - -endif - -u-boot.rom: $(rom-deps) FORCE - $(call if_changed,binman) -endif +endif # CONFIG_X86
ifneq ($(CONFIG_ARCH_SUNXI),) ifeq ($(CONFIG_ARM64),) @@ -1644,9 +1612,6 @@ u-boot-sunxi-with-spl.bin: spl/sunxi-spl.bin u-boot.itb FORCE endif endif
-u-boot-x86-with-spl.bin: spl/u-boot-spl.bin u-boot.bin FORCE - $(call if_changed,binman) - ifneq ($(CONFIG_ARCH_TEGRA),) # Makes u-boot-dtb-tegra.bin u-boot-tegra.bin u-boot-nodtb-tegra.bin %-dtb-tegra.bin %-tegra.bin %-nodtb-tegra.bin: spl/%-spl %.bin FORCE

This Kconfig is not needed anymore since U-Boot will build the ROM if the required binary blobs exist.
The BUILD_ROM environment variable used to request that the ROM be built. Now this always happens if the required binary blobs are available. Update it to mean that U-Boot should fail if the ROM cannot be built. This behaviour should be compatible with how it used to work.
Signed-off-by: Simon Glass sjg@chromium.org Reviewed-by: Bin Meng bmeng.cn@gmail.com ---
(no changes since v1)
Kconfig | 7 +++++-- Makefile | 3 ++- configs/qemu-x86_64_defconfig | 1 - configs/qemu-x86_defconfig | 1 - 4 files changed, 7 insertions(+), 5 deletions(-)
diff --git a/Kconfig b/Kconfig index 7f469748e8..5ac5efcc2e 100644 --- a/Kconfig +++ b/Kconfig @@ -288,8 +288,11 @@ config ROM_NEEDS_BLOBS depends on HAS_ROM help Enable this if building the u-boot.rom target needs binary blobs, and - so cannot be done normally. In this case, pass BUILD_ROM=1 to make - to tell U-Boot to build the ROM. + so cannot be done normally. In this case, U-Boot will only build the + ROM if the required blobs exist. If not, you will see an warning like: + + Image 'main-section' is missing external blobs and is non-functional: + intel-descriptor intel-me intel-refcode intel-vga intel-mrc
config BUILD_ROM bool "Build U-Boot as BIOS replacement" diff --git a/Makefile b/Makefile index 5929c50aea..08d14c00ec 100644 --- a/Makefile +++ b/Makefile @@ -1310,7 +1310,8 @@ quiet_cmd_binman = BINMAN $@ cmd_binman = $(srctree)/tools/binman/binman $(if $(BINMAN_DEBUG),-D) \ --toolpath $(objtree)/tools \ $(if $(BINMAN_VERBOSE),-v$(BINMAN_VERBOSE)) \ - build -u -d u-boot.dtb -O . -m --allow-missing \ + build -u -d u-boot.dtb -O . \ + $(if $(BUILD_ROM),,-m --allow-missing) \ -I . -I $(srctree) -I $(srctree)/board/$(BOARDDIR) \ $(BINMAN_$(@F))
diff --git a/configs/qemu-x86_64_defconfig b/configs/qemu-x86_64_defconfig index dd4ae62a30..4d156bc7fc 100644 --- a/configs/qemu-x86_64_defconfig +++ b/configs/qemu-x86_64_defconfig @@ -18,7 +18,6 @@ CONFIG_GENERATE_ACPI_TABLE=y CONFIG_X86_OFFSET_U_BOOT=0xfff00000 CONFIG_DEFAULT_DEVICE_TREE="qemu-x86_i440fx" CONFIG_DISTRO_DEFAULTS=y -CONFIG_BUILD_ROM=y CONFIG_FIT=y CONFIG_SPL_LOAD_FIT=y CONFIG_BOOTSTAGE=y diff --git a/configs/qemu-x86_defconfig b/configs/qemu-x86_defconfig index 4309c2352d..f0e8e7d967 100644 --- a/configs/qemu-x86_defconfig +++ b/configs/qemu-x86_defconfig @@ -8,7 +8,6 @@ CONFIG_GENERATE_PIRQ_TABLE=y CONFIG_GENERATE_MP_TABLE=y CONFIG_GENERATE_ACPI_TABLE=y CONFIG_DISTRO_DEFAULTS=y -CONFIG_BUILD_ROM=y CONFIG_FIT=y CONFIG_BOOTSTAGE=y CONFIG_BOOTSTAGE_REPORT=y

On sunxi various files that need to be created by binman. It does not make sense to enumerate these in the Makefile. They are described in the configuration (devicetree) for each board and we can simply run binman (always) to generate them.
This avoid sprinkling the Makefile with arch-specific code.
Reviewed-by: Bin Meng bmeng.cn@gmail.com Signed-off-by: Simon Glass sjg@chromium.org ---
(no changes since v1)
Makefile | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-)
diff --git a/Makefile b/Makefile index 08d14c00ec..000482e482 100644 --- a/Makefile +++ b/Makefile @@ -920,7 +920,7 @@ INPUTS-$(CONFIG_EFI_APP) += u-boot-app.efi INPUTS-$(CONFIG_EFI_STUB) += u-boot-payload.efi
# Build a combined spl + u-boot image for sunxi -ifeq ($(CONFIG_ARCH_SUNXI)$(CONFIG_SPL),yy) +ifeq ($(CONFIG_ARCH_SUNXI)$(CONFIG_ARM64)$(CONFIG_SPL),yyy) INPUTS-y += u-boot-sunxi-with-spl.bin endif
@@ -1604,10 +1604,7 @@ u-boot-x86-reset16.bin: u-boot FORCE endif # CONFIG_X86
ifneq ($(CONFIG_ARCH_SUNXI),) -ifeq ($(CONFIG_ARM64),) -u-boot-sunxi-with-spl.bin: spl/sunxi-spl.bin u-boot.img u-boot.dtb FORCE - $(call if_changed,binman) -else +ifeq ($(CONFIG_ARM64),y) u-boot-sunxi-with-spl.bin: spl/sunxi-spl.bin u-boot.itb FORCE $(call if_changed,cat) endif

On tegra various files that need to be created by binman. It does not make sense to enumerate these in the Makefile. They are described in the configuration (devicetree) for each board and we can simply run binman (always) to generate them.
This avoid sprinkling the Makefile with arch-specific code.
Reviewed-by: Bin Meng bmeng.cn@gmail.com Signed-off-by: Simon Glass sjg@chromium.org ---
(no changes since v1)
Makefile | 12 ------------ 1 file changed, 12 deletions(-)
diff --git a/Makefile b/Makefile index 000482e482..bdd701e187 100644 --- a/Makefile +++ b/Makefile @@ -924,12 +924,6 @@ ifeq ($(CONFIG_ARCH_SUNXI)$(CONFIG_ARM64)$(CONFIG_SPL),yyy) INPUTS-y += u-boot-sunxi-with-spl.bin endif
-# enable combined SPL/u-boot/dtb rules for tegra -ifeq ($(CONFIG_ARCH_TEGRA)$(CONFIG_SPL),yy) -INPUTS-y += u-boot-tegra.bin u-boot-nodtb-tegra.bin -INPUTS-$(CONFIG_OF_SEPARATE) += u-boot-dtb-tegra.bin -endif - INPUTS-$(CONFIG_ARCH_MEDIATEK) += u-boot-mtk.bin
# Add optional build target if defined in board/cpu/soc headers @@ -1610,12 +1604,6 @@ u-boot-sunxi-with-spl.bin: spl/sunxi-spl.bin u-boot.itb FORCE endif endif
-ifneq ($(CONFIG_ARCH_TEGRA),) -# Makes u-boot-dtb-tegra.bin u-boot-tegra.bin u-boot-nodtb-tegra.bin -%-dtb-tegra.bin %-tegra.bin %-nodtb-tegra.bin: spl/%-spl %.bin FORCE - $(call if_changed,binman) -endif - OBJCOPYFLAGS_u-boot-app.efi := $(OBJCOPYFLAGS_EFI) u-boot-app.efi: u-boot FORCE $(call if_changed,zobjcopy)

On mediatek various files that need to be created by binman. It does not make sense to enumerate these in the Makefile. They are described in the configuration (devicetree) for each board and we can simply run binman (always) to generate them.
This avoid sprinkling the Makefile with arch-specific code.
Also update the binman definition so that idbloader.img is only needed when SPL is actually being used.
Reviewed-by: Bin Meng bmeng.cn@gmail.com Signed-off-by: Simon Glass sjg@chromium.org ---
Changes in v3: - Move in the rockchip changes mistakenly in the earlier x86 patch
Makefile | 24 ++++++++++++++++-------- arch/arm/dts/rockchip-u-boot.dtsi | 2 ++ 2 files changed, 18 insertions(+), 8 deletions(-)
diff --git a/Makefile b/Makefile index bdd701e187..77386000e6 100644 --- a/Makefile +++ b/Makefile @@ -924,7 +924,10 @@ ifeq ($(CONFIG_ARCH_SUNXI)$(CONFIG_ARM64)$(CONFIG_SPL),yyy) INPUTS-y += u-boot-sunxi-with-spl.bin endif
+# Generate this input file for binman +ifeq ($(CONFIG_SPL),) INPUTS-$(CONFIG_ARCH_MEDIATEK) += u-boot-mtk.bin +endif
# Add optional build target if defined in board/cpu/soc headers ifneq ($(CONFIG_BUILD_TARGET),) @@ -939,9 +942,20 @@ ifeq ($(CONFIG_MPC85xx)$(CONFIG_OF_SEPARATE),yy) INPUTS-y += u-boot-with-dtb.bin endif
-ifeq ($(CONFIG_ARCH_ROCKCHIP)$(CONFIG_SPL),yy) +ifeq ($(CONFIG_ARCH_ROCKCHIP),y) +# On ARM64 this target is produced by binman so we don't need this dep +ifeq ($(CONFIG_ARM64),y) +ifeq ($(CONFIG_SPL),y) +# TODO: Get binman to generate this too INPUTS-y += u-boot-rockchip.bin endif +else +ifeq ($(CONFIG_SPL),y) +# Generate these inputs for binman which will create the output files +INPUTS-y += idbloader.img u-boot.img +endif +endif +endif
INPUTS-$(CONFIG_X86) += u-boot-x86-start16.bin u-boot-x86-reset16.bin \ $(if $(CONFIG_SPL_X86_16BIT_INIT),spl/u-boot-spl.bin) \ @@ -1457,10 +1471,7 @@ idbloader.img: spl/u-boot-spl.bin FORCE $(call if_changed,mkimage) endif
-ifeq ($(CONFIG_ARM64),) -u-boot-rockchip.bin: idbloader.img u-boot.img FORCE - $(call if_changed,binman) -else +ifeq ($(CONFIG_ARM64),y) OBJCOPYFLAGS_u-boot-rockchip.bin = -I binary -O binary \ --pad-to=$(CONFIG_SPL_PAD_TO) --gap-fill=0xff u-boot-rockchip.bin: idbloader.img u-boot.itb FORCE @@ -1687,9 +1698,6 @@ u-boot-elf.lds: arch/u-boot-elf.lds prepare FORCE
ifeq ($(CONFIG_SPL),y) spl/u-boot-spl-mtk.bin: spl/u-boot-spl - -u-boot-mtk.bin: u-boot.dtb u-boot.img spl/u-boot-spl-mtk.bin FORCE - $(call if_changed,binman) else MKIMAGEFLAGS_u-boot-mtk.bin = -T mtk_image \ -a $(CONFIG_SYS_TEXT_BASE) -e $(CONFIG_SYS_TEXT_BASE) \ diff --git a/arch/arm/dts/rockchip-u-boot.dtsi b/arch/arm/dts/rockchip-u-boot.dtsi index 0451db735e..eae3ee715d 100644 --- a/arch/arm/dts/rockchip-u-boot.dtsi +++ b/arch/arm/dts/rockchip-u-boot.dtsi @@ -11,6 +11,7 @@ }; };
+#ifdef CONFIG_SPL &binman { simple-bin { filename = "u-boot-rockchip.bin"; @@ -25,3 +26,4 @@ }; }; }; +#endif

At present this is checked before the config has been loaded by the Makefile, so it doesn't work.
Move the check to later.
Signed-off-by: Simon Glass sjg@chromium.org Reviewed-by: Bin Meng bmeng.cn@gmail.com ---
(no changes since v1)
Makefile | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-)
diff --git a/Makefile b/Makefile index 77386000e6..57bd1ea85e 100644 --- a/Makefile +++ b/Makefile @@ -278,7 +278,7 @@ HOST_LFS_LIBS := $(shell getconf LFS_LIBS 2>/dev/null) HOSTCC = cc HOSTCXX = c++ KBUILD_HOSTCFLAGS := -Wall -Wstrict-prototypes -O2 -fomit-frame-pointer \ - $(if $(CONFIG_TOOLS_DEBUG),-g) $(HOST_LFS_CFLAGS) $(HOSTCFLAGS) + $(HOST_LFS_CFLAGS) $(HOSTCFLAGS) KBUILD_HOSTCXXFLAGS := -O2 $(HOST_LFS_CFLAGS) $(HOSTCXXFLAGS) KBUILD_HOSTLDFLAGS := $(HOST_LFS_LDFLAGS) $(HOSTLDFLAGS) KBUILD_HOSTLDLIBS := $(HOST_LFS_LIBS) $(HOSTLDLIBS) @@ -735,6 +735,8 @@ KBUILD_CPPFLAGS += $(KCPPFLAGS) KBUILD_AFLAGS += $(KAFLAGS) KBUILD_CFLAGS += $(KCFLAGS)
+KBUILD_HOSTCFLAGS += $(if $(CONFIG_TOOLS_DEBUG),-g) + # Use UBOOTINCLUDE when you must reference the include/ directory. # Needed to be compatible with the O= option UBOOTINCLUDE := \

Fix this line which is over the limit.
Signed-off-by: Simon Glass sjg@chromium.org Reviewed-by: Bin Meng bmeng.cn@gmail.com ---
(no changes since v1)
Makefile | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/Makefile b/Makefile index 57bd1ea85e..f2b229096e 100644 --- a/Makefile +++ b/Makefile @@ -997,7 +997,8 @@ cmd_mkimage = $(objtree)/tools/mkimage $(MKIMAGEFLAGS_$(@F)) -d $< $@ \ >$(MKIMAGEOUTPUT) $(if $(KBUILD_VERBOSE:0=), && cat $(MKIMAGEOUTPUT))
quiet_cmd_mkfitimage = MKIMAGE $@ -cmd_mkfitimage = $(objtree)/tools/mkimage $(MKIMAGEFLAGS_$(@F)) -f $(U_BOOT_ITS) -p $(CONFIG_FIT_EXTERNAL_OFFSET) $@\ +cmd_mkfitimage = $(objtree)/tools/mkimage $(MKIMAGEFLAGS_$(@F)) \ + -f $(U_BOOT_ITS) -p $(CONFIG_FIT_EXTERNAL_OFFSET) $@ \ >$(MKIMAGEOUTPUT) $(if $(KBUILD_VERBOSE:0=), && cat $(MKIMAGEOUTPUT))
quiet_cmd_cat = CAT $@

At present we use the empty string to indicate that there is no FIT generator, but this doesn't allow an individual board to undefine it. Create a separate bool instead.
Update the config of the boards which currently have an empty string.
Signed-off-by: Simon Glass sjg@chromium.org ---
(no changes since v1)
Kconfig | 6 +++++- Makefile | 2 +- configs/am335x_evm_defconfig | 1 + configs/am335x_hs_evm_defconfig | 1 + configs/am335x_hs_evm_uart_defconfig | 1 + configs/am43xx_evm_defconfig | 1 + configs/am43xx_evm_rtconly_defconfig | 1 + configs/am43xx_evm_usbhost_boot_defconfig | 1 + configs/am43xx_hs_evm_defconfig | 1 + configs/am57xx_evm_defconfig | 1 + configs/am57xx_hs_evm_defconfig | 1 + configs/am57xx_hs_evm_usb_defconfig | 1 + configs/am65x_evm_a53_defconfig | 1 + configs/am65x_evm_r5_defconfig | 1 + configs/am65x_hs_evm_a53_defconfig | 1 + configs/am65x_hs_evm_r5_defconfig | 1 + configs/dh_imx6_defconfig | 1 + configs/display5_defconfig | 1 + configs/display5_factory_defconfig | 1 + configs/dra7xx_evm_defconfig | 1 + configs/dra7xx_hs_evm_defconfig | 1 + configs/dra7xx_hs_evm_usb_defconfig | 1 + configs/imx6qdl_icore_mipi_defconfig | 1 + configs/imx6qdl_icore_mmc_defconfig | 1 + configs/imx6qdl_icore_rqs_defconfig | 1 + configs/j721e_evm_a72_defconfig | 1 + configs/j721e_evm_r5_defconfig | 1 + configs/j721e_hs_evm_a72_defconfig | 1 + configs/j721e_hs_evm_r5_defconfig | 1 + configs/ls1046ardb_qspi_spl_defconfig | 1 + configs/mccmon6_nor_defconfig | 1 + configs/mccmon6_sd_defconfig | 1 + configs/mx6sabreauto_defconfig | 1 + configs/mx6sabresd_defconfig | 1 + configs/pico-imx6_defconfig | 1 + configs/qemu-x86_64_defconfig | 1 + configs/sandbox_spl_defconfig | 1 + configs/socfpga_arria10_defconfig | 1 + configs/stm32mp15_dhcom_basic_defconfig | 1 + configs/stm32mp15_dhcor_basic_defconfig | 1 + configs/wandboard_defconfig | 1 + configs/xilinx_zynq_virt_defconfig | 1 + 42 files changed, 46 insertions(+), 2 deletions(-)
diff --git a/Kconfig b/Kconfig index 5ac5efcc2e..893ea35ea8 100644 --- a/Kconfig +++ b/Kconfig @@ -594,9 +594,13 @@ config SPL_FIT_SOURCE U-Boot FIT image. This could specify further image to load and/or execute.
+config USE_SPL_FIT_GENERATOR + bool "Use a script to generate the .its script" + default y if SPL_FIT + config SPL_FIT_GENERATOR string ".its file generator script for U-Boot FIT image" - depends on SPL_FIT + depends on USE_SPL_FIT_GENERATOR default "board/sunxi/mksunxi_fit_atf.sh" if SPL_LOAD_FIT && ARCH_SUNXI default "arch/arm/mach-rockchip/make_fit_atf.py" if SPL_LOAD_FIT && ARCH_ROCKCHIP default "arch/arm/mach-zynqmp/mkimage_fit_atf.sh" if SPL_LOAD_FIT && ARCH_ZYNQMP diff --git a/Makefile b/Makefile index f2b229096e..c34620f0c4 100644 --- a/Makefile +++ b/Makefile @@ -1348,7 +1348,7 @@ U_BOOT_ITS := u-boot.its $(U_BOOT_ITS): $(subst ",,$(CONFIG_SPL_FIT_SOURCE)) $(call if_changed,copy) else -ifneq ($(CONFIG_SPL_FIT_GENERATOR),"") +ifneq ($(CONFIG_USE_SPL_FIT_GENERATOR),) U_BOOT_ITS := u-boot.its ifeq ($(CONFIG_SPL_FIT_GENERATOR),"arch/arm/mach-imx/mkimage_fit_atf.sh") U_BOOT_ITS_DEPS += u-boot-nodtb.bin diff --git a/configs/am335x_evm_defconfig b/configs/am335x_evm_defconfig index b8333eb4b8..7c34fc5f81 100644 --- a/configs/am335x_evm_defconfig +++ b/configs/am335x_evm_defconfig @@ -6,6 +6,7 @@ CONFIG_AM33XX=y CONFIG_SPL=y CONFIG_DISTRO_DEFAULTS=y CONFIG_SPL_LOAD_FIT=y +# CONFIG_USE_SPL_FIT_GENERATOR is not set CONFIG_OF_BOARD_SETUP=y CONFIG_BOOTCOMMAND="if test ${boot_fit} -eq 1; then run update_to_fit; fi; run findfdt; run init_console; run envboot; run distro_bootcmd" CONFIG_LOGLEVEL=3 diff --git a/configs/am335x_hs_evm_defconfig b/configs/am335x_hs_evm_defconfig index 4faab7fa5b..c4ebe54cf4 100644 --- a/configs/am335x_hs_evm_defconfig +++ b/configs/am335x_hs_evm_defconfig @@ -10,6 +10,7 @@ CONFIG_DISTRO_DEFAULTS=y CONFIG_FIT_IMAGE_POST_PROCESS=y CONFIG_SPL_LOAD_FIT=y CONFIG_SPL_FIT_IMAGE_POST_PROCESS=y +# CONFIG_USE_SPL_FIT_GENERATOR is not set CONFIG_OF_BOARD_SETUP=y CONFIG_BOOTCOMMAND="if test ${boot_fit} -eq 1; then run update_to_fit; fi; run findfdt; run init_console; run envboot; run distro_bootcmd" CONFIG_LOGLEVEL=3 diff --git a/configs/am335x_hs_evm_uart_defconfig b/configs/am335x_hs_evm_uart_defconfig index fb4e11d1c7..9e8eeefe36 100644 --- a/configs/am335x_hs_evm_uart_defconfig +++ b/configs/am335x_hs_evm_uart_defconfig @@ -13,6 +13,7 @@ CONFIG_DISTRO_DEFAULTS=y CONFIG_FIT_IMAGE_POST_PROCESS=y CONFIG_SPL_LOAD_FIT=y CONFIG_SPL_FIT_IMAGE_POST_PROCESS=y +# CONFIG_USE_SPL_FIT_GENERATOR is not set CONFIG_OF_BOARD_SETUP=y CONFIG_BOOTCOMMAND="if test ${boot_fit} -eq 1; then run update_to_fit; fi; run findfdt; run init_console; run envboot; run distro_bootcmd" CONFIG_LOGLEVEL=3 diff --git a/configs/am43xx_evm_defconfig b/configs/am43xx_evm_defconfig index be88f28e9e..e92e9a1825 100644 --- a/configs/am43xx_evm_defconfig +++ b/configs/am43xx_evm_defconfig @@ -10,6 +10,7 @@ CONFIG_SPL_DRIVERS_MISC_SUPPORT=y CONFIG_SPL=y CONFIG_DISTRO_DEFAULTS=y CONFIG_SPL_LOAD_FIT=y +# CONFIG_USE_SPL_FIT_GENERATOR is not set # CONFIG_USE_BOOTCOMMAND is not set CONFIG_SYS_CONSOLE_INFO_QUIET=y # CONFIG_MISC_INIT_R is not set diff --git a/configs/am43xx_evm_rtconly_defconfig b/configs/am43xx_evm_rtconly_defconfig index 8f1e60fd3e..6d32536129 100644 --- a/configs/am43xx_evm_rtconly_defconfig +++ b/configs/am43xx_evm_rtconly_defconfig @@ -10,6 +10,7 @@ CONFIG_SPL_RTC_DDR_SUPPORT=y CONFIG_SPL=y CONFIG_DISTRO_DEFAULTS=y CONFIG_SPL_LOAD_FIT=y +# CONFIG_USE_SPL_FIT_GENERATOR is not set # CONFIG_USE_BOOTCOMMAND is not set CONFIG_SYS_CONSOLE_INFO_QUIET=y # CONFIG_MISC_INIT_R is not set diff --git a/configs/am43xx_evm_usbhost_boot_defconfig b/configs/am43xx_evm_usbhost_boot_defconfig index 7afd328a49..6a9ec32bc7 100644 --- a/configs/am43xx_evm_usbhost_boot_defconfig +++ b/configs/am43xx_evm_usbhost_boot_defconfig @@ -9,6 +9,7 @@ CONFIG_AM43XX=y CONFIG_SPL=y CONFIG_DISTRO_DEFAULTS=y CONFIG_SPL_LOAD_FIT=y +# CONFIG_USE_SPL_FIT_GENERATOR is not set # CONFIG_USE_BOOTCOMMAND is not set CONFIG_SYS_CONSOLE_INFO_QUIET=y # CONFIG_MISC_INIT_R is not set diff --git a/configs/am43xx_hs_evm_defconfig b/configs/am43xx_hs_evm_defconfig index fa8d069910..598b14a580 100644 --- a/configs/am43xx_hs_evm_defconfig +++ b/configs/am43xx_hs_evm_defconfig @@ -18,6 +18,7 @@ CONFIG_DISTRO_DEFAULTS=y CONFIG_FIT_IMAGE_POST_PROCESS=y CONFIG_SPL_LOAD_FIT=y CONFIG_SPL_FIT_IMAGE_POST_PROCESS=y +# CONFIG_USE_SPL_FIT_GENERATOR is not set CONFIG_OF_BOARD_SETUP=y # CONFIG_USE_BOOTCOMMAND is not set CONFIG_SYS_CONSOLE_INFO_QUIET=y diff --git a/configs/am57xx_evm_defconfig b/configs/am57xx_evm_defconfig index dce50dc4be..5afa372e95 100644 --- a/configs/am57xx_evm_defconfig +++ b/configs/am57xx_evm_defconfig @@ -18,6 +18,7 @@ CONFIG_AHCI=y CONFIG_DEFAULT_DEVICE_TREE="am572x-idk" CONFIG_DISTRO_DEFAULTS=y CONFIG_SPL_LOAD_FIT=y +# CONFIG_USE_SPL_FIT_GENERATOR is not set CONFIG_OF_BOARD_SETUP=y CONFIG_USE_BOOTARGS=y CONFIG_BOOTARGS="androidboot.serialno=${serial#} console=ttyS2,115200 androidboot.console=ttyS2 androidboot.hardware=beagle_x15board" diff --git a/configs/am57xx_hs_evm_defconfig b/configs/am57xx_hs_evm_defconfig index 081a48f038..f4aaa429ef 100644 --- a/configs/am57xx_hs_evm_defconfig +++ b/configs/am57xx_hs_evm_defconfig @@ -22,6 +22,7 @@ CONFIG_DISTRO_DEFAULTS=y CONFIG_FIT_IMAGE_POST_PROCESS=y CONFIG_SPL_LOAD_FIT=y CONFIG_SPL_FIT_IMAGE_POST_PROCESS=y +# CONFIG_USE_SPL_FIT_GENERATOR is not set CONFIG_OF_BOARD_SETUP=y CONFIG_USE_BOOTARGS=y CONFIG_BOOTARGS="androidboot.serialno=${serial#} console=ttyS2,115200 androidboot.console=ttyS2 androidboot.hardware=beagle_x15board" diff --git a/configs/am57xx_hs_evm_usb_defconfig b/configs/am57xx_hs_evm_usb_defconfig index 2ecc990683..b71cf14943 100644 --- a/configs/am57xx_hs_evm_usb_defconfig +++ b/configs/am57xx_hs_evm_usb_defconfig @@ -24,6 +24,7 @@ CONFIG_DISTRO_DEFAULTS=y CONFIG_FIT_IMAGE_POST_PROCESS=y CONFIG_SPL_LOAD_FIT=y CONFIG_SPL_FIT_IMAGE_POST_PROCESS=y +# CONFIG_USE_SPL_FIT_GENERATOR is not set CONFIG_OF_BOARD_SETUP=y CONFIG_USE_BOOTARGS=y CONFIG_BOOTARGS="androidboot.serialno=${serial#} console=ttyS2,115200 androidboot.console=ttyS2 androidboot.hardware=beagle_x15board" diff --git a/configs/am65x_evm_a53_defconfig b/configs/am65x_evm_a53_defconfig index 918ff4de0c..88f595b397 100644 --- a/configs/am65x_evm_a53_defconfig +++ b/configs/am65x_evm_a53_defconfig @@ -26,6 +26,7 @@ CONFIG_DEFAULT_DEVICE_TREE="k3-am654-base-board" CONFIG_DISTRO_DEFAULTS=y # CONFIG_SYS_MALLOC_CLEAR_ON_INIT is not set CONFIG_SPL_LOAD_FIT=y +# CONFIG_USE_SPL_FIT_GENERATOR is not set CONFIG_OF_BOARD_SETUP=y CONFIG_BOOTCOMMAND="run findfdt; run envboot; run init_${boot}; run boot_rprocs; run get_kern_${boot}; run get_fdt_${boot}; run get_overlay_${boot}; run run_kern" CONFIG_CONSOLE_MUX=y diff --git a/configs/am65x_evm_r5_defconfig b/configs/am65x_evm_r5_defconfig index 09c8b74aee..5b756d24e8 100644 --- a/configs/am65x_evm_r5_defconfig +++ b/configs/am65x_evm_r5_defconfig @@ -24,6 +24,7 @@ CONFIG_SPL_SPI_SUPPORT=y CONFIG_DEFAULT_DEVICE_TREE="k3-am654-r5-base-board" # CONFIG_SYS_MALLOC_CLEAR_ON_INIT is not set CONFIG_SPL_LOAD_FIT=y +# CONFIG_USE_SPL_FIT_GENERATOR is not set CONFIG_USE_BOOTCOMMAND=y # CONFIG_DISPLAY_CPUINFO is not set CONFIG_SPL_STACK_R=y diff --git a/configs/am65x_hs_evm_a53_defconfig b/configs/am65x_hs_evm_a53_defconfig index bc3da74509..6786e75f3e 100644 --- a/configs/am65x_hs_evm_a53_defconfig +++ b/configs/am65x_hs_evm_a53_defconfig @@ -29,6 +29,7 @@ CONFIG_DISTRO_DEFAULTS=y CONFIG_FIT_IMAGE_POST_PROCESS=y CONFIG_SPL_LOAD_FIT=y CONFIG_SPL_FIT_IMAGE_POST_PROCESS=y +# CONFIG_USE_SPL_FIT_GENERATOR is not set CONFIG_OF_BOARD_SETUP=y CONFIG_BOOTCOMMAND="run findfdt; run envboot; run init_${boot}; run get_fit_${boot}; run get_overlaystring; run run_fit" CONFIG_CONSOLE_MUX=y diff --git a/configs/am65x_hs_evm_r5_defconfig b/configs/am65x_hs_evm_r5_defconfig index ead4a59c38..38fd5627fd 100644 --- a/configs/am65x_hs_evm_r5_defconfig +++ b/configs/am65x_hs_evm_r5_defconfig @@ -26,6 +26,7 @@ CONFIG_DEFAULT_DEVICE_TREE="k3-am654-r5-base-board" # CONFIG_SYS_MALLOC_CLEAR_ON_INIT is not set CONFIG_SPL_LOAD_FIT=y CONFIG_SPL_FIT_IMAGE_POST_PROCESS=y +# CONFIG_USE_SPL_FIT_GENERATOR is not set CONFIG_USE_BOOTCOMMAND=y # CONFIG_DISPLAY_CPUINFO is not set CONFIG_SPL_STACK_R=y diff --git a/configs/dh_imx6_defconfig b/configs/dh_imx6_defconfig index d91ff77a4a..5d28105197 100644 --- a/configs/dh_imx6_defconfig +++ b/configs/dh_imx6_defconfig @@ -25,6 +25,7 @@ CONFIG_DISTRO_DEFAULTS=y # CONFIG_SYS_MALLOC_F is not set CONFIG_FIT=y CONFIG_SPL_FIT=y +# CONFIG_USE_SPL_FIT_GENERATOR is not set CONFIG_SYS_EXTRA_OPTIONS="IMX_CONFIG=arch/arm/mach-imx/spl_sd.cfg" CONFIG_BOOTDELAY=3 # CONFIG_USE_BOOTCOMMAND is not set diff --git a/configs/display5_defconfig b/configs/display5_defconfig index ee5815514b..8577622cbe 100644 --- a/configs/display5_defconfig +++ b/configs/display5_defconfig @@ -28,6 +28,7 @@ CONFIG_SPL_SPI_FLASH_SUPPORT=y CONFIG_SPL_SPI_SUPPORT=y CONFIG_FIT=y CONFIG_SPL_LOAD_FIT=y +# CONFIG_USE_SPL_FIT_GENERATOR is not set CONFIG_OF_BOARD_SETUP=y CONFIG_SYS_EXTRA_OPTIONS="IMX_CONFIG=arch/arm/mach-imx/spl_sd.cfg,MX6Q" CONFIG_SUPPORT_RAW_INITRD=y diff --git a/configs/display5_factory_defconfig b/configs/display5_factory_defconfig index 9cb9612a95..a235170b9b 100644 --- a/configs/display5_factory_defconfig +++ b/configs/display5_factory_defconfig @@ -25,6 +25,7 @@ CONFIG_SPL_SPI_FLASH_SUPPORT=y CONFIG_SPL_SPI_SUPPORT=y CONFIG_FIT=y CONFIG_SPL_LOAD_FIT=y +# CONFIG_USE_SPL_FIT_GENERATOR is not set CONFIG_OF_BOARD_SETUP=y CONFIG_SYS_EXTRA_OPTIONS="IMX_CONFIG=arch/arm/mach-imx/spl_sd.cfg,MX6Q" CONFIG_BOOTDELAY=3 diff --git a/configs/dra7xx_evm_defconfig b/configs/dra7xx_evm_defconfig index 12f08ae6f9..bc142a565d 100644 --- a/configs/dra7xx_evm_defconfig +++ b/configs/dra7xx_evm_defconfig @@ -18,6 +18,7 @@ CONFIG_AHCI=y CONFIG_DEFAULT_DEVICE_TREE="dra7-evm" CONFIG_DISTRO_DEFAULTS=y CONFIG_SPL_LOAD_FIT=y +# CONFIG_USE_SPL_FIT_GENERATOR is not set CONFIG_OF_BOARD_SETUP=y CONFIG_USE_BOOTARGS=y CONFIG_BOOTARGS="androidboot.serialno=${serial#} console=ttyS0,115200 androidboot.console=ttyS0 androidboot.hardware=jacinto6evmboard" diff --git a/configs/dra7xx_hs_evm_defconfig b/configs/dra7xx_hs_evm_defconfig index e15f62eded..52593d9c67 100644 --- a/configs/dra7xx_hs_evm_defconfig +++ b/configs/dra7xx_hs_evm_defconfig @@ -22,6 +22,7 @@ CONFIG_DISTRO_DEFAULTS=y CONFIG_FIT_IMAGE_POST_PROCESS=y CONFIG_SPL_LOAD_FIT=y CONFIG_SPL_FIT_IMAGE_POST_PROCESS=y +# CONFIG_USE_SPL_FIT_GENERATOR is not set CONFIG_OF_BOARD_SETUP=y CONFIG_USE_BOOTARGS=y CONFIG_BOOTARGS="androidboot.serialno=${serial#} console=ttyS0,115200 androidboot.console=ttyS0 androidboot.hardware=jacinto6evmboard" diff --git a/configs/dra7xx_hs_evm_usb_defconfig b/configs/dra7xx_hs_evm_usb_defconfig index 4178473ddf..c44a3204f2 100644 --- a/configs/dra7xx_hs_evm_usb_defconfig +++ b/configs/dra7xx_hs_evm_usb_defconfig @@ -25,6 +25,7 @@ CONFIG_DISTRO_DEFAULTS=y CONFIG_FIT_IMAGE_POST_PROCESS=y CONFIG_SPL_LOAD_FIT=y CONFIG_SPL_FIT_IMAGE_POST_PROCESS=y +# CONFIG_USE_SPL_FIT_GENERATOR is not set CONFIG_OF_BOARD_SETUP=y CONFIG_USE_BOOTARGS=y CONFIG_BOOTARGS="androidboot.serialno=${serial#} console=ttyS0,115200 androidboot.console=ttyS0 androidboot.hardware=jacinto6evmboard" diff --git a/configs/imx6qdl_icore_mipi_defconfig b/configs/imx6qdl_icore_mipi_defconfig index c08a361ee1..6bae7ae331 100644 --- a/configs/imx6qdl_icore_mipi_defconfig +++ b/configs/imx6qdl_icore_mipi_defconfig @@ -20,6 +20,7 @@ CONFIG_FIT=y CONFIG_FIT_SIGNATURE=y CONFIG_FIT_VERBOSE=y CONFIG_SPL_LOAD_FIT=y +# CONFIG_USE_SPL_FIT_GENERATOR is not set CONFIG_LEGACY_IMAGE_FORMAT=y CONFIG_SYS_EXTRA_OPTIONS="IMX_CONFIG=arch/arm/mach-imx/spl_sd.cfg" CONFIG_BOOTDELAY=3 diff --git a/configs/imx6qdl_icore_mmc_defconfig b/configs/imx6qdl_icore_mmc_defconfig index 66985bde31..5bf3b16721 100644 --- a/configs/imx6qdl_icore_mmc_defconfig +++ b/configs/imx6qdl_icore_mmc_defconfig @@ -23,6 +23,7 @@ CONFIG_FIT=y CONFIG_FIT_SIGNATURE=y CONFIG_FIT_VERBOSE=y CONFIG_SPL_LOAD_FIT=y +# CONFIG_USE_SPL_FIT_GENERATOR is not set CONFIG_LEGACY_IMAGE_FORMAT=y CONFIG_SYS_EXTRA_OPTIONS="IMX_CONFIG=arch/arm/mach-imx/spl_sd.cfg" CONFIG_BOOTDELAY=3 diff --git a/configs/imx6qdl_icore_rqs_defconfig b/configs/imx6qdl_icore_rqs_defconfig index 6cc50eb264..de455893d4 100644 --- a/configs/imx6qdl_icore_rqs_defconfig +++ b/configs/imx6qdl_icore_rqs_defconfig @@ -17,6 +17,7 @@ CONFIG_FIT=y CONFIG_FIT_SIGNATURE=y CONFIG_FIT_VERBOSE=y CONFIG_SPL_LOAD_FIT=y +# CONFIG_USE_SPL_FIT_GENERATOR is not set CONFIG_LEGACY_IMAGE_FORMAT=y CONFIG_SYS_EXTRA_OPTIONS="IMX_CONFIG=arch/arm/mach-imx/spl_sd.cfg" CONFIG_BOOTDELAY=3 diff --git a/configs/j721e_evm_a72_defconfig b/configs/j721e_evm_a72_defconfig index 09a73e590d..90e1e43563 100644 --- a/configs/j721e_evm_a72_defconfig +++ b/configs/j721e_evm_a72_defconfig @@ -27,6 +27,7 @@ CONFIG_DEFAULT_DEVICE_TREE="k3-j721e-common-proc-board" CONFIG_DISTRO_DEFAULTS=y # CONFIG_SYS_MALLOC_CLEAR_ON_INIT is not set CONFIG_SPL_LOAD_FIT=y +# CONFIG_USE_SPL_FIT_GENERATOR is not set CONFIG_BOOTCOMMAND="run findfdt; run envboot; run init_${boot}; run boot_rprocs; run get_kern_${boot}; run get_fdt_${boot}; run get_overlay_${boot}; run run_kern" CONFIG_SPL_BOARD_INIT=y CONFIG_SPL_SYS_MALLOC_SIMPLE=y diff --git a/configs/j721e_evm_r5_defconfig b/configs/j721e_evm_r5_defconfig index a06fc7c3d2..6ab6040660 100644 --- a/configs/j721e_evm_r5_defconfig +++ b/configs/j721e_evm_r5_defconfig @@ -23,6 +23,7 @@ CONFIG_SPL_SPI_SUPPORT=y CONFIG_DEFAULT_DEVICE_TREE="k3-j721e-r5-common-proc-board" # CONFIG_SYS_MALLOC_CLEAR_ON_INIT is not set CONFIG_SPL_LOAD_FIT=y +# CONFIG_USE_SPL_FIT_GENERATOR is not set CONFIG_USE_BOOTCOMMAND=y # CONFIG_DISPLAY_CPUINFO is not set CONFIG_SPL_BOARD_INIT=y diff --git a/configs/j721e_hs_evm_a72_defconfig b/configs/j721e_hs_evm_a72_defconfig index 9b5bc6cf54..5b4ada66c4 100644 --- a/configs/j721e_hs_evm_a72_defconfig +++ b/configs/j721e_hs_evm_a72_defconfig @@ -28,6 +28,7 @@ CONFIG_DISTRO_DEFAULTS=y CONFIG_FIT_IMAGE_POST_PROCESS=y CONFIG_SPL_LOAD_FIT=y CONFIG_SPL_FIT_IMAGE_POST_PROCESS=y +# CONFIG_USE_SPL_FIT_GENERATOR is not set CONFIG_BOOTCOMMAND="run findfdt; run envboot; run init_${boot}; run boot_rprocs; run get_fit_${boot}; run get_overlaystring; run run_fit" CONFIG_SPL_BOARD_INIT=y CONFIG_SPL_SYS_MALLOC_SIMPLE=y diff --git a/configs/j721e_hs_evm_r5_defconfig b/configs/j721e_hs_evm_r5_defconfig index 1aa899e63c..9ef2dbcae4 100644 --- a/configs/j721e_hs_evm_r5_defconfig +++ b/configs/j721e_hs_evm_r5_defconfig @@ -26,6 +26,7 @@ CONFIG_DEFAULT_DEVICE_TREE="k3-j721e-r5-common-proc-board" # CONFIG_SYS_MALLOC_CLEAR_ON_INIT is not set CONFIG_SPL_LOAD_FIT=y CONFIG_SPL_FIT_IMAGE_POST_PROCESS=y +# CONFIG_USE_SPL_FIT_GENERATOR is not set CONFIG_USE_BOOTCOMMAND=y # CONFIG_DISPLAY_CPUINFO is not set CONFIG_SPL_STACK_R=y diff --git a/configs/ls1046ardb_qspi_spl_defconfig b/configs/ls1046ardb_qspi_spl_defconfig index 3f27ccf7e0..0385bbef9f 100644 --- a/configs/ls1046ardb_qspi_spl_defconfig +++ b/configs/ls1046ardb_qspi_spl_defconfig @@ -19,6 +19,7 @@ CONFIG_AHCI=y CONFIG_DISTRO_DEFAULTS=y CONFIG_FIT_VERBOSE=y CONFIG_SPL_LOAD_FIT=y +# CONFIG_USE_SPL_FIT_GENERATOR is not set CONFIG_OF_BOARD_SETUP=y CONFIG_QSPI_BOOT=y CONFIG_BOOTDELAY=10 diff --git a/configs/mccmon6_nor_defconfig b/configs/mccmon6_nor_defconfig index 3139567b80..13dc37a2b0 100644 --- a/configs/mccmon6_nor_defconfig +++ b/configs/mccmon6_nor_defconfig @@ -16,6 +16,7 @@ CONFIG_SPL=y CONFIG_DISTRO_DEFAULTS=y CONFIG_FIT=y CONFIG_SPL_LOAD_FIT=y +# CONFIG_USE_SPL_FIT_GENERATOR is not set CONFIG_SYS_EXTRA_OPTIONS="IMX_CONFIG=board/liebherr/mccmon6/mon6_imximage_nor.cfg" # CONFIG_USE_BOOTCOMMAND is not set CONFIG_BOARD_LATE_INIT=y diff --git a/configs/mccmon6_sd_defconfig b/configs/mccmon6_sd_defconfig index 24a7dd87a0..b26f847e19 100644 --- a/configs/mccmon6_sd_defconfig +++ b/configs/mccmon6_sd_defconfig @@ -17,6 +17,7 @@ CONFIG_SPL=y CONFIG_DISTRO_DEFAULTS=y CONFIG_FIT=y CONFIG_SPL_LOAD_FIT=y +# CONFIG_USE_SPL_FIT_GENERATOR is not set CONFIG_SYS_EXTRA_OPTIONS="IMX_CONFIG=board/liebherr/mccmon6/mon6_imximage_sd.cfg" # CONFIG_USE_BOOTCOMMAND is not set CONFIG_BOARD_LATE_INIT=y diff --git a/configs/mx6sabreauto_defconfig b/configs/mx6sabreauto_defconfig index 56fe307e63..f7facbc5ef 100644 --- a/configs/mx6sabreauto_defconfig +++ b/configs/mx6sabreauto_defconfig @@ -19,6 +19,7 @@ CONFIG_NXP_BOARD_REVISION=y CONFIG_FIT=y CONFIG_SPL_FIT_PRINT=y CONFIG_SPL_LOAD_FIT=y +# CONFIG_USE_SPL_FIT_GENERATOR is not set CONFIG_SYS_EXTRA_OPTIONS="IMX_CONFIG=arch/arm/mach-imx/spl_sd.cfg" # CONFIG_CONSOLE_MUX is not set CONFIG_SYS_CONSOLE_IS_IN_ENV=y diff --git a/configs/mx6sabresd_defconfig b/configs/mx6sabresd_defconfig index 24bc8630f1..cbae47467d 100644 --- a/configs/mx6sabresd_defconfig +++ b/configs/mx6sabresd_defconfig @@ -18,6 +18,7 @@ CONFIG_SPL_LIBDISK_SUPPORT=y CONFIG_FIT=y CONFIG_SPL_FIT_PRINT=y CONFIG_SPL_LOAD_FIT=y +# CONFIG_USE_SPL_FIT_GENERATOR is not set CONFIG_SYS_EXTRA_OPTIONS="IMX_CONFIG=arch/arm/mach-imx/spl_sd.cfg" # CONFIG_CONSOLE_MUX is not set CONFIG_SYS_CONSOLE_IS_IN_ENV=y diff --git a/configs/pico-imx6_defconfig b/configs/pico-imx6_defconfig index 52f9d8fb16..8bcedd21ad 100644 --- a/configs/pico-imx6_defconfig +++ b/configs/pico-imx6_defconfig @@ -18,6 +18,7 @@ CONFIG_DISTRO_DEFAULTS=y CONFIG_FIT=y CONFIG_SPL_FIT_PRINT=y CONFIG_SPL_LOAD_FIT=y +# CONFIG_USE_SPL_FIT_GENERATOR is not set CONFIG_SYS_EXTRA_OPTIONS="IMX_CONFIG=arch/arm/mach-imx/spl_sd.cfg" CONFIG_BOOTCOMMAND="run default_boot" CONFIG_SYS_CONSOLE_OVERWRITE_ROUTINE=y diff --git a/configs/qemu-x86_64_defconfig b/configs/qemu-x86_64_defconfig index 4d156bc7fc..c7a7abcbb5 100644 --- a/configs/qemu-x86_64_defconfig +++ b/configs/qemu-x86_64_defconfig @@ -20,6 +20,7 @@ CONFIG_DEFAULT_DEVICE_TREE="qemu-x86_i440fx" CONFIG_DISTRO_DEFAULTS=y CONFIG_FIT=y CONFIG_SPL_LOAD_FIT=y +# CONFIG_USE_SPL_FIT_GENERATOR is not set CONFIG_BOOTSTAGE=y CONFIG_BOOTSTAGE_REPORT=y CONFIG_SHOW_BOOT_PROGRESS=y diff --git a/configs/sandbox_spl_defconfig b/configs/sandbox_spl_defconfig index b3274a93b4..cd115bf6b2 100644 --- a/configs/sandbox_spl_defconfig +++ b/configs/sandbox_spl_defconfig @@ -13,6 +13,7 @@ CONFIG_FIT=y CONFIG_FIT_SIGNATURE=y CONFIG_FIT_VERBOSE=y CONFIG_SPL_LOAD_FIT=y +# CONFIG_USE_SPL_FIT_GENERATOR is not set CONFIG_BOOTSTAGE=y CONFIG_BOOTSTAGE_REPORT=y CONFIG_BOOTSTAGE_FDT=y diff --git a/configs/socfpga_arria10_defconfig b/configs/socfpga_arria10_defconfig index 625b597bbd..8fdd21c0d3 100644 --- a/configs/socfpga_arria10_defconfig +++ b/configs/socfpga_arria10_defconfig @@ -12,6 +12,7 @@ CONFIG_DEFAULT_DEVICE_TREE="socfpga_arria10_socdk_sdmmc" CONFIG_DISTRO_DEFAULTS=y CONFIG_FIT=y CONFIG_SPL_FIT=y +# CONFIG_USE_SPL_FIT_GENERATOR is not set CONFIG_USE_BOOTARGS=y CONFIG_BOOTARGS="console=ttyS0,115200" # CONFIG_USE_BOOTCOMMAND is not set diff --git a/configs/stm32mp15_dhcom_basic_defconfig b/configs/stm32mp15_dhcom_basic_defconfig index cd9ba108b3..dc85625a8b 100644 --- a/configs/stm32mp15_dhcom_basic_defconfig +++ b/configs/stm32mp15_dhcom_basic_defconfig @@ -16,6 +16,7 @@ CONFIG_DISTRO_DEFAULTS=y CONFIG_FIT=y CONFIG_SPL_LOAD_FIT=y CONFIG_SPL_FIT_SOURCE="board/dhelectronics/dh_stm32mp1/u-boot-dhcom.its" +# CONFIG_USE_SPL_FIT_GENERATOR is not set CONFIG_BOOTCOMMAND="run bootcmd_stm32mp" CONFIG_BOARD_EARLY_INIT_F=y CONFIG_SPL_LEGACY_IMAGE_SUPPORT=y diff --git a/configs/stm32mp15_dhcor_basic_defconfig b/configs/stm32mp15_dhcor_basic_defconfig index 94361f3b10..1e1aa86426 100644 --- a/configs/stm32mp15_dhcor_basic_defconfig +++ b/configs/stm32mp15_dhcor_basic_defconfig @@ -16,6 +16,7 @@ CONFIG_DISTRO_DEFAULTS=y CONFIG_FIT=y CONFIG_SPL_LOAD_FIT=y CONFIG_SPL_FIT_SOURCE="board/dhelectronics/dh_stm32mp1/u-boot-dhcor.its" +# CONFIG_USE_SPL_FIT_GENERATOR is not set CONFIG_BOOTCOMMAND="run bootcmd_stm32mp" CONFIG_BOARD_EARLY_INIT_F=y CONFIG_SPL_LEGACY_IMAGE_SUPPORT=y diff --git a/configs/wandboard_defconfig b/configs/wandboard_defconfig index 8dfd218426..3209aad65e 100644 --- a/configs/wandboard_defconfig +++ b/configs/wandboard_defconfig @@ -23,6 +23,7 @@ CONFIG_DISTRO_DEFAULTS=y CONFIG_FIT=y CONFIG_SPL_FIT_PRINT=y CONFIG_SPL_LOAD_FIT=y +# CONFIG_USE_SPL_FIT_GENERATOR is not set CONFIG_SYS_EXTRA_OPTIONS="IMX_CONFIG=arch/arm/mach-imx/spl_sd.cfg" CONFIG_BOOTCOMMAND="run findfdt; run finduuid; run distro_bootcmd" # CONFIG_CONSOLE_MUX is not set diff --git a/configs/xilinx_zynq_virt_defconfig b/configs/xilinx_zynq_virt_defconfig index 76cc94ef23..5b08503395 100644 --- a/configs/xilinx_zynq_virt_defconfig +++ b/configs/xilinx_zynq_virt_defconfig @@ -15,6 +15,7 @@ CONFIG_FIT_SIGNATURE=y CONFIG_FIT_VERBOSE=y CONFIG_SPL_FIT_PRINT=y CONFIG_SPL_LOAD_FIT=y +# CONFIG_USE_SPL_FIT_GENERATOR is not set CONFIG_LEGACY_IMAGE_FORMAT=y CONFIG_USE_PREBOOT=y CONFIG_SPL_STACK_R=y

This option is used to run arch-specific shell scripts which produce .its files which are used to produce FIT images. We already have binman which is designed to produce firmware images. It is more powerful and has tests.
So this option should be deprecated and not used. Existing uses should be migrated.
Mentions of this in code reviews over the last year or so do not seem to have resulted in action, and things are getting worse.
So let's add a warning.
Signed-off-by: Simon Glass sjg@chromium.org Reviewed-by: Bin Meng bmeng.cn@gmail.com ---
(no changes since v1)
Makefile | 9 +++++++++ 1 file changed, 9 insertions(+)
diff --git a/Makefile b/Makefile index c34620f0c4..60a6f27abd 100644 --- a/Makefile +++ b/Makefile @@ -1146,6 +1146,13 @@ ifneq ($(CONFIG_DM_ETH),y) @echo >&2 "See doc/driver-model/migration.rst for more info." @echo >&2 "====================================================" endif +endif +ifneq ($(CONFIG_SPL_FIT_GENERATOR),) + @echo >&2 "===================== WARNING ======================" + @echo >&2 "This board uses CONFIG_SPL_FIT_GENERATOR. Please migrate" + @echo >&2 "to binman instead, to avoid the proliferation of" + @echo >&2 "arch-specific scripts with no tests." + @echo >&2 "====================================================" endif @# Check that this build does not use CONFIG options that we do not @# know about unless they are in Kconfig. All the existing CONFIG @@ -1343,6 +1350,8 @@ endif
# Boards with more complex image requirements can provide an .its source file # or a generator script +# NOTE: Please do not use this. We are migrating away from Makefile rules to use +# binman instead. ifneq ($(CONFIG_SPL_FIT_SOURCE),"") U_BOOT_ITS := u-boot.its $(U_BOOT_ITS): $(subst ",,$(CONFIG_SPL_FIT_SOURCE))

At present this board uses a custom script to produce the .its file. Update it to use binman instead. Binman can create all the images that are needed.
Signed-off-by: Simon Glass sjg@chromium.org ---
Changes in v3: - Drop use of rk322x.dtsi - Add changes to rk3288-u-boot.dtsi instead
Kconfig | 2 +- arch/arm/dts/rk3288-u-boot.dtsi | 54 +++++++++++++++++++++++++++++++++ configs/evb-rk3288_defconfig | 2 +- 3 files changed, 56 insertions(+), 2 deletions(-)
diff --git a/Kconfig b/Kconfig index 893ea35ea8..0dfe2676de 100644 --- a/Kconfig +++ b/Kconfig @@ -321,7 +321,7 @@ config BUILD_TARGET default "u-boot-with-spl.sfp" if TARGET_SOCFPGA_GEN5 default "u-boot-spl.kwb" if ARCH_MVEBU && SPL default "u-boot-elf.srec" if RCAR_GEN3 - default "u-boot.itb" if SPL_LOAD_FIT && (ARCH_ROCKCHIP || \ + default "u-boot.itb" if !BINMAN && SPL_LOAD_FIT && (ARCH_ROCKCHIP || \ ARCH_SUNXI || RISCV || ARCH_ZYNQMP) default "u-boot.kwb" if ARCH_KIRKWOOD default "u-boot-with-spl.bin" if ARCH_AT91 && SPL_NAND_SUPPORT diff --git a/arch/arm/dts/rk3288-u-boot.dtsi b/arch/arm/dts/rk3288-u-boot.dtsi index e4e762aabf..3b693a1257 100644 --- a/arch/arm/dts/rk3288-u-boot.dtsi +++ b/arch/arm/dts/rk3288-u-boot.dtsi @@ -33,6 +33,60 @@ fdtmap { }; }; + + itb { + filename = "u-boot.itb"; + fit { + fit,external-offset = <CONFIG_FIT_EXTERNAL_OFFSET>; + description = "FIT image with OP-TEE support"; + #address-cells = <1>; + + images { + uboot { + description = "U-Boot"; + type = "standalone"; + os = "U-Boot"; + arch = "arm"; + compression = "none"; + load = <CONFIG_SYS_TEXT_BASE>; + + u-boot-nodtb { + }; + }; + optee { + description = "OP-TEE"; + type = "firmware"; + arch = "arm"; + os = "tee"; + compression = "none"; + load = <(CONFIG_SYS_SDRAM_BASE + 0x8400000)>; + entry = <(CONFIG_SYS_SDRAM_BASE + 0x8400000)>; + + blob-ext { + filename = "tee.bin"; + }; + }; + fdt { + description = CONFIG_SYS_BOARD; + type = "flat_dt"; + compression = "none"; + + u-boot-dtb { + }; + }; + }; + + configurations { + default = "conf"; + conf { + description = CONFIG_SYS_BOARD; + firmware = "optee"; + loadables = "uboot"; + fdt = "fdt"; + }; + }; + }; + }; }; #endif
diff --git a/configs/evb-rk3288_defconfig b/configs/evb-rk3288_defconfig index 350189fc63..cd03767bd5 100644 --- a/configs/evb-rk3288_defconfig +++ b/configs/evb-rk3288_defconfig @@ -14,7 +14,7 @@ CONFIG_DEBUG_UART=y CONFIG_FIT=y CONFIG_FIT_VERBOSE=y CONFIG_SPL_LOAD_FIT=y -CONFIG_SPL_FIT_GENERATOR="arch/arm/mach-rockchip/fit_spl_optee.sh" +# CONFIG_USE_SPL_FIT_GENERATOR is not set CONFIG_USE_PREBOOT=y CONFIG_SILENT_CONSOLE=y CONFIG_DEFAULT_FDT_FILE="rk3288-evb-rk808.dtb"

At present this board uses a custom script to produce the .its file. Update it to use binman instead. Binman can create all the images that are needed.
Signed-off-by: Simon Glass sjg@chromium.org ---
Changes in v3: - Drop leftover debugging
configs/evb-rk3229_defconfig | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/configs/evb-rk3229_defconfig b/configs/evb-rk3229_defconfig index 1d0fe3332b..406437d1d9 100644 --- a/configs/evb-rk3229_defconfig +++ b/configs/evb-rk3229_defconfig @@ -15,7 +15,7 @@ CONFIG_DEBUG_UART=y CONFIG_FIT=y CONFIG_FIT_VERBOSE=y CONFIG_SPL_LOAD_FIT=y -CONFIG_SPL_FIT_GENERATOR="arch/arm/mach-rockchip/fit_spl_optee.sh" +# CONFIG_USE_SPL_FIT_GENERATOR is not set CONFIG_USE_PREBOOT=y CONFIG_DEFAULT_FDT_FILE="rk3229-evb.dtb" # CONFIG_DISPLAY_CPUINFO is not set

Now that all board use binman instead of this script, drop it.
Signed-off-by: Simon Glass sjg@chromium.org Reviewed-by: Bin Meng bmeng.cn@gmail.com ---
(no changes since v1)
arch/arm/mach-rockchip/fit_spl_optee.sh | 84 ------------------------- 1 file changed, 84 deletions(-) delete mode 100755 arch/arm/mach-rockchip/fit_spl_optee.sh
diff --git a/arch/arm/mach-rockchip/fit_spl_optee.sh b/arch/arm/mach-rockchip/fit_spl_optee.sh deleted file mode 100755 index 4118472d9f..0000000000 --- a/arch/arm/mach-rockchip/fit_spl_optee.sh +++ /dev/null @@ -1,84 +0,0 @@ -#!/bin/sh -# SPDX-License-Identifier: GPL-2.0+ -# -# Copyright (C) 2019 Rockchip Electronic Co.,Ltd -# -# Script to generate FIT image source for 32-bit Rockchip SoCs with -# U-Boot proper, OPTEE, and devicetree. -# -# usage: $0 <dt_name> - -[ -z "$TEE" ] && TEE="tee.bin" - -if [ ! -f $TEE ]; then - echo "WARNING: TEE file $TEE NOT found, U-Boot.itb is non-functional" >&2 - echo "Please export path for TEE or copy tee.bin to U-Boot folder" >&2 - TEE=/dev/null -fi - -dtname=$1 -text_base=`sed -n "/SYS_TEXT_BASE=/s/CONFIG_SYS_TEXT_BASE=//p" .config \ - |tr -d '\r'` -dram_base=`sed -n "/SYS_SDRAM_BASE=/s/CONFIG_SYS_SDRAM_BASE=//p" \ - include/autoconf.mk|tr -d '\r'` -tee_base=`echo "obase=16;$(($dram_base+0x8400000))"|bc` -tee_base='0x'$tee_base - -cat << __HEADER_EOF -/* - * Copyright (C) 2017-2019 Rockchip Electronic Co.,Ltd - * - * Simple U-boot FIT source file containing U-Boot, dtb and optee - */ - -/dts-v1/; - -/ { - description = "FIT image with OP-TEE support"; - #address-cells = <1>; - - images { - uboot { - description = "U-Boot"; - data = /incbin/("u-boot-nodtb.bin"); - type = "standalone"; - os = "U-Boot"; - arch = "arm"; - compression = "none"; - load = <$text_base>; - }; - optee { - description = "OP-TEE"; - data = /incbin/("$TEE"); - type = "firmware"; - arch = "arm"; - os = "tee"; - compression = "none"; - load = <$tee_base>; - entry = <$tee_base>; - }; - fdt { - description = "$(basename $dtname .dtb)"; - data = /incbin/("$dtname"); - type = "flat_dt"; - compression = "none"; - }; -__HEADER_EOF - -cat << __CONF_HEADER_EOF - }; - - configurations { - default = "conf"; - conf { - description = "$(basename $dtname .dtb)"; - firmware = "optee"; - loadables = "uboot"; - fdt = "fdt"; - }; -__CONF_HEADER_EOF - -cat << __ITS_EOF - }; -}; -__ITS_EOF

This causes conflicts on chromebook_link64. Move it to after U-Boot where there should be plenty of space.
Signed-off-by: Simon Glass sjg@chromium.org Reviewed-by: Bin Meng bmeng.cn@gmail.com ---
(no changes since v1)
arch/x86/dts/u-boot.dtsi | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/arch/x86/dts/u-boot.dtsi b/arch/x86/dts/u-boot.dtsi index f0f8c71761..1e0a985b43 100644 --- a/arch/x86/dts/u-boot.dtsi +++ b/arch/x86/dts/u-boot.dtsi @@ -92,6 +92,8 @@ u-boot-dtb { }; #endif + fdtmap { + }; #ifdef CONFIG_HAVE_X86_FIT intel-fit { }; @@ -139,8 +141,6 @@ filename = CONFIG_FSP_FILE_S; }; #endif - fdtmap { - }; #ifdef CONFIG_HAVE_CMC intel-cmc { filename = CONFIG_CMC_FILE;

At present the image layout is not correct, since it uses the SDRAM address of the 64-bit U-Boot as the ROM address. Fix this.
Signed-off-by: Simon Glass sjg@chromium.org Reviewed-by: Bin Meng bmeng.cn@gmail.com ---
(no changes since v1)
configs/chromebook_link64_defconfig | 2 ++ 1 file changed, 2 insertions(+)
diff --git a/configs/chromebook_link64_defconfig b/configs/chromebook_link64_defconfig index 7828e2dc34..772a75a8e7 100644 --- a/configs/chromebook_link64_defconfig +++ b/configs/chromebook_link64_defconfig @@ -17,8 +17,10 @@ CONFIG_HAVE_MRC=y CONFIG_SMP=y CONFIG_HAVE_VGA_BIOS=y CONFIG_DEFAULT_DEVICE_TREE="chromebook_link" +CONFIG_X86_OFFSET_U_BOOT=0xffa00000 CONFIG_FIT=y CONFIG_SPL_LOAD_FIT=y +# CONFIG_USE_SPL_FIT_GENERATOR is not set CONFIG_BOOTSTAGE=y CONFIG_BOOTSTAGE_REPORT=y CONFIG_SHOW_BOOT_PROGRESS=y

This board does not have microcode but at present that is not supported by Kconfig nor the binman image layout. Fix both of these.
Signed-off-by: Simon Glass sjg@chromium.org Reviewed-by: Bin Meng bmeng.cn@gmail.com ---
(no changes since v1)
arch/x86/Kconfig | 7 ++++++- arch/x86/dts/u-boot.dtsi | 6 +++++- configs/chromebox_panther_defconfig | 2 ++ 3 files changed, 13 insertions(+), 2 deletions(-)
diff --git a/arch/x86/Kconfig b/arch/x86/Kconfig index c688c46475..6bea6b9b92 100644 --- a/arch/x86/Kconfig +++ b/arch/x86/Kconfig @@ -594,8 +594,13 @@ config HAVE_REFCODE Various peripherals may fail to work.
config HAVE_MICROCODE - bool + bool "Board requires a microcode binary" default y if !FSP_VERSION2 + help + Enable this if the board requires microcode to be loaded on boot. + Typically this is handed by the FSP for modern boards, but for + some older boards, it must be programmed by U-Boot, and that form + part of the image.
config SMP bool "Enable Symmetric Multiprocessing" diff --git a/arch/x86/dts/u-boot.dtsi b/arch/x86/dts/u-boot.dtsi index 1e0a985b43..fa8106c8b8 100644 --- a/arch/x86/dts/u-boot.dtsi +++ b/arch/x86/dts/u-boot.dtsi @@ -75,11 +75,15 @@ u-boot { offset = <CONFIG_SYS_TEXT_BASE>; }; -# else +# elif defined(CONFIG_HAVE_MICROCODE) /* If there is no SPL then we need to put microcode in U-Boot */ u-boot-with-ucode-ptr { offset = <CONFIG_X86_OFFSET_U_BOOT>; }; +# else + u-boot-nodtb { + offset = <CONFIG_X86_OFFSET_U_BOOT>; + }; # endif #endif #ifdef CONFIG_HAVE_MICROCODE diff --git a/configs/chromebox_panther_defconfig b/configs/chromebox_panther_defconfig index fd87ab262b..35ec3e912b 100644 --- a/configs/chromebox_panther_defconfig +++ b/configs/chromebox_panther_defconfig @@ -7,7 +7,9 @@ CONFIG_NR_DRAM_BANKS=8 CONFIG_VENDOR_GOOGLE=y CONFIG_TARGET_CHROMEBOX_PANTHER=y CONFIG_HAVE_MRC=y +# CONFIG_HAVE_MICROCODE is not set CONFIG_HAVE_VGA_BIOS=y +CONFIG_X86_OFFSET_U_BOOT=0xffa00000 CONFIG_FIT=y CONFIG_BOOTSTAGE=y CONFIG_BOOTSTAGE_REPORT=y

At present there is not enough space for U-Boot due to the EFI loader. Correct this.
Signed-off-by: Simon Glass sjg@chromium.org Reviewed-by: Bin Meng bmeng.cn@gmail.com ---
(no changes since v2)
Changes in v2: - Add patches to partially migrate rockchip to use binman
configs/chromebook_samus_tpl_defconfig | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/configs/chromebook_samus_tpl_defconfig b/configs/chromebook_samus_tpl_defconfig index e54a4ff6a6..43622f4182 100644 --- a/configs/chromebook_samus_tpl_defconfig +++ b/configs/chromebook_samus_tpl_defconfig @@ -17,8 +17,8 @@ CONFIG_HAVE_MRC=y CONFIG_HAVE_REFCODE=y CONFIG_SMP=y CONFIG_HAVE_VGA_BIOS=y -CONFIG_X86_OFFSET_U_BOOT=0xfff00000 CONFIG_DEFAULT_DEVICE_TREE="chromebook_samus" +CONFIG_X86_OFFSET_U_BOOT=0xffee0000 CONFIG_BOOTSTAGE=y CONFIG_BOOTSTAGE_REPORT=y CONFIG_SHOW_BOOT_PROGRESS=y
participants (2)
-
Jagan Teki
-
Simon Glass