diff options
author | Tom Rini <trini@konsulko.com> | 2023-06-24 21:36:19 -0400 |
---|---|---|
committer | Tom Rini <trini@konsulko.com> | 2023-06-24 21:36:19 -0400 |
commit | f95232c6f06cc0747801bb6a4372b33825ab0164 (patch) | |
tree | 4e179f7c6962564dd11fba3d6bb551603b368457 | |
parent | b2101df305212dd3b98486cbec1d1f15da0832de (diff) | |
parent | 6039e0edc8540bd2abee780549b260bdaf089168 (diff) | |
download | u-boot-f95232c6f06cc0747801bb6a4372b33825ab0164.zip u-boot-f95232c6f06cc0747801bb6a4372b33825ab0164.tar.gz u-boot-f95232c6f06cc0747801bb6a4372b33825ab0164.tar.bz2 |
Merge branch '2023-06-23-assorted-important-fixes'
- Merge in a few important fixes. This includes a (partial) regression
fix, updating documentation and some sanity checking around image
loading.
-rw-r--r-- | arch/arm/dts/imx8mm-u-boot.dtsi | 2 | ||||
-rw-r--r-- | arch/arm/dts/imx8mn-u-boot.dtsi | 2 | ||||
-rw-r--r-- | arch/arm/dts/imx8mp-u-boot.dtsi | 2 | ||||
-rw-r--r-- | arch/arm/dts/imx8mq-u-boot.dtsi | 2 | ||||
-rw-r--r-- | arch/arm/mach-imx/cpu.c | 4 | ||||
-rw-r--r-- | arch/arm/mach-imx/hab.c | 6 | ||||
-rw-r--r-- | arch/arm/mach-imx/spl.c | 67 | ||||
-rw-r--r-- | arch/mips/cpu/cpu.c | 2 | ||||
-rw-r--r-- | cmd/Kconfig | 3 | ||||
-rw-r--r-- | common/menu.c | 2 | ||||
-rw-r--r-- | common/spl/spl_fit.c | 7 | ||||
-rw-r--r-- | common/spl/spl_legacy.c | 20 | ||||
-rw-r--r-- | configs/sama5d2_icp_mmc_defconfig | 1 | ||||
-rw-r--r-- | doc/develop/statistics/u-boot-stats-v2022.10.rst | 27 | ||||
-rw-r--r-- | doc/develop/statistics/u-boot-stats-v2023.01.rst | 52 | ||||
-rw-r--r-- | doc/develop/statistics/u-boot-stats-v2023.04.rst | 27 | ||||
-rw-r--r-- | doc/imx/habv4/csf_examples/mx8m/csf.sh | 28 | ||||
-rw-r--r-- | doc/imx/habv4/csf_examples/mx8m/csf_fit.txt | 10 | ||||
-rw-r--r-- | doc/imx/habv4/guides/mx8m_spl_secure_boot.txt | 74 | ||||
-rw-r--r-- | include/spl.h | 6 | ||||
-rw-r--r-- | tools/mkimage.h | 3 |
21 files changed, 142 insertions, 205 deletions
diff --git a/arch/arm/dts/imx8mm-u-boot.dtsi b/arch/arm/dts/imx8mm-u-boot.dtsi index 7fd5a05..035282b 100644 --- a/arch/arm/dts/imx8mm-u-boot.dtsi +++ b/arch/arm/dts/imx8mm-u-boot.dtsi @@ -81,7 +81,9 @@ fit { description = "Configuration to load ATF before U-Boot"; +#ifndef CONFIG_IMX_HAB fit,external-offset = <CONFIG_FIT_EXTERNAL_OFFSET>; +#endif fit,fdt-list = "of-list"; #address-cells = <1>; diff --git a/arch/arm/dts/imx8mn-u-boot.dtsi b/arch/arm/dts/imx8mn-u-boot.dtsi index cef20da..5046b38 100644 --- a/arch/arm/dts/imx8mn-u-boot.dtsi +++ b/arch/arm/dts/imx8mn-u-boot.dtsi @@ -145,7 +145,9 @@ fit { description = "Configuration to load ATF before U-Boot"; +#ifndef CONFIG_IMX_HAB fit,external-offset = <CONFIG_FIT_EXTERNAL_OFFSET>; +#endif fit,fdt-list = "of-list"; #address-cells = <1>; diff --git a/arch/arm/dts/imx8mp-u-boot.dtsi b/arch/arm/dts/imx8mp-u-boot.dtsi index 18d1728..68cd0e1 100644 --- a/arch/arm/dts/imx8mp-u-boot.dtsi +++ b/arch/arm/dts/imx8mp-u-boot.dtsi @@ -103,7 +103,9 @@ fit { description = "Configuration to load ATF before U-Boot"; +#ifndef CONFIG_IMX_HAB fit,external-offset = <CONFIG_FIT_EXTERNAL_OFFSET>; +#endif fit,fdt-list = "of-list"; #address-cells = <1>; diff --git a/arch/arm/dts/imx8mq-u-boot.dtsi b/arch/arm/dts/imx8mq-u-boot.dtsi index b3fef86..90b2274 100644 --- a/arch/arm/dts/imx8mq-u-boot.dtsi +++ b/arch/arm/dts/imx8mq-u-boot.dtsi @@ -97,7 +97,9 @@ fit { description = "Configuration to load ATF before U-Boot"; +#ifndef CONFIG_IMX_HAB fit,external-offset = <CONFIG_FIT_EXTERNAL_OFFSET>; +#endif #address-cells = <1>; images { diff --git a/arch/arm/mach-imx/cpu.c b/arch/arm/mach-imx/cpu.c index 702cfc3..488638c 100644 --- a/arch/arm/mach-imx/cpu.c +++ b/arch/arm/mach-imx/cpu.c @@ -510,3 +510,7 @@ char nxp_board_rev_string(void) return (*rev + nxp_board_rev() - 1); } #endif + +__weak void reset_cpu(void) +{ +} diff --git a/arch/arm/mach-imx/hab.c b/arch/arm/mach-imx/hab.c index c6747b2..439cdaf 100644 --- a/arch/arm/mach-imx/hab.c +++ b/arch/arm/mach-imx/hab.c @@ -932,10 +932,10 @@ int imx_hab_authenticate_image(uint32_t ddr_start, uint32_t image_size, printf("ivt entry = 0x%08x, dcd = 0x%08x, csf = 0x%08x\n", ivt->entry, ivt->dcd, ivt->csf); puts("Dumping IVT\n"); - print_buffer(ivt_addr, (void *)(ivt_addr), 4, 0x8, 0); + print_buffer(ivt_addr, (void *)(uintptr_t)(ivt_addr), 4, 0x8, 0); puts("Dumping CSF Header\n"); - print_buffer(ivt->csf, (void *)(ivt->csf), 4, 0x10, 0); + print_buffer(ivt->csf, (void *)(uintptr_t)(ivt->csf), 4, 0x10, 0); #if !defined(CONFIG_SPL_BUILD) get_hab_status(); @@ -944,7 +944,7 @@ int imx_hab_authenticate_image(uint32_t ddr_start, uint32_t image_size, puts("\nCalling authenticate_image in ROM\n"); printf("\tivt_offset = 0x%x\n", ivt_offset); printf("\tstart = 0x%08lx\n", start); - printf("\tbytes = 0x%x\n", bytes); + printf("\tbytes = 0x%lx\n", (ulong)bytes); #endif #ifndef CONFIG_ARM64 diff --git a/arch/arm/mach-imx/spl.c b/arch/arm/mach-imx/spl.c index cb9801b..6c13b00 100644 --- a/arch/arm/mach-imx/spl.c +++ b/arch/arm/mach-imx/spl.c @@ -20,6 +20,7 @@ #include <asm/mach-imx/boot_mode.h> #include <g_dnl.h> #include <linux/libfdt.h> +#include <memalign.h> DECLARE_GLOBAL_DATA_PTR; @@ -315,47 +316,21 @@ ulong board_spl_fit_size_align(ulong size) size = ALIGN(size, 0x1000); size += CONFIG_CSF_SIZE; - return size; -} + if (size > CONFIG_SYS_BOOTM_LEN) + panic("spl: ERROR: image too big\n"); -void board_spl_fit_post_load(const void *fit) -{ - u32 offset = ALIGN(fdt_totalsize(fit), 0x1000); - - if (imx_hab_authenticate_image((uintptr_t)fit, - offset + IVT_SIZE + CSF_PAD_SIZE, - offset)) { - panic("spl: ERROR: image authentication unsuccessful\n"); - } + return size; } #endif void *board_spl_fit_buffer_addr(ulong fit_size, int sectors, int bl_len) { - int align_len = ARCH_DMA_MINALIGN - 1; - - /* Some devices like SDP, NOR, NAND, SPI are using bl_len =1, so their fit address - * is different with SD/MMC, this cause mismatch with signed address. Thus, adjust - * the bl_len to align with SD/MMC. - */ - if (bl_len < 512) - bl_len = 512; - - return (void *)((CONFIG_TEXT_BASE - fit_size - bl_len - - align_len) & ~align_len); -} +#if defined(CONFIG_SPL_LOAD_FIT_ADDRESS) + return (void *)CONFIG_SPL_LOAD_FIT_ADDRESS; +#else + return (void *)(CONFIG_TEXT_BASE + CONFIG_SYS_BOOTM_LEN); #endif - -#if defined(CONFIG_MX6) && defined(CONFIG_SPL_OS_BOOT) -int dram_init_banksize(void) -{ - gd->bd->bi_dram[0].start = CFG_SYS_SDRAM_BASE; - gd->bd->bi_dram[0].size = imx_ddr_size(); - - return 0; } -#endif - /* * read the address where the IVT header must sit * from IVT image header, loaded from SPL into @@ -365,7 +340,6 @@ int dram_init_banksize(void) void *spl_load_simple_fit_fix_load(const void *fit) { struct ivt *ivt; - unsigned long new; unsigned long offset; unsigned long size; u8 *tmp = (u8 *)fit; @@ -375,16 +349,23 @@ void *spl_load_simple_fit_fix_load(const void *fit) size = board_spl_fit_size_align(size); tmp += offset; ivt = (struct ivt *)tmp; - if (ivt->hdr.magic != IVT_HEADER_MAGIC) { - debug("no IVT header found\n"); - return (void *)fit; - } + debug("%s: ivt: %p offset: %lx size: %lx\n", __func__, ivt, offset, size); debug("%s: ivt self: %x\n", __func__, ivt->self); - new = ivt->self; - new -= offset; - debug("%s: new %lx\n", __func__, new); - memcpy((void *)new, fit, size); - return (void *)new; + if (imx_hab_authenticate_image((uintptr_t)fit, (uintptr_t)ivt, offset)) + panic("spl: ERROR: image authentication unsuccessful\n"); + + return (void *)fit; } +#endif /* CONFIG_IMX_HAB */ + +#if defined(CONFIG_MX6) && defined(CONFIG_SPL_OS_BOOT) +int dram_init_banksize(void) +{ + gd->bd->bi_dram[0].start = CFG_SYS_SDRAM_BASE; + gd->bd->bi_dram[0].size = imx_ddr_size(); + + return 0; +} +#endif diff --git a/arch/mips/cpu/cpu.c b/arch/mips/cpu/cpu.c index b304026..f0e20da 100644 --- a/arch/mips/cpu/cpu.c +++ b/arch/mips/cpu/cpu.c @@ -15,7 +15,7 @@ #if !CONFIG_IS_ENABLED(SYSRESET) void __weak _machine_restart(void) { - fprintf(stderr, "*** reset failed ***\n"); + puts("*** reset failed ***\n"); while (1) /* NOP */; diff --git a/cmd/Kconfig b/cmd/Kconfig index 365371f..02e54f1 100644 --- a/cmd/Kconfig +++ b/cmd/Kconfig @@ -362,7 +362,8 @@ config BOOTM_VXWORKS config SYS_BOOTM_LEN hex "Maximum size of a decompresed OS image" - depends on CMD_BOOTM || CMD_BOOTI || CMD_BOOTZ + depends on CMD_BOOTM || CMD_BOOTI || CMD_BOOTZ || \ + LEGACY_IMAGE_FORMAT || SPL_LEGACY_IMAGE_FORMAT default 0x4000000 if PPC || ARM64 default 0x1000000 if X86 || ARCH_MX6 || ARCH_MX7 default 0x800000 diff --git a/common/menu.c b/common/menu.c index 9451417..b55cf7b 100644 --- a/common/menu.c +++ b/common/menu.c @@ -15,7 +15,7 @@ #include "menu.h" -#define ansi 0 +#define ansi 1 /* * Internally, each item in a menu is represented by a struct menu_item. diff --git a/common/spl/spl_fit.c b/common/spl/spl_fit.c index c51482b..730639f 100644 --- a/common/spl/spl_fit.c +++ b/common/spl/spl_fit.c @@ -27,10 +27,6 @@ struct spl_fit_info { int conf_node; /* FDT offset to selected configuration node */ }; -__weak void board_spl_fit_post_load(const void *fit) -{ -} - __weak ulong board_spl_fit_size_align(ulong size) { return size; @@ -829,8 +825,5 @@ int spl_load_simple_fit(struct spl_image_info *spl_image, spl_image->flags |= SPL_FIT_FOUND; - if (IS_ENABLED(CONFIG_IMX_HAB)) - board_spl_fit_post_load(ctx.fit); - return 0; } diff --git a/common/spl/spl_legacy.c b/common/spl/spl_legacy.c index 16851c5..d34bc54 100644 --- a/common/spl/spl_legacy.c +++ b/common/spl/spl_legacy.c @@ -7,6 +7,7 @@ #include <image.h> #include <log.h> #include <malloc.h> +#include <asm/sections.h> #include <spl.h> #include <lzma/LzmaTypes.h> @@ -15,6 +16,22 @@ #define LZMA_LEN (1 << 20) +static void spl_parse_legacy_validate(uintptr_t start, uintptr_t size) +{ + uintptr_t spl_start = (uintptr_t)_start; + uintptr_t spl_end = (uintptr_t)__bss_end; + uintptr_t end = start + size; + + if ((start >= spl_start && start < spl_end) || + (end > spl_start && end <= spl_end) || + (start < spl_start && end >= spl_end) || + (start > end && end > spl_start)) + panic("SPL: Image overlaps SPL\n"); + + if (size > CONFIG_SYS_BOOTM_LEN) + panic("SPL: Image too large\n"); +} + int spl_parse_legacy_header(struct spl_image_info *spl_image, const struct legacy_img_hdr *header) { @@ -58,6 +75,9 @@ int spl_parse_legacy_header(struct spl_image_info *spl_image, "payload image: %32s load addr: 0x%lx size: %d\n", spl_image->name, spl_image->load_addr, spl_image->size); + spl_parse_legacy_validate(spl_image->load_addr, spl_image->size); + spl_parse_legacy_validate(spl_image->entry_point, 0); + return 0; } diff --git a/configs/sama5d2_icp_mmc_defconfig b/configs/sama5d2_icp_mmc_defconfig index 6b7e308..185694d 100644 --- a/configs/sama5d2_icp_mmc_defconfig +++ b/configs/sama5d2_icp_mmc_defconfig @@ -41,6 +41,7 @@ CONFIG_SPL_MAX_SIZE=0x10000 CONFIG_SPL_HAS_BSS_LINKER_SECTION=y CONFIG_SPL_BSS_START_ADDR=0x20000000 CONFIG_SPL_BSS_MAX_SIZE=0x80000 +CONFIG_SPL_SYS_MALLOC_SIMPLE=y # CONFIG_SPL_SHARES_INIT_SP_ADDR is not set CONFIG_SYS_SPL_MALLOC=y CONFIG_SYS_SPL_MALLOC_SIZE=0x80000 diff --git a/doc/develop/statistics/u-boot-stats-v2022.10.rst b/doc/develop/statistics/u-boot-stats-v2022.10.rst index 6fb71d4..7a5fc2e 100644 --- a/doc/develop/statistics/u-boot-stats-v2022.10.rst +++ b/doc/develop/statistics/u-boot-stats-v2022.10.rst @@ -607,20 +607,21 @@ Release Statistics for U-Boot v2022.10 ==================================== ===== Name Count ==================================== ===== - (Unknown) 590 (38.8%) + (Unknown) 584 (38.4%) Konsulko Group 265 (17.4%) Google, Inc. 141 (9.3%) NXP 77 (5.1%) + AMD 70 (4.6%) ST Microelectronics 67 (4.4%) Linaro 60 (3.9%) Texas Instruments 56 (3.7%) - AMD 53 (3.5%) DENX Software Engineering 45 (3.0%) Toradex 45 (3.0%) Weidmüller Interface GmbH & Co. KG 41 (2.7%) - Xilinx 29 (1.9%) Amarula Solutions 18 (1.2%) + Xilinx 12 (0.8%) ARM 11 (0.7%) + Collabora Ltd. 7 (0.5%) BayLibre SAS 5 (0.3%) SUSE 4 (0.3%) Socionext Inc. 3 (0.2%) @@ -628,7 +629,6 @@ Release Statistics for U-Boot v2022.10 IBM 2 (0.1%) Siemens 2 (0.1%) Broadcom 1 (0.1%) - Collabora Ltd. 1 (0.1%) Debian.org 1 (0.1%) Marvell 1 (0.1%) Samsung 1 (0.1%) @@ -642,7 +642,7 @@ Release Statistics for U-Boot v2022.10 Name Count ==================================== ===== Konsulko Group 98915 (47.3%) - (Unknown) 36773 (17.6%) + (Unknown) 36630 (17.5%) Toradex 20197 (9.7%) NXP 11759 (5.6%) Google, Inc. 8739 (4.2%) @@ -651,12 +651,13 @@ Release Statistics for U-Boot v2022.10 Texas Instruments 5930 (2.8%) ST Microelectronics 3803 (1.8%) DENX Software Engineering 3551 (1.7%) - AMD 2343 (1.1%) + AMD 2591 (1.2%) Amarula Solutions 1360 (0.7%) - Xilinx 1016 (0.5%) + Xilinx 768 (0.4%) Broadcom 315 (0.2%) ARM 298 (0.1%) BayLibre SAS 197 (0.1%) + Collabora Ltd. 144 (0.1%) SUSE 79 (0.0%) IBM 34 (0.0%) Bootlin 32 (0.0%) @@ -665,7 +666,6 @@ Release Statistics for U-Boot v2022.10 Debian.org 4 (0.0%) Marvell 3 (0.0%) Samsung 2 (0.0%) - Collabora Ltd. 1 (0.0%) ==================================== ===== @@ -677,13 +677,14 @@ Release Statistics for U-Boot v2022.10 ==================================== ===== AMD 81 (30.5%) NXP 51 (19.2%) - (Unknown) 33 (12.4%) + (Unknown) 28 (10.5%) Texas Instruments 19 (7.1%) Linaro 16 (6.0%) ARM 16 (6.0%) Amarula Solutions 14 (5.3%) Xilinx 13 (4.9%) Konsulko Group 6 (2.3%) + Canonical 5 (1.9%) Toradex 4 (1.5%) Google, Inc. 4 (1.5%) Socionext Inc. 4 (1.5%) @@ -699,19 +700,20 @@ Release Statistics for U-Boot v2022.10 ==================================== ===== Name Count ==================================== ===== - (Unknown) 78 (51.0%) + (Unknown) 77 (50.3%) Linaro 12 (7.8%) Texas Instruments 11 (7.2%) NXP 7 (4.6%) + AMD 6 (3.9%) Google, Inc. 5 (3.3%) DENX Software Engineering 5 (3.3%) - Xilinx 4 (2.6%) Toradex 4 (2.6%) ST Microelectronics 4 (2.6%) - AMD 3 (2.0%) ARM 3 (2.0%) BayLibre SAS 3 (2.0%) Amarula Solutions 2 (1.3%) + Collabora Ltd. 2 (1.3%) + Xilinx 1 (0.7%) Konsulko Group 1 (0.7%) Socionext Inc. 1 (0.7%) Broadcom 1 (0.7%) @@ -723,5 +725,4 @@ Release Statistics for U-Boot v2022.10 Debian.org 1 (0.7%) Marvell 1 (0.7%) Samsung 1 (0.7%) - Collabora Ltd. 1 (0.7%) ==================================== ===== diff --git a/doc/develop/statistics/u-boot-stats-v2023.01.rst b/doc/develop/statistics/u-boot-stats-v2023.01.rst index 2fd34bb..793aaa5 100644 --- a/doc/develop/statistics/u-boot-stats-v2023.01.rst +++ b/doc/develop/statistics/u-boot-stats-v2023.01.rst @@ -5,7 +5,7 @@ Release Statistics for U-Boot v2023.01 * Processed 1396 changesets from 152 developers -* 23 employers found +* 24 employers found * A total of 91252 lines added, 42422 removed (delta 48830) @@ -603,11 +603,11 @@ Release Statistics for U-Boot v2023.01 ==================================== ===== Name Count ==================================== ===== - (Unknown) 557 (39.9%) + (Unknown) 556 (39.8%) Google, Inc. 270 (19.3%) + AMD 90 (6.4%) DENX Software Engineering 86 (6.2%) Linaro 85 (6.1%) - AMD 80 (5.7%) Konsulko Group 48 (3.4%) ST Microelectronics 47 (3.4%) SUSE 36 (2.6%) @@ -616,16 +616,17 @@ Release Statistics for U-Boot v2023.01 Broadcom 27 (1.9%) Texas Instruments 26 (1.9%) Amarula Solutions 24 (1.7%) - Xilinx 13 (0.9%) NXP 8 (0.6%) BayLibre SAS 6 (0.4%) Collabora Ltd. 6 (0.4%) Weidmüller Interface GmbH & Co. KG 6 (0.4%) Socionext Inc. 4 (0.3%) + Xilinx 3 (0.2%) Edgeble AI Technologies Pvt. Ltd. 1 (0.1%) Marvell 1 (0.1%) Rockchip 1 (0.1%) Siemens 1 (0.1%) + Canonical 1 (0.1%) ==================================== ===== @@ -635,7 +636,7 @@ Release Statistics for U-Boot v2023.01 ==================================== ===== Name Count ==================================== ===== - (Unknown) 41561 (37.8%) + (Unknown) 41551 (37.8%) Google, Inc. 19204 (17.5%) Linaro 11194 (10.2%) Toradex 6724 (6.1%) @@ -644,18 +645,19 @@ Release Statistics for U-Boot v2023.01 Collabora Ltd. 3312 (3.0%) Amarula Solutions 3308 (3.0%) ST Microelectronics 3303 (3.0%) + AMD 2379 (2.2%) Texas Instruments 2174 (2.0%) DENX Software Engineering 2105 (1.9%) - AMD 2105 (1.9%) ARM 1569 (1.4%) SUSE 478 (0.4%) Weidmüller Interface GmbH & Co. KG 448 (0.4%) NXP 446 (0.4%) - Xilinx 280 (0.3%) Marvell 200 (0.2%) Socionext Inc. 76 (0.1%) BayLibre SAS 65 (0.1%) + Canonical 10 (0.0%) Siemens 9 (0.0%) + Xilinx 6 (0.0%) Edgeble AI Technologies Pvt. Ltd. 1 (0.0%) Rockchip 1 (0.0%) ==================================== ===== @@ -669,47 +671,49 @@ Release Statistics for U-Boot v2023.01 ==================================== ===== AMD 79 (46.7%) Amarula Solutions 27 (16.0%) - (Unknown) 22 (13.0%) + (Unknown) 18 (10.7%) DENX Software Engineering 10 (5.9%) NXP 7 (4.1%) Linaro 5 (3.0%) Google, Inc. 4 (2.4%) ST Microelectronics 4 (2.4%) ARM 4 (2.4%) + Canonical 4 (2.4%) Texas Instruments 3 (1.8%) Konsulko Group 2 (1.2%) BayLibre SAS 2 (1.2%) ==================================== ===== -.. table:: Employers with the most hackers (total 154) +.. table:: Employers with the most hackers (total 153) :widths: auto ==================================== ===== Name Count ==================================== ===== - (Unknown) 81 (52.6%) - Linaro 9 (5.8%) + (Unknown) 80 (52.3%) + AMD 9 (5.9%) + Linaro 9 (5.9%) Texas Instruments 8 (5.2%) - AMD 7 (4.5%) ST Microelectronics 6 (3.9%) - DENX Software Engineering 5 (3.2%) + DENX Software Engineering 5 (3.3%) Amarula Solutions 4 (2.6%) Toradex 4 (2.6%) - Xilinx 4 (2.6%) - NXP 3 (1.9%) - Google, Inc. 3 (1.9%) - ARM 3 (1.9%) - BayLibre SAS 3 (1.9%) + NXP 3 (2.0%) + Google, Inc. 3 (2.0%) + ARM 3 (2.0%) + BayLibre SAS 3 (2.0%) Collabora Ltd. 2 (1.3%) SUSE 2 (1.3%) Weidmüller Interface GmbH & Co. KG 2 (1.3%) Socionext Inc. 2 (1.3%) - Konsulko Group 1 (0.6%) - Broadcom 1 (0.6%) - Marvell 1 (0.6%) - Siemens 1 (0.6%) - Edgeble AI Technologies Pvt. Ltd. 1 (0.6%) - Rockchip 1 (0.6%) + Canonical 1 (0.7%) + Konsulko Group 1 (0.7%) + Broadcom 1 (0.7%) + Marvell 1 (0.7%) + Siemens 1 (0.7%) + Xilinx 1 (0.7%) + Edgeble AI Technologies Pvt. Ltd. 1 (0.7%) + Rockchip 1 (0.7%) ==================================== ===== diff --git a/doc/develop/statistics/u-boot-stats-v2023.04.rst b/doc/develop/statistics/u-boot-stats-v2023.04.rst index 57f2efc..73a3583 100644 --- a/doc/develop/statistics/u-boot-stats-v2023.04.rst +++ b/doc/develop/statistics/u-boot-stats-v2023.04.rst @@ -5,7 +5,7 @@ Release Statistics for U-Boot v2023.04 * Processed 1691 changesets from 157 developers -* 29 employers found +* 28 employers found * A total of 174471 lines added, 78380 removed (delta 96091) @@ -631,17 +631,17 @@ Release Statistics for U-Boot v2023.04 ==================================== ===== Name Count ==================================== ===== - (Unknown) 524 (31.0%) + (Unknown) 464 (27.4%) Google, Inc. 381 (22.5%) Konsulko Group 333 (19.7%) + Renesas Electronics 84 (5.0%) DENX Software Engineering 72 (4.3%) Texas Instruments 49 (2.9%) Linaro 47 (2.8%) Edgeble AI Technologies Pvt. Ltd. 46 (2.7%) ST Microelectronics 40 (2.4%) - AMD 34 (2.0%) + AMD 35 (2.1%) NXP 25 (1.5%) - Renesas Electronics 24 (1.4%) Toradex 24 (1.4%) Amarula Solutions 20 (1.2%) Collabora Ltd. 20 (1.2%) @@ -659,7 +659,6 @@ Release Statistics for U-Boot v2023.04 Intel 1 (0.1%) linutronix 1 (0.1%) Samsung 1 (0.1%) - Xilinx 1 (0.1%) ==================================== ===== @@ -669,18 +668,18 @@ Release Statistics for U-Boot v2023.04 ==================================== ===== Name Count ==================================== ===== - (Unknown) 64681 (30.1%) + (Unknown) 51007 (23.8%) Texas Instruments 42105 (19.6%) Konsulko Group 36464 (17.0%) Google, Inc. 30090 (14.0%) Edgeble AI Technologies Pvt. Ltd. 23070 (10.7%) + Renesas Electronics 14449 (6.7%) Linaro 4601 (2.1%) DENX Software Engineering 4582 (2.1%) - AMD 1741 (0.8%) + AMD 1744 (0.8%) Amarula Solutions 1649 (0.8%) ST Microelectronics 882 (0.4%) Bootlin 860 (0.4%) - Renesas Electronics 775 (0.4%) Socionext Inc. 760 (0.4%) ARM 724 (0.3%) Collabora Ltd. 413 (0.2%) @@ -695,7 +694,6 @@ Release Statistics for U-Boot v2023.04 Pengutronix 13 (0.0%) Samsung 9 (0.0%) Ronetix 4 (0.0%) - Xilinx 3 (0.0%) Intel 1 (0.0%) linutronix 1 (0.0%) ==================================== ===== @@ -707,14 +705,14 @@ Release Statistics for U-Boot v2023.04 ==================================== ===== Name Count ==================================== ===== - (Unknown) 48 (22.3%) + Renesas Electronics 30 (14.0%) Rockchip 29 (13.5%) Toradex 28 (13.0%) + (Unknown) 27 (12.6%) Amarula Solutions 24 (11.2%) AMD 23 (10.7%) NVidia 19 (8.8%) Linaro 9 (4.2%) - Renesas Electronics 9 (4.2%) Texas Instruments 5 (2.3%) Konsulko Group 5 (2.3%) NXP 4 (1.9%) @@ -734,18 +732,18 @@ Release Statistics for U-Boot v2023.04 ==================================== ===== Name Count ==================================== ===== - (Unknown) 86 (53.8%) + (Unknown) 85 (53.1%) Linaro 9 (5.6%) Texas Instruments 8 (5.0%) - AMD 6 (3.8%) + AMD 7 (4.4%) Collabora Ltd. 6 (3.8%) Toradex 5 (3.1%) DENX Software Engineering 5 (3.1%) Amarula Solutions 4 (2.5%) NXP 4 (2.5%) + Renesas Electronics 3 (1.9%) ARM 3 (1.9%) ST Microelectronics 3 (1.9%) - Renesas Electronics 2 (1.2%) SUSE 2 (1.2%) Socionext Inc. 2 (1.2%) Konsulko Group 1 (0.6%) @@ -761,7 +759,6 @@ Release Statistics for U-Boot v2023.04 Pengutronix 1 (0.6%) Samsung 1 (0.6%) Ronetix 1 (0.6%) - Xilinx 1 (0.6%) linutronix 1 (0.6%) ==================================== ===== diff --git a/doc/imx/habv4/csf_examples/mx8m/csf.sh b/doc/imx/habv4/csf_examples/mx8m/csf.sh index 7a9a05e..5b383fa 100644 --- a/doc/imx/habv4/csf_examples/mx8m/csf.sh +++ b/doc/imx/habv4/csf_examples/mx8m/csf.sh @@ -37,29 +37,11 @@ dd if=csf_spl.bin of=flash.bin bs=1 seek=${spl_dd_offset} conv=notrunc # 3) Sign u-boot.itb -# fitImage tree -fit_block_base=$(printf "0x%x" $(( $(sed -n "/CONFIG_TEXT_BASE=/ s@.*=@@p" .config) - $(sed -n "/CONFIG_FIT_EXTERNAL_OFFSET=/ s@.*=@@p" .config) - 0x200 - 0x40)) ) +# fitImage +fit_block_base=$(printf "0x%x" $(sed -n "/CONFIG_SPL_LOAD_FIT_ADDRESS=/ s@.*=@@p" .config) ) fit_block_offset=$(printf "0x%s" $(fdtget -t x u-boot.dtb /binman/imx-boot/uboot offset)) -fit_block_size=$(printf "0x%x" $(( ( ($(fdtdump u-boot.itb 2>/dev/null | sed -n "/^...totalsize:/ s@.*\(0x[0-9a-f]\+\).*@\1@p") + 0x1000 - 0x1 ) & ~(0x1000 - 0x1)) + 0x20 )) ) -sed -i "/Blocks = / s@.*@ Blocks = $fit_block_base $fit_block_offset $fit_block_size \"flash.bin\", \\\\@" csf_fit.tmp - -# U-Boot -uboot_block_base=$(printf "0x%s" $(fdtget -t x u-boot.itb /images/uboot load)) -uboot_block_offset=$(printf "0x%x" $(( $(printf "0x%s" $(fdtget -t x u-boot.itb /images/uboot data-position)) + ${fit_block_offset} ))) -uboot_block_size=$(printf "0x%s" $(fdtget -t x u-boot.itb /images/uboot data-size)) -sed -i "/0xuuuu/ s@.*@ $uboot_block_base $uboot_block_offset $uboot_block_size \"flash.bin\", \\\\@" csf_fit.tmp - -# ATF -atf_block_base=$(printf "0x%s" $(fdtget -t x u-boot.itb /images/atf load)) -atf_block_offset=$(printf "0x%x" $(( $(printf "0x%s" $(fdtget -t x u-boot.itb /images/atf data-position)) + ${fit_block_offset} ))) -atf_block_size=$(printf "0x%s" $(fdtget -t x u-boot.itb /images/atf data-size)) -sed -i "/0xaaaa/ s@.*@ $atf_block_base $atf_block_offset $atf_block_size \"flash.bin\", \\\\@" csf_fit.tmp - -# DTB -dtb_block_base=$(printf "0x%x" $(( ${uboot_block_base} + ${uboot_block_size} ))) -dtb_block_offset=$(printf "0x%x" $(( $(printf "0x%s" $(fdtget -t x u-boot.itb /images/fdt-1 data-position)) + ${fit_block_offset} ))) -dtb_block_size=$(printf "0x%s" $(fdtget -t x u-boot.itb /images/fdt-1 data-size)) -sed -i "/0xdddd/ s@.*@ $dtb_block_base $dtb_block_offset $dtb_block_size \"flash.bin\"@" csf_fit.tmp +fit_block_size=$(printf "0x%x" $(( ( ( $(stat -tc %s u-boot.itb) + 0x1000 - 0x1 ) & ~(0x1000 - 0x1)) + 0x20 )) ) +sed -i "/Blocks = / s@.*@ Blocks = $fit_block_base $fit_block_offset $fit_block_size \"flash.bin\"@" csf_fit.tmp # IVT ivt_ptr_base=$(printf "%08x" ${fit_block_base} | sed "s@\(..\)\(..\)\(..\)\(..\)@0x\4\3\2\1@") @@ -68,7 +50,7 @@ csf_block_base=$(printf "%08x" $(( ${fit_block_base} + ${fit_block_size} )) | se ivt_block_offset=$((${fit_block_offset} + ${fit_block_size} - 0x20)) csf_block_offset=$((${ivt_block_offset} + 0x20)) -echo "0xd1002041 ${ivt_ptr_base} 0x00000000 0x00000000 0x00000000 ${ivt_block_base} ${csf_block_base} 0x00000000" | xxd -r -p > ivt.bin +echo "0xd1002041 ${ivt_block_base} 0x00000000 0x00000000 0x00000000 ${ivt_block_base} ${csf_block_base} 0x00000000" | xxd -r -p > ivt.bin dd if=ivt.bin of=flash.bin bs=1 seek=${ivt_block_offset} conv=notrunc # Generate CSF blob diff --git a/doc/imx/habv4/csf_examples/mx8m/csf_fit.txt b/doc/imx/habv4/csf_examples/mx8m/csf_fit.txt index cd1d407..bbb82f6 100644 --- a/doc/imx/habv4/csf_examples/mx8m/csf_fit.txt +++ b/doc/imx/habv4/csf_examples/mx8m/csf_fit.txt @@ -26,11 +26,5 @@ [Authenticate Data] Verification index = 2 # FIXME: - # Line 1 -- fitImage tree - # Line 2 -- U-Boot u-boot-nodtb.bin blob - # Line 3 -- ATF BL31 blob - # Line 4 -- DT blob - Blocks = 0x401fcdc0 0x57c00 0xffff "flash.bin", \ - 0x40200000 0x62c00 0xuuuu "flash.bin", \ - 0x920000 0x00000 0xaaaa "flash.bin", \ - 0x40200000 0x00000 0xdddd "flash.bin" + # Line 1 -- fitImage + Blocks = 0x401fcdc0 0x57c00 0xffff "flash.bin" diff --git a/doc/imx/habv4/guides/mx8m_spl_secure_boot.txt b/doc/imx/habv4/guides/mx8m_spl_secure_boot.txt index 3e3d384..e79726b 100644 --- a/doc/imx/habv4/guides/mx8m_spl_secure_boot.txt +++ b/doc/imx/habv4/guides/mx8m_spl_secure_boot.txt @@ -79,18 +79,16 @@ code within it: The diagram below illustrate a signed U-Boot binary, DT blob and external ATF BL31 blob combined to form fitImage part of flash.bin container layout. -The *load_address is derived from CONFIG_TEXT_BASE such that the U-Boot -binary *start is placed exactly at CONFIG_SPL_TEXT_BASE in DRAM, however the -SPL moves the fitImage tree further to location: - *load_address = CONFIG_SPL_TEXT_BASE - CONFIG_FIT_EXTERNAL_OFFSET (=12kiB) - - 512 Byte sector - sizeof(mkimage header) +The *load_address is CONFIG_SPL_LOAD_FIT_ADDRESS, the fitImage is loaded +including all of its embedded data, authenticated using IVT+CSF concatenated +at the end of the fitImage at offset aligned to 4 kiB. The fitImage with +external data is not supported. ------- +-----------------------------+ <-- *load_address ^ | | | | fitImage tree | - | | with external data at | - | | offset 12 kiB from tree | - | | (cca. 1 kiB) | + | | with embedded data | + | | (cca. 1 MiB) | Signed | | | .----- Tree | +-----------------------------+ | Data | | Padding to next 4k aligned | @@ -101,34 +99,9 @@ SPL moves the fitImage tree further to location: | ------- +-----------------------------+ <-- *csf | | Command Sequence File (CSF) | | | for all signed entries in | - >--------------->| the fitImage, tree and data | - | | (cca 6-7 kiB) | - | +-----------------------------+ - | | Padding to 12 kiB offset | - | | from *load_address | - | ------- +-----------------------------+ <-- *start - | ^ | | - | Signed | | | - |---- Payload | | U-Boot external data blob | - | Data | | | - | v | | - | ------- +-----------------------------+ - | | Padding to 4 Bytes | - | ------- +-----------------------------+ - | ^ | | - | Signed | | | - |---- Payload | | ATF external data blob | - | Data | | | - | v | | - | ------- +-----------------------------+ - | | Padding to 4 Bytes | - | ------- +-----------------------------+ - | ^ | | - | Signed | | | - '---- Payload | | DTB external data blob | - Data | | | - v | | - ------- +-----------------------------+ + '---------------->| the fitImage, tree and data | + | (cca 6-7 kiB) | + +-----------------------------+ The diagram below illustrate a combined flash.bin container layout: @@ -202,29 +175,11 @@ dd if=csf_spl.bin of=flash.bin bs=1 seek=${spl_dd_offset} conv=notrunc CSF "Blocks" line for csf_fit.txt can be generated as follows: ``` -# fitImage tree -fit_block_base=$(printf "0x%x" $(( $(sed -n "/CONFIG_TEXT_BASE=/ s@.*=@@p" .config) - $(sed -n "/CONFIG_FIT_EXTERNAL_OFFSET=/ s@.*=@@p" .config) - 0x200 - 0x40)) ) +# fitImage +fit_block_base=$(printf "0x%x" $(sed -n "/CONFIG_SPL_LOAD_FIT_ADDRESS=/ s@.*=@@p" .config) ) fit_block_offset=$(printf "0x%s" $(fdtget -t x u-boot.dtb /binman/imx-boot/uboot offset)) -fit_block_size=$(printf "0x%x" $(( ( $(fdtdump u-boot.itb 2>/dev/null | sed -n "/^...totalsize:/ s@.*\(0x[0-9a-f]\+\).*@\1@p") + 0x1000 - 0x1 ) & ~(0x1000 - 0x1) + 0x20 )) ) -sed -i "/Blocks = / s@.*@ Blocks = $fit_block_base $fit_block_offset $fit_block_size \"flash.bin\", \\\\@" csf_fit.tmp - -# U-Boot -uboot_block_base=$(printf "0x%s" $(fdtget -t x u-boot.itb /images/uboot load)) -uboot_block_offset=$(printf "0x%x" $(( $(printf "0x%s" $(fdtget -t x u-boot.itb /images/uboot data-position)) + ${fit_block_offset} ))) -uboot_block_size=$(printf "0x%s" $(fdtget -t x u-boot.itb /images/uboot data-size)) -sed -i "/0xuuuu/ s@.*@ $uboot_block_base $uboot_block_offset $uboot_block_size \"flash.bin\", \\\\@" csf_fit.tmp - -# ATF -atf_block_base=$(printf "0x%s" $(fdtget -t x u-boot.itb /images/atf load)) -atf_block_offset=$(printf "0x%x" $(( $(printf "0x%s" $(fdtget -t x u-boot.itb /images/atf data-position)) + ${fit_block_offset} ))) -atf_block_size=$(printf "0x%s" $(fdtget -t x u-boot.itb /images/atf data-size)) -sed -i "/0xaaaa/ s@.*@ $atf_block_base $atf_block_offset $atf_block_size \"flash.bin\", \\\\@" csf_fit.tmp - -# DTB -dtb_block_base=$(printf "0x%x" $(( ${uboot_block_base} + ${uboot_block_size} ))) -dtb_block_offset=$(printf "0x%x" $(( $(printf "0x%s" $(fdtget -t x u-boot.itb /images/fdt-1 data-position)) + ${fit_block_offset} ))) -dtb_block_size=$(printf "0x%s" $(fdtget -t x u-boot.itb /images/fdt-1 data-size)) -sed -i "/0xdddd/ s@.*@ $dtb_block_base $dtb_block_offset $dtb_block_size \"flash.bin\"@" csf_fit.tmp +fit_block_size=$(printf "0x%x" $(( ( ( $(stat -tc %s u-boot.itb) + 0x1000 - 0x1 ) & ~(0x1000 - 0x1)) + 0x20 )) ) +sed -i "/Blocks = / s@.*@ Blocks = $fit_block_base $fit_block_offset $fit_block_size \"flash.bin\"@" csf_fit.tmp ``` The fitImage part of flash.bin requires separate IVT. Generate the IVT and @@ -237,8 +192,9 @@ csf_block_base=$(printf "%08x" $(( ${fit_block_base} + ${fit_block_size} )) | se ivt_block_offset=$((${fit_block_offset} + ${fit_block_size} - 0x20)) csf_block_offset=$((${ivt_block_offset} + 0x20)) -echo "0xd1002041 ${ivt_ptr_base} 0x00000000 0x00000000 0x00000000 ${ivt_block_base} ${csf_block_base} 0x00000000" | xxd -r -p > ivt.bin +echo "0xd1002041 ${ivt_block_base} 0x00000000 0x00000000 0x00000000 ${ivt_block_base} ${csf_block_base} 0x00000000" | xxd -r -p > ivt.bin dd if=ivt.bin of=flash.bin bs=1 seek=${ivt_block_offset} conv=notrunc +``` To generate CSF signature for the fitImage part of flash.bin container, use CST: ``` diff --git a/include/spl.h b/include/spl.h index 7e0f5ac..98f5732 100644 --- a/include/spl.h +++ b/include/spl.h @@ -872,12 +872,6 @@ int board_return_to_bootrom(struct spl_image_info *spl_image, struct spl_boot_device *bootdev); /** - * board_spl_fit_post_load - allow process images after loading finished - * @fit: Pointer to a valid Flattened Image Tree blob - */ -void board_spl_fit_post_load(const void *fit); - -/** * board_spl_fit_size_align - specific size align before processing payload * */ diff --git a/tools/mkimage.h b/tools/mkimage.h index f5ca65e..d92a3ff 100644 --- a/tools/mkimage.h +++ b/tools/mkimage.h @@ -17,6 +17,7 @@ #include <sys/stat.h> #include <time.h> #include <unistd.h> +#include <limits.h> #include <u-boot/sha1.h> #include "fdt_host.h" #include "imagetool.h" @@ -44,7 +45,7 @@ static inline ulong map_to_sysmem(void *ptr) #define ALLOC_CACHE_ALIGN_BUFFER(type, name, size) type name[size] #define MKIMAGE_TMPFILE_SUFFIX ".tmp" -#define MKIMAGE_MAX_TMPFILE_LEN 256 +#define MKIMAGE_MAX_TMPFILE_LEN PATH_MAX #define MKIMAGE_DEFAULT_DTC_OPTIONS "-I dts -O dtb -p 500" #define MKIMAGE_MAX_DTC_CMDLINE_LEN 2 * MKIMAGE_MAX_TMPFILE_LEN + 35 |