xref: /freebsd/stand/i386/gptzfsboot/Makefile (revision 6fa42b91ca3f481912af98c4d49c44507eb1b8e1)
1.include <bsd.init.mk>
2
3.PATH:		${BOOTSRC}/i386/boot2 ${BOOTSRC}/i386/gptboot \
4		${BOOTSRC}/i386/zfsboot ${BOOTSRC}/i386/common \
5		${BOOTSRC}/common
6
7FILES=		gptzfsboot
8MAN=		gptzfsboot.8
9
10BOOT_COMCONSOLE_PORT?= 0x3f8
11BOOT_COMCONSOLE_SPEED?= 115200
12B2SIOFMT?=	0x3
13
14REL1=	0x700
15ORG1=	0x7c00
16ORG2=	0x0
17
18CFLAGS+=-DBOOTPROG=\"gptzfsboot\" \
19	-O1 \
20	-DBOOT2 \
21	-DLOADER_GPT_SUPPORT \
22	-DLOADER_MBR_SUPPORT \
23	-DLOADER_ZFS_SUPPORT \
24	-DSIOPRT=${BOOT_COMCONSOLE_PORT} \
25	-DSIOFMT=${B2SIOFMT} \
26	-DSIOSPD=${BOOT_COMCONSOLE_SPEED} \
27	-I${LDRSRC} \
28	-I${BOOTSRC}/i386/common \
29	-I${BOOTSRC}/i386/libi386 \
30	-I${ZFSSRC} \
31	-I${SYSDIR}/crypto/skein \
32	-I${SYSDIR}/cddl/boot/zfs \
33	-I${SYSDIR}/contrib/openzfs/include \
34	-I${SYSDIR}/contrib/openzfs/include/os/freebsd/spl \
35	-I${SYSDIR}/contrib/openzfs/include/os/freebsd/zfs \
36	-I${SYSDIR}/cddl/contrib/opensolaris/common/lz4 \
37	-I${BOOTSRC}/i386/btx/lib \
38	-I${BOOTSRC}/i386/boot2 \
39	-DHAVE_MEMCPY -I${SRCTOP}/sys/contrib/zlib \
40	-Wall -Waggregate-return -Wbad-function-cast \
41	-Wmissing-declarations -Wmissing-prototypes -Wnested-externs \
42	-Wpointer-arith -Wshadow -Wstrict-prototypes -Wwrite-strings \
43	-Wno-pointer-sign
44
45CFLAGS.clang+=	-Wno-tentative-definition-incomplete-type
46
47NO_WCAST_ALIGN=
48
49CFLAGS.gcc+=	--param max-inline-insns-single=100
50
51LD_FLAGS+=${LD_FLAGS_BIN}
52
53CLEANFILES+=	gptzfsboot
54
55gptzfsboot: gptldr.bin gptzfsboot.bin ${BTXKERN}
56	btxld -v -E ${ORG2} -f bin -b ${BTXKERN} -l gptldr.bin \
57	    -o ${.TARGET} gptzfsboot.bin
58
59CLEANFILES+=	gptldr.bin gptldr.out gptldr.o
60
61gptldr.bin: gptldr.out
62	${OBJCOPY} -S -O binary gptldr.out ${.TARGET}
63
64gptldr.out: gptldr.o
65	${LD} ${LD_FLAGS} -e start --defsym ORG=${ORG1} -T ${LDSCRIPT} -o ${.TARGET} gptldr.o
66
67OBJS=	zfsboot.o sio.o cons.o bcache.o devopen.o disk.o part.o zfs_cmd.o misc.o
68CLEANFILES+=	gptzfsboot.bin gptzfsboot.out ${OBJS} ${OPENCRYPTO_XTS}
69
70# i386 standalone support library
71LIBI386=	${BOOTOBJ}/i386/libi386/libi386.a
72
73gptzfsboot.bin: gptzfsboot.out
74	${OBJCOPY} -S -O binary gptzfsboot.out ${.TARGET}
75
76gptzfsboot.out: ${BTXCRT} ${OBJS} \
77	${OPENCRYPTO_XTS}
78	${LD} ${LD_FLAGS} --defsym ORG=${ORG2} -T ${LDSCRIPT} -o ${.TARGET} ${.ALLSRC} ${LIBI386} ${LIBSA32}
79
80zfsboot.o: ${ZFSSRC}/zfsimpl.c
81
82.include <bsd.prog.mk>
83