From 602f95d4c4b87003655c74f5c0b25de0b381dfcc Mon Sep 17 00:00:00 2001 From: Ed Maste Date: Thu, 15 Dec 2016 21:26:58 +0000 Subject: [PATCH] Add WITH_REPRODUCIBLE_BUILD src.conf(5) knob to disable kernel metadata The kernel builds reproducibly, except for the time, date, user, and hostname baked into the kernel (reported at startup and via the kern.version sysctl for uname). Add a build knob to disable the inclusion of this metadata. Reviewed by: jhb MFC after: 1 month Relnotes: Yes Sponsored by: Reproducible Builds World Summit 2, Berlin Differential Revision: https://reviews.freebsd.org/D8809 --- sys/conf/kern.opts.mk | 3 ++- sys/conf/kern.post.mk | 5 ++++- tools/build/options/WITH_REPRODUCIBLE_BUILD | 3 +++ 3 files changed, 9 insertions(+), 2 deletions(-) create mode 100644 tools/build/options/WITH_REPRODUCIBLE_BUILD diff --git a/sys/conf/kern.opts.mk b/sys/conf/kern.opts.mk index b8f0c3ec62b2..66d43b2ac511 100644 --- a/sys/conf/kern.opts.mk +++ b/sys/conf/kern.opts.mk @@ -47,7 +47,8 @@ __DEFAULT_NO_OPTIONS = \ EISA \ EXTRA_TCP_STACKS \ NAND \ - OFED + OFED \ + REPRODUCIBLE_BUILD # Some options are totally broken on some architectures. We disable # them. If you need to enable them on an experimental basis, you diff --git a/sys/conf/kern.post.mk b/sys/conf/kern.post.mk index 128e47d67432..a16cb0318759 100644 --- a/sys/conf/kern.post.mk +++ b/sys/conf/kern.post.mk @@ -357,8 +357,11 @@ config.o env.o hints.o vers.o vnode_if.o: config.ln env.ln hints.ln vers.ln vnode_if.ln: ${NORMAL_LINT} +.if ${MK_REPRODUCIBLE_BUILD} != "no" +REPRO_FLAG="-r" +.endif vers.c: $S/conf/newvers.sh $S/sys/param.h ${SYSTEM_DEP} - MAKE=${MAKE} sh $S/conf/newvers.sh ${KERN_IDENT} + MAKE=${MAKE} sh $S/conf/newvers.sh ${REPRO_FLAG} ${KERN_IDENT} vnode_if.c: $S/tools/vnode_if.awk $S/kern/vnode_if.src ${AWK} -f $S/tools/vnode_if.awk $S/kern/vnode_if.src -c diff --git a/tools/build/options/WITH_REPRODUCIBLE_BUILD b/tools/build/options/WITH_REPRODUCIBLE_BUILD new file mode 100644 index 000000000000..fec4b1eef166 --- /dev/null +++ b/tools/build/options/WITH_REPRODUCIBLE_BUILD @@ -0,0 +1,3 @@ +$FreeBSD$ +Set to exclude build metadata (build time, user, host and path) from the +kernel and uname output.