[PATCH v2 41/50] image: Drop unnecessary #ifdefs from image.h

Alex G. mr.nuke.me at gmail.com
Fri May 14 23:45:15 CEST 2021



On 5/6/21 9:24 AM, Simon Glass wrote:
> This file has a lot of conditional code and much of it is unnecessary.
> Clean this up to reduce the number of build combinations.
> 
> Signed-off-by: Simon Glass <sjg at chromium.org>
> ---

[snip]

> @@ -523,12 +520,9 @@ enum fit_load_op {
>   int boot_get_setup(bootm_headers_t *images, uint8_t arch, ulong *setup_start,
>   		   ulong *setup_len);
>   
> -#ifndef USE_HOSTCC
>   /* Image format types, returned by _get_format() routine */
>   #define IMAGE_FORMAT_INVALID	0x00
> -#if defined(CONFIG_LEGACY_IMAGE_FORMAT)
>   #define IMAGE_FORMAT_LEGACY	0x01	/* legacy image_header based format */
> -#endif
>   #define IMAGE_FORMAT_FIT	0x02	/* new, libfdt based format */
>   #define IMAGE_FORMAT_ANDROID	0x03	/* Android boot image */

I've hit build errors in stm32 before because IMAGE_FORMAT_LEGACY wasn't 
defined. I'm with you on this one.

[snip]

>   /**
>    * board_fit_config_name_match() - Check for a matching board name
> diff --git a/include/u-boot/hash-checksum.h b/include/u-boot/hash-checksum.h
> index 54e6a73744e..7f16b37a9ab 100644
> --- a/include/u-boot/hash-checksum.h
> +++ b/include/u-boot/hash-checksum.h
> @@ -7,11 +7,12 @@
>   #define _RSA_CHECKSUM_H
>   
>   #include <errno.h>
> -#include <image.h>
>   #include <u-boot/sha1.h>
>   #include <u-boot/sha256.h>
>   #include <u-boot/sha512.h>
>   
> +struct image_region;
> +
>   /**
>    * hash_calculate() - Calculate hash over the data
>    *
> @@ -23,7 +24,7 @@
>    * @return 0 if OK, < 0 if error
>    */
>   int hash_calculate(const char *name,
> -		   const struct image_region region[], int region_count,
> +		   const struct image_region *region, int region_count,
>   		   uint8_t *checksum);

This doesn't have to do anything with ifdefs. Should id be a separate 
change?

>   
>   #endif
> diff --git a/lib/hash-checksum.c b/lib/hash-checksum.c
> index d732ecc38fd..8f2a42f9a08 100644
> --- a/lib/hash-checksum.c
> +++ b/lib/hash-checksum.c
> @@ -17,7 +17,7 @@
>   #include <image.h>
>   
>   int hash_calculate(const char *name,
> -		    const struct image_region region[],
> +		    const struct image_region *region,
>   		    int region_count, uint8_t *checksum)
>   {
>   	struct hash_algo *algo;

Ditto


More information about the U-Boot mailing list