Makefile revision 96424
150477Speter# $FreeBSD: head/sys/boot/i386/gptboot/Makefile 96424 2002-05-11 21:39:59Z peter $ 240269Srnordier 340326SrnordierPROG= boot2 440326SrnordierNOMAN= 540326SrnordierSTRIP= 640326SrnordierBINDIR?= /boot 740326SrnordierBINMODE= 444 840326SrnordierCLEANFILES+= boot1 boot1.out boot1.o \ 980751Sjhb boot2.ldr boot2.bin boot2.ld boot2.out boot2.o boot2.h \ 1040404Srnordier 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 2740269SrnordierORG1= 0x7c00 2840269SrnordierORG2= 0x1000 2940269Srnordier 3096327SjhbCFLAGS= -elf -ffreestanding -Os -fno-builtin \ 3196306Sobrien -fno-align-functions -fno-align-jumps -fno-align-loops -fno-align-labels \ 3296327Sjhb -mrtd \ 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 3840269SrnordierLDFLAGS=-nostdlib -static -N 3940269Srnordier 4040269Srnordierall: boot1 boot2 4140269Srnordier 4240269Srnordierboot1: boot1.out 4340308Srnordier objcopy -S -O binary boot1.out ${.TARGET} 4440269Srnordier 4540269Srnordierboot1.out: boot1.o 4640269Srnordier ${LD} ${LDFLAGS} -e start -Ttext ${ORG1} -o ${.TARGET} boot1.o 4740269Srnordier 4860821Sjhbboot1.o: boot1.s 4960821Sjhb ${AS} ${AFLAGS} --defsym FLAGS=${B1FLAGS} ${.IMPSRC} -o ${.TARGET} 5040269Srnordier 5196424Speterboot2.o: boot2.c 5296424Speter ${CC} ${CFLAGS} -S -o boot2.s.tmp ${.IMPSRC} 5396424Speter sed -e '/align/d' -e '/nop/d' < boot2.s.tmp > boot2.s 5496424Speter rm -f boot2.s.tmp 5596424Speter ${AS} ${AFLAGS} -o boot2.o boot2.s 5696424Speter 5780751Sjhbboot2.h: boot1.out 5880751Sjhb ${NM} -t d ${.ALLSRC} | awk '/([0-9])+ T xread/ \ 5980751Sjhb { x = $$1 - ORG1; printf("#define XREADORG 0x7%x\n", x) }' \ 6080751Sjhb ORG1=`printf "%d" ${ORG1}` > boot2.h 6180751Sjhb 6259150Sjhbboot2: boot2.ldr boot2.bin ${BTX}/btx/btx 6340269Srnordier btxld -v -E ${ORG2} -f bin -b ${BTX}/btx/btx -l boot2.ldr \ 6440314Srnordier -o boot2.ld -P 1 boot2.bin 6540314Srnordier @ls -l boot2.ld | awk '{ x = 7680 - $$5; \ 6640314Srnordier print x " bytes available"; if (x < 0) exit 1 }' 6740314Srnordier dd if=boot2.ld of=${.TARGET} obs=7680 conv=osync 2>/dev/null 6840269Srnordier 6940269Srnordierboot2.ldr: 7040269Srnordier dd if=/dev/zero of=${.TARGET} bs=512 count=1 2>/dev/null 7140269Srnordier 7240269Srnordierboot2.bin: boot2.out 7340308Srnordier objcopy -S -O binary boot2.out ${.TARGET} 7440269Srnordier 7540404Srnordierboot2.out: boot2.o sio.o 7640269Srnordier ${LD} ${LDFLAGS} -Ttext ${ORG2} -o ${.TARGET} \ 7740404Srnordier ${BTX}/lib/crt0.o boot2.o sio.o 7840269Srnordier 7980751Sjhbboot2.o: boot2.h 8080751Sjhb 8140404Srnordiersio.o: sio.s 8260821Sjhb ${AS} ${AFLAGS} --defsym SIOPRT=${BOOT_COMCONSOLE_PORT} \ 8360821Sjhb --defsym SIOFMT=${B2SIOFMT} \ 8460821Sjhb --defsym SIOSPD=${BOOT_COMCONSOLE_SPEED} \ 8560821Sjhb ${.IMPSRC} -o ${.TARGET} 8640404Srnordier 8740326Srnordierinstall: 8840326Srnordier ${INSTALL} ${COPY} -o ${BINOWN} -g ${BINGRP} -m ${BINMODE} \ 8940326Srnordier boot1 ${DESTDIR}${BINDIR}/boot1 9040326Srnordier ${INSTALL} ${COPY} -o ${BINOWN} -g ${BINGRP} -m ${BINMODE} \ 9140326Srnordier boot2 ${DESTDIR}${BINDIR}/boot2 9240326Srnordier 9340326Srnordier.include <bsd.prog.mk> 94