diff options
author | ngie <ngie@FreeBSD.org> | 2017-05-28 01:08:46 +0000 |
---|---|---|
committer | ngie <ngie@FreeBSD.org> | 2017-05-28 01:08:46 +0000 |
commit | f43d5da5414aa01a655c9c1a05013d49ae98940a (patch) | |
tree | a3557391e6fa2137b55f6ce5b9d26329ea3f3cd8 | |
parent | 4a550888a16640efaafa8a870de7e4994f8ba97e (diff) | |
download | FreeBSD-src-f43d5da5414aa01a655c9c1a05013d49ae98940a.zip FreeBSD-src-f43d5da5414aa01a655c9c1a05013d49ae98940a.tar.gz |
MFC r309412,r316109,r316132:
r309412 (by imp):
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.
r316109:
Don't hardcode input files for stage 1/2 bootloaders; use .ALLSRC instead
This is a better pattern to follow when creating the bootloaders and doing
the relevant space checks to make sure that the sizes aren't exceeded (and
thus, copy-pasting is a bit less error prone).
r316132:
Parameterize out 7680 (15 * 512) as BOOT2SIZE, similar to sys/boot/i386/zfsboot/...
This is being done to make it easier to change in the future--this action might be
needed sooner rather than later because of gcc 6.3.0 bailing, stating that there
is negative free space left (deficit) in the boot2 bootloader.
-rw-r--r-- | Makefile.inc1 | 6 | ||||
-rw-r--r-- | sys/boot/Makefile.inc | 7 | ||||
-rw-r--r-- | sys/boot/efi/boot1/Makefile | 5 | ||||
-rw-r--r-- | sys/boot/i386/boot2/Makefile | 8 | ||||
-rw-r--r-- | sys/boot/i386/pxeldr/Makefile | 2 | ||||
-rw-r--r-- | sys/boot/i386/zfsboot/Makefile | 4 | ||||
-rw-r--r-- | sys/boot/pc98/boot0.5/Makefile | 2 | ||||
-rw-r--r-- | sys/boot/pc98/boot2/Makefile | 4 | ||||
-rw-r--r-- | sys/boot/pc98/pc98boot/Makefile | 2 | ||||
-rw-r--r-- | sys/boot/powerpc/boot1.chrp/Makefile | 4 | ||||
-rw-r--r-- | sys/boot/sparc64/boot1/Makefile | 6 |
11 files changed, 26 insertions, 24 deletions
diff --git a/Makefile.inc1 b/Makefile.inc1 index 554c8d2..451becc 100644 --- a/Makefile.inc1 +++ b/Makefile.inc1 @@ -1632,11 +1632,6 @@ ${_bt}-usr.sbin/nmtree: ${_bt}-lib/libnetbsd _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 @@ -1719,7 +1714,6 @@ bootstrap-tools: .PHONY ${_groff} \ ${_dtc} \ ${_cat} \ - ${_dd} \ ${_kbdcontrol} \ usr.bin/lorder \ ${_libopenbsd} \ diff --git a/sys/boot/Makefile.inc b/sys/boot/Makefile.inc index 9c39953..1f1ccc2 100644 --- a/sys/boot/Makefile.inc +++ b/sys/boot/Makefile.inc @@ -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} diff --git a/sys/boot/efi/boot1/Makefile b/sys/boot/efi/boot1/Makefile index 11d604d..8ae1b76 100644 --- a/sys/boot/efi/boot1/Makefile +++ b/sys/boot/efi/boot1/Makefile @@ -107,7 +107,7 @@ boot1.o: ${.CURDIR}/../../common/ufsread.c BOOT1_MAXSIZE?= 131072 boot1.efifat: boot1.efi - @set -- `ls -l boot1.efi`; \ + @set -- `ls -l ${.ALLSRC}`; \ x=$$(($$5-${BOOT1_MAXSIZE})); \ if [ $$x -ge 0 ]; then \ echo "boot1 $$x bytes too large; regenerate FAT templates?" >&2 ;\ @@ -117,8 +117,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=${.ALLSRC} of=${.TARGET} seek=${BOOT1_OFFSET} conv=notrunc CLEANFILES= boot1.efi boot1.efifat diff --git a/sys/boot/i386/boot2/Makefile b/sys/boot/i386/boot2/Makefile index 16ed404..c524be0 100644 --- a/sys/boot/i386/boot2/Makefile +++ b/sys/boot/i386/boot2/Makefile @@ -69,17 +69,19 @@ boot1.out: boot1.o CLEANFILES+= boot2 boot2.ld boot2.ldr boot2.bin boot2.out boot2.o \ boot2.s boot2.s.tmp boot2.h sio.o +BOOT2SIZE= 7680 + boot2: boot2.ld - @set -- `ls -l boot2.ld`; x=$$((7680-$$5)); \ + @set -- `ls -l ${.ALLSRC}`; x=$$((${BOOT2SIZE}-$$5)); \ echo "$$x bytes available"; test $$x -ge 0 - dd if=boot2.ld of=${.TARGET} obs=7680 conv=osync status=none + ${DD} if=${.ALLSRC} of=${.TARGET} obs=${BOOT2SIZE} 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} diff --git a/sys/boot/i386/pxeldr/Makefile b/sys/boot/i386/pxeldr/Makefile index 8de2139..c0b7504 100644 --- a/sys/boot/i386/pxeldr/Makefile +++ b/sys/boot/i386/pxeldr/Makefile @@ -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+=-e start -Ttext ${ORG} -Wl,-N,-S,--oformat,binary diff --git a/sys/boot/i386/zfsboot/Makefile b/sys/boot/i386/zfsboot/Makefile index ee83e04..d7b6636 100644 --- a/sys/boot/i386/zfsboot/Makefile +++ b/sys/boot/i386/zfsboot/Makefile @@ -63,9 +63,9 @@ CLEANFILES+= zfsboot2 zfsboot.ld zfsboot.ldr zfsboot.bin zfsboot.out \ BOOT2SIZE= 65536 zfsboot2: zfsboot.ld - @set -- `ls -l zfsboot.ld`; x=$$((${BOOT2SIZE}-$$5)); \ + @set -- `ls -l ${.ALLSRC}`; 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=${.ALLSRC} of=${.TARGET} obs=${BOOT2SIZE} conv=osync zfsboot.ld: zfsboot.ldr zfsboot.bin ${BTXKERN} btxld -v -E ${ORG2} -f bin -b ${BTXKERN} -l zfsboot.ldr \ diff --git a/sys/boot/pc98/boot0.5/Makefile b/sys/boot/pc98/boot0.5/Makefile index 9a9d94f..ec40fe5 100644 --- a/sys/boot/pc98/boot0.5/Makefile +++ b/sys/boot/pc98/boot0.5/Makefile @@ -18,7 +18,7 @@ LDFLAGS=-e start -Ttext ${BOOT_BOOT0_ORG} -Wl,-N,-T,${.CURDIR}/ldscript # 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} diff --git a/sys/boot/pc98/boot2/Makefile b/sys/boot/pc98/boot2/Makefile index 8d5e791..2c26468 100644 --- a/sys/boot/pc98/boot2/Makefile +++ b/sys/boot/pc98/boot2/Makefile @@ -78,14 +78,14 @@ CLEANFILES+= boot2 boot2.ld boot2.ldr boot2.bin boot2.out boot2.o \ 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} diff --git a/sys/boot/pc98/pc98boot/Makefile b/sys/boot/pc98/pc98boot/Makefile index 73bfba5..f33b15f 100644 --- a/sys/boot/pc98/pc98boot/Makefile +++ b/sys/boot/pc98/pc98boot/Makefile @@ -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> diff --git a/sys/boot/powerpc/boot1.chrp/Makefile b/sys/boot/powerpc/boot1.chrp/Makefile index 381d2a8..a642f6c 100644 --- a/sys/boot/powerpc/boot1.chrp/Makefile +++ b/sys/boot/powerpc/boot1.chrp/Makefile @@ -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 diff --git a/sys/boot/sparc64/boot1/Makefile b/sys/boot/sparc64/boot1/Makefile index 5150c3b..3453b28 100644 --- a/sys/boot/sparc64/boot1/Makefile +++ b/sys/boot/sparc64/boot1/Makefile @@ -17,10 +17,10 @@ LDFLAGS=-Ttext ${BOOTBLOCKBASE} -Wl,-N # Construct boot1. sunlabel expects it to contain zeroed-out space for the # label, and to be of the correct size. ${FILES}: boot1.aout - @set -- `ls -l boot1.aout`; x=$$((7680-$$5)); \ + @set -- `ls -l ${.ALLSRC}`; 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=${.ALLSRC} of=${.TARGET} bs=512 oseek=1 conv=notrunc boot1.aout: boot1.elf elf2aout -o ${.TARGET} ${.ALLSRC} |