a9be09f45f
bootonce feature is temporary, one time boot, activated by "bectl activate -t BE", "bectl activate -T BE" will reset the bootonce flag. By default, the bootonce setting is reset on attempt to boot and the next boot will use previously active BE. By setting zfs_bootonce_activate="YES" in rc.conf, the bootonce BE will be set permanently active. bootonce dataset name is recorded in boot pool labels, bootenv area. in case of nextboot, the nextboot_enable boolean variable is recorded in freebsd:nvstore nvlist, also stored in boot pool label bootenv area. On boot, the loader will process /boot/nextboot.conf if nextboot_enable is "YES", and will set nextboot_enable to "NO", preventing /boot/nextboot.conf processing on next boot. bootonce and nextboot features are usable in both UEFI and BIOS boot. To use bootonce/nextboot features, the boot loader needs to be updated on disk; if loader.efi is stored on ESP, then ESP needs to be updated and for BIOS boot, stage2 (zfsboot or gptzfsboot) needs to be updated (gpart or other tools). At this time, only lua loader is updated. Sponsored by: Netflix, Klara Inc. Differential Revision: https://reviews.freebsd.org/D25512
85 lines
2.2 KiB
Makefile
85 lines
2.2 KiB
Makefile
# $FreeBSD$
|
|
|
|
.include <bsd.init.mk>
|
|
|
|
.PATH: ${BOOTSRC}/i386/boot2 ${BOOTSRC}/i386/gptboot \
|
|
${BOOTSRC}/i386/zfsboot ${BOOTSRC}/i386/common \
|
|
${BOOTSRC}/common
|
|
|
|
FILES= gptzfsboot
|
|
MAN= gptzfsboot.8
|
|
|
|
BOOT_COMCONSOLE_PORT?= 0x3f8
|
|
BOOT_COMCONSOLE_SPEED?= 9600
|
|
B2SIOFMT?= 0x3
|
|
|
|
REL1= 0x700
|
|
ORG1= 0x7c00
|
|
ORG2= 0x0
|
|
|
|
CFLAGS+=-DBOOTPROG=\"gptzfsboot\" \
|
|
-O1 \
|
|
-DBOOT2 \
|
|
-DLOADER_GPT_SUPPORT \
|
|
-DLOADER_MBR_SUPPORT \
|
|
-DLOADER_ZFS_SUPPORT \
|
|
-DSIOPRT=${BOOT_COMCONSOLE_PORT} \
|
|
-DSIOFMT=${B2SIOFMT} \
|
|
-DSIOSPD=${BOOT_COMCONSOLE_SPEED} \
|
|
-I${LDRSRC} \
|
|
-I${BOOTSRC}/i386/common \
|
|
-I${BOOTSRC}/i386/libi386 \
|
|
-I${ZFSSRC} \
|
|
-I${SYSDIR}/crypto/skein \
|
|
-I${SYSDIR}/cddl/boot/zfs \
|
|
-I${SYSDIR}/contrib/openzfs/include \
|
|
-I${SYSDIR}/contrib/openzfs/include/os/freebsd/spl \
|
|
-I${SYSDIR}/contrib/openzfs/include/os/freebsd/zfs \
|
|
-I${SYSDIR}/cddl/contrib/opensolaris/common/lz4 \
|
|
-I${BOOTSRC}/i386/btx/lib \
|
|
-I${BOOTSRC}/i386/boot2 \
|
|
-DHAVE_MEMCPY -I${SRCTOP}/sys/contrib/zlib \
|
|
-Wall -Waggregate-return -Wbad-function-cast \
|
|
-Wmissing-declarations -Wmissing-prototypes -Wnested-externs \
|
|
-Wpointer-arith -Wshadow -Wstrict-prototypes -Wwrite-strings \
|
|
-Wno-pointer-sign
|
|
|
|
CFLAGS.clang+= -Wno-tentative-definition-incomplete-type
|
|
|
|
NO_WCAST_ALIGN=
|
|
|
|
CFLAGS.gcc+= --param max-inline-insns-single=100
|
|
|
|
LD_FLAGS+=${LD_FLAGS_BIN}
|
|
|
|
CLEANFILES+= gptzfsboot
|
|
|
|
gptzfsboot: gptldr.bin gptzfsboot.bin ${BTXKERN}
|
|
btxld -v -E ${ORG2} -f bin -b ${BTXKERN} -l gptldr.bin \
|
|
-o ${.TARGET} gptzfsboot.bin
|
|
|
|
CLEANFILES+= gptldr.bin gptldr.out gptldr.o
|
|
|
|
gptldr.bin: gptldr.out
|
|
${OBJCOPY} -S -O binary gptldr.out ${.TARGET}
|
|
|
|
gptldr.out: gptldr.o
|
|
${LD} ${LD_FLAGS} -e start --defsym ORG=${ORG1} -T ${LDSCRIPT} -o ${.TARGET} gptldr.o
|
|
|
|
OBJS= zfsboot.o sio.o cons.o bcache.o devopen.o disk.o part.o zfs_cmd.o
|
|
CLEANFILES+= gptzfsboot.bin gptzfsboot.out ${OBJS} ${OPENCRYPTO_XTS}
|
|
|
|
# i386 standalone support library
|
|
LIBI386= ${BOOTOBJ}/i386/libi386/libi386.a
|
|
|
|
gptzfsboot.bin: gptzfsboot.out
|
|
${OBJCOPY} -S -O binary gptzfsboot.out ${.TARGET}
|
|
|
|
gptzfsboot.out: ${BTXCRT} ${OBJS} \
|
|
${OPENCRYPTO_XTS}
|
|
${LD} ${LD_FLAGS} --defsym ORG=${ORG2} -T ${LDSCRIPT} -o ${.TARGET} ${.ALLSRC} ${LIBI386} ${LIBSA32}
|
|
|
|
zfsboot.o: ${ZFSSRC}/zfsimpl.c
|
|
|
|
.include <bsd.prog.mk>
|