Makefile revision 148046
1# $FreeBSD: head/sys/boot/i386/gptboot/Makefile 148046 2005-07-15 12:22:14Z ache $ 2 3FILES= boot boot1 boot2 4 5NM?= nm 6 7# A value of 0x80 enables LBA support. 8BOOT_BOOT1_FLAGS?= 0x80 9 10BOOT_COMCONSOLE_PORT?= 0x3f8 11BOOT_COMCONSOLE_SPEED?= 9600 12B2SIOFMT?= 0x3 13 14REL1= 0x700 15ORG1= 0x7c00 16ORG2= 0x2000 17 18# Decide level of UFS support. 19BOOT2_UFS?= UFS1_AND_UFS2 20#BOOT2_UFS?= UFS2_ONLY 21#BOOT2_UFS?= UFS1_ONLY 22 23CFLAGS= -Os \ 24 -fno-guess-branch-probability \ 25 -fomit-frame-pointer \ 26 -fno-unit-at-a-time \ 27 -mno-align-long-strings \ 28 -mrtd \ 29 -mno-mmx -mno-3dnow -mno-sse -mno-sse2 -mno-sse3 \ 30 -D${BOOT2_UFS} \ 31 -DFLAGS=${BOOT_BOOT1_FLAGS} \ 32 -DSIOPRT=${BOOT_COMCONSOLE_PORT} \ 33 -DSIOFMT=${B2SIOFMT} \ 34 -DSIOSPD=${BOOT_COMCONSOLE_SPEED} \ 35 -I${.CURDIR}/../../common \ 36 -I${.CURDIR}/../btx/lib -I. \ 37 -Wall -Waggregate-return -Wbad-function-cast -Wcast-align \ 38 -Wmissing-declarations -Wmissing-prototypes -Wnested-externs \ 39 -Wpointer-arith -Wshadow -Wstrict-prototypes -Wwrite-strings 40 41LDFLAGS=-static -N --gc-sections 42 43# Pick up ../Makefile.inc early. 44.include <bsd.init.mk> 45 46CLEANFILES= boot 47 48boot: boot1 boot2 49 cat boot1 boot2 > boot 50 51CLEANFILES+= boot1 boot1.out boot1.o 52 53boot1: boot1.out 54 objcopy -S -O binary boot1.out ${.TARGET} 55 56boot1.out: boot1.o 57 ${LD} ${LDFLAGS} -e start -Ttext ${ORG1} -o ${.TARGET} boot1.o 58 59CLEANFILES+= boot2 boot2.ld boot2.ldr boot2.bin boot2.out boot2.o \ 60 boot2.s boot2.s.tmp boot2.h sio.o 61 62boot2: boot2.ld 63 @set -- `ls -l boot2.ld`; x=$$((7680-$$5)); \ 64 echo "$$x bytes available"; test $$x -ge 0 65 dd if=boot2.ld of=${.TARGET} obs=7680 conv=osync 66 67boot2.ld: boot2.ldr boot2.bin ${BTXKERN} 68 btxld -v -E ${ORG2} -f bin -b ${BTXKERN} -l boot2.ldr \ 69 -o ${.TARGET} -P 1 boot2.bin 70 71boot2.ldr: 72 dd if=/dev/zero of=${.TARGET} bs=276 count=1 73 74boot2.bin: boot2.out 75 objcopy -S -O binary boot2.out ${.TARGET} 76 77boot2.out: ${BTXCRT} boot2.o sio.o 78 ${LD} ${LDFLAGS} -Ttext ${ORG2} -o ${.TARGET} ${.ALLSRC} 79 80boot2.o: boot2.s 81 82SRCS= boot2.c boot2.h 83 84boot2.s: boot2.c boot2.h ${.CURDIR}/../../common/ufsread.c 85 ${CC} ${CFLAGS} -S -o boot2.s.tmp ${.CURDIR}/boot2.c 86 sed -e '/align/d' -e '/nop/d' < boot2.s.tmp > boot2.s 87 rm -f boot2.s.tmp 88 89boot2.h: boot1.out 90 ${NM} -t d ${.ALLSRC} | awk '/([0-9])+ T xread/ \ 91 { x = $$1 - ORG1; \ 92 printf("#define XREADORG %#x\n", REL1 + x) }' \ 93 ORG1=`printf "%d" ${ORG1}` \ 94 REL1=`printf "%d" ${REL1}` > ${.TARGET} 95 96.if ${MACHINE_ARCH} == "amd64" 97beforedepend boot2.s: machine 98CLEANFILES+= machine 99machine: 100 ln -sf ${.CURDIR}/../../../i386/include machine 101.endif 102 103.include <bsd.prog.mk> 104