mirror of
https://github.com/opnsense/src.git
synced 2026-04-26 00:27:08 -04:00
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
106 lines
2.7 KiB
Makefile
106 lines
2.7 KiB
Makefile
# $FreeBSD$
|
|
|
|
LOADER_NET_SUPPORT?= yes
|
|
LOADER_MSDOS_SUPPORT?= yes
|
|
LOADER_UFS_SUPPORT?= yes
|
|
LOADER_CD9660_SUPPORT?= no
|
|
LOADER_EXT2FS_SUPPORT?= no
|
|
|
|
.include <bsd.init.mk>
|
|
|
|
LOADER?= loader_${LOADER_INTERP}
|
|
PROG= ${LOADER}.sym
|
|
INTERNALPROG=
|
|
WARNS?= 3
|
|
|
|
# architecture-specific loader code
|
|
SRCS= autoload.c \
|
|
bootinfo.c \
|
|
conf.c \
|
|
copy.c \
|
|
efi_main.c \
|
|
framebuffer.c \
|
|
main.c \
|
|
self_reloc.c \
|
|
vers.c
|
|
|
|
CFLAGS+= -I${.CURDIR}/../loader
|
|
.if ${MK_LOADER_ZFS} != "no"
|
|
CFLAGS+= -I${ZFSSRC}
|
|
CFLAGS+= -I${SYSDIR}/contrib/openzfs/include
|
|
CFLAGS+= -I${SYSDIR}/contrib/openzfs/include/os/freebsd/zfs
|
|
CFLAGS+= -DEFI_ZFS_BOOT
|
|
HAVE_ZFS= yes
|
|
.endif
|
|
|
|
# We implement a slightly non-standard %S in that it always takes a
|
|
# CHAR16 that's common in UEFI-land instead of a wchar_t. This only
|
|
# seems to matter on arm64 where wchar_t defaults to an int instead
|
|
# of a short. There's no good cast to use here so just ignore the
|
|
# warnings for now.
|
|
CWARNFLAGS.main.c+= -Wno-format
|
|
|
|
.PATH: ${.CURDIR}/../loader
|
|
.PATH: ${.CURDIR}/../loader/arch/${MACHINE}
|
|
.include "${.CURDIR}/../loader/arch/${MACHINE}/Makefile.inc"
|
|
|
|
CFLAGS+= -I${.CURDIR}
|
|
CFLAGS+= -I${.CURDIR}/arch/${MACHINE}
|
|
CFLAGS+= -I${EFISRC}/include
|
|
CFLAGS+= -I${EFISRC}/include/${MACHINE}
|
|
CFLAGS+= -I${SYSDIR}/contrib/dev/acpica/include
|
|
CFLAGS+= -I${BOOTSRC}/i386/libi386
|
|
CFLAGS+= -DEFI
|
|
|
|
.if defined(HAVE_FDT) && ${MK_FDT} != "no"
|
|
.include "${BOOTSRC}/fdt.mk"
|
|
LIBEFI_FDT= ${BOOTOBJ}/efi/fdt/libefi_fdt.a
|
|
.endif
|
|
|
|
# Include bcache code.
|
|
HAVE_BCACHE= yes
|
|
|
|
.if defined(EFI_STAGING_SIZE)
|
|
CFLAGS+= -DEFI_STAGING_SIZE=${EFI_STAGING_SIZE}
|
|
.endif
|
|
|
|
.if ${MK_LOADER_EFI_SECUREBOOT} != "no"
|
|
CFLAGS+= -DEFI_SECUREBOOT
|
|
.endif
|
|
|
|
NEWVERSWHAT= "EFI loader" ${MACHINE}
|
|
VERSION_FILE= ${.CURDIR}/../loader/version
|
|
|
|
# Always add MI sources
|
|
.include "${BOOTSRC}/loader.mk"
|
|
|
|
FILES+= ${LOADER}.efi
|
|
FILESMODE_${LOADER}.efi= ${BINMODE}
|
|
|
|
.if ${LOADER_INTERP} == ${LOADER_DEFAULT_INTERP}
|
|
LINKS+= ${BINDIR}/${LOADER}.efi ${BINDIR}/loader.efi
|
|
.endif
|
|
|
|
LDSCRIPT= ${.CURDIR}/../loader/arch/${MACHINE}/ldscript.${MACHINE}
|
|
LDFLAGS+= -Wl,-T${LDSCRIPT},-Bsymbolic,-znotext -shared
|
|
|
|
CLEANFILES+= loader.efi
|
|
|
|
${LOADER}.efi: ${PROG}
|
|
if ${NM} ${.ALLSRC} | grep ' U '; then \
|
|
echo "Undefined symbols in ${.ALLSRC}"; \
|
|
exit 1; \
|
|
fi
|
|
SOURCE_DATE_EPOCH=${SOURCE_DATE_EPOCH} \
|
|
${OBJCOPY} -j .peheader -j .text -j .sdata -j .data \
|
|
-j .dynamic -j .dynsym -j .rel.dyn \
|
|
-j .rela.dyn -j .reloc -j .eh_frame -j set_Xcommand_set \
|
|
-j set_Xficl_compile_set \
|
|
--output-target=${EFI_TARGET} ${.ALLSRC} ${.TARGET}
|
|
|
|
LIBEFI= ${BOOTOBJ}/efi/libefi/libefi.a
|
|
|
|
DPADD= ${LDR_INTERP} ${LIBEFI} ${LIBFDT} ${LIBEFI_FDT} ${LIBSA} ${LDSCRIPT}
|
|
LDADD= ${LDR_INTERP} ${LIBEFI} ${LIBFDT} ${LIBEFI_FDT} ${LIBSA}
|
|
|
|
.include <bsd.prog.mk>
|