Collapse zfsloader functionality back down into loader.

We no longer really need a separate zfsloader. It was useful when we
were first supporting ZFS and had limited ability to properly boot off
of ZFS without the special boot loader. Now that the boot loader has
matured, go the way loader.efi pioneered and just build one
binary. Change the name of the loader to load in the secondary boot
blocks to be just /boot/loader. Provide a symbolic link from zfsloader
to loader so people who have not upgraded their boot blocks are not
affected. This has the happy benefit of making coexistence easier as
well (fewer binaries in the matrix).

Discussed with: allanjude@, kevans@
RelNotes: Yes
Sponsored by: Netflix
Differential Revision: https://reviews.freebsd.org/D16361
This commit is contained in:
Warner Losh 2018-07-20 05:17:37 +00:00
parent dfbd3c8d91
commit 060679ef9c
10 changed files with 15 additions and 42 deletions

View File

@ -33,7 +33,6 @@
#define PATH_CONFIG "/boot/config"
#define PATH_LOADER "/boot/loader"
#define PATH_LOADER_EFI "/boot/loader.efi"
#define PATH_LOADER_ZFS "/boot/zfsloader"
#define PATH_KERNEL "/boot/kernel/kernel"
#endif /* _PATHS_H_ */

View File

@ -18,6 +18,6 @@ SUBDIR.yes+= pxeldr
SUBDIR.yes+= kgzldr
.endif
SUBDIR.${MK_ZFS}+= zfsboot gptzfsboot zfsloader
SUBDIR.${MK_ZFS}+= zfsboot gptzfsboot
.include <bsd.subdir.mk>

View File

@ -1,5 +1,7 @@
# $FreeBSD$
HAVE_ZFS= ${MK_ZFS}
LOADER_NET_SUPPORT?= yes
LOADER_NFS_SUPPORT?= yes
LOADER_TFTP_SUPPORT?= yes
@ -62,6 +64,9 @@ ${LOADER}: ${LOADER}.bin ${BTXLDR} ${BTXKERN}
${LOADER}.bin: ${LOADER}.sym
strip -R .comment -R .note -o ${.TARGET} ${.ALLSRC}
.if ${MK_ZFS} == "yes"
SYMLINKS= ${BINDIR}/${LOADER} ${BINDIR}/zfs${LOADER}
.endif
FILES+= ${LOADER}
# XXX INSTALLFLAGS_loader= -b
FILESMODE_${LOADER}= ${BINMODE} -b

View File

@ -848,7 +848,7 @@ main(void)
*/
if (autoboot && !*kname) {
memcpy(kname, PATH_LOADER_ZFS, sizeof(PATH_LOADER_ZFS));
memcpy(kname, PATH_LOADER, sizeof(PATH_LOADER));
if (!keyhit(3)) {
load();
memcpy(kname, PATH_KERNEL, sizeof(PATH_KERNEL));

View File

@ -1,8 +0,0 @@
# $FreeBSD$
LOADER= zfsloader
NEWVERSWHAT= "ZFS enabled bootstrap loader" x86
HAVE_ZFS= yes
CFLAGS+= -DBOOTPROG=\"zfsloader\"
.include "${.CURDIR}/../loader/Makefile"

View File

@ -1,21 +0,0 @@
# $FreeBSD$
# Autogenerated - do NOT edit!
DIRDEPS = \
include \
include/xlocale \
stand/ficl32 \
stand/geli \
stand/i386/btx/btx \
stand/i386/btx/btxldr \
stand/i386/btx/lib \
stand/i386/libi386 \
stand/libsa32 \
stand/zfs32 \
.include <dirdeps.mk>
.if ${DEP_RELDIR} == ${_DEP_RELDIR}
# local dependencies - needed for -jN in clean tree
.endif

View File

@ -124,7 +124,7 @@ CFLAGS+= -DLOADER_GPT_SUPPORT
CFLAGS+= -DLOADER_MBR_SUPPORT
.endif
.if defined(HAVE_ZFS)
.if ${HAVE_ZFS:Uno} == "yes"
CFLAGS+= -DLOADER_ZFS_SUPPORT
CFLAGS+= -I${ZFSSRC}
CFLAGS+= -I${SYSDIR}/cddl/boot/zfs

View File

@ -5,6 +5,6 @@ NO_OBJ=t
.include <bsd.init.mk>
SUBDIR.yes= boot1 loader
SUBDIR.${MK_ZFS}+=zfsboot zfsloader
SUBDIR.${MK_ZFS}+=zfsboot
.include <bsd.subdir.mk>

View File

@ -1,5 +1,7 @@
# $FreeBSD$
HAVE_ZFS= ${MK_ZFS}
LOADER_DISK_SUPPORT?= yes
LOADER_UFS_SUPPORT?= yes
LOADER_CD9660_SUPPORT?= yes
@ -40,6 +42,10 @@ HELP_FILES= ${.CURDIR}/help.sparc64
LDFLAGS+= -static
.if ${MK_ZFS} == "yes"
SYMLINKS= ${BINDIR}/loader ${BINDIR}/zfsloader
.endif
# Open Firmware standalone support library
LIBOFW= ${BOOTOBJ}/ofw/libofw/libofw.a
CFLAGS+= -I${BOOTSRC}/ofw/libofw/

View File

@ -1,8 +0,0 @@
# $FreeBSD$
PROG= zfsloader
NEWVERSWHAT= "ZFS enabled bootstrap loader" sparc64
HAVE_ZFS= yes
CFLAGS+= -DBOOTPROG=\"zfsloader\"
.include "${.CURDIR}/../loader/Makefile"