Makefile revision 80751
197049Speter# $FreeBSD: head/sys/boot/i386/gptboot/Makefile 80751 2001-07-31 19:50:09Z jhb $ 2166124Srafan 397049SpeterPROG= boot2 497049SpeterNOMAN= 597049SpeterSTRIP= 697049SpeterBINDIR?= /boot 797049SpeterBINMODE= 444 897049SpeterCLEANFILES+= boot1 boot1.out boot1.o \ 997049Speter boot2.ldr boot2.bin boot2.ld boot2.out boot2.o boot2.h \ 1097049Speter sio.o 1197049Speter 1297049SpeterNM?= nm 1397049Speter 1497049Speter# A value of 0x80 enables LBA support. 1597049SpeterB1FLAGS= 0x80 1697049Speter 1797049SpeterBOOT_COMCONSOLE_PORT?= 0x3f8 1897049SpeterBOOT_COMCONSOLE_SPEED?= 9600 1997049SpeterB2SIOFMT?= 0x3 2097049Speter 2197049Speter.if exists(${.OBJDIR}/../btx) 2297049SpeterBTX= ${.OBJDIR}/../btx 2397049Speter.else 2497049SpeterBTX= ${.CURDIR}/../btx 2597049Speter.endif 2697049Speter 2797049SpeterORG1= 0x7c00 2897049SpeterORG2= 0x1000 2997049Speter 30166124SrafanCFLAGS= -elf -I${.CURDIR}/../btx/lib -I. \ 3197049Speter -Os -fno-builtin -fforce-addr -fdata-sections \ 3297049Speter -malign-functions=0 -malign-jumps=0 -malign-loops=0 -mrtd \ 3397049Speter -mpreferred-stack-boundary=2 \ 3497049Speter -Wall -Waggregate-return -Wbad-function-cast -Wcast-align \ 3597049Speter -Wmissing-declarations -Wmissing-prototypes -Wnested-externs \ 3697049Speter -Wpointer-arith -Wshadow -Wstrict-prototypes -Wwrite-strings 3797049Speter 3897049SpeterLDFLAGS=-nostdlib -static -N 3997049Speter 4097049Speterall: boot1 boot2 4197049Speter 42166124Srafanboot1: boot1.out 4397049Speter objcopy -S -O binary boot1.out ${.TARGET} 4497049Speter 45166124Srafanboot1.out: boot1.o 4697049Speter ${LD} ${LDFLAGS} -e start -Ttext ${ORG1} -o ${.TARGET} boot1.o 4797049Speter 4897049Speterboot1.o: boot1.s 4997049Speter ${AS} ${AFLAGS} --defsym FLAGS=${B1FLAGS} ${.IMPSRC} -o ${.TARGET} 5097049Speter 5197049Speterboot2.h: boot1.out 5297049Speter ${NM} -t d ${.ALLSRC} | awk '/([0-9])+ T xread/ \ 5397049Speter { x = $$1 - ORG1; printf("#define XREADORG 0x7%x\n", x) }' \ 5497049Speter ORG1=`printf "%d" ${ORG1}` > boot2.h 5597049Speter 56166124Srafanboot2: boot2.ldr boot2.bin ${BTX}/btx/btx 5797049Speter btxld -v -E ${ORG2} -f bin -b ${BTX}/btx/btx -l boot2.ldr \ 5897049Speter -o boot2.ld -P 1 boot2.bin 5997049Speter @ls -l boot2.ld | awk '{ x = 7680 - $$5; \ 60166124Srafan print x " bytes available"; if (x < 0) exit 1 }' 61166124Srafan dd if=boot2.ld of=${.TARGET} obs=7680 conv=osync 2>/dev/null 6297049Speter 63boot2.ldr: 64 dd if=/dev/zero of=${.TARGET} bs=512 count=1 2>/dev/null 65 66boot2.bin: boot2.out 67 objcopy -S -O binary boot2.out ${.TARGET} 68 69boot2.out: boot2.o sio.o 70 ${LD} ${LDFLAGS} -Ttext ${ORG2} -o ${.TARGET} \ 71 ${BTX}/lib/crt0.o boot2.o sio.o 72 73boot2.o: boot2.h 74 75sio.o: sio.s 76 ${AS} ${AFLAGS} --defsym SIOPRT=${BOOT_COMCONSOLE_PORT} \ 77 --defsym SIOFMT=${B2SIOFMT} \ 78 --defsym SIOSPD=${BOOT_COMCONSOLE_SPEED} \ 79 ${.IMPSRC} -o ${.TARGET} 80 81install: 82 ${INSTALL} ${COPY} -o ${BINOWN} -g ${BINGRP} -m ${BINMODE} \ 83 boot1 ${DESTDIR}${BINDIR}/boot1 84 ${INSTALL} ${COPY} -o ${BINOWN} -g ${BINGRP} -m ${BINMODE} \ 85 boot2 ${DESTDIR}${BINDIR}/boot2 86 87.include <bsd.prog.mk> 88