diff --git a/sys/boot/Makefile.amd64 b/sys/boot/Makefile.amd64 index c8da2478d90..08f9f50d88d 100644 --- a/sys/boot/Makefile.amd64 +++ b/sys/boot/Makefile.amd64 @@ -1,16 +1,16 @@ # $FreeBSD$ -SUBDIR+= efi SUBDIR+= libsa32 -SUBDIR+= zfs +SUBDIR+= zfs zfs32 +.if ${MK_FORTH} != "no" +SUBDIR+= ficl32 +.endif + +SUBDIR+= efi SUBDIR+= userboot .if ${LOADER_GELI_SUPPORT:Uyes} == "yes" SUBDIR+= geli .endif -.if ${MK_FORTH} != "no" -SUBDIR+= ficl32 -.endif - SUBDIR+= i386 diff --git a/sys/boot/Makefile.arm b/sys/boot/Makefile.arm index bb0e01cb5fc..387b77bd344 100644 --- a/sys/boot/Makefile.arm +++ b/sys/boot/Makefile.arm @@ -3,5 +3,8 @@ .if ${MK_FDT} != "no" SUBDIR+= fdt .endif +.if ${MK_ZFS} != "no" +SUBDIR+= zfs +.endif SUBDIR+= efi uboot diff --git a/sys/boot/Makefile.arm64 b/sys/boot/Makefile.arm64 index 116e903020f..bf0fd3988c1 100644 --- a/sys/boot/Makefile.arm64 +++ b/sys/boot/Makefile.arm64 @@ -3,5 +3,8 @@ .if ${MK_FDT} != "no" SUBDIR+= fdt .endif +.if ${MK_ZFS} != "no" +SUBDIR+= zfs +.endif SUBDIR+= efi diff --git a/sys/boot/Makefile.i386 b/sys/boot/Makefile.i386 index 90c3e8ba6b6..a5c6f673477 100644 --- a/sys/boot/Makefile.i386 +++ b/sys/boot/Makefile.i386 @@ -1,9 +1,9 @@ # $FreeBSD$ -SUBDIR+= efi SUBDIR+= libsa32 -SUBDIR+= zfs - .if ${LOADER_GELI_SUPPORT:Uyes} == "yes" SUBDIR+= geli .endif +SUBDIR+= zfs + +SUBDIR+= efi diff --git a/sys/boot/defs.mk b/sys/boot/defs.mk index 0c17d38e893..0115f4bc09b 100644 --- a/sys/boot/defs.mk +++ b/sys/boot/defs.mk @@ -15,6 +15,7 @@ LDRSRC= ${BOOTSRC}/common SASRC= ${BOOTSRC}/libsa SYSDIR= ${SRCTOP}/sys UBOOTSRC= ${BOOTSRC}/uboot +ZFSSRC= ${BOOTSRC}/zfs BOOTOBJ= ${OBJTOP}/sys/boot diff --git a/sys/boot/efi/boot1/Makefile b/sys/boot/efi/boot1/Makefile index 0d69148dfbd..c6b27d8ade0 100644 --- a/sys/boot/efi/boot1/Makefile +++ b/sys/boot/efi/boot1/Makefile @@ -26,21 +26,15 @@ CWARNFLAGS.zfs_module.c += -Wno-missing-prototypes CWARNFLAGS.zfs_module.c += -Wno-sign-compare CWARNFLAGS.zfs_module.c += -Wno-unused-parameter CWARNFLAGS.zfs_module.c += -Wno-unused-function -CWARNFLAGS.skein.c += -Wno-cast-align -.if ${COMPILER_TYPE} == "clang" -CWARNFLAGS.skein.c += -Wno-missing-variable-declarations -.else if ${COMPILER_TYPE} == "gcc" -CWARNFLAGS.skein.c += -Wno-missing-declarations -.endif # architecture-specific loader code SRCS= boot1.c self_reloc.c start.S ufs_module.c .if ${MK_ZFS} != "no" SRCS+= zfs_module.c -SRCS+= skein.c skein_block.c -# Do not unroll skein loops, reduce code size -CFLAGS+= -DSKEIN_LOOP=111 -.PATH: ${SYSDIR}/crypto/skein +CFLAGS+= -I${ZFSSRC} +CFLAGS+= -I${SYSDIR}/cddl/boot/zfs +CFLAGS+= -DEFI_ZFS_BOOT +LIBZFSBOOT= ${BOOTOBJ}/zfs/libzfsboot.a .endif .if ${COMPILER_TYPE} == "gcc" && ${COMPILER_VERSION} > 40201 @@ -57,13 +51,6 @@ CFLAGS+= -DEFI_UFS_BOOT CFLAGS+= -DEFI_DEBUG .endif -.if ${MK_ZFS} != "no" -CFLAGS+= -I${BOOTSRC}/zfs/ -CFLAGS+= -I${SYSDIR}/cddl/boot/zfs/ -CFLAGS+= -I${SYSDIR}/crypto/skein -CFLAGS+= -DEFI_ZFS_BOOT -.endif - # Always add MI sources and REGULAR efi loader bits .PATH: ${EFISRC}/loader/arch/${MACHINE} .PATH: ${EFISRC}/loader @@ -91,8 +78,8 @@ LIBEFI= ${BOOTOBJ}/efi/libefi/libefi.a # __aeabi_* (arm) or __divdi3 (i386). # as well as required string and memory functions for all platforms. # -DPADD+= ${LIBEFI} ${LIBSA} -LDADD+= ${LIBEFI} ${LIBSA} +DPADD+= ${LIBEFI} ${LIBZFSBOOT} ${LIBSA} +LDADD+= ${LIBEFI} ${LIBZFSBOOT} ${LIBSA} DPADD+= ${LDSCRIPT} diff --git a/sys/boot/efi/libefi/Makefile b/sys/boot/efi/libefi/Makefile index 8deac5243ac..99fe2bde2f9 100644 --- a/sys/boot/efi/libefi/Makefile +++ b/sys/boot/efi/libefi/Makefile @@ -38,9 +38,7 @@ CFLAGS+= -I${SYSDIR} CFLAGS+= -I${EFIINC} CFLAGS+= -I${EFIINCMD} .if ${MK_ZFS} != "no" -CFLAGS+= -I${BOOTSRC}/zfs -CFLAGS+= -I${SYSDIR}/cddl/boot/zfs -CFLAGS+= -I${SYSDIR}/crypto/skein +CFLAGS+= -I${ZFSSRC} CFLAGS+= -DEFI_ZFS_BOOT .endif diff --git a/sys/boot/efi/loader/Makefile b/sys/boot/efi/loader/Makefile index d68dac3955e..d4eb8d8d55e 100644 --- a/sys/boot/efi/loader/Makefile +++ b/sys/boot/efi/loader/Makefile @@ -29,17 +29,9 @@ SRCS= autoload.c \ vers.c .if ${MK_ZFS} != "no" -SRCS+= zfs.c -.PATH: ${BOOTSRC}/zfs -SRCS+= skein.c skein_block.c -# Do not unroll skein loops, reduce code size -CFLAGS+= -DSKEIN_LOOP=111 -.PATH: ${SYSDIR}/crypto/skein - -# Disable warnings that are currently incompatible with the zfs boot code -CWARNFLAGS.zfs.c+= -Wno-sign-compare -CWARNFLAGS.zfs.c+= -Wno-array-bounds -CWARNFLAGS.zfs.c+= -Wno-missing-prototypes +LIBZFSBOOT= ${BOOTOBJ}/zfs/libzfsboot.a +CFLAGS+= -I${ZFSSRC} +CFLAGS+= -DEFI_ZFS_BOOT .endif .if ${COMPILER_TYPE} == "gcc" && ${COMPILER_VERSION} > 40201 @@ -65,12 +57,6 @@ CFLAGS+= -I${EFISRC}/include/${MACHINE} CFLAGS+= -I${SYSDIR}/contrib/dev/acpica/include CFLAGS+= -I${SYSDIR} CFLAGS+= -I${BOOTSRC}/i386/libi386 -.if ${MK_ZFS} != "no" -CFLAGS+= -I${BOOTSRC}/zfs -CFLAGS+= -I${SYSDIR}/cddl/boot/zfs -CFLAGS+= -I${SYSDIR}/crypto/skein -CFLAGS+= -DEFI_ZFS_BOOT -.endif CFLAGS+= -DNO_PCI -DEFI .if !defined(BOOT_HIDE_SERIAL_NUMBERS) @@ -142,9 +128,9 @@ loader.efi: ${PROG} LIBEFI= ${BOOTOBJ}/efi/libefi/libefi.a -DPADD= ${LIBFICL} ${LIBEFI} ${LIBFDT} ${LIBEFI_FDT} ${LIBSA} \ +DPADD= ${LIBFICL} ${LIBEFI} ${LIBFDT} ${LIBEFI_FDT} ${LIBZFSBOOT} ${LIBSA} \ ${LDSCRIPT} -LDADD= ${LIBFICL} ${LIBEFI} ${LIBFDT} ${LIBEFI_FDT} ${LIBSA} +LDADD= ${LIBFICL} ${LIBEFI} ${LIBFDT} ${LIBEFI_FDT} ${LIBZFSBOOT} ${LIBSA} .include diff --git a/sys/boot/i386/gptzfsboot/Makefile b/sys/boot/i386/gptzfsboot/Makefile index c2bd133211b..c2da080e39f 100644 --- a/sys/boot/i386/gptzfsboot/Makefile +++ b/sys/boot/i386/gptzfsboot/Makefile @@ -4,7 +4,7 @@ .PATH: ${BOOTSRC}/i386/boot2 ${BOOTSRC}/i386/gptboot \ ${BOOTSRC}/i386/zfsboot ${BOOTSRC}/i386/common \ - ${SYSDIR}/crypto/skein ${SASRC} + ${SASRC} FILES= gptzfsboot MAN= gptzfsboot.8 @@ -27,9 +27,8 @@ CFLAGS+=-DBOOTPROG=\"gptzfsboot\" \ -DSIOSPD=${BOOT_COMCONSOLE_SPEED} \ -I${LDRSRC} \ -I${BOOTSRC}/i386/common \ - -I${BOOTSRC}/zfs \ + -I${ZFSSRC} \ -I${SYSDIR}/cddl/boot/zfs \ - -I${SYSDIR}/crypto/skein \ -I${BOOTSRC}/i386/btx/lib -I. \ -I${BOOTSRC}/i386/boot2 \ -I${SYSDIR} \ @@ -45,8 +44,11 @@ NO_WCAST_ALIGN= CFLAGS+= -Wno-tentative-definition-incomplete-type .endif -# Do not unroll skein loops, reduce code size -CFLAGS+= -DSKEIN_LOOP=111 +.if ${MACHINE} == "amd64" +LIBZFSBOOT=${BOOTOBJ}/zfs32/libzfsboot.a +.else +LIBZFSBOOT=${BOOTOBJ}/zfs/libzfsboot.a +.endif .if ${LOADER_GELI_SUPPORT:Uyes} == "yes" CFLAGS+= -DLOADER_GELI_SUPPORT @@ -75,16 +77,16 @@ gptldr.out: gptldr.o ${LD} ${LD_FLAGS} -e start -Ttext ${ORG1} -o ${.TARGET} gptldr.o CLEANFILES+= gptzfsboot.bin gptzfsboot.out zfsboot.o sio.o cons.o \ - drv.o gpt.o util.o skein.o skein_block.o ${OPENCRYPTO_XTS} + drv.o gpt.o util.o ${OPENCRYPTO_XTS} gptzfsboot.bin: gptzfsboot.out ${OBJCOPY} -S -O binary gptzfsboot.out ${.TARGET} gptzfsboot.out: ${BTXCRT} zfsboot.o sio.o gpt.o drv.o cons.o util.o \ - skein.o skein_block.o ${OPENCRYPTO_XTS} - ${LD} ${LD_FLAGS} -Ttext ${ORG2} -o ${.TARGET} ${.ALLSRC} ${LIBGELIBOOT} ${LIBSA32} + ${OPENCRYPTO_XTS} + ${LD} ${LD_FLAGS} -Ttext ${ORG2} -o ${.TARGET} ${.ALLSRC} ${LIBGELIBOOT} ${LIBZFSBOOT} ${LIBSA32} -zfsboot.o: ${BOOTSRC}/zfs/zfsimpl.c +zfsboot.o: ${ZFSSRC}/zfsimpl.c .if ${MACHINE_CPUARCH} == "amd64" beforedepend zfsboot.o: machine diff --git a/sys/boot/i386/libi386/Makefile b/sys/boot/i386/libi386/Makefile index 8c89afd7a1e..e998d6d6b0b 100644 --- a/sys/boot/i386/libi386/Makefile +++ b/sys/boot/i386/libi386/Makefile @@ -11,8 +11,8 @@ SRCS= biosacpi.c bioscd.c biosdisk.c biosmem.c biospnp.c \ elf64_freebsd.c multiboot.c multiboot_tramp.S relocater_tramp.S \ i386_copy.c i386_module.c nullconsole.c pxe.c pxetramp.s \ smbios.c time.c vidconsole.c amd64_tramp.S spinconsole.c -.PATH: ${BOOTSRC}/zfs -SRCS+= devicename_stubs.c +.PATH: ${ZFSSRC} +SRCS+= devicename_stubs.c BOOT_COMCONSOLE_PORT?= 0x3f8 CFLAGS+= -DCOMPORT=${BOOT_COMCONSOLE_PORT} diff --git a/sys/boot/i386/loader/Makefile b/sys/boot/i386/loader/Makefile index 65e77214837..bf9256873f9 100644 --- a/sys/boot/i386/loader/Makefile +++ b/sys/boot/i386/loader/Makefile @@ -31,8 +31,12 @@ LIBFIREWIRE= ${BOOTSRC}/i386/libfirewire/libfirewire.a # Set by zfsloader Makefile .if defined(LOADER_ZFS_SUPPORT) CFLAGS+= -DLOADER_ZFS_SUPPORT +.if ${MACHINE} == "amd64" +LIBZFSBOOT= ${BOOTOBJ}/zfs32/libzfsboot.a +.else LIBZFSBOOT= ${BOOTOBJ}/zfs/libzfsboot.a .endif +.endif # Include bcache code. HAVE_BCACHE= yes diff --git a/sys/boot/i386/zfsboot/Makefile b/sys/boot/i386/zfsboot/Makefile index 0d424d5514c..2a9804a6f85 100644 --- a/sys/boot/i386/zfsboot/Makefile +++ b/sys/boot/i386/zfsboot/Makefile @@ -4,8 +4,7 @@ LOADER_GELI_SUPPORT=no .include -.PATH: ${BOOTSRC}/i386/boot2 ${BOOTSRC}/i386/common \ - ${SYSDIR}/crypto/skein ${SASRC} +.PATH: ${BOOTSRC}/i386/boot2 ${BOOTSRC}/i386/common ${SASRC} FILES= zfsboot MAN= zfsboot.8 @@ -29,9 +28,8 @@ CFLAGS+=-DBOOTPROG=\"zfsboot\" \ -I${LDRSRC} \ -I${BOOTSRC}/i386/common \ -I${BOOTSRC}/i386 \ - -I${BOOTSRC}/zfs \ + -I${ZFSSRC} \ -I${SYSDIR}/cddl/boot/zfs \ - -I${SYSDIR}/crypto/skein \ -I${BTXLIB} -I. \ -I${BOOTSRC}/i386/boot2 \ -Wall -Waggregate-return -Wbad-function-cast -Wno-cast-align \ @@ -40,8 +38,11 @@ CFLAGS+=-DBOOTPROG=\"zfsboot\" \ -Winline CFLAGS.gcc+= --param max-inline-insns-single=100 -# Do not unroll skein loops, reduce code size -CFLAGS+= -DSKEIN_LOOP=111 +.if ${MACHINE} == "amd64" +LIBZFSBOOT=${BOOTOBJ}/zfs32/libzfsboot.a +.else +LIBZFSBOOT=${BOOTOBJ}/zfs/libzfsboot.a +.endif LD_FLAGS+=${LD_FLAGS_BIN} @@ -59,8 +60,7 @@ zfsldr.out: zfsldr.o ${LD} ${LD_FLAGS} -e start -Ttext ${ORG1} -o ${.TARGET} zfsldr.o CLEANFILES+= zfsboot2 zfsboot.ld zfsboot.ldr zfsboot.bin zfsboot.out \ - zfsboot.o zfsboot.s zfsboot.s.tmp sio.o cons.o drv.o util.o \ - skein.o skein_block.o + zfsboot.o zfsboot.s zfsboot.s.tmp sio.o cons.o drv.o util.o # We currently allow 128k bytes for zfsboot - in practice it could be # any size up to 3.5Mb but keeping it fixed size simplifies zfsldr. @@ -82,8 +82,8 @@ zfsboot.ldr: zfsboot.bin: zfsboot.out ${OBJCOPY} -S -O binary zfsboot.out ${.TARGET} -zfsboot.out: ${BTXCRT} zfsboot.o sio.o drv.o cons.o util.o skein.o skein_block.o - ${LD} ${LD_FLAGS} -Ttext ${ORG2} -o ${.TARGET} ${.ALLSRC} ${LIBSA32} +zfsboot.out: ${BTXCRT} zfsboot.o sio.o drv.o cons.o util.o + ${LD} ${LD_FLAGS} -Ttext ${ORG2} -o ${.TARGET} ${.ALLSRC} ${LIBZFSBOOT} ${LIBSA32} SRCS= zfsboot.c diff --git a/sys/boot/ofw/libofw/Makefile b/sys/boot/ofw/libofw/Makefile index 6a8c6842fc9..0af80aafa54 100644 --- a/sys/boot/ofw/libofw/Makefile +++ b/sys/boot/ofw/libofw/Makefile @@ -8,7 +8,7 @@ INTERNALLIB= SRCS= devicename.c elf_freebsd.c ofw_console.c ofw_copy.c ofw_disk.c \ ofw_memory.c ofw_module.c ofw_net.c ofw_reboot.c \ ofw_time.c openfirm.c -.PATH: ${BOOTSRC}/zfs +.PATH: ${ZFSSRC} SRCS+= devicename_stubs.c # Pick up the bootstrap header for some interface items diff --git a/sys/boot/sparc64/loader/Makefile b/sys/boot/sparc64/loader/Makefile index a1e01018af3..c5fc902f009 100644 --- a/sys/boot/sparc64/loader/Makefile +++ b/sys/boot/sparc64/loader/Makefile @@ -30,7 +30,7 @@ CFLAGS+= -DLOADER_DEBUG .endif .if ${LOADER_ZFS_SUPPORT} == "yes" CFLAGS+= -DLOADER_ZFS_SUPPORT -CFLAGS+= -I${BOOTSRC}/zfs +CFLAGS+= -I${ZFSSRC} CFLAGS+= -I${SYSDIR}/cddl/boot/zfs LIBZFSBOOT= ${BOOTOBJ}/zfs/libzfsboot.a .endif diff --git a/sys/boot/userboot/Makefile b/sys/boot/userboot/Makefile index b0a53777791..0a53a217dc1 100644 --- a/sys/boot/userboot/Makefile +++ b/sys/boot/userboot/Makefile @@ -2,7 +2,7 @@ .include -SUBDIR= test zfs userboot +SUBDIR= test userboot .include diff --git a/sys/boot/userboot/userboot/Makefile b/sys/boot/userboot/userboot/Makefile index 68ee77c1561..aea362d88b9 100644 --- a/sys/boot/userboot/userboot/Makefile +++ b/sys/boot/userboot/userboot/Makefile @@ -47,7 +47,7 @@ NEWVERSWHAT= "User boot" ${MACHINE_CPUARCH} .if ${MK_ZFS} != "no" CFLAGS+= -DUSERBOOT_ZFS_SUPPORT -LIBZFSBOOT= ${BOOTOBJ}/userboot/zfs/libzfsboot.a +LIBZFSBOOT= ${BOOTOBJ}/zfs/libzfsboot.a .endif # Always add MI sources diff --git a/sys/boot/userboot/zfs/Makefile b/sys/boot/userboot/zfs/Makefile deleted file mode 100644 index e39db54d1dc..00000000000 --- a/sys/boot/userboot/zfs/Makefile +++ /dev/null @@ -1,22 +0,0 @@ -# $FreeBSD$ - -.include - -.PATH: ${BOOTSRC}/zfs ${SYSDIR}/crypto/skein -LIB= zfsboot -INTERNALLIB= - -SRCS+= zfs.c skein.c skein_block.c - -# Do not unroll skein loops, reduce code size -CFLAGS+= -DSKEIN_LOOP=111 - -CFLAGS+= -I${LDRSRC} -I${SYSDIR} -I. -CFLAGS+= -I${SASRC} -CFLAGS+= -I${SYSDIR}/cddl/boot/zfs -CFLAGS+= -I${SYSDIR}/crypto/skein - -CFLAGS+= -ffreestanding -fPIC -CFLAGS+= -Wformat -Wall - -.include diff --git a/sys/boot/userboot/zfs/Makefile.depend b/sys/boot/userboot/zfs/Makefile.depend deleted file mode 100644 index 18be76b0cb6..00000000000 --- a/sys/boot/userboot/zfs/Makefile.depend +++ /dev/null @@ -1,13 +0,0 @@ -# $FreeBSD$ -# Autogenerated - do NOT edit! - -DIRDEPS = \ - include \ - include/xlocale \ - - -.include - -.if ${DEP_RELDIR} == ${_DEP_RELDIR} -# local dependencies - needed for -jN in clean tree -.endif diff --git a/sys/boot/zfs/Makefile b/sys/boot/zfs/Makefile index 0125a3c7b54..24d0773479d 100644 --- a/sys/boot/zfs/Makefile +++ b/sys/boot/zfs/Makefile @@ -5,9 +5,8 @@ LIB= zfsboot INTERNALLIB= -SRCS+= zfs.c - -SRCS+= skein.c skein_block.c +.PATH: ${ZFSSRC} +SRCS+= zfs.c skein.c skein_block.c # Do not unroll skein loops, reduce code size CFLAGS+= -DSKEIN_LOOP=111 .PATH: ${SYSDIR}/crypto/skein @@ -17,16 +16,17 @@ CFLAGS+= -I${LDRSRC} -I${SYSDIR} -I. CFLAGS+= -I${SYSDIR}/cddl/boot/zfs CFLAGS+= -I${SYSDIR}/crypto/skein -.if ${MACHINE_CPUARCH} == "i386" || ${MACHINE_CPUARCH} == "amd64" +.if ${MACHINE_CPUARCH} == "i386" || \ + (${MACHINE_CPUARCH} == "amd64" && defined(ZFS32)) CFLAGS+= -march=i386 .endif -.if ${MACHINE_CPUARCH} == "amd64" +.if ${MACHINE_CPUARCH} == "amd64" && defined(ZFS32) CFLAGS+= -m32 .endif CFLAGS+= -Wformat -Wall -.if ${MACHINE_CPUARCH} == "amd64" +.if ${MACHINE_CPUARCH} == "amd64" && defined(ZFS32) CLEANFILES+= machine machine: .NOMETA ln -sf ${SYSDIR}/i386/include machine @@ -35,7 +35,7 @@ machine: .NOMETA .include .include -.if ${MACHINE_CPUARCH} == "amd64" +.if ${MACHINE_CPUARCH} == "amd64" && defined(ZFS32) .if !exists(machine) beforedepend ${OBJS}: machine .endif