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