1999-08-28 01:08:13 +00:00
|
|
|
# $FreeBSD$
|
1998-10-14 00:24:16 +00:00
|
|
|
|
2010-09-24 19:49:12 +00:00
|
|
|
.PATH: ${.CURDIR}/../boot2 ${.CURDIR}/../common ${.CURDIR}/../../common
|
1998-10-12 21:16:26 +00:00
|
|
|
|
2007-10-24 21:33:00 +00:00
|
|
|
FILES= gptboot
|
2013-07-01 22:38:36 +00:00
|
|
|
MAN= gptboot.8
|
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
|
|
|
|
2010-09-24 19:49:12 +00:00
|
|
|
CFLAGS= -DBOOTPROG=\"gptboot\" \
|
2011-09-13 14:03:55 +00:00
|
|
|
-O1 \
|
2010-09-24 19:49:12 +00:00
|
|
|
-DGPT \
|
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 \
|
2010-09-24 19:49:12 +00:00
|
|
|
-I${.CURDIR}/../common \
|
2007-10-26 15:56:22 +00:00
|
|
|
-I${.CURDIR}/../btx/lib -I. \
|
2007-10-24 21:33:00 +00:00
|
|
|
-I${.CURDIR}/../boot2 \
|
2010-10-08 10:27:52 +00:00
|
|
|
-I${.CURDIR}/../../.. \
|
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 \
|
2014-01-05 21:03:49 +00:00
|
|
|
-Winline
|
|
|
|
|
|
|
|
CFLAGS.gcc+= --param max-inline-insns-single=100
|
1998-10-12 21:16:26 +00:00
|
|
|
|
2013-12-30 19:05:50 +00:00
|
|
|
LD_FLAGS=-static -N --gc-sections
|
1998-10-12 21:16:26 +00:00
|
|
|
|
2014-02-06 21:54:21 +00:00
|
|
|
LIBSTAND= ${.OBJDIR}/../../libstand32/libstand.a
|
|
|
|
|
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
|
2015-04-02 06:58:17 +00:00
|
|
|
${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
|
2013-12-30 19:05:50 +00:00
|
|
|
${LD} ${LD_FLAGS} -e start -Ttext ${ORG1} -o ${.TARGET} gptldr.o
|
2004-02-06 21:58:32 +00:00
|
|
|
|
2011-03-11 13:11:15 +00:00
|
|
|
CLEANFILES+= gptboot.bin gptboot.out gptboot.o sio.o gpt.o crc32.o drv.o \
|
|
|
|
cons.o util.o
|
1998-10-12 21:16:26 +00:00
|
|
|
|
2007-10-24 21:33:00 +00:00
|
|
|
gptboot.bin: gptboot.out
|
2015-04-02 06:58:17 +00:00
|
|
|
${OBJCOPY} -S -O binary gptboot.out ${.TARGET}
|
1998-10-12 21:16:26 +00:00
|
|
|
|
2010-09-24 19:49:12 +00:00
|
|
|
gptboot.out: ${BTXCRT} gptboot.o sio.o gpt.o crc32.o drv.o cons.o util.o
|
2013-12-30 19:05:50 +00:00
|
|
|
${LD} ${LD_FLAGS} -Ttext ${ORG2} -o ${.TARGET} ${.ALLSRC} ${LIBSTAND}
|
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
|
|
|
|
2010-08-23 01:42:09 +00:00
|
|
|
.if ${MACHINE_CPUARCH} == "amd64"
|
2007-10-24 21:33:00 +00:00
|
|
|
beforedepend gptboot.o: machine
|
2004-02-07 08:10:07 +00:00
|
|
|
CLEANFILES+= machine
|
2016-03-11 23:45:51 +00:00
|
|
|
machine: .NOMETA
|
2003-06-26 03:51:57 +00:00
|
|
|
ln -sf ${.CURDIR}/../../../i386/include machine
|
|
|
|
.endif
|
|
|
|
|
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.gptldr.S= ${CLANG_NO_IAS}
|
|
|
|
CFLAGS+= ${CFLAGS.${.IMPSRC:T}}
|