summaryrefslogtreecommitdiff
path: root/boot
diff options
context:
space:
mode:
authorTom Rini <trini@konsulko.com>2023-01-09 11:30:08 -0500
committerTom Rini <trini@konsulko.com>2023-01-09 11:30:08 -0500
commitcebdfc22da6eb81793b616e855bc4d6d89c1c7a6 (patch)
tree44eaafcbe4866712d361304882e7d56ca0ef1682 /boot
parent62e2ad1ceafbfdf2c44d3dc1b6efc81e768a96b9 (diff)
parentfe33066d246462551f385f204690a11018336ac8 (diff)
downloadu-boot-cebdfc22da6eb81793b616e855bc4d6d89c1c7a6.tar.gz
u-boot-cebdfc22da6eb81793b616e855bc4d6d89c1c7a6.tar.bz2
u-boot-cebdfc22da6eb81793b616e855bc4d6d89c1c7a6.zip
Merge branch 'next'
Signed-off-by: Tom Rini <trini@konsulko.com>
Diffstat (limited to 'boot')
-rw-r--r--boot/Kconfig31
-rw-r--r--boot/bootm.c3
-rw-r--r--boot/bootmeth_script.c2
-rw-r--r--boot/image-board.c8
-rw-r--r--boot/image.c1
-rw-r--r--boot/pxe_utils.c74
6 files changed, 65 insertions, 54 deletions
diff --git a/boot/Kconfig b/boot/Kconfig
index 424ad0e466..30bc182fcd 100644
--- a/boot/Kconfig
+++ b/boot/Kconfig
@@ -36,10 +36,9 @@ config TIMESTAMP
loaded that does not, the message 'Wrong FIT format: no timestamp'
is shown.
-if FIT
-
config FIT_EXTERNAL_OFFSET
hex "FIT external data offset"
+ depends on FIT
default 0x0
help
This specifies a data offset in fit image.
@@ -50,6 +49,7 @@ config FIT_EXTERNAL_OFFSET
config FIT_FULL_CHECK
bool "Do a full check of the FIT before using it"
+ depends on FIT
default y
help
Enable this do a full check of the FIT to make sure it is valid. This
@@ -59,7 +59,7 @@ config FIT_FULL_CHECK
config FIT_SIGNATURE
bool "Enable signature verification of FIT uImages"
- depends on DM
+ depends on DM && FIT
select HASH
imply RSA
imply RSA_VERIFY
@@ -97,7 +97,7 @@ config FIT_RSASSA_PSS
config FIT_CIPHER
bool "Enable ciphering data in a FIT uImages"
- depends on DM
+ depends on DM && FIT
select AES
help
Enable the feature of data ciphering/unciphering in the tool mkimage
@@ -105,6 +105,7 @@ config FIT_CIPHER
config FIT_VERBOSE
bool "Show verbose messages when FIT images fail"
+ depends on FIT
help
Generally a system will have valid FIT images so debug messages
are a waste of code space. If you are debugging your images then
@@ -113,6 +114,7 @@ config FIT_VERBOSE
config FIT_BEST_MATCH
bool "Select the best match for the kernel device tree"
+ depends on FIT
help
When no configuration is explicitly selected, default to the
one whose fdt's compatibility field best matches that of
@@ -122,6 +124,7 @@ config FIT_BEST_MATCH
config FIT_IMAGE_POST_PROCESS
bool "Enable post-processing of FIT artifacts after loading by U-Boot"
+ depends on FIT
depends on TI_SECURE_DEVICE || SOCFPGA_SECURE_VAB_AUTH
default y if TI_SECURE_DEVICE
help
@@ -137,15 +140,14 @@ config FIT_IMAGE_POST_PROCESS
config FIT_PRINT
bool "Support FIT printing"
+ depends on FIT
default y
help
Support printing the content of the fitImage in a verbose manner.
-if SPL
-
config SPL_FIT
bool "Support Flattened Image Tree within SPL"
- depends on SPL
+ depends on SPL && FIT
select SPL_HASH
select SPL_OF_LIBFDT
@@ -157,13 +159,13 @@ config SPL_FIT_PRINT
config SPL_FIT_FULL_CHECK
bool "Do a full check of the FIT before using it"
+ depends on SPL_FIT
help
Enable this do a full check of the FIT to make sure it is valid. This
helps to protect against carefully crafted FITs which take advantage
of bugs or omissions in the code. This includes a bad structure,
multiple root nodes and the like.
-
config SPL_FIT_SIGNATURE
bool "Enable signature verification of FIT firmware within SPL"
depends on SPL_DM
@@ -196,6 +198,7 @@ config SPL_FIT_RSASSA_PSS
config SPL_LOAD_FIT
bool "Enable SPL loading U-Boot as a FIT (basic fitImage features)"
+ depends on SPL && FIT
select SPL_FIT
help
Normally with the SPL framework a legacy image is generated as part
@@ -217,7 +220,7 @@ config SPL_LOAD_FIT
config SPL_LOAD_FIT_ADDRESS
hex "load address of fit image"
- depends on SPL_LOAD_FIT
+ depends on SPL_LOAD_FIT || SPL_RAM_SUPPORT || TPL_RAM_SUPPORT
default 0x0
help
Specify the load address of the fit image that will be loaded
@@ -243,6 +246,7 @@ config SPL_LOAD_FIT_APPLY_OVERLAY_BUF_SZ
config SPL_LOAD_FIT_FULL
bool "Enable SPL loading U-Boot as a FIT (full fitImage features)"
+ depends on FIT
select SPL_FIT
help
Normally with the SPL framework a legacy image is generated as part
@@ -277,7 +281,8 @@ config SPL_FIT_SOURCE
config USE_SPL_FIT_GENERATOR
bool "Use a script to generate the .its script"
- default y if SPL_FIT && (!ARCH_SUNXI && !RISCV)
+ depends on SPL_FIT
+ default y if !ARCH_SUNXI && !RISCV
config SPL_FIT_GENERATOR
string ".its file generator script for U-Boot FIT image"
@@ -290,8 +295,6 @@ config SPL_FIT_GENERATOR
passed a list of supported device tree file stub names to
include in the generated image.
-endif # SPL
-
if VPL
config VPL_FIT
@@ -342,8 +345,6 @@ config VPL_FIT_SIGNATURE_MAX_SIZE
endif # VPL
-endif # FIT
-
config PXE_UTILS
bool
select MENU
@@ -654,7 +655,7 @@ config SYS_MONITOR_BASE
default TEXT_BASE
help
The physical start address of boot monitor code (which is the same as
- CONFIG_TEXT_BASE when linking) and the same as CONFIG_SYS_FLASH_BASE
+ CONFIG_TEXT_BASE when linking) and the same as CFG_SYS_FLASH_BASE
when booting from flash.
config SPL_SYS_MONITOR_BASE
diff --git a/boot/bootm.c b/boot/bootm.c
index a4c0870c0f..15fce8ad95 100644
--- a/boot/bootm.c
+++ b/boot/bootm.c
@@ -475,9 +475,6 @@ ulong bootm_disable_interrupts(void)
#ifdef CONFIG_NETCONSOLE
/* Stop the ethernet stack if NetConsole could have left it up */
eth_halt();
-# ifndef CONFIG_DM_ETH
- eth_unregister(eth_get_dev());
-# endif
#endif
#if defined(CONFIG_CMD_USB)
diff --git a/boot/bootmeth_script.c b/boot/bootmeth_script.c
index d1c3f94003..6c84721d1c 100644
--- a/boot/bootmeth_script.c
+++ b/boot/bootmeth_script.c
@@ -101,7 +101,7 @@ static int script_boot(struct udevice *dev, struct bootflow *bflow)
log_debug("mmc_bootdev: %s\n", env_get("mmc_bootdev"));
addr = map_to_sysmem(bflow->buf);
- ret = image_source_script(addr, NULL);
+ ret = image_source_script(addr, NULL, NULL);
if (ret)
return log_msg_ret("boot", ret);
diff --git a/boot/image-board.c b/boot/image-board.c
index 34d1e5f18b..0fd63291d3 100644
--- a/boot/image-board.c
+++ b/boot/image-board.c
@@ -116,8 +116,8 @@ ulong env_get_bootm_low(void)
return tmp;
}
-#if defined(CONFIG_SYS_SDRAM_BASE)
- return CONFIG_SYS_SDRAM_BASE;
+#if defined(CFG_SYS_SDRAM_BASE)
+ return CFG_SYS_SDRAM_BASE;
#elif defined(CONFIG_ARM) || defined(CONFIG_MICROBLAZE) || defined(CONFIG_RISCV)
return gd->bd->bi_dram[0].start;
#else
@@ -161,8 +161,8 @@ phys_size_t env_get_bootm_mapsize(void)
return tmp;
}
-#if defined(CONFIG_SYS_BOOTMAPSZ)
- return CONFIG_SYS_BOOTMAPSZ;
+#if defined(CFG_SYS_BOOTMAPSZ)
+ return CFG_SYS_BOOTMAPSZ;
#else
return env_get_bootm_size();
#endif
diff --git a/boot/image.c b/boot/image.c
index b33d1dfc6b..958dbf8534 100644
--- a/boot/image.c
+++ b/boot/image.c
@@ -180,6 +180,7 @@ static const table_entry_t uimage_type[] = {
{ IH_TYPE_COPRO, "copro", "Coprocessor Image"},
{ IH_TYPE_SUNXI_EGON, "sunxi_egon", "Allwinner eGON Boot Image" },
{ IH_TYPE_SUNXI_TOC0, "sunxi_toc0", "Allwinner TOC0 Boot Image" },
+ { IH_TYPE_FDT_LEGACY, "fdt_legacy", "legacy Image with Flat Device Tree ", },
{ -1, "", "", },
};
diff --git a/boot/pxe_utils.c b/boot/pxe_utils.c
index 099aa2f4bc..3a1e50f2b1 100644
--- a/boot/pxe_utils.c
+++ b/boot/pxe_utils.c
@@ -258,6 +258,7 @@ static struct pxe_label *label_create(void)
static void label_destroy(struct pxe_label *label)
{
free(label->name);
+ free(label->kernel_label);
free(label->kernel);
free(label->config);
free(label->append);
@@ -521,28 +522,44 @@ static int label_boot(struct pxe_context *ctx, struct pxe_label *label)
return 1;
}
- if (label->initrd) {
- ulong size;
+ if (get_relfile_envaddr(ctx, label->kernel, "kernel_addr_r",
+ NULL) < 0) {
+ printf("Skipping %s for failure retrieving kernel\n",
+ label->name);
+ return 1;
+ }
+
+ kernel_addr = env_get("kernel_addr_r");
+ /* for FIT, append the configuration identifier */
+ if (label->config) {
+ int len = strlen(kernel_addr) + strlen(label->config) + 1;
+
+ fit_addr = malloc(len);
+ if (!fit_addr) {
+ printf("malloc fail (FIT address)\n");
+ return 1;
+ }
+ snprintf(fit_addr, len, "%s%s", kernel_addr, label->config);
+ kernel_addr = fit_addr;
+ }
+ /* For FIT, the label can be identical to kernel one */
+ if (label->initrd && !strcmp(label->kernel_label, label->initrd)) {
+ initrd_addr_str = kernel_addr;
+ } else if (label->initrd) {
+ ulong size;
if (get_relfile_envaddr(ctx, label->initrd, "ramdisk_addr_r",
&size) < 0) {
printf("Skipping %s for failure retrieving initrd\n",
label->name);
- return 1;
+ goto cleanup;
}
initrd_addr_str = env_get("ramdisk_addr_r");
size = snprintf(initrd_str, sizeof(initrd_str), "%s:%lx",
initrd_addr_str, size);
if (size >= sizeof(initrd_str))
- return 1;
- }
-
- if (get_relfile_envaddr(ctx, label->kernel, "kernel_addr_r",
- NULL) < 0) {
- printf("Skipping %s for failure retrieving kernel\n",
- label->name);
- return 1;
+ goto cleanup;
}
if (label->ipappend & 0x1) {
@@ -572,7 +589,7 @@ static int label_boot(struct pxe_context *ctx, struct pxe_label *label)
strlen(label->append ?: ""),
strlen(ip_str), strlen(mac_str),
sizeof(bootargs));
- return 1;
+ goto cleanup;
}
if (label->append)
@@ -587,21 +604,6 @@ static int label_boot(struct pxe_context *ctx, struct pxe_label *label)
printf("append: %s\n", finalbootargs);
}
- kernel_addr = env_get("kernel_addr_r");
-
- /* for FIT, append the configuration identifier */
- if (label->config) {
- int len = strlen(kernel_addr) + strlen(label->config) + 1;
-
- fit_addr = malloc(len);
- if (!fit_addr) {
- printf("malloc fail (FIT address)\n");
- return 1;
- }
- snprintf(fit_addr, len, "%s%s", kernel_addr, label->config);
- kernel_addr = fit_addr;
- }
-
/*
* fdt usage is optional:
* It handles the following scenarios.
@@ -623,8 +625,11 @@ static int label_boot(struct pxe_context *ctx, struct pxe_label *label)
*/
bootm_argv[3] = env_get("fdt_addr_r");
+ /* For FIT, the label can be identical to kernel one */
+ if (label->fdt && !strcmp(label->kernel_label, label->fdt)) {
+ bootm_argv[3] = kernel_addr;
/* if fdt label is defined then get fdt from server */
- if (bootm_argv[3]) {
+ } else if (bootm_argv[3]) {
char *fdtfile = NULL;
char *fdtfilefree = NULL;
@@ -1166,15 +1171,19 @@ static int parse_label_kernel(char **c, struct pxe_label *label)
if (err < 0)
return err;
+ /* copy the kernel label to compare with FDT / INITRD when FIT is used */
+ label->kernel_label = strdup(label->kernel);
+ if (!label->kernel_label)
+ return -ENOMEM;
+
s = strstr(label->kernel, "#");
if (!s)
return 1;
- label->config = malloc(strlen(s) + 1);
+ label->config = strdup(s);
if (!label->config)
return -ENOMEM;
- strcpy(label->config, s);
*s = 0;
return 1;
@@ -1360,7 +1369,10 @@ static int parse_pxefile_top(struct pxe_context *ctx, char *p, unsigned long bas
break;
case T_PROMPT:
- eol_or_eof(&p);
+ err = parse_integer(&p, &cfg->prompt);
+ // Do not fail if prompt configuration is undefined
+ if (err < 0)
+ eol_or_eof(&p);
break;
case T_EOL: