diff mbox series

[04/10] stm32mp: stm32prog: solve compilation with CONFIG_FIT_SIGNATURE

Message ID 20210518151206.4.I44c0cbd50fa01f82729d1d6d435d0f663b9e7dcb@changeid
State Accepted
Commit 90ed215dd5d3fb4240fe3149eaf23530b6c37420
Delegated to: Patrice Chotard
Headers show
Series stm32mp: stm32prog: several features and fixes | expand

Commit Message

Patrick Delaunay May 18, 2021, 1:12 p.m. UTC
When CONFIG_FIT_SIGNATURE is activated, CONFIG_LEGACY_IMAGE_FORMAT
is deactivated and the define IMAGE_FORMAT_LEGACY don't exist with
include/image.h:
  #if defined(CONFIG_LEGACY_IMAGE_FORMAT)
  #define IMAGE_FORMAT_LEGACY	0x01	/* legacy image_header based format */
  #endif

This patch adds the needed check on compilation flag
CONFIG_LEGACY_IMAGE_FORMAT to avoid the compilation error
for command stm32prog:

cmd_stm32prog.c:81:8: error: ‘IMAGE_FORMAT_LEGACY’ undeclared
(first use in this function); did you mean ‘IMAGE_FORMAT_FIT’?
   81 |    if (IMAGE_FORMAT_LEGACY ==
      |        ^~~~~~~~~~~~~~~~~~~
      |        IMAGE_FORMAT_FIT

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
---

 arch/arm/mach-stm32mp/cmd_stm32prog/cmd_stm32prog.c | 2 ++
 1 file changed, 2 insertions(+)

Comments

Patrice CHOTARD May 28, 2021, 12:53 p.m. UTC | #1
Hi Patrick

On 5/18/21 3:12 PM, Patrick Delaunay wrote:
> When CONFIG_FIT_SIGNATURE is activated, CONFIG_LEGACY_IMAGE_FORMAT
> is deactivated and the define IMAGE_FORMAT_LEGACY don't exist with
> include/image.h:
>   #if defined(CONFIG_LEGACY_IMAGE_FORMAT)
>   #define IMAGE_FORMAT_LEGACY	0x01	/* legacy image_header based format */
>   #endif
> 
> This patch adds the needed check on compilation flag
> CONFIG_LEGACY_IMAGE_FORMAT to avoid the compilation error
> for command stm32prog:
> 
> cmd_stm32prog.c:81:8: error: ‘IMAGE_FORMAT_LEGACY’ undeclared
> (first use in this function); did you mean ‘IMAGE_FORMAT_FIT’?
>    81 |    if (IMAGE_FORMAT_LEGACY ==
>       |        ^~~~~~~~~~~~~~~~~~~
>       |        IMAGE_FORMAT_FIT
> 
> Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
> ---
> 
>  arch/arm/mach-stm32mp/cmd_stm32prog/cmd_stm32prog.c | 2 ++
>  1 file changed, 2 insertions(+)
> 
> diff --git a/arch/arm/mach-stm32mp/cmd_stm32prog/cmd_stm32prog.c b/arch/arm/mach-stm32mp/cmd_stm32prog/cmd_stm32prog.c
> index e584bb52bd..f3790f900f 100644
> --- a/arch/arm/mach-stm32mp/cmd_stm32prog/cmd_stm32prog.c
> +++ b/arch/arm/mach-stm32mp/cmd_stm32prog/cmd_stm32prog.c
> @@ -77,10 +77,12 @@ static int do_stm32prog(struct cmd_tbl *cmdtp, int flag, int argc,
>  		if (header.type == HEADER_STM32IMAGE) {
>  			size = header.image_length + BL_HEADER_SIZE;
>  
> +#if defined(CONFIG_LEGACY_IMAGE_FORMAT)
>  			/* uImage detected in STM32IMAGE, execute the script */
>  			if (IMAGE_FORMAT_LEGACY ==
>  			    genimg_get_format((void *)(addr + BL_HEADER_SIZE)))
>  				return image_source_script(addr + BL_HEADER_SIZE, "script@1");
> +#endif
>  		}
>  	}
>  
> 
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>

Thanks
Patrice
Patrice CHOTARD June 18, 2021, 7:57 a.m. UTC | #2
On 5/28/21 2:53 PM, Patrice CHOTARD wrote:
> Hi Patrick
> 
> On 5/18/21 3:12 PM, Patrick Delaunay wrote:
>> When CONFIG_FIT_SIGNATURE is activated, CONFIG_LEGACY_IMAGE_FORMAT
>> is deactivated and the define IMAGE_FORMAT_LEGACY don't exist with
>> include/image.h:
>>   #if defined(CONFIG_LEGACY_IMAGE_FORMAT)
>>   #define IMAGE_FORMAT_LEGACY	0x01	/* legacy image_header based format */
>>   #endif
>>
>> This patch adds the needed check on compilation flag
>> CONFIG_LEGACY_IMAGE_FORMAT to avoid the compilation error
>> for command stm32prog:
>>
>> cmd_stm32prog.c:81:8: error: ‘IMAGE_FORMAT_LEGACY’ undeclared
>> (first use in this function); did you mean ‘IMAGE_FORMAT_FIT’?
>>    81 |    if (IMAGE_FORMAT_LEGACY ==
>>       |        ^~~~~~~~~~~~~~~~~~~
>>       |        IMAGE_FORMAT_FIT
>>
>> Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
>> ---
>>
>>  arch/arm/mach-stm32mp/cmd_stm32prog/cmd_stm32prog.c | 2 ++
>>  1 file changed, 2 insertions(+)
>>
>> diff --git a/arch/arm/mach-stm32mp/cmd_stm32prog/cmd_stm32prog.c b/arch/arm/mach-stm32mp/cmd_stm32prog/cmd_stm32prog.c
>> index e584bb52bd..f3790f900f 100644
>> --- a/arch/arm/mach-stm32mp/cmd_stm32prog/cmd_stm32prog.c
>> +++ b/arch/arm/mach-stm32mp/cmd_stm32prog/cmd_stm32prog.c
>> @@ -77,10 +77,12 @@ static int do_stm32prog(struct cmd_tbl *cmdtp, int flag, int argc,
>>  		if (header.type == HEADER_STM32IMAGE) {
>>  			size = header.image_length + BL_HEADER_SIZE;
>>  
>> +#if defined(CONFIG_LEGACY_IMAGE_FORMAT)
>>  			/* uImage detected in STM32IMAGE, execute the script */
>>  			if (IMAGE_FORMAT_LEGACY ==
>>  			    genimg_get_format((void *)(addr + BL_HEADER_SIZE)))
>>  				return image_source_script(addr + BL_HEADER_SIZE, "script@1");
>> +#endif
>>  		}
>>  	}
>>  
>>
> Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>
> 
> Thanks
> Patrice
> _______________________________________________
> Uboot-stm32 mailing list
> Uboot-stm32@st-md-mailman.stormreply.com
> https://st-md-mailman.stormreply.com/mailman/listinfo/uboot-stm32
> 
Applied on u-boot-stm32/next

Thanks
diff mbox series

Patch

diff --git a/arch/arm/mach-stm32mp/cmd_stm32prog/cmd_stm32prog.c b/arch/arm/mach-stm32mp/cmd_stm32prog/cmd_stm32prog.c
index e584bb52bd..f3790f900f 100644
--- a/arch/arm/mach-stm32mp/cmd_stm32prog/cmd_stm32prog.c
+++ b/arch/arm/mach-stm32mp/cmd_stm32prog/cmd_stm32prog.c
@@ -77,10 +77,12 @@  static int do_stm32prog(struct cmd_tbl *cmdtp, int flag, int argc,
 		if (header.type == HEADER_STM32IMAGE) {
 			size = header.image_length + BL_HEADER_SIZE;
 
+#if defined(CONFIG_LEGACY_IMAGE_FORMAT)
 			/* uImage detected in STM32IMAGE, execute the script */
 			if (IMAGE_FORMAT_LEGACY ==
 			    genimg_get_format((void *)(addr + BL_HEADER_SIZE)))
 				return image_source_script(addr + BL_HEADER_SIZE, "script@1");
+#endif
 		}
 	}