Remove LOADER_ZFS_SUPPORT as a Makefile variable

LOADER_ZFS_SUPPORT is entirely used to select whether or not to
support ZFS in the loader. But it's not a user-servicable part (MK_ZFS
is what's used for that) Change it to the more conventional HAVE_ZFS
and move the ZFS support code into loader.mk. In addition, only build
ZFS libraries and boot loaders when ZFS is enabled.

Sponsored by: Netflix
This commit is contained in:
Warner Losh 2017-11-10 23:54:31 +00:00
parent 1f9ecdf78f
commit 4e8fc5c539
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=325690
9 changed files with 30 additions and 26 deletions

View file

@ -1,7 +1,9 @@
# $FreeBSD$ # $FreeBSD$
SUBDIR+= libsa32 SUBDIR+= libsa32
.if ${MK_ZFS} != "no"
SUBDIR+= zfs zfs32 SUBDIR+= zfs zfs32
.endif
.if ${MK_FORTH} != "no" .if ${MK_FORTH} != "no"
SUBDIR+= ficl32 SUBDIR+= ficl32
.endif .endif

View file

@ -3,6 +3,8 @@
.if ${LOADER_GELI_SUPPORT:Uyes} == "yes" .if ${LOADER_GELI_SUPPORT:Uyes} == "yes"
SUBDIR+= geli SUBDIR+= geli
.endif .endif
.if ${MK_ZFS} != "no"
SUBDIR+= zfs SUBDIR+= zfs
.endif
SUBDIR+= efi SUBDIR+= efi

View file

@ -1,4 +1,6 @@
# $FreeBSD$ # $FreeBSD$
SUBDIR+= ofw SUBDIR+= ofw
.if ${MK_ZFS} != "no"
SUBDIR+= zfs SUBDIR+= zfs
.endif

View file

@ -21,6 +21,8 @@ INTERNALPROG=
NEWVERSWHAT?= "bootstrap loader" x86 NEWVERSWHAT?= "bootstrap loader" x86
VERSION_FILE= ${.CURDIR}/../loader/version VERSION_FILE= ${.CURDIR}/../loader/version
.PATH: ${BOOTSRC}/i386/loader
# architecture-specific loader code # architecture-specific loader code
SRCS= main.c conf.c vers.c chain.c SRCS= main.c conf.c vers.c chain.c
@ -30,16 +32,6 @@ CFLAGS+= -DLOADER_FIREWIRE_SUPPORT
LIBFIREWIRE= ${BOOTOBJ}/i386/libfirewire/libfirewire.a LIBFIREWIRE= ${BOOTOBJ}/i386/libfirewire/libfirewire.a
.endif .endif
# 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. # Include bcache code.
HAVE_BCACHE= yes HAVE_BCACHE= yes

View file

@ -1,15 +1,10 @@
# $FreeBSD$ # $FreeBSD$
LOADER_ZFS_SUPPORT=yes
.include <bsd.init.mk>
.PATH: ${BOOTSRC}/i386/loader
LOADER= zfsloader LOADER= zfsloader
NEWVERSWHAT= "ZFS enabled bootstrap loader" x86 NEWVERSWHAT= "ZFS enabled bootstrap loader" x86
LOADER_ONLY= yes LOADER_ONLY= yes
MAN= HAVE_ZFS= yes
.include <bsd.init.mk>
.include "${BOOTSRC}/i386/loader/Makefile" .include "${BOOTSRC}/i386/loader/Makefile"

View file

@ -69,6 +69,19 @@ CFLAGS+= -DBOOT_PROMPT_123
SRCS+= install.c SRCS+= install.c
.endif .endif
.if defined(HAVE_ZFS)
CFLAGS+= -DLOADER_ZFS_SUPPORT
CFLAGS+= -I${ZFSSRC}
CFLAGS+= -I${SYSDIR}/cddl/boot/zfs
.if ${MACHINE} == "amd64"
# Have to override to use 32-bit version of zfs library...
# kinda lame to select that there XXX
LIBZFSBOOT= ${BOOTOBJ}/zfs32/libzfsboot.a
.else
LIBZFSBOOT= ${BOOTOBJ}/zfs/libzfsboot.a
.endif
.endif
CLEANFILES+= vers.c CLEANFILES+= vers.c
VERSION_FILE?= ${.CURDIR}/version VERSION_FILE?= ${.CURDIR}/version
.if ${MK_REPRODUCIBLE_BUILD} != no .if ${MK_REPRODUCIBLE_BUILD} != no

View file

@ -1,5 +1,10 @@
# $FreeBSD$ # $FreeBSD$
SUBDIR= boot1 loader zfsboot zfsloader .include <bsd.init.mk>
SUBDIR= boot1 loader
.if ${MK_ZFS} != "no"
SUBDIR+=zfsboot zfsloader
.endif
.include <bsd.subdir.mk> .include <bsd.subdir.mk>

View file

@ -5,7 +5,6 @@ LOADER_UFS_SUPPORT?= yes
LOADER_CD9660_SUPPORT?= yes LOADER_CD9660_SUPPORT?= yes
LOADER_EXT2FS_SUPPORT?= no LOADER_EXT2FS_SUPPORT?= no
LOADER_MSDOS_SUPPORT?= no LOADER_MSDOS_SUPPORT?= no
LOADER_ZFS_SUPPORT?= no
LOADER_NET_SUPPORT?= yes LOADER_NET_SUPPORT?= yes
LOADER_NFS_SUPPORT?= yes LOADER_NFS_SUPPORT?= yes
LOADER_TFTP_SUPPORT?= yes LOADER_TFTP_SUPPORT?= yes
@ -28,12 +27,6 @@ SRCS= locore.S main.c metadata.c vers.c
.if ${LOADER_DEBUG} == "yes" .if ${LOADER_DEBUG} == "yes"
CFLAGS+= -DLOADER_DEBUG CFLAGS+= -DLOADER_DEBUG
.endif .endif
.if ${LOADER_ZFS_SUPPORT} == "yes"
CFLAGS+= -DLOADER_ZFS_SUPPORT
CFLAGS+= -I${ZFSSRC}
CFLAGS+= -I${SYSDIR}/cddl/boot/zfs
LIBZFSBOOT= ${BOOTOBJ}/zfs/libzfsboot.a
.endif
# Always add MI sources # Always add MI sources
.include "${BOOTSRC}/loader.mk" .include "${BOOTSRC}/loader.mk"

View file

@ -4,6 +4,6 @@
PROG= zfsloader PROG= zfsloader
NEWVERSWHAT= "ZFS enabled bootstrap loader" sparc64 NEWVERSWHAT= "ZFS enabled bootstrap loader" sparc64
LOADER_ZFS_SUPPORT=yes HAVE_ZFS= yes
.include "${.CURDIR}/../loader/Makefile" .include "${.CURDIR}/../loader/Makefile"