xref: /freebsd/stand/i386/gptzfsboot/Makefile (revision e9ac41698b2f322d55ccf9da50a3596edb2c1800)
1ca987d46SWarner Losh.include <bsd.init.mk>
2ca987d46SWarner Losh
3ca987d46SWarner Losh.PATH:		${BOOTSRC}/i386/boot2 ${BOOTSRC}/i386/gptboot \
4ca987d46SWarner Losh		${BOOTSRC}/i386/zfsboot ${BOOTSRC}/i386/common \
53830659eSToomas Soome		${BOOTSRC}/common
6ca987d46SWarner Losh
7ca987d46SWarner LoshFILES=		gptzfsboot
8ca987d46SWarner LoshMAN=		gptzfsboot.8
9ca987d46SWarner Losh
10ca987d46SWarner LoshBOOT_COMCONSOLE_PORT?= 0x3f8
11*4722ceb7SEd MasteBOOT_COMCONSOLE_SPEED?= 115200
12ca987d46SWarner LoshB2SIOFMT?=	0x3
13ca987d46SWarner Losh
14ca987d46SWarner LoshREL1=	0x700
15ca987d46SWarner LoshORG1=	0x7c00
16ca987d46SWarner LoshORG2=	0x0
17ca987d46SWarner Losh
18ca987d46SWarner LoshCFLAGS+=-DBOOTPROG=\"gptzfsboot\" \
19ca987d46SWarner Losh	-O1 \
203830659eSToomas Soome	-DBOOT2 \
213830659eSToomas Soome	-DLOADER_GPT_SUPPORT \
223830659eSToomas Soome	-DLOADER_MBR_SUPPORT \
233830659eSToomas Soome	-DLOADER_ZFS_SUPPORT \
24ca987d46SWarner Losh	-DSIOPRT=${BOOT_COMCONSOLE_PORT} \
25ca987d46SWarner Losh	-DSIOFMT=${B2SIOFMT} \
26ca987d46SWarner Losh	-DSIOSPD=${BOOT_COMCONSOLE_SPEED} \
27ca987d46SWarner Losh	-I${LDRSRC} \
28ca987d46SWarner Losh	-I${BOOTSRC}/i386/common \
293830659eSToomas Soome	-I${BOOTSRC}/i386/libi386 \
30ca987d46SWarner Losh	-I${ZFSSRC} \
3192a2b890SWarner Losh	-I${SYSDIR}/crypto/skein \
32ca987d46SWarner Losh	-I${SYSDIR}/cddl/boot/zfs \
33e307eb94SToomas Soome	-I${SYSDIR}/contrib/openzfs/include \
34e307eb94SToomas Soome	-I${SYSDIR}/contrib/openzfs/include/os/freebsd/spl \
35e307eb94SToomas Soome	-I${SYSDIR}/contrib/openzfs/include/os/freebsd/zfs \
36e499793eSToomas Soome	-I${SYSDIR}/cddl/contrib/opensolaris/common/lz4 \
37ca987d46SWarner Losh	-I${BOOTSRC}/i386/btx/lib \
38ca987d46SWarner Losh	-I${BOOTSRC}/i386/boot2 \
3927bae615SToomas Soome	-DHAVE_MEMCPY -I${SRCTOP}/sys/contrib/zlib \
40ca987d46SWarner Losh	-Wall -Waggregate-return -Wbad-function-cast \
41ca987d46SWarner Losh	-Wmissing-declarations -Wmissing-prototypes -Wnested-externs \
42ca987d46SWarner Losh	-Wpointer-arith -Wshadow -Wstrict-prototypes -Wwrite-strings \
43073193edSDimitry Andric	-Wno-pointer-sign
44ca987d46SWarner Losh
452dbeaed4SMark JohnstonCFLAGS.clang+=	-Wno-tentative-definition-incomplete-type
46ca987d46SWarner Losh
472dbeaed4SMark JohnstonNO_WCAST_ALIGN=
48ca987d46SWarner Losh
49ca987d46SWarner LoshCFLAGS.gcc+=	--param max-inline-insns-single=100
50ca987d46SWarner Losh
51ca987d46SWarner LoshLD_FLAGS+=${LD_FLAGS_BIN}
52ca987d46SWarner Losh
53ca987d46SWarner LoshCLEANFILES+=	gptzfsboot
54ca987d46SWarner Losh
55ca987d46SWarner Loshgptzfsboot: gptldr.bin gptzfsboot.bin ${BTXKERN}
56ca987d46SWarner Losh	btxld -v -E ${ORG2} -f bin -b ${BTXKERN} -l gptldr.bin \
57ca987d46SWarner Losh	    -o ${.TARGET} gptzfsboot.bin
58ca987d46SWarner Losh
59ca987d46SWarner LoshCLEANFILES+=	gptldr.bin gptldr.out gptldr.o
60ca987d46SWarner Losh
61ca987d46SWarner Loshgptldr.bin: gptldr.out
62ca987d46SWarner Losh	${OBJCOPY} -S -O binary gptldr.out ${.TARGET}
63ca987d46SWarner Losh
64ca987d46SWarner Loshgptldr.out: gptldr.o
65a2037dbaSDimitry Andric	${LD} ${LD_FLAGS} -e start --defsym ORG=${ORG1} -T ${LDSCRIPT} -o ${.TARGET} gptldr.o
66ca987d46SWarner Losh
67b4cb3fe0SToomas SoomeOBJS=	zfsboot.o sio.o cons.o bcache.o devopen.o disk.o part.o zfs_cmd.o misc.o
683830659eSToomas SoomeCLEANFILES+=	gptzfsboot.bin gptzfsboot.out ${OBJS} ${OPENCRYPTO_XTS}
693830659eSToomas Soome
703830659eSToomas Soome# i386 standalone support library
713830659eSToomas SoomeLIBI386=	${BOOTOBJ}/i386/libi386/libi386.a
72ca987d46SWarner Losh
73ca987d46SWarner Loshgptzfsboot.bin: gptzfsboot.out
74ca987d46SWarner Losh	${OBJCOPY} -S -O binary gptzfsboot.out ${.TARGET}
75ca987d46SWarner Losh
763830659eSToomas Soomegptzfsboot.out: ${BTXCRT} ${OBJS} \
77ca987d46SWarner Losh	${OPENCRYPTO_XTS}
783830659eSToomas Soome	${LD} ${LD_FLAGS} --defsym ORG=${ORG2} -T ${LDSCRIPT} -o ${.TARGET} ${.ALLSRC} ${LIBI386} ${LIBSA32}
79ca987d46SWarner Losh
80ca987d46SWarner Loshzfsboot.o: ${ZFSSRC}/zfsimpl.c
81ca987d46SWarner Losh
82ca987d46SWarner Losh.include <bsd.prog.mk>
83