1 # $FreeBSD: src/sys/boot/i386/boot2/Makefile,v 1.16.2.5 2002/08/07 16:31:53 ru Exp $
2 # $DragonFly: src/sys/boot/i386/boot2/Attic/Makefile,v 1.2 2003/06/17 04:28:18 dillon Exp $
9 CLEANFILES+= boot1 boot1.out boot1.o \
10 boot2.ldr boot2.bin boot2.ld boot2.out boot2.o boot2.h \
15 # A value of 0x80 enables LBA support.
18 BOOT_COMCONSOLE_PORT?= 0x3f8
19 BOOT_COMCONSOLE_SPEED?= 9600
22 .if exists(${.OBJDIR}/../btx)
23 BTX= ${.OBJDIR}/../btx
25 BTX= ${.CURDIR}/../btx
31 CFLAGS= -elf -I${.CURDIR}/../btx/lib -I. \
32 -Os -fno-builtin -fforce-addr -fdata-sections \
33 -malign-functions=0 -malign-jumps=0 -malign-loops=0 -mrtd \
34 -mpreferred-stack-boundary=2 \
35 -Wall -Waggregate-return -Wbad-function-cast -Wcast-align \
36 -Wmissing-declarations -Wmissing-prototypes -Wnested-externs \
37 -Wpointer-arith -Wshadow -Wstrict-prototypes -Wwrite-strings
39 LDFLAGS=-nostdlib -static -N
44 objcopy -S -O binary boot1.out ${.TARGET}
47 ${LD} ${LDFLAGS} -e start -Ttext ${ORG1} -o ${.TARGET} boot1.o
50 ${AS} ${AFLAGS} --defsym FLAGS=${B1FLAGS} ${.IMPSRC} -o ${.TARGET}
53 ${NM} -t d ${.ALLSRC} | awk '/([0-9])+ T xread/ \
54 { x = $$1 - ORG1; printf("#define XREADORG 0x7%x\n", x) }' \
55 ORG1=`printf "%d" ${ORG1}` > boot2.h
57 boot2: boot2.ldr boot2.bin ${BTX}/btx/btx
58 btxld -v -E ${ORG2} -f bin -b ${BTX}/btx/btx -l boot2.ldr \
59 -o boot2.ld -P 1 boot2.bin
60 @ls -l boot2.ld | awk '{ x = 7680 - $$5; \
61 print x " bytes available"; if (x < 0) exit 1 }'
62 dd if=boot2.ld of=${.TARGET} obs=7680 conv=osync 2>/dev/null
65 dd if=/dev/zero of=${.TARGET} bs=512 count=1 2>/dev/null
68 objcopy -S -O binary boot2.out ${.TARGET}
70 boot2.out: boot2.o sio.o
71 ${LD} ${LDFLAGS} -Ttext ${ORG2} -o ${.TARGET} \
72 ${BTX}/lib/crt0.o boot2.o sio.o
77 ${AS} ${AFLAGS} --defsym SIOPRT=${BOOT_COMCONSOLE_PORT} \
78 --defsym SIOFMT=${B2SIOFMT} \
79 --defsym SIOSPD=${BOOT_COMCONSOLE_SPEED} \
80 ${.IMPSRC} -o ${.TARGET}
83 ${INSTALL} -o ${BINOWN} -g ${BINGRP} -m ${BINMODE} \
84 boot1 ${DESTDIR}${BINDIR}/boot1
85 ${INSTALL} -o ${BINOWN} -g ${BINGRP} -m ${BINMODE} \
86 boot2 ${DESTDIR}${BINDIR}/boot2
88 .include <bsd.prog.mk>