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