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. Reviewed by: bapt MFC after: 1 month Relnotes: yes Sponsored by: The FreeBSD Foundation Differential Revision: https://reviews.freebsd.org/D8842
This commit is contained in:
parent
bc814587a9
commit
a97b71605a
@ -190,6 +190,7 @@ __DEFAULT_NO_OPTIONS = \
|
||||
OFED \
|
||||
OPENLDAP \
|
||||
RCS \
|
||||
REPRODUCIBLE_BUILD \
|
||||
SHARED_TOOLCHAIN \
|
||||
SORT_THREADS \
|
||||
SVN \
|
||||
|
@ -74,5 +74,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}
|
||||
|
@ -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
|
||||
|
@ -1,3 +1,4 @@
|
||||
$FreeBSD$
|
||||
Set to exclude build metadata (build time, user, host and path) from the
|
||||
kernel and uname output.
|
||||
Set to exclude build metadata (such as the build time, user, or host)
|
||||
from the kernel, boot loaders, and uname output, so that builds produce
|
||||
bit-for-bit identical output.
|
||||
|
Loading…
Reference in New Issue
Block a user