[U-Boot] [PATCH PATCH v3 00/12] Add support for applications of overlays in SPL

The purpose of this series is to provide the SPL with ability to apply overlays for u-boot. this is only a RFC so far, to get a feedback on the approach.
Our use-case is the support of the daughter boards of the AM65x EVM. In Linux, each board is supported by a unique overlay. The presence of the boards is detected at runtime, and some useful features (like USB) are implemented on those daughter boards. Instead of providing multiple dtbs and fall in a combinatorial pit, we propose to use DT overlays.
Patch #1 "spl: fit: Add support for applying DT overlay" has been posted a few weeks ago by Michal Simek. Patch #2 to #5 amend Michal's patch. Patch #6 to #8 are simple fixes for the Makefile Patch #9 is not required but relates to this series and will be required later by the AM6x platform Patch #10 is used to reduce the complexity of the Makefile by having FIT generator scripts provide their dependencies Patch #12 adds a way to dynamically select the DT overlays. That is were we would use HW detection to select the required overlays. In that case, the board-level code tells what overlay it needs (it gives the name of the node).
On arm, if overlay are supported, this series increases the size of the SPL by 3.2 kB.
Travis build : https://travis-ci.org/jjhiblot/u-boot/builds/535686392 For a strange reason, buildman on travis show errors for sun8i ans sun50i, but pass when I run it locally.
Changes in v3: - Add a new config option: SPL_LOAD_FIT_APPLY_OVERLAY. By default, it is not selected. - removed the RFC prefix. This work will be needed soon by TI's AM65x platform. and can probably benefit other modular platforms - removed the last patch that provided an example of how to use this with on a DRA76. - removed the patch that made u-boot.img a symlink to u-boot.itb because it breaks the build of many platforms (because files required to build the ITB are missing) - removed the patch to reduce the footprint of the am335x SPL. (already merged) - Made the boot flow more permissive (don't fail immediately if an overlay is not present) and more verbose when an error occures - handle the dependencies of the FIT generation in a more generic way - use a dedicated kconfig option to enable the application of the overlays by the SPL.
Changes in v2: - reworked board_fit_get_additionnal_images() and how it used in spl_fit.c - removed dtbo generation from dtso files and use .dts extension for the overlays - add dynamic allocation usage in a separate patch - defconfig change for the am335x_evm
Jean-Jacques Hiblot (11): spl: fit: Make room in the FDT before applying overlays spl: fit: allocate a temporary buffer to load the overlays spl: fit: Do not fail immediately if an overlay is not available spl: fit: be more verbose when an error occurs when applying the overlays Makefile.lib: include /__symbols__ in dtb if SPL_LOAD_FIT_APPLY_OVERLAY is enabled Makefile: Fix tests for CONFIG_SPL_LOAD_FIT and CONFIG_SPL_FIT_GENERATOR Makefile: Fix u-boot.itb generation when building outside the source tree Makefile: Pass the board name to the FIT generator scripts Makefile: Query the SPL Fit Generator for its dependencies spl: fit: constify the output parameter of spl_fit_get_image_name() spl: fit: Allow the board to tell if more images must be loaded from FIT
Michal Simek (1): spl: fit: Add support for applying DT overlay
Kconfig | 10 +++ Makefile | 23 +++-- arch/arm/mach-imx/mkimage_fit_atf.sh | 10 ++- arch/arm/mach-rockchip/make_fit_atf.py | 13 ++- board/sunxi/mksunxi_fit_atf.sh | 7 ++ .../lion_rk3368/fit_spl_atf.its | 6 +- .../puma_rk3399/fit_spl_atf.its | 8 +- common/spl/spl_fit.c | 90 +++++++++++++++++-- include/spl.h | 16 ++++ scripts/Makefile.lib | 4 + 10 files changed, 156 insertions(+), 31 deletions(-)

From: Michal Simek michal.simek@xilinx.com
doc/uImage.FIT/overlay-fdt-boot.txt is describing how to create FIT image with DT overlays in it. Add support for this feature to SPL.
Here is the ZynqMP fragment where dtb points to full DT and dtbo is overlay which should be applied on the top of dtb. config { description = "ATF with full u-boot overlay"; firmware = "atf"; loadables = "uboot"; fdt = "dtb", "dtbo"; };
The whole feature depends on OF_LIBFDT_OVERLAY which is adding +4kB code and 0 for platforms which are not enabling this feature.
Signed-off-by: Michal Simek michal.simek@xilinx.com Signed-off-by: Jean-Jacques Hiblot jjhiblot@ti.com
---
Changes in v3: - Add a new config option: SPL_LOAD_FIT_APPLY_OVERLAY. By default, it is not selected.
Changes in v2: None
Kconfig | 10 ++++++++++ common/spl/spl_fit.c | 27 +++++++++++++++++++++++++-- 2 files changed, 35 insertions(+), 2 deletions(-)
diff --git a/Kconfig b/Kconfig index 5f5c5ccfd6..8197c9066a 100644 --- a/Kconfig +++ b/Kconfig @@ -398,6 +398,16 @@ config SPL_LOAD_FIT particular it can handle selecting from multiple device tree and passing the correct one to U-Boot.
+config SPL_LOAD_FIT_APPLY_OVERLAY + bool "Enable SPL applying DT overlays from FIT" + depends on SPL_LOAD_FIT + select OF_LIBFDT_OVERLAY + default n + help + The device tree is loaded from the FIT image. Allow the SPL is to + also load device-tree overlays from the FIT image an apply them + over the device tree. + config SPL_LOAD_FIT_FULL bool "Enable SPL loading U-Boot as a FIT" select SPL_FIT diff --git a/common/spl/spl_fit.c b/common/spl/spl_fit.c index 87ecf0bb9e..3fbcb969f8 100644 --- a/common/spl/spl_fit.c +++ b/common/spl/spl_fit.c @@ -278,10 +278,10 @@ static int spl_fit_append_fdt(struct spl_image_info *spl_image, void *fit, int images, ulong base_offset) { struct spl_image_info image_info; - int node, ret; + int node, ret, index = 0;
/* Figure out which device tree the board wants to use */ - node = spl_fit_get_image_node(fit, images, FIT_FDT_PROP, 0); + node = spl_fit_get_image_node(fit, images, FIT_FDT_PROP, index++); if (node < 0) { debug("%s: cannot find FDT node\n", __func__); return node; @@ -303,8 +303,31 @@ static int spl_fit_append_fdt(struct spl_image_info *spl_image, #if !CONFIG_IS_ENABLED(FIT_IMAGE_TINY) /* Try to make space, so we can inject details on the loadables */ ret = fdt_shrink_to_minimum(spl_image->fdt_addr, 8192); + if (ret < 0) + return ret; #endif +#if defined(CONFIG_SPL_LOAD_FIT_APPLY_OVERLAY) + for (; ; index++) { + node = spl_fit_get_image_node(fit, images, FIT_FDT_PROP, index); + if (node < 0) { + debug("%s: No additional FDT node\n", __func__); + return 0; + }
+ ret = spl_load_fit_image(info, sector, fit, base_offset, node, + &image_info); + if (ret < 0) + return ret; + + ret = fdt_overlay_apply_verbose(spl_image->fdt_addr, + (void *)image_info.load_addr); + if (ret) + return ret; + + debug("%s: DT overlay %s applied\n", __func__, + fit_get_name(fit, node, NULL)); + } +#endif return ret; }

On 23. 05. 19 12:39, Jean-Jacques Hiblot wrote:
From: Michal Simek michal.simek@xilinx.com
doc/uImage.FIT/overlay-fdt-boot.txt is describing how to create FIT image with DT overlays in it. Add support for this feature to SPL.
Here is the ZynqMP fragment where dtb points to full DT and dtbo is overlay which should be applied on the top of dtb. config { description = "ATF with full u-boot overlay"; firmware = "atf"; loadables = "uboot"; fdt = "dtb", "dtbo"; };
The whole feature depends on OF_LIBFDT_OVERLAY which is adding +4kB code and 0 for platforms which are not enabling this feature.
Signed-off-by: Michal Simek michal.simek@xilinx.com Signed-off-by: Jean-Jacques Hiblot jjhiblot@ti.com
Changes in v3:
- Add a new config option: SPL_LOAD_FIT_APPLY_OVERLAY. By default, it is
not selected.
Changes in v2: None
Kconfig | 10 ++++++++++ common/spl/spl_fit.c | 27 +++++++++++++++++++++++++-- 2 files changed, 35 insertions(+), 2 deletions(-)
diff --git a/Kconfig b/Kconfig index 5f5c5ccfd6..8197c9066a 100644 --- a/Kconfig +++ b/Kconfig @@ -398,6 +398,16 @@ config SPL_LOAD_FIT particular it can handle selecting from multiple device tree and passing the correct one to U-Boot.
+config SPL_LOAD_FIT_APPLY_OVERLAY
- bool "Enable SPL applying DT overlays from FIT"
- depends on SPL_LOAD_FIT
- select OF_LIBFDT_OVERLAY
- default n
- help
The device tree is loaded from the FIT image. Allow the SPL is to
also load device-tree overlays from the FIT image an apply them
over the device tree.
config SPL_LOAD_FIT_FULL bool "Enable SPL loading U-Boot as a FIT" select SPL_FIT diff --git a/common/spl/spl_fit.c b/common/spl/spl_fit.c index 87ecf0bb9e..3fbcb969f8 100644 --- a/common/spl/spl_fit.c +++ b/common/spl/spl_fit.c @@ -278,10 +278,10 @@ static int spl_fit_append_fdt(struct spl_image_info *spl_image, void *fit, int images, ulong base_offset) { struct spl_image_info image_info;
- int node, ret;
int node, ret, index = 0;
/* Figure out which device tree the board wants to use */
- node = spl_fit_get_image_node(fit, images, FIT_FDT_PROP, 0);
- node = spl_fit_get_image_node(fit, images, FIT_FDT_PROP, index++); if (node < 0) { debug("%s: cannot find FDT node\n", __func__); return node;
@@ -303,8 +303,31 @@ static int spl_fit_append_fdt(struct spl_image_info *spl_image, #if !CONFIG_IS_ENABLED(FIT_IMAGE_TINY) /* Try to make space, so we can inject details on the loadables */ ret = fdt_shrink_to_minimum(spl_image->fdt_addr, 8192);
- if (ret < 0)
return ret;
#endif +#if defined(CONFIG_SPL_LOAD_FIT_APPLY_OVERLAY)
for (; ; index++) {
node = spl_fit_get_image_node(fit, images, FIT_FDT_PROP, index);
if (node < 0) {
debug("%s: No additional FDT node\n", __func__);
return 0;
}
ret = spl_load_fit_image(info, sector, fit, base_offset, node,
&image_info);
if (ret < 0)
return ret;
ret = fdt_overlay_apply_verbose(spl_image->fdt_addr,
(void *)image_info.load_addr);
if (ret)
return ret;
debug("%s: DT overlay %s applied\n", __func__,
fit_get_name(fit, node, NULL));
}
+#endif return ret; }
It looks like that something has been fixed in mainline that travis is passing now when this patch is applied.. Thanks for taking this forward.
I will look at the rest of patches next week.
Thanks, Michal

On Thu, 23 May 2019 at 11:39, Jean-Jacques Hiblot jjhiblot@ti.com wrote:
From: Michal Simek michal.simek@xilinx.com
doc/uImage.FIT/overlay-fdt-boot.txt is describing how to create FIT image with DT overlays in it. Add support for this feature to SPL.
Here is the ZynqMP fragment where dtb points to full DT and dtbo is overlay which should be applied on the top of dtb. config { description = "ATF with full u-boot overlay"; firmware = "atf"; loadables = "uboot"; fdt = "dtb", "dtbo"; };
The whole feature depends on OF_LIBFDT_OVERLAY which is adding +4kB code and 0 for platforms which are not enabling this feature.
Signed-off-by: Michal Simek michal.simek@xilinx.com Signed-off-by: Jean-Jacques Hiblot jjhiblot@ti.com
Changes in v3:
- Add a new config option: SPL_LOAD_FIT_APPLY_OVERLAY. By default, it is
not selected.
Changes in v2: None
Kconfig | 10 ++++++++++ common/spl/spl_fit.c | 27 +++++++++++++++++++++++++-- 2 files changed, 35 insertions(+), 2 deletions(-)
Reviewed-by: Simon Glass sjg@chromium.org
nits below
diff --git a/Kconfig b/Kconfig index 5f5c5ccfd6..8197c9066a 100644 --- a/Kconfig +++ b/Kconfig @@ -398,6 +398,16 @@ config SPL_LOAD_FIT particular it can handle selecting from multiple device tree and passing the correct one to U-Boot.
+config SPL_LOAD_FIT_APPLY_OVERLAY
bool "Enable SPL applying DT overlays from FIT"
depends on SPL_LOAD_FIT
select OF_LIBFDT_OVERLAY
default n
this is the default anyway so you can omit this line
help
The device tree is loaded from the FIT image. Allow the SPL is to
also load device-tree overlays from the FIT image an apply them
over the device tree.
Where are the instructions for this? At least add a pointer to a README somewhere else.
config SPL_LOAD_FIT_FULL bool "Enable SPL loading U-Boot as a FIT" select SPL_FIT diff --git a/common/spl/spl_fit.c b/common/spl/spl_fit.c index 87ecf0bb9e..3fbcb969f8 100644 --- a/common/spl/spl_fit.c +++ b/common/spl/spl_fit.c @@ -278,10 +278,10 @@ static int spl_fit_append_fdt(struct spl_image_info *spl_image, void *fit, int images, ulong base_offset) { struct spl_image_info image_info;
int node, ret;
int node, ret, index = 0; /* Figure out which device tree the board wants to use */
node = spl_fit_get_image_node(fit, images, FIT_FDT_PROP, 0);
node = spl_fit_get_image_node(fit, images, FIT_FDT_PROP, index++); if (node < 0) { debug("%s: cannot find FDT node\n", __func__); return node;
@@ -303,8 +303,31 @@ static int spl_fit_append_fdt(struct spl_image_info *spl_image, #if !CONFIG_IS_ENABLED(FIT_IMAGE_TINY) /* Try to make space, so we can inject details on the loadables */ ret = fdt_shrink_to_minimum(spl_image->fdt_addr, 8192);
if (ret < 0)
return ret;
#endif +#if defined(CONFIG_SPL_LOAD_FIT_APPLY_OVERLAY)
Can you use if (CONFIG_IS_ENABLED()) so that this builds with sandbox?
Actually we should really enable this with sandbox, too, so we can add a test.
for (; ; index++) {
node = spl_fit_get_image_node(fit, images, FIT_FDT_PROP, index);
if (node < 0) {
debug("%s: No additional FDT node\n", __func__);
return 0;
}
ret = spl_load_fit_image(info, sector, fit, base_offset, node,
&image_info);
if (ret < 0)
return ret;
ret = fdt_overlay_apply_verbose(spl_image->fdt_addr,
(void *)image_info.load_addr);
if (ret)
return ret;
debug("%s: DT overlay %s applied\n", __func__,
fit_get_name(fit, node, NULL));
}
+#endif return ret; }
-- 2.17.1
Regards, Simon

Make room in the FDT before applying the overlay, otherwise it may fail if the overlay is big. As the exact added size is not known in advance, just add the size of the overlay. Move after the end of the application of the overlays, the resize of the FDT for the injection of the details on the loadables.
Signed-off-by: Jean-Jacques Hiblot jjhiblot@ti.com ---
Changes in v3: None Changes in v2: None
common/spl/spl_fit.c | 16 +++++++++++----- 1 file changed, 11 insertions(+), 5 deletions(-)
diff --git a/common/spl/spl_fit.c b/common/spl/spl_fit.c index 3fbcb969f8..c1c982f002 100644 --- a/common/spl/spl_fit.c +++ b/common/spl/spl_fit.c @@ -301,11 +301,6 @@ static int spl_fit_append_fdt(struct spl_image_info *spl_image, /* Make the load-address of the FDT available for the SPL framework */ spl_image->fdt_addr = (void *)image_info.load_addr; #if !CONFIG_IS_ENABLED(FIT_IMAGE_TINY) - /* Try to make space, so we can inject details on the loadables */ - ret = fdt_shrink_to_minimum(spl_image->fdt_addr, 8192); - if (ret < 0) - return ret; -#endif #if defined(CONFIG_SPL_LOAD_FIT_APPLY_OVERLAY) for (; ; index++) { node = spl_fit_get_image_node(fit, images, FIT_FDT_PROP, index); @@ -319,6 +314,11 @@ static int spl_fit_append_fdt(struct spl_image_info *spl_image, if (ret < 0) return ret;
+ /* Make room in FDT for changes coming from the overlay */ + ret = fdt_increase_size(spl_image->fdt_addr, image_info.size); + if (ret < 0) + return ret; + ret = fdt_overlay_apply_verbose(spl_image->fdt_addr, (void *)image_info.load_addr); if (ret) @@ -328,6 +328,12 @@ static int spl_fit_append_fdt(struct spl_image_info *spl_image, fit_get_name(fit, node, NULL)); } #endif + /* Try to make space, so we can inject details on the loadables */ + ret = fdt_shrink_to_minimum(spl_image->fdt_addr, 8192); + if (ret < 0) + return ret; +#endif + return ret; }

On Thu, 23 May 2019 at 11:39, Jean-Jacques Hiblot jjhiblot@ti.com wrote:
Make room in the FDT before applying the overlay, otherwise it may fail if the overlay is big. As the exact added size is not known in advance, just add the size of the overlay. Move after the end of the application of the overlays, the resize of the FDT for the injection of the details on the loadables.
Signed-off-by: Jean-Jacques Hiblot jjhiblot@ti.com
Changes in v3: None Changes in v2: None
common/spl/spl_fit.c | 16 +++++++++++----- 1 file changed, 11 insertions(+), 5 deletions(-)
Reviewed-by: Simon Glass sjg@chromium.org

If the node describing an overlay does not specify a load address, it will be loaded at the address previously used. Fixing it by allocating a temporary 64kB region that will be used as a default load address.
Signed-off-by: Jean-Jacques Hiblot jjhiblot@ti.com ---
Changes in v3: None Changes in v2: None
common/spl/spl_fit.c | 14 ++++++++++++++ 1 file changed, 14 insertions(+)
diff --git a/common/spl/spl_fit.c b/common/spl/spl_fit.c index c1c982f002..b521ee68e6 100644 --- a/common/spl/spl_fit.c +++ b/common/spl/spl_fit.c @@ -9,6 +9,7 @@ #include <fpga.h> #include <image.h> #include <linux/libfdt.h> +#include <malloc.h> #include <spl.h>
#ifndef CONFIG_SYS_BOOTM_LEN @@ -302,6 +303,16 @@ static int spl_fit_append_fdt(struct spl_image_info *spl_image, spl_image->fdt_addr = (void *)image_info.load_addr; #if !CONFIG_IS_ENABLED(FIT_IMAGE_TINY) #if defined(CONFIG_SPL_LOAD_FIT_APPLY_OVERLAY) + void *tmpbuffer; + /* + * allocate 64kB of memory. This will be used to store the DT overlay + * before it is applied. It may not be used depending on how the + * overlay is stored. + */ + tmpbuffer = malloc(64 * 1024); + if (!tmpbuffer) + debug("%s: unable to allocate space for overlays\n", __func__); + for (; ; index++) { node = spl_fit_get_image_node(fit, images, FIT_FDT_PROP, index); if (node < 0) { @@ -309,6 +320,7 @@ static int spl_fit_append_fdt(struct spl_image_info *spl_image, return 0; }
+ image_info.load_addr = (ulong)tmpbuffer; ret = spl_load_fit_image(info, sector, fit, base_offset, node, &image_info); if (ret < 0) @@ -327,6 +339,8 @@ static int spl_fit_append_fdt(struct spl_image_info *spl_image, debug("%s: DT overlay %s applied\n", __func__, fit_get_name(fit, node, NULL)); } + if (tmpbuffer) + free(tmpbuffer); #endif /* Try to make space, so we can inject details on the loadables */ ret = fdt_shrink_to_minimum(spl_image->fdt_addr, 8192);

Hi Jean-Jacques,
On Thu, 23 May 2019 at 11:39, Jean-Jacques Hiblot jjhiblot@ti.com wrote:
If the node describing an overlay does not specify a load address, it will be loaded at the address previously used. Fixing it by allocating a temporary 64kB region that will be used as a default load address.
Signed-off-by: Jean-Jacques Hiblot jjhiblot@ti.com
Changes in v3: None Changes in v2: None
common/spl/spl_fit.c | 14 ++++++++++++++ 1 file changed, 14 insertions(+)
diff --git a/common/spl/spl_fit.c b/common/spl/spl_fit.c index c1c982f002..b521ee68e6 100644 --- a/common/spl/spl_fit.c +++ b/common/spl/spl_fit.c @@ -9,6 +9,7 @@ #include <fpga.h> #include <image.h> #include <linux/libfdt.h>
should go at end
+#include <malloc.h> #include <spl.h>
#ifndef CONFIG_SYS_BOOTM_LEN @@ -302,6 +303,16 @@ static int spl_fit_append_fdt(struct spl_image_info *spl_image, spl_image->fdt_addr = (void *)image_info.load_addr; #if !CONFIG_IS_ENABLED(FIT_IMAGE_TINY) #if defined(CONFIG_SPL_LOAD_FIT_APPLY_OVERLAY)
void *tmpbuffer;
/*
* allocate 64kB of memory. This will be used to store the DT overlay
64KB
* before it is applied. It may not be used depending on how the
* overlay is stored.
*/
tmpbuffer = malloc(64 * 1024);
if (!tmpbuffer)
debug("%s: unable to allocate space for overlays\n", __func__);
Need to return an error here I think
for (; ; index++) { node = spl_fit_get_image_node(fit, images, FIT_FDT_PROP, index); if (node < 0) {
@@ -309,6 +320,7 @@ static int spl_fit_append_fdt(struct spl_image_info *spl_image, return 0; }
image_info.load_addr = (ulong)tmpbuffer; ret = spl_load_fit_image(info, sector, fit, base_offset, node, &image_info); if (ret < 0)
@@ -327,6 +339,8 @@ static int spl_fit_append_fdt(struct spl_image_info *spl_image, debug("%s: DT overlay %s applied\n", __func__, fit_get_name(fit, node, NULL)); }
if (tmpbuffer)
free(tmpbuffer);
Is this buffer freed if there is an error?
#endif /* Try to make space, so we can inject details on the loadables */ ret = fdt_shrink_to_minimum(spl_image->fdt_addr, 8192); -- 2.17.1
Regards, Simon

If one overlay that must be applied cannot be found in the FIT, the current implementation stops applying the overlays. Let's make it skip only the failing overlay instead.
Signed-off-by: Jean-Jacques Hiblot jjhiblot@ti.com ---
Changes in v3: None Changes in v2: None
common/spl/spl_fit.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-)
diff --git a/common/spl/spl_fit.c b/common/spl/spl_fit.c index b521ee68e6..d5e3858ed0 100644 --- a/common/spl/spl_fit.c +++ b/common/spl/spl_fit.c @@ -315,9 +315,13 @@ static int spl_fit_append_fdt(struct spl_image_info *spl_image,
for (; ; index++) { node = spl_fit_get_image_node(fit, images, FIT_FDT_PROP, index); - if (node < 0) { + if (node == -E2BIG) { debug("%s: No additional FDT node\n", __func__); return 0; + } else if (node < 0) { + debug("%s: unable to find FDT node %d\n", __func__, + index); + continue; }
image_info.load_addr = (ulong)tmpbuffer;

On Thu, 23 May 2019 at 11:39, Jean-Jacques Hiblot jjhiblot@ti.com wrote:
If one overlay that must be applied cannot be found in the FIT, the current implementation stops applying the overlays. Let's make it skip only the failing overlay instead.
Signed-off-by: Jean-Jacques Hiblot jjhiblot@ti.com
Changes in v3: None Changes in v2: None
common/spl/spl_fit.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-)
Reviewed-by: Simon Glass sjg@chromium.org

There are many ways the overlay application can fail. 2 of them are probably the most common: - the application itself failed. Usually this is comes from an unresolved reference - DTBO not available in FIT (could be because of a typo)
In both case it is good to be more explicit about the error and at least show which overlay is failing.
Signed-off-by: Jean-Jacques Hiblot jjhiblot@ti.com ---
Changes in v3: None Changes in v2: None
common/spl/spl_fit.c | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-)
diff --git a/common/spl/spl_fit.c b/common/spl/spl_fit.c index d5e3858ed0..d772f2db64 100644 --- a/common/spl/spl_fit.c +++ b/common/spl/spl_fit.c @@ -106,7 +106,7 @@ static int spl_fit_get_image_node(const void *fit, int images,
node = fdt_subnode_offset(fit, images, str); if (node < 0) { - debug("cannot find image node '%s': %d\n", str, node); + pr_err("cannot find image node '%s': %d\n", str, node); return -EINVAL; }
@@ -337,8 +337,11 @@ static int spl_fit_append_fdt(struct spl_image_info *spl_image,
ret = fdt_overlay_apply_verbose(spl_image->fdt_addr, (void *)image_info.load_addr); - if (ret) + if (ret) { + pr_err("failed to apply DT overlay %s\n", + fit_get_name(fit, node, NULL)); return ret; + }
debug("%s: DT overlay %s applied\n", __func__, fit_get_name(fit, node, NULL));

On Thu, 23 May 2019 at 11:39, Jean-Jacques Hiblot jjhiblot@ti.com wrote:
There are many ways the overlay application can fail. 2 of them are probably the most common:
- the application itself failed. Usually this is comes from an unresolved reference
- DTBO not available in FIT (could be because of a typo)
In both case it is good to be more explicit about the error and at least show which overlay is failing.
Signed-off-by: Jean-Jacques Hiblot jjhiblot@ti.com
Changes in v3: None Changes in v2: None
common/spl/spl_fit.c | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-)
Reviewed-by: Simon Glass sjg@chromium.org

In order to apply an overlay to a DTB. The DTB must have been generated with the option '-@'.
Signed-off-by: Jean-Jacques Hiblot jjhiblot@ti.com ---
Changes in v3: None Changes in v2: None
scripts/Makefile.lib | 4 ++++ 1 file changed, 4 insertions(+)
diff --git a/scripts/Makefile.lib b/scripts/Makefile.lib index de67677f61..4b9f333d57 100644 --- a/scripts/Makefile.lib +++ b/scripts/Makefile.lib @@ -292,6 +292,10 @@ cmd_dt_S_dtb= \ $(obj)/%.dtb.S: $(obj)/%.dtb $(call cmd,dt_S_dtb)
+ifeq ($(CONFIG_SPL_LOAD_FIT_APPLY_OVERLAY),y) +DTC_FLAGS += -@ +endif + quiet_cmd_dtc = DTC $@ # Modified for U-Boot # Bring in any U-Boot-specific include at the end of the file

On Thu, 23 May 2019 at 11:39, Jean-Jacques Hiblot jjhiblot@ti.com wrote:
In order to apply an overlay to a DTB. The DTB must have been generated with the option '-@'.
Signed-off-by: Jean-Jacques Hiblot jjhiblot@ti.com
Changes in v3: None Changes in v2: None
scripts/Makefile.lib | 4 ++++ 1 file changed, 4 insertions(+)
Reviewed-by: Simon Glass sjg@chromium.org

The current tests do to handle well the cases where those variables are not defined. When CONFIG_SPL_LOAD_FIT is not defined, U_BOOT_ITS gets defined as an empty string. Fixing it by using intermediate variables with the quotes removed
Signed-off-by: Jean-Jacques Hiblot jjhiblot@ti.com ---
Changes in v3: None Changes in v2: None
Makefile | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-)
diff --git a/Makefile b/Makefile index 059978bfe6..b3ac1a9b8a 100644 --- a/Makefile +++ b/Makefile @@ -1200,12 +1200,15 @@ ifndef CONFIG_SYS_UBOOT_START CONFIG_SYS_UBOOT_START := 0 endif
+ # Boards with more complex image requirments can provide an .its source file # or a generator script -ifneq ($(CONFIG_SPL_FIT_SOURCE),"") -U_BOOT_ITS = $(subst ",,$(CONFIG_SPL_FIT_SOURCE)) +SPL_FIT_SOURCE := $(subst ",,$(CONFIG_SPL_FIT_SOURCE)) +SPL_FIT_GENERATOR := $(subst ",,$(CONFIG_SPL_FIT_GENERATOR)) +ifneq ($(SPL_FIT_SOURCE),) +U_BOOT_ITS = $(SPL_FIT_SOURCE) else -ifneq ($(CONFIG_SPL_FIT_GENERATOR),"") +ifneq ($(SPL_FIT_GENERATOR),) U_BOOT_ITS := u-boot.its ifeq ($(CONFIG_SPL_FIT_GENERATOR),"arch/arm/mach-imx/mkimage_fit_atf.sh") U_BOOT_ITS_DEPS += u-boot-nodtb.bin @@ -1214,7 +1217,7 @@ ifeq ($(CONFIG_SPL_FIT_GENERATOR),"arch/arm/mach-rockchip/make_fit_atf.py") U_BOOT_ITS_DEPS += u-boot endif $(U_BOOT_ITS): $(U_BOOT_ITS_DEPS) FORCE - $(srctree)/$(CONFIG_SPL_FIT_GENERATOR) \ + $(srctree)/$(SPL_FIT_GENERATOR) \ $(patsubst %,arch/$(ARCH)/dts/%.dtb,$(subst ",,$(CONFIG_OF_LIST))) > $@ endif endif

On Thu, 23 May 2019 at 11:39, Jean-Jacques Hiblot jjhiblot@ti.com wrote:
The current tests do to handle well the cases where those variables are not defined. When CONFIG_SPL_LOAD_FIT is not defined, U_BOOT_ITS gets defined as an empty string. Fixing it by using intermediate variables with the quotes removed
Signed-off-by: Jean-Jacques Hiblot jjhiblot@ti.com
Changes in v3: None Changes in v2: None
Makefile | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-)
Reviewed-by: Simon Glass sjg@chromium.org

Include the object tree and the source tree in the search path of the FIT compîler (dtc). This allows to use paths relative to the root of the source or object trees in the ITS instead of working backward from the actual location of the ITS. It also allows to use a build directory different of the source directory.
Signed-off-by: Jean-Jacques Hiblot jjhiblot@ti.com ---
Changes in v3: None Changes in v2: None
Makefile | 5 +++-- board/theobroma-systems/lion_rk3368/fit_spl_atf.its | 6 +++--- board/theobroma-systems/puma_rk3399/fit_spl_atf.its | 8 ++++---- 3 files changed, 10 insertions(+), 9 deletions(-)
diff --git a/Makefile b/Makefile index b3ac1a9b8a..f0ee4a21e2 100644 --- a/Makefile +++ b/Makefile @@ -900,7 +900,8 @@ cmd_mkimage = $(objtree)/tools/mkimage $(MKIMAGEFLAGS_$(@F)) -d $< $@ \ >$(MKIMAGEOUTPUT) $(if $(KBUILD_VERBOSE:0=), && cat $(MKIMAGEOUTPUT))
quiet_cmd_mkfitimage = MKIMAGE $@ -cmd_mkfitimage = $(objtree)/tools/mkimage $(MKIMAGEFLAGS_$(@F)) -f $(U_BOOT_ITS) -p $(CONFIG_FIT_EXTERNAL_OFFSET) $@\ +cmd_mkfitimage = $(objtree)/tools/mkimage $(MKIMAGEFLAGS_$(@F)) -D "-i $(obj) -i $(src)"\ + -f $(U_BOOT_ITS) $@ -p $(CONFIG_FIT_EXTERNAL_OFFSET)\ >$(MKIMAGEOUTPUT) $(if $(KBUILD_VERBOSE:0=), && cat $(MKIMAGEOUTPUT))
quiet_cmd_cat = CAT $@ @@ -1206,7 +1207,7 @@ endif SPL_FIT_SOURCE := $(subst ",,$(CONFIG_SPL_FIT_SOURCE)) SPL_FIT_GENERATOR := $(subst ",,$(CONFIG_SPL_FIT_GENERATOR)) ifneq ($(SPL_FIT_SOURCE),) -U_BOOT_ITS = $(SPL_FIT_SOURCE) +U_BOOT_ITS = $(src)/$(SPL_FIT_SOURCE) else ifneq ($(SPL_FIT_GENERATOR),) U_BOOT_ITS := u-boot.its diff --git a/board/theobroma-systems/lion_rk3368/fit_spl_atf.its b/board/theobroma-systems/lion_rk3368/fit_spl_atf.its index 6b04fbc7da..69202a117b 100644 --- a/board/theobroma-systems/lion_rk3368/fit_spl_atf.its +++ b/board/theobroma-systems/lion_rk3368/fit_spl_atf.its @@ -14,7 +14,7 @@ images { uboot { description = "U-Boot (64-bit)"; - data = /incbin/("../../../u-boot-nodtb.bin"); + data = /incbin/("u-boot-nodtb.bin"); type = "standalone"; os = "U-Boot"; arch = "arm64"; @@ -23,7 +23,7 @@ }; atf { description = "ARM Trusted Firmware"; - data = /incbin/("../../../bl31-rk3368.bin"); + data = /incbin/("bl31-rk3368.bin"); type = "firmware"; os = "arm-trusted-firmware"; arch = "arm64"; @@ -34,7 +34,7 @@
fdt { description = "RK3368-uQ7 (Lion) flat device-tree"; - data = /incbin/("../../../u-boot.dtb"); + data = /incbin/("u-boot.dtb"); type = "flat_dt"; compression = "none"; }; diff --git a/board/theobroma-systems/puma_rk3399/fit_spl_atf.its b/board/theobroma-systems/puma_rk3399/fit_spl_atf.its index 530f059f3d..659183ecc1 100644 --- a/board/theobroma-systems/puma_rk3399/fit_spl_atf.its +++ b/board/theobroma-systems/puma_rk3399/fit_spl_atf.its @@ -14,7 +14,7 @@ images { uboot { description = "U-Boot (64-bit)"; - data = /incbin/("../../../u-boot-nodtb.bin"); + data = /incbin/("u-boot-nodtb.bin"); type = "standalone"; os = "U-Boot"; arch = "arm64"; @@ -23,7 +23,7 @@ }; atf { description = "ARM Trusted Firmware"; - data = /incbin/("../../../bl31-rk3399.bin"); + data = /incbin/("bl31-rk3399.bin"); type = "firmware"; arch = "arm64"; os = "arm-trusted-firmware"; @@ -33,14 +33,14 @@ }; pmu { description = "Cortex-M0 firmware"; - data = /incbin/("../../../rk3399m0.bin"); + data = /incbin/("rk3399m0.bin"); type = "pmu-firmware"; compression = "none"; load = <0x180000>; }; fdt { description = "RK3399-Q7 (Puma) flat device-tree"; - data = /incbin/("../../../u-boot.dtb"); + data = /incbin/("u-boot.dtb"); type = "flat_dt"; compression = "none"; };

On Thu, 23 May 2019 at 11:39, Jean-Jacques Hiblot jjhiblot@ti.com wrote:
Include the object tree and the source tree in the search path of the FIT compîler (dtc). This allows to use paths relative to the root of the source or object trees in the ITS instead of working backward from the actual location of the ITS. It also allows to use a build directory different of the source directory.
Signed-off-by: Jean-Jacques Hiblot jjhiblot@ti.com
Changes in v3: None Changes in v2: None
Makefile | 5 +++-- board/theobroma-systems/lion_rk3368/fit_spl_atf.its | 6 +++--- board/theobroma-systems/puma_rk3399/fit_spl_atf.its | 8 ++++---- 3 files changed, 10 insertions(+), 9 deletions(-)
Reviewed-by: Simon Glass sjg@chromium.org

Currently the FIT generator scripts are passed only a list of dtbs. However some platforms may also require information about the board itself.
Signed-off-by: Jean-Jacques Hiblot jjhiblot@ti.com ---
Changes in v3: None Changes in v2: None
Makefile | 2 +- arch/arm/mach-imx/mkimage_fit_atf.sh | 3 ++- arch/arm/mach-rockchip/make_fit_atf.py | 5 +++-- board/sunxi/mksunxi_fit_atf.sh | 2 ++ 4 files changed, 8 insertions(+), 4 deletions(-)
diff --git a/Makefile b/Makefile index f0ee4a21e2..048d12340b 100644 --- a/Makefile +++ b/Makefile @@ -1218,7 +1218,7 @@ ifeq ($(CONFIG_SPL_FIT_GENERATOR),"arch/arm/mach-rockchip/make_fit_atf.py") U_BOOT_ITS_DEPS += u-boot endif $(U_BOOT_ITS): $(U_BOOT_ITS_DEPS) FORCE - $(srctree)/$(SPL_FIT_GENERATOR) \ + $(srctree)/$(SPL_FIT_GENERATOR) $(BOARD) \ $(patsubst %,arch/$(ARCH)/dts/%.dtb,$(subst ",,$(CONFIG_OF_LIST))) > $@ endif endif diff --git a/arch/arm/mach-imx/mkimage_fit_atf.sh b/arch/arm/mach-imx/mkimage_fit_atf.sh index 38c9858e84..45b325665e 100755 --- a/arch/arm/mach-imx/mkimage_fit_atf.sh +++ b/arch/arm/mach-imx/mkimage_fit_atf.sh @@ -4,7 +4,7 @@ # script to generate FIT image source for i.MX8MQ boards with # ARM Trusted Firmware and multiple device trees (given on the command line) # -# usage: $0 <dt_name> [<dt_name> [<dt_name] ...] +# usage: $0 <board> <dt_name> [<dt_name> [<dt_name] ...]
[ -z "$BL31" ] && BL31="bl31.bin" [ -z "$TEE_LOAD_ADDR" ] && TEE_LOAD_ADDR="0xfe000000" @@ -39,6 +39,7 @@ else ls -lct u-boot-nodtb.bin | awk '{print $5}' >&2 fi
+shift for dtname in $* do echo "$dtname size: " >&2 diff --git a/arch/arm/mach-rockchip/make_fit_atf.py b/arch/arm/mach-rockchip/make_fit_atf.py index d1faff1957..4138b04a37 100755 --- a/arch/arm/mach-rockchip/make_fit_atf.py +++ b/arch/arm/mach-rockchip/make_fit_atf.py @@ -4,7 +4,7 @@ A script to generate FIT image source for rockchip boards with ARM Trusted Firmware and multiple device trees (given on the command line)
-usage: $0 <dt_name> [<dt_name> [<dt_name] ...] +usage: $0 <board> <dt_name> [<dt_name> [<dt_name] ...] """
import os @@ -209,7 +209,8 @@ def main(): print(__doc__) sys.exit(2)
- dtbs = args + board = args[0] + dtbs = args[1:] #get_bl31_segments_info("u-boot") #get_bl31_segments_info("bl31.elf")
diff --git a/board/sunxi/mksunxi_fit_atf.sh b/board/sunxi/mksunxi_fit_atf.sh index 88ad719747..0dc7ab4348 100755 --- a/board/sunxi/mksunxi_fit_atf.sh +++ b/board/sunxi/mksunxi_fit_atf.sh @@ -46,6 +46,8 @@ cat << __HEADER_EOF }; __HEADER_EOF
+shift + cnt=1 for dtname in $* do

Hi,
On Thu, 23 May 2019 at 11:39, Jean-Jacques Hiblot jjhiblot@ti.com wrote:
Currently the FIT generator scripts are passed only a list of dtbs. However some platforms may also require information about the board itself.
Signed-off-by: Jean-Jacques Hiblot jjhiblot@ti.com
Changes in v3: None Changes in v2: None
Makefile | 2 +- arch/arm/mach-imx/mkimage_fit_atf.sh | 3 ++- arch/arm/mach-rockchip/make_fit_atf.py | 5 +++-- board/sunxi/mksunxi_fit_atf.sh | 2 ++ 4 files changed, 8 insertions(+), 4 deletions(-)
Reviewed-by: Simon Glass sjg@chromium.org
I wonder if these scripts should use binman?
Regards, Simon

To reduce the complexity of the Makefile, let the generator tell what its dependencies are. For this purpose use the "--deps" option.
Signed-off-by: Jean-Jacques Hiblot jjhiblot@ti.com ---
Changes in v3: None Changes in v2: None
Makefile | 9 ++------- arch/arm/mach-imx/mkimage_fit_atf.sh | 7 +++++++ arch/arm/mach-rockchip/make_fit_atf.py | 8 ++++++++ board/sunxi/mksunxi_fit_atf.sh | 5 +++++ 4 files changed, 22 insertions(+), 7 deletions(-)
diff --git a/Makefile b/Makefile index 048d12340b..3f8899b91b 100644 --- a/Makefile +++ b/Makefile @@ -1211,13 +1211,8 @@ U_BOOT_ITS = $(src)/$(SPL_FIT_SOURCE) else ifneq ($(SPL_FIT_GENERATOR),) U_BOOT_ITS := u-boot.its -ifeq ($(CONFIG_SPL_FIT_GENERATOR),"arch/arm/mach-imx/mkimage_fit_atf.sh") -U_BOOT_ITS_DEPS += u-boot-nodtb.bin -endif -ifeq ($(CONFIG_SPL_FIT_GENERATOR),"arch/arm/mach-rockchip/make_fit_atf.py") -U_BOOT_ITS_DEPS += u-boot -endif -$(U_BOOT_ITS): $(U_BOOT_ITS_DEPS) FORCE +U_BOOT_ITS_DEPS += $(shell $(srctree)/$(SPL_FIT_GENERATOR) --deps $(BOARD)) +$(U_BOOT_ITS): u-boot-nodtb.bin $(U_BOOT_ITS_DEPS) FORCE $(srctree)/$(SPL_FIT_GENERATOR) $(BOARD) \ $(patsubst %,arch/$(ARCH)/dts/%.dtb,$(subst ",,$(CONFIG_OF_LIST))) > $@ endif diff --git a/arch/arm/mach-imx/mkimage_fit_atf.sh b/arch/arm/mach-imx/mkimage_fit_atf.sh index 45b325665e..45a81fbad3 100755 --- a/arch/arm/mach-imx/mkimage_fit_atf.sh +++ b/arch/arm/mach-imx/mkimage_fit_atf.sh @@ -11,6 +11,13 @@ [ -z "$ATF_LOAD_ADDR" ] && ATF_LOAD_ADDR="0x00910000" [ -z "$BL33_LOAD_ADDR" ] && BL33_LOAD_ADDR="0x40200000"
+if [ x"$1" = x"--deps" ]; then + echo $BL31 + echo "tee.bin" + echo "u-boot-nodtb.bin" + exit 0 +fi + if [ ! -f $BL31 ]; then echo "ERROR: BL31 file $BL31 NOT found" >&2 exit 0 diff --git a/arch/arm/mach-rockchip/make_fit_atf.py b/arch/arm/mach-rockchip/make_fit_atf.py index 4138b04a37..afd734e736 100755 --- a/arch/arm/mach-rockchip/make_fit_atf.py +++ b/arch/arm/mach-rockchip/make_fit_atf.py @@ -192,11 +192,19 @@ def get_bl31_segments_info(bl31_file_name): paddr = seg[ELF_SEG_P_PADDR] print('paddr: %08x' % paddr)
+def show_deps_and_exit(): + print("u-boot") + print("bl31.elf") + sys.exit(0) + def main(): uboot_elf="./u-boot" bl31_elf="./bl31.elf" FIT_ITS=sys.stdout
+ if sys.argv[1] == "--deps": + show_deps_and_exit() + opts, args = getopt.getopt(sys.argv[1:], "o:u:b:h") for opt, val in opts: if opt == "-o": diff --git a/board/sunxi/mksunxi_fit_atf.sh b/board/sunxi/mksunxi_fit_atf.sh index 0dc7ab4348..8f87514a6f 100755 --- a/board/sunxi/mksunxi_fit_atf.sh +++ b/board/sunxi/mksunxi_fit_atf.sh @@ -5,6 +5,11 @@ # # usage: $0 <dt_name> [<dt_name> [<dt_name] ...]
+if [ x"$1" = x"--deps" ]; then + echo "u-boot-nodtb.bin" + exit 0 +fi + [ -z "$BL31" ] && BL31="bl31.bin"
if [ ! -f $BL31 ]; then

On Thu, 23 May 2019 at 11:39, Jean-Jacques Hiblot jjhiblot@ti.com wrote:
To reduce the complexity of the Makefile, let the generator tell what its dependencies are. For this purpose use the "--deps" option.
Signed-off-by: Jean-Jacques Hiblot jjhiblot@ti.com
Changes in v3: None Changes in v2: None
Makefile | 9 ++------- arch/arm/mach-imx/mkimage_fit_atf.sh | 7 +++++++ arch/arm/mach-rockchip/make_fit_atf.py | 8 ++++++++ board/sunxi/mksunxi_fit_atf.sh | 5 +++++ 4 files changed, 22 insertions(+), 7 deletions(-)
Reviewed-by: Simon Glass sjg@chromium.org

There is no need for it to be non-constant. Making it constant, allows to return constant string without warning.
Signed-off-by: Jean-Jacques Hiblot jjhiblot@ti.com ---
Changes in v3: None Changes in v2: None
common/spl/spl_fit.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-)
diff --git a/common/spl/spl_fit.c b/common/spl/spl_fit.c index d772f2db64..8c5d15c3c8 100644 --- a/common/spl/spl_fit.c +++ b/common/spl/spl_fit.c @@ -39,7 +39,7 @@ __weak ulong board_spl_fit_size_align(ulong size) */ static int spl_fit_get_image_name(const void *fit, int images, const char *type, int index, - char **outname) + const char **outname) { const char *name, *str; __maybe_unused int node; @@ -94,7 +94,7 @@ static int spl_fit_get_image_name(const void *fit, int images, static int spl_fit_get_image_node(const void *fit, int images, const char *type, int index) { - char *str; + const char *str; int err; int node;
@@ -363,7 +363,7 @@ static int spl_fit_record_loadable(const void *fit, int images, int index, { int ret = 0; #if !CONFIG_IS_ENABLED(FIT_IMAGE_TINY) - char *name; + const char *name; int node;
ret = spl_fit_get_image_name(fit, images, "loadables",

On Thu, 23 May 2019 at 11:39, Jean-Jacques Hiblot jjhiblot@ti.com wrote:
There is no need for it to be non-constant. Making it constant, allows to return constant string without warning.
Signed-off-by: Jean-Jacques Hiblot jjhiblot@ti.com
Changes in v3: None Changes in v2: None
common/spl/spl_fit.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-)
Reviewed-by: Simon Glass sjg@chromium.org

spl_fit_get_image_name() is used to get the names of the images that the SPL must load from the FIT. It relies on the content of a property present in the FIT. The list of images is thus statically defined in the FIT. With this scheme, it becomes quickly hard to manage combinations of more than a hand few of images. To address this problem, give the board-level code the opportunity to add to the list of images. The images from the FIT property are loaded first, and then the board_fit_get_additionnal_images() is called to get more image names.
Signed-off-by: Jean-Jacques Hiblot jjhiblot@ti.com
---
Changes in v3: - removed the RFC prefix. This work will be needed soon by TI's AM65x platform. and can probably benefit other modular platforms - removed the last patch that provided an example of how to use this with on a DRA76. - removed the patch that made u-boot.img a symlink to u-boot.itb because it breaks the build of many platforms (because files required to build the ITB are missing) - removed the patch to reduce the footprint of the am335x SPL. (already merged) - Made the boot flow more permissive (don't fail immediately if an overlay is not present) and more verbose when an error occures - handle the dependencies of the FIT generation in a more generic way - use a dedicated kconfig option to enable the application of the overlays by the SPL.
Changes in v2: - reworked board_fit_get_additionnal_images() and how it used in spl_fit.c - removed dtbo generation from dtso files and use .dts extension for the overlays - add dynamic allocation usage in a separate patch - defconfig change for the am335x_evm
common/spl/spl_fit.c | 28 +++++++++++++++++++++++++--- include/spl.h | 16 ++++++++++++++++ 2 files changed, 41 insertions(+), 3 deletions(-)
diff --git a/common/spl/spl_fit.c b/common/spl/spl_fit.c index 8c5d15c3c8..f1e0ad8d73 100644 --- a/common/spl/spl_fit.c +++ b/common/spl/spl_fit.c @@ -25,6 +25,12 @@ __weak ulong board_spl_fit_size_align(ulong size) return size; }
+__weak const char *board_fit_get_additionnal_images(int index, + const char *type) +{ + return NULL; +} + /** * spl_fit_get_image_name(): By using the matching configuration subnode, * retrieve the name of an image, specified by a property name and an index @@ -45,6 +51,7 @@ static int spl_fit_get_image_name(const void *fit, int images, __maybe_unused int node; int conf_node; int len, i; + bool found = true;
conf_node = fit_find_config_node(fit); if (conf_node < 0) { @@ -70,12 +77,27 @@ static int spl_fit_get_image_name(const void *fit, int images, for (i = 0; i < index; i++) { str = strchr(str, '\0') + 1; if (!str || (str - name >= len)) { - debug("no string for index %d\n", index); - return -E2BIG; + found = false; + break; } }
- *outname = (char *)str; + if (!found) { + /* + * no string in the property for this index. Check if the board + * level code can supply one. + */ + str = board_fit_get_additionnal_images(index - i - 1, type); + if (str) + found = true; + } + + if (!found) { + debug("no string for index %d\n", index); + return -E2BIG; + } + + *outname = str; return 0; }
diff --git a/include/spl.h b/include/spl.h index a9aaef345f..b7a5d6a995 100644 --- a/include/spl.h +++ b/include/spl.h @@ -370,6 +370,22 @@ void board_spl_fit_post_load(ulong load_addr, size_t length); */ ulong board_spl_fit_size_align(ulong size);
+/** + * board_fit_get_additionnal_images - Get additional image names from board- + * level code. + * This function can be used to provide the image names based on runtime + * detection. A classic use-case would when DTBOs are used to describe + * additionnal daughter cards. + * + * @param index Index of the image. Starts at 0 and gets incremented after each + * call to this function. + * @param type The type of image. For example, "fdt" for DTBs + * + * @return The name of the node describing the image. NULL indicates that + * there no more images to get from this function. + */ +const char *board_fit_get_additionnal_images(int index, const char *type); + /** * spl_perform_fixups() - arch/board-specific callback before processing * the boot-payload

Hi Jean-Jacques,
On Thu, 23 May 2019 at 11:39, Jean-Jacques Hiblot jjhiblot@ti.com wrote:
spl_fit_get_image_name() is used to get the names of the images that the SPL must load from the FIT. It relies on the content of a property present in the FIT. The list of images is thus statically defined in the FIT. With this scheme, it becomes quickly hard to manage combinations of more than a hand few of images. To address this problem, give the board-level code the opportunity to add to the list of images. The images from the FIT property are loaded first, and then the board_fit_get_additionnal_images() is called to get more image names.
Signed-off-by: Jean-Jacques Hiblot jjhiblot@ti.com
Changes in v3:
- removed the RFC prefix. This work will be needed soon by TI's AM65x
platform. and can probably benefit other modular platforms
- removed the last patch that provided an example of how to use this with
on a DRA76.
- removed the patch that made u-boot.img a symlink to u-boot.itb because
it breaks the build of many platforms (because files required to build the ITB are missing)
- removed the patch to reduce the footprint of the am335x SPL. (already
merged)
- Made the boot flow more permissive (don't fail immediately if an overlay
is not present) and more verbose when an error occures
- handle the dependencies of the FIT generation in a more generic way
- use a dedicated kconfig option to enable the application of the overlays
by the SPL.
Changes in v2:
- reworked board_fit_get_additionnal_images() and how it used in spl_fit.c
- removed dtbo generation from dtso files and use .dts extension for the overlays
- add dynamic allocation usage in a separate patch
- defconfig change for the am335x_evm
common/spl/spl_fit.c | 28 +++++++++++++++++++++++++--- include/spl.h | 16 ++++++++++++++++ 2 files changed, 41 insertions(+), 3 deletions(-)
Can we instead use driver mode for this? E.g. there is a board uclass which could have functionality added.
Regards, Simon

Hi Jean-Jacques,
On Thu, 23 May 2019 at 11:39, Jean-Jacques Hiblot jjhiblot@ti.com wrote:
The purpose of this series is to provide the SPL with ability to apply overlays for u-boot. this is only a RFC so far, to get a feedback on the approach.
Our use-case is the support of the daughter boards of the AM65x EVM. In Linux, each board is supported by a unique overlay. The presence of the boards is detected at runtime, and some useful features (like USB) are implemented on those daughter boards. Instead of providing multiple dtbs and fall in a combinatorial pit, we propose to use DT overlays.
Patch #1 "spl: fit: Add support for applying DT overlay" has been posted a few weeks ago by Michal Simek. Patch #2 to #5 amend Michal's patch. Patch #6 to #8 are simple fixes for the Makefile Patch #9 is not required but relates to this series and will be required later by the AM6x platform Patch #10 is used to reduce the complexity of the Makefile by having FIT generator scripts provide their dependencies Patch #12 adds a way to dynamically select the DT overlays. That is were we would use HW detection to select the required overlays. In that case, the board-level code tells what overlay it needs (it gives the name of the node).
On arm, if overlay are supported, this series increases the size of the SPL by 3.2 kB.
Travis build : https://travis-ci.org/jjhiblot/u-boot/builds/535686392 For a strange reason, buildman on travis show errors for sun8i ans sun50i, but pass when I run it locally.
Changes in v3:
- Add a new config option: SPL_LOAD_FIT_APPLY_OVERLAY. By default, it is
not selected.
- removed the RFC prefix. This work will be needed soon by TI's AM65x
platform. and can probably benefit other modular platforms
- removed the last patch that provided an example of how to use this with
on a DRA76.
- removed the patch that made u-boot.img a symlink to u-boot.itb because
it breaks the build of many platforms (because files required to build the ITB are missing)
- removed the patch to reduce the footprint of the am335x SPL. (already
merged)
- Made the boot flow more permissive (don't fail immediately if an overlay
is not present) and more verbose when an error occures
- handle the dependencies of the FIT generation in a more generic way
- use a dedicated kconfig option to enable the application of the overlays
by the SPL.
Changes in v2:
- reworked board_fit_get_additionnal_images() and how it used in spl_fit.c
- removed dtbo generation from dtso files and use .dts extension for the overlays
- add dynamic allocation usage in a separate patch
- defconfig change for the am335x_evm
Jean-Jacques Hiblot (11): spl: fit: Make room in the FDT before applying overlays spl: fit: allocate a temporary buffer to load the overlays spl: fit: Do not fail immediately if an overlay is not available spl: fit: be more verbose when an error occurs when applying the overlays Makefile.lib: include /__symbols__ in dtb if SPL_LOAD_FIT_APPLY_OVERLAY is enabled Makefile: Fix tests for CONFIG_SPL_LOAD_FIT and CONFIG_SPL_FIT_GENERATOR Makefile: Fix u-boot.itb generation when building outside the source tree Makefile: Pass the board name to the FIT generator scripts Makefile: Query the SPL Fit Generator for its dependencies spl: fit: constify the output parameter of spl_fit_get_image_name() spl: fit: Allow the board to tell if more images must be loaded from FIT
Michal Simek (1): spl: fit: Add support for applying DT overlay
Kconfig | 10 +++ Makefile | 23 +++-- arch/arm/mach-imx/mkimage_fit_atf.sh | 10 ++- arch/arm/mach-rockchip/make_fit_atf.py | 13 ++- board/sunxi/mksunxi_fit_atf.sh | 7 ++ .../lion_rk3368/fit_spl_atf.its | 6 +- .../puma_rk3399/fit_spl_atf.its | 8 +- common/spl/spl_fit.c | 90 +++++++++++++++++-- include/spl.h | 16 ++++ scripts/Makefile.lib | 4 + 10 files changed, 156 insertions(+), 31 deletions(-)
How about a test that uses sandbox to apply some overlays?
Regards, Simon

Hi Simon,
On 22/06/2019 21:09, Simon Glass wrote:
Hi Jean-Jacques,
On Thu, 23 May 2019 at 11:39, Jean-Jacques Hiblot jjhiblot@ti.com wrote:
The purpose of this series is to provide the SPL with ability to apply overlays for u-boot. this is only a RFC so far, to get a feedback on the approach.
Our use-case is the support of the daughter boards of the AM65x EVM. In Linux, each board is supported by a unique overlay. The presence of the boards is detected at runtime, and some useful features (like USB) are implemented on those daughter boards. Instead of providing multiple dtbs and fall in a combinatorial pit, we propose to use DT overlays.
Patch #1 "spl: fit: Add support for applying DT overlay" has been posted a few weeks ago by Michal Simek. Patch #2 to #5 amend Michal's patch. Patch #6 to #8 are simple fixes for the Makefile Patch #9 is not required but relates to this series and will be required later by the AM6x platform Patch #10 is used to reduce the complexity of the Makefile by having FIT generator scripts provide their dependencies Patch #12 adds a way to dynamically select the DT overlays. That is were we would use HW detection to select the required overlays. In that case, the board-level code tells what overlay it needs (it gives the name of the node).
On arm, if overlay are supported, this series increases the size of the SPL by 3.2 kB.
Travis build : https://travis-ci.org/jjhiblot/u-boot/builds/535686392 For a strange reason, buildman on travis show errors for sun8i ans sun50i, but pass when I run it locally.
Changes in v3:
- Add a new config option: SPL_LOAD_FIT_APPLY_OVERLAY. By default, it is
not selected.
- removed the RFC prefix. This work will be needed soon by TI's AM65x
platform. and can probably benefit other modular platforms
- removed the last patch that provided an example of how to use this with
on a DRA76.
- removed the patch that made u-boot.img a symlink to u-boot.itb because
it breaks the build of many platforms (because files required to build the ITB are missing)
- removed the patch to reduce the footprint of the am335x SPL. (already
merged)
- Made the boot flow more permissive (don't fail immediately if an overlay
is not present) and more verbose when an error occures
- handle the dependencies of the FIT generation in a more generic way
- use a dedicated kconfig option to enable the application of the overlays
by the SPL.
Changes in v2:
- reworked board_fit_get_additionnal_images() and how it used in spl_fit.c
- removed dtbo generation from dtso files and use .dts extension for the overlays
- add dynamic allocation usage in a separate patch
- defconfig change for the am335x_evm
Jean-Jacques Hiblot (11): spl: fit: Make room in the FDT before applying overlays spl: fit: allocate a temporary buffer to load the overlays spl: fit: Do not fail immediately if an overlay is not available spl: fit: be more verbose when an error occurs when applying the overlays Makefile.lib: include /__symbols__ in dtb if SPL_LOAD_FIT_APPLY_OVERLAY is enabled Makefile: Fix tests for CONFIG_SPL_LOAD_FIT and CONFIG_SPL_FIT_GENERATOR Makefile: Fix u-boot.itb generation when building outside the source tree Makefile: Pass the board name to the FIT generator scripts Makefile: Query the SPL Fit Generator for its dependencies spl: fit: constify the output parameter of spl_fit_get_image_name() spl: fit: Allow the board to tell if more images must be loaded from FIT
Michal Simek (1): spl: fit: Add support for applying DT overlay
Kconfig | 10 +++ Makefile | 23 +++-- arch/arm/mach-imx/mkimage_fit_atf.sh | 10 ++- arch/arm/mach-rockchip/make_fit_atf.py | 13 ++- board/sunxi/mksunxi_fit_atf.sh | 7 ++ .../lion_rk3368/fit_spl_atf.its | 6 +- .../puma_rk3399/fit_spl_atf.its | 8 +- common/spl/spl_fit.c | 90 +++++++++++++++++-- include/spl.h | 16 ++++ scripts/Makefile.lib | 4 + 10 files changed, 156 insertions(+), 31 deletions(-)
How about a test that uses sandbox to apply some overlays?
I had had a look it but came to the conclusion that the SPL is not passing the FDT to u-boot. Were I mistaken ?
Thanks for the reviews, I'll take your comments in account for the next round.
JJ
Regards, Simon

Hi Jean-Jacques,
On Tue, 25 Jun 2019 at 12:10, Jean-Jacques Hiblot jjhiblot@ti.com wrote:
Hi Simon,
On 22/06/2019 21:09, Simon Glass wrote:
Hi Jean-Jacques,
On Thu, 23 May 2019 at 11:39, Jean-Jacques Hiblot jjhiblot@ti.com wrote:
The purpose of this series is to provide the SPL with ability to apply overlays for u-boot. this is only a RFC so far, to get a feedback on the approach.
Our use-case is the support of the daughter boards of the AM65x EVM. In Linux, each board is supported by a unique overlay. The presence of the boards is detected at runtime, and some useful features (like USB) are implemented on those daughter boards. Instead of providing multiple dtbs and fall in a combinatorial pit, we propose to use DT overlays.
Patch #1 "spl: fit: Add support for applying DT overlay" has been posted a few weeks ago by Michal Simek. Patch #2 to #5 amend Michal's patch. Patch #6 to #8 are simple fixes for the Makefile Patch #9 is not required but relates to this series and will be required later by the AM6x platform Patch #10 is used to reduce the complexity of the Makefile by having FIT generator scripts provide their dependencies Patch #12 adds a way to dynamically select the DT overlays. That is were we would use HW detection to select the required overlays. In that case, the board-level code tells what overlay it needs (it gives the name of the node).
On arm, if overlay are supported, this series increases the size of the SPL by 3.2 kB.
Travis build : https://travis-ci.org/jjhiblot/u-boot/builds/535686392 For a strange reason, buildman on travis show errors for sun8i ans sun50i, but pass when I run it locally.
Changes in v3:
- Add a new config option: SPL_LOAD_FIT_APPLY_OVERLAY. By default, it is
not selected.
- removed the RFC prefix. This work will be needed soon by TI's AM65x
platform. and can probably benefit other modular platforms
- removed the last patch that provided an example of how to use this with
on a DRA76.
- removed the patch that made u-boot.img a symlink to u-boot.itb because
it breaks the build of many platforms (because files required to build the ITB are missing)
- removed the patch to reduce the footprint of the am335x SPL. (already
merged)
- Made the boot flow more permissive (don't fail immediately if an overlay
is not present) and more verbose when an error occures
- handle the dependencies of the FIT generation in a more generic way
- use a dedicated kconfig option to enable the application of the overlays
by the SPL.
Changes in v2:
- reworked board_fit_get_additionnal_images() and how it used in spl_fit.c
- removed dtbo generation from dtso files and use .dts extension for the overlays
- add dynamic allocation usage in a separate patch
- defconfig change for the am335x_evm
Jean-Jacques Hiblot (11): spl: fit: Make room in the FDT before applying overlays spl: fit: allocate a temporary buffer to load the overlays spl: fit: Do not fail immediately if an overlay is not available spl: fit: be more verbose when an error occurs when applying the overlays Makefile.lib: include /__symbols__ in dtb if SPL_LOAD_FIT_APPLY_OVERLAY is enabled Makefile: Fix tests for CONFIG_SPL_LOAD_FIT and CONFIG_SPL_FIT_GENERATOR Makefile: Fix u-boot.itb generation when building outside the source tree Makefile: Pass the board name to the FIT generator scripts Makefile: Query the SPL Fit Generator for its dependencies spl: fit: constify the output parameter of spl_fit_get_image_name() spl: fit: Allow the board to tell if more images must be loaded from FIT
Michal Simek (1): spl: fit: Add support for applying DT overlay
Kconfig | 10 +++ Makefile | 23 +++-- arch/arm/mach-imx/mkimage_fit_atf.sh | 10 ++- arch/arm/mach-rockchip/make_fit_atf.py | 13 ++- board/sunxi/mksunxi_fit_atf.sh | 7 ++ .../lion_rk3368/fit_spl_atf.its | 6 +- .../puma_rk3399/fit_spl_atf.its | 8 +- common/spl/spl_fit.c | 90 +++++++++++++++++-- include/spl.h | 16 ++++ scripts/Makefile.lib | 4 + 10 files changed, 156 insertions(+), 31 deletions(-)
How about a test that uses sandbox to apply some overlays?
I had had a look it but came to the conclusion that the SPL is not passing the FDT to u-boot. Were I mistaken ?
Well actually that is possible. I haven't dug into the details, but there is a feature where SPL can select a DT to pass to U-Boot proper.
Thanks for the reviews, I'll take your comments in account for the next round.
OK sounds good.
Regards, Simon

On Thu, May 23, 2019 at 12:39:00PM +0200, Jean-Jacques Hiblot wrote:
The purpose of this series is to provide the SPL with ability to apply overlays for u-boot. this is only a RFC so far, to get a feedback on the approach.
Our use-case is the support of the daughter boards of the AM65x EVM. In Linux, each board is supported by a unique overlay. The presence of the boards is detected at runtime, and some useful features (like USB) are implemented on those daughter boards. Instead of providing multiple dtbs and fall in a combinatorial pit, we propose to use DT overlays.
Patch #1 "spl: fit: Add support for applying DT overlay" has been posted a few weeks ago by Michal Simek. Patch #2 to #5 amend Michal's patch. Patch #6 to #8 are simple fixes for the Makefile Patch #9 is not required but relates to this series and will be required later by the AM6x platform Patch #10 is used to reduce the complexity of the Makefile by having FIT generator scripts provide their dependencies Patch #12 adds a way to dynamically select the DT overlays. That is were we would use HW detection to select the required overlays. In that case, the board-level code tells what overlay it needs (it gives the name of the node).
On arm, if overlay are supported, this series increases the size of the SPL by 3.2 kB.
Travis build : https://travis-ci.org/jjhiblot/u-boot/builds/535686392 For a strange reason, buildman on travis show errors for sun8i ans sun50i, but pass when I run it locally.
Changes in v3:
- Add a new config option: SPL_LOAD_FIT_APPLY_OVERLAY. By default, it is
not selected.
- removed the RFC prefix. This work will be needed soon by TI's AM65x
platform. and can probably benefit other modular platforms
- removed the last patch that provided an example of how to use this with
on a DRA76.
- removed the patch that made u-boot.img a symlink to u-boot.itb because
it breaks the build of many platforms (because files required to build the ITB are missing)
- removed the patch to reduce the footprint of the am335x SPL. (already
merged)
- Made the boot flow more permissive (don't fail immediately if an overlay
is not present) and more verbose when an error occures
- handle the dependencies of the FIT generation in a more generic way
- use a dedicated kconfig option to enable the application of the overlays
by the SPL.
Changes in v2:
- reworked board_fit_get_additionnal_images() and how it used in spl_fit.c
- removed dtbo generation from dtso files and use .dts extension for the overlays
- add dynamic allocation usage in a separate patch
- defconfig change for the am335x_evm
Jean-Jacques Hiblot (11): spl: fit: Make room in the FDT before applying overlays spl: fit: allocate a temporary buffer to load the overlays spl: fit: Do not fail immediately if an overlay is not available spl: fit: be more verbose when an error occurs when applying the overlays Makefile.lib: include /__symbols__ in dtb if SPL_LOAD_FIT_APPLY_OVERLAY is enabled Makefile: Fix tests for CONFIG_SPL_LOAD_FIT and CONFIG_SPL_FIT_GENERATOR Makefile: Fix u-boot.itb generation when building outside the source tree Makefile: Pass the board name to the FIT generator scripts Makefile: Query the SPL Fit Generator for its dependencies spl: fit: constify the output parameter of spl_fit_get_image_name() spl: fit: Allow the board to tell if more images must be loaded from FIT
Michal Simek (1): spl: fit: Add support for applying DT overlay
Kconfig | 10 +++ Makefile | 23 +++-- arch/arm/mach-imx/mkimage_fit_atf.sh | 10 ++- arch/arm/mach-rockchip/make_fit_atf.py | 13 ++- board/sunxi/mksunxi_fit_atf.sh | 7 ++ .../lion_rk3368/fit_spl_atf.its | 6 +- .../puma_rk3399/fit_spl_atf.its | 8 +- common/spl/spl_fit.c | 90 +++++++++++++++++-- include/spl.h | 16 ++++ scripts/Makefile.lib | 4 + 10 files changed, 156 insertions(+), 31 deletions(-)
So where are we at here? Simon Glass had a few nits on one patch and reviewed the rest. I don't see any review from Michal and I really would like to before applying this as xilinx is another SoC that would be making use of this feature, yes? Thanks folks!

Hi Tom,
On 26/07/2019 21:46, Tom Rini wrote:
On Thu, May 23, 2019 at 12:39:00PM +0200, Jean-Jacques Hiblot wrote:
The purpose of this series is to provide the SPL with ability to apply overlays for u-boot. this is only a RFC so far, to get a feedback on the approach.
Our use-case is the support of the daughter boards of the AM65x EVM. In Linux, each board is supported by a unique overlay. The presence of the boards is detected at runtime, and some useful features (like USB) are implemented on those daughter boards. Instead of providing multiple dtbs and fall in a combinatorial pit, we propose to use DT overlays.
Patch #1 "spl: fit: Add support for applying DT overlay" has been posted a few weeks ago by Michal Simek. Patch #2 to #5 amend Michal's patch. Patch #6 to #8 are simple fixes for the Makefile Patch #9 is not required but relates to this series and will be required later by the AM6x platform Patch #10 is used to reduce the complexity of the Makefile by having FIT generator scripts provide their dependencies Patch #12 adds a way to dynamically select the DT overlays. That is were we would use HW detection to select the required overlays. In that case, the board-level code tells what overlay it needs (it gives the name of the node).
On arm, if overlay are supported, this series increases the size of the SPL by 3.2 kB.
Travis build : https://travis-ci.org/jjhiblot/u-boot/builds/535686392 For a strange reason, buildman on travis show errors for sun8i ans sun50i, but pass when I run it locally.
Changes in v3:
- Add a new config option: SPL_LOAD_FIT_APPLY_OVERLAY. By default, it is
not selected.
- removed the RFC prefix. This work will be needed soon by TI's AM65x
platform. and can probably benefit other modular platforms
- removed the last patch that provided an example of how to use this with
on a DRA76.
- removed the patch that made u-boot.img a symlink to u-boot.itb because
it breaks the build of many platforms (because files required to build the ITB are missing)
- removed the patch to reduce the footprint of the am335x SPL. (already
merged)
- Made the boot flow more permissive (don't fail immediately if an overlay
is not present) and more verbose when an error occures
- handle the dependencies of the FIT generation in a more generic way
- use a dedicated kconfig option to enable the application of the overlays
by the SPL.
Changes in v2:
- reworked board_fit_get_additionnal_images() and how it used in spl_fit.c
- removed dtbo generation from dtso files and use .dts extension for the overlays
- add dynamic allocation usage in a separate patch
- defconfig change for the am335x_evm
Jean-Jacques Hiblot (11): spl: fit: Make room in the FDT before applying overlays spl: fit: allocate a temporary buffer to load the overlays spl: fit: Do not fail immediately if an overlay is not available spl: fit: be more verbose when an error occurs when applying the overlays Makefile.lib: include /__symbols__ in dtb if SPL_LOAD_FIT_APPLY_OVERLAY is enabled Makefile: Fix tests for CONFIG_SPL_LOAD_FIT and CONFIG_SPL_FIT_GENERATOR Makefile: Fix u-boot.itb generation when building outside the source tree Makefile: Pass the board name to the FIT generator scripts Makefile: Query the SPL Fit Generator for its dependencies spl: fit: constify the output parameter of spl_fit_get_image_name() spl: fit: Allow the board to tell if more images must be loaded from FIT
Michal Simek (1): spl: fit: Add support for applying DT overlay
Kconfig | 10 +++ Makefile | 23 +++-- arch/arm/mach-imx/mkimage_fit_atf.sh | 10 ++- arch/arm/mach-rockchip/make_fit_atf.py | 13 ++- board/sunxi/mksunxi_fit_atf.sh | 7 ++ .../lion_rk3368/fit_spl_atf.its | 6 +- .../puma_rk3399/fit_spl_atf.its | 8 +- common/spl/spl_fit.c | 90 +++++++++++++++++-- include/spl.h | 16 ++++ scripts/Makefile.lib | 4 + 10 files changed, 156 insertions(+), 31 deletions(-)
So where are we at here? Simon Glass had a few nits on one patch and reviewed the rest. I don't see any review from Michal and I really would like to before applying this as xilinx is another SoC that would be making use of this feature, yes? Thanks folks!
I did not take the time to correct all the nits but I'll do that shortly (tomorrow probably)
The only problematic part for me will be testing with the sandbox for which I have nothing in store.
JJ

On 26. 07. 19 21:46, Tom Rini wrote:
On Thu, May 23, 2019 at 12:39:00PM +0200, Jean-Jacques Hiblot wrote:
The purpose of this series is to provide the SPL with ability to apply overlays for u-boot. this is only a RFC so far, to get a feedback on the approach.
Our use-case is the support of the daughter boards of the AM65x EVM. In Linux, each board is supported by a unique overlay. The presence of the boards is detected at runtime, and some useful features (like USB) are implemented on those daughter boards. Instead of providing multiple dtbs and fall in a combinatorial pit, we propose to use DT overlays.
Patch #1 "spl: fit: Add support for applying DT overlay" has been posted a few weeks ago by Michal Simek. Patch #2 to #5 amend Michal's patch. Patch #6 to #8 are simple fixes for the Makefile Patch #9 is not required but relates to this series and will be required later by the AM6x platform Patch #10 is used to reduce the complexity of the Makefile by having FIT generator scripts provide their dependencies Patch #12 adds a way to dynamically select the DT overlays. That is were we would use HW detection to select the required overlays. In that case, the board-level code tells what overlay it needs (it gives the name of the node).
On arm, if overlay are supported, this series increases the size of the SPL by 3.2 kB.
Travis build : https://travis-ci.org/jjhiblot/u-boot/builds/535686392 For a strange reason, buildman on travis show errors for sun8i ans sun50i, but pass when I run it locally.
Changes in v3:
- Add a new config option: SPL_LOAD_FIT_APPLY_OVERLAY. By default, it is
not selected.
- removed the RFC prefix. This work will be needed soon by TI's AM65x
platform. and can probably benefit other modular platforms
- removed the last patch that provided an example of how to use this with
on a DRA76.
- removed the patch that made u-boot.img a symlink to u-boot.itb because
it breaks the build of many platforms (because files required to build the ITB are missing)
- removed the patch to reduce the footprint of the am335x SPL. (already
merged)
- Made the boot flow more permissive (don't fail immediately if an overlay
is not present) and more verbose when an error occures
- handle the dependencies of the FIT generation in a more generic way
- use a dedicated kconfig option to enable the application of the overlays
by the SPL.
Changes in v2:
- reworked board_fit_get_additionnal_images() and how it used in spl_fit.c
- removed dtbo generation from dtso files and use .dts extension for the overlays
- add dynamic allocation usage in a separate patch
- defconfig change for the am335x_evm
Jean-Jacques Hiblot (11): spl: fit: Make room in the FDT before applying overlays spl: fit: allocate a temporary buffer to load the overlays spl: fit: Do not fail immediately if an overlay is not available spl: fit: be more verbose when an error occurs when applying the overlays Makefile.lib: include /__symbols__ in dtb if SPL_LOAD_FIT_APPLY_OVERLAY is enabled Makefile: Fix tests for CONFIG_SPL_LOAD_FIT and CONFIG_SPL_FIT_GENERATOR Makefile: Fix u-boot.itb generation when building outside the source tree Makefile: Pass the board name to the FIT generator scripts Makefile: Query the SPL Fit Generator for its dependencies spl: fit: constify the output parameter of spl_fit_get_image_name() spl: fit: Allow the board to tell if more images must be loaded from FIT
Michal Simek (1): spl: fit: Add support for applying DT overlay
Kconfig | 10 +++ Makefile | 23 +++-- arch/arm/mach-imx/mkimage_fit_atf.sh | 10 ++- arch/arm/mach-rockchip/make_fit_atf.py | 13 ++- board/sunxi/mksunxi_fit_atf.sh | 7 ++ .../lion_rk3368/fit_spl_atf.its | 6 +- .../puma_rk3399/fit_spl_atf.its | 8 +- common/spl/spl_fit.c | 90 +++++++++++++++++-- include/spl.h | 16 ++++ scripts/Makefile.lib | 4 + 10 files changed, 156 insertions(+), 31 deletions(-)
So where are we at here? Simon Glass had a few nits on one patch and reviewed the rest. I don't see any review from Michal and I really would like to before applying this as xilinx is another SoC that would be making use of this feature, yes? Thanks folks!
I took July off and trying to catch all emails that's why please give me some time to take a look at it again. I need to take a look how to improve that hw detection for applying to overlay.
M
participants (4)
-
Jean-Jacques Hiblot
-
Michal Simek
-
Simon Glass
-
Tom Rini