]> CyberLeo.Net >> Repos - FreeBSD/releng/9.0.git/blob - sys/boot/i386/zfsboot/Makefile
Copy stable/9 to releng/9.0 as part of the FreeBSD 9.0-RELEASE release
[FreeBSD/releng/9.0.git] / sys / boot / i386 / zfsboot / Makefile
1 # $FreeBSD$
2
3 .PATH:          ${.CURDIR}/../boot2 ${.CURDIR}/../common ${.CURDIR}/../../common
4
5 FILES=          zfsboot
6
7 NM?=            nm
8
9 BOOT_COMCONSOLE_PORT?= 0x3f8
10 BOOT_COMCONSOLE_SPEED?= 9600
11 B2SIOFMT?=      0x3
12
13 REL1=   0x700
14 ORG1=   0x7c00
15 ORG2=   0x2000
16
17 CFLAGS= -DBOOTPROG=\"zfsboot\" \
18         -O1 \
19         -DBOOT2 \
20         -DSIOPRT=${BOOT_COMCONSOLE_PORT} \
21         -DSIOFMT=${B2SIOFMT} \
22         -DSIOSPD=${BOOT_COMCONSOLE_SPEED} \
23         -I${.CURDIR}/../../common \
24         -I${.CURDIR}/../common \
25         -I${.CURDIR}/../../zfs \
26         -I${.CURDIR}/../../../cddl/boot/zfs \
27         -I${.CURDIR}/../btx/lib -I. \
28         -I${.CURDIR}/../boot2 \
29         -Wall -Waggregate-return -Wbad-function-cast -Wcast-align \
30         -Wmissing-declarations -Wmissing-prototypes -Wnested-externs \
31         -Wpointer-arith -Wshadow -Wstrict-prototypes -Wwrite-strings \
32         -Winline --param max-inline-insns-single=100
33
34 .if ${CC:T:Mclang} == "clang"
35 # XXX: clang integrated-as doesn't grok .codeNN directives yet
36 CFLAGS+=        ${.IMPSRC:T:Mzfsldr.S:C/^.+$/-no-integrated-as/}
37 .endif
38
39 LDFLAGS=-static -N --gc-sections
40
41 # Pick up ../Makefile.inc early.
42 .include <bsd.init.mk>
43
44 CLEANFILES=     zfsboot
45
46 zfsboot: zfsboot1 zfsboot2
47         cat zfsboot1 zfsboot2 > zfsboot
48
49 CLEANFILES+=    zfsboot1 zfsldr.out zfsldr.o
50
51 zfsboot1: zfsldr.out
52         objcopy -S -O binary zfsldr.out ${.TARGET}
53
54 zfsldr.out: zfsldr.o
55         ${LD} ${LDFLAGS} -e start -Ttext ${ORG1} -o ${.TARGET} zfsldr.o
56
57 CLEANFILES+=    zfsboot2 zfsboot.ld zfsboot.ldr zfsboot.bin zfsboot.out \
58                 zfsboot.o zfsboot.s zfsboot.s.tmp sio.o cons.o drv.o util.o
59
60 # We currently allow 65536 bytes for zfsboot - in practice it could be
61 # any size up to 3.5Mb but keeping it fixed size simplifies zfsldr.
62
63 BOOT2SIZE=      65536
64
65 zfsboot2: zfsboot.ld
66         @set -- `ls -l zfsboot.ld`; x=$$((${BOOT2SIZE}-$$5)); \
67             echo "$$x bytes available"; test $$x -ge 0
68         dd if=zfsboot.ld of=${.TARGET} obs=${BOOT2SIZE} conv=osync
69
70 zfsboot.ld: zfsboot.ldr zfsboot.bin ${BTXKERN}
71         btxld -v -E ${ORG2} -f bin -b ${BTXKERN} -l zfsboot.ldr \
72             -o ${.TARGET} -P 1 zfsboot.bin
73
74 zfsboot.ldr:
75         cp /dev/null ${.TARGET}
76
77 zfsboot.bin: zfsboot.out
78         objcopy -S -O binary zfsboot.out ${.TARGET}
79
80 zfsboot.out: ${BTXCRT} zfsboot.o sio.o drv.o cons.o util.o
81         ${LD} ${LDFLAGS} -Ttext ${ORG2} -o ${.TARGET} ${.ALLSRC} ${LIBSTAND}
82
83 SRCS=   zfsboot.c
84
85 .if ${MACHINE_CPUARCH} == "amd64"
86 beforedepend zfsboot.o: machine
87 CLEANFILES+=    machine
88 machine:
89         ln -sf ${.CURDIR}/../../../i386/include machine
90 .endif
91
92 .include <bsd.prog.mk>