]> CyberLeo.Net >> Repos - FreeBSD/FreeBSD.git/blob - stand/i386/zfsboot/Makefile
loader: fix non-zfs build
[FreeBSD/FreeBSD.git] / stand / i386 / zfsboot / Makefile
1 # $FreeBSD$
2
3 .include <bsd.init.mk>
4
5 .PATH:          ${BOOTSRC}/i386/boot2 ${BOOTSRC}/i386/common ${BOOTSRC}/common
6
7 FILES=          zfsboot
8 MAN=            zfsboot.8
9
10 BOOT_COMCONSOLE_PORT?= 0x3f8
11 BOOT_COMCONSOLE_SPEED?= 9600
12 B2SIOFMT?=      0x3
13
14 REL1=   0x700
15 ORG1=   0x7c00
16 ORG2=   0x2000
17
18 CFLAGS+=-DBOOTPROG=\"zfsboot\" \
19         -O1 \
20         -DBOOT2 \
21         -DLOADER_GPT_SUPPORT \
22         -DLOADER_MBR_SUPPORT \
23         -DLOADER_ZFS_SUPPORT \
24         -DLOADER_UFS_SUPPORT \
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/libi386 \
31         -I${ZFSSRC} \
32         -I${SYSDIR}/crypto/skein \
33         -I${SYSDIR}/cddl/boot/zfs \
34         -I${SYSDIR}/contrib/openzfs/include \
35         -I${SYSDIR}/contrib/openzfs/include/os/freebsd/spl \
36         -I${SYSDIR}/contrib/openzfs/include/os/freebsd/zfs \
37         -I${SYSDIR}/cddl/contrib/opensolaris/common/lz4 \
38         -I${BOOTSRC}/i386/boot2 \
39         -Wall -Waggregate-return -Wbad-function-cast -Wno-cast-align \
40         -Wmissing-declarations -Wmissing-prototypes -Wnested-externs \
41         -Wpointer-arith -Wshadow -Wstrict-prototypes -Wwrite-strings
42
43 CFLAGS.part.c+= -DHAVE_MEMCPY -I${SRCTOP}/sys/contrib/zlib
44
45 CFLAGS.gcc+=    --param max-inline-insns-single=100
46
47 LD_FLAGS+=${LD_FLAGS_BIN}
48
49 CLEANFILES+=    zfsboot
50
51 zfsboot: zfsboot1 zfsboot2
52         cat zfsboot1 zfsboot2 > zfsboot
53
54 CLEANFILES+=    zfsboot1 zfsldr.out zfsldr.o
55
56 zfsboot1: zfsldr.out
57         ${OBJCOPY} -S -O binary zfsldr.out ${.TARGET}
58
59 zfsldr.out: zfsldr.o
60         ${LD} ${LD_FLAGS} -e start --defsym ORG=${ORG1} -T ${LDSCRIPT} -o ${.TARGET} zfsldr.o
61
62 OBJS=   zfsboot.o sio.o cons.o bcache.o devopen.o disk.o part.o zfs_cmd.o
63 CLEANFILES+=    zfsboot2 zfsboot.ld zfsboot.ldr zfsboot.bin zfsboot.out \
64                 ${OBJS}
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 # i386 standalone support library
72 LIBI386=        ${BOOTOBJ}/i386/libi386/libi386.a
73
74 zfsboot2: zfsboot.ld
75         @set -- `ls -l ${.ALLSRC}`; x=$$((${BOOT2SIZE}-$$5)); \
76             echo "$$x bytes available"; test $$x -ge 0
77         ${DD} if=${.ALLSRC} of=${.TARGET} bs=${BOOT2SIZE} conv=sync
78
79 zfsboot.ld: zfsboot.ldr zfsboot.bin ${BTXKERN}
80         btxld -v -E ${ORG2} -f bin -b ${BTXKERN} -l zfsboot.ldr \
81             -o ${.TARGET} -P 1 zfsboot.bin
82
83 zfsboot.ldr:
84         :> ${.TARGET}
85
86 zfsboot.bin: zfsboot.out
87         ${OBJCOPY} -S -O binary zfsboot.out ${.TARGET}
88
89 zfsboot.out: ${BTXCRT} ${OBJS}
90         ${LD} ${LD_FLAGS} --defsym ORG=${ORG2} -T ${LDSCRIPT} -o ${.TARGET} ${.ALLSRC} ${LIBI386} ${LIBSA32}
91
92 SRCS=   zfsboot.c
93
94 .include <bsd.prog.mk>