]> CyberLeo.Net >> Repos - FreeBSD/FreeBSD.git/blob - stand/i386/zfsboot/Makefile
Merge compiler-rt trunk r321414 to contrib/compiler-rt.
[FreeBSD/FreeBSD.git] / stand / i386 / zfsboot / Makefile
1 # $FreeBSD$
2
3 HAVE_GELI=yes
4
5 .include <bsd.init.mk>
6
7 .PATH:          ${BOOTSRC}/i386/boot2 ${BOOTSRC}/i386/common ${SASRC}
8
9 FILES=          zfsboot
10 MAN=            zfsboot.8
11
12 NM?=            nm
13
14 BOOT_COMCONSOLE_PORT?= 0x3f8
15 BOOT_COMCONSOLE_SPEED?= 9600
16 B2SIOFMT?=      0x3
17
18 REL1=   0x700
19 ORG1=   0x7c00
20 ORG2=   0x2000
21
22 CFLAGS+=-DBOOTPROG=\"zfsboot\" \
23         -O1 \
24         -DZFS -DBOOT2 \
25         -DSIOPRT=${BOOT_COMCONSOLE_PORT} \
26         -DSIOFMT=${B2SIOFMT} \
27         -DSIOSPD=${BOOT_COMCONSOLE_SPEED} \
28         -I${LDRSRC} \
29         -I${BOOTSRC}/i386/common \
30         -I${BOOTSRC}/i386 \
31         -I${ZFSSRC} \
32         -I${SYSDIR}/crypto/skein \
33         -I${SYSDIR}/cddl/boot/zfs \
34         -I${BTXLIB} \
35         -I${BOOTSRC}/i386/boot2 \
36         -Wall -Waggregate-return -Wbad-function-cast -Wno-cast-align \
37         -Wmissing-declarations -Wmissing-prototypes -Wnested-externs \
38         -Wpointer-arith -Wshadow -Wstrict-prototypes -Wwrite-strings \
39         -Winline
40
41 CFLAGS.gcc+=    --param max-inline-insns-single=100
42 .if ${MACHINE} == "amd64"
43 LIBZFSBOOT=${BOOTOBJ}/zfs32/libzfsboot.a
44 .else
45 LIBZFSBOOT=${BOOTOBJ}/zfs/libzfsboot.a
46 .endif
47
48 LD_FLAGS+=${LD_FLAGS_BIN}
49
50 CLEANFILES+=    zfsboot
51
52 zfsboot: zfsboot1 zfsboot2
53         cat zfsboot1 zfsboot2 > zfsboot
54
55 CLEANFILES+=    zfsboot1 zfsldr.out zfsldr.o
56
57 zfsboot1: zfsldr.out
58         ${OBJCOPY} -S -O binary zfsldr.out ${.TARGET}
59
60 zfsldr.out: zfsldr.o
61         ${LD} ${LD_FLAGS} -e start -Ttext ${ORG1} -o ${.TARGET} zfsldr.o
62
63 CLEANFILES+=    zfsboot2 zfsboot.ld zfsboot.ldr zfsboot.bin zfsboot.out \
64                 zfsboot.o zfsboot.s zfsboot.s.tmp sio.o cons.o drv.o
65
66 # We currently allow 256k bytes for zfsboot - in practice it could be
67 # any size up to 3.5Mb but keeping it fixed size simplifies zfsldr.
68
69 BOOT2SIZE=      262144
70
71 zfsboot2: zfsboot.ld
72         @set -- `ls -l ${.ALLSRC}`; x=$$((${BOOT2SIZE}-$$5)); \
73             echo "$$x bytes available"; test $$x -ge 0
74         ${DD} if=${.ALLSRC} of=${.TARGET} obs=${BOOT2SIZE} conv=osync
75
76 zfsboot.ld: zfsboot.ldr zfsboot.bin ${BTXKERN}
77         btxld -v -E ${ORG2} -f bin -b ${BTXKERN} -l zfsboot.ldr \
78             -o ${.TARGET} -P 1 zfsboot.bin
79
80 zfsboot.ldr:
81         cp /dev/null ${.TARGET}
82
83 zfsboot.bin: zfsboot.out
84         ${OBJCOPY} -S -O binary zfsboot.out ${.TARGET}
85
86 zfsboot.out: ${BTXCRT} zfsboot.o sio.o drv.o cons.o
87         ${LD} ${LD_FLAGS} -Ttext ${ORG2} -o ${.TARGET} ${.ALLSRC} ${LIBZFSBOOT} ${LIBGELIBOOT} ${LIBSA32}
88
89 SRCS=   zfsboot.c
90
91 .include <bsd.prog.mk>
92
93 # XXX: clang integrated-as doesn't grok .codeNN directives yet
94 CFLAGS.zfsldr.S=        ${CLANG_NO_IAS}