xref: /freebsd/stand/i386/gptzfsboot/Makefile (revision 3c857567c10f9e30c86133729532188f5c3664f0)
1.include <bsd.init.mk>
2
3.PATH:		${BOOTSRC}/i386/boot2 ${BOOTSRC}/i386/gptboot \
4		${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${SAZFSSRC} \
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		--param min-pagesize=1024
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}
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	${LD} ${LD_FLAGS} --defsym ORG=${ORG2} -T ${LDSCRIPT} -o ${.TARGET} ${.ALLSRC} ${LIBI386} ${LIBSA32}
79
80zfsboot.o: ${SAZFSSRC}/zfsimpl.c
81
82.include <bsd.prog.mk>
83