[RFC PATCH] mkimage: Allow -o to set hash algorithm in auto mode
Joel Stanley
joel at jms.id.au
Thu Oct 31 10:35:10 CET 2024
Users would like to be able to create a FIT with hashed images using
using a given algorithm in auto mode. Allow them to use the existing -o
option for this.
In commit b93a65209c4a ("mkimage: fit: Support signed configurations in
'auto' FITs"), the examples lead me to believe this was already the
behavior, however -o only affects auto-conf mode.
The change in this commit does not affect the auto-conf behaviour.
Signed-off-by: Joel Stanley <joel at jms.id.au>
---
RFC. This is useful in testing that the hash infrastructure is working.
If there's no appetite for changing the mkimage behaviour then I
understand.
---
tools/fit_image.c | 9 +++++++++
1 file changed, 9 insertions(+)
diff --git a/tools/fit_image.c b/tools/fit_image.c
index 0fccfbb4ebda..b3b0283eca83 100644
--- a/tools/fit_image.c
+++ b/tools/fit_image.c
@@ -217,6 +217,12 @@ static void fit_add_hash_or_sign(struct image_tool_params *params, void *fdt,
const char *hash_algo = "crc32";
bool do_hash = false;
bool do_sign = false;
+ char *algo_name = NULL;
+
+ if (params->algo_name) {
+ algo_name = strdup(params->algo_name);
+ hash_algo = strtok(algo_name, ",");
+ }
switch (params->auto_fit) {
case AF_OFF:
@@ -254,6 +260,9 @@ static void fit_add_hash_or_sign(struct image_tool_params *params, void *fdt,
fdt_property_string(fdt, FIT_KEY_HINT, params->keyname);
fdt_end_node(fdt);
}
+
+ if (algo_name)
+ free(algo_name);
}
/**
--
2.45.2
More information about the U-Boot
mailing list