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