xref: /freebsd/stand/i386/gptboot/Makefile (revision e9ac41698b2f322d55ccf9da50a3596edb2c1800)
1ca987d46SWarner Losh.include <bsd.init.mk>
2ca987d46SWarner Losh
3ca987d46SWarner Losh.PATH:		${BOOTSRC}/i386/boot2 ${BOOTSRC}/i386/common ${SASRC}
4ca987d46SWarner Losh
5ca987d46SWarner LoshFILES=		gptboot
6ca987d46SWarner LoshMAN=		gptboot.8
7ca987d46SWarner Losh
8ca987d46SWarner LoshBOOT_COMCONSOLE_PORT?= 0x3f8
9*4722ceb7SEd MasteBOOT_COMCONSOLE_SPEED?= 115200
10ca987d46SWarner LoshB2SIOFMT?=	0x3
11ca987d46SWarner Losh
12ca987d46SWarner LoshREL1=	0x700
13ca987d46SWarner LoshORG1=	0x7c00
14ca987d46SWarner LoshORG2=	0x0
15ca987d46SWarner Losh
16ca987d46SWarner Losh# Decide level of UFS support.
17ca987d46SWarner LoshGPTBOOT_UFS?=	UFS1_AND_UFS2
18ca987d46SWarner Losh#GPTBOOT_UFS?=	UFS2_ONLY
19ca987d46SWarner Losh#GPTBOOT_UFS?=	UFS1_ONLY
20ca987d46SWarner Losh
21ca987d46SWarner LoshCFLAGS+=-DBOOTPROG=\"gptboot\" \
22ca987d46SWarner Losh	-O1 \
23ca987d46SWarner Losh	-DGPT \
24ca987d46SWarner Losh	-D${GPTBOOT_UFS} \
25ca987d46SWarner Losh	-DSIOPRT=${BOOT_COMCONSOLE_PORT} \
26ca987d46SWarner Losh	-DSIOFMT=${B2SIOFMT} \
27ca987d46SWarner Losh	-DSIOSPD=${BOOT_COMCONSOLE_SPEED} \
28ca987d46SWarner Losh	-I${LDRSRC} \
29ca987d46SWarner Losh	-I${BOOTSRC}/i386/common \
30ca987d46SWarner Losh	-I${BOOTSRC}/i386/boot2 \
3127bae615SToomas Soome	-DHAVE_MEMCPY -I${SRCTOP}/sys/contrib/zlib \
32ca987d46SWarner Losh	-Wall -Waggregate-return -Wbad-function-cast -Wno-cast-align \
33ca987d46SWarner Losh	-Wmissing-declarations -Wmissing-prototypes -Wnested-externs \
34ca987d46SWarner Losh	-Wpointer-arith -Wshadow -Wstrict-prototypes -Wwrite-strings \
35073193edSDimitry Andric	-Wno-pointer-sign
36ca987d46SWarner Losh
37ca987d46SWarner LoshCFLAGS.gcc+=	--param max-inline-insns-single=100
38ca987d46SWarner Losh
39ca987d46SWarner LoshLD_FLAGS+=${LD_FLAGS_BIN}
40ca987d46SWarner Losh
41ca987d46SWarner LoshCLEANFILES+=	gptboot
42ca987d46SWarner Losh
43ca987d46SWarner Loshgptboot: gptldr.bin gptboot.bin ${BTXKERN}
44ca987d46SWarner Losh	btxld -v -E ${ORG2} -f bin -b ${BTXKERN} -l gptldr.bin \
45ca987d46SWarner Losh	    -o ${.TARGET} gptboot.bin
46ca987d46SWarner Losh
47ca987d46SWarner LoshCLEANFILES+=	gptldr.bin gptldr.out gptldr.o
48ca987d46SWarner Losh
49ca987d46SWarner Loshgptldr.bin: gptldr.out
50ca987d46SWarner Losh	${OBJCOPY} -S -O binary gptldr.out ${.TARGET}
51ca987d46SWarner Losh
52ca987d46SWarner Loshgptldr.out: gptldr.o
53a2037dbaSDimitry Andric	${LD} ${LD_FLAGS} -e start --defsym ORG=${ORG1} -T ${LDSCRIPT} -o ${.TARGET} gptldr.o
54ca987d46SWarner Losh
55ca251958SToomas SoomeCLEANFILES+=	gptboot.bin gptboot.out gptboot.o sio.o drv.o \
56ca987d46SWarner Losh		cons.o ${OPENCRYPTO_XTS}
57ca987d46SWarner Losh
58ca987d46SWarner Loshgptboot.bin: gptboot.out
59ca987d46SWarner Losh	${OBJCOPY} -S -O binary gptboot.out ${.TARGET}
60ca987d46SWarner Losh
61ca251958SToomas Soomegptboot.out: ${BTXCRT} gptboot.o sio.o drv.o cons.o ${OPENCRYPTO_XTS}
62a2037dbaSDimitry Andric	${LD} ${LD_FLAGS} --defsym ORG=${ORG2} -T ${LDSCRIPT} -o ${.TARGET} ${.ALLSRC} ${LIBSA32}
63ca987d46SWarner Losh
64ca987d46SWarner Losh.include <bsd.prog.mk>
65