diff options
author | allanjude <allanjude@FreeBSD.org> | 2016-01-15 05:45:45 +0000 |
---|---|---|
committer | allanjude <allanjude@FreeBSD.org> | 2016-01-15 05:45:45 +0000 |
commit | b69dd9628fc085b4153ee4c6ae5b01e8e7cfb884 (patch) | |
tree | c825f6033c8935b1fe2c73ebe98f4a0a9c27e497 /sys/boot/efi/loader | |
parent | d2351469ab88f5c3ea559523a497b153b2187c6e (diff) | |
download | FreeBSD-src-b69dd9628fc085b4153ee4c6ae5b01e8e7cfb884.zip FreeBSD-src-b69dd9628fc085b4153ee4c6ae5b01e8e7cfb884.tar.gz |
Connect the ZFS boot environment menu to the UEFI loader
MFC after: 3 days
Sponsored by: ScaleEngine Inc.
Diffstat (limited to 'sys/boot/efi/loader')
-rw-r--r-- | sys/boot/efi/loader/main.c | 33 |
1 files changed, 33 insertions, 0 deletions
diff --git a/sys/boot/efi/loader/main.c b/sys/boot/efi/loader/main.c index 4ba42d9..0b9dcf6 100644 --- a/sys/boot/efi/loader/main.c +++ b/sys/boot/efi/loader/main.c @@ -199,6 +199,7 @@ main(int argc, CHAR16 *argv[]) efi_setcurrdev, env_nounset); env_setenv("loaddev", EV_VOLATILE, efi_fmtdev(&currdev), env_noset, env_nounset); + init_zfs_bootenv(zfs_fmtdev(&currdev)); break; } #endif @@ -507,6 +508,38 @@ command_lszfs(int argc, char *argv[]) } return (CMD_OK); } + +COMMAND_SET(reloadbe, "reloadbe", "refresh the list of ZFS Boot Environments", + command_reloadbe); + +static int +command_reloadbe(int argc, char *argv[]) +{ + int err; + char *root; + + if (argc > 2) { + command_errmsg = "wrong number of arguments"; + return (CMD_ERROR); + } + + if (argc == 2) { + err = zfs_bootenv(argv[1]); + } else { + root = getenv("zfs_be_root"); + if (root == NULL) { + return (CMD_OK); + } + err = zfs_bootenv(root); + } + + if (err != 0) { + command_errmsg = strerror(err); + return (CMD_ERROR); + } + + return (CMD_OK); +} #endif #ifdef LOADER_FDT_SUPPORT |