From mboxrd@z Thu Jan 1 00:00:00 1970 Authentication-Results: mx.groups.io; dkim=missing; spf=pass (domain: intel.com, ip: 192.55.52.93, mailfrom: zhiguang.liu@intel.com) Received: from mga11.intel.com (mga11.intel.com [192.55.52.93]) by groups.io with SMTP; Sun, 28 Apr 2019 22:25:38 -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 fmsmga102.fm.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 28 Apr 2019 22:25:38 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.60,408,1549958400"; d="scan'208";a="341695423" Received: from fieedk002.ccr.corp.intel.com ([10.239.157.133]) by fmsmga006.fm.intel.com with ESMTP; 28 Apr 2019 22:25:37 -0700 From: "Zhiguang Liu" To: devel@edk2.groups.io Cc: Jordan Justen , Andrew Fish , Ray Ni Subject: [PATCH 1/2] EmulatorPkg: Make the shell be the first boot option Date: Mon, 29 Apr 2019 13:24:42 +0800 Message-Id: <20190429052443.2908-2-zhiguang.liu@intel.com> X-Mailer: git-send-email 2.21.0.windows.1 In-Reply-To: <20190429052443.2908-1-zhiguang.liu@intel.com> References: <20190429052443.2908-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, when run the emulator if user don't change boot order. Signed-off-by: Zhiguang Liu Cc: Jordan Justen Cc: Andrew Fish Cc: Ray Ni --- EmulatorPkg/Library/PlatformBmLib/PlatformBm.c | 31 ++++++++++++++++++++++++++++++- 1 file changed, 30 insertions(+), 1 deletion(-) diff --git a/EmulatorPkg/Library/PlatformBmLib/PlatformBm.c b/EmulatorPkg/Library/PlatformBmLib/PlatformBm.c index 2a97e385be..459ac5c4b5 100644 --- a/EmulatorPkg/Library/PlatformBmLib/PlatformBm.c +++ b/EmulatorPkg/Library/PlatformBmLib/PlatformBm.c @@ -388,6 +388,34 @@ PlatformBootManagerChangeDevicePath ( } } } +/** + 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. @@ -432,9 +460,10 @@ PlatformBootManagerAfterConsole ( default: PlatformBdsDiagnostics (IGNORE, TRUE); PlatformBootManagerChangeDevicePath(&FirstBoot); - PlatformBdsRegisterStaticBootOptions (); PlatformBdsConnectSequence (); EfiBootManagerRefreshAllBootOption (); + PlatformBdsRegisterStaticBootOptions (); + if(FirstBoot)EfiBootManagerSortLoadOptionVariable (LoadOptionTypeBoot, (SORT_COMPARE) CompareBootOption); break; } } -- 2.21.0.windows.1