From mboxrd@z Thu Jan 1 00:00:00 1970 Authentication-Results: mx.groups.io; dkim=missing; spf=pass (domain: intel.com, ip: 134.134.136.31, mailfrom: ray.ni@intel.com) Received: from mga06.intel.com (mga06.intel.com [134.134.136.31]) by groups.io with SMTP; Sat, 04 May 2019 20:23:36 -0700 X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from fmsmga005.fm.intel.com ([10.253.24.32]) by orsmga104.jf.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 04 May 2019 20:23:35 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.60,431,1549958400"; d="scan'208";a="343535602" Received: from fmsmsx105.amr.corp.intel.com ([10.18.124.203]) by fmsmga005.fm.intel.com with ESMTP; 04 May 2019 20:23:35 -0700 Received: from FMSMSX109.amr.corp.intel.com (10.18.116.9) by FMSMSX105.amr.corp.intel.com (10.18.124.203) with Microsoft SMTP Server (TLS) id 14.3.408.0; Sat, 4 May 2019 20:23:35 -0700 Received: from shsmsx154.ccr.corp.intel.com (10.239.6.54) by fmsmsx109.amr.corp.intel.com (10.18.116.9) with Microsoft SMTP Server (TLS) id 14.3.408.0; Sat, 4 May 2019 20:23:35 -0700 Received: from shsmsx104.ccr.corp.intel.com ([169.254.5.33]) by SHSMSX154.ccr.corp.intel.com ([169.254.7.136]) with mapi id 14.03.0415.000; Sun, 5 May 2019 11:23:33 +0800 From: "Ni, Ray" To: "Liu, Zhiguang" , "devel@edk2.groups.io" CC: "Justen, Jordan L" , Andrew Fish Subject: Re: [PATCH 1/2] EmulatorPkg: Make the shell be the first boot option Thread-Topic: [PATCH 1/2] EmulatorPkg: Make the shell be the first boot option Thread-Index: AQHU/kwBmRCh+oCUMkCe8979zgcqJKZb6BRw Date: Sun, 5 May 2019 03:23:32 +0000 Message-ID: <734D49CCEBEEF84792F5B80ED585239D5C125F06@SHSMSX104.ccr.corp.intel.com> References: <20190429052443.2908-1-zhiguang.liu@intel.com> <20190429052443.2908-2-zhiguang.liu@intel.com> In-Reply-To: <20190429052443.2908-2-zhiguang.liu@intel.com> Accept-Language: en-US, zh-CN X-MS-Has-Attach: X-MS-TNEF-Correlator: x-originating-ip: [10.239.127.40] MIME-Version: 1.0 Return-Path: ray.ni@intel.com Content-Language: en-US Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable Please run ecc to make sure your coding style is proper. > -----Original Message----- > From: Liu, Zhiguang > Sent: Monday, April 29, 2019 1:25 PM > To: devel@edk2.groups.io > Cc: Justen, Jordan L ; Andrew Fish > ; Ni, Ray > Subject: [PATCH 1/2] EmulatorPkg: Make the shell be the first boot option >=20 > REF:https://bugzilla.tianocore.org/show_bug.cgi?id=3D1649 >=20 > 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. >=20 > Signed-off-by: Zhiguang Liu >=20 > Cc: Jordan Justen > Cc: Andrew Fish > Cc: Ray Ni > --- > EmulatorPkg/Library/PlatformBmLib/PlatformBm.c | 31 > ++++++++++++++++++++++++++++++- > 1 file changed, 30 insertions(+), 1 deletion(-) >=20 > 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") =3D=3D 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); > +} >=20 > /** > 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