77 lines
2.5 KiB
Diff
77 lines
2.5 KiB
Diff
From 1fdc9daf97a1518960e5603dd43a5f353cb3ca89 Mon Sep 17 00:00:00 2001
|
|
From: Michael Chang <mchang@suse.com>
|
|
Date: Thu, 30 Nov 2023 13:45:13 +0800
|
|
Subject: [PATCH 1/2] mkstandalone: ensure stable timestamps for generated
|
|
images
|
|
|
|
This change mirrors a previous fix [1] but is specific to images
|
|
generated by grub-mkstandalone.
|
|
|
|
The former fix (85a7be241) focused on utilizing a stable timestamp
|
|
during binary generation in the util/mkimage context. This commit
|
|
extends that approach to the images produced by grub-mkstandalone,
|
|
ensuring consistency and stability in timestamps across all generated
|
|
binaries.
|
|
|
|
[1] 85a7be241 util/mkimage: Use stable timestamp when generating
|
|
binaries.
|
|
|
|
Signed-off-by: Michael Chang <mchang@suse.com>
|
|
Signed-off-by: Bernhard Wiedemann <bwiedemann@suse.com>
|
|
---
|
|
util/grub-mkstandalone.c | 10 +++++-----
|
|
1 file changed, 5 insertions(+), 5 deletions(-)
|
|
|
|
diff --git a/util/grub-mkstandalone.c b/util/grub-mkstandalone.c
|
|
index bdbeea6a6..8e1229925 100644
|
|
--- a/util/grub-mkstandalone.c
|
|
+++ b/util/grub-mkstandalone.c
|
|
@@ -30,6 +30,9 @@
|
|
#pragma GCC diagnostic error "-Wmissing-prototypes"
|
|
#pragma GCC diagnostic error "-Wmissing-declarations"
|
|
|
|
+/* use 2015-01-01T00:00:00+0000 as a stock timestamp */
|
|
+#define STABLE_EMBEDDING_TIMESTAMP 1420070400
|
|
+
|
|
static char *output_image;
|
|
static char **files;
|
|
static int nfiles;
|
|
@@ -184,7 +187,6 @@ add_tar_file (const char *from,
|
|
struct head hd;
|
|
grub_util_fd_t in;
|
|
ssize_t r;
|
|
- grub_uint32_t mtime = 0;
|
|
grub_uint32_t size;
|
|
|
|
COMPILE_TIME_ASSERT (sizeof (hd) == 512);
|
|
@@ -192,8 +194,6 @@ add_tar_file (const char *from,
|
|
if (grub_util_is_special_file (from))
|
|
return;
|
|
|
|
- mtime = grub_util_get_mtime (from);
|
|
-
|
|
optr = tcn = xmalloc (strlen (to) + 1);
|
|
for (iptr = to; *iptr == '/'; iptr++);
|
|
for (; *iptr; iptr++)
|
|
@@ -234,7 +234,7 @@ add_tar_file (const char *from,
|
|
memcpy (hd.gid, "0001750", 7);
|
|
|
|
set_tar_value (hd.size, optr - tcn, 12);
|
|
- set_tar_value (hd.mtime, mtime, 12);
|
|
+ set_tar_value (hd.mtime, STABLE_EMBEDDING_TIMESTAMP, 12);
|
|
hd.typeflag = 'L';
|
|
memcpy (hd.magic, MAGIC, sizeof (hd.magic));
|
|
memcpy (hd.uname, "grub", 4);
|
|
@@ -264,7 +264,7 @@ add_tar_file (const char *from,
|
|
memcpy (hd.gid, "0001750", 7);
|
|
|
|
set_tar_value (hd.size, size, 12);
|
|
- set_tar_value (hd.mtime, mtime, 12);
|
|
+ set_tar_value (hd.mtime, STABLE_EMBEDDING_TIMESTAMP, 12);
|
|
hd.typeflag = '0';
|
|
memcpy (hd.magic, MAGIC, sizeof (hd.magic));
|
|
memcpy (hd.uname, "grub", 4);
|
|
--
|
|
2.43.0
|
|
|