From patchwork Fri Jul 10 00:39:23 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Simon Glass X-Patchwork-Id: 241165 List-Id: U-Boot discussion From: sjg at chromium.org (Simon Glass) Date: Thu, 9 Jul 2020 18:39:23 -0600 Subject: [PATCH v3 00/49] rockchip: x86: Support building ROM files automatically with binman Message-ID: <20200710004012.3016230-1-sjg@chromium.org> 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