Makefile revision 97860
1# $FreeBSD: head/sys/boot/i386/gptboot/Makefile 97860 2002-06-05 11:10:38Z phk $ 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 27ORG1= 0x7c00 28ORG2= 0x1000 29 30CFLAGS= -elf -ffreestanding -Os -fno-builtin \ 31 -fno-guess-branch-probability \ 32 -mrtd \ 33 -I${.CURDIR}/../../common \ 34 -I${.CURDIR}/../btx/lib -I. \ 35 -Wall -Waggregate-return -Wbad-function-cast -Wcast-align \ 36 -Wmissing-declarations -Wmissing-prototypes -Wnested-externs \ 37 -Wpointer-arith -Wshadow -Wstrict-prototypes -Wwrite-strings 38 39LDFLAGS=-nostdlib -static -N 40 41all: boot1 boot2 42 43boot1: boot1.out 44 objcopy -S -O binary boot1.out ${.TARGET} 45 46boot1.out: boot1.o 47 ${LD} ${LDFLAGS} -e start -Ttext ${ORG1} -o ${.TARGET} boot1.o 48 49boot1.o: boot1.s 50 ${AS} ${AFLAGS} --defsym FLAGS=${B1FLAGS} ${.IMPSRC} -o ${.TARGET} 51 52boot2.o: boot2.c 53 ${CC} ${CFLAGS} -S -o boot2.s.tmp ${.IMPSRC} 54 sed -e '/align/d' -e '/nop/d' < boot2.s.tmp > boot2.s 55 rm -f boot2.s.tmp 56 ${AS} ${AFLAGS} -o boot2.o boot2.s 57 58boot2.h: boot1.out 59 ${NM} -t d ${.ALLSRC} | awk '/([0-9])+ T xread/ \ 60 { x = $$1 - ORG1; printf("#define XREADORG 0x7%x\n", x) }' \ 61 ORG1=`printf "%d" ${ORG1}` > boot2.h 62 63boot2: boot2.ldr boot2.bin ${BTX}/btx/btx 64 btxld -v -E ${ORG2} -f bin -b ${BTX}/btx/btx -l boot2.ldr \ 65 -o boot2.ld -P 1 boot2.bin 66 @ls -l boot2.ld | awk '{ x = 7680 - $$5; \ 67 print x " bytes available"; if (x < 0) exit 1 }' 68 dd if=boot2.ld of=${.TARGET} obs=7680 conv=osync 2>/dev/null 69 70boot2.ldr: 71 dd if=/dev/zero of=${.TARGET} bs=512 count=1 2>/dev/null 72 73boot2.bin: boot2.out 74 objcopy -S -O binary boot2.out ${.TARGET} 75 76boot2.out: boot2.o sio.o 77 ${LD} ${LDFLAGS} -Ttext ${ORG2} -o ${.TARGET} \ 78 ${BTX}/lib/crt0.o boot2.o sio.o 79 80boot2.o: boot2.h 81 82sio.o: sio.s 83 ${AS} ${AFLAGS} --defsym SIOPRT=${BOOT_COMCONSOLE_PORT} \ 84 --defsym SIOFMT=${B2SIOFMT} \ 85 --defsym SIOSPD=${BOOT_COMCONSOLE_SPEED} \ 86 ${.IMPSRC} -o ${.TARGET} 87 88install: 89 ${INSTALL} ${COPY} -o ${BINOWN} -g ${BINGRP} -m ${BINMODE} \ 90 boot1 ${DESTDIR}${BINDIR}/boot1 91 ${INSTALL} ${COPY} -o ${BINOWN} -g ${BINGRP} -m ${BINMODE} \ 92 boot2 ${DESTDIR}${BINDIR}/boot2 93 94.include <bsd.prog.mk> 95