1999-08-28 01:08:13 +00:00
|
|
|
# $FreeBSD$
|
1998-10-14 00:24:16 +00:00
|
|
|
|
2017-10-30 23:14:37 +00:00
|
|
|
.include <bsd.init.mk>
|
2010-08-21 15:01:59 +00:00
|
|
|
|
2004-02-06 21:58:32 +00:00
|
|
|
FILES= boot boot1 boot2
|
1998-10-12 21:16:26 +00:00
|
|
|
|
2001-07-31 19:50:09 +00:00
|
|
|
NM?= nm
|
|
|
|
|
1999-07-20 01:19:23 +00:00
|
|
|
# A value of 0x80 enables LBA support.
|
2004-08-27 15:01:56 +00:00
|
|
|
BOOT_BOOT1_FLAGS?= 0x80
|
1999-07-20 01:19:23 +00:00
|
|
|
|
1999-01-10 14:48:05 +00:00
|
|
|
BOOT_COMCONSOLE_PORT?= 0x3f8
|
|
|
|
BOOT_COMCONSOLE_SPEED?= 9600
|
1998-10-20 20:20:48 +00:00
|
|
|
B2SIOFMT?= 0x3
|
|
|
|
|
2002-10-08 12:09:16 +00:00
|
|
|
REL1= 0x700
|
1998-10-12 21:16:26 +00:00
|
|
|
ORG1= 0x7c00
|
2002-10-08 18:19:02 +00:00
|
|
|
ORG2= 0x2000
|
1998-10-12 21:16:26 +00:00
|
|
|
|
2004-02-06 21:58:32 +00:00
|
|
|
# Decide level of UFS support.
|
2002-12-17 21:10:34 +00:00
|
|
|
BOOT2_UFS?= UFS1_AND_UFS2
|
2004-02-06 21:58:32 +00:00
|
|
|
#BOOT2_UFS?= UFS2_ONLY
|
|
|
|
#BOOT2_UFS?= UFS1_ONLY
|
|
|
|
|
2017-10-30 23:14:37 +00:00
|
|
|
CFLAGS+=-fomit-frame-pointer \
|
2002-05-10 04:05:42 +00:00
|
|
|
-mrtd \
|
2011-04-04 18:23:55 +00:00
|
|
|
-mregparm=3 \
|
2002-12-14 19:44:13 +00:00
|
|
|
-D${BOOT2_UFS} \
|
2004-08-27 15:01:56 +00:00
|
|
|
-DFLAGS=${BOOT_BOOT1_FLAGS} \
|
2004-02-17 07:13:04 +00:00
|
|
|
-DSIOPRT=${BOOT_COMCONSOLE_PORT} \
|
|
|
|
-DSIOFMT=${B2SIOFMT} \
|
|
|
|
-DSIOSPD=${BOOT_COMCONSOLE_SPEED} \
|
2017-10-30 23:14:37 +00:00
|
|
|
-I${LDRSRC} \
|
Add SHA512, skein, large blocks support for loader zfs.
Updated sha512 from illumos.
Using skein from freebsd crypto tree.
Since loader itself is using 64MB memory for heap, updated zfsboot to
use same, and this also allows to support zfs large blocks.
Note, adding additional features does increate zfsboot code, therefore
this update does increase zfsboot code to 128k, also I have ported gptldr.S
update to zfsldr.S to support 64k+ code.
With this update, boot1.efi has almost reached the current limit of the size
set for it, so one of the future patches for boot1.efi will need to
increase the limit.
Currently known missing zfs features in boot loader are edonr and gzip support.
Reviewed by: delphij, imp
Approved by: imp (mentor)
Obtained from: sha256.c update and skein_zfs.c stub from illumos.
Differential Revision: https://reviews.freebsd.org/D7418
2016-08-18 00:37:07 +00:00
|
|
|
-Wall -Waggregate-return -Wbad-function-cast -Wno-cast-align \
|
1998-10-12 21:16:26 +00:00
|
|
|
-Wmissing-declarations -Wmissing-prototypes -Wnested-externs \
|
2007-05-19 05:07:47 +00:00
|
|
|
-Wpointer-arith -Wshadow -Wstrict-prototypes -Wwrite-strings \
|
2014-09-28 12:12:54 +00:00
|
|
|
-Winline
|
2011-05-02 21:13:08 +00:00
|
|
|
|
2014-11-24 20:01:05 +00:00
|
|
|
CFLAGS.gcc+= -Os \
|
2017-08-09 20:13:49 +00:00
|
|
|
-fno-asynchronous-unwind-tables \
|
2014-01-05 21:03:49 +00:00
|
|
|
--param max-inline-insns-single=100
|
2015-03-04 20:33:15 +00:00
|
|
|
.if ${COMPILER_TYPE} == "gcc" && ${COMPILER_VERSION} <= 40201
|
|
|
|
CFLAGS.gcc+= -mno-align-long-strings
|
|
|
|
.endif
|
2013-12-26 11:32:39 +00:00
|
|
|
|
2014-11-24 20:01:05 +00:00
|
|
|
CFLAGS.clang+= -Oz ${CLANG_OPT_SMALL}
|
2014-05-05 22:03:01 +00:00
|
|
|
|
2017-10-30 23:14:37 +00:00
|
|
|
LD_FLAGS+=${LD_FLAGS_BIN}
|
2004-02-06 21:58:32 +00:00
|
|
|
|
2017-11-10 23:54:58 +00:00
|
|
|
CLEANFILES+= boot
|
2003-01-26 13:33:57 +00:00
|
|
|
|
|
|
|
boot: boot1 boot2
|
|
|
|
cat boot1 boot2 > boot
|
1998-10-12 21:16:26 +00:00
|
|
|
|
2004-02-06 21:58:32 +00:00
|
|
|
CLEANFILES+= boot1 boot1.out boot1.o
|
|
|
|
|
1998-10-12 21:16:26 +00:00
|
|
|
boot1: boot1.out
|
2015-04-02 06:58:17 +00:00
|
|
|
${OBJCOPY} -S -O binary boot1.out ${.TARGET}
|
1998-10-12 21:16:26 +00:00
|
|
|
|
|
|
|
boot1.out: boot1.o
|
2013-12-30 19:05:50 +00:00
|
|
|
${LD} ${LD_FLAGS} -e start -Ttext ${ORG1} -o ${.TARGET} boot1.o
|
1998-10-12 21:16:26 +00:00
|
|
|
|
2004-02-06 21:58:32 +00:00
|
|
|
CLEANFILES+= boot2 boot2.ld boot2.ldr boot2.bin boot2.out boot2.o \
|
2017-03-28 07:58:27 +00:00
|
|
|
boot2.h sio.o
|
2002-05-11 21:39:59 +00:00
|
|
|
|
2017-03-29 09:30:03 +00:00
|
|
|
BOOT2SIZE= 7680
|
|
|
|
|
2004-02-06 21:58:32 +00:00
|
|
|
boot2: boot2.ld
|
2017-03-29 09:30:03 +00:00
|
|
|
@set -- `ls -l ${.ALLSRC}`; x=$$((${BOOT2SIZE}-$$5)); \
|
2004-02-06 21:58:32 +00:00
|
|
|
echo "$$x bytes available"; test $$x -ge 0
|
2017-03-29 09:30:03 +00:00
|
|
|
${DD} if=${.ALLSRC} of=${.TARGET} obs=${BOOT2SIZE} conv=osync
|
2004-02-06 21:58:32 +00:00
|
|
|
|
|
|
|
boot2.ld: boot2.ldr boot2.bin ${BTXKERN}
|
|
|
|
btxld -v -E ${ORG2} -f bin -b ${BTXKERN} -l boot2.ldr \
|
|
|
|
-o ${.TARGET} -P 1 boot2.bin
|
1998-10-12 21:16:26 +00:00
|
|
|
|
|
|
|
boot2.ldr:
|
2016-12-02 14:44:38 +00:00
|
|
|
${DD} if=/dev/zero of=${.TARGET} bs=512 count=1
|
1998-10-12 21:16:26 +00:00
|
|
|
|
|
|
|
boot2.bin: boot2.out
|
2015-04-02 06:58:17 +00:00
|
|
|
${OBJCOPY} -S -O binary boot2.out ${.TARGET}
|
1998-10-12 21:16:26 +00:00
|
|
|
|
2004-02-06 21:58:32 +00:00
|
|
|
boot2.out: ${BTXCRT} boot2.o sio.o
|
2013-12-30 19:05:50 +00:00
|
|
|
${LD} ${LD_FLAGS} -Ttext ${ORG2} -o ${.TARGET} ${.ALLSRC}
|
2001-07-31 19:50:09 +00:00
|
|
|
|
2004-02-07 13:38:47 +00:00
|
|
|
SRCS= boot2.c boot2.h
|
|
|
|
|
2004-02-06 21:58:32 +00:00
|
|
|
boot2.h: boot1.out
|
|
|
|
${NM} -t d ${.ALLSRC} | awk '/([0-9])+ T xread/ \
|
|
|
|
{ x = $$1 - ORG1; \
|
|
|
|
printf("#define XREADORG %#x\n", REL1 + x) }' \
|
|
|
|
ORG1=`printf "%d" ${ORG1}` \
|
|
|
|
REL1=`printf "%d" ${REL1}` > ${.TARGET}
|
2003-06-26 03:51:57 +00:00
|
|
|
|
2004-02-06 21:58:32 +00:00
|
|
|
.include <bsd.prog.mk>
|
2012-02-28 18:30:18 +00:00
|
|
|
|
|
|
|
# XXX: clang integrated-as doesn't grok .codeNN directives yet
|
|
|
|
CFLAGS.boot1.S= ${CLANG_NO_IAS}
|