diff options
author | Tom Rini <trini@konsulko.com> | 2024-12-12 16:35:47 -0600 |
---|---|---|
committer | Tom Rini <trini@konsulko.com> | 2024-12-12 16:35:47 -0600 |
commit | 1fdf53ace13f745fe8ad4d2d4e79eed98088d555 (patch) | |
tree | 94f48a0eb15db6ce3da3953ae4e6d98623d6edae /boot | |
parent | e5aef1bbf11412eebd4c242b46adff5301353c30 (diff) | |
parent | f0315babfb43c6d1f5d4ff0ea7554ec2c27bf7b1 (diff) | |
download | u-boot-1fdf53ace13f745fe8ad4d2d4e79eed98088d555.tar.gz |
Merge patch series "vbe: Series part E"
Simon Glass <sjg@chromium.org> says:
This includes various patches towards implementing the VBE abrec
bootmeth in U-Boot. It mostly focuses on SPL tweaks and adjusting what
fatures are available in VPL.
Link: https://lore.kernel.org/r/20241207172412.1124558-1-sjg@chromium.org
Diffstat (limited to 'boot')
-rw-r--r-- | boot/Kconfig | 71 | ||||
-rw-r--r-- | boot/bootdev-uclass.c | 10 | ||||
-rw-r--r-- | boot/image-fit.c | 29 |
3 files changed, 96 insertions, 14 deletions
diff --git a/boot/Kconfig b/boot/Kconfig index 99dcedcc840..20935a269c6 100644 --- a/boot/Kconfig +++ b/boot/Kconfig @@ -163,6 +163,18 @@ config SPL_FIT select SPL_HASH select SPL_OF_LIBFDT +config VPL_FIT + bool "Support Flattened Image Tree within VPL" + depends on VPL + select VPL_HASH + select VPL_OF_LIBFDT + +config TPL_FIT + bool "Support Flattened Image Tree within TPL" + depends on TPL + select TPL_HASH + select TPL_OF_LIBFDT + config SPL_FIT_PRINT bool "Support FIT printing within SPL" depends on SPL_FIT @@ -268,6 +280,28 @@ config SPL_LOAD_FIT_FULL particular it can handle selecting from multiple device tree and passing the correct one to U-Boot. +config TPL_LOAD_FIT + bool "Enable TPL loading U-Boot as a FIT (basic fitImage features)" + depends on TPL + select TPL_FIT + help + Normally with the SPL framework a legacy image is generated as part + of the build. This contains U-Boot along with information as to + where it should be loaded. This option instead enables generation + of a FIT (Flat Image Tree) which provides more flexibility. In + particular it can handle selecting from multiple device tree + and passing the correct one to U-Boot. + + This path has the following limitations: + + 1. "loadables" images, other than FDTs, which do not have a "load" + property will not be loaded. This limitation also applies to FPGA + images with the correct "compatible" string. + 2. For FPGA images, the supported "compatible" list is in the + doc/uImage.FIT/source_file_format.txt. + 3. FDTs are only loaded for images with an "os" property of "u-boot". + "linux" images are also supported with Falcon boot mode. + config SPL_FIT_IMAGE_POST_PROCESS bool "Enable post-processing of FIT artifacts after loading by the SPL" depends on SPL_LOAD_FIT @@ -292,6 +326,22 @@ config VPL_FIT select VPL_HASH select VPL_OF_LIBFDT +config VPL_LOAD_FIT + bool "Enable VPL loading U-Boot as a FIT (basic fitImage features)" + select VPL_FIT + default y + +config VPL_LOAD_FIT_FULL + bool "Enable SPL loading U-Boot as a FIT (full fitImage features)" + select VPL_FIT + help + Normally with the SPL framework a legacy image is generated as part + of the build. This contains U-Boot along with information as to + where it should be loaded. This option instead enables generation + of a FIT (Flat Image Tree) which provides more flexibility. In + particular it can handle selecting from multiple device tree + and passing the correct one to U-Boot. + config VPL_FIT_PRINT bool "Support FIT printing within VPL" depends on VPL_FIT @@ -620,6 +670,15 @@ config VPL_BOOTMETH_VBE supports selection of various firmware components, selection of an OS to boot as well as updating these using fwupd. +config TPL_BOOTMETH_VBE + bool "Bootdev support for Verified Boot for Embedded (TPL)" + depends on TPL + default y + help + Enables support for VBE boot. This is a standard boot method which + supports selection of various firmware components, seleciton of an OS to + boot as well as updating these using fwupd. + if BOOTMETH_VBE config BOOTMETH_VBE_REQUEST @@ -645,6 +704,8 @@ config SPL_BOOTMETH_VBE_REQUEST config BOOTMETH_VBE_SIMPLE bool "Bootdev support for VBE 'simple' method" default y + imply SPL_CRC8 if SPL + imply VPL_CRC8 if VPL help Enables support for VBE 'simple' boot. This allows updating a single firmware image in boot media such as MMC. It does not support any sort @@ -698,7 +759,15 @@ config VPL_BOOTMETH_VBE_SIMPLE_FW This option enabled for VPL, since it is the phase where the SPL decision is made. -endif # BOOTMETH_VBE +config TPL_BOOTMETH_VBE_SIMPLE_FW + bool "Bootdev support for VBE 'simple' method firmware phase (TPL)" + depends on VPL + default y + help + Enables support for the firmware parts of VBE 'simple' boot, in TPL. + TPL loads a FIT containing the VPL binary and a suitable devicetree. + +endif # BOOTMETH_VBE_SIMPLE config EXPO bool "Support for expos - groups of scenes displaying a UI" diff --git a/boot/bootdev-uclass.c b/boot/bootdev-uclass.c index 64ec4fde493..2e61c853142 100644 --- a/boot/bootdev-uclass.c +++ b/boot/bootdev-uclass.c @@ -16,6 +16,7 @@ #include <malloc.h> #include <part.h> #include <sort.h> +#include <spl.h> #include <dm/device-internal.h> #include <dm/lists.h> #include <dm/uclass-internal.h> @@ -278,8 +279,13 @@ int bootdev_setup_for_sibling_blk(struct udevice *blk, const char *drv_name) int ret, len; len = bootdev_get_suffix_start(blk, ".blk"); - snprintf(dev_name, sizeof(dev_name), "%.*s.%s", len, blk->name, - "bootdev"); + if (xpl_phase() < PHASE_BOARD_R) { + strlcpy(dev_name, blk->name, sizeof(dev_name) - 5); + strcat(dev_name, ".sib"); + } else { + snprintf(dev_name, sizeof(dev_name), "%.*s.%s", len, blk->name, + "bootdev"); + } parent = dev_get_parent(blk); ret = device_find_child_by_name(parent, dev_name, &dev); diff --git a/boot/image-fit.c b/boot/image-fit.c index 7d56f0b5e6e..db7fb61bca9 100644 --- a/boot/image-fit.c +++ b/boot/image-fit.c @@ -1729,13 +1729,13 @@ int fit_conf_find_compat(const void *fit, const void *fdt) images_noffset = fdt_path_offset(fit, FIT_IMAGES_PATH); if (confs_noffset < 0 || images_noffset < 0) { debug("Can't find configurations or images nodes.\n"); - return -1; + return -EINVAL; } fdt_compat = fdt_getprop(fdt, 0, "compatible", &fdt_compat_len); if (!fdt_compat) { debug("Fdt for comparison has no \"compatible\" property.\n"); - return -1; + return -ENXIO; } /* @@ -1812,7 +1812,7 @@ int fit_conf_find_compat(const void *fit, const void *fdt) } if (!best_match_offset) { debug("No match found.\n"); - return -1; + return -ENOENT; } return best_match_offset; @@ -2095,17 +2095,18 @@ int fit_image_load(struct bootm_headers *images, ulong addr, * fit_conf_get_node() will try to find default config node */ bootstage_mark(bootstage_id + BOOTSTAGE_SUB_NO_UNIT_NAME); - if (IS_ENABLED(CONFIG_FIT_BEST_MATCH) && !fit_uname_config) { - cfg_noffset = fit_conf_find_compat(fit, gd_fdt_blob()); - } else { - cfg_noffset = fit_conf_get_node(fit, fit_uname_config); - } - if (cfg_noffset < 0) { + ret = -ENXIO; + if (IS_ENABLED(CONFIG_FIT_BEST_MATCH) && !fit_uname_config) + ret = fit_conf_find_compat(fit, gd_fdt_blob()); + if (ret < 0 && ret != -EINVAL) + ret = fit_conf_get_node(fit, fit_uname_config); + if (ret < 0) { puts("Could not find configuration node\n"); bootstage_error(bootstage_id + BOOTSTAGE_SUB_NO_UNIT_NAME); return -ENOENT; } + cfg_noffset = ret; fit_base_uname_config = fdt_get_name(fit, cfg_noffset, NULL); printf(" Using '%s' configuration\n", fit_base_uname_config); @@ -2225,6 +2226,7 @@ int fit_image_load(struct bootm_headers *images, ulong addr, data = map_to_sysmem(buf); load = data; if (load_op == FIT_LOAD_IGNORED) { + log_debug("load_op: not loading\n"); /* Don't load */ } else if (fit_image_get_load(fit, noffset, &load)) { if (load_op == FIT_LOAD_REQUIRED) { @@ -2261,10 +2263,13 @@ int fit_image_load(struct bootm_headers *images, ulong addr, /* Kernel images get decompressed later in bootm_load_os(). */ if (!fit_image_get_comp(fit, noffset, &comp) && comp != IH_COMP_NONE && + load_op != FIT_LOAD_IGNORED && !(image_type == IH_TYPE_KERNEL || image_type == IH_TYPE_KERNEL_NOLOAD || image_type == IH_TYPE_RAMDISK)) { ulong max_decomp_len = len * 20; + + log_debug("decompressing image\n"); if (load == data) { loadbuf = malloc(max_decomp_len); load = map_to_sysmem(loadbuf); @@ -2279,6 +2284,7 @@ int fit_image_load(struct bootm_headers *images, ulong addr, } len = load_end - load; } else if (load != data) { + log_debug("copying\n"); loadbuf = map_sysmem(load, len); memcpy(loadbuf, buf, len); } @@ -2288,8 +2294,9 @@ int fit_image_load(struct bootm_headers *images, ulong addr, " please fix your .its file!\n"); /* verify that image data is a proper FDT blob */ - if (image_type == IH_TYPE_FLATDT && fdt_check_header(loadbuf)) { - puts("Subimage data is not a FDT"); + if (load_op != FIT_LOAD_IGNORED && image_type == IH_TYPE_FLATDT && + fdt_check_header(loadbuf)) { + puts("Subimage data is not a FDT\n"); return -ENOEXEC; } |