[PATCH] tools/firmware-utils: use UTC for image timestamps
Paul Spooren
mail at aparcar.org
Thu Aug 6 16:02:05 EDT 2020
Please increase the PKG_RELEASE on code changes.
On 06.08.20 09:10, Sander Vanheule wrote:
> 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 at svanheule.net>
> ---
> Tested by building factory images with tplink-safeloader
>
> tools/firmware-utils/src/addpattern.c | 2 +-
> tools/firmware-utils/src/tplink-safeloader.c | 2 +-
> 2 files changed, 2 insertions(+), 2 deletions(-)
>
> diff --git a/tools/firmware-utils/src/addpattern.c b/tools/firmware-utils/src/addpattern.c
> index 9bc4865335..9791527878 100644
> --- a/tools/firmware-utils/src/addpattern.c
> +++ b/tools/firmware-utils/src/addpattern.c
> @@ -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);
> diff --git a/tools/firmware-utils/src/tplink-safeloader.c b/tools/firmware-utils/src/tplink-safeloader.c
> index a5f3ced16d..0af1fe4c6e 100644
> --- a/tools/firmware-utils/src/tplink-safeloader.c
> +++ b/tools/firmware-utils/src/tplink-safeloader.c
> @@ -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;
More information about the openwrt-devel
mailing list