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