From 51d8367d8a8d6edb0c5af9828c20bb7aba5670da Mon Sep 17 00:00:00 2001 From: Andre Przywara Date: Fri, 21 Jan 2022 16:36:04 +0000 Subject: [PATCH 01/10] vexpress64: semi_defconfig: disable CRC32 support Commit 270f8710f92f ("crc32: Add crc32 implementation using __builtin_aarch64_crc32b") enabled the usage of ARMv8 CRC instructions by default, for all arm64 builds. And indeed all Arm Ltd. v8 Cortex-A cores support the instructions, and they are mandatory starting with architecture revision v8.1, so realistically every known hardware implementation should support them. The Arm Fastmodel however defaults to the bare minimum ARMv8 feature set by default, which means v8.0 without the CRC instructions, so U-Boot hangs very early at the moment, without any output (the boot-wrapper or TF-A printing the last visible lines). Support for those instructions can be enabled on the model command line by either: -C cluster0.cpu0.enable_crc32=1 (for each core) or by using a higher architecture revision by default: -C cluster0.has_arm_v8-1=1 (for each cluster) Of course any arch revision higher than v8.1 would work as well. But for the sake of a smooth out-of-the-box experience, let's just disable the usage of those instructions in the defconfig, to avoid random hangs without any clues. Reported-by: Ross Burton Signed-off-by: Andre Przywara Acked-by: Marek Vasut --- configs/vexpress_aemv8a_semi_defconfig | 1 + 1 file changed, 1 insertion(+) diff --git a/configs/vexpress_aemv8a_semi_defconfig b/configs/vexpress_aemv8a_semi_defconfig index f9abf29b26..8e6a87c99f 100644 --- a/configs/vexpress_aemv8a_semi_defconfig +++ b/configs/vexpress_aemv8a_semi_defconfig @@ -11,6 +11,7 @@ CONFIG_ENV_SECT_SIZE=0x40000 CONFIG_IDENT_STRING=" vexpress_aemv8a" CONFIG_DISTRO_DEFAULTS=y CONFIG_SYS_LOAD_ADDR=0x90000000 +# CONFIG_ARM64_CRC32 is not set CONFIG_ANDROID_BOOT_IMAGE=y CONFIG_BOOTDELAY=1 CONFIG_USE_BOOTARGS=y From 5390cafed8858c8f9096131f2c2ddb2698931d2d Mon Sep 17 00:00:00 2001 From: Stefan Eichenberger Date: Mon, 10 Jan 2022 18:48:31 +0100 Subject: [PATCH 02/10] tools/fitimage: remove redundant format check fit_extract_contents does a fit_check_format even thought it was already checked during imagetool_verify_print_header. Therefore, this check is not necessary. This commit removes the redundancy. Signed-off-by: Stefan Eichenberger Reviewed-by: Simon Glass --- tools/fit_image.c | 5 ----- 1 file changed, 5 deletions(-) diff --git a/tools/fit_image.c b/tools/fit_image.c index f4f372ba62..62e1796ce5 100644 --- a/tools/fit_image.c +++ b/tools/fit_image.c @@ -884,11 +884,6 @@ static int fit_extract_contents(void *ptr, struct image_tool_params *params) /* Indent string is defined in header image.h */ p = IMAGE_INDENT_STRING; - if (fit_check_format(fit, IMAGE_SIZE_INVAL)) { - printf("Bad FIT image format\n"); - return -1; - } - /* Find images parent node offset */ images_noffset = fdt_path_offset(fit, FIT_IMAGES_PATH); if (images_noffset < 0) { From 6f08eee67fe93068ab501cc5f3094e480e76f4a9 Mon Sep 17 00:00:00 2001 From: Stefan Eichenberger Date: Mon, 10 Jan 2022 18:48:32 +0100 Subject: [PATCH 03/10] tools/fitimage: make sure dumpimage still works when "@" are detected fit_verify_header fails if it detects unit addresses "@". However, this will break tools like dumpimage on fit images which worked with previous versions of the tool (e.g. 2020.04 vs 2021.07). As an example the output of: dumpimage -l is: FIT description: U-Boot fitImage for Linux Distribution Created: Thu Jan 1 01:00:00 1970 Image 0 (kernel@1) Description: Linux kernel Created: Thu Jan 1 01:00:00 1970 Type: Kernel Image Compression: gzip compressed Data Size: 6442456 Bytes = 6291.46 KiB = 6.14 MiB Architecture: AArch64 OS: Linux Load Address: 0x80080000 Entry Point: 0x80080000 Hash algo: sha256 Hash value: ... Image 1 (fdt@freescale_fsl-s32g274a-evb.dtb) Description: Flattened Device Tree blob Created: Thu Jan 1 01:00:00 1970 Type: Flat Device Tree Compression: uncompressed Data Size: 39661 Bytes = 38.73 KiB = 0.04 MiB Architecture: AArch64 Hash algo: sha256 Hash value: ... Default Configuration: 'conf@freescale_fsl-s32g274a-evb.dtb' Configuration 0 (conf@freescale_fsl-s32g274a-evb.dtb) Description: 1 Linux kernel, FDT blob Kernel: kernel@1 FDT: fdt@freescale_fsl-s32g274a-evb.dtb Hash algo: sha256 Hash value: unavailable But with newer version it shows: dumpimage -l GP Header: Size d00dfeed LoadAddr 62f0a4 This commit will output a warning that unit addresses were detected but will not fail: dumpimage -l Image contains unit addresses @, this will break signing ... Signed-off-by: Stefan Eichenberger Reviewed-by: Simon Glass --- tools/fit_common.c | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/tools/fit_common.c b/tools/fit_common.c index 52b63296f8..5c8920de54 100644 --- a/tools/fit_common.c +++ b/tools/fit_common.c @@ -26,10 +26,18 @@ int fit_verify_header(unsigned char *ptr, int image_size, struct image_tool_params *params) { - if (fdt_check_header(ptr) != EXIT_SUCCESS || - fit_check_format(ptr, IMAGE_SIZE_INVAL)) + int ret; + + if (fdt_check_header(ptr) != EXIT_SUCCESS) return EXIT_FAILURE; + ret = fit_check_format(ptr, IMAGE_SIZE_INVAL); + if (ret) { + if (ret != -EADDRNOTAVAIL) + return EXIT_FAILURE; + fprintf(stderr, "Image contains unit addresses @, this will break signing\n"); + } + return EXIT_SUCCESS; } From e44d2f5df9baa9b604df4eaa4d42f89657170598 Mon Sep 17 00:00:00 2001 From: John Keeping Date: Tue, 11 Jan 2022 17:04:49 +0000 Subject: [PATCH 04/10] misc: mark write buffer const The write operation in misc_ops already takes a "const void *" buffer, but misc_write() takes a mutable "void *". There's no reason for this, so make misc_write() consistent with the standard write() prototype. Signed-off-by: John Keeping Reviewed-by: Simon Glass --- drivers/misc/misc-uclass.c | 2 +- include/misc.h | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/misc/misc-uclass.c b/drivers/misc/misc-uclass.c index cbfacc3801..cfe9d562fa 100644 --- a/drivers/misc/misc-uclass.c +++ b/drivers/misc/misc-uclass.c @@ -26,7 +26,7 @@ int misc_read(struct udevice *dev, int offset, void *buf, int size) return ops->read(dev, offset, buf, size); } -int misc_write(struct udevice *dev, int offset, void *buf, int size) +int misc_write(struct udevice *dev, int offset, const void *buf, int size) { const struct misc_ops *ops = device_get_ops(dev); diff --git a/include/misc.h b/include/misc.h index 82ec2ce793..6f042625c9 100644 --- a/include/misc.h +++ b/include/misc.h @@ -28,7 +28,7 @@ int misc_read(struct udevice *dev, int offset, void *buf, int size); * * Return: number of bytes written if OK (may be < @size), -ve on error */ -int misc_write(struct udevice *dev, int offset, void *buf, int size); +int misc_write(struct udevice *dev, int offset, const void *buf, int size); /** * misc_ioctl() - Assert command to the device, optional. From 4550ce9be01dcdf451d74b0f6263d0c43e1377f1 Mon Sep 17 00:00:00 2001 From: Jan Kiszka Date: Fri, 14 Jan 2022 10:21:17 +0100 Subject: [PATCH 05/10] image-fit: Make string of algo parameter constant Modifications would be invalid. Signed-off-by: Jan Kiszka Reviewed-by: Simon Glass --- boot/image-fit-sig.c | 2 +- boot/image-fit.c | 8 ++++---- include/image.h | 2 +- tools/image-host.c | 4 ++-- 4 files changed, 8 insertions(+), 8 deletions(-) diff --git a/boot/image-fit-sig.c b/boot/image-fit-sig.c index 9b1d38b20a..495d7768f6 100644 --- a/boot/image-fit-sig.c +++ b/boot/image-fit-sig.c @@ -67,7 +67,7 @@ static int fit_image_setup_verify(struct image_sign_info *info, const void *fit, int noffset, int required_keynode, char **err_msgp) { - char *algo_name; + const char *algo_name; const char *padding_name; if (fdt_totalsize(fit) > CONFIG_VAL(FIT_SIGNATURE_MAX_SIZE)) { diff --git a/boot/image-fit.c b/boot/image-fit.c index f6594e065c..85a6f223c8 100644 --- a/boot/image-fit.c +++ b/boot/image-fit.c @@ -191,7 +191,7 @@ static void fit_image_print_data(const void *fit, int noffset, const char *p, const char *keyname; uint8_t *value; int value_len; - char *algo; + const char *algo; const char *padding; bool required; int ret, i; @@ -1063,11 +1063,11 @@ int fit_image_get_data_and_size(const void *fit, int noffset, * 0, on success * -1, on failure */ -int fit_image_hash_get_algo(const void *fit, int noffset, char **algo) +int fit_image_hash_get_algo(const void *fit, int noffset, const char **algo) { int len; - *algo = (char *)fdt_getprop(fit, noffset, FIT_ALGO_PROP, &len); + *algo = (const char *)fdt_getprop(fit, noffset, FIT_ALGO_PROP, &len); if (*algo == NULL) { fit_get_debug(fit, noffset, FIT_ALGO_PROP, len); return -1; @@ -1265,7 +1265,7 @@ static int fit_image_check_hash(const void *fit, int noffset, const void *data, { uint8_t value[FIT_MAX_HASH_LEN]; int value_len; - char *algo; + const char *algo; uint8_t *fit_value; int fit_value_len; int ignore; diff --git a/include/image.h b/include/image.h index 1cdc70faee..7be6f11f61 100644 --- a/include/image.h +++ b/include/image.h @@ -1011,7 +1011,7 @@ int fit_image_get_data_size_unciphered(const void *fit, int noffset, int fit_image_get_data_and_size(const void *fit, int noffset, const void **data, size_t *size); -int fit_image_hash_get_algo(const void *fit, int noffset, char **algo); +int fit_image_hash_get_algo(const void *fit, int noffset, const char **algo); int fit_image_hash_get_value(const void *fit, int noffset, uint8_t **value, int *value_len); diff --git a/tools/image-host.c b/tools/image-host.c index 945571f584..5b814ce715 100644 --- a/tools/image-host.c +++ b/tools/image-host.c @@ -63,7 +63,7 @@ static int fit_image_process_hash(void *fit, const char *image_name, uint8_t value[FIT_MAX_HASH_LEN]; const char *node_name; int value_len; - char *algo; + const char *algo; int ret; node_name = fit_get_name(fit, noffset, NULL); @@ -160,7 +160,7 @@ static int fit_image_setup_sig(struct image_sign_info *info, const char *engine_id) { const char *node_name; - char *algo_name; + const char *algo_name; const char *padding_name; node_name = fit_get_name(fit, noffset, NULL); From 6ae24346891d7e9d22707949c61f09346b28d761 Mon Sep 17 00:00:00 2001 From: Jan Kiszka Date: Fri, 14 Jan 2022 10:21:18 +0100 Subject: [PATCH 06/10] mkimage: Drop unused OPT_STRING constant The actual opt string is inlined - and different. Seems this was a left-over from older versions of 603e26f76346. Signed-off-by: Jan Kiszka Reviewed-by: Simon Glass --- tools/mkimage.c | 1 - 1 file changed, 1 deletion(-) diff --git a/tools/mkimage.c b/tools/mkimage.c index fbe883ce36..a4844d0f18 100644 --- a/tools/mkimage.c +++ b/tools/mkimage.c @@ -146,7 +146,6 @@ static int add_content(int type, const char *fname) return 0; } -#define OPT_STRING "a:A:b:B:c:C:d:D:e:Ef:Fk:i:K:ln:N:p:O:rR:qstT:vVx" static void process_args(int argc, char **argv) { char *ptr; From 5902a397d029008a98e8e83b7627635ed3a2cd06 Mon Sep 17 00:00:00 2001 From: Jan Kiszka Date: Fri, 14 Jan 2022 10:21:19 +0100 Subject: [PATCH 07/10] mkimage: Allow to specify the signature algorithm on the command line This permits to prepare FIT image description that do not hard-code the final choice of the signature algorithm, possibly requiring the user to patch the sources. When -o is specified, this information is used in favor of the 'algo' property in the signature node. Furthermore, that property is set accordingly when writing the image. Signed-off-by: Jan Kiszka --- doc/mkimage.1 | 5 +++++ include/image.h | 3 ++- tools/fit_image.c | 3 ++- tools/image-host.c | 48 +++++++++++++++++++++++++++------------------- tools/imagetool.h | 1 + tools/mkimage.c | 5 ++++- 6 files changed, 42 insertions(+), 23 deletions(-) diff --git a/doc/mkimage.1 b/doc/mkimage.1 index fea5288784..0734bd36a1 100644 --- a/doc/mkimage.1 +++ b/doc/mkimage.1 @@ -155,6 +155,11 @@ the corresponding public key is written into this file for for run-time verification. Typically the file here is the device tree binary used by CONFIG_OF_CONTROL in U-Boot. +.TP +.BI "\-o [" "signing algorithm" "]" +Specifies the algorithm to be used for signing a FIT image. The default is +taken from the target signature nodes 'algo' properties. + .TP .BI "\-p [" "external position" "]" Place external data at a static external position. See \-E. Instead of writing diff --git a/include/image.h b/include/image.h index 7be6f11f61..fe1356265c 100644 --- a/include/image.h +++ b/include/image.h @@ -1031,6 +1031,7 @@ int fit_cipher_data(const char *keydir, void *keydest, void *fit, * @require_keys: Mark all keys as 'required' * @engine_id: Engine to use for signing * @cmdname: Command name used when reporting errors + * @algo_name: Algorithm name, or NULL if to be read from FIT * * Adds hash values for all component images in the FIT blob. * Hashes are calculated for all component images which have hash subnodes @@ -1045,7 +1046,7 @@ int fit_cipher_data(const char *keydir, void *keydest, void *fit, int fit_add_verification_data(const char *keydir, const char *keyfile, void *keydest, void *fit, const char *comment, int require_keys, const char *engine_id, - const char *cmdname); + const char *cmdname, const char *algo_name); int fit_image_verify_with_data(const void *fit, int image_noffset, const void *data, size_t size); diff --git a/tools/fit_image.c b/tools/fit_image.c index 62e1796ce5..8df95c40d2 100644 --- a/tools/fit_image.c +++ b/tools/fit_image.c @@ -73,7 +73,8 @@ static int fit_add_file_data(struct image_tool_params *params, size_t size_inc, params->comment, params->require_keys, params->engine_id, - params->cmdname); + params->cmdname, + params->algo_name); } if (dest_blob) { diff --git a/tools/image-host.c b/tools/image-host.c index 5b814ce715..f86e1fbb1b 100644 --- a/tools/image-host.c +++ b/tools/image-host.c @@ -107,7 +107,7 @@ static int fit_image_process_hash(void *fit, const char *image_name, */ static int fit_image_write_sig(void *fit, int noffset, uint8_t *value, int value_len, const char *comment, const char *region_prop, - int region_proplen, const char *cmdname) + int region_proplen, const char *cmdname, const char *algo_name) { int string_size; int ret; @@ -150,6 +150,8 @@ static int fit_image_write_sig(void *fit, int noffset, uint8_t *value, strdata, sizeof(strdata)); } } + if (algo_name && !ret) + ret = fdt_setprop_string(fit, noffset, "algo", algo_name); return ret; } @@ -157,17 +159,18 @@ static int fit_image_write_sig(void *fit, int noffset, uint8_t *value, static int fit_image_setup_sig(struct image_sign_info *info, const char *keydir, const char *keyfile, void *fit, const char *image_name, int noffset, const char *require_keys, - const char *engine_id) + const char *engine_id, const char *algo_name) { const char *node_name; - const char *algo_name; const char *padding_name; node_name = fit_get_name(fit, noffset, NULL); - if (fit_image_hash_get_algo(fit, noffset, &algo_name)) { - printf("Can't get algo property for '%s' signature node in '%s' image node\n", - node_name, image_name); - return -1; + if (!algo_name) { + if (fit_image_hash_get_algo(fit, noffset, &algo_name)) { + printf("Can't get algo property for '%s' signature node in '%s' image node\n", + node_name, image_name); + return -1; + } } padding_name = fdt_getprop(fit, noffset, "padding", NULL); @@ -215,7 +218,7 @@ static int fit_image_process_sig(const char *keydir, const char *keyfile, void *keydest, void *fit, const char *image_name, int noffset, const void *data, size_t size, const char *comment, int require_keys, const char *engine_id, - const char *cmdname) + const char *cmdname, const char *algo_name) { struct image_sign_info info; struct image_region region; @@ -226,7 +229,7 @@ static int fit_image_process_sig(const char *keydir, const char *keyfile, if (fit_image_setup_sig(&info, keydir, keyfile, fit, image_name, noffset, require_keys ? "image" : NULL, - engine_id)) + engine_id, algo_name)) return -1; node_name = fit_get_name(fit, noffset, NULL); @@ -244,7 +247,7 @@ static int fit_image_process_sig(const char *keydir, const char *keyfile, } ret = fit_image_write_sig(fit, noffset, value, value_len, comment, - NULL, 0, cmdname); + NULL, 0, cmdname, algo_name); if (ret) { if (ret == -FDT_ERR_NOSPACE) return -ENOSPC; @@ -606,7 +609,7 @@ int fit_image_cipher_data(const char *keydir, void *keydest, int fit_image_add_verification_data(const char *keydir, const char *keyfile, void *keydest, void *fit, int image_noffset, const char *comment, int require_keys, const char *engine_id, - const char *cmdname) + const char *cmdname, const char* algo_name) { const char *image_name; const void *data; @@ -643,7 +646,8 @@ int fit_image_add_verification_data(const char *keydir, const char *keyfile, strlen(FIT_SIG_NODENAME))) { ret = fit_image_process_sig(keydir, keyfile, keydest, fit, image_name, noffset, data, size, - comment, require_keys, engine_id, cmdname); + comment, require_keys, engine_id, cmdname, + algo_name); } if (ret) return ret; @@ -927,7 +931,8 @@ static int fit_config_get_data(void *fit, int conf_noffset, int noffset, static int fit_config_process_sig(const char *keydir, const char *keyfile, void *keydest, void *fit, const char *conf_name, int conf_noffset, int noffset, const char *comment, - int require_keys, const char *engine_id, const char *cmdname) + int require_keys, const char *engine_id, const char *cmdname, + const char *algo_name) { struct image_sign_info info; const char *node_name; @@ -945,7 +950,8 @@ static int fit_config_process_sig(const char *keydir, const char *keyfile, return -1; if (fit_image_setup_sig(&info, keydir, keyfile, fit, conf_name, noffset, - require_keys ? "conf" : NULL, engine_id)) + require_keys ? "conf" : NULL, engine_id, + algo_name)) return -1; ret = info.crypto->sign(&info, region, region_count, &value, @@ -962,7 +968,8 @@ static int fit_config_process_sig(const char *keydir, const char *keyfile, } ret = fit_image_write_sig(fit, noffset, value, value_len, comment, - region_prop, region_proplen, cmdname); + region_prop, region_proplen, cmdname, + algo_name); if (ret) { if (ret == -FDT_ERR_NOSPACE) return -ENOSPC; @@ -992,7 +999,7 @@ static int fit_config_process_sig(const char *keydir, const char *keyfile, static int fit_config_add_verification_data(const char *keydir, const char *keyfile, void *keydest, void *fit, int conf_noffset, const char *comment, int require_keys, const char *engine_id, - const char *cmdname) + const char *cmdname, const char *algo_name) { const char *conf_name; int noffset; @@ -1011,7 +1018,7 @@ static int fit_config_add_verification_data(const char *keydir, strlen(FIT_SIG_NODENAME))) { ret = fit_config_process_sig(keydir, keyfile, keydest, fit, conf_name, conf_noffset, noffset, comment, - require_keys, engine_id, cmdname); + require_keys, engine_id, cmdname, algo_name); } if (ret) return ret; @@ -1058,7 +1065,7 @@ int fit_cipher_data(const char *keydir, void *keydest, void *fit, int fit_add_verification_data(const char *keydir, const char *keyfile, void *keydest, void *fit, const char *comment, int require_keys, const char *engine_id, - const char *cmdname) + const char *cmdname, const char *algo_name) { int images_noffset, confs_noffset; int noffset; @@ -1082,7 +1089,7 @@ int fit_add_verification_data(const char *keydir, const char *keyfile, */ ret = fit_image_add_verification_data(keydir, keyfile, keydest, fit, noffset, comment, require_keys, engine_id, - cmdname); + cmdname, algo_name); if (ret) return ret; } @@ -1106,7 +1113,8 @@ int fit_add_verification_data(const char *keydir, const char *keyfile, ret = fit_config_add_verification_data(keydir, keyfile, keydest, fit, noffset, comment, require_keys, - engine_id, cmdname); + engine_id, cmdname, + algo_name); if (ret) return ret; } diff --git a/tools/imagetool.h b/tools/imagetool.h index 3546f7a671..b7ac3a23d0 100644 --- a/tools/imagetool.h +++ b/tools/imagetool.h @@ -69,6 +69,7 @@ struct image_tool_params { const char *keydest; /* Destination .dtb for public key */ const char *keyfile; /* Filename of private or public key */ const char *comment; /* Comment to add to signature node */ + const char *algo_name; /* Algorithm name to use hashing/signing */ int require_keys; /* 1 to mark signing keys as 'required' */ int file_size; /* Total size of output file */ int orig_file_size; /* Original size for file before padding */ diff --git a/tools/mkimage.c b/tools/mkimage.c index a4844d0f18..ddb79331a6 100644 --- a/tools/mkimage.c +++ b/tools/mkimage.c @@ -154,7 +154,7 @@ static void process_args(int argc, char **argv) int opt; while ((opt = getopt(argc, argv, - "a:A:b:B:c:C:d:D:e:Ef:FG:k:i:K:ln:N:p:O:rR:qstT:vVx")) != -1) { + "a:A:b:B:c:C:d:D:e:Ef:FG:k:i:K:ln:N:p:o:O:rR:qstT:vVx")) != -1) { switch (opt) { case 'a': params.addr = strtoull(optarg, &ptr, 16); @@ -250,6 +250,9 @@ static void process_args(int argc, char **argv) case 'N': params.engine_id = optarg; break; + case 'o': + params.algo_name = optarg; + break; case 'O': params.os = genimg_get_os_id(optarg); if (params.os < 0) { From 800f0d05e1a1bef75ca1aa8a580f1b0139bceb20 Mon Sep 17 00:00:00 2001 From: Anastasiia Lukianenko Date: Wed, 19 Jan 2022 22:49:21 +0200 Subject: [PATCH 08/10] MAINTAINERS: Update e-mail in Xen maintainership Changing e-mail because of leaving EPAM. Signed-off-by: Anastasiia Lukianenko Reviewed-by: Oleksandr Andrushchenko --- MAINTAINERS | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/MAINTAINERS b/MAINTAINERS index 64648c2921..9c2d6fe063 100644 --- a/MAINTAINERS +++ b/MAINTAINERS @@ -1307,7 +1307,7 @@ F: arch/x86/ F: cmd/x86/ XEN -M: Anastasiia Lukianenko +M: Anastasiia Lukianenko M: Oleksandr Andrushchenko S: Maintained F: arch/arm/cpu/armv8/xen/ From c28f2499952a78609e80d3b1f7aca9b0aab8d6d6 Mon Sep 17 00:00:00 2001 From: Heinrich Schuchardt Date: Sat, 15 Jan 2022 20:12:56 +0100 Subject: [PATCH 09/10] mkimage: struct stat.st_size may not be long MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The component st_size of struct stat is of type off_t. Depending on the system printing it using %ld leads to a warning: tools/mkimage.c:438:54: warning: format '%ld' expects argument of type 'long int', but argument 5 has type 'off_t' {aka 'long long int'} [-Wformat=] 438 | "%s: Bad size: \"%s\" is not valid image: size %ld < %u\n", | ~~^ | | | long int | %lld When comparing an off_t value to a 32bit integer we should not convert to uint32_t but to off_t which may be wider. Reported-by: Milan P. Stanić Fixes: 331f0800f1a3 ("mkimage: allow -l to work on block devices on Linux") Signed-off-by: Heinrich Schuchardt Reviewed-by: Mark Kettenis --- tools/mkimage.c | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/tools/mkimage.c b/tools/mkimage.c index ddb79331a6..0ec28da33c 100644 --- a/tools/mkimage.c +++ b/tools/mkimage.c @@ -435,11 +435,12 @@ int main(int argc, char **argv) params.cmdname, params.imagefile); exit (EXIT_FAILURE); #endif - } else if ((unsigned)sbuf.st_size < tparams->header_size) { + } else if (sbuf.st_size < (off_t)tparams->header_size) { fprintf (stderr, - "%s: Bad size: \"%s\" is not valid image: size %ld < %u\n", + "%s: Bad size: \"%s\" is not valid image: size %llu < %u\n", params.cmdname, params.imagefile, - sbuf.st_size, tparams->header_size); + (unsigned long long) sbuf.st_size, + tparams->header_size); exit (EXIT_FAILURE); } else { size = sbuf.st_size; From 480245cf273dfd14536dc2b30aff0a733b71a1ed Mon Sep 17 00:00:00 2001 From: Ashok Reddy Soma Date: Mon, 17 Jan 2022 10:16:50 +0100 Subject: [PATCH 10/10] cmd: Add Kconfig option for multiprocessor cmds Add Kconfig option(CONFIG_CMD_MP) to enable or disable multiprocessor commands. Compile cmd/mp.c based on CONFIG_CMD_MP. Signed-off-by: Ashok Reddy Soma Signed-off-by: Michal Simek --- Kconfig | 6 ++++++ cmd/Kconfig | 11 ++++++----- cmd/Makefile | 2 +- 3 files changed, 13 insertions(+), 6 deletions(-) diff --git a/Kconfig b/Kconfig index c46f4fce86..b0e45cd236 100644 --- a/Kconfig +++ b/Kconfig @@ -454,6 +454,12 @@ config SYS_SRAM_SIZE default 0x10000 if TARGET_TRICORDER default 0x0 +config MP + bool "Support for multiprocessor" + help + This provides an option to bringup different processors + in multiprocessor cases. + config EXAMPLES bool "Compile API examples" depends on !SANDBOX diff --git a/cmd/Kconfig b/cmd/Kconfig index 84ede90eee..5e25e45fd2 100644 --- a/cmd/Kconfig +++ b/cmd/Kconfig @@ -1827,12 +1827,13 @@ config CMD_SLEEP help Delay execution for some time -config MP - bool "support for multiprocessor" +config CMD_MP + bool "support for multiprocessor commands" + depends on MP + default y help - This provides an option to brinup - different processors in multiprocessor - cases. + This enables commands to bringup different processors + in multiprocessor cases. config CMD_TIMER bool "timer" diff --git a/cmd/Makefile b/cmd/Makefile index fb133e3703..166c652d98 100644 --- a/cmd/Makefile +++ b/cmd/Makefile @@ -100,7 +100,7 @@ obj-$(CONFIG_CMD_MDIO) += mdio.o obj-$(CONFIG_CMD_SLEEP) += sleep.o obj-$(CONFIG_CMD_MMC) += mmc.o obj-$(CONFIG_CMD_OPTEE_RPMB) += optee_rpmb.o -obj-$(CONFIG_MP) += mp.o +obj-$(CONFIG_CMD_MP) += mp.o obj-$(CONFIG_CMD_MTD) += mtd.o obj-$(CONFIG_CMD_MTDPARTS) += mtdparts.o obj-$(CONFIG_CMD_CLONE) += clone.o