]> CyberLeo.Net >> Repos - FreeBSD/FreeBSD.git/blob - stand/i386/zfsboot/Makefile
Avoid using non-portable dd conv=osync option
[FreeBSD/FreeBSD.git] / stand / i386 / zfsboot / Makefile
1 # $FreeBSD$
2
3 .include <bsd.init.mk>
4
5 .PATH:          ${BOOTSRC}/i386/boot2 ${BOOTSRC}/i386/common ${SASRC}
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         -DZFS -DBOOT2 \
21         -DSIOPRT=${BOOT_COMCONSOLE_PORT} \
22         -DSIOFMT=${B2SIOFMT} \
23         -DSIOSPD=${BOOT_COMCONSOLE_SPEED} \
24         -I${LDRSRC} \
25         -I${BOOTSRC}/i386/common \
26         -I${BOOTSRC}/i386 \
27         -I${ZFSSRC} \
28         -I${SYSDIR}/crypto/skein \
29         -I${SYSDIR}/cddl/boot/zfs \
30         -I${SYSDIR}/cddl/contrib/opensolaris/uts/common \
31         -I${SYSDIR}/cddl/contrib/opensolaris/common/lz4 \
32         -I${BOOTSRC}/i386/boot2 \
33         -Wall -Waggregate-return -Wbad-function-cast -Wno-cast-align \
34         -Wmissing-declarations -Wmissing-prototypes -Wnested-externs \
35         -Wpointer-arith -Wshadow -Wstrict-prototypes -Wwrite-strings
36
37 CFLAGS.gcc+=    --param max-inline-insns-single=100
38
39 LD_FLAGS+=${LD_FLAGS_BIN}
40
41 CLEANFILES+=    zfsboot
42
43 zfsboot: zfsboot1 zfsboot2
44         cat zfsboot1 zfsboot2 > zfsboot
45
46 CLEANFILES+=    zfsboot1 zfsldr.out zfsldr.o
47
48 zfsboot1: zfsldr.out
49         ${OBJCOPY} -S -O binary zfsldr.out ${.TARGET}
50
51 zfsldr.out: zfsldr.o
52         ${LD} ${LD_FLAGS} -e start --defsym ORG=${ORG1} -T ${LDSCRIPT} -o ${.TARGET} zfsldr.o
53
54 CLEANFILES+=    zfsboot2 zfsboot.ld zfsboot.ldr zfsboot.bin zfsboot.out \
55                 zfsboot.o zfsboot.s zfsboot.s.tmp sio.o cons.o drv.o
56
57 # We currently allow 256k bytes for zfsboot - in practice it could be
58 # any size up to 3.5Mb but keeping it fixed size simplifies zfsldr.
59
60 BOOT2SIZE=      262144
61
62 zfsboot2: zfsboot.ld
63         @set -- `ls -l ${.ALLSRC}`; x=$$((${BOOT2SIZE}-$$5)); \
64             echo "$$x bytes available"; test $$x -ge 0
65         ${DD} if=${.ALLSRC} of=${.TARGET} bs=${BOOT2SIZE} conv=sync
66
67 zfsboot.ld: zfsboot.ldr zfsboot.bin ${BTXKERN}
68         btxld -v -E ${ORG2} -f bin -b ${BTXKERN} -l zfsboot.ldr \
69             -o ${.TARGET} -P 1 zfsboot.bin
70
71 zfsboot.ldr:
72         cp /dev/null ${.TARGET}
73
74 zfsboot.bin: zfsboot.out
75         ${OBJCOPY} -S -O binary zfsboot.out ${.TARGET}
76
77 zfsboot.out: ${BTXCRT} zfsboot.o sio.o drv.o cons.o
78         ${LD} ${LD_FLAGS} --defsym ORG=${ORG2} -T ${LDSCRIPT} -o ${.TARGET} ${.ALLSRC} ${LIBSA32}
79
80 SRCS=   zfsboot.c
81
82 .include <bsd.prog.mk>