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.

svn path=/dists/trunk/linux/; revision=22647
This commit is contained in:
Ben Hutchings 2015-05-12 18:52:20 +00:00
parent 56c70a5fd2
commit 73842f1f17
4 changed files with 40 additions and 1 deletions

4
debian/changelog vendored
View File

@ -2,6 +2,10 @@ linux (4.1~rc3-1~exp1) UNRELEASED; urgency=medium
* New upstream release candidate
[ Ben Hutchings ]
* linux-image: Fix timestamps in the built-in initramfs for reproducible
build
-- Ben Hutchings <ben@decadent.org.uk> Mon, 11 May 2015 16:19:42 +0100
linux (4.0.2-1) unstable; urgency=medium

View File

@ -0,0 +1,33 @@
From: Ben Hutchings <ben@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/\\/\\\\/')

View File

@ -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

3
debian/rules.real vendored
View File

@ -15,6 +15,7 @@ endif
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 @@ include debian/rules.defs
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)