aboutsummaryrefslogtreecommitdiffstats
path: root/include
diff options
context:
space:
mode:
authorFelix Fietkau <nbd@openwrt.org>2016-01-31 23:29:16 +0000
committerFelix Fietkau <nbd@openwrt.org>2016-01-31 23:29:16 +0000
commit0e8196cca45664ae092dcfab0e8047ad1dc37084 (patch)
tree6a523482e166fcbe3e388d475b030d5cfe67d097 /include
parent973cd87d30f5763113e830f3343ca33267c79b9a (diff)
downloadmaster-187ad058-0e8196cca45664ae092dcfab0e8047ad1dc37084.tar.gz
master-187ad058-0e8196cca45664ae092dcfab0e8047ad1dc37084.tar.bz2
master-187ad058-0e8196cca45664ae092dcfab0e8047ad1dc37084.zip
build system: have tar use $SOURCE_DATE_EPOCH for --mtime
The --mtime argument to 'tar' sets the modification time for all files within the archive, which determines the timestamp files will get when they are extracted. In this case, rootfs and other tarballs will get mtimes which correspond to the last commit timestamp of the build system, as reported by git/subversion. This is a step towards reproducible image builds. Signed-off-by: bryan newbold <bnewbold@robocracy.org> Signed-off-by: Alexander Couzens <lynxis@fe80.eu> Signed-off-by: Felix Fietkau <nbd@openwrt.org> git-svn-id: svn://svn.openwrt.org/openwrt/trunk@48586 3c298f89-4303-0410-b956-a3cf2f4a3e73
Diffstat (limited to 'include')
-rw-r--r--include/image.mk8
-rw-r--r--include/kernel-build.mk4
2 files changed, 9 insertions, 3 deletions
diff --git a/include/image.mk b/include/image.mk
index 4eee4adfaf..8f81861fd0 100644
--- a/include/image.mk
+++ b/include/image.mk
@@ -186,7 +186,8 @@ ifneq ($(CONFIG_NAND_SUPPORT),)
[ -z "$(2)" ] || $(CP) "$(KDIR)/root.$(2)" "$(KDIR_TMP)/sysupgrade-$(1)/root"
[ -z "$(3)" ] || $(CP) "$(3)" "$(KDIR_TMP)/sysupgrade-$(1)/kernel"
(cd "$(KDIR_TMP)"; $(TAR) cvf \
- "$(BIN_DIR)/$(IMG_PREFIX)-$(1)-$(2)-sysupgrade.tar" sysupgrade-$(1))
+ "$(BIN_DIR)/$(IMG_PREFIX)-$(1)-$(2)-sysupgrade.tar" sysupgrade-$(1) \
+ $(if $(SOURCE_DATE_EPOCH),--mtime="@$(SOURCE_DATE_EPOCH)")
endef
# $(1) board name
@@ -248,7 +249,10 @@ define Image/mkfs/cpiogz
endef
define Image/mkfs/targz
- $(TAR) -czpf $(BIN_DIR)/$(IMG_PREFIX)$(if $(PROFILE_SANITIZED),-$(PROFILE_SANITIZED))-rootfs.tar.gz --numeric-owner --owner=0 --group=0 --sort=name -C $(TARGET_DIR)/ .
+ $(TAR) -czpf $(BIN_DIR)/$(IMG_PREFIX)$(if $(PROFILE_SANITIZED),-$(PROFILE_SANITIZED))-rootfs.tar.gz \
+ --numeric-owner --owner=0 --group=0 --sort=name \
+ $(if $(SOURCE_DATE_EPOCH),--mtime="@$(SOURCE_DATE_EPOCH)") \
+ -C $(TARGET_DIR)/ .
endef
E2SIZE=$(shell echo $$(($(CONFIG_TARGET_ROOTFS_PARTSIZE)*1024*1024)))
diff --git a/include/kernel-build.mk b/include/kernel-build.mk
index 8bfd9c89e3..a52c90d9e7 100644
--- a/include/kernel-build.mk
+++ b/include/kernel-build.mk
@@ -54,7 +54,9 @@ ifdef CONFIG_COLLECT_KERNEL_DEBUG
$(STAGING_DIR_ROOT)/lib/modules/$(LINUX_VERSION)/* \
$(KERNEL_BUILD_DIR)/debug/modules/
$(FIND) $(KERNEL_BUILD_DIR)/debug -type f | $(XARGS) $(KERNEL_CROSS)strip --only-keep-debug
- $(TAR) c -C $(KERNEL_BUILD_DIR) debug | bzip2 -c -9 > $(BIN_DIR)/kernel-debug.tar.bz2
+ $(TAR) c -C $(KERNEL_BUILD_DIR) debug \
+ $(if $(SOURCE_DATE_EPOCH),--mtime="@$(SOURCE_DATE_EPOCH)") \
+ | bzip2 -c -9 > $(BIN_DIR)/kernel-debug.tar.bz2
endef
endif