[kernel] r22647 - in dists/trunk/linux/debian: . patches patches/debian

Ben Hutchings benh at moszumanska.debian.org
Tue May 12 18:52:20 UTC 2015


Author: benh
Date: Tue May 12 18:52:20 2015
New Revision: 22647

Log:
linux-image: Fix timestamps in the built-in initramfs for reproducible build

$KBUILD_BUILD_TIMESTAMP is used in two places:
1. By mkcompile_h, to generate both the utsname::version string
2. By gen_initramfs_list.sh, to set the timestamps for the built-in initramfs

As we want utsname::version to contain the package version and not an
RFC822 timestamp, the current value doesn't work for (2).

Change mkcompile_h to prefer $KBUILD_BUILD_VERSION_TIMESTAMP over
$KBUILD_BUILD_TIMESTAMP, and set both variables in debian/rules.real.

Added:
   dists/trunk/linux/debian/patches/debian/uname-version-timestamp.patch
Modified:
   dists/trunk/linux/debian/changelog
   dists/trunk/linux/debian/patches/series
   dists/trunk/linux/debian/rules.real

Modified: dists/trunk/linux/debian/changelog
==============================================================================
--- dists/trunk/linux/debian/changelog	Mon May 11 19:44:34 2015	(r22646)
+++ dists/trunk/linux/debian/changelog	Tue May 12 18:52:20 2015	(r22647)
@@ -2,6 +2,10 @@
 
   * New upstream release candidate
 
+  [ Ben Hutchings ]
+  * linux-image: Fix timestamps in the built-in initramfs for reproducible
+    build
+
  -- Ben Hutchings <ben at decadent.org.uk>  Mon, 11 May 2015 16:19:42 +0100
 
 linux (4.0.2-1) unstable; urgency=medium

Added: dists/trunk/linux/debian/patches/debian/uname-version-timestamp.patch
==============================================================================
--- /dev/null	00:00:00 1970	(empty, because file is newly added)
+++ dists/trunk/linux/debian/patches/debian/uname-version-timestamp.patch	Tue May 12 18:52:20 2015	(r22647)
@@ -0,0 +1,33 @@
+From: Ben Hutchings <ben at decadent.org.uk>
+Subject: Make mkcompile_h accept an alternate timestamp string
+Date: Tue, 12 May 2015 19:29:22 +0100
+Forwarded: not-needed
+
+We want to include the Debian version in the utsname::version string
+instead of a full timestamp string.  However, we still need to provide
+a standard timestamp string for gen_initramfs_list.sh to make the
+kernel image reproducible.
+
+Make mkcompile_h use $KBUILD_BUILD_VERSION_TIMESTAMP in preference to
+$KBUILD_BUILD_TIMESTAMP.
+
+--- a/scripts/mkcompile_h
++++ b/scripts/mkcompile_h
+@@ -37,10 +37,14 @@ else
+ 	VERSION=$KBUILD_BUILD_VERSION
+ fi
+ 
+-if [ -z "$KBUILD_BUILD_TIMESTAMP" ]; then
+-	TIMESTAMP=`date`
++if [ -z "$KBUILD_BUILD_VERSION_TIMESTAMP" ]; then
++	if [ -z "$KBUILD_BUILD_TIMESTAMP" ]; then
++		TIMESTAMP=`date`
++	else
++		TIMESTAMP=$KBUILD_BUILD_TIMESTAMP
++	fi
+ else
+-	TIMESTAMP=$KBUILD_BUILD_TIMESTAMP
++	TIMESTAMP=$KBUILD_BUILD_VERSION_TIMESTAMP
+ fi
+ if test -z "$KBUILD_BUILD_USER"; then
+ 	LINUX_COMPILE_BY=$(whoami | sed 's/\\/\\\\/')

Modified: dists/trunk/linux/debian/patches/series
==============================================================================
--- dists/trunk/linux/debian/patches/series	Mon May 11 19:44:34 2015	(r22646)
+++ dists/trunk/linux/debian/patches/series	Tue May 12 18:52:20 2015	(r22647)
@@ -1,5 +1,6 @@
 # Changes to support package build system
 debian/version.patch
+debian/uname-version-timestamp.patch
 debian/kernelvariables.patch
 debian/gitignore.patch
 debian/ia64-hardcode-arch-script-output.patch

Modified: dists/trunk/linux/debian/rules.real
==============================================================================
--- dists/trunk/linux/debian/rules.real	Mon May 11 19:44:34 2015	(r22646)
+++ dists/trunk/linux/debian/rules.real	Tue May 12 18:52:20 2015	(r22647)
@@ -15,6 +15,7 @@
 MAINTAINER := $(shell sed -ne 's,^Maintainer: .[^<]*<\([^>]*\)>,\1,p' debian/control)
 DISTRIBUTION := $(shell dpkg-parsechangelog | sed -ne 's,^Distribution: ,,p')
 SOURCE_DATE := $(shell dpkg-parsechangelog | sed -ne 's,^Date: ,,p')
+SOURCE_DATE_UTC_822 := $(shell date -u -d '$(SOURCE_DATE)' -R)
 SOURCE_DATE_UTC_ISO := $(shell date -u -d '$(SOURCE_DATE)' +%Y-%m-%d)
 
 DISTRIBUTOR := $(shell lsb_release -is 2>/dev/null)
@@ -39,7 +40,7 @@
 stamp = [ -d $(dir $@) ] || mkdir $(dir $@); touch $@
 
 setup_env := env -u ABINAME -u ARCH -u FEATURESET -u FLAVOUR -u VERSION -u LOCALVERSION
-setup_env += DISTRIBUTION_OFFICIAL_BUILD=1 DISTRIBUTOR="$(DISTRIBUTOR)" DISTRIBUTION_VERSION="$(SOURCEVERSION)" KBUILD_BUILD_TIMESTAMP="$(DISTRIBUTOR) $(SOURCEVERSION) ($(SOURCE_DATE_UTC_ISO))" KBUILD_BUILD_USER="$(word 1,$(subst @, ,$(MAINTAINER)))" KBUILD_BUILD_HOST="$(word 2,$(subst @, ,$(MAINTAINER)))"
+setup_env += DISTRIBUTION_OFFICIAL_BUILD=1 DISTRIBUTOR="$(DISTRIBUTOR)" DISTRIBUTION_VERSION="$(SOURCEVERSION)" KBUILD_BUILD_TIMESTAMP="$(SOURCE_DATE_UTC_822)" KBUILD_BUILD_VERSION_TIMESTAMP="$(DISTRIBUTOR) $(SOURCEVERSION) ($(SOURCE_DATE_UTC_ISO))" KBUILD_BUILD_USER="$(word 1,$(subst @, ,$(MAINTAINER)))" KBUILD_BUILD_HOST="$(word 2,$(subst @, ,$(MAINTAINER)))"
 
 MAKE_CLEAN = $(setup_env) $(MAKE)
 MAKE_SELF := $(MAKE) -f debian/rules.real $(MAKEOVERRIDES)



More information about the Kernel-svn-changes mailing list