svn commit: r316109 - in head/sys/boot: efi/boot1 i386/boot2 i386/zfsboot sparc64/boot1

Ngie Cooper ngie at FreeBSD.org
Tue Mar 28 21:35:20 UTC 2017


Author: ngie
Date: Tue Mar 28 21:35:18 2017
New Revision: 316109
URL: https://svnweb.freebsd.org/changeset/base/316109

Log:
  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).
  
  MFC after:	3 days
  Sponsored by:	Dell EMC Isilon

Modified:
  head/sys/boot/efi/boot1/Makefile
  head/sys/boot/i386/boot2/Makefile
  head/sys/boot/i386/zfsboot/Makefile
  head/sys/boot/sparc64/boot1/Makefile

Modified: head/sys/boot/efi/boot1/Makefile
==============================================================================
--- head/sys/boot/efi/boot1/Makefile	Tue Mar 28 21:16:11 2017	(r316108)
+++ head/sys/boot/efi/boot1/Makefile	Tue Mar 28 21:35:18 2017	(r316109)
@@ -114,7 +114,7 @@ boot1.o: ${.CURDIR}/../../common/ufsread
 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 ;\
@@ -124,7 +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
+	${DD} if=${.ALLSRC} 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	Tue Mar 28 21:16:11 2017	(r316108)
+++ head/sys/boot/i386/boot2/Makefile	Tue Mar 28 21:35:18 2017	(r316109)
@@ -67,9 +67,9 @@ CLEANFILES+=	boot2 boot2.ld boot2.ldr bo
 		boot2.h sio.o
 
 boot2: boot2.ld
-	@set -- `ls -l boot2.ld`; x=$$((7680-$$5)); \
+	@set -- `ls -l ${.ALLSRC}`; x=$$((7680-$$5)); \
 	    echo "$$x bytes available"; test $$x -ge 0
-	${DD} if=boot2.ld of=${.TARGET} obs=7680 conv=osync
+	${DD} if=${.ALLSRC} of=${.TARGET} obs=7680 conv=osync
 
 boot2.ld: boot2.ldr boot2.bin ${BTXKERN}
 	btxld -v -E ${ORG2} -f bin -b ${BTXKERN} -l boot2.ldr \

Modified: head/sys/boot/i386/zfsboot/Makefile
==============================================================================
--- head/sys/boot/i386/zfsboot/Makefile	Tue Mar 28 21:16:11 2017	(r316108)
+++ head/sys/boot/i386/zfsboot/Makefile	Tue Mar 28 21:35:18 2017	(r316109)
@@ -68,9 +68,9 @@ CLEANFILES+=	zfsboot2 zfsboot.ld zfsboot
 BOOT2SIZE=	131072
 
 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
+	${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 \

Modified: head/sys/boot/sparc64/boot1/Makefile
==============================================================================
--- head/sys/boot/sparc64/boot1/Makefile	Tue Mar 28 21:16:11 2017	(r316108)
+++ head/sys/boot/sparc64/boot1/Makefile	Tue Mar 28 21:35:18 2017	(r316109)
@@ -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=${.ALLSRC} of=${.TARGET} bs=512 oseek=1 conv=notrunc
 
 boot1.aout: boot1.elf
 	elf2aout -o ${.TARGET} ${.ALLSRC}


More information about the svn-src-head mailing list