Makefile revision 125517
1# $FreeBSD: head/sys/boot/i386/gptboot/Makefile 125517 2004-02-06 12:58:32Z ru $ 2 3PROG= boot2 4NOMAN= 5STRIP= 6BINMODE= 444 7CLEANFILES= boot boot1 boot1.out boot1.o \ 8 boot2.ldr boot2.bin boot2.ld boot2.out boot2.o boot2.h \ 9 boot2.s sio.o 10 11NM?= nm 12 13# A value of 0x80 enables LBA support. 14B1FLAGS= 0x80 15 16BOOT_COMCONSOLE_PORT?= 0x3f8 17BOOT_COMCONSOLE_SPEED?= 9600 18B2SIOFMT?= 0x3 19 20.if exists(${.OBJDIR}/../btx) 21BTX= ${.OBJDIR}/../btx 22.else 23BTX= ${.CURDIR}/../btx 24.endif 25 26REL1= 0x700 27ORG1= 0x7c00 28ORG2= 0x2000 29 30# Decide Level of UFS support. UFS1_AND_UFS2 doesn't fit. 31 32# BOOT2_UFS?= UFS2_ONLY 33BOOT2_UFS?= UFS1_AND_UFS2 34# BOOT2_UFS?= UFS1_ONLY 35 36CFLAGS= -elf -ffreestanding -Os -fno-builtin \ 37 -fno-guess-branch-probability -fomit-frame-pointer\ 38 -mno-align-long-strings \ 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 boot 50 51boot: boot1 boot2 52 cat boot1 boot2 > boot 53 54boot1: boot1.out 55 objcopy -S -O binary boot1.out ${.TARGET} 56 57boot1.out: boot1.o 58 ${LD} ${LDFLAGS} -e start -Ttext ${ORG1} -o ${.TARGET} boot1.o 59 60boot1.o: boot1.s 61 ${CPP} ${CFLAGS} ${.IMPSRC} | \ 62 ${AS} ${AFLAGS} --defsym FLAGS=${B1FLAGS} -o ${.TARGET} 63 64boot2.o: boot2.c ${.CURDIR}/../../common/ufsread.c 65 ${CC} ${CFLAGS} -S -o boot2.s.tmp ${.IMPSRC} 66 sed -e '/align/d' -e '/nop/d' < boot2.s.tmp > boot2.s 67 rm -f boot2.s.tmp 68 ${AS} ${AFLAGS} -o boot2.o boot2.s 69 70boot2.h: boot1.out 71 ${NM} -t d ${.ALLSRC} | awk '/([0-9])+ T xread/ \ 72 { x = $$1 - ORG1; \ 73 printf("#define XREADORG %#x\n", REL1 + x) }' \ 74 ORG1=`printf "%d" ${ORG1}` \ 75 REL1=`printf "%d" ${REL1}` > boot2.h 76 77boot2: boot2.ldr boot2.bin ${BTX}/btx/btx 78 btxld -v -E ${ORG2} -f bin -b ${BTX}/btx/btx -l boot2.ldr \ 79 -o boot2.ld -P 1 boot2.bin 80 @ls -l boot2.ld | awk '{ x = 7680 - $$5; \ 81 print x " bytes available"; if (x < 0) exit 1 }' 82 dd if=boot2.ld of=${.TARGET} obs=7680 conv=osync 2>/dev/null 83 84boot2.ldr: 85 dd if=/dev/zero of=${.TARGET} bs=276 count=1 2>/dev/null 86 87boot2.bin: boot2.out 88 objcopy -S -O binary boot2.out ${.TARGET} 89 90boot2.out: boot2.o sio.o 91 ${LD} ${LDFLAGS} -Ttext ${ORG2} -o ${.TARGET} \ 92 ${BTX}/lib/crt0.o ${.ALLSRC} 93 94boot2.o: boot2.h 95 96sio.o: sio.s 97 ${AS} ${AFLAGS} --defsym SIOPRT=${BOOT_COMCONSOLE_PORT} \ 98 --defsym SIOFMT=${B2SIOFMT} \ 99 --defsym SIOSPD=${BOOT_COMCONSOLE_SPEED} \ 100 ${.IMPSRC} -o ${.TARGET} 101 102install: 103 ${INSTALL} -o ${BINOWN} -g ${BINGRP} -m ${BINMODE} \ 104 boot ${DESTDIR}${BINDIR}/boot 105 ${INSTALL} -o ${BINOWN} -g ${BINGRP} -m ${BINMODE} \ 106 boot1 ${DESTDIR}${BINDIR}/boot1 107 ${INSTALL} -o ${BINOWN} -g ${BINGRP} -m ${BINMODE} \ 108 boot2 ${DESTDIR}${BINDIR}/boot2 109 110.include <bsd.prog.mk> 111 112.if defined(REALLY_AMD64) 113boot2.o: machine 114 115beforedepend ${OBJS}: machine 116 117machine: 118 ln -sf ${.CURDIR}/../../../i386/include machine 119 120CLEANFILES+= machine 121.endif 122 123