* [edk2-platform][PATCH v1 1/1] Platforms/RaspberryPi: Regenerate boot options on boot failure
@ 2020-06-17 21:33 Samer El-Haj-Mahmoud
2020-06-18 7:01 ` Andrei Warkentin
2020-06-18 10:39 ` Ard Biesheuvel
0 siblings, 2 replies; 3+ messages in thread
From: Samer El-Haj-Mahmoud @ 2020-06-17 21:33 UTC (permalink / raw)
To: devel; +Cc: Ard Biesheuvel, Leif Lindholm, Andrei Warkentin, Pete Batard
Port tianocore/edk2@2d233af64b8f73d1b1e138b302e6344f7c2e0f4e
This enables network boot by default on RPi first boot, when all other
boot options fail. This is required for unattended/headless boot cases.
Cc: Ard Biesheuvel <ard.biesheuvel@arm.com>
Cc: Leif Lindholm <leif@nuviainc.com>
Cc: Andrei Warkentin <awarkentin@vmware.com>
Cc: Pete Batard <pete@akeo.ie>
Signed-off-by: Samer El-Haj-Mahmoud <samer.el-haj-mahmoud@arm.com>
---
Platform/RaspberryPi/Library/PlatformBootManagerLib/PlatformBm.c | 36 +++++++++++++++++++-
1 file changed, 35 insertions(+), 1 deletion(-)
diff --git a/Platform/RaspberryPi/Library/PlatformBootManagerLib/PlatformBm.c b/Platform/RaspberryPi/Library/PlatformBootManagerLib/PlatformBm.c
index cb74d65b7f91..fa46be791732 100644
--- a/Platform/RaspberryPi/Library/PlatformBootManagerLib/PlatformBm.c
+++ b/Platform/RaspberryPi/Library/PlatformBootManagerLib/PlatformBm.c
@@ -4,7 +4,7 @@
* Copyright (c) 2017-2018, Andrei Warkentin <andrey.warkentin@gmail.com>
* Copyright (c) 2016, Linaro Ltd. All rights reserved.
* Copyright (c) 2015-2016, Red Hat, Inc.
- * Copyright (c) 2014, ARM Ltd. All rights reserved.
+ * Copyright (c) 2014-2020, ARM Ltd. All rights reserved.
* Copyright (c) 2004-2016, Intel Corporation. All rights reserved.
*
* SPDX-License-Identifier: BSD-2-Clause-Patent
@@ -700,6 +700,40 @@ PlatformBootManagerUnableToBoot (
EFI_INPUT_KEY Key;
EFI_BOOT_MANAGER_LOAD_OPTION BootManagerMenu;
UINTN Index;
+ EFI_BOOT_MANAGER_LOAD_OPTION *BootOptions;
+ UINTN OldBootOptionCount;
+ UINTN NewBootOptionCount;
+
+ //
+ // Record the total number of boot configured boot options
+ //
+ BootOptions = EfiBootManagerGetLoadOptions (&OldBootOptionCount,
+ LoadOptionTypeBoot);
+ EfiBootManagerFreeLoadOptions (BootOptions, OldBootOptionCount);
+
+ //
+ // Connect all devices, and regenerate all boot options
+ //
+ EfiBootManagerConnectAll ();
+ EfiBootManagerRefreshAllBootOption ();
+
+ //
+ // Record the updated number of boot configured boot options
+ //
+ BootOptions = EfiBootManagerGetLoadOptions (&NewBootOptionCount,
+ LoadOptionTypeBoot);
+ EfiBootManagerFreeLoadOptions (BootOptions, NewBootOptionCount);
+
+ //
+ // If the number of configured boot options has changed, reboot
+ // the system so the new boot options will be taken into account
+ // while executing the ordinary BDS bootflow sequence.
+ //
+ if (NewBootOptionCount != OldBootOptionCount) {
+ DEBUG ((DEBUG_WARN, "%a: rebooting after refreshing all boot options\n",
+ __FUNCTION__));
+ gRT->ResetSystem (EfiResetCold, EFI_SUCCESS, 0, NULL);
+ }
//
// BootManagerMenu doesn't contain the correct information when return status
--
2.17.1
^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: [edk2-platform][PATCH v1 1/1] Platforms/RaspberryPi: Regenerate boot options on boot failure
2020-06-17 21:33 [edk2-platform][PATCH v1 1/1] Platforms/RaspberryPi: Regenerate boot options on boot failure Samer El-Haj-Mahmoud
@ 2020-06-18 7:01 ` Andrei Warkentin
2020-06-18 10:39 ` Ard Biesheuvel
1 sibling, 0 replies; 3+ messages in thread
From: Andrei Warkentin @ 2020-06-18 7:01 UTC (permalink / raw)
To: Samer El-Haj-Mahmoud, devel@edk2.groups.io
Cc: Ard Biesheuvel, Leif Lindholm, Pete Batard
[-- Attachment #1: Type: text/plain, Size: 3406 bytes --]
Reviewed-by: Andrei Warkentin <awarkentin@vmware.com>
________________________________
From: Samer El-Haj-Mahmoud <Samer.El-Haj-Mahmoud@arm.com>
Sent: Wednesday, June 17, 2020 4:33 PM
To: devel@edk2.groups.io <devel@edk2.groups.io>
Cc: Ard Biesheuvel <ard.biesheuvel@arm.com>; Leif Lindholm <leif@nuviainc.com>; Andrei Warkentin <awarkentin@vmware.com>; Pete Batard <pete@akeo.ie>
Subject: [edk2-platform][PATCH v1 1/1] Platforms/RaspberryPi: Regenerate boot options on boot failure
Port tianocore/edk2@2d233af64b8f73d1b1e138b302e6344f7c2e0f4e
This enables network boot by default on RPi first boot, when all other
boot options fail. This is required for unattended/headless boot cases.
Cc: Ard Biesheuvel <ard.biesheuvel@arm.com>
Cc: Leif Lindholm <leif@nuviainc.com>
Cc: Andrei Warkentin <awarkentin@vmware.com>
Cc: Pete Batard <pete@akeo.ie>
Signed-off-by: Samer El-Haj-Mahmoud <samer.el-haj-mahmoud@arm.com>
---
Platform/RaspberryPi/Library/PlatformBootManagerLib/PlatformBm.c | 36 +++++++++++++++++++-
1 file changed, 35 insertions(+), 1 deletion(-)
diff --git a/Platform/RaspberryPi/Library/PlatformBootManagerLib/PlatformBm.c b/Platform/RaspberryPi/Library/PlatformBootManagerLib/PlatformBm.c
index cb74d65b7f91..fa46be791732 100644
--- a/Platform/RaspberryPi/Library/PlatformBootManagerLib/PlatformBm.c
+++ b/Platform/RaspberryPi/Library/PlatformBootManagerLib/PlatformBm.c
@@ -4,7 +4,7 @@
* Copyright (c) 2017-2018, Andrei Warkentin <andrey.warkentin@gmail.com>
* Copyright (c) 2016, Linaro Ltd. All rights reserved.
* Copyright (c) 2015-2016, Red Hat, Inc.
- * Copyright (c) 2014, ARM Ltd. All rights reserved.
+ * Copyright (c) 2014-2020, ARM Ltd. All rights reserved.
* Copyright (c) 2004-2016, Intel Corporation. All rights reserved.
*
* SPDX-License-Identifier: BSD-2-Clause-Patent
@@ -700,6 +700,40 @@ PlatformBootManagerUnableToBoot (
EFI_INPUT_KEY Key;
EFI_BOOT_MANAGER_LOAD_OPTION BootManagerMenu;
UINTN Index;
+ EFI_BOOT_MANAGER_LOAD_OPTION *BootOptions;
+ UINTN OldBootOptionCount;
+ UINTN NewBootOptionCount;
+
+ //
+ // Record the total number of boot configured boot options
+ //
+ BootOptions = EfiBootManagerGetLoadOptions (&OldBootOptionCount,
+ LoadOptionTypeBoot);
+ EfiBootManagerFreeLoadOptions (BootOptions, OldBootOptionCount);
+
+ //
+ // Connect all devices, and regenerate all boot options
+ //
+ EfiBootManagerConnectAll ();
+ EfiBootManagerRefreshAllBootOption ();
+
+ //
+ // Record the updated number of boot configured boot options
+ //
+ BootOptions = EfiBootManagerGetLoadOptions (&NewBootOptionCount,
+ LoadOptionTypeBoot);
+ EfiBootManagerFreeLoadOptions (BootOptions, NewBootOptionCount);
+
+ //
+ // If the number of configured boot options has changed, reboot
+ // the system so the new boot options will be taken into account
+ // while executing the ordinary BDS bootflow sequence.
+ //
+ if (NewBootOptionCount != OldBootOptionCount) {
+ DEBUG ((DEBUG_WARN, "%a: rebooting after refreshing all boot options\n",
+ __FUNCTION__));
+ gRT->ResetSystem (EfiResetCold, EFI_SUCCESS, 0, NULL);
+ }
//
// BootManagerMenu doesn't contain the correct information when return status
--
2.17.1
[-- Attachment #2: Type: text/html, Size: 5762 bytes --]
^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: [edk2-platform][PATCH v1 1/1] Platforms/RaspberryPi: Regenerate boot options on boot failure
2020-06-17 21:33 [edk2-platform][PATCH v1 1/1] Platforms/RaspberryPi: Regenerate boot options on boot failure Samer El-Haj-Mahmoud
2020-06-18 7:01 ` Andrei Warkentin
@ 2020-06-18 10:39 ` Ard Biesheuvel
1 sibling, 0 replies; 3+ messages in thread
From: Ard Biesheuvel @ 2020-06-18 10:39 UTC (permalink / raw)
To: Samer El-Haj-Mahmoud, devel; +Cc: Leif Lindholm, Andrei Warkentin, Pete Batard
On 6/17/20 11:33 PM, Samer El-Haj-Mahmoud wrote:
> Port tianocore/edk2@2d233af64b8f73d1b1e138b302e6344f7c2e0f4e
>
> This enables network boot by default on RPi first boot, when all other
> boot options fail. This is required for unattended/headless boot cases.
>
> Cc: Ard Biesheuvel <ard.biesheuvel@arm.com>
> Cc: Leif Lindholm <leif@nuviainc.com>
> Cc: Andrei Warkentin <awarkentin@vmware.com>
> Cc: Pete Batard <pete@akeo.ie>
> Signed-off-by: Samer El-Haj-Mahmoud <samer.el-haj-mahmoud@arm.com>
'Series' pushed as
d2c797e22184 Platforms/RaspberryPi: Fix SMBIOS Type 9
b2bc8596e2ac Platforms/RaspberryPi: Add SMBIOS Type 11
8dd78ea11a38 Platforms/RaspberryPi: Regenerate boot options on boot failure
Thanks,
> ---
> Platform/RaspberryPi/Library/PlatformBootManagerLib/PlatformBm.c | 36 +++++++++++++++++++-
> 1 file changed, 35 insertions(+), 1 deletion(-)
>
> diff --git a/Platform/RaspberryPi/Library/PlatformBootManagerLib/PlatformBm.c b/Platform/RaspberryPi/Library/PlatformBootManagerLib/PlatformBm.c
> index cb74d65b7f91..fa46be791732 100644
> --- a/Platform/RaspberryPi/Library/PlatformBootManagerLib/PlatformBm.c
> +++ b/Platform/RaspberryPi/Library/PlatformBootManagerLib/PlatformBm.c
> @@ -4,7 +4,7 @@
> * Copyright (c) 2017-2018, Andrei Warkentin <andrey.warkentin@gmail.com>
> * Copyright (c) 2016, Linaro Ltd. All rights reserved.
> * Copyright (c) 2015-2016, Red Hat, Inc.
> - * Copyright (c) 2014, ARM Ltd. All rights reserved.
> + * Copyright (c) 2014-2020, ARM Ltd. All rights reserved.
> * Copyright (c) 2004-2016, Intel Corporation. All rights reserved.
> *
> * SPDX-License-Identifier: BSD-2-Clause-Patent
> @@ -700,6 +700,40 @@ PlatformBootManagerUnableToBoot (
> EFI_INPUT_KEY Key;
> EFI_BOOT_MANAGER_LOAD_OPTION BootManagerMenu;
> UINTN Index;
> + EFI_BOOT_MANAGER_LOAD_OPTION *BootOptions;
> + UINTN OldBootOptionCount;
> + UINTN NewBootOptionCount;
> +
> + //
> + // Record the total number of boot configured boot options
> + //
> + BootOptions = EfiBootManagerGetLoadOptions (&OldBootOptionCount,
> + LoadOptionTypeBoot);
> + EfiBootManagerFreeLoadOptions (BootOptions, OldBootOptionCount);
> +
> + //
> + // Connect all devices, and regenerate all boot options
> + //
> + EfiBootManagerConnectAll ();
> + EfiBootManagerRefreshAllBootOption ();
> +
> + //
> + // Record the updated number of boot configured boot options
> + //
> + BootOptions = EfiBootManagerGetLoadOptions (&NewBootOptionCount,
> + LoadOptionTypeBoot);
> + EfiBootManagerFreeLoadOptions (BootOptions, NewBootOptionCount);
> +
> + //
> + // If the number of configured boot options has changed, reboot
> + // the system so the new boot options will be taken into account
> + // while executing the ordinary BDS bootflow sequence.
> + //
> + if (NewBootOptionCount != OldBootOptionCount) {
> + DEBUG ((DEBUG_WARN, "%a: rebooting after refreshing all boot options\n",
> + __FUNCTION__));
> + gRT->ResetSystem (EfiResetCold, EFI_SUCCESS, 0, NULL);
> + }
>
> //
> // BootManagerMenu doesn't contain the correct information when return status
>
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2020-06-18 10:39 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2020-06-17 21:33 [edk2-platform][PATCH v1 1/1] Platforms/RaspberryPi: Regenerate boot options on boot failure Samer El-Haj-Mahmoud
2020-06-18 7:01 ` Andrei Warkentin
2020-06-18 10:39 ` Ard Biesheuvel
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox