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