From b57b8d2f341c0182aa784e1de7906ec67daff414 Mon Sep 17 00:00:00 2001 From: Alexander Couzens Date: Sun, 16 Jul 2017 21:43:03 +0200 Subject: [PATCH] target/linux/4.4|4.9: use fixed timestamp for files within initramfs Signed-off-by: Alexander Couzens --- ...mfs-cpio-fix-source-date-epoch-files.patch | 30 +++++++++++++++++++ 1 file changed, 30 insertions(+) create mode 100644 target/linux/generic/patches-4.9/999-initramfs-cpio-fix-source-date-epoch-files.patch 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 index 0000000000..bfd702beb5 --- /dev/null +++ b/target/linux/generic/patches-4.9/999-initramfs-cpio-fix-source-date-epoch-files.patch @@ -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); -- 2.30.2