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