svn commit: r309412 - in head: . sys/boot sys/boot/efi/boot1 sys/boot/i386/boot2 sys/boot/i386/pxeldr sys/boot/i386/zfsboot sys/boot/pc98/boot0.5 sys/boot/pc98/boot2 sys/boot/pc98/pc98boot sys/boot...

Warner Losh imp at FreeBSD.org
Fri Dec 2 14:44:41 UTC 2016


Author: imp
Date: Fri Dec  2 14:44:38 2016
New Revision: 309412
URL: https://svnweb.freebsd.org/changeset/base/309412

Log:
  dd is currently a bootstrap tool. It really doesn't have any business
  being a bootstrap tool. However, for reproducible build output,
  FreeBSD added dd status=none because it was otherwise difficult to
  suppress the status information, but retain any errors that might
  happen. There's no real reason that dd has to be a build tool, other
  than we use status=none unconditional. Remove dd from a bootstrap tool
  entirely by only using status=none when available. This may also help
  efforts to build the system on non-FreeBSD hosts as well.
  
  Differential Revision: https://reviews.freebsd.org/D8605

Modified:
  head/Makefile.inc1
  head/sys/boot/Makefile.inc
  head/sys/boot/efi/boot1/Makefile
  head/sys/boot/i386/boot2/Makefile
  head/sys/boot/i386/pxeldr/Makefile
  head/sys/boot/i386/zfsboot/Makefile
  head/sys/boot/pc98/boot0.5/Makefile
  head/sys/boot/pc98/boot2/Makefile
  head/sys/boot/pc98/pc98boot/Makefile
  head/sys/boot/powerpc/boot1.chrp/Makefile
  head/sys/boot/sparc64/boot1/Makefile

Modified: head/Makefile.inc1
==============================================================================
--- head/Makefile.inc1	Fri Dec  2 14:23:26 2016	(r309411)
+++ head/Makefile.inc1	Fri Dec  2 14:44:38 2016	(r309412)
@@ -1631,11 +1631,6 @@ ${_bt}-usr.sbin/nmtree: ${_bt}-lib/libne
 _cat=		bin/cat
 .endif
 
-# r264059 support for status=
-.if ${BOOTSTRAPPING} < 1100017
-_dd=		bin/dd
-.endif
-
 # r277259 crunchide: Correct 64-bit section header offset
 # r281674 crunchide: always include both 32- and 64-bit ELF support
 .if ${BOOTSTRAPPING} < 1100078
@@ -1718,7 +1713,6 @@ bootstrap-tools: .PHONY
     ${_groff} \
     ${_dtc} \
     ${_cat} \
-    ${_dd} \
     ${_kbdcontrol} \
     usr.bin/lorder \
     ${_libopenbsd} \

Modified: head/sys/boot/Makefile.inc
==============================================================================
--- head/sys/boot/Makefile.inc	Fri Dec  2 14:23:26 2016	(r309411)
+++ head/sys/boot/Makefile.inc	Fri Dec  2 14:44:38 2016	(r309412)
@@ -15,3 +15,10 @@ CFLAGS.clang+=	-mno-movt
 .endif
 CFLAGS.clang+=  -mfpu=none
 .endif
+
+# The boot loader build uses dd status=none, where possible, for reproducible
+# build output (since performance varies from run to run). Trouble is that
+# option was recently (10.3) added to FreeBSD and is non-standard. Only use it
+# when this test succeeds rather than require dd to be a bootstrap tool.
+DD_NOSTATUS!=(dd status=none count=0 2> /dev/null && echo status=none) || true
+DD=dd ${DD_NOSTATUS}

Modified: head/sys/boot/efi/boot1/Makefile
==============================================================================
--- head/sys/boot/efi/boot1/Makefile	Fri Dec  2 14:23:26 2016	(r309411)
+++ head/sys/boot/efi/boot1/Makefile	Fri Dec  2 14:44:38 2016	(r309412)
@@ -124,8 +124,7 @@ boot1.efifat: boot1.efi
 	uudecode ${.CURDIR}/fat-${MACHINE}.tmpl.bz2.uu
 	mv fat-${MACHINE}.tmpl.bz2 ${.TARGET}.bz2
 	bzip2 -f -d ${.TARGET}.bz2
-	dd if=boot1.efi of=${.TARGET} seek=${BOOT1_OFFSET} conv=notrunc \
-	    status=none
+	${DD} if=boot1.efi of=${.TARGET} seek=${BOOT1_OFFSET} conv=notrunc
 
 CLEANFILES= boot1.efi boot1.efifat
 

Modified: head/sys/boot/i386/boot2/Makefile
==============================================================================
--- head/sys/boot/i386/boot2/Makefile	Fri Dec  2 14:23:26 2016	(r309411)
+++ head/sys/boot/i386/boot2/Makefile	Fri Dec  2 14:44:38 2016	(r309412)
@@ -72,14 +72,14 @@ CLEANFILES+=	boot2 boot2.ld boot2.ldr bo
 boot2: boot2.ld
 	@set -- `ls -l boot2.ld`; x=$$((7680-$$5)); \
 	    echo "$$x bytes available"; test $$x -ge 0
-	dd if=boot2.ld of=${.TARGET} obs=7680 conv=osync status=none
+	${DD} if=boot2.ld of=${.TARGET} obs=7680 conv=osync
 
 boot2.ld: boot2.ldr boot2.bin ${BTXKERN}
 	btxld -v -E ${ORG2} -f bin -b ${BTXKERN} -l boot2.ldr \
 	    -o ${.TARGET} -P 1 boot2.bin
 
 boot2.ldr:
-	dd if=/dev/zero of=${.TARGET} bs=512 count=1 status=none
+	${DD} if=/dev/zero of=${.TARGET} bs=512 count=1
 
 boot2.bin: boot2.out
 	${OBJCOPY} -S -O binary boot2.out ${.TARGET}

Modified: head/sys/boot/i386/pxeldr/Makefile
==============================================================================
--- head/sys/boot/i386/pxeldr/Makefile	Fri Dec  2 14:23:26 2016	(r309411)
+++ head/sys/boot/i386/pxeldr/Makefile	Fri Dec  2 14:44:38 2016	(r309412)
@@ -31,7 +31,7 @@ CLEANFILES+= ${BOOT}.tmp
 
 ${BOOT}: ${LDR} ${LOADER}
 	cat ${LDR} ${LOADER} > ${.TARGET}.tmp
-	dd if=${.TARGET}.tmp of=${.TARGET} obs=2k conv=osync status=none
+	${DD} if=${.TARGET}.tmp of=${.TARGET} obs=2k conv=osync
 	rm ${.TARGET}.tmp
 
 LDFLAGS+=${LDFLAGS_BIN}

Modified: head/sys/boot/i386/zfsboot/Makefile
==============================================================================
--- head/sys/boot/i386/zfsboot/Makefile	Fri Dec  2 14:23:26 2016	(r309411)
+++ head/sys/boot/i386/zfsboot/Makefile	Fri Dec  2 14:44:38 2016	(r309412)
@@ -70,7 +70,7 @@ BOOT2SIZE=	131072
 zfsboot2: zfsboot.ld
 	@set -- `ls -l zfsboot.ld`; x=$$((${BOOT2SIZE}-$$5)); \
 	    echo "$$x bytes available"; test $$x -ge 0
-	dd if=zfsboot.ld of=${.TARGET} obs=${BOOT2SIZE} conv=osync status=none
+	${DD} if=zfsboot.ld of=${.TARGET} obs=${BOOT2SIZE} conv=osync
 
 zfsboot.ld: zfsboot.ldr zfsboot.bin ${BTXKERN}
 	btxld -v -E ${ORG2} -f bin -b ${BTXKERN} -l zfsboot.ldr \

Modified: head/sys/boot/pc98/boot0.5/Makefile
==============================================================================
--- head/sys/boot/pc98/boot0.5/Makefile	Fri Dec  2 14:23:26 2016	(r309411)
+++ head/sys/boot/pc98/boot0.5/Makefile	Fri Dec  2 14:44:38 2016	(r309412)
@@ -18,7 +18,7 @@ LDFLAGS=-e start -Ttext ${BOOT_BOOT0_ORG
 
 # The size of boot0.5 must be 7168 bytes
 ${BOOT}: ${BOOT}.bin
-	cat ${BOOT}.bin /dev/zero | dd of=${BOOT} bs=1 count=7168
+	cat ${BOOT}.bin /dev/zero | ${DD} of=${BOOT} bs=1 count=7168
 
 ${BOOT}.bin: ${BOOT}.out
 	${OBJCOPY} -S -O binary ${BOOT}.out ${.TARGET}

Modified: head/sys/boot/pc98/boot2/Makefile
==============================================================================
--- head/sys/boot/pc98/boot2/Makefile	Fri Dec  2 14:23:26 2016	(r309411)
+++ head/sys/boot/pc98/boot2/Makefile	Fri Dec  2 14:44:38 2016	(r309412)
@@ -78,14 +78,14 @@ CLEANFILES+=	boot2 boot2.ld boot2.ldr bo
 boot2: boot2.ld
 	@set -- `ls -l boot2.ld`; x=$$((7680-$$5)); \
 	    echo "$$x bytes available"; test $$x -ge 0
-	dd if=boot2.ld of=${.TARGET} obs=7680 conv=osync
+	${DD} if=boot2.ld of=${.TARGET} obs=7680 conv=osync
 
 boot2.ld: boot2.ldr boot2.bin ${BTXKERN}
 	btxld -v -E ${ORG2} -f bin -b ${BTXKERN} -l boot2.ldr \
 	    -o ${.TARGET} -P 1 boot2.bin
 
 boot2.ldr:
-	dd if=/dev/zero of=${.TARGET} bs=276 count=1
+	${DD} if=/dev/zero of=${.TARGET} bs=276 count=1
 
 boot2.bin: boot2.out
 	${OBJCOPY} -S -O binary boot2.out ${.TARGET}

Modified: head/sys/boot/pc98/pc98boot/Makefile
==============================================================================
--- head/sys/boot/pc98/pc98boot/Makefile	Fri Dec  2 14:23:26 2016	(r309411)
+++ head/sys/boot/pc98/pc98boot/Makefile	Fri Dec  2 14:44:38 2016	(r309412)
@@ -20,6 +20,6 @@ ${BOOT}: ${BOOT0} ${BOOT05} ${BOOT}.part
 	cat ${BOOT0} ${BOOT}.part ${BOOT05} > ${.TARGET}
 
 ${BOOT}.part:
-	dd if=/dev/zero of=${.TARGET} bs=512 count=1
+	${DD} if=/dev/zero of=${.TARGET} bs=512 count=1
 
 .include <bsd.prog.mk>

Modified: head/sys/boot/powerpc/boot1.chrp/Makefile
==============================================================================
--- head/sys/boot/powerpc/boot1.chrp/Makefile	Fri Dec  2 14:23:26 2016	(r309411)
+++ head/sys/boot/powerpc/boot1.chrp/Makefile	Fri Dec  2 14:44:38 2016	(r309412)
@@ -30,8 +30,8 @@ boot1.hfs: boot1.elf bootinfo.txt
 	uudecode ${.CURDIR}/hfs.tmpl.bz2.uu
 	mv hfs.tmpl.bz2 ${.TARGET}.bz2
 	bzip2 -f -d ${.TARGET}.bz2
-	dd if=boot1.elf of=${.TARGET} seek=${BOOT1_OFFSET} conv=notrunc
-	dd if=${.CURDIR}/bootinfo.txt of=${.TARGET} seek=${BOOTINFO_OFFSET} \
+	${DD} if=boot1.elf of=${.TARGET} seek=${BOOT1_OFFSET} conv=notrunc
+	${DD} if=${.CURDIR}/bootinfo.txt of=${.TARGET} seek=${BOOTINFO_OFFSET} \
 	    conv=notrunc
 
 CLEANFILES= boot1.hfs

Modified: head/sys/boot/sparc64/boot1/Makefile
==============================================================================
--- head/sys/boot/sparc64/boot1/Makefile	Fri Dec  2 14:23:26 2016	(r309411)
+++ head/sys/boot/sparc64/boot1/Makefile	Fri Dec  2 14:44:38 2016	(r309412)
@@ -19,8 +19,8 @@ LDFLAGS=-Ttext ${BOOTBLOCKBASE} -Wl,-N
 ${FILES}: boot1.aout
 	@set -- `ls -l boot1.aout`; x=$$((7680-$$5)); \
 	    echo "$$x bytes available"; test $$x -ge 0
-	dd if=/dev/zero of=${.TARGET} bs=512 count=16
-	dd if=boot1.aout of=${.TARGET} bs=512 oseek=1 conv=notrunc
+	${DD} if=/dev/zero of=${.TARGET} bs=512 count=16
+	${DD} if=boot1.aout of=${.TARGET} bs=512 oseek=1 conv=notrunc
 
 boot1.aout: boot1.elf
 	elf2aout -o ${.TARGET} ${.ALLSRC}


More information about the svn-src-all mailing list