Commit 87ebee39e9d02dba6d36d03d512e7d6e8a5a9abb
Committed by
Tom Rini
1 parent
1fe7d93891
Exists in
master
and in
53 other branches
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: Simon Glass <sjg@chromium.org>
Showing 3 changed files with 42 additions and 5 deletions Side-by-side Diff
README
... | ... | @@ -2997,6 +2997,12 @@ |
2997 | 2997 | use an arch-specific makefile fragment instead, for |
2998 | 2998 | example if more than one image needs to be produced. |
2999 | 2999 | |
3000 | + CONFIG_FIT_SPL_PRINT | |
3001 | + Printing information about a FIT image adds quite a bit of | |
3002 | + code to SPL. So this is normally disabled in SPL. Use this | |
3003 | + option to re-enable it. This will affect the output of the | |
3004 | + bootm command when booting a FIT image. | |
3005 | + | |
3000 | 3006 | Modem Support: |
3001 | 3007 | -------------- |
3002 | 3008 |
common/image-fit.c
... | ... | @@ -124,6 +124,7 @@ |
124 | 124 | fdt_strerror(err)); |
125 | 125 | } |
126 | 126 | |
127 | +#if !defined(CONFIG_SPL_BUILD) || defined(CONFIG_FIT_SPL_PRINT) | |
127 | 128 | /** |
128 | 129 | * fit_print_contents - prints out the contents of the FIT format image |
129 | 130 | * @fit: pointer to the FIT format image header |
... | ... | @@ -402,6 +403,7 @@ |
402 | 403 | } |
403 | 404 | } |
404 | 405 | } |
406 | +#endif | |
405 | 407 | |
406 | 408 | /** |
407 | 409 | * fit_get_desc - get node description property |
408 | 410 | |
409 | 411 | |
... | ... | @@ -852,16 +854,16 @@ |
852 | 854 | int calculate_hash(const void *data, int data_len, const char *algo, |
853 | 855 | uint8_t *value, int *value_len) |
854 | 856 | { |
855 | - if (strcmp(algo, "crc32") == 0) { | |
857 | + if (IMAGE_ENABLE_CRC32 && strcmp(algo, "crc32") == 0) { | |
856 | 858 | *((uint32_t *)value) = crc32_wd(0, data, data_len, |
857 | 859 | CHUNKSZ_CRC32); |
858 | 860 | *((uint32_t *)value) = cpu_to_uimage(*((uint32_t *)value)); |
859 | 861 | *value_len = 4; |
860 | - } else if (strcmp(algo, "sha1") == 0) { | |
862 | + } else if (IMAGE_ENABLE_SHA1 && strcmp(algo, "sha1") == 0) { | |
861 | 863 | sha1_csum_wd((unsigned char *)data, data_len, |
862 | 864 | (unsigned char *)value, CHUNKSZ_SHA1); |
863 | 865 | *value_len = 20; |
864 | - } else if (strcmp(algo, "md5") == 0) { | |
866 | + } else if (IMAGE_ENABLE_MD5 && strcmp(algo, "md5") == 0) { | |
865 | 867 | md5_wd((unsigned char *)data, data_len, value, CHUNKSZ_MD5); |
866 | 868 | *value_len = 16; |
867 | 869 | } else { |
include/image.h
... | ... | @@ -61,8 +61,37 @@ |
61 | 61 | #if defined(CONFIG_FIT) |
62 | 62 | #include <libfdt.h> |
63 | 63 | #include <fdt_support.h> |
64 | -#define CONFIG_MD5 /* FIT images need MD5 support */ | |
65 | -#define CONFIG_SHA1 /* and SHA1 */ | |
64 | +# ifdef CONFIG_SPL_BUILD | |
65 | +# ifdef CONFIG_SPL_CRC32_SUPPORT | |
66 | +# define IMAGE_ENABLE_CRC32 1 | |
67 | +# endif | |
68 | +# ifdef CONFIG_SPL_MD5_SUPPORT | |
69 | +# define IMAGE_ENABLE_MD5 1 | |
70 | +# endif | |
71 | +# ifdef CONFIG_SPL_SHA1_SUPPORT | |
72 | +# define IMAGE_ENABLE_SHA1 1 | |
73 | +# endif | |
74 | +# else | |
75 | +# define CONFIG_CRC32 /* FIT images need CRC32 support */ | |
76 | +# define CONFIG_MD5 /* and MD5 */ | |
77 | +# define CONFIG_SHA1 /* and SHA1 */ | |
78 | +# define IMAGE_ENABLE_CRC32 1 | |
79 | +# define IMAGE_ENABLE_MD5 1 | |
80 | +# define IMAGE_ENABLE_SHA1 1 | |
81 | +# endif | |
82 | + | |
83 | +#ifndef IMAGE_ENABLE_CRC32 | |
84 | +#define IMAGE_ENABLE_CRC32 0 | |
85 | +#endif | |
86 | + | |
87 | +#ifndef IMAGE_ENABLE_MD5 | |
88 | +#define IMAGE_ENABLE_MD5 0 | |
89 | +#endif | |
90 | + | |
91 | +#ifndef IMAGE_ENABLE_SHA1 | |
92 | +#define IMAGE_ENABLE_SHA1 0 | |
93 | +#endif | |
94 | + | |
66 | 95 | #endif |
67 | 96 | |
68 | 97 | /* |