Author: allanjude
Date: Fri Jan 15 05:45:45 2016
New Revision: 294073
URL: https://svnweb.freebsd.org/changeset/base/294073

Log:
  Connect the ZFS boot environment menu to the UEFI loader
  
  MFC after:    3 days
  Sponsored by: ScaleEngine Inc.

Modified:
  head/sys/boot/efi/loader/main.c

Modified: head/sys/boot/efi/loader/main.c
==============================================================================
--- head/sys/boot/efi/loader/main.c     Fri Jan 15 05:45:10 2016        
(r294072)
+++ head/sys/boot/efi/loader/main.c     Fri Jan 15 05:45:45 2016        
(r294073)
@@ -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
_______________________________________________
[email protected] mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "[email protected]"

Reply via email to