The complete Genio 510 and Genio 700 boot-chain images depend on platform firmware built outside U-Boot. Keep image assembly opt-in through CONFIG_MTK_BOOT_IMAGES so the default configurations build U-Boot proper and SPL without requiring external blobs, while integration builds can enable the canonical binman image layout.
mtk-boot.bin wraps an external DDR loader, padded to its fixed 0x4b000-byte ABI, followed by a CONFIG_SPL_MAX_SIZE U-Boot SPL region in a MediaTek eMMC BootROM image. The external loader copies that complete fixed-size SPL window, so pad the region to keep every source byte inside the BootROM-loaded payload. bootloaders.img is a conventional FIT containing BL31, U-Boot proper, OP-TEE, and the U-Boot control devicetree. Both boards share this layout, with their descriptions supplied by the board-specific U-Boot devicetree includes. Use the standard BL31 and TEE binman inputs and obtain ddr-loader.bin through BINMAN_INDIRS. Disable SPL binman symbols by default on MT8188 because SPL does not consume runtime offsets for entries in mtk-boot.bin and U-Boot proper lives in a separate storage image. SPL locates U-Boot through the GPT FIT partition, so there are no in-image U-Boot offsets to publish. Signed-off-by: Vitor Sato Eschholz <[email protected]> Signed-off-by: Julien Stephan <[email protected]> Signed-off-by: Carlo Caione <[email protected]> --- arch/arm/dts/mt8370-genio-510-evk-u-boot.dtsi | 7 ++ arch/arm/dts/mt8390-genio-700-evk-u-boot.dtsi | 7 ++ arch/arm/dts/mt8390-genio-common-binman.dtsi | 127 ++++++++++++++++++++++++++ arch/arm/mach-mediatek/Kconfig | 8 ++ board/mediatek/MAINTAINERS | 1 + common/spl/Kconfig | 1 + 6 files changed, 151 insertions(+) diff --git a/arch/arm/dts/mt8370-genio-510-evk-u-boot.dtsi b/arch/arm/dts/mt8370-genio-510-evk-u-boot.dtsi index 1a5f45cba6b..fa03e6ac05e 100644 --- a/arch/arm/dts/mt8370-genio-510-evk-u-boot.dtsi +++ b/arch/arm/dts/mt8370-genio-510-evk-u-boot.dtsi @@ -4,4 +4,11 @@ * Author: Julien Stephan <[email protected]> */ +#include <config.h> #include "mt8390-genio-common-u-boot.dtsi" + +#ifdef CONFIG_MTK_BOOT_IMAGES +#define MTK_BOOTLOADERS_DESCRIPTION "MediaTek Genio 510 bootloaders" +#define MTK_BOOT_CHAIN_DESCRIPTION "Genio 510 boot chain" +#include "mt8390-genio-common-binman.dtsi" +#endif diff --git a/arch/arm/dts/mt8390-genio-700-evk-u-boot.dtsi b/arch/arm/dts/mt8390-genio-700-evk-u-boot.dtsi index 1a5f45cba6b..f8e7e78a25f 100644 --- a/arch/arm/dts/mt8390-genio-700-evk-u-boot.dtsi +++ b/arch/arm/dts/mt8390-genio-700-evk-u-boot.dtsi @@ -4,4 +4,11 @@ * Author: Julien Stephan <[email protected]> */ +#include <config.h> #include "mt8390-genio-common-u-boot.dtsi" + +#ifdef CONFIG_MTK_BOOT_IMAGES +#define MTK_BOOTLOADERS_DESCRIPTION "MediaTek Genio 700 bootloaders" +#define MTK_BOOT_CHAIN_DESCRIPTION "Genio 700 boot chain" +#include "mt8390-genio-common-binman.dtsi" +#endif diff --git a/arch/arm/dts/mt8390-genio-common-binman.dtsi b/arch/arm/dts/mt8390-genio-common-binman.dtsi new file mode 100644 index 00000000000..c16282027c6 --- /dev/null +++ b/arch/arm/dts/mt8390-genio-common-binman.dtsi @@ -0,0 +1,127 @@ +// SPDX-License-Identifier: (GPL-2.0 OR MIT) +/* + * Copyright (c) 2026 BayLibre, SAS. + * Author: Julien Stephan <[email protected]> + * Author: Carlo Caione <[email protected]> + */ + +/ { + binman: binman { + multiple-images; + }; +}; + +&binman { + mtk-boot { + filename = "mtk-boot.bin"; + + mkimage { + args = "-T", "mtk_image", + "-a", "0x201000", + "-e", "0x201000", + "-n", "media=emmc;arm64=1"; + + section { + pad-byte = <0>; + + /* Must match SPL_OFFSET in the external DDR loader. */ + ddr-loader { + type = "blob-ext"; + filename = "ddr-loader.bin"; + size = <0x4b000>; + }; + + u-boot-spl { + size = <CONFIG_SPL_MAX_SIZE>; + }; + }; + }; + }; + + bootloaders { + filename = "bootloaders.img"; + + fit { + description = MTK_BOOTLOADERS_DESCRIPTION; + #address-cells = <1>; + + images { + uboot { + description = "U-Boot"; + type = "firmware"; + os = "u-boot"; + arch = "arm64"; + compression = "none"; + load = <CONFIG_TEXT_BASE>; + entry = <CONFIG_TEXT_BASE>; + + u-boot-nodtb { + }; + + hash { + algo = "sha256"; + }; + }; + + atf { + description = "ARM Trusted Firmware BL31"; + type = "firmware"; + os = "arm-trusted-firmware"; + arch = "arm64"; + compression = "none"; + load = <0x54601000>; + entry = <0x54601000>; + + atf-bl31 { + }; + + hash { + algo = "sha256"; + }; + }; + + optee { + description = "OP-TEE"; + type = "firmware"; + os = "tee"; + arch = "arm64"; + compression = "none"; + load = <0x431fffe4>; + entry = <0x43200000>; + + tee-os { + }; + + hash { + algo = "sha256"; + }; + }; + + uboot-fdt { + description = "U-Boot control devicetree"; + type = "flat_dt"; + arch = "arm64"; + compression = "none"; + + u-boot-dtb { + }; + + hash { + algo = "sha256"; + }; + }; + }; + + configurations { + default = "conf"; + + conf { + description = MTK_BOOT_CHAIN_DESCRIPTION; + firmware = "atf"; + loadables = "uboot", "optee"; + fdt = "uboot-fdt"; + }; + }; + }; + }; +}; diff --git a/arch/arm/mach-mediatek/Kconfig b/arch/arm/mach-mediatek/Kconfig index 5e6c50ca64d..05ba7c209bc 100644 --- a/arch/arm/mach-mediatek/Kconfig +++ b/arch/arm/mach-mediatek/Kconfig @@ -210,6 +210,14 @@ config MTK_BROM_HEADER_INFO default "media=emmc" if TARGET_MT8516 || TARGET_MT8365 || TARGET_MT8183 || TARGET_MT8188 || TARGET_MT8189 || TARGET_MT8195 default "lk=1" if TARGET_MT7623 +config MTK_BOOT_IMAGES + bool "Build MediaTek firmware images" + depends on TARGET_MT8188 && SPL + select BINMAN + help + Enable binman to assemble the MediaTek BootROM image and firmware + FIT from U-Boot and external platform firmware components. + config MTK_TZ_MOVABLE select ARCH_MISC_INIT select OF_SYSTEM_SETUP diff --git a/board/mediatek/MAINTAINERS b/board/mediatek/MAINTAINERS index d0d25b096e5..83662079068 100644 --- a/board/mediatek/MAINTAINERS +++ b/board/mediatek/MAINTAINERS @@ -24,6 +24,7 @@ S: Maintained F: arch/arm/dts/mt8188-u-boot.dtsi F: arch/arm/dts/mt8390-genio-common-u-boot.dtsi F: arch/arm/dts/mt8370-genio-510-evk-u-boot.dtsi +F: arch/arm/dts/mt8390-genio-common-binman.dtsi F: arch/arm/dts/mt8390-genio-700-evk-u-boot.dtsi F: configs/mt8188.config F: configs/mt8370_genio_510_evk_defconfig diff --git a/common/spl/Kconfig b/common/spl/Kconfig index 0618f42c941..e5d0aade7fc 100644 --- a/common/spl/Kconfig +++ b/common/spl/Kconfig @@ -194,6 +194,7 @@ config SPL_SHOW_ERRORS config SPL_BINMAN_SYMBOLS bool "Declare binman symbols in SPL" depends on SPL_FRAMEWORK && BINMAN + default n if TARGET_MT8188 default y help This enables use of symbols in SPL which refer to other entries in -- 2.55.0
