diff mbox series

[U-Boot,v3,06/14] fit: Do not throw away extra configuration on fit_image_load()

Message ID 1504555943-12893-7-git-send-email-pantelis.antoniou@konsulko.com
State Accepted
Commit 7c3dc776b91a683b2f7dd40ed91361124a3a91c0
Delegated to: Simon Glass
Headers show
Series uboot overlays, FIT image & unittest | expand

Commit Message

Pantelis Antoniou Sept. 4, 2017, 8:12 p.m. UTC
fit_image_load() threw away the extra configuration parts when
loading. We need them around for applying extra overlays for
building the boot fdt.

Signed-off-by: Pantelis Antoniou <pantelis.antoniou@konsulko.com>
---
 common/image-fit.c | 11 +++++++----
 1 file changed, 7 insertions(+), 4 deletions(-)

Comments

Simon Glass Sept. 9, 2017, 4:53 a.m. UTC | #1
Hi,

On 4 September 2017 at 14:12, Pantelis Antoniou
<pantelis.antoniou@konsulko.com> wrote:
> fit_image_load() threw away the extra configuration parts when
> loading. We need them around for applying extra overlays for
> building the boot fdt.
>
> Signed-off-by: Pantelis Antoniou <pantelis.antoniou@konsulko.com>
> ---
>  common/image-fit.c | 11 +++++++----
>  1 file changed, 7 insertions(+), 4 deletions(-)

Acked-by: Simon Glass <sjg@chromium.org>

>
> diff --git a/common/image-fit.c b/common/image-fit.c
> index 74e5557..e75cb64 100644
> --- a/common/image-fit.c
> +++ b/common/image-fit.c
> @@ -1653,6 +1653,7 @@ int fit_image_load(bootm_headers_t *images, ulong addr,
>         int cfg_noffset, noffset;
>         const char *fit_uname;
>         const char *fit_uname_config;
> +       const char *fit_base_uname_config;
>         const void *fit;
>         const void *buf;
>         size_t size;
> @@ -1668,6 +1669,7 @@ int fit_image_load(bootm_headers_t *images, ulong addr,
>         fit = map_sysmem(addr, 0);
>         fit_uname = fit_unamep ? *fit_unamep : NULL;
>         fit_uname_config = fit_uname_configp ? *fit_uname_configp : NULL;
> +       fit_base_uname_config = NULL;
>         prop_name = fit_get_image_type_property(image_type);
>         printf("## Loading %s from FIT Image at %08lx ...\n", prop_name, addr);
>
> @@ -1701,11 +1703,11 @@ int fit_image_load(bootm_headers_t *images, ulong addr,
>                                         BOOTSTAGE_SUB_NO_UNIT_NAME);
>                         return -ENOENT;
>                 }
> -               fit_uname_config = fdt_get_name(fit, cfg_noffset, NULL);
> -               printf("   Using '%s' configuration\n", fit_uname_config);
> +               fit_base_uname_config = fdt_get_name(fit, cfg_noffset, NULL);
> +               printf("   Using '%s' configuration\n", fit_base_uname_config);
>                 if (image_type == IH_TYPE_KERNEL) {
>                         /* Remember (and possibly verify) this config */
> -                       images->fit_uname_cfg = fit_uname_config;
> +                       images->fit_uname_cfg = fit_base_uname_config;
>                         if (IMAGE_ENABLE_VERIFY && images->verify) {
>                                 puts("   Verifying Hash Integrity ... ");
>                                 if (fit_config_verify(fit, cfg_noffset)) {
> @@ -1861,7 +1863,8 @@ int fit_image_load(bootm_headers_t *images, ulong addr,
>         if (fit_unamep)
>                 *fit_unamep = (char *)fit_uname;
>         if (fit_uname_configp)
> -               *fit_uname_configp = (char *)fit_uname_config;
> +               *fit_uname_configp = (char *)(fit_uname_config ? :
> +                                             fit_base_uname_config);

I just learned something I didn't know about C.

>
>         return noffset;
>  }
> --
> 2.1.4
>
Simon Glass Sept. 15, 2017, 7:19 p.m. UTC | #2
Hi,

On 4 September 2017 at 14:12, Pantelis Antoniou
<pantelis.antoniou@konsulko.com> wrote:
> fit_image_load() threw away the extra configuration parts when
> loading. We need them around for applying extra overlays for
> building the boot fdt.
>
> Signed-off-by: Pantelis Antoniou <pantelis.antoniou@konsulko.com>
> ---
>  common/image-fit.c | 11 +++++++----
>  1 file changed, 7 insertions(+), 4 deletions(-)

Acked-by: Simon Glass <sjg@chromium.org>

>
Applied to u-boot-fdt thanks!
diff mbox series

Patch

diff --git a/common/image-fit.c b/common/image-fit.c
index 74e5557..e75cb64 100644
--- a/common/image-fit.c
+++ b/common/image-fit.c
@@ -1653,6 +1653,7 @@  int fit_image_load(bootm_headers_t *images, ulong addr,
 	int cfg_noffset, noffset;
 	const char *fit_uname;
 	const char *fit_uname_config;
+	const char *fit_base_uname_config;
 	const void *fit;
 	const void *buf;
 	size_t size;
@@ -1668,6 +1669,7 @@  int fit_image_load(bootm_headers_t *images, ulong addr,
 	fit = map_sysmem(addr, 0);
 	fit_uname = fit_unamep ? *fit_unamep : NULL;
 	fit_uname_config = fit_uname_configp ? *fit_uname_configp : NULL;
+	fit_base_uname_config = NULL;
 	prop_name = fit_get_image_type_property(image_type);
 	printf("## Loading %s from FIT Image at %08lx ...\n", prop_name, addr);
 
@@ -1701,11 +1703,11 @@  int fit_image_load(bootm_headers_t *images, ulong addr,
 					BOOTSTAGE_SUB_NO_UNIT_NAME);
 			return -ENOENT;
 		}
-		fit_uname_config = fdt_get_name(fit, cfg_noffset, NULL);
-		printf("   Using '%s' configuration\n", fit_uname_config);
+		fit_base_uname_config = fdt_get_name(fit, cfg_noffset, NULL);
+		printf("   Using '%s' configuration\n", fit_base_uname_config);
 		if (image_type == IH_TYPE_KERNEL) {
 			/* Remember (and possibly verify) this config */
-			images->fit_uname_cfg = fit_uname_config;
+			images->fit_uname_cfg = fit_base_uname_config;
 			if (IMAGE_ENABLE_VERIFY && images->verify) {
 				puts("   Verifying Hash Integrity ... ");
 				if (fit_config_verify(fit, cfg_noffset)) {
@@ -1861,7 +1863,8 @@  int fit_image_load(bootm_headers_t *images, ulong addr,
 	if (fit_unamep)
 		*fit_unamep = (char *)fit_uname;
 	if (fit_uname_configp)
-		*fit_uname_configp = (char *)fit_uname_config;
+		*fit_uname_configp = (char *)(fit_uname_config ? :
+					      fit_base_uname_config);
 
 	return noffset;
 }