Add a qualcomm specific Makefile fragment to make u-boot.mbn a build target and introduce a kconfig option to build it by default on relevant platforms via CONFIG_BUILD_TARGET.
Signed-off-by: Casey Connolly <[email protected]> --- Kconfig | 1 + arch/arm/mach-snapdragon/Kconfig | 11 +++++++++++ board/qualcomm/config.mk | 14 ++++++++++++++ 3 files changed, 26 insertions(+) diff --git a/Kconfig b/Kconfig index 8428d039a1c0..183c8096030d 100644 --- a/Kconfig +++ b/Kconfig @@ -557,8 +557,9 @@ config BUILD_TARGET default "u-boot-with-spl.sfp" if ARCH_SOCFPGA_GEN5 default "u-boot.itb" if !BINMAN && SPL_LOAD_FIT && (ARCH_ROCKCHIP || \ RISCV || ARCH_ZYNQMP) default "u-boot.kwb" if (ARCH_KIRKWOOD || ARMADA_32BIT) && !SPL + default "u-boot.mbn" if ARCH_SNAPDRAGON && QCOM_GENERATE_MBN help Some SoCs need special image types (e.g. U-Boot binary with a special header) as build targets. By defining CONFIG_BUILD_TARGET in the SoC / board header, this diff --git a/arch/arm/mach-snapdragon/Kconfig b/arch/arm/mach-snapdragon/Kconfig index d3de8693b5a8..6329cbb9215e 100644 --- a/arch/arm/mach-snapdragon/Kconfig +++ b/arch/arm/mach-snapdragon/Kconfig @@ -41,5 +41,16 @@ config SYS_CONFIG_NAME This option contains information about board configuration name. Based on this option include/configs/<CONFIG_SYS_CONFIG_NAME>.h header will be used for board configuration. +config QCOM_GENERATE_MBN + bool "Generate an MBN-compatible ELF binary" + default n + help + Enable this if you intend to flash U-Boot as a first-stage bootloader. + The build system will generate a board-specific ELF file with the appropriate + MBN hash segments and test keys. + + New platforms can be added to tools/qcom/mkmbn/mkmbn.py if they aren't already + supported. + endif diff --git a/board/qualcomm/config.mk b/board/qualcomm/config.mk new file mode 100644 index 000000000000..769e4a51ca01 --- /dev/null +++ b/board/qualcomm/config.mk @@ -0,0 +1,14 @@ +# SPDX-License-Identifier: GPL-2.0+ +# +# (C) Copyright Linaro Ltd. +# +# Qualcomm specific make target for MBN signed ELF files. +# + +# Create Qualcomm signed elf images +CMD_MKMBN = $(srctree)/tools/qcom/mkmbn/mkmbn.py +quiet_cmd_mkmbn = MBN $@ + cmd_mkmbn = $(CMD_MKMBN) $< + +u-boot.mbn: u-boot.bin FORCE + $(call if_changed,mkmbn) -- 2.53.0

