[pve-devel] [RFC kernel] fix #1276: include package version in uname information

Fabian Grünbichler f.gruenbichler at proxmox.com
Wed Feb 8 15:49:46 CET 2017


Signed-off-by: Fabian Grünbichler <f.gruenbichler at proxmox.com>
---
note: adapted from Debian's build script. this changes

Linux node2 4.4.40-1-pve #1 SMP Wed Feb 8 15:28:59 CET 2017 x86_64 GNU/Linux

into

Linux node1 4.4.40-1-pve #1 SMP PVE 4.4.40-80 (Wed, 8 Feb 2017 13:10:51 +0100) x86_64 GNU/Linux


 Makefile                      |  4 +++-
 uname-version-timestamp.patch | 33 +++++++++++++++++++++++++++++++++
 2 files changed, 36 insertions(+), 1 deletion(-)
 create mode 100644 uname-version-timestamp.patch

diff --git a/Makefile b/Makefile
index 132521e..ed7e307 100644
--- a/Makefile
+++ b/Makefile
@@ -17,6 +17,7 @@ HDRPACKAGE=pve-headers-${KVNAME}
 
 ARCH=amd64
 GITVERSION:=$(shell cat .git/refs/heads/master)
+CHANGELOG_DATE:=$(shell dpkg-parsechangelog -SDate -lchangelog.Debian)
 
 TOP=$(shell pwd)
 
@@ -241,7 +242,7 @@ PVE_CONFIG_OPTS= \
 	cp ${KERNEL_CFG_ORG} ${KERNEL_SRC}/.config
 	cd ${KERNEL_SRC}; ./scripts/config ${PVE_CONFIG_OPTS}
 	cd ${KERNEL_SRC}; make oldconfig
-	cd ${KERNEL_SRC}; make -j 8
+	cd ${KERNEL_SRC}; make KBUILD_BUILD_VERSION_TIMESTAMP="PVE ${KERNEL_VER}-${PKGREL} ($(CHANGELOG_DATE))" -j 8
 	make -C ${KERNEL_SRC}/tools/perf prefix=/usr HAVE_CPLUS_DEMANGLE=1 NO_LIBPYTHON=1 NO_LIBPERL=1 NO_LIBCRYPTO=1 PYTHON=python2.7
 	make -C ${KERNEL_SRC}/tools/perf man
 	touch $@
@@ -250,6 +251,7 @@ ${KERNEL_SRC}/README ${KERNEL_CFG_ORG}: ${KERNELSRCTAR}
 	rm -rf ${KERNEL_SRC}
 	tar xf ${KERNELSRCTAR}
 	cat ${KERNEL_SRC}/debian.master/config/config.common.ubuntu ${KERNEL_SRC}/debian.master/config/amd64/config.common.amd64 ${KERNEL_SRC}/debian.master/config/amd64/config.flavour.generic > ${KERNEL_CFG_ORG}
+	cd ${KERNEL_SRC}; patch -p1 < ../uname-version-timestamp.patch
 	cd ${KERNEL_SRC}; patch -p1 <../bridge-patch.diff
 	#cd ${KERNEL_SRC}; patch -p1 <../bridge-forward-ipv6-neighbor-solicitation.patch
 	#cd ${KERNEL_SRC}; patch -p1 <../add-empty-ndo_poll_controller-to-veth.patch
diff --git a/uname-version-timestamp.patch b/uname-version-timestamp.patch
new file mode 100644
index 0000000..5cd565c
--- /dev/null
+++ b/uname-version-timestamp.patch
@@ -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/\\/\\\\/')
-- 
2.1.4





More information about the pve-devel mailing list