diff mbox

[edk2] ArmVirtPkg/PlatformBootManagerLib: Postpone the shell registration

Message ID 1467973913-23523-1-git-send-email-lersek@redhat.com
State Accepted
Commit efadd41590b4d5251dd7e254f68bd09b1bb0a4b0
Headers show

Commit Message

Laszlo Ersek July 8, 2016, 10:31 a.m. UTC
This patch ports Gary's OvmfPkg commit 14b2ebc30c8b to ArmVirtPkg.

Turns out Gary's argument in 14b2ebc30c8b is not only valid for Xen. The
same situation arises with QEMU if:
- the user specifies no boot order via fw_cfg at all (so QemuBootOrderLib
  won't touch the boot order), and
- the varstore file has just been created from the varstore template.

In this case the user is dropped to the UEFI shell (because the shell is
registered earlier than all the auto-generated options), which is likely
not what the user wants.

Cc: Ard Biesheuvel <ard.biesheuvel@linaro.org>
Cc: Gary Lin <glin@suse.com
Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Laszlo Ersek <lersek@redhat.com>

---
 ArmVirtPkg/Library/PlatformBootManagerLib/PlatformBm.c | 14 ++++++++------
 1 file changed, 8 insertions(+), 6 deletions(-)

-- 
1.8.3.1

_______________________________________________
edk2-devel mailing list
edk2-devel@lists.01.org
https://lists.01.org/mailman/listinfo/edk2-devel

Comments

Ard Biesheuvel July 8, 2016, 10:33 a.m. UTC | #1
On 8 July 2016 at 12:31, Laszlo Ersek <lersek@redhat.com> wrote:
> This patch ports Gary's OvmfPkg commit 14b2ebc30c8b to ArmVirtPkg.

>

> Turns out Gary's argument in 14b2ebc30c8b is not only valid for Xen. The

> same situation arises with QEMU if:

> - the user specifies no boot order via fw_cfg at all (so QemuBootOrderLib

>   won't touch the boot order), and

> - the varstore file has just been created from the varstore template.

>

> In this case the user is dropped to the UEFI shell (because the shell is

> registered earlier than all the auto-generated options), which is likely

> not what the user wants.

>

> Cc: Ard Biesheuvel <ard.biesheuvel@linaro.org>

> Cc: Gary Lin <glin@suse.com

> Contributed-under: TianoCore Contribution Agreement 1.0

> Signed-off-by: Laszlo Ersek <lersek@redhat.com>


Reviewed-by: Ard Biesheuvel <ard.biesheuvel@linaro.org>


> ---

>  ArmVirtPkg/Library/PlatformBootManagerLib/PlatformBm.c | 14 ++++++++------

>  1 file changed, 8 insertions(+), 6 deletions(-)

>

> diff --git a/ArmVirtPkg/Library/PlatformBootManagerLib/PlatformBm.c b/ArmVirtPkg/Library/PlatformBootManagerLib/PlatformBm.c

> index 198d0602b3c0..eaafe7ff57ea 100644

> --- a/ArmVirtPkg/Library/PlatformBootManagerLib/PlatformBm.c

> +++ b/ArmVirtPkg/Library/PlatformBootManagerLib/PlatformBm.c

> @@ -424,12 +424,6 @@ PlatformRegisterOptionsAndKeys (

>               NULL, (UINT16) BootOption.OptionNumber, 0, &Esc, NULL

>               );

>    ASSERT (Status == EFI_SUCCESS || Status == EFI_ALREADY_STARTED);

> -  //

> -  // Register UEFI Shell

> -  //

> -  PlatformRegisterFvBootOption (

> -    PcdGetPtr (PcdShellFile), L"EFI Internal Shell", LOAD_OPTION_ACTIVE

> -    );

>  }

>

>

> @@ -558,6 +552,14 @@ PlatformBootManagerAfterConsole (

>    // the QEMU configuration.

>    //

>    EfiBootManagerRefreshAllBootOption ();

> +

> +  //

> +  // Register UEFI Shell

> +  //

> +  PlatformRegisterFvBootOption (

> +    PcdGetPtr (PcdShellFile), L"EFI Internal Shell", LOAD_OPTION_ACTIVE

> +    );

> +

>    SetBootOrderFromQemu ();

>  }

>

> --

> 1.8.3.1

>

_______________________________________________
edk2-devel mailing list
edk2-devel@lists.01.org
https://lists.01.org/mailman/listinfo/edk2-devel
Laszlo Ersek July 8, 2016, 11:16 a.m. UTC | #2
On 07/08/16 12:33, Ard Biesheuvel wrote:
> On 8 July 2016 at 12:31, Laszlo Ersek <lersek@redhat.com> wrote:

>> This patch ports Gary's OvmfPkg commit 14b2ebc30c8b to ArmVirtPkg.

>>

>> Turns out Gary's argument in 14b2ebc30c8b is not only valid for Xen. The

>> same situation arises with QEMU if:

>> - the user specifies no boot order via fw_cfg at all (so QemuBootOrderLib

>>   won't touch the boot order), and

>> - the varstore file has just been created from the varstore template.

>>

>> In this case the user is dropped to the UEFI shell (because the shell is

>> registered earlier than all the auto-generated options), which is likely

>> not what the user wants.

>>

>> Cc: Ard Biesheuvel <ard.biesheuvel@linaro.org>

>> Cc: Gary Lin <glin@suse.com

>> Contributed-under: TianoCore Contribution Agreement 1.0

>> Signed-off-by: Laszlo Ersek <lersek@redhat.com>

> 

> Reviewed-by: Ard Biesheuvel <ard.biesheuvel@linaro.org>


That was super quick, thank you (2 minutes :)).

Pushed as commit efadd41590b4.

I also fixed up the missing ">" in Gary's email address in the commit
message. (AFAICS git-send-email saved my bacon and corrected it for the
CC header, so Gary was on CC ultimately. I mainly wanted to inform Gary
that his patch was going to make it into ArmVirtPkg as well.)

Thanks!
Laszlo

>>  ArmVirtPkg/Library/PlatformBootManagerLib/PlatformBm.c | 14 ++++++++------

>>  1 file changed, 8 insertions(+), 6 deletions(-)

>>

>> diff --git a/ArmVirtPkg/Library/PlatformBootManagerLib/PlatformBm.c b/ArmVirtPkg/Library/PlatformBootManagerLib/PlatformBm.c

>> index 198d0602b3c0..eaafe7ff57ea 100644

>> --- a/ArmVirtPkg/Library/PlatformBootManagerLib/PlatformBm.c

>> +++ b/ArmVirtPkg/Library/PlatformBootManagerLib/PlatformBm.c

>> @@ -424,12 +424,6 @@ PlatformRegisterOptionsAndKeys (

>>               NULL, (UINT16) BootOption.OptionNumber, 0, &Esc, NULL

>>               );

>>    ASSERT (Status == EFI_SUCCESS || Status == EFI_ALREADY_STARTED);

>> -  //

>> -  // Register UEFI Shell

>> -  //

>> -  PlatformRegisterFvBootOption (

>> -    PcdGetPtr (PcdShellFile), L"EFI Internal Shell", LOAD_OPTION_ACTIVE

>> -    );

>>  }

>>

>>

>> @@ -558,6 +552,14 @@ PlatformBootManagerAfterConsole (

>>    // the QEMU configuration.

>>    //

>>    EfiBootManagerRefreshAllBootOption ();

>> +

>> +  //

>> +  // Register UEFI Shell

>> +  //

>> +  PlatformRegisterFvBootOption (

>> +    PcdGetPtr (PcdShellFile), L"EFI Internal Shell", LOAD_OPTION_ACTIVE

>> +    );

>> +

>>    SetBootOrderFromQemu ();

>>  }

>>

>> --

>> 1.8.3.1

>>


_______________________________________________
edk2-devel mailing list
edk2-devel@lists.01.org
https://lists.01.org/mailman/listinfo/edk2-devel
diff mbox

Patch

diff --git a/ArmVirtPkg/Library/PlatformBootManagerLib/PlatformBm.c b/ArmVirtPkg/Library/PlatformBootManagerLib/PlatformBm.c
index 198d0602b3c0..eaafe7ff57ea 100644
--- a/ArmVirtPkg/Library/PlatformBootManagerLib/PlatformBm.c
+++ b/ArmVirtPkg/Library/PlatformBootManagerLib/PlatformBm.c
@@ -424,12 +424,6 @@  PlatformRegisterOptionsAndKeys (
              NULL, (UINT16) BootOption.OptionNumber, 0, &Esc, NULL
              );
   ASSERT (Status == EFI_SUCCESS || Status == EFI_ALREADY_STARTED);
-  //
-  // Register UEFI Shell
-  //
-  PlatformRegisterFvBootOption (
-    PcdGetPtr (PcdShellFile), L"EFI Internal Shell", LOAD_OPTION_ACTIVE
-    );
 }
 
 
@@ -558,6 +552,14 @@  PlatformBootManagerAfterConsole (
   // the QEMU configuration.
   //
   EfiBootManagerRefreshAllBootOption ();
+
+  //
+  // Register UEFI Shell
+  //
+  PlatformRegisterFvBootOption (
+    PcdGetPtr (PcdShellFile), L"EFI Internal Shell", LOAD_OPTION_ACTIVE
+    );
+
   SetBootOrderFromQemu ();
 }