From owner-svn-src-stable@freebsd.org Thu Feb 21 02:31:15 2019 Return-Path: Delivered-To: svn-src-stable@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 7C9D114EA167; Thu, 21 Feb 2019 02:31:15 +0000 (UTC) (envelope-from kevans@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 1CBB585058; Thu, 21 Feb 2019 02:31:15 +0000 (UTC) (envelope-from kevans@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 0F028EE78; Thu, 21 Feb 2019 02:31:15 +0000 (UTC) (envelope-from kevans@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x1L2VEDG078841; Thu, 21 Feb 2019 02:31:14 GMT (envelope-from kevans@FreeBSD.org) Received: (from kevans@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x1L2VEAd078840; Thu, 21 Feb 2019 02:31:14 GMT (envelope-from kevans@FreeBSD.org) Message-Id: <201902210231.x1L2VEAd078840@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: kevans set sender to kevans@FreeBSD.org using -f From: Kyle Evans Date: Thu, 21 Feb 2019 02:31:14 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r344404 - stable/11/stand/efi/loader X-SVN-Group: stable-11 X-SVN-Commit-Author: kevans X-SVN-Commit-Paths: stable/11/stand/efi/loader X-SVN-Commit-Revision: 344404 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Rspamd-Queue-Id: 1CBB585058 X-Spamd-Bar: -- Authentication-Results: mx1.freebsd.org X-Spamd-Result: default: False [-2.94 / 15.00]; local_wl_from(0.00)[FreeBSD.org]; NEURAL_HAM_MEDIUM(-1.00)[-0.999,0]; NEURAL_HAM_SHORT(-0.94)[-0.944,0]; ASN(0.00)[asn:11403, ipnet:2610:1c1:1::/48, country:US]; NEURAL_HAM_LONG(-1.00)[-0.999,0] X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 21 Feb 2019 02:31:15 -0000 Author: kevans Date: Thu Feb 21 02:31:14 2019 New Revision: 344404 URL: https://svnweb.freebsd.org/changeset/base/344404 Log: MFC r336463: 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. Modified: stable/11/stand/efi/loader/main.c Directory Properties: stable/11/ (props changed) Modified: stable/11/stand/efi/loader/main.c ============================================================================== --- stable/11/stand/efi/loader/main.c Thu Feb 21 02:28:04 2019 (r344403) +++ stable/11/stand/efi/loader/main.c Thu Feb 21 02:31:14 2019 (r344404) @@ -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);