[edk2-devel] [PATCH 11/11] OvmfPkg/CI: copy shell to virtual drive

Gerd Hoffmann posted 11 patches 2 years, 4 months ago
[edk2-devel] [PATCH 11/11] OvmfPkg/CI: copy shell to virtual drive
Posted by Gerd Hoffmann 2 years, 4 months ago
Place the EFI shell as EFI/BOOT/BOOT{ARCH}.EFI on the virtual drive.
This allows the "run to shell" CI test case to work even in case the
shell is not included in the firmware image.

Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
---
 OvmfPkg/PlatformCI/PlatformBuildLib.py | 12 +++++++++++-
 1 file changed, 11 insertions(+), 1 deletion(-)

diff --git a/OvmfPkg/PlatformCI/PlatformBuildLib.py b/OvmfPkg/PlatformCI/PlatformBuildLib.py
index f829738cdda4..00d454954bff 100644
--- a/OvmfPkg/PlatformCI/PlatformBuildLib.py
+++ b/OvmfPkg/PlatformCI/PlatformBuildLib.py
@@ -5,6 +5,7 @@
 # SPDX-License-Identifier: BSD-2-Clause-Patent
 ##
 import os
+import shutil
 import logging
 import io
 
@@ -181,7 +182,8 @@ class PlatformBuilder( UefiBuilder, BuildSettingsManager):
 
     def FlashRomImage(self):
         VirtualDrive = os.path.join(self.env.GetValue("BUILD_OUTPUT_BASE"), "VirtualDrive")
-        os.makedirs(VirtualDrive, exist_ok=True)
+        VirtualDriveBoot = os.path.join(VirtualDrive, "EFI", "BOOT")
+        os.makedirs(VirtualDriveBoot, exist_ok=True)
         OutputPath_FV = os.path.join(self.env.GetValue("BUILD_OUTPUT_BASE"), "FV")
 
         if (self.env.GetValue("QEMU_SKIP") and
@@ -189,6 +191,14 @@ class PlatformBuilder( UefiBuilder, BuildSettingsManager):
             logging.info("skipping qemu boot test")
             return 0
 
+        # copy shell to VirtualDrive
+        for arch in self.env.GetValue("TARGET_ARCH").split():
+            src = os.path.join(self.env.GetValue("BUILD_OUTPUT_BASE"), arch, "Shell.efi")
+            dst = os.path.join(VirtualDriveBoot, f'BOOT{arch}.EFI')
+            if os.path.exists(src):
+                logging.info("copy %s -> %s", src, dst)
+                shutil.copyfile(src, dst)
+
         #
         # QEMU must be on the path
         #
-- 
2.43.0



-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.
View/Reply Online (#114328): https://edk2.groups.io/g/devel/message/114328
Mute This Topic: https://groups.io/mt/103935352/1787277
Group Owner: devel+owner@edk2.groups.io
Unsubscribe: https://edk2.groups.io/g/devel/unsub [importer@patchew.org]
-=-=-=-=-=-=-=-=-=-=-=-
Re: [edk2-devel] [PATCH 11/11] OvmfPkg/CI: copy shell to virtual drive
Posted by Laszlo Ersek 2 years, 4 months ago
On 1/24/24 17:38, Gerd Hoffmann wrote:
> Place the EFI shell as EFI/BOOT/BOOT{ARCH}.EFI on the virtual drive.
> This allows the "run to shell" CI test case to work even in case the
> shell is not included in the firmware image.

In the commit message, can you list the platforms explicitly that
benefit from this change?

Thanks,
Laszlo

> 
> Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
> ---
>  OvmfPkg/PlatformCI/PlatformBuildLib.py | 12 +++++++++++-
>  1 file changed, 11 insertions(+), 1 deletion(-)
> 
> diff --git a/OvmfPkg/PlatformCI/PlatformBuildLib.py b/OvmfPkg/PlatformCI/PlatformBuildLib.py
> index f829738cdda4..00d454954bff 100644
> --- a/OvmfPkg/PlatformCI/PlatformBuildLib.py
> +++ b/OvmfPkg/PlatformCI/PlatformBuildLib.py
> @@ -5,6 +5,7 @@
>  # SPDX-License-Identifier: BSD-2-Clause-Patent
>  ##
>  import os
> +import shutil
>  import logging
>  import io
>  
> @@ -181,7 +182,8 @@ class PlatformBuilder( UefiBuilder, BuildSettingsManager):
>  
>      def FlashRomImage(self):
>          VirtualDrive = os.path.join(self.env.GetValue("BUILD_OUTPUT_BASE"), "VirtualDrive")
> -        os.makedirs(VirtualDrive, exist_ok=True)
> +        VirtualDriveBoot = os.path.join(VirtualDrive, "EFI", "BOOT")
> +        os.makedirs(VirtualDriveBoot, exist_ok=True)
>          OutputPath_FV = os.path.join(self.env.GetValue("BUILD_OUTPUT_BASE"), "FV")
>  
>          if (self.env.GetValue("QEMU_SKIP") and
> @@ -189,6 +191,14 @@ class PlatformBuilder( UefiBuilder, BuildSettingsManager):
>              logging.info("skipping qemu boot test")
>              return 0
>  
> +        # copy shell to VirtualDrive
> +        for arch in self.env.GetValue("TARGET_ARCH").split():
> +            src = os.path.join(self.env.GetValue("BUILD_OUTPUT_BASE"), arch, "Shell.efi")
> +            dst = os.path.join(VirtualDriveBoot, f'BOOT{arch}.EFI')
> +            if os.path.exists(src):
> +                logging.info("copy %s -> %s", src, dst)
> +                shutil.copyfile(src, dst)
> +
>          #
>          # QEMU must be on the path
>          #



-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.
View/Reply Online (#114437): https://edk2.groups.io/g/devel/message/114437
Mute This Topic: https://groups.io/mt/103935352/1787277
Group Owner: devel+owner@edk2.groups.io
Unsubscribe: https://edk2.groups.io/g/devel/leave/3901457/1787277/102458076/xyzzy [importer@patchew.org]
-=-=-=-=-=-=-=-=-=-=-=-