summaryrefslogtreecommitdiffstats
path: root/sys/boot/common
diff options
context:
space:
mode:
authoremaste <emaste@FreeBSD.org>2017-01-25 01:04:51 +0000
committeremaste <emaste@FreeBSD.org>2017-01-25 01:04:51 +0000
commitdc47b733e66efd0d5af4953ba33a5877e3e54b8f (patch)
treed927bdf4c964e7ea8ff439880300540978dd1b0d /sys/boot/common
parent59522422d6d0ca53d9b19d6ac7213481ce7a6321 (diff)
downloadFreeBSD-src-dc47b733e66efd0d5af4953ba33a5877e3e54b8f.zip
FreeBSD-src-dc47b733e66efd0d5af4953ba33a5877e3e54b8f.tar.gz
Add WITH_REPRODUCIBLE_BUILD src.conf(5) knob
MFC r310128: 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. MFC r310268: Build loaders reproducibly when WITH_REPRODUCIBLE_BUILD When WITH_REPRODUCIBLE_BUILD=yes is set in src.conf(5), eliminate the time, user, and host from the loader's version information. This allows builds to produce bit-for-bit identical output.
Diffstat (limited to 'sys/boot/common')
-rw-r--r--sys/boot/common/Makefile.inc6
-rwxr-xr-xsys/boot/common/newvers.sh17
2 files changed, 21 insertions, 2 deletions
diff --git a/sys/boot/common/Makefile.inc b/sys/boot/common/Makefile.inc
index 8bd6c7d..eb17549 100644
--- a/sys/boot/common/Makefile.inc
+++ b/sys/boot/common/Makefile.inc
@@ -73,5 +73,9 @@ CFLAGS+=-I${.CURDIR}/../../../../lib/libstand
CLEANFILES+= vers.c
VERSION_FILE?= ${.CURDIR}/version
+.if ${MK_REPRODUCIBLE_BUILD} != no
+REPRO_FLAG= -r
+.endif
vers.c: ${SRCTOP}/sys/boot/common/newvers.sh ${VERSION_FILE}
- sh ${SRCTOP}/sys/boot/common/newvers.sh ${VERSION_FILE} ${NEWVERSWHAT}
+ sh ${SRCTOP}/sys/boot/common/newvers.sh ${REPRO_FLAG} ${VERSION_FILE} \
+ ${NEWVERSWHAT}
diff --git a/sys/boot/common/newvers.sh b/sys/boot/common/newvers.sh
index 167b7cc..9547c85 100755
--- a/sys/boot/common/newvers.sh
+++ b/sys/boot/common/newvers.sh
@@ -35,11 +35,26 @@
tempfile=$(mktemp tmp.XXXXXX) || exit
trap "rm -f $tempfile" EXIT INT TERM
+include_metadata=true
+while getopts r opt; do
+ case "$opt" in
+ r)
+ include_metadata=
+ ;;
+ esac
+done
+shift $((OPTIND - 1))
+
LC_ALL=C; export LC_ALL
u=${USER-root} h=${HOSTNAME-`hostname`} t=`date`
#r=`head -n 6 $1 | tail -n 1 | awk -F: ' { print $1 } '`
r=`awk -F: ' /^[0-9]\.[0-9]+:/ { print $1; exit }' $1`
-echo "char bootprog_info[] = \"FreeBSD/${3} ${2}, Revision ${r}\\n(${t} ${u}@${h})\\n\";" > $tempfile
+bootprog_info="FreeBSD/${3} ${2}, Revision ${r}\\n"
+if [ -n "${include_metadata}" ]; then
+ bootprog_info="$bootprog_info(${t} ${u}@${h})\\n"
+fi
+
+echo "char bootprog_info[] = \"$bootprog_info\";" > $tempfile
echo "unsigned bootprog_rev = ${r%%.*}${r##*.};" >> $tempfile
mv $tempfile vers.c
OpenPOWER on IntegriCloud