target/linux/4.4|4.9: use fixed timestamp for files within initramfs for-master
authorAlexander Couzens <lynxis@fe80.eu>
Sun, 16 Jul 2017 19:43:03 +0000 (21:43 +0200)
committerAlexander Couzens <lynxis@fe80.eu>
Tue, 3 Oct 2017 21:26:39 +0000 (23:26 +0200)
Signed-off-by: Alexander Couzens <lynxis@fe80.eu>
target/linux/generic/patches-4.9/999-initramfs-cpio-fix-source-date-epoch-files.patch [new file with mode: 0644]

diff --git a/target/linux/generic/patches-4.9/999-initramfs-cpio-fix-source-date-epoch-files.patch b/target/linux/generic/patches-4.9/999-initramfs-cpio-fix-source-date-epoch-files.patch
new file mode 100644 (file)
index 0000000..bfd702b
--- /dev/null
@@ -0,0 +1,30 @@
+Index: linux-4.9.34/usr/gen_init_cpio.c
+===================================================================
+--- linux-4.9.34.orig/usr/gen_init_cpio.c
++++ linux-4.9.34/usr/gen_init_cpio.c
+@@ -23,6 +23,7 @@
+ static unsigned int offset;
+ static unsigned int ino = 721;
+ static time_t default_mtime;
++static time_t source_date_epoch = -1;
+ struct file_handler {
+       const char *type;
+@@ -336,6 +337,9 @@ static int cpio_mkfile(const char *name,
+               /* data goes on last link */
+               if (i == nlinks) size = buf.st_size;
++              if (source_date_epoch != -1)
++                      buf.st_mtime = source_date_epoch;
++
+               if (name[0] == '/')
+                       name++;
+               namesize = strlen(name) + 1;
+@@ -536,6 +540,7 @@ int main (int argc, char *argv[])
+               switch (opt) {
+               case 't':
+                       default_mtime = strtol(optarg, &invalid, 10);
++                      source_date_epoch = default_mtime;
+                       if (!*optarg || *invalid) {
+                               fprintf(stderr, "Invalid timestamp: %s\n",
+                                               optarg);