From a6631d1e6b9a07e832a800239640d5785207deac Mon Sep 17 00:00:00 2001 From: Mike Beaton Date: Fri, 13 Sep 2024 08:17:40 +0100 Subject: [PATCH] ArmVirtPkg/CI: Copy shell to virtual drive 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. This is needed because a follow up patch will exclude the shell from secure boot enabled firmware images. The same update was previously applied to OvmfPkg by 6862b9d538d96363635677198899e1669e591259. Signed-off-by: Gerd Hoffmann Signed-off-by: Mike Beaton --- ArmVirtPkg/PlatformCI/PlatformBuildLib.py | 16 ++++++++++++++-- 1 file changed, 14 insertions(+), 2 deletions(-) diff --git a/ArmVirtPkg/PlatformCI/PlatformBuildLib.py b/ArmVirtPkg/PlatformCI/PlatformBuildLib.py index 3abab09141..ccc61feaff 100644 --- a/ArmVirtPkg/PlatformCI/PlatformBuildLib.py +++ b/ArmVirtPkg/PlatformCI/PlatformBuildLib.py @@ -5,6 +5,7 @@ # SPDX-License-Identifier: BSD-2-Clause-Patent ## import os +import shutil import logging import io @@ -206,7 +207,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") Built_FV = os.path.join(OutputPath_FV, "QEMU_EFI.fd") @@ -217,7 +219,17 @@ class PlatformBuilder(UefiBuilder, BuildSettingsManager): additional = b'\0' * ((64 * 1024 * 1024)-fvfile.tell()) fvfile.write(additional) - # QEMU must be on that path + # 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{"AA64" if arch == "AARCH64" else arch}.EFI') + if os.path.exists(src): + logging.info("copy %s -> %s", src, dst) + shutil.copyfile(src, dst) + + # QEMU must be on the path # Unique Command and Args parameters per ARCH if (self.env.GetValue("TARGET_ARCH").upper() == "AARCH64"):