xref: /freebsd/stand/i386/gptzfsboot/Makefile (revision cddbc3b40812213ff00041f79174cac0be360a2a)
1# $FreeBSD$
2
3.include <bsd.init.mk>
4
5.PATH:		${BOOTSRC}/i386/boot2 ${BOOTSRC}/i386/gptboot \
6		${BOOTSRC}/i386/zfsboot ${BOOTSRC}/i386/common \
7		${SASRC}
8
9FILES=		gptzfsboot
10MAN=		gptzfsboot.8
11
12BOOT_COMCONSOLE_PORT?= 0x3f8
13BOOT_COMCONSOLE_SPEED?= 9600
14B2SIOFMT?=	0x3
15
16REL1=	0x700
17ORG1=	0x7c00
18ORG2=	0x0
19
20CFLAGS+=-DBOOTPROG=\"gptzfsboot\" \
21	-O1 \
22	-DGPT -DZFS -DBOOT2 \
23	-DSIOPRT=${BOOT_COMCONSOLE_PORT} \
24	-DSIOFMT=${B2SIOFMT} \
25	-DSIOSPD=${BOOT_COMCONSOLE_SPEED} \
26	-I${LDRSRC} \
27	-I${BOOTSRC}/i386/common \
28	-I${ZFSSRC} \
29	-I${SYSDIR}/crypto/skein \
30	-I${SYSDIR}/cddl/boot/zfs \
31	-I${BOOTSRC}/i386/btx/lib \
32	-I${BOOTSRC}/i386/boot2 \
33	-Wall -Waggregate-return -Wbad-function-cast \
34	-Wmissing-declarations -Wmissing-prototypes -Wnested-externs \
35	-Wpointer-arith -Wshadow -Wstrict-prototypes -Wwrite-strings \
36	-Wno-pointer-sign
37
38CFLAGS.clang+=	-Wno-tentative-definition-incomplete-type
39
40NO_WCAST_ALIGN=
41
42CFLAGS.gcc+=	--param max-inline-insns-single=100
43
44LD_FLAGS+=${LD_FLAGS_BIN}
45
46CLEANFILES+=	gptzfsboot
47
48gptzfsboot: gptldr.bin gptzfsboot.bin ${BTXKERN}
49	btxld -v -E ${ORG2} -f bin -b ${BTXKERN} -l gptldr.bin \
50	    -o ${.TARGET} gptzfsboot.bin
51
52CLEANFILES+=	gptldr.bin gptldr.out gptldr.o
53
54gptldr.bin: gptldr.out
55	${OBJCOPY} -S -O binary gptldr.out ${.TARGET}
56
57gptldr.out: gptldr.o
58	${LD} ${LD_FLAGS} -e start -Ttext ${ORG1} -o ${.TARGET} gptldr.o
59
60CLEANFILES+=	gptzfsboot.bin gptzfsboot.out zfsboot.o sio.o cons.o \
61		drv.o gpt.o ${OPENCRYPTO_XTS}
62
63gptzfsboot.bin: gptzfsboot.out
64	${OBJCOPY} -S -O binary gptzfsboot.out ${.TARGET}
65
66gptzfsboot.out: ${BTXCRT} zfsboot.o sio.o gpt.o drv.o cons.o \
67	${OPENCRYPTO_XTS}
68	${LD} ${LD_FLAGS} -Ttext ${ORG2} -o ${.TARGET} ${.ALLSRC} ${LIBSA32}
69
70zfsboot.o: ${ZFSSRC}/zfsimpl.c
71
72.include <bsd.prog.mk>
73
74# XXX: clang integrated-as doesn't grok .codeNN directives yet
75CFLAGS.gptldr.S=	${CLANG_NO_IAS}
76