Skip to content
Snippets Groups Projects
Commit 87ebee39 authored by Simon Glass's avatar Simon Glass Committed by Tom Rini
Browse files

image: Add CONFIG_FIT_SPL_PRINT to control FIT image printing in SPL


This code is very large, and in SPL it isn't always useful to print
out image information (in fact there might not even be a console
active). So disable this feature unless this option is set.

Signed-off-by: default avatarSimon Glass <sjg@chromium.org>
parent 1fe7d938
No related branches found
No related tags found
No related merge requests found
...@@ -2997,6 +2997,12 @@ FIT uImage format: ...@@ -2997,6 +2997,12 @@ FIT uImage format:
use an arch-specific makefile fragment instead, for use an arch-specific makefile fragment instead, for
example if more than one image needs to be produced. example if more than one image needs to be produced.
CONFIG_FIT_SPL_PRINT
Printing information about a FIT image adds quite a bit of
code to SPL. So this is normally disabled in SPL. Use this
option to re-enable it. This will affect the output of the
bootm command when booting a FIT image.
Modem Support: Modem Support:
-------------- --------------
......
...@@ -124,6 +124,7 @@ static void fit_get_debug(const void *fit, int noffset, ...@@ -124,6 +124,7 @@ static void fit_get_debug(const void *fit, int noffset,
fdt_strerror(err)); fdt_strerror(err));
} }
#if !defined(CONFIG_SPL_BUILD) || defined(CONFIG_FIT_SPL_PRINT)
/** /**
* fit_print_contents - prints out the contents of the FIT format image * fit_print_contents - prints out the contents of the FIT format image
* @fit: pointer to the FIT format image header * @fit: pointer to the FIT format image header
...@@ -402,6 +403,7 @@ void fit_image_print(const void *fit, int image_noffset, const char *p) ...@@ -402,6 +403,7 @@ void fit_image_print(const void *fit, int image_noffset, const char *p)
} }
} }
} }
#endif
/** /**
* fit_get_desc - get node description property * fit_get_desc - get node description property
...@@ -852,16 +854,16 @@ int fit_set_timestamp(void *fit, int noffset, time_t timestamp) ...@@ -852,16 +854,16 @@ int fit_set_timestamp(void *fit, int noffset, time_t timestamp)
int calculate_hash(const void *data, int data_len, const char *algo, int calculate_hash(const void *data, int data_len, const char *algo,
uint8_t *value, int *value_len) uint8_t *value, int *value_len)
{ {
if (strcmp(algo, "crc32") == 0) { if (IMAGE_ENABLE_CRC32 && strcmp(algo, "crc32") == 0) {
*((uint32_t *)value) = crc32_wd(0, data, data_len, *((uint32_t *)value) = crc32_wd(0, data, data_len,
CHUNKSZ_CRC32); CHUNKSZ_CRC32);
*((uint32_t *)value) = cpu_to_uimage(*((uint32_t *)value)); *((uint32_t *)value) = cpu_to_uimage(*((uint32_t *)value));
*value_len = 4; *value_len = 4;
} else if (strcmp(algo, "sha1") == 0) { } else if (IMAGE_ENABLE_SHA1 && strcmp(algo, "sha1") == 0) {
sha1_csum_wd((unsigned char *)data, data_len, sha1_csum_wd((unsigned char *)data, data_len,
(unsigned char *)value, CHUNKSZ_SHA1); (unsigned char *)value, CHUNKSZ_SHA1);
*value_len = 20; *value_len = 20;
} else if (strcmp(algo, "md5") == 0) { } else if (IMAGE_ENABLE_MD5 && strcmp(algo, "md5") == 0) {
md5_wd((unsigned char *)data, data_len, value, CHUNKSZ_MD5); md5_wd((unsigned char *)data, data_len, value, CHUNKSZ_MD5);
*value_len = 16; *value_len = 16;
} else { } else {
......
...@@ -61,8 +61,37 @@ ...@@ -61,8 +61,37 @@
#if defined(CONFIG_FIT) #if defined(CONFIG_FIT)
#include <libfdt.h> #include <libfdt.h>
#include <fdt_support.h> #include <fdt_support.h>
#define CONFIG_MD5 /* FIT images need MD5 support */ # ifdef CONFIG_SPL_BUILD
#define CONFIG_SHA1 /* and SHA1 */ # ifdef CONFIG_SPL_CRC32_SUPPORT
# define IMAGE_ENABLE_CRC32 1
# endif
# ifdef CONFIG_SPL_MD5_SUPPORT
# define IMAGE_ENABLE_MD5 1
# endif
# ifdef CONFIG_SPL_SHA1_SUPPORT
# define IMAGE_ENABLE_SHA1 1
# endif
# else
# define CONFIG_CRC32 /* FIT images need CRC32 support */
# define CONFIG_MD5 /* and MD5 */
# define CONFIG_SHA1 /* and SHA1 */
# define IMAGE_ENABLE_CRC32 1
# define IMAGE_ENABLE_MD5 1
# define IMAGE_ENABLE_SHA1 1
# endif
#ifndef IMAGE_ENABLE_CRC32
#define IMAGE_ENABLE_CRC32 0
#endif
#ifndef IMAGE_ENABLE_MD5
#define IMAGE_ENABLE_MD5 0
#endif
#ifndef IMAGE_ENABLE_SHA1
#define IMAGE_ENABLE_SHA1 0
#endif
#endif #endif
/* /*
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment