Author: imp
Date: Wed Jul 18 22:45:26 2018
New Revision: 336463
URL: https://svnweb.freebsd.org/changeset/base/336463

Log:
  If rootdev is set, use it as currdev.
  
  Setting rootdev in the enviornment should specify things
  completely. If it is set, then have it override everything else.
  
  PR: 229770
  Differential Review: https://reviews.freebsd.org/D16322

Modified:
  head/stand/efi/loader/main.c

Modified: head/stand/efi/loader/main.c
==============================================================================
--- head/stand/efi/loader/main.c        Wed Jul 18 21:57:04 2018        
(r336462)
+++ head/stand/efi/loader/main.c        Wed Jul 18 22:45:26 2018        
(r336463)
@@ -166,16 +166,21 @@ out:
 }
 
 static void
+set_currdev(const char *devname)
+{
+
+       env_setenv("currdev", EV_VOLATILE, devname, efi_setcurrdev, 
env_nounset);
+       env_setenv("loaddev", EV_VOLATILE, devname, env_noset, env_nounset);
+}
+
+static void
 set_currdev_devdesc(struct devdesc *currdev)
 {
        const char *devname;
 
        devname = efi_fmtdev(currdev);
-
        printf("Setting currdev to %s\n", devname);
-
-       env_setenv("currdev", EV_VOLATILE, devname, efi_setcurrdev, 
env_nounset);
-       env_setenv("loaddev", EV_VOLATILE, devname, env_noset, env_nounset);
+       set_currdev(devname);
 }
 
 static void
@@ -279,7 +284,15 @@ find_currdev(EFI_LOADED_IMAGE *img)
        struct devsw *dev;
        int unit;
        uint64_t extra;
+       char *rootdev;
 
+       rootdev = getenv("rootdev");
+       if (rootdev != NULL) {
+               printf("Setting currdev to configured rootdev %s\n", rootdev);
+               set_currdev(rootdev);
+               return (0);
+       }
+
 #ifdef EFI_ZFS_BOOT
        /*
         * Did efi_zfs_probe() detect the boot pool? If so, use the zpool
@@ -616,7 +629,7 @@ main(int argc, CHAR16 *argv[])
         * set the env based on it.
         */
        boot_howto_to_env(howto);
-       
+
        if (efi_copy_init()) {
                printf("failed to allocate staging area\n");
                return (EFI_BUFFER_TOO_SMALL);
_______________________________________________
svn-src-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"

Reply via email to