Makefile revision 129215
150477Speter# $FreeBSD: head/sys/boot/i386/boot2/Makefile 125932 2004-02-17 07:13:04Z 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 23125566SruCFLAGS= -Os \ 24108000Simp -fno-guess-branch-probability -fomit-frame-pointer\ 25108149Sobrien -mno-align-long-strings \ 2696327Sjhb -mrtd \ 27107879Sphk -D${BOOT2_UFS} \ 28125932Sru -DFLAGS=${B1FLAGS} \ 29125932Sru -DSIOPRT=${BOOT_COMCONSOLE_PORT} \ 30125932Sru -DSIOFMT=${B2SIOFMT} \ 31125932Sru -DSIOSPD=${BOOT_COMCONSOLE_SPEED} \ 3297860Sphk -I${.CURDIR}/../../common \ 3396306Sobrien -I${.CURDIR}/../btx/lib -I. \ 3440269Srnordier -Wall -Waggregate-return -Wbad-function-cast -Wcast-align \ 3540269Srnordier -Wmissing-declarations -Wmissing-prototypes -Wnested-externs \ 3640269Srnordier -Wpointer-arith -Wshadow -Wstrict-prototypes -Wwrite-strings 3740269Srnordier 38125621SruLDFLAGS=-static -N --gc-sections 3940269Srnordier 40125537Sru# Pick up ../Makefile.inc early. 41125537Sru.include <bsd.init.mk> 4240269Srnordier 43125537SruCLEANFILES= boot 44125537Sru 45109886Sphkboot: boot1 boot2 46109886Sphk cat boot1 boot2 > boot 47109886Sphk 48125537SruCLEANFILES+= boot1 boot1.out boot1.o 49125537Sru 5040269Srnordierboot1: boot1.out 5140308Srnordier objcopy -S -O binary boot1.out ${.TARGET} 5240269Srnordier 5340269Srnordierboot1.out: boot1.o 5440269Srnordier ${LD} ${LDFLAGS} -e start -Ttext ${ORG1} -o ${.TARGET} boot1.o 5540269Srnordier 56125537SruCLEANFILES+= boot2 boot2.ld boot2.ldr boot2.bin boot2.out boot2.o \ 57125537Sru boot2.s boot2.s.tmp boot2.h sio.o 5896424Speter 59125537Sruboot2: boot2.ld 60125537Sru @set -- `ls -l boot2.ld`; x=$$((7680-$$5)); \ 61125537Sru echo "$$x bytes available"; test $$x -ge 0 62125537Sru dd if=boot2.ld of=${.TARGET} obs=7680 conv=osync 6380751Sjhb 64125537Sruboot2.ld: boot2.ldr boot2.bin ${BTXKERN} 65125537Sru btxld -v -E ${ORG2} -f bin -b ${BTXKERN} -l boot2.ldr \ 66125537Sru -o ${.TARGET} -P 1 boot2.bin 6740269Srnordier 6840269Srnordierboot2.ldr: 69125537Sru dd if=/dev/zero of=${.TARGET} bs=276 count=1 7040269Srnordier 7140269Srnordierboot2.bin: boot2.out 7240308Srnordier objcopy -S -O binary boot2.out ${.TARGET} 7340269Srnordier 74125537Sruboot2.out: ${BTXCRT} boot2.o sio.o 75125537Sru ${LD} ${LDFLAGS} -Ttext ${ORG2} -o ${.TARGET} ${.ALLSRC} 7640269Srnordier 77125537Sruboot2.o: boot2.s 7880751Sjhb 79125564SruSRCS= boot2.c boot2.h 80125564Sru 81125537Sruboot2.s: boot2.c boot2.h ${.CURDIR}/../../common/ufsread.c 82125537Sru ${CC} ${CFLAGS} -S -o boot2.s.tmp ${.CURDIR}/boot2.c 83125537Sru sed -e '/align/d' -e '/nop/d' < boot2.s.tmp > boot2.s 84125537Sru rm -f boot2.s.tmp 8540404Srnordier 86125537Sruboot2.h: boot1.out 87125537Sru ${NM} -t d ${.ALLSRC} | awk '/([0-9])+ T xread/ \ 88125537Sru { x = $$1 - ORG1; \ 89125537Sru printf("#define XREADORG %#x\n", REL1 + x) }' \ 90125537Sru ORG1=`printf "%d" ${ORG1}` \ 91125537Sru REL1=`printf "%d" ${REL1}` > ${.TARGET} 9240326Srnordier 93125556Sru.if ${MACHINE_ARCH} == "amd64" 94125581Srubeforedepend boot2.s: machine 95125556SruCLEANFILES+= machine 96116864Spetermachine: 97116864Speter ln -sf ${.CURDIR}/../../../i386/include machine 98116864Speter.endif 99116864Speter 100125537Sru.include <bsd.prog.mk> 101