2008-11-19 16:39:01 +00:00
|
|
|
# $FreeBSD$
|
|
|
|
|
2010-09-24 19:49:12 +00:00
|
|
|
.PATH: ${.CURDIR}/../boot2 ${.CURDIR}/../gptboot \
|
|
|
|
${.CURDIR}/../zfsboot ${.CURDIR}/../common \
|
|
|
|
${.CURDIR}/../../common
|
2008-11-19 16:39:01 +00:00
|
|
|
|
|
|
|
FILES= gptzfsboot
|
|
|
|
|
|
|
|
NM?= nm
|
|
|
|
|
|
|
|
BOOT_COMCONSOLE_PORT?= 0x3f8
|
|
|
|
BOOT_COMCONSOLE_SPEED?= 9600
|
|
|
|
B2SIOFMT?= 0x3
|
|
|
|
|
|
|
|
REL1= 0x700
|
|
|
|
ORG1= 0x7c00
|
|
|
|
ORG2= 0x0
|
|
|
|
|
2010-09-24 19:49:12 +00:00
|
|
|
CFLAGS= -DBOOTPROG=\"gptzfsboot\" \
|
|
|
|
-Os \
|
2008-11-19 16:39:01 +00:00
|
|
|
-fno-guess-branch-probability \
|
|
|
|
-fomit-frame-pointer \
|
|
|
|
-fno-unit-at-a-time \
|
|
|
|
-mno-align-long-strings \
|
|
|
|
-mrtd \
|
|
|
|
-DGPT -DBOOT2 \
|
|
|
|
-DSIOPRT=${BOOT_COMCONSOLE_PORT} \
|
|
|
|
-DSIOFMT=${B2SIOFMT} \
|
|
|
|
-DSIOSPD=${BOOT_COMCONSOLE_SPEED} \
|
|
|
|
-I${.CURDIR}/../../common \
|
2010-09-24 19:49:12 +00:00
|
|
|
-I${.CURDIR}/../common \
|
2008-11-19 16:39:01 +00:00
|
|
|
-I${.CURDIR}/../../zfs \
|
|
|
|
-I${.CURDIR}/../../../cddl/boot/zfs \
|
|
|
|
-I${.CURDIR}/../btx/lib -I. \
|
|
|
|
-I${.CURDIR}/../boot2 \
|
|
|
|
-Wall -Waggregate-return -Wbad-function-cast -Wcast-align \
|
|
|
|
-Wmissing-declarations -Wmissing-prototypes -Wnested-externs \
|
|
|
|
-Wpointer-arith -Wshadow -Wstrict-prototypes -Wwrite-strings \
|
|
|
|
-Winline --param max-inline-insns-single=100
|
|
|
|
|
2011-02-20 19:33:47 +00:00
|
|
|
.if ${CC:T:Mclang} == "clang"
|
|
|
|
# XXX: clang integrated-as doesn't grok .codeNN directives yet
|
|
|
|
CFLAGS+= ${.IMPSRC:T:Mgptldr.S:C/^.+$/-no-integrated-as/}
|
|
|
|
.endif
|
|
|
|
|
2008-11-19 16:39:01 +00:00
|
|
|
LDFLAGS=-static -N --gc-sections
|
|
|
|
|
|
|
|
# Pick up ../Makefile.inc early.
|
|
|
|
.include <bsd.init.mk>
|
|
|
|
|
|
|
|
CLEANFILES= gptzfsboot
|
|
|
|
|
|
|
|
gptzfsboot: gptldr.bin gptzfsboot.bin ${BTXKERN}
|
|
|
|
btxld -v -E ${ORG2} -f bin -b ${BTXKERN} -l gptldr.bin \
|
|
|
|
-o ${.TARGET} gptzfsboot.bin
|
|
|
|
|
|
|
|
CLEANFILES+= gptldr.bin gptldr.out gptldr.o
|
|
|
|
|
|
|
|
gptldr.bin: gptldr.out
|
|
|
|
objcopy -S -O binary gptldr.out ${.TARGET}
|
|
|
|
|
|
|
|
gptldr.out: gptldr.o
|
|
|
|
${LD} ${LDFLAGS} -e start -Ttext ${ORG1} -o ${.TARGET} gptldr.o
|
|
|
|
|
|
|
|
CLEANFILES+= gptzfsboot.bin gptzfsboot.out zfsboot.o sio.o
|
|
|
|
|
|
|
|
gptzfsboot.bin: gptzfsboot.out
|
|
|
|
objcopy -S -O binary gptzfsboot.out ${.TARGET}
|
|
|
|
|
2010-09-24 19:49:12 +00:00
|
|
|
gptzfsboot.out: ${BTXCRT} zfsboot.o sio.o gpt.o drv.o cons.o util.o
|
2008-12-17 18:12:01 +00:00
|
|
|
${LD} ${LDFLAGS} -Ttext ${ORG2} -o ${.TARGET} ${.ALLSRC} ${LIBSTAND}
|
2008-11-19 16:39:01 +00:00
|
|
|
|
|
|
|
zfsboot.o: ${.CURDIR}/../../zfs/zfsimpl.c
|
|
|
|
|
2010-08-23 01:42:09 +00:00
|
|
|
.if ${MACHINE_CPUARCH} == "amd64"
|
2008-11-22 14:24:55 +00:00
|
|
|
beforedepend zfsboot.o: machine
|
2008-11-19 16:39:01 +00:00
|
|
|
CLEANFILES+= machine
|
|
|
|
machine:
|
|
|
|
ln -sf ${.CURDIR}/../../../i386/include machine
|
|
|
|
.endif
|
|
|
|
|
|
|
|
.include <bsd.prog.mk>
|