mirror of
https://github.com/opnsense/src.git
synced 2026-06-09 08:43:19 -04:00
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
This commit is contained in:
parent
e5daf958c1
commit
c20d3baeb0
4 changed files with 8 additions and 8 deletions
|
|
@ -114,7 +114,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 ;\
|
||||
|
|
@ -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
|
||||
|
||||
|
|
|
|||
|
|
@ -67,9 +67,9 @@ CLEANFILES+= boot2 boot2.ld boot2.ldr boot2.bin boot2.out boot2.o \
|
|||
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 \
|
||||
|
|
|
|||
|
|
@ -68,9 +68,9 @@ CLEANFILES+= zfsboot2 zfsboot.ld zfsboot.ldr zfsboot.bin zfsboot.out \
|
|||
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 \
|
||||
|
|
|
|||
|
|
@ -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}
|
||||
|
|
|
|||
Loading…
Reference in a new issue