Respect SOURCE_DATE_EPOCH when building FIT images.
Embedding timestamps in FIT images results in unreproducible builds
for targets that generate a fit image, such as dra7xx_evm.
This patch uses the SOURCE_DATE_EPOCH environment variable, when set,
to use specified value for the date.
Thanks to HW42 for debugging the issue and providing the patch:
https://lists.alioth.debian.org/pipermail/reproducible-builds/Week-of-Mon-20160606/005722.html
For more information about reproducible builds and the
SOURCE_DATE_EPOCH specification:
https://reproducible-builds.org/specs/source-date-epoch/
https://reproducible-builds.org/
Signed-off-by: Vagrant Cascadian <vagrant@debian.org>
Reviewed-by: Simon Glass <sjg@chromium.org>
diff --git a/tools/fit_image.c b/tools/fit_image.c
index 76a6de4..58aa8e2 100644
--- a/tools/fit_image.c
+++ b/tools/fit_image.c
@@ -51,8 +51,10 @@
}
/* for first image creation, add a timestamp at offset 0 i.e., root */
- if (params->datafile)
- ret = fit_set_timestamp(ptr, 0, sbuf.st_mtime);
+ if (params->datafile) {
+ time_t time = imagetool_get_source_date(params, sbuf.st_mtime);
+ ret = fit_set_timestamp(ptr, 0, time);
+ }
if (!ret) {
ret = fit_add_verification_data(params->keydir, dest_blob, ptr,