Makefile revision 98542
11539Srgrimes# $FreeBSD: head/sys/boot/i386/gptboot/Makefile 98542 2002-06-21 06:18:05Z mckusick $ 21539Srgrimes 31539SrgrimesPROG= boot2 41539SrgrimesNOMAN= 51539SrgrimesSTRIP= 61539SrgrimesBINDIR?= /boot 71539SrgrimesBINMODE= 444 81539SrgrimesCLEANFILES+= boot1 boot1.out boot1.o \ 91539Srgrimes boot2.ldr boot2.bin boot2.ld boot2.out boot2.o boot2.h \ 101539Srgrimes boot2.s sio.o 111539Srgrimes 121539SrgrimesNM?= nm 131539Srgrimes 141539Srgrimes# A value of 0x80 enables LBA support. 151539SrgrimesB1FLAGS= 0x80 161539Srgrimes 171539SrgrimesBOOT_COMCONSOLE_PORT?= 0x3f8 181539SrgrimesBOOT_COMCONSOLE_SPEED?= 9600 191539SrgrimesB2SIOFMT?= 0x3 201539Srgrimes 21203964Simp.if exists(${.OBJDIR}/../btx) 221539SrgrimesBTX= ${.OBJDIR}/../btx 231539Srgrimes.else 241539SrgrimesBTX= ${.CURDIR}/../btx 251539Srgrimes.endif 261539Srgrimes 271539SrgrimesORG1= 0x7c00 281539SrgrimesORG2= 0x1000 291539Srgrimes 301539SrgrimesCFLAGS= -elf -ffreestanding -Os -fno-builtin \ 311539Srgrimes -fno-guess-branch-probability \ 321539Srgrimes -mrtd \ 331539Srgrimes -I${.CURDIR}/../../common \ 341539Srgrimes -I${.CURDIR}/../btx/lib -I. \ 351539Srgrimes -Wall -Waggregate-return -Wbad-function-cast -Wcast-align \ 361539Srgrimes -Wmissing-declarations -Wmissing-prototypes -Wnested-externs \ 371539Srgrimes -Wpointer-arith -Wshadow -Wstrict-prototypes -Wwrite-strings 3854746Sphantom 391539SrgrimesLDFLAGS=-nostdlib -static -N 401539Srgrimes 417655Sbdeall: boot1 boot2 427655Sbde 431539Srgrimesboot1: boot1.out 44103113Smike objcopy -S -O binary boot1.out ${.TARGET} 45103113Smike 46133559Stjrboot1.out: boot1.o 471539Srgrimes ${LD} ${LDFLAGS} -e start -Ttext ${ORG1} -o ${.TARGET} boot1.o 487655Sbde 4993032Simpboot1.o: boot1.s 5093032Simp ${AS} ${AFLAGS} --defsym FLAGS=${B1FLAGS} ${.IMPSRC} -o ${.TARGET} 5193032Simp 5293032Simpboot2.o: boot2.c ${.CURDIR}/../../common/ufsread.c 5393032Simp ${CC} ${CFLAGS} -S -o boot2.s.tmp ${.IMPSRC} 5493032Simp sed -e '/align/d' -e '/nop/d' < boot2.s.tmp > boot2.s 5593032Simp rm -f boot2.s.tmp 5693032Simp ${AS} ${AFLAGS} -o boot2.o boot2.s 5793032Simp 5893032Simpboot2.h: boot1.out 5993032Simp ${NM} -t d ${.ALLSRC} | awk '/([0-9])+ T xread/ \ 6093032Simp { x = $$1 - ORG1; printf("#define XREADORG 0x7%x\n", x) }' \ 6193032Simp ORG1=`printf "%d" ${ORG1}` > boot2.h 621539Srgrimes 63102998Smikeboot2: boot2.ldr boot2.bin ${BTX}/btx/btx 64102998Smike btxld -v -E ${ORG2} -f bin -b ${BTX}/btx/btx -l boot2.ldr \ 65102998Smike -o boot2.ld -P 1 boot2.bin 66102998Smike @ls -l boot2.ld | awk '{ x = 7680 - $$5; \ 67102998Smike print x " bytes available"; if (x < 0) exit 1 }' 68128523Stjr dd if=boot2.ld of=${.TARGET} obs=7680 conv=osync 2>/dev/null 69128523Stjr 70128523Stjrboot2.ldr: 71128523Stjr dd if=/dev/zero of=${.TARGET} bs=512 count=1 2>/dev/null 72102998Smike 7393032Simpboot2.bin: boot2.out 7493032Simp objcopy -S -O binary boot2.out ${.TARGET} 7593032Simp 7693032Simpboot2.out: boot2.o sio.o 7793032Simp ${LD} ${LDFLAGS} -Ttext ${ORG2} -o ${.TARGET} \ 7893032Simp ${BTX}/lib/crt0.o boot2.o sio.o ../libi386/libi386.a 7993032Simp 807655Sbdeboot2.o: boot2.h 81232498Stheraven 82233600Stheravensio.o: sio.s 83232498Stheraven ${AS} ${AFLAGS} --defsym SIOPRT=${BOOT_COMCONSOLE_PORT} \ 84232498Stheraven --defsym SIOFMT=${B2SIOFMT} \ 857655Sbde --defsym SIOSPD=${BOOT_COMCONSOLE_SPEED} \ 867655Sbde ${.IMPSRC} -o ${.TARGET} 87227490Stheraven 88172619Sacheinstall: 89172619Sache ${INSTALL} ${COPY} -o ${BINOWN} -g ${BINGRP} -m ${BINMODE} \ 90172619Sache boot1 ${DESTDIR}${BINDIR}/boot1 9157035Sobrien ${INSTALL} ${COPY} -o ${BINOWN} -g ${BINGRP} -m ${BINMODE} \ 92172619Sache boot2 ${DESTDIR}${BINDIR}/boot2 93172619Sache 94172619Sache.include <bsd.prog.mk> 95172619Sache