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