From mboxrd@z Thu Jan 1 00:00:00 1970 Authentication-Results: mx.groups.io; dkim=missing; spf=fail (domain: intel.com, ip: , mailfrom: zhiguang.liu@intel.com) Received: from mga09.intel.com (mga09.intel.com []) by groups.io with SMTP; Sun, 05 May 2019 19:07:07 -0700 X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from fmsmga006.fm.intel.com ([10.253.24.20]) by orsmga102.jf.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 05 May 2019 19:07:07 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.60,435,1549958400"; d="scan'208";a="344045955" Received: from fieedk002.ccr.corp.intel.com ([10.239.157.133]) by fmsmga006.fm.intel.com with ESMTP; 05 May 2019 19:07:06 -0700 From: "Zhiguang Liu" To: devel@edk2.groups.io Cc: Jordan Justen , Andrew Fish , Ray Ni Subject: [Patch V2 2/2] EmulatorPkg: Make the shell be the first boot option Date: Mon, 6 May 2019 10:06:18 +0800 Message-Id: <20190506020618.12032-3-zhiguang.liu@intel.com> X-Mailer: git-send-email 2.21.0.windows.1 In-Reply-To: <20190506020618.12032-1-zhiguang.liu@intel.com> References: <20190506020618.12032-1-zhiguang.liu@intel.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit REF:https://bugzilla.tianocore.org/show_bug.cgi?id=1649 Make the shell be the first boot option by default, So it can boot into UEFI Internal Shell directly Signed-off-by: Zhiguang Liu Cc: Jordan Justen Cc: Andrew Fish Cc: Ray Ni --- EmulatorPkg/Library/PlatformBmLib/PlatformBm.c | 30 ++++++++++++++++++++++++++++++ 1 file changed, 30 insertions(+) diff --git a/EmulatorPkg/Library/PlatformBmLib/PlatformBm.c b/EmulatorPkg/Library/PlatformBmLib/PlatformBm.c index 191ce58cfb..03f6157ae8 100644 --- a/EmulatorPkg/Library/PlatformBmLib/PlatformBm.c +++ b/EmulatorPkg/Library/PlatformBmLib/PlatformBm.c @@ -332,6 +332,35 @@ PlatformBdsRegisterStaticBootOptions ( PrintXY (10, 50, &White, &Black, L"Enter to boot directly."); } +/** + Returns the priority number. + + @param BootOption +**/ +UINTN +BootOptionPriority ( + CONST EFI_BOOT_MANAGER_LOAD_OPTION *BootOption + ) +{ + // + // Make sure Shell is first + // + if (StrCmp (BootOption->Description, L"UEFI Shell") == 0) { + return 0; + } + return 100; +} + +INTN +EFIAPI +CompareBootOption ( + CONST EFI_BOOT_MANAGER_LOAD_OPTION *Left, + CONST EFI_BOOT_MANAGER_LOAD_OPTION *Right + ) +{ + return BootOptionPriority (Left) - BootOptionPriority (Right); +} + /** Do the platform specific action after the console is connected. @@ -377,6 +406,7 @@ PlatformBootManagerAfterConsole ( PlatformBdsRegisterStaticBootOptions (); PlatformBdsConnectSequence (); EfiBootManagerRefreshAllBootOption (); + EfiBootManagerSortLoadOptionVariable (LoadOptionTypeBoot, (SORT_COMPARE)CompareBootOption); break; } } -- 2.21.0.windows.1