Makefile revision 125621
150477Speter# $FreeBSD: head/sys/boot/i386/boot2/Makefile 125621 2004-02-09 14:11:58Z ru $ 240269Srnordier 3125537SruFILES= boot boot1 boot2 440326Srnordier 580751SjhbNM?= nm 680751Sjhb 748919Srnordier# A value of 0x80 enables LBA support. 862138SjhbB1FLAGS= 0x80 948919Srnordier 1042480SrnordierBOOT_COMCONSOLE_PORT?= 0x3f8 1142480SrnordierBOOT_COMCONSOLE_SPEED?= 9600 1240541SrnordierB2SIOFMT?= 0x3 1340541Srnordier 14104673SgreenREL1= 0x700 1540269SrnordierORG1= 0x7c00 16104683SjhbORG2= 0x2000 1740269Srnordier 18125537Sru# Decide level of UFS support. 19108000SimpBOOT2_UFS?= UFS1_AND_UFS2 20125537Sru#BOOT2_UFS?= UFS2_ONLY 21125537Sru#BOOT2_UFS?= UFS1_ONLY 22104635Sphk 23125537SruAFLAGS+=--defsym FLAGS=${B1FLAGS} \ 24125537Sru --defsym SIOPRT=${BOOT_COMCONSOLE_PORT} \ 25125537Sru --defsym SIOFMT=${B2SIOFMT} \ 26125537Sru --defsym SIOSPD=${BOOT_COMCONSOLE_SPEED} 27125537Sru 28125566SruCFLAGS= -Os \ 29108000Simp -fno-guess-branch-probability -fomit-frame-pointer\ 30108149Sobrien -mno-align-long-strings \ 3196327Sjhb -mrtd \ 32107879Sphk -D${BOOT2_UFS} \ 3397860Sphk -I${.CURDIR}/../../common \ 3496306Sobrien -I${.CURDIR}/../btx/lib -I. \ 3540269Srnordier -Wall -Waggregate-return -Wbad-function-cast -Wcast-align \ 3640269Srnordier -Wmissing-declarations -Wmissing-prototypes -Wnested-externs \ 3740269Srnordier -Wpointer-arith -Wshadow -Wstrict-prototypes -Wwrite-strings 3840269Srnordier 39125621SruLDFLAGS=-static -N --gc-sections 4040269Srnordier 41125537Sru# Pick up ../Makefile.inc early. 42125537Sru.include <bsd.init.mk> 4340269Srnordier 44125537SruCLEANFILES= boot 45125537Sru 46109886Sphkboot: boot1 boot2 47109886Sphk cat boot1 boot2 > boot 48109886Sphk 49125537SruCLEANFILES+= boot1 boot1.out boot1.o 50125537Sru 5140269Srnordierboot1: boot1.out 5240308Srnordier objcopy -S -O binary boot1.out ${.TARGET} 5340269Srnordier 5440269Srnordierboot1.out: boot1.o 5540269Srnordier ${LD} ${LDFLAGS} -e start -Ttext ${ORG1} -o ${.TARGET} boot1.o 5640269Srnordier 5760821Sjhbboot1.o: boot1.s 58125537Sru ${CPP} ${CFLAGS} ${.CURDIR}/boot1.s | \ 59125537Sru ${AS} ${AFLAGS} -o ${.TARGET} 6040269Srnordier 61125537SruCLEANFILES+= boot2 boot2.ld boot2.ldr boot2.bin boot2.out boot2.o \ 62125537Sru boot2.s boot2.s.tmp boot2.h sio.o 6396424Speter 64125537Sruboot2: boot2.ld 65125537Sru @set -- `ls -l boot2.ld`; x=$$((7680-$$5)); \ 66125537Sru echo "$$x bytes available"; test $$x -ge 0 67125537Sru dd if=boot2.ld of=${.TARGET} obs=7680 conv=osync 6880751Sjhb 69125537Sruboot2.ld: boot2.ldr boot2.bin ${BTXKERN} 70125537Sru btxld -v -E ${ORG2} -f bin -b ${BTXKERN} -l boot2.ldr \ 71125537Sru -o ${.TARGET} -P 1 boot2.bin 7240269Srnordier 7340269Srnordierboot2.ldr: 74125537Sru dd if=/dev/zero of=${.TARGET} bs=276 count=1 7540269Srnordier 7640269Srnordierboot2.bin: boot2.out 7740308Srnordier objcopy -S -O binary boot2.out ${.TARGET} 7840269Srnordier 79125537Sruboot2.out: ${BTXCRT} boot2.o sio.o 80125537Sru ${LD} ${LDFLAGS} -Ttext ${ORG2} -o ${.TARGET} ${.ALLSRC} 8140269Srnordier 82125537Sruboot2.o: boot2.s 8380751Sjhb 84125564SruSRCS= boot2.c boot2.h 85125564Sru 86125537Sruboot2.s: boot2.c boot2.h ${.CURDIR}/../../common/ufsread.c 87125537Sru ${CC} ${CFLAGS} -S -o boot2.s.tmp ${.CURDIR}/boot2.c 88125537Sru sed -e '/align/d' -e '/nop/d' < boot2.s.tmp > boot2.s 89125537Sru rm -f boot2.s.tmp 9040404Srnordier 91125537Sruboot2.h: boot1.out 92125537Sru ${NM} -t d ${.ALLSRC} | awk '/([0-9])+ T xread/ \ 93125537Sru { x = $$1 - ORG1; \ 94125537Sru printf("#define XREADORG %#x\n", REL1 + x) }' \ 95125537Sru ORG1=`printf "%d" ${ORG1}` \ 96125537Sru REL1=`printf "%d" ${REL1}` > ${.TARGET} 9740326Srnordier 98125556Sru.if ${MACHINE_ARCH} == "amd64" 99125581Srubeforedepend boot2.s: machine 100125556SruCLEANFILES+= machine 101116864Spetermachine: 102116864Speter ln -sf ${.CURDIR}/../../../i386/include machine 103116864Speter.endif 104116864Speter 105125537Sru.include <bsd.prog.mk> 106