Makefile revision 108000
1# $FreeBSD: head/sys/boot/i386/gptboot/Makefile 108000 2002-12-17 21:10:34Z imp $ 2 3PROG= boot2 4NOMAN= 5STRIP= 6BINDIR?= /boot 7BINMODE= 444 8CLEANFILES+= boot1 boot1.out boot1.o \ 9 boot2.ldr boot2.bin boot2.ld boot2.out boot2.o boot2.h \ 10 boot2.s sio.o 11 12NM?= nm 13 14# A value of 0x80 enables LBA support. 15B1FLAGS= 0x80 16 17BOOT_COMCONSOLE_PORT?= 0x3f8 18BOOT_COMCONSOLE_SPEED?= 9600 19B2SIOFMT?= 0x3 20 21.if exists(${.OBJDIR}/../btx) 22BTX= ${.OBJDIR}/../btx 23.else 24BTX= ${.CURDIR}/../btx 25.endif 26 27REL1= 0x700 28ORG1= 0x7c00 29ORG2= 0x2000 30 31# Decide Level of UFS support. UFS1_AND_UFS2 doesn't fit. 32 33# BOOT2_UFS?= UFS2_ONLY 34BOOT2_UFS?= UFS1_AND_UFS2 35# BOOT2_UFS?= UFS1_ONLY 36 37CFLAGS= -elf -ffreestanding -Os -fno-builtin \ 38 -fno-guess-branch-probability -fomit-frame-pointer\ 39 -mrtd \ 40 -D${BOOT2_UFS} \ 41 -I${.CURDIR}/../../common \ 42 -I${.CURDIR}/../btx/lib -I. \ 43 -Wall -Waggregate-return -Wbad-function-cast -Wcast-align \ 44 -Wmissing-declarations -Wmissing-prototypes -Wnested-externs \ 45 -Wpointer-arith -Wshadow -Wstrict-prototypes -Wwrite-strings 46 47LDFLAGS=-nostdlib -static -N --gc-sections 48 49all: boot1 boot2 50 51boot1: boot1.out 52 objcopy -S -O binary boot1.out ${.TARGET} 53 54boot1.out: boot1.o 55 ${LD} ${LDFLAGS} -e start -Ttext ${ORG1} -o ${.TARGET} boot1.o 56 57boot1.o: boot1.s 58 ${CPP} ${CFLAGS} ${.IMPSRC} | \ 59 ${AS} ${AFLAGS} --defsym FLAGS=${B1FLAGS} -o ${.TARGET} 60 61boot2.o: boot2.c ${.CURDIR}/../../common/ufsread.c 62 ${CC} ${CFLAGS} -S -o boot2.s.tmp ${.IMPSRC} 63 sed -e '/align/d' -e '/nop/d' < boot2.s.tmp > boot2.s 64 ${AS} ${AFLAGS} -o boot2.o boot2.s 65 66boot2.h: boot1.out 67 ${NM} -t d ${.ALLSRC} | awk '/([0-9])+ T xread/ \ 68 { x = $$1 - ORG1; \ 69 printf("#define XREADORG %#x\n", REL1 + x) }' \ 70 ORG1=`printf "%d" ${ORG1}` \ 71 REL1=`printf "%d" ${REL1}` > boot2.h 72 73boot2: boot2.ldr boot2.bin ${BTX}/btx/btx 74 btxld -v -E ${ORG2} -f bin -b ${BTX}/btx/btx -l boot2.ldr \ 75 -o boot2.ld -P 1 boot2.bin 76 @ls -l boot2.ld | awk '{ x = 7680 - $$5; \ 77 print x " bytes available"; if (x < 0) exit 1 }' 78 dd if=boot2.ld of=${.TARGET} obs=7680 conv=osync 2>/dev/null 79 80boot2.ldr: 81 dd if=/dev/zero of=${.TARGET} bs=276 count=1 2>/dev/null 82 83boot2.bin: boot2.out 84 objcopy -S -O binary boot2.out ${.TARGET} 85 86boot2.out: boot2.o sio.o 87 ${LD} ${LDFLAGS} -Ttext ${ORG2} -o ${.TARGET} \ 88 ${BTX}/lib/crt0.o ${.ALLSRC} 89 90boot2.o: boot2.h 91 92sio.o: sio.s 93 ${AS} ${AFLAGS} --defsym SIOPRT=${BOOT_COMCONSOLE_PORT} \ 94 --defsym SIOFMT=${B2SIOFMT} \ 95 --defsym SIOSPD=${BOOT_COMCONSOLE_SPEED} \ 96 ${.IMPSRC} -o ${.TARGET} 97 98install: 99 ${INSTALL} -o ${BINOWN} -g ${BINGRP} -m ${BINMODE} \ 100 boot1 ${DESTDIR}${BINDIR}/boot1 101 ${INSTALL} -o ${BINOWN} -g ${BINGRP} -m ${BINMODE} \ 102 boot2 ${DESTDIR}${BINDIR}/boot2 103 104.include <bsd.prog.mk> 105