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