Support automatic fitImage config selection
v3 cover Support automatic fitImage config selection
This was part of a cleanup series for GE Bx50v3 board. Board specific patches have already been merged to i.MX tree; this needs to be applied to get the default configuration working again.
Changes since PATCHv2:
* rebase against imx/next (so basically drop patches 1,4,5)
* drop OF_LIBFDT_OVERLAY ifdef removal from PATCH 1, this change requires more work
-- Sebastian
Sebastian Reichel (2):
image: cleanup pre-processor usage
image: support board_fit_config_name_match
common/image-fit.c | 65 +++++++++++++++++++++++----------------------- include/image.h | 4 +++ 2 files changed, 37 insertions(+), 32 deletions(-)
Signature · 1 line
2.29.2
PATCH v3 1/2 image: cleanup pre-processor usage
Replace most #ifdef checks for USE_HOSTCC and CONFIG_* with normal if instructions.
--- common/image-fit.c | 46 ++++++++++++++++++++-------------------------- include/image.h | 4 ++++ 2 files changed, 24 insertions(+), 26 deletions(-)
common/image-fit.c +20 -26
@@ -15,7 +15,6 @@#include <u-boot/crc.h> #else #include <linux/compiler.h> -#include <linux/kconfig.h> #include <common.h> #include <errno.h> #include <log.h>
@@ -28,6 +27,7 @@ DECLARE_GLOBAL_DATA_PTR;#include <bootm.h> #include <image.h> #include <bootstage.h> +#include <linux/kconfig.h> #include <u-boot/crc.h> #include <u-boot/md5.h> #include <u-boot/sha1.h>
@@ -486,16 +486,16 @@ void fit_image_print(const void *fit, int image_noffset, const char *p) ret =fit_image_get_data_and_size (fit, image_noffset, &data, &size); -#ifndef USE_HOSTCC -printf ("%s Data Start: " , p); -if (ret) { -printf ("unavailable\n" ); - }else { -void *vdata = (void *)data; +if (!host_build ()) { +printf ("%s Data Start: " , p); +if (ret) { +printf ("unavailable\n" ); + }else { +void *vdata = (void *)data; -printf ("0x%08lx\n" , (ulong )map_to_sysmem (vdata)); +printf ("0x%08lx\n" , (ulong )map_to_sysmem (vdata)); + } } -#endif printf ("%s Data Size: " , p);if (ret)
@@ -1420,7 +1420,6 @@ int fit_all_image_verify(const void *fit)return 1 ; } -#ifdef CONFIG_FIT_CIPHER static int fit_image_uncipher (const void *fit,int image_noffset,void **data,size_t *size) {
@@ -1444,7 +1443,6 @@ static int fit_image_uncipher(const void *fit, int image_noffset, out:return ret; } -#endif /* CONFIG_FIT_CIPHER */ /** * fit_image_check_os - check whether image node is of a given os type
@@ -1486,9 +1484,8 @@ int fit_image_check_arch(const void *fit, int noffset, uint8_t arch)uint8_t image_arch;int aarch32_support =0 ; -#ifdef CONFIG_ARM64_SUPPORT_AARCH32 - aarch32_support =1 ; -#endif +if (IS_ENABLED (CONFIG_ARM64_SUPPORT_AARCH32 )) + aarch32_support =1 ;if (fit_image_get_arch (fit, noffset, &image_arch))return 0 ;
@@ -1977,13 +1974,13 @@ int fit_image_load(bootm_headers_t *images, ulong addr, }bootstage_mark (bootstage_id +BOOTSTAGE_SUB_CHECK_ARCH ); -#if !defined(USE_HOSTCC ) && !defined(CONFIG_SANDBOX ) -if (!fit_image_check_target_arch (fit, noffset)) { -puts ("Unsupported Architecture\n" ); -bootstage_error (bootstage_id +BOOTSTAGE_SUB_CHECK_ARCH ); -return -ENOEXEC ; +if (!host_build () &&IS_ENABLED (CONFIG_SANDBOX )) { +if (!fit_image_check_target_arch (fit, noffset)) { +puts ("Unsupported Architecture\n" ); +bootstage_error (bootstage_id +BOOTSTAGE_SUB_CHECK_ARCH ); +return -ENOEXEC ; + } } -#endif #ifndef USE_HOSTCC fit_image_get_arch (fit, noffset, &os_arch);
@@ -2029,9 +2026,8 @@ int fit_image_load(bootm_headers_t *images, ulong addr,return -ENOENT ; } -#ifdef CONFIG_FIT_CIPHER /* Decrypt data before uncompress/move */ -if (IMAGE_ENABLE_DECRYPT ) { +if (IS_ENABLED (CONFIG_FIT_CIPHER ) &&IMAGE_ENABLE_DECRYPT ) {puts (" Decrypting Data ... " );if (fit_image_uncipher (fit, noffset, &buf, &size)) {puts ("Error\n" );
@@ -2039,12 +2035,10 @@ int fit_image_load(bootm_headers_t *images, ulong addr, }puts ("OK\n" ); } -#endif -#if !defined(USE_HOSTCC ) && defined(CONFIG_FIT_IMAGE_POST_PROCESS )/* perform any post-processing on the image data */ -board_fit_image_post_process (&buf, &size); -#endif +if (!host_build () &&IS_ENABLED (CONFIG_FIT_IMAGE_POST_PROCESS )) +board_fit_image_post_process (&buf, &size); len = (ulong )size;
include/image.h +4 -0
@@ -1552,6 +1552,10 @@ int board_fit_config_name_match(const char *name);* @return no return value (failure should be handled internally) */ void board_fit_image_post_process (void **p_image,size_t *p_size); +#else +static inline void board_fit_image_post_process (void **p_image,size_t *p_size) +{ +}#endif /* CONFIG_SPL_FIT_IMAGE_POST_PROCESS */ #define FDT_ERROR ((ulong)(-1))
Signature · 1 line
2.29.2
PATCH v3 1/2 image: cleanup pre-processor usage
Quoted 5 lines · Sebastian Reichel
Replace most #ifdef checks for
USE_HOSTCCand CONFIG_* with normal if instructions.Reviewed-by Simon Glass <[email protected]>Signed-off-by Sebastian Reichel <[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: 659 bytes Desc: not available URL: <https://lists.denx.de/pipermail/u-boot/attachments/20210106/685c1d89/attachment.sig>
PATCH v3 2/2 image: support board_fit_config_name_match
In reply to Sebastian ReichelSupport reusing board_fit_config_name_match() to automatically select a sensible default configuration for booting fitImages using 'bootm'.
--- common/image-fit.c | 19 +++++++++++++------ 1 file changed, 13 insertions(+), 6 deletions(-)
common/image-fit.c +13 -6
@@ -1738,12 +1738,19 @@ int fit_conf_get_node(const void *fit, const char *conf_uname)if (conf_uname ==NULL ) {/* get configuration unit name from the default property */ debug ("No configuration specified, trying default...\n" ); - conf_uname = (char *)fdt_getprop (fit, confs_noffset, -FIT_DEFAULT_PROP , &len); -if (conf_uname ==NULL ) { -fit_get_debug (fit, confs_noffset,FIT_DEFAULT_PROP , - len); -return len; +if (!host_build () &&IS_ENABLED (CONFIG_MULTI_DTB_FIT )) { + noffset =fit_find_config_node (fit); +if (noffset <0 ) +return noffset; + conf_uname =fdt_get_name (fit, noffset,NULL ); + }else { + conf_uname = (char *)fdt_getprop (fit, confs_noffset, +FIT_DEFAULT_PROP , &len); +if (conf_uname ==NULL ) { +fit_get_debug (fit, confs_noffset,FIT_DEFAULT_PROP , + len); +return len; + } }debug ("Found default configuration: '%s'\n" , conf_uname); }
Signature · 1 line
2.29.2
PATCH v3 2/2 image: support board_fit_config_name_match
Quoted 6 lines · Sebastian Reichel
Support reusing
board_fit_config_name_match()to automatically select a sensible default configuration for booting fitImages using 'bootm'.Reviewed-by Simon Glass <[email protected]>Signed-off-by Sebastian Reichel <[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: 659 bytes Desc: not available URL: <https://lists.denx.de/pipermail/u-boot/attachments/20210106/48290356/attachment.sig>