[PATCH v5 3/6] arm: mediatek: build Genio 510 and 700 boot images with binman
Carlo Caione <[email protected]>
| Newsgroups | org.u-boot-project.lists.u-boot |
|---|---|
| Message-ID | <20260827-ccaione-upstream-mt8390-spl-v5-3-81d04e3ab785@baylibre.com> |
Genio 510 and Genio 700 use an external DDR loader before U-Boot SPL, then load the remaining firmware from a FIT. Add shared binman descriptions for both images so integration builds can assemble the complete boot chain. Keep packaging optional because the required platform firmware is built outside U-Boot. 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 | 9 ++ arch/arm/dts/mt8390-genio-700-evk-u-boot.dtsi | 9 ++ arch/arm/dts/mtk-genio-binman-u-boot.dtsi | 12 +++ .../dts/mtk-genio-bootloaders-binman-u-boot.dtsi | 97 ++++++++++++++++++++++ .../dts/mtk-genio-loader-spl-binman-u-boot.dtsi | 16 ++++ arch/arm/dts/mtk-genio-mtk-boot-binman-u-boot.dtsi | 26 ++++++ arch/arm/mach-mediatek/Kconfig | 38 ++++++++- board/mediatek/MAINTAINERS | 2 + common/spl/Kconfig | 1 + 9 files changed, 209 insertions(+), 1 deletion(-) 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..726e060f281 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,13 @@ * Author: Julien Stephan <[email protected]> */ +#include <config.h> #include "mt8390-genio-common-u-boot.dtsi" + +#ifdef CONFIG_MTK_GENIO_BOOT_IMAGES +#define MTK_BOOTLOADERS_DESCRIPTION "MediaTek Genio 510 bootloaders" +#define MTK_BOOT_CHAIN_DESCRIPTION "Genio 510 boot chain" +#include "mtk-genio-binman-u-boot.dtsi" +#include "mtk-genio-mtk-boot-binman-u-boot.dtsi" +#include "mtk-genio-bootloaders-binman-u-boot.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..09cab1d2721 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,13 @@ * Author: Julien Stephan <[email protected]> */ +#include <config.h> #include "mt8390-genio-common-u-boot.dtsi" + +#ifdef CONFIG_MTK_GENIO_BOOT_IMAGES +#define MTK_BOOTLOADERS_DESCRIPTION "MediaTek Genio 700 bootloaders" +#define MTK_BOOT_CHAIN_DESCRIPTION "Genio 700 boot chain" +#include "mtk-genio-binman-u-boot.dtsi" +#include "mtk-genio-mtk-boot-binman-u-boot.dtsi" +#include "mtk-genio-bootloaders-binman-u-boot.dtsi" +#endif diff --git a/arch/arm/dts/mtk-genio-binman-u-boot.dtsi b/arch/arm/dts/mtk-genio-binman-u-boot.dtsi new file mode 100644 index 00000000000..7e718ddf8da --- /dev/null +++ b/arch/arm/dts/mtk-genio-binman-u-boot.dtsi @@ -0,0 +1,12 @@ +// 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; + }; +}; diff --git a/arch/arm/dts/mtk-genio-bootloaders-binman-u-boot.dtsi b/arch/arm/dts/mtk-genio-bootloaders-binman-u-boot.dtsi new file mode 100644 index 00000000000..ce492790aee --- /dev/null +++ b/arch/arm/dts/mtk-genio-bootloaders-binman-u-boot.dtsi @@ -0,0 +1,97 @@ +// SPDX-License-Identifier: (GPL-2.0 OR MIT) +/* + * Copyright (c) 2026 BayLibre, SAS. + * Author: Julien Stephan <[email protected]> + * Author: Carlo Caione <[email protected]> + */ + +&binman { + 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 = <CONFIG_MTK_GENIO_BL31_LOAD_ADDR>; + entry = <CONFIG_MTK_GENIO_BL31_LOAD_ADDR>; + + atf-bl31 { + }; + + hash { + algo = "sha256"; + }; + }; + + @optee-SEQ { + fit,operation = "split-elf"; + description = "OP-TEE"; + type = "firmware"; + os = "tee"; + arch = "arm64"; + compression = "none"; + fit,load; + fit,entry; + fit,data; + + 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-1"; + fdt = "uboot-fdt"; + }; + }; + }; + }; +}; diff --git a/arch/arm/dts/mtk-genio-loader-spl-binman-u-boot.dtsi b/arch/arm/dts/mtk-genio-loader-spl-binman-u-boot.dtsi new file mode 100644 index 00000000000..e49ad5c471f --- /dev/null +++ b/arch/arm/dts/mtk-genio-loader-spl-binman-u-boot.dtsi @@ -0,0 +1,16 @@ +// SPDX-License-Identifier: (GPL-2.0 OR MIT) +/* + * Copyright (c) 2026 BayLibre, SAS. + * Author: Julien Stephan <[email protected]> + * Author: Carlo Caione <[email protected]> + */ + +ddr-loader { + type = "blob-ext"; + filename = "ddr-loader.bin"; + size = <CONFIG_MTK_GENIO_DDR_LOADER_SIZE>; +}; + +u-boot-spl { + size = <CONFIG_SPL_MAX_SIZE>; +}; diff --git a/arch/arm/dts/mtk-genio-mtk-boot-binman-u-boot.dtsi b/arch/arm/dts/mtk-genio-mtk-boot-binman-u-boot.dtsi new file mode 100644 index 00000000000..8fdafbd750d --- /dev/null +++ b/arch/arm/dts/mtk-genio-mtk-boot-binman-u-boot.dtsi @@ -0,0 +1,26 @@ +// SPDX-License-Identifier: (GPL-2.0 OR MIT) +/* + * Copyright (c) 2026 BayLibre, SAS. + * Author: Julien Stephan <[email protected]> + * Author: Carlo Caione <[email protected]> + */ + +#include <linux/stringify.h> + +&binman { + mtk-boot { + filename = "mtk-boot.bin"; + + mkimage { + args = "-T", "mtk_image", + "-a", __stringify(CONFIG_MTK_GENIO_BROM_LOAD_ADDR), + "-e", __stringify(CONFIG_MTK_GENIO_BROM_LOAD_ADDR), + "-n", CONFIG_MTK_BROM_HEADER_INFO; + + section { + pad-byte = <0>; +#include "mtk-genio-loader-spl-binman-u-boot.dtsi" + }; + }; + }; +}; diff --git a/arch/arm/mach-mediatek/Kconfig b/arch/arm/mach-mediatek/Kconfig index 5e6c50ca64d..0bece6b1b3e 100644 --- a/arch/arm/mach-mediatek/Kconfig +++ b/arch/arm/mach-mediatek/Kconfig @@ -207,9 +207,45 @@ config SYS_CONFIG_NAME config MTK_BROM_HEADER_INFO string default "media=nor" if TARGET_MT8518 || TARGET_MT8512 || TARGET_MT7629 - default "media=emmc" if TARGET_MT8516 || TARGET_MT8365 || TARGET_MT8183 || TARGET_MT8188 || TARGET_MT8189 || TARGET_MT8195 + default "media=emmc;arm64=1" if TARGET_MT8188 + default "media=emmc" if TARGET_MT8516 || TARGET_MT8365 || TARGET_MT8183 || TARGET_MT8189 || TARGET_MT8195 default "lk=1" if TARGET_MT7623 +config MTK_GENIO_BOOT_IMAGES + bool "Build MediaTek firmware images" + depends on TARGET_MT8188 && SPL + select BINMAN + select MTK_GENIO_IMAGE_CONTRACT + help + Enable binman to assemble the MediaTek BootROM image and firmware + FIT from U-Boot and external platform firmware components. + +config MTK_GENIO_IMAGE_CONTRACT + bool + +if MTK_GENIO_IMAGE_CONTRACT + +config MTK_GENIO_BROM_LOAD_ADDR + hex "BootROM payload load address" + default 0x201000 if TARGET_MT8188 + help + Address at which the MediaTek BootROM loads and enters the external + DDR loader. + +config MTK_GENIO_DDR_LOADER_SIZE + hex "DDR-loader image region size" + default 0x4b000 if TARGET_MT8188 + help + Size reserved for the external DDR loader at the start of the + BootROM payload. This is also the offset of U-Boot SPL and must match + the loader's SPL_OFFSET value. + +config MTK_GENIO_BL31_LOAD_ADDR + hex "BL31 load and entry address" + default 0x54601000 if TARGET_MT8188 + +endif + config MTK_TZ_MOVABLE select ARCH_MISC_INIT select OF_SYSTEM_SETUP diff --git a/board/mediatek/MAINTAINERS b/board/mediatek/MAINTAINERS index d0d25b096e5..57bb3095305 100644 --- a/board/mediatek/MAINTAINERS +++ b/board/mediatek/MAINTAINERS @@ -24,6 +24,8 @@ 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/mtk-genio-*-binman-u-boot.dtsi +F: arch/arm/dts/mtk-genio-binman-u-boot.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..f9b453df766 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 MTK_GENIO_BOOT_IMAGES default y help This enables use of symbols in SPL which refer to other entries in -- 2.55.0