tools/firmware-utils: use UTC for image timestamps
authorSander Vanheule <sander@svanheule.net>
Thu, 6 Aug 2020 20:10:32 +0000 (22:10 +0200)
committerJo-Philipp Wich <jo@mein.io>
Fri, 7 Aug 2020 07:48:33 +0000 (09:48 +0200)
By using localtime() to determine the timestamp that goes into factory
images, the resulting image depends on the timezone of the build system.
Use gmtime() instead, which results in more reproducible images.

Signed-off-by: Sander Vanheule <sander@svanheule.net>
Makefile
src/addpattern.c
src/tplink-safeloader.c

index ee0ef3a6fdebaec23cfe54096693060a60c51162..4fcda7e439655ca68d5bc7b23ad38ef49b210148 100644 (file)
--- a/Makefile
+++ b/Makefile
@@ -7,7 +7,7 @@
 include $(TOPDIR)/rules.mk
 
 PKG_NAME := firmware-utils
-PKG_RELEASE := 1
+PKG_RELEASE := 2
 
 include $(INCLUDE_DIR)/host-build.mk
 include $(INCLUDE_DIR)/kernel.mk
index 9bc48653356291c1568e020a6f5bcdc35822fb09..979152787831cec0712cc6908a88822649f5a4aa 100644 (file)
@@ -296,7 +296,7 @@ int main(int argc, char **argv)
                return EXIT_FAILURE;
        }
 
-       ptm = localtime(&t);
+       ptm = gmtime(&t);
 
        if (3 != sscanf(version, "v%d.%d.%d", &v0, &v1, &v2)) {
                fprintf(stderr, "bad version string \"%s\"\n", version);
index a5f3ced16d871ed72d8cd5728605a802938184cc..0af1fe4c6e2ecf215591e0476459fea226e89949 100644 (file)
@@ -2079,7 +2079,7 @@ static struct image_partition_entry make_soft_version(uint32_t rev) {
        else if (time(&t) == (time_t)(-1))
                error(1, errno, "time");
 
-       struct tm *tm = localtime(&t);
+       struct tm *tm = gmtime(&t);
 
        s->magic = htonl(0x0000000c);
        s->zero = 0;