Add support for applications of overlays in SPL
v6 cover 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.
Our use-case is the support of the daughter boards of the AM65x and J721e EVMs. 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.
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/600742163
Changes in v6:
- Instead of matching a overlay by the name of it's node. Try to match it first with the description, and then with the node's name. This allows to use makeimg to add the overlays to u-boot.img and not use a custom SPL_FIT_GENERATOR script
Changes in v5:
- Do not allocate the buffer if not needed (no overlay).
- Add a Kconfig option for the buffer size
- board_get_fit_loadable() returns an error code instead of a NULL string in case of failure
-reword commit log
Changes in v4:
- use CONFIG_IS_ENABLED() instead of #idef
- make sure that the temp buffer is freed in all cases
- Use the board driver infrastructure to get the image names from the board code.
- Remove a patch that passed the board name to the FIT generator. If needed the generator can get it from elsewhere
- Add a fix to not load the firmware twice (once as a firmware and once as a loadable)
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:
- depend on SPL_DM
- update the commit log
- 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 (12):
spl: fit: don't load the firmware twice
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
spl: fit: constify the output parameter of spl_fit_get_image_name()
drivers: board: Make the board drivers available in SPL
drivers: board: Add get_fit_loadable()
include: board: provide empty stubs when the BOARD option is not
selected
dts: Add support for adding DT overlays in u-boot.img
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 | 18 +++++ Makefile | 3 +- common/spl/spl_fit.c | 151 ++++++++++++++++++++++++++++++++--- drivers/Makefile | 2 +- drivers/board/Kconfig | 3 + drivers/board/Makefile | 2 +- drivers/board/board-uclass.c | 11 +++ dts/Kconfig | 8 ++ include/board.h | 74 +++++++++++++++++ scripts/Makefile.lib | 4 + 10 files changed, 263 insertions(+), 13 deletions(-)
Signature · 1 line
2.17.1
PATCH v6 1/13 spl: fit: don't load the firmware twice
When u-boot.img is a FIT image generated automatically by mkimage, the configuration node has the following structure:
conf-1 {
description = "k3-am654-base-board";
firmware = "firmware-1";
loadables = "firmware-1";
fdt = "fdt-1";
};
The firmware is referenced twice. Once by the 'firmware' property and once by the 'loadables' property. Currently this result in the firmware being loaded twice. This is not a big problem but has an impact on the boot time.
Fixing it by not loading a loadable image if it is also the firmware image.
---
Changes in v6: None
Changes in v5: None
Changes in v4: None
Changes in v3: None
Changes in v2: None
common/spl/spl_fit.c | 10 ++++++++++ 1 file changed, 10 insertions(+)
common/spl/spl_fit.c +10 -0
@@ -373,6 +373,7 @@ int spl_load_simple_fit(struct spl_image_info *spl_image,int images, ret;int base_offset, hsize, align_len =ARCH_DMA_MINALIGN -1 ;int index =0 ; +int firmware_node;/* * For FIT with external data, figure out where the external images
@@ -502,6 +503,7 @@ int spl_load_simple_fit(struct spl_image_info *spl_image,spl_fit_append_fdt (spl_image, info, sector, fit, images, base_offset); + firmware_node = node;/* Now check if there are more images for us to load */ for (; ; index++) {uint8_t os_type =IH_OS_INVALID ;
@@ -510,6 +512,14 @@ int spl_load_simple_fit(struct spl_image_info *spl_image,if (node <0 )break ; +/* +* if the firmware is also a loadable, skip it because +* it already has been loaded. This is typically the case with +* u-boot.img generated by mkimage. +*/ +if (firmware_node == node) +continue ; + ret =spl_load_fit_image (info, sector, fit, base_offset, node, &image_info);if (ret <0 )
Signature · 1 line
2.17.1
PATCH v6 1/13 spl: fit: don't load the firmware twice
Quoted 15 lines · Jean-Jacques Hiblot
When u-boot.img is a FIT image generated automatically by mkimage, the configuration node has the following structure:
conf-1 { description = "k3-am654-base-board"; firmware = "firmware-1"; loadables = "firmware-1"; fdt = "fdt-1"; };The firmware is referenced twice. Once by the 'firmware' property and once by the 'loadables' property. Currently this result in the firmware being loaded twice. This is not a big problem but has an impact on the boot time.
Fixing it by not loading a loadable image if it is also the firmware image.
Quoted 3 lines
Signed-off-by Jean-Jacques Hiblot <[email protected]>Reviewed-by Simon Glass <[email protected]>Tested-by Andreas Dannenberg <[email protected]>
Applied to u-boot/master, thanks!
Signature · 8 lines
Tom -------------- next part -------------- A non-text attachment was scrubbed... Name: signature.asc Type: application/pgp-signature Size: 833 bytes Desc: not available URL: <https://lists.denx.de/pipermail/u-boot/attachments/20200108/2e81e7ed/attachment.sig>
PATCH v6 2/13 spl: fit: Add support for applying DT overlay
In reply to Jean-Jacques HiblotFrom: Michal Simek <[email protected]>
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.
---
Changes in v6: None
Changes in v5: None
Changes in v4:
- use CONFIG_IS_ENABLED() instead of #idef
Changes in v3:
- Add a new config option: SPL_LOAD_FIT_APPLY_OVERLAY. By default, it is not selected.
Changes in v2: None
Kconfig | 9 +++++++++ common/spl/spl_fit.c | 30 +++++++++++++++++++++++++++--- 2 files changed, 36 insertions(+), 3 deletions(-)
Kconfig +9 -0
@@ -429,6 +429,15 @@ 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 + 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 (full fitImage features)" select SPL_FIT
common/spl/spl_fit.c +27 -3
@@ -281,7 +281,7 @@ 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 =0 ; +int node, ret =0 , index =0 ;/* * Use the address following the image as target address for the
@@ -290,7 +290,7 @@ static int spl_fit_append_fdt(struct spl_image_info *spl_image, image_info.load_addr = spl_image->load_addr + spl_image->size;/* 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__);
@@ -315,8 +315,32 @@ 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 (CONFIG_IS_ENABLED (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 )); + } + }return ret; }
Signature · 1 line
2.17.1
PATCH v6 2/13 spl: fit: Add support for applying DT overlay
Quoted 15 lines · Jean-Jacques Hiblot
From: Michal Simek <[email protected]>
doc/uImage.FIT/overlay-fdt-boot.txtis 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"; };
Quoted 6 lines
The whole feature depends on
OF_LIBFDT_OVERLAYwhich is adding +4kB code and 0 for platforms which are not enabling this feature.Signed-off-by Michal Simek <[email protected]>Signed-off-by Jean-Jacques Hiblot <[email protected]>Reviewed-by Simon Glass <[email protected]>
Applied to u-boot/master, thanks!
Signature · 8 lines
Tom -------------- next part -------------- A non-text attachment was scrubbed... Name: signature.asc Type: application/pgp-signature Size: 833 bytes Desc: not available URL: <https://lists.denx.de/pipermail/u-boot/attachments/20200108/4d0c4fa0/attachment.sig>
PATCH v6 3/13 spl: fit: Make room in the FDT before applying overlays
In reply to Jean-Jacques HiblotMake 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.
---
Changes in v6: None
Changes in v5: None
Changes in v4: None
Changes in v3: None
Changes in v2: None
common/spl/spl_fit.c | 17 ++++++++++++----- 1 file changed, 12 insertions(+), 5 deletions(-)
common/spl/spl_fit.c +12 -5
@@ -313,11 +313,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 (CONFIG_IS_ENABLED (LOAD_FIT_APPLY_OVERLAY )) {for (; ; index++) { node = spl_fit_get_image_node(fit, images, FIT_FDT_PROP,
@@ -332,6 +327,12 @@ static int spl_fit_append_fdt(struct spl_image_info *spl_image,if (ret <0 )return ret; +/* Make room in FDT for changes 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)
@@ -341,6 +342,12 @@ static int spl_fit_append_fdt(struct spl_image_info *spl_image, fit_get_name(fit, node, NULL)); } } +/* 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; }
Signature · 1 line
2.17.1
PATCH v6 3/13 spl: fit: Make room in the FDT before applying overlays
Quoted 8 lines · Jean-Jacques Hiblot
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 <[email protected]>Reviewed-by Simon Glass <[email protected]>
Applied to u-boot/master, thanks!
Signature · 8 lines
Tom -------------- next part -------------- A non-text attachment was scrubbed... Name: signature.asc Type: application/pgp-signature Size: 833 bytes Desc: not available URL: <https://lists.denx.de/pipermail/u-boot/attachments/20200108/ce73ac29/attachment.sig>
PATCH v6 4/13 spl: fit: allocate a temporary buffer to load the overlays
In reply to Jean-Jacques HiblotIf 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 buffer that will be used as a default load address. By default, the size of the buffer is 64kB which should be plenty for most use cases.
---
Changes in v6: None
Changes in v5:
- Do not allocate the buffer if not needed (no overlay).
- Add a Kconfig option for the buffer size
Changes in v4:
- make sure that the temp buffer is freed in all cases
Changes in v3: None
Changes in v2: None
Kconfig | 9 +++++++++ common/spl/spl_fit.c | 34 +++++++++++++++++++++++++++++----- 2 files changed, 38 insertions(+), 5 deletions(-)
Kconfig +9 -0
@@ -438,6 +438,15 @@ config SPL_LOAD_FIT_APPLY_OVERLAY also load device-tree overlays from the FIT image an apply them over the device tree. +config SPL_LOAD_FIT_APPLY_OVERLAY_BUF_SZ + depends on SPL_LOAD_FIT_APPLY_OVERLAY + default 0x10000 + hex "size of temporary buffer used to load the overlays" + help + The size of the area where the overlays will be loaded and + uncompress. Must be at least as large as biggest overlay + (uncompressed) + config SPL_LOAD_FIT_FULL bool "Enable SPL loading U-Boot as a FIT (full fitImage features)" select SPL_FIT
common/spl/spl_fit.c +29 -5
@@ -9,11 +9,16 @@#include <fpga.h> #include <gzip.h> #include <image.h> -#include <linux/libfdt.h> +#include <malloc.h> #include <spl.h> +#include <linux/libfdt.h> DECLARE_GLOBAL_DATA_PTR ; +#ifndef CONFIG_SPL_LOAD_FIT_APPLY_OVERLAY_BUF_SZ +#define CONFIG_SPL_LOAD_FIT_APPLY_OVERLAY_BUF_SZ (64 * 1024) +#endif +#ifndef CONFIG_SYS_BOOTM_LEN #define CONFIG_SYS_BOOTM_LEN (64 << 20)#endif
@@ -314,33 +319,52 @@ 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 (CONFIG_IS_ENABLED (LOAD_FIT_APPLY_OVERLAY )) { +void *tmpbuffer =NULL ; +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 ; +break ; } +if (!tmpbuffer) { +/* +* allocate memory to store the DT overlay +* before it is applied. It may not be used +* depending on how the overlay is stored, so +* don't fail yet if the allocation failed. +*/ + tmpbuffer =malloc (CONFIG_SPL_LOAD_FIT_APPLY_OVERLAY_BUF_SZ ); +if (!tmpbuffer) +debug ("%s: unable to allocate space for overlays\n" , + __func__); + } + image_info.load_addr = (ulong )tmpbuffer; ret =spl_load_fit_image (info, sector, fit, base_offset, node, &image_info);if (ret <0 ) -return ret; +break ;/* Make room in FDT for changes from the overlay */ ret =fdt_increase_size (spl_image->fdt_addr, image_info.size);if (ret <0 ) -return ret; +break ; ret =fdt_overlay_apply_verbose (spl_image->fdt_addr, (void *)image_info.load_addr);if (ret) -return ret; +break ;debug ("%s: DT overlay %s applied\n" , __func__,fit_get_name (fit, node,NULL )); } +if (tmpbuffer) +free (tmpbuffer); +if (ret) +return ret; }/* Try to make space, so we can inject details on the loadables */ ret =fdt_shrink_to_minimum (spl_image->fdt_addr,8192 );
Signature · 1 line
2.17.1
PATCH v6 4/13 spl: fit: allocate a temporary buffer to load the overlays
Quoted 19 lines · Jean-Jacques Hiblot
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 buffer that will be used as a default load address. By default, the size of the buffer is 64kB which should be plenty for most use cases.Signed-off-by Jean-Jacques Hiblot <[email protected]>---
Changes in v6: None
Changes in v5:
- Do not allocate the buffer if not needed (no overlay).
- Add aKconfigoption for the buffer sizeChanges in v4:
- make sure that the temp buffer is freed in all cases
Quoted 6 lines
Changes in v3: None
Changes in v2: NoneKconfig | 9 +++++++++ common/spl/spl_fit.c | 34 +++++++++++++++++++++++++++++----- 2 files changed, 38 insertions(+), 5 deletions(-)
PATCH v6 4/13 spl: fit: allocate a temporary buffer to load the overlays
In reply to Jean-Jacques HiblotQuoted 8 lines · Jean-Jacques Hiblot
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 buffer that will be used as a default load address. By default, the size of the buffer is 64kB which should be plenty for most use cases.Signed-off-by Jean-Jacques Hiblot <[email protected]>Reviewed-by Simon Glass <[email protected]>
Applied to u-boot/master, thanks!
Signature · 8 lines
Tom -------------- next part -------------- A non-text attachment was scrubbed... Name: signature.asc Type: application/pgp-signature Size: 833 bytes Desc: not available URL: <https://lists.denx.de/pipermail/u-boot/attachments/20200108/2b889392/attachment.sig>
PATCH v6 5/13 spl: fit: Do not fail immediately if an overlay is not available
In reply to Jean-Jacques HiblotIf 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.
---
Changes in v6: None
Changes in v5: None
Changes in v4: None
Changes in v3: None
Changes in v2: None
common/spl/spl_fit.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-)
common/spl/spl_fit.c +5 -1
@@ -324,9 +324,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__);break ; + }else if (node <0 ) { +debug ("%s: unable to find FDT node %d\n" , + __func__, index); +continue ; }if (!tmpbuffer) {
Signature · 1 line
2.17.1
PATCH v6 5/13 spl: fit: Do not fail immediately if an overlay is not available
Quoted 6 lines · Jean-Jacques Hiblot
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 <[email protected]>Reviewed-by Simon Glass <[email protected]>
Applied to u-boot/master, thanks!
Signature · 8 lines
Tom -------------- next part -------------- A non-text attachment was scrubbed... Name: signature.asc Type: application/pgp-signature Size: 833 bytes Desc: not available URL: <https://lists.denx.de/pipermail/u-boot/attachments/20200108/05cb783e/attachment.sig>
PATCH v6 6/13 spl: fit: be more verbose when an error occurs when applying the overlays
In reply to Jean-Jacques HiblotThere 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.
---
Changes in v6: None
Changes in v5: None
Changes in v4: None
Changes in v3: None
Changes in v2: None
common/spl/spl_fit.c | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-)
common/spl/spl_fit.c +5 -2
@@ -113,7 +113,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 ; }
@@ -359,8 +359,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 ));break ; + }debug ("%s: DT overlay %s applied\n" , __func__,fit_get_name (fit, node,NULL ));
Signature · 1 line
2.17.1
PATCH v6 6/13 spl: fit: be more verbose when an error occurs when applying the overlays
Quoted 11 lines · Jean-Jacques Hiblot
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 <[email protected]>Reviewed-by Simon Glass <[email protected]>
Applied to u-boot/master, thanks!
Signature · 8 lines
Tom -------------- next part -------------- A non-text attachment was scrubbed... Name: signature.asc Type: application/pgp-signature Size: 833 bytes Desc: not available URL: <https://lists.denx.de/pipermail/u-boot/attachments/20200108/81e22917/attachment.sig>
PATCH v6 7/13 Makefile.lib: include /__symbols__ in dtb if SPL_LOAD_FIT_APPLY_OVERLAY is enabled
In reply to Jean-Jacques HiblotIn order to apply an overlay to a DTB. The DTB must have been generated with the option '-@'.
---
Changes in v6: None
Changes in v5: None
Changes in v4: None
Changes in v3: None
Changes in v2: None
scripts/Makefile.lib | 4 ++++ 1 file changed, 4 insertions(+)
scripts/Makefile.lib +4 -0
@@ -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
Signature · 1 line
2.17.1
PATCH v6 7/13 Makefile.lib: include /__symbols__ in dtb if SPL_LOAD_FIT_APPLY_OVERLAY is enabled
Quoted 5 lines · Jean-Jacques Hiblot
In order to apply an overlay to a DTB. The DTB must have been generated with the option '-@'.
Signed-off-by Jean-Jacques Hiblot <[email protected]>Reviewed-by Simon Glass <[email protected]>
Applied to u-boot/master, thanks!
Signature · 8 lines
Tom -------------- next part -------------- A non-text attachment was scrubbed... Name: signature.asc Type: application/pgp-signature Size: 833 bytes Desc: not available URL: <https://lists.denx.de/pipermail/u-boot/attachments/20200108/c7b7befa/attachment.sig>
PATCH v6 8/13 spl: fit: constify the output parameter of spl_fit_get_image_name()
In reply to Jean-Jacques HiblotThere is no need for it to be non-constant. Making it constant, allows to return constant string without warning.
---
Changes in v6: None
Changes in v5: None
Changes in v4: None
Changes in v3: None
Changes in v2: None
common/spl/spl_fit.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-)
common/spl/spl_fit.c +3 -3
@@ -46,7 +46,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;
@@ -101,7 +101,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;
@@ -387,7 +387,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",
Signature · 1 line
2.17.1
PATCH v6 8/13 spl: fit: constify the output parameter of spl_fit_get_image_name()
Quoted 5 lines · Jean-Jacques Hiblot
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 <[email protected]>Reviewed-by Simon Glass <[email protected]>
Applied to u-boot/master, thanks!
Signature · 8 lines
Tom -------------- next part -------------- A non-text attachment was scrubbed... Name: signature.asc Type: application/pgp-signature Size: 833 bytes Desc: not available URL: <https://lists.denx.de/pipermail/u-boot/attachments/20200108/2607aad0/attachment.sig>
PATCH v6 9/13 drivers: board: Make the board drivers available in SPL
In reply to Jean-Jacques HiblotMake the board driver available in the SPL too. The board driver is a way to provide useful information about the board and that can be useful in the SPL too.
---
Changes in v6: None
Changes in v5: None
Changes in v4: None
Changes in v3: None
Changes in v2:
- depend on SPL_DM
- update the commit log
drivers/Makefile | 2 +- drivers/board/Kconfig | 3 +++ drivers/board/Makefile | 2 +- 3 files changed, 5 insertions(+), 2 deletions(-)
drivers/Makefile +1 -1
@@ -26,6 +26,7 @@ obj-$(CONFIG_$(SPL_TPL_)VIRTIO) += virtio/ obj-$(CONFIG_$(SPL_)DM_MAILBOX) += mailbox/ obj-$(CONFIG_$(SPL_)REMOTEPROC) += remoteproc/ obj-$(CONFIG_$(SPL_TPL_)TPM) += tpm/ +obj-$(CONFIG_$(SPL_)BOARD) += board/ ifndef CONFIG_TPL_BUILD ifdef CONFIG_SPL_BUILD
@@ -77,7 +78,6 @@ obj-y += ata/ obj-$(CONFIG_DM_DEMO) += demo/ obj-$(CONFIG_BIOSEMU) += bios_emulator/ obj-y += block/ -obj-y += board/ obj-$(CONFIG_BOOTCOUNT_LIMIT) += bootcount/ obj-y += cache/ obj-$(CONFIG_CPU) += cpu/
drivers/board/Kconfig +3 -0
@@ -8,6 +8,9 @@ menuconfig BOARD if BOARD +config SPL_BOARD + depends on SPL_DM + bool "Enable board driver support in SPL" config BOARD_GAZERBEAM bool "Enable board driver for the Gazerbeam board"
drivers/board/Makefile +1 -1
@@ -2,6 +2,6 @@ # # (C) Copyright 2017 # Mario Six, Guntermann & Drunck GmbH, mario.six at gdsys.cc -obj-$(CONFIG_BOARD) += board-uclass.o +obj-y += board-uclass.o obj-$(CONFIG_BOARD_GAZERBEAM) += gazerbeam.o obj-$(CONFIG_BOARD_SANDBOX) += sandbox.o
Signature · 1 line
2.17.1
PATCH v6 9/13 drivers: board: Make the board drivers available in SPL
Quoted 6 lines · Jean-Jacques Hiblot
Make the board driver available in the SPL too. The board driver is a way to provide useful information about the board and that can be useful in the SPL too.
Signed-off-by Jean-Jacques Hiblot <[email protected]>Reviewed-by Simon Glass <[email protected]>
Applied to u-boot/master, thanks!
Signature · 8 lines
Tom -------------- next part -------------- A non-text attachment was scrubbed... Name: signature.asc Type: application/pgp-signature Size: 833 bytes Desc: not available URL: <https://lists.denx.de/pipermail/u-boot/attachments/20200108/a1c0bb30/attachment.sig>
PATCH v6 10/13 drivers: board: Add get_fit_loadable()
In reply to Jean-Jacques HiblotThis function will be used by the SPL to get the names of images to load from the FIT. This allows to load different images based on runtime HW detection.
---
Changes in v6: None
Changes in v5:
- board_get_fit_loadable() returns an error code instead of a NULL string in case of failure
Changes in v4: None
Changes in v3: None
Changes in v2: None
drivers/board/board-uclass.c | 11 +++++++++++ include/board.h | 37 ++++++++++++++++++++++++++++++++++++ 2 files changed, 48 insertions(+)
drivers/board/board-uclass.c +11 -0
@@ -23,6 +23,17 @@ int board_detect(struct udevice *dev)return ops->detect (dev); } +int board_get_fit_loadable (struct udevice *dev,int index, +const char *type,const char **strp) +{ +struct board_ops *ops =board_get_ops (dev); + +if (!ops->get_fit_loadable) +return -ENOSYS ; + +return ops->get_fit_loadable (dev, index, type, strp); +} +int board_get_bool (struct udevice *dev,int id,bool *val) {struct board_ops *ops =board_get_ops (dev);
include/board.h +37 -0
@@ -79,6 +79,24 @@ struct board_ops {* Return: 0 if OK, -ve on error. */ int (*get_str)(struct udevice *dev,int id,size_t size,char *val); + +/** +* get_fit_loadable - Get the name of an image to load from FIT +* 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. +* +* @dev: The board instance to gather the data. +* @index: Index of the image. Starts at 0 and gets incremented +* after each call to this function. +* @type: The type of image. For example, "fdt" for DTBs +* @strp: A pointer to string. Untouched if the function fails +* +* Return: 0 if OK, -ENOENT if no loadable is available else -ve on +* error. +*/ +int (*get_fit_loadable)(struct udevice *dev,int index, +const char *type,const char **strp); };#define board_get_ops (dev) ((struct board_ops *)(dev)->driver->ops)
@@ -137,3 +155,22 @@ int board_get_str(struct udevice *dev, int id, size_t size, char *val);* Return: 0 if OK, -ve on error. */ int board_get (struct udevice **devp); + +/** +* board_get_fit_loadable - Get the name of an image to load from FIT +* 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. +* +* @dev: The board instance to gather the data. +* @index: Index of the image. Starts at 0 and gets incremented +* after each call to this function. +* @type: The type of image. For example, "fdt" for DTBs +* @strp: A pointer to string. Untouched if the function fails +* +* +* Return: 0 if OK, -ENOENT if no loadable is available else -ve on +* error. +*/ +int board_get_fit_loadable (struct udevice *dev,int index, +const char *type,const char **strp);
Signature · 1 line
2.17.1
PATCH v6 10/13 drivers: board: Add get_fit_loadable()
Quoted 14 lines · Jean-Jacques Hiblot
This function will be used by the SPL to get the names of images to load from the FIT. This allows to load different images based on runtime HW detection.
Signed-off-by Jean-Jacques Hiblot <[email protected]>---
Changes in v6: None
Changes in v5:
-board_get_fit_loadable()returns an error code instead of a NULL string in case of failure
Quoted 7 lines
Changes in v4: None
Changes in v3: None
Changes in v2: Nonedrivers/board/board-uclass.c | 11 +++++++++++ include/board.h | 37 ++++++++++++++++++++++++++++++++++++ 2 files changed, 48 insertions(+)
PATCH v6 10/13 drivers: board: Add get_fit_loadable()
In reply to Jean-Jacques HiblotQuoted 6 lines · Jean-Jacques Hiblot
This function will be used by the SPL to get the names of images to load from the FIT. This allows to load different images based on runtime HW detection.
Signed-off-by Jean-Jacques Hiblot <[email protected]>Reviewed-by Simon Glass <[email protected]>
Applied to u-boot/master, thanks!
Signature · 8 lines
Tom -------------- next part -------------- A non-text attachment was scrubbed... Name: signature.asc Type: application/pgp-signature Size: 833 bytes Desc: not available URL: <https://lists.denx.de/pipermail/u-boot/attachments/20200108/6a2e2835/attachment.sig>
PATCH v6 11/13 include: board: provide empty stubs when the BOARD option is not selected
In reply to Jean-Jacques HiblotUseful to avoid #ifdef throughout the code that uses the board driver API.
---
Changes in v6: None
Changes in v5: None
Changes in v4: None
Changes in v3: None
Changes in v2: None
include/board.h | 37 +++++++++++++++++++++++++++++++++++++ 1 file changed, 37 insertions(+)
include/board.h +37 -0
@@ -31,6 +31,7 @@* to read the serial number. */ +#if CONFIG_IS_ENABLED (BOARD ) struct board_ops {/** * detect() - Run the hardware info detection procedure for this
@@ -174,3 +175,39 @@ int board_get(struct udevice **devp);*/ int board_get_fit_loadable (struct udevice *dev,int index,const char *type,const char **strp); + +#else + +static inline int board_detect (struct udevice *dev) +{ +return -ENOSYS ; +} + +static inline int board_get_bool (struct udevice *dev,int id,bool *val) +{ +return -ENOSYS ; +} + +static inline int board_get_int (struct udevice *dev,int id,int *val) +{ +return -ENOSYS ; +} + +static inline int board_get_str (struct udevice *dev,int id,size_t size, +char *val) +{ +return -ENOSYS ; +} + +static inline int board_get (struct udevice **devp) +{ +return -ENOSYS ; +} + +static inline int board_get_fit_loadable (struct udevice *dev,int index, +const char *type,const char **strp) +{ +return -ENOSYS ; +} + +#endif
Signature · 1 line
2.17.1
PATCH v6 11/13 include: board: provide empty stubs when the BOARD option is not selected
Quoted 4 lines · Jean-Jacques Hiblot
Useful to avoid #ifdef throughout the code that uses the board driver API.
Signed-off-by Jean-Jacques Hiblot <[email protected]>Reviewed-by Simon Glass <[email protected]>
Applied to u-boot/master, thanks!
Signature · 8 lines
Tom -------------- next part -------------- A non-text attachment was scrubbed... Name: signature.asc Type: application/pgp-signature Size: 833 bytes Desc: not available URL: <https://lists.denx.de/pipermail/u-boot/attachments/20200108/73099435/attachment.sig>
PATCH v6 12/13 dts: Add support for adding DT overlays in u-boot.img
In reply to Jean-Jacques HiblotIf u-boot.img is a FIT image, CONFIG_OF_OVERLAY_LIST can be used to add DT overlays to u-boot.img.
---
Changes in v6: None
Changes in v5: None
Changes in v4: None
Changes in v3: None
Changes in v2: None
Makefile | 3 ++- dts/Kconfig | 8 ++++++++ 2 files changed, 10 insertions(+), 1 deletion(-)
Makefile +2 -1
@@ -1262,7 +1262,8 @@ MKIMAGEFLAGS_u-boot.img = -f auto -A $(ARCH) -T firmware -C none -O u-boot \ -a $(CONFIG_SYS_TEXT_BASE) -e $(CONFIG_SYS_UBOOT_START) \ -p $(CONFIG_FIT_EXTERNAL_OFFSET) \ -n "U-Boot $(UBOOTRELEASE) for $(BOARD) board" -E \ - $(patsubst %,-b arch/$(ARCH)/dts/%.dtb,$(subst ",,$(CONFIG_OF_LIST))) + $(patsubst %,-b arch/$(ARCH)/dts/%.dtb,$(subst ",,$(CONFIG_OF_LIST))) \ + $(patsubst %,-b arch/$(ARCH)/dts/%.dtbo,$(subst ",,$(CONFIG_OF_OVERLAY_LIST))) else MKIMAGEFLAGS_u-boot.img = -A $(ARCH) -T firmware -C none -O u-boot \ -a $(CONFIG_SYS_TEXT_BASE) -e $(CONFIG_SYS_UBOOT_START) \
dts/Kconfig +8 -0
@@ -130,6 +130,14 @@ config OF_LIST device tree files (without the directory or .dtb suffix) separated by <space>. +config OF_OVERLAY_LIST + string "List of device tree overlays to include for DT control" + depends on SPL_LOAD_FIT_APPLY_OVERLAY + help + This option specifies a list of device tree overlaysto use for DT + control. This option can then be used a FIT generator to include + the overlays in the FIT image + choice prompt "SPL OF LIST compression" depends on MULTI_DTB_FIT
Signature · 1 line
2.17.1
PATCH v6 12/13 dts: Add support for adding DT overlays in u-boot.img
Quoted 13 lines · Jean-Jacques Hiblot
If u-boot.img is a FIT image,
CONFIG_OF_OVERLAY_LISTcan be used to add DT overlays to u-boot.img.Signed-off-by Jean-Jacques Hiblot <[email protected]>---
Changes in v6: None
Changes in v5: None
Changes in v4: None
Changes in v3: None
Changes in v2: None
Quoted 3 lines
Makefile | 3 ++- dts/Kconfig | 8 ++++++++ 2 files changed, 10 insertions(+), 1 deletion(-)
nit below
Quoted 20 lines
Makefile +2
-1@@ -1262,7 +1262,8 @@ MKIMAGEFLAGS_u-boot.img = -f auto -A $(ARCH) -T firmware -C none -O u-boot \ -a $(CONFIG_SYS_TEXT_BASE) -e $(CONFIG_SYS_UBOOT_START) \ -p $(CONFIG_FIT_EXTERNAL_OFFSET) \ -n "U-Boot $(UBOOTRELEASE) for $(BOARD) board" -E \ - $(patsubst %,-b arch/$(ARCH)/dts/%.dtb,$(subst ",,$(CONFIG_OF_LIST))) + $(patsubst %,-b arch/$(ARCH)/dts/%.dtb,$(subst ",,$(CONFIG_OF_LIST))) \ + $(patsubst %,-b arch/$(ARCH)/dts/%.dtbo,$(subst ",,$(CONFIG_OF_OVERLAY_LIST))) else MKIMAGEFLAGS_u-boot.img = -A $(ARCH) -T firmware -C none -O u-boot \ -a $(CONFIG_SYS_TEXT_BASE) -e $(CONFIG_SYS_UBOOT_START) \dts/Kconfig +0
-0
dts/Kconfig config OF_LIST · line 137
Quoted 8 lines
dts/Kconfig +5
-0@@ -130,6 +130,14 @@ config OF_LIST device tree files (without the directory or .dtb suffix) separated by <space>. +config OF_OVERLAY_LIST + string "List of device tree overlays to include for DT control" + depends on SPL_LOAD_FIT_APPLY_OVERLAY + help + This option specifies a list of device tree overlaysto use for DT
missing space
dts/Kconfig config OF_LIST · line 138
Quoted 1 line
dts/Kconfig +1
-0+ control. This option can then be used a FIT generator to include
by a FIT generator?
Quoted 8 lines
dts/Kconfig +2
-1+ the overlays in the FIT image + choice prompt "SPL OF LIST compression" depends on MULTI_DTB_FIT --2.17.1
PATCH v6 12/13 dts: Add support for adding DT overlays in u-boot.img
In reply to Jean-Jacques HiblotQuoted 5 lines · Jean-Jacques Hiblot
If u-boot.img is a FIT image,
CONFIG_OF_OVERLAY_LISTcan be used to add DT overlays to u-boot.img.Signed-off-by Jean-Jacques Hiblot <[email protected]>Reviewed-by Simon Glass <[email protected]>
With Simon's nits corrected:
Applied to u-boot/master, thanks!
Signature · 8 lines
Tom -------------- next part -------------- A non-text attachment was scrubbed... Name: signature.asc Type: application/pgp-signature Size: 833 bytes Desc: not available URL: <https://lists.denx.de/pipermail/u-boot/attachments/20200108/b426d41f/attachment.sig>
PATCH v6 13/13 spl: fit: Allow the board to tell if more images must be loaded from FIT
In reply to Jean-Jacques Hiblotspl_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 quickly becomes hard to manage combinations of more than a handful of images.
To address this problem, give the board driver code the opportunity to add to the list of images. The images from the FIT property are loaded first, and then the board_get_fit_loadable() is called to get more image names.
---
Changes in v6:
- Instead of matching a overlay by the name of it's node. Try to match it first with the description, and then with the node's name. This allows to use makeimg to add the overlays to u-boot.img and not use a custom SPL_FIT_GENERATOR script
Changes in v5:
-reword commit log
Changes in v4:
- Use the board driver infrastructure to get the image names from the board code.
- Remove a patch that passed the board name to the FIT generator. If needed the generator can get it from elsewhere
- Add a fix to not load the firmware twice (once as a firmware and once as a loadable)
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 | 65 ++++++++++++++++++++++++++++++++++++++++++-- 1 file changed, 62 insertions(+), 3 deletions(-)
common/spl/spl_fit.c +62 -3
@@ -6,6 +6,7 @@#include <common.h> #include <errno.h> +#include <board.h> #include <fpga.h> #include <gzip.h> #include <image.h>
@@ -32,6 +33,29 @@ __weak ulong board_spl_fit_size_align(ulong size)return size; } +static int find_node_from_desc (const void *fit,int node,const char *str) +{ +int child; + +if (node <0 ) +return -EINVAL ; + +/* iterate the FIT nodes and find a matching description */ +for (child =fdt_first_subnode (fit, node); child >=0 ; + child =fdt_next_subnode (fit, child)) { +int len; +const char *desc =fdt_getprop (fit, child,"description" , &len); + +if (!desc) +continue ; + +if (!strcmp (desc, str)) +return child; + } + +return -ENOENT ; +} +/** * 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
@@ -48,10 +72,12 @@ static int spl_fit_get_image_name(const void *fit, int images, const char *type, int index, const char **outname) { + struct udevice *board;const char *name, *str;__maybe_unused int node;int conf_node;int len, i; +bool found = true; conf_node =fit_find_config_node (fit);if (conf_node <0 ) {
@@ -77,12 +103,45 @@ 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 ; + } + } + +if (!found && !board_get (&board)) { +int rc; +/* +* no string in the property for this index. Check if the board +* level code can supply one. +*/ + rc =board_get_fit_loadable (board, index - i -1 , type, &str); +if (rc && rc != -ENOENT ) +return rc; + +if (!rc) { +/* +* The board provided a name for a loadable. +* Try to match it against the description properties +* first. If no matching node is found, use it as a +* node name. +*/ +int node; +int images =fdt_path_offset (fit,FIT_IMAGES_PATH ); + + node =find_node_from_desc (fit, images, str); +if (node >0 ) + str =fdt_get_name (fit, node,NULL ); + + found = true; } } - *outname = (char *)str; +if (!found) { +debug ("no string for index %d\n" , index); +return -E2BIG ; + } + + *outname = str;return 0 ; }
Signature · 1 line
2.17.1
PATCH v6 13/13 spl: fit: Allow the board to tell if more images must be loaded from FIT
Quoted 55 lines · Jean-Jacques Hiblot
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 quickly becomes hard to manage combinations of more than a handful of images.
To address this problem, give the board driver code the opportunity to add to the list of images. The images from the FIT property are loaded first, and then theboard_get_fit_loadable()is called to get more image names.Signed-off-by Jean-Jacques Hiblot <[email protected]>---
Changes in v6:
- Instead of matching a overlay by the name of it's node. Try to match it first with the description, and then with the node's name. This allows to use makeimg to add the overlays to u-boot.img and not use a customSPL_FIT_GENERATORscriptChanges in v5:
-reword commit logChanges in v4:
- Use the board driver infrastructure to get the image names from the board code.
- Remove a patch that passed the board name to the FIT generator. If needed the generator can get it from elsewhere
- Add a fix to not load the firmware twice (once as a firmware and once as a loadable)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:
- reworkedboard_fit_get_additionnal_images()and how it used inspl_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 theam335x_evm
Quoted 2 lines
common/spl/spl_fit.c | 65 ++++++++++++++++++++++++++++++++++++++++++-- 1 file changed, 62 insertions(+), 3 deletions(-)
Can you add a test for this to sandbox_spl?
PATCH v6 13/13 spl: fit: Allow the board to tell if more images must be loaded from FIT
In reply to Jean-Jacques HiblotQuoted 10 lines · Jean-Jacques Hiblot
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 quickly becomes hard to manage combinations of more than a handful of images.
To address this problem, give the board driver code the opportunity to add to the list of images. The images from the FIT property are loaded first, and then theboard_get_fit_loadable()is called to get more image names.
Quoted 2 lines
Signed-off-by Jean-Jacques Hiblot <[email protected]>Reviewed-by Simon Glass <[email protected]>
Applied to u-boot/master, thanks!
Signature · 8 lines
Tom -------------- next part -------------- A non-text attachment was scrubbed... Name: signature.asc Type: application/pgp-signature Size: 833 bytes Desc: not available URL: <https://lists.denx.de/pipermail/u-boot/attachments/20200108/c527f79e/attachment.sig>
v6 cover Add support for applications of overlays in SPL
In reply to Jean-Jacques HiblotTom, Simon,
gentle ping on this series. It has been posted for a long time and I did not push for it because I was working on other stuff. am654x and J7x SOCs will need this kind of feature.
Before sending a version rebased on latest u-boot, I would have liked to have your feeling on the series as a whole.
JJ
Quoted 97 lines · Jean-Jacques Hiblot
The purpose of this series is to provide the SPL with ability to apply overlays for u-boot.
Our use-case is the support of the daughter boards of the AM65x and J721e EVMs. 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.
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/600742163
Changes in v6:
- Instead of matching a overlay by the name of it's node. Try to match it first with the description, and then with the node's name. This allows to use makeimg to add the overlays to u-boot.img and not use a customSPL_FIT_GENERATORscriptChanges in v5:
- Do not allocate the buffer if not needed (no overlay).
- Add aKconfigoption for the buffer size
-board_get_fit_loadable()returns an error code instead of a NULL string in case of failure
-reword commit logChanges in v4:
- useCONFIG_IS_ENABLED()instead of #idef
- make sure that the temp buffer is freed in all cases
- Use the board driver infrastructure to get the image names from the board code.
- Remove a patch that passed the board name to the FIT generator. If needed the generator can get it from elsewhere
- Add a fix to not load the firmware twice (once as a firmware and once as a loadable)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:
- depend onSPL_DM
- update the commit log
- reworkedboard_fit_get_additionnal_images()and how it used inspl_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 theam335x_evmJean-Jacques Hiblot (12):
spl: fit: don't load the firmware twice
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_OVERLAYis enabled
spl: fit: constify the output parameter ofspl_fit_get_image_name()
drivers: board: Make the board drivers available in SPL
drivers: board: Addget_fit_loadable()
include: board: provide empty stubs when the BOARD option is not
selected
dts: Add support for adding DT overlays in u-boot.img
spl: fit: Allow the board to tell if more images must be loaded from
FITMichal Simek (1):
spl: fit: Add support for applying DT overlayKconfig | 18 +++++ Makefile | 3 +- common/spl/spl_fit.c | 151 ++++++++++++++++++++++++++++++++--- drivers/Makefile | 2 +- drivers/board/Kconfig | 3 + drivers/board/Makefile | 2 +- drivers/board/board-uclass.c | 11 +++ dts/Kconfig | 8 ++ include/board.h | 74 +++++++++++++++++ scripts/Makefile.lib | 4 + 10 files changed, 263 insertions(+), 13 deletions(-)
v6 cover Add support for applications of overlays in SPL
Hi Jean-Jacques,
Quoted 9 lines · Jean-Jacques Hiblot
Tom, Simon,
gentle ping on this series. It has been posted for a long time and I did not push for it because I was working on other stuff. am654x and J7x SOCs will need this kind of feature.
Before sending a version rebased on latest u-boot, I would have liked to have your feeling on the series as a whole.
It looks fine from my point of view, but does need tests.
- Simon