summaryrefslogtreecommitdiff
path: root/tools/fit_image.c
diff options
context:
space:
mode:
authorTom Rini <trini@konsulko.com>2020-06-03 11:44:12 -0400
committerTom Rini <trini@konsulko.com>2020-06-03 11:44:12 -0400
commit49c8c91cc69546f7a2017bc0943ef1225a01c72c (patch)
treef91b7127c7f7c9798f511e786d0b6a3116d79f53 /tools/fit_image.c
parentecd4d99f654f3f7bfb96001891d69c3125e70b69 (diff)
parent9f8aa0fbee40b66ceeaab06d3a0ce9a7a7d692a7 (diff)
Merge branch '2020-06-03-misc-bugfixes'
- Update various docs to not have 'ARCH=' in them as that's not part of how U-Boot builds. - Add macOS tools-only build to Azure to help catch problems on BSD hosts with tools. - Bugfixes from the latest header cleanup around ARCH_DMA_MINALIGN - Assorted small Kconfig logic/typo corrections - Add a default hash to FIT images that have their its auto generated. - Other assorted fixes
Diffstat (limited to 'tools/fit_image.c')
-rw-r--r--tools/fit_image.c18
1 files changed, 16 insertions, 2 deletions
diff --git a/tools/fit_image.c b/tools/fit_image.c
index 88ff093d05b..a082d9386d2 100644
--- a/tools/fit_image.c
+++ b/tools/fit_image.c
@@ -111,7 +111,7 @@ static int fit_calc_size(struct image_tool_params *params)
if (size < 0)
return -1;
- /* Add space for properties */
+ /* Add space for properties and hash node */
total_size += size + 300;
}
@@ -193,6 +193,18 @@ static void get_basename(char *str, int size, const char *fname)
}
/**
+ * add_crc_node() - Add a hash node to request a CRC checksum for an image
+ *
+ * @fdt: Device tree to add to (in sequential-write mode)
+ */
+static void add_crc_node(void *fdt)
+{
+ fdt_begin_node(fdt, "hash-1");
+ fdt_property_string(fdt, FIT_ALGO_PROP, "crc32");
+ fdt_end_node(fdt);
+}
+
+/**
* fit_write_images() - Write out a list of images to the FIT
*
* We always include the main image (params->datafile). If there are device
@@ -230,6 +242,7 @@ static int fit_write_images(struct image_tool_params *params, char *fdt)
ret = fdt_property_file(params, fdt, FIT_DATA_PROP, params->datafile);
if (ret)
return ret;
+ add_crc_node(fdt);
fdt_end_node(fdt);
/* Now the device tree files if available */
@@ -252,6 +265,7 @@ static int fit_write_images(struct image_tool_params *params, char *fdt)
genimg_get_arch_short_name(params->arch));
fdt_property_string(fdt, FIT_COMP_PROP,
genimg_get_comp_short_name(IH_COMP_NONE));
+ add_crc_node(fdt);
fdt_end_node(fdt);
}
@@ -269,7 +283,7 @@ static int fit_write_images(struct image_tool_params *params, char *fdt)
params->fit_ramdisk);
if (ret)
return ret;
-
+ add_crc_node(fdt);
fdt_end_node(fdt);
}