Catch attempts to queue to unregistered ISRs
[dragonfly.git] / sys / boot / pc32 / boot2 / Makefile
CommitLineData
984263bc 1# $FreeBSD: src/sys/boot/i386/boot2/Makefile,v 1.16.2.5 2002/08/07 16:31:53 ru Exp $
53b3c2d0 2# $DragonFly: src/sys/boot/pc32/boot2/Makefile,v 1.3 2003/08/16 02:51:57 dillon Exp $
984263bc
MD
3
4PROG= boot2
5NOMAN=
6STRIP=
7BINDIR?= /boot
8BINMODE= 444
9CLEANFILES+= boot1 boot1.out boot1.o \
10 boot2.ldr boot2.bin boot2.ld boot2.out boot2.o boot2.h \
11 sio.o
12
13NM?= nm
14
15# A value of 0x80 enables LBA support.
16B1FLAGS= 0x80
17
18BOOT_COMCONSOLE_PORT?= 0x3f8
19BOOT_COMCONSOLE_SPEED?= 9600
20B2SIOFMT?= 0x3
21
22.if exists(${.OBJDIR}/../btx)
23BTX= ${.OBJDIR}/../btx
24.else
25BTX= ${.CURDIR}/../btx
26.endif
27
28ORG1= 0x7c00
29ORG2= 0x1000
30
53b3c2d0 31CFLAGS= -elf -I${.CURDIR}/../btx/lib -I. -I${.CURDIR}/../../.. \
984263bc
MD
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
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.h: boot1.out
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
56
57boot2: 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
63
64boot2.ldr:
65 dd if=/dev/zero of=${.TARGET} bs=512 count=1 2>/dev/null
66
67boot2.bin: boot2.out
68 objcopy -S -O binary boot2.out ${.TARGET}
69
70boot2.out: boot2.o sio.o
71 ${LD} ${LDFLAGS} -Ttext ${ORG2} -o ${.TARGET} \
72 ${BTX}/lib/crt0.o boot2.o sio.o
73
74boot2.o: boot2.h
75
76sio.o: sio.s
77 ${AS} ${AFLAGS} --defsym SIOPRT=${BOOT_COMCONSOLE_PORT} \
78 --defsym SIOFMT=${B2SIOFMT} \
79 --defsym SIOSPD=${BOOT_COMCONSOLE_SPEED} \
80 ${.IMPSRC} -o ${.TARGET}
81
82install:
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
87
88.include <bsd.prog.mk>