Makefile revision 125621
138666Sjb# $FreeBSD: head/sys/boot/i386/gptboot/Makefile 125621 2004-02-09 14:11:58Z ru $ 250479Speter 338666SjbFILES= boot boot1 boot2 438666Sjb 5139122SruNM?= nm 6139122Sru 7245825Sbrooks# A value of 0x80 enables LBA support. 8245825SbrooksB1FLAGS= 0x80 9139120Sru 10200596SimpBOOT_COMCONSOLE_PORT?= 0x3f8 1161703SbrianBOOT_COMCONSOLE_SPEED?= 9600 1271401SpeterB2SIOFMT?= 0x3 1361703Sbrian 14200596SimpREL1= 0x700 1564340SsheldonhORG1= 0x7c00 16245825SbrooksORG2= 0x2000 1764340Ssheldonh 18179233Sjb# Decide level of UFS support. 1938666SjbBOOT2_UFS?= UFS1_AND_UFS2 20237142Sbrooks#BOOT2_UFS?= UFS2_ONLY 21241684Sbrooks#BOOT2_UFS?= UFS1_ONLY 22241684Sbrooks 23229659SadrianAFLAGS+=--defsym FLAGS=${B1FLAGS} \ 24229659Sadrian --defsym SIOPRT=${BOOT_COMCONSOLE_PORT} \ 25245825Sbrooks --defsym SIOFMT=${B2SIOFMT} \ 26245825Sbrooks --defsym SIOSPD=${BOOT_COMCONSOLE_SPEED} 27162113Sru 28206618SimpCFLAGS= -Os \ 29230786Simp -fno-guess-branch-probability -fomit-frame-pointer\ 30246283Shrs -mno-align-long-strings \ 31246283Shrs -mrtd \ 3238666Sjb -D${BOOT2_UFS} \ 3338666Sjb -I${.CURDIR}/../../common \ 3438666Sjb -I${.CURDIR}/../btx/lib -I. \ 3538666Sjb -Wall -Waggregate-return -Wbad-function-cast -Wcast-align \ 3638666Sjb -Wmissing-declarations -Wmissing-prototypes -Wnested-externs \ 37158962Snetchild -Wpointer-arith -Wshadow -Wstrict-prototypes -Wwrite-strings 38251075Sgjb 3938666SjbLDFLAGS=-static -N --gc-sections 4038666Sjb 4138666Sjb# Pick up ../Makefile.inc early. 4238666Sjb.include <bsd.init.mk> 4338666Sjb 44218526SimpCLEANFILES= boot 45218526Simp 46218526Simpboot: boot1 boot2 47218526Simp cat boot1 boot2 > boot 48156813Sru 49209509SimpCLEANFILES+= boot1 boot1.out boot1.o 50240468Sbrooks 51183193Sobrienboot1: boot1.out 5238666Sjb objcopy -S -O binary boot1.out ${.TARGET} 5338666Sjb 5438666Sjbboot1.out: boot1.o 55125789Sru ${LD} ${LDFLAGS} -e start -Ttext ${ORG1} -o ${.TARGET} boot1.o 56164249Sru 57123309Sgadboot1.o: boot1.s 58123309Sgad ${CPP} ${CFLAGS} ${.CURDIR}/boot1.s | \ 59123309Sgad ${AS} ${AFLAGS} -o ${.TARGET} 60125789Sru 61257136SgjbCLEANFILES+= boot2 boot2.ld boot2.ldr boot2.bin boot2.out boot2.o \ 62250143Sbenno boot2.s boot2.s.tmp boot2.h sio.o 63250143Sbenno 64250143Sbennoboot2: boot2.ld 65164249Sru @set -- `ls -l boot2.ld`; x=$$((7680-$$5)); \ 66164249Sru echo "$$x bytes available"; test $$x -ge 0 67156813Sru dd if=boot2.ld of=${.TARGET} obs=7680 conv=osync 68125789Sru 6938666Sjbboot2.ld: boot2.ldr boot2.bin ${BTXKERN} 70168409Spjd btxld -v -E ${ORG2} -f bin -b ${BTXKERN} -l boot2.ldr \ 71168409Spjd -o ${.TARGET} -P 1 boot2.bin 72168409Spjd 73164249Sruboot2.ldr: 74156813Sru dd if=/dev/zero of=${.TARGET} bs=276 count=1 75125789Sru 76120120Sruboot2.bin: boot2.out 77156813Sru objcopy -S -O binary boot2.out ${.TARGET} 78125789Sru 7938666Sjbboot2.out: ${BTXCRT} boot2.o sio.o 80125789Sru ${LD} ${LDFLAGS} -Ttext ${ORG2} -o ${.TARGET} ${.ALLSRC} 81156813Sru 82125789Sruboot2.o: boot2.s 8338666Sjb 84139120SruSRCS= boot2.c boot2.h 85125789Sru 8638666Sjbboot2.s: boot2.c boot2.h ${.CURDIR}/../../common/ufsread.c 87164249Sru ${CC} ${CFLAGS} -S -o boot2.s.tmp ${.CURDIR}/boot2.c 88219820Sjeff sed -e '/align/d' -e '/nop/d' < boot2.s.tmp > boot2.s 89219820Sjeff rm -f boot2.s.tmp 90219820Sjeff 91164249Sruboot2.h: boot1.out 92164249Sru ${NM} -t d ${.ALLSRC} | awk '/([0-9])+ T xread/ \ 93164249Sru { x = $$1 - ORG1; \ 94164249Sru printf("#define XREADORG %#x\n", REL1 + x) }' \ 9538666Sjb ORG1=`printf "%d" ${ORG1}` \ 9638666Sjb REL1=`printf "%d" ${REL1}` > ${.TARGET} 9738666Sjb 98237141Sbrooks.if ${MACHINE_ARCH} == "amd64" 99125789Srubeforedepend boot2.s: machine 10038666SjbCLEANFILES+= machine 10138666Sjbmachine: 10238666Sjb ln -sf ${.CURDIR}/../../../i386/include machine 10395509Sru.endif 10495509Sru 105142766Sobrien.include <bsd.prog.mk> 106142766Sobrien