Makefile revision 118824
150477Speter# $FreeBSD: head/sys/boot/i386/boot2/Makefile 116864 2003-06-26 03:51:57Z peter $ 240269Srnordier 340326SrnordierPROG= boot2 440326SrnordierNOMAN= 540326SrnordierSTRIP= 640326SrnordierBINDIR?= /boot 740326SrnordierBINMODE= 444 8111490SruCLEANFILES= boot boot1 boot1.out boot1.o \ 980751Sjhb boot2.ldr boot2.bin boot2.ld boot2.out boot2.o boot2.h \ 10104680Sphk boot2.s sio.o 1140326Srnordier 1280751SjhbNM?= nm 1380751Sjhb 1448919Srnordier# A value of 0x80 enables LBA support. 1562138SjhbB1FLAGS= 0x80 1648919Srnordier 1742480SrnordierBOOT_COMCONSOLE_PORT?= 0x3f8 1842480SrnordierBOOT_COMCONSOLE_SPEED?= 9600 1940541SrnordierB2SIOFMT?= 0x3 2040541Srnordier 2140269Srnordier.if exists(${.OBJDIR}/../btx) 2240269SrnordierBTX= ${.OBJDIR}/../btx 2340269Srnordier.else 2440269SrnordierBTX= ${.CURDIR}/../btx 2540269Srnordier.endif 2640269Srnordier 27104673SgreenREL1= 0x700 2840269SrnordierORG1= 0x7c00 29104683SjhbORG2= 0x2000 3040269Srnordier 31107879Sphk# Decide Level of UFS support. UFS1_AND_UFS2 doesn't fit. 32107879Sphk 33107879Sphk# BOOT2_UFS?= UFS2_ONLY 34108000SimpBOOT2_UFS?= UFS1_AND_UFS2 35108000Simp# BOOT2_UFS?= UFS1_ONLY 36104635Sphk 3796327SjhbCFLAGS= -elf -ffreestanding -Os -fno-builtin \ 38108000Simp -fno-guess-branch-probability -fomit-frame-pointer\ 39108149Sobrien -mno-align-long-strings \ 4096327Sjhb -mrtd \ 41107879Sphk -D${BOOT2_UFS} \ 4297860Sphk -I${.CURDIR}/../../common \ 4396306Sobrien -I${.CURDIR}/../btx/lib -I. \ 4440269Srnordier -Wall -Waggregate-return -Wbad-function-cast -Wcast-align \ 4540269Srnordier -Wmissing-declarations -Wmissing-prototypes -Wnested-externs \ 4640269Srnordier -Wpointer-arith -Wshadow -Wstrict-prototypes -Wwrite-strings 4740269Srnordier 48108000SimpLDFLAGS=-nostdlib -static -N --gc-sections 4940269Srnordier 50109886Sphkall: boot1 boot2 boot 5140269Srnordier 52109886Sphkboot: boot1 boot2 53109886Sphk cat boot1 boot2 > boot 54109886Sphk 5540269Srnordierboot1: boot1.out 5640308Srnordier objcopy -S -O binary boot1.out ${.TARGET} 5740269Srnordier 5840269Srnordierboot1.out: boot1.o 5940269Srnordier ${LD} ${LDFLAGS} -e start -Ttext ${ORG1} -o ${.TARGET} boot1.o 6040269Srnordier 6160821Sjhbboot1.o: boot1.s 62104632Sphk ${CPP} ${CFLAGS} ${.IMPSRC} | \ 63104632Sphk ${AS} ${AFLAGS} --defsym FLAGS=${B1FLAGS} -o ${.TARGET} 6440269Srnordier 6597867Sphkboot2.o: boot2.c ${.CURDIR}/../../common/ufsread.c 6696424Speter ${CC} ${CFLAGS} -S -o boot2.s.tmp ${.IMPSRC} 6796424Speter sed -e '/align/d' -e '/nop/d' < boot2.s.tmp > boot2.s 68108016Simp rm -f boot2.s.tmp 6996424Speter ${AS} ${AFLAGS} -o boot2.o boot2.s 7096424Speter 7180751Sjhbboot2.h: boot1.out 7280751Sjhb ${NM} -t d ${.ALLSRC} | awk '/([0-9])+ T xread/ \ 73104673Sgreen { x = $$1 - ORG1; \ 74104673Sgreen printf("#define XREADORG %#x\n", REL1 + x) }' \ 75104673Sgreen ORG1=`printf "%d" ${ORG1}` \ 76104673Sgreen REL1=`printf "%d" ${REL1}` > boot2.h 7780751Sjhb 7859150Sjhbboot2: boot2.ldr boot2.bin ${BTX}/btx/btx 7940269Srnordier btxld -v -E ${ORG2} -f bin -b ${BTX}/btx/btx -l boot2.ldr \ 8040314Srnordier -o boot2.ld -P 1 boot2.bin 8140314Srnordier @ls -l boot2.ld | awk '{ x = 7680 - $$5; \ 8240314Srnordier print x " bytes available"; if (x < 0) exit 1 }' 8340314Srnordier dd if=boot2.ld of=${.TARGET} obs=7680 conv=osync 2>/dev/null 8440269Srnordier 8540269Srnordierboot2.ldr: 86107879Sphk dd if=/dev/zero of=${.TARGET} bs=276 count=1 2>/dev/null 8740269Srnordier 8840269Srnordierboot2.bin: boot2.out 8940308Srnordier objcopy -S -O binary boot2.out ${.TARGET} 9040269Srnordier 9140404Srnordierboot2.out: boot2.o sio.o 9240269Srnordier ${LD} ${LDFLAGS} -Ttext ${ORG2} -o ${.TARGET} \ 93104635Sphk ${BTX}/lib/crt0.o ${.ALLSRC} 9440269Srnordier 9580751Sjhbboot2.o: boot2.h 9680751Sjhb 9740404Srnordiersio.o: sio.s 9860821Sjhb ${AS} ${AFLAGS} --defsym SIOPRT=${BOOT_COMCONSOLE_PORT} \ 9960821Sjhb --defsym SIOFMT=${B2SIOFMT} \ 10060821Sjhb --defsym SIOSPD=${BOOT_COMCONSOLE_SPEED} \ 10160821Sjhb ${.IMPSRC} -o ${.TARGET} 10240404Srnordier 10340326Srnordierinstall: 104100872Sru ${INSTALL} -o ${BINOWN} -g ${BINGRP} -m ${BINMODE} \ 105109886Sphk boot ${DESTDIR}${BINDIR}/boot 106109886Sphk ${INSTALL} -o ${BINOWN} -g ${BINGRP} -m ${BINMODE} \ 10740326Srnordier boot1 ${DESTDIR}${BINDIR}/boot1 108100872Sru ${INSTALL} -o ${BINOWN} -g ${BINGRP} -m ${BINMODE} \ 10940326Srnordier boot2 ${DESTDIR}${BINDIR}/boot2 11040326Srnordier 11140326Srnordier.include <bsd.prog.mk> 112116864Speter 113116864Speter.if defined(REALLY_AMD64) 114116864Speterboot2.o: machine 115116864Speter 116116864Speterbeforedepend ${OBJS}: machine 117116864Speter 118116864Spetermachine: 119116864Speter ln -sf ${.CURDIR}/../../../i386/include machine 120116864Speter 121116864SpeterCLEANFILES+= machine 122116864Speter.endif 123116864Speter 124