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