1999-08-28 01:08:13 +00:00
|
|
|
# $FreeBSD$
|
1998-10-14 00:24:16 +00:00
|
|
|
|
2007-10-24 21:33:00 +00:00
|
|
|
.PATH: ${.CURDIR}/../boot2
|
1998-10-12 21:16:26 +00:00
|
|
|
|
2007-10-24 21:33:00 +00:00
|
|
|
FILES= gptboot
|
2001-07-31 19:50:09 +00:00
|
|
|
|
2007-10-24 21:33:00 +00:00
|
|
|
NM?= nm
|
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
|
2007-10-24 21:33:00 +00:00
|
|
|
ORG2= 0x0
|
1998-10-12 21:16:26 +00:00
|
|
|
|
2004-02-06 21:58:32 +00:00
|
|
|
# Decide level of UFS support.
|
2007-10-24 21:33:00 +00:00
|
|
|
GPTBOOT_UFS?= UFS1_AND_UFS2
|
|
|
|
#GPTBOOT_UFS?= UFS2_ONLY
|
|
|
|
#GPTBOOT_UFS?= UFS1_ONLY
|
2004-02-06 21:58:32 +00:00
|
|
|
|
2004-02-07 14:32:06 +00:00
|
|
|
CFLAGS= -Os \
|
2004-07-30 04:27:20 +00:00
|
|
|
-fno-guess-branch-probability \
|
|
|
|
-fomit-frame-pointer \
|
|
|
|
-fno-unit-at-a-time \
|
2002-12-21 02:03:31 +00:00
|
|
|
-mno-align-long-strings \
|
2002-05-10 04:05:42 +00:00
|
|
|
-mrtd \
|
2005-07-15 12:22:14 +00:00
|
|
|
-mno-mmx -mno-3dnow -mno-sse -mno-sse2 -mno-sse3 \
|
2007-10-24 21:33:00 +00:00
|
|
|
-D${GPTBOOT_UFS} \
|
2004-02-17 07:13:04 +00:00
|
|
|
-DSIOPRT=${BOOT_COMCONSOLE_PORT} \
|
|
|
|
-DSIOFMT=${B2SIOFMT} \
|
|
|
|
-DSIOSPD=${BOOT_COMCONSOLE_SPEED} \
|
2002-06-05 11:10:38 +00:00
|
|
|
-I${.CURDIR}/../../common \
|
2007-10-24 21:33:00 +00:00
|
|
|
-I${.CURDIR}/../btx/lib \
|
|
|
|
-I${.CURDIR}/../boot2 \
|
1998-10-12 21:16:26 +00:00
|
|
|
-Wall -Waggregate-return -Wbad-function-cast -Wcast-align \
|
|
|
|
-Wmissing-declarations -Wmissing-prototypes -Wnested-externs \
|
2007-05-19 05:07:47 +00:00
|
|
|
-Wpointer-arith -Wshadow -Wstrict-prototypes -Wwrite-strings \
|
|
|
|
-Winline --param max-inline-insns-single=100
|
1998-10-12 21:16:26 +00:00
|
|
|
|
2004-02-09 14:11:58 +00:00
|
|
|
LDFLAGS=-static -N --gc-sections
|
1998-10-12 21:16:26 +00:00
|
|
|
|
2004-02-06 21:58:32 +00:00
|
|
|
# Pick up ../Makefile.inc early.
|
|
|
|
.include <bsd.init.mk>
|
|
|
|
|
2007-10-24 21:33:00 +00:00
|
|
|
CLEANFILES= gptboot
|
2004-02-06 21:58:32 +00:00
|
|
|
|
2007-10-24 21:33:00 +00:00
|
|
|
gptboot: gptldr.bin gptboot.bin ${BTXKERN}
|
|
|
|
btxld -v -E ${ORG2} -f bin -b ${BTXKERN} -l gptldr.bin \
|
|
|
|
-o ${.TARGET} gptboot.bin
|
1998-10-12 21:16:26 +00:00
|
|
|
|
2007-10-24 21:33:00 +00:00
|
|
|
CLEANFILES+= gptldr.bin gptldr.out gptldr.o
|
1998-10-12 21:16:26 +00:00
|
|
|
|
2007-10-24 21:33:00 +00:00
|
|
|
gptldr.bin: gptldr.out
|
|
|
|
objcopy -S -O binary gptldr.out ${.TARGET}
|
2002-05-11 21:39:59 +00:00
|
|
|
|
2007-10-24 21:33:00 +00:00
|
|
|
gptldr.out: gptldr.o
|
|
|
|
${LD} ${LDFLAGS} -e start -Ttext ${ORG1} -o ${.TARGET} gptldr.o
|
2004-02-06 21:58:32 +00:00
|
|
|
|
2007-10-24 21:33:00 +00:00
|
|
|
CLEANFILES+= gptboot.bin gptboot.out gptboot.o sio.o
|
1998-10-12 21:16:26 +00:00
|
|
|
|
2007-10-24 21:33:00 +00:00
|
|
|
gptboot.bin: gptboot.out
|
|
|
|
objcopy -S -O binary gptboot.out ${.TARGET}
|
1998-10-12 21:16:26 +00:00
|
|
|
|
2007-10-24 21:33:00 +00:00
|
|
|
gptboot.out: ${BTXCRT} gptboot.o sio.o
|
2004-02-06 21:58:32 +00:00
|
|
|
${LD} ${LDFLAGS} -Ttext ${ORG2} -o ${.TARGET} ${.ALLSRC}
|
2001-07-31 19:50:09 +00:00
|
|
|
|
2007-10-24 21:33:00 +00:00
|
|
|
gptboot.o: ${.CURDIR}/../../common/ufsread.c
|
2003-06-26 03:51:57 +00:00
|
|
|
|
2004-02-07 08:10:07 +00:00
|
|
|
.if ${MACHINE_ARCH} == "amd64"
|
2007-10-24 21:33:00 +00:00
|
|
|
beforedepend gptboot.o: machine
|
2004-02-07 08:10:07 +00:00
|
|
|
CLEANFILES+= machine
|
2003-06-26 03:51:57 +00:00
|
|
|
machine:
|
|
|
|
ln -sf ${.CURDIR}/../../../i386/include machine
|
|
|
|
.endif
|
|
|
|
|
2004-02-06 21:58:32 +00:00
|
|
|
.include <bsd.prog.mk>
|