]> CyberLeo.Net >> Repos - FreeBSD/FreeBSD.git/commit
loader: zfs should support bootonce an nextboot
authorToomas Soome <tsoome@FreeBSD.org>
Mon, 21 Sep 2020 09:01:10 +0000 (09:01 +0000)
committerToomas Soome <tsoome@FreeBSD.org>
Mon, 21 Sep 2020 09:01:10 +0000 (09:01 +0000)
commite307eb94ae520d98dc1d346a0c53667a41beab5d
tree388cef449cfe2f57e0f2c494db23b11a1390072f
parent7d54cc9165a3990849b60835c85ddb388905e1b7
loader: zfs should support bootonce an nextboot

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
52 files changed:
Makefile.inc1
cddl/lib/Makefile
cddl/lib/libzfsbootenv/Makefile [new file with mode: 0644]
cddl/lib/libzpool/Makefile
lib/libbe/Makefile
lib/libbe/be.c
lib/libbe/be.h
lib/libbe/be_impl.h
lib/libbe/be_info.c
lib/libbe/libbe.3
libexec/rc/rc.conf
libexec/rc/rc.d/zfsbe
rescue/rescue/Makefile
sbin/bectl/Makefile
sbin/bectl/bectl.8
sbin/bectl/bectl.c
sbin/bectl/bectl_list.c
sbin/reboot/nextboot.8
sbin/reboot/nextboot.sh
sbin/zfsbootcfg/Makefile
sbin/zfsbootcfg/zfsbootcfg.8
sbin/zfsbootcfg/zfsbootcfg.c
share/man/man5/rc.conf.5
share/mk/bsd.libnames.mk
share/mk/src.libnames.mk
stand/common/bootstrap.h
stand/common/nvstore.c [new file with mode: 0644]
stand/defaults/loader.conf
stand/efi/boot1/Makefile
stand/efi/boot1/zfs_module.c
stand/efi/loader/Makefile
stand/efi/loader/main.c
stand/forth/support.4th
stand/i386/gptzfsboot/Makefile
stand/i386/loader/Makefile
stand/i386/loader/main.c
stand/i386/zfsboot/Makefile
stand/i386/zfsboot/zfsboot.c
stand/libsa/zfs/Makefile.inc
stand/libsa/zfs/libzfs.h
stand/libsa/zfs/nvlist.c
stand/libsa/zfs/zfs.c
stand/libsa/zfs/zfsimpl.c
stand/loader.mk
stand/lua/config.lua
stand/userboot/test/test.c
stand/userboot/userboot.h
stand/userboot/userboot/Makefile
stand/userboot/userboot/main.c
stand/userboot/userboot/userboot_disk.c
sys/cddl/boot/zfs/zfsimpl.h
tools/tools/zfsboottest/zfsboottest.c