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