xref: /freebsd/stand/i386/isoboot/Makefile (revision 7acb51f681a6960ce8dd029ad78fd354bd05b4bd)
1# $FreeBSD$
2
3HAVE_GELI=		yes
4
5.include <bsd.init.mk>
6
7.PATH:		${BOOTSRC}/i386/boot2 ${BOOTSRC}/i386/gptboot \
8		${BOOTSRC}/i386/common ${SASRC}
9
10FILES=		isoboot
11MAN=		isoboot.8
12
13NM?=		nm
14
15BOOT_COMCONSOLE_PORT?= 0x3f8
16BOOT_COMCONSOLE_SPEED?= 9600
17B2SIOFMT?=	0x3
18
19REL1=	0x700
20ORG1=	0x7c00
21ORG2=	0x0
22
23ISOBOOTSIZE?=	30720
24
25CFLAGS+=-DBOOTPROG=\"isoboot\" \
26	-O1 \
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	-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	-Winline -Wno-pointer-sign
37
38CFLAGS.gcc+=	--param max-inline-insns-single=100
39CFLAGS.clang+=  -Oz ${CLANG_OPT_SMALL}
40
41LD_FLAGS+=${LD_FLAGS_BIN}
42
43CLEANFILES+=	isoboot
44
45isoboot: gptldr.bin isoboot.bin ${BTXKERN}
46	btxld -v -E ${ORG2} -f bin -b ${BTXKERN} -l gptldr.bin \
47	    -o ${.TARGET} isoboot.bin
48	@set -- `ls -l ${.TARGET}`; x=$$((${ISOBOOTSIZE}-$$5)); \
49	    echo "$$x bytes available"; test $$x -ge 0
50
51CLEANFILES+=	gptldr.bin gptldr.out gptldr.o
52
53gptldr.bin: gptldr.out
54	${OBJCOPY} -S -O binary gptldr.out ${.TARGET}
55
56gptldr.out: gptldr.o
57	${LD} ${LD_FLAGS} -e start -Ttext ${ORG1} -o ${.TARGET} gptldr.o
58
59CLEANFILES+=	isoboot.bin isoboot.out isoboot.o sio.o crc32.o drv.o \
60		cons.o ${OPENCRYPTO_XTS}
61
62isoboot.bin: isoboot.out
63	${OBJCOPY} -S -O binary isoboot.out ${.TARGET}
64
65isoboot.out: ${BTXCRT} isoboot.o sio.o crc32.o drv.o cons.o ${OPENCRYPTO_XTS}
66	${LD} ${LD_FLAGS} -Ttext ${ORG2} -o ${.TARGET} ${.ALLSRC} ${LIBGELIBOOT} ${LIBSA32}
67
68.include <bsd.prog.mk>
69