strategy:\r
matrix:\r
QEMU_AARCH64_DEBUG:\r
- Build.File: "$(package)/PlatformCI/PlatformBuild.py"\r
+ Build.File: "$(package)/PlatformCI/QemuBuild.py"\r
Build.Arch: "AARCH64"\r
Build.Flags: ""\r
Build.Target: "DEBUG"\r
Run.Flags: $(run_flags)\r
Run: $(should_run)\r
QEMU_AARCH64_RELEASE:\r
- Build.File: "$(package)/PlatformCI/PlatformBuild.py"\r
+ Build.File: "$(package)/PlatformCI/QemuBuild.py"\r
Build.Arch: "AARCH64"\r
Build.Flags: ""\r
Build.Target: "RELEASE"\r
Run.Flags: $(run_flags)\r
Run: $(should_run)\r
QEMU_AARCH64_NOOPT:\r
- Build.File: "$(package)/PlatformCI/PlatformBuild.py"\r
+ Build.File: "$(package)/PlatformCI/QemuBuild.py"\r
Build.Arch: "AARCH64"\r
Build.Flags: ""\r
Build.Target: "NOOPT"\r
Run.Flags: $(run_flags)\r
Run: $(should_run)\r
QEMU_ARM_DEBUG:\r
- Build.File: "$(package)/PlatformCI/PlatformBuild.py"\r
+ Build.File: "$(package)/PlatformCI/QemuBuild.py"\r
Build.Arch: "ARM"\r
Build.Flags: ""\r
Build.Target: "DEBUG"\r
Run.Flags: $(run_flags)\r
Run: $(should_run)\r
QEMU_ARM_RELEASE:\r
- Build.File: "$(package)/PlatformCI/PlatformBuild.py"\r
+ Build.File: "$(package)/PlatformCI/QemuBuild.py"\r
Build.Arch: "ARM"\r
Build.Flags: ""\r
Build.Target: "RELEASE"\r
Run.Flags: $(run_flags)\r
Run: $(should_run)\r
QEMU_ARM_NOOPT:\r
- Build.File: "$(package)/PlatformCI/PlatformBuild.py"\r
+ Build.File: "$(package)/PlatformCI/QemuBuild.py"\r
Build.Arch: "ARM"\r
Build.Flags: ""\r
Build.Target: "NOOPT"\r
+++ /dev/null
-# @file\r
-# Script to Build ArmVirtPkg UEFI firmware\r
-#\r
-# Copyright (c) Microsoft Corporation.\r
-# SPDX-License-Identifier: BSD-2-Clause-Patent\r
-##\r
-import os\r
-import logging\r
-import io\r
-\r
-from edk2toolext.environment import shell_environment\r
-from edk2toolext.environment.uefi_build import UefiBuilder\r
-from edk2toolext.invocables.edk2_platform_build import BuildSettingsManager\r
-from edk2toolext.invocables.edk2_setup import SetupSettingsManager, RequiredSubmodule\r
-from edk2toolext.invocables.edk2_update import UpdateSettingsManager\r
-from edk2toolext.invocables.edk2_pr_eval import PrEvalSettingsManager\r
-from edk2toollib.utility_functions import RunCmd\r
-from edk2toollib.utility_functions import GetHostInfo\r
-\r
-# ####################################################################################### #\r
-# Common Configuration #\r
-# ####################################################################################### #\r
-\r
-\r
-class CommonPlatform():\r
- ''' Common settings for this platform. Define static data here and use\r
- for the different parts of stuart\r
- '''\r
- PackagesSupported = ("ArmVirtPkg",)\r
- ArchSupported = ("AARCH64", "ARM")\r
- TargetsSupported = ("DEBUG", "RELEASE", "NOOPT")\r
- Scopes = ('armvirt', 'edk2-build')\r
- WorkspaceRoot = os.path.realpath(os.path.join(\r
- os.path.dirname(os.path.abspath(__file__)), "..", ".."))\r
-\r
- # ####################################################################################### #\r
- # Configuration for Update & Setup #\r
- # ####################################################################################### #\r
-\r
-\r
-class SettingsManager(UpdateSettingsManager, SetupSettingsManager, PrEvalSettingsManager):\r
-\r
- def GetPackagesSupported(self):\r
- ''' return iterable of edk2 packages supported by this build.\r
- These should be edk2 workspace relative paths '''\r
- return CommonPlatform.PackagesSupported\r
-\r
- def GetArchitecturesSupported(self):\r
- ''' return iterable of edk2 architectures supported by this build '''\r
- return CommonPlatform.ArchSupported\r
-\r
- def GetTargetsSupported(self):\r
- ''' return iterable of edk2 target tags supported by this build '''\r
- return CommonPlatform.TargetsSupported\r
-\r
- def GetRequiredSubmodules(self):\r
- ''' return iterable containing RequiredSubmodule objects.\r
- If no RequiredSubmodules return an empty iterable\r
- '''\r
- rs = []\r
-\r
- # intentionally declare this one with recursive false to avoid overhead\r
- rs.append(RequiredSubmodule(\r
- "CryptoPkg/Library/OpensslLib/openssl", False))\r
-\r
- # To avoid maintenance of this file for every new submodule\r
- # lets just parse the .gitmodules and add each if not already in list.\r
- # The GetRequiredSubmodules is designed to allow a build to optimize\r
- # the desired submodules but it isn't necessary for this repository.\r
- result = io.StringIO()\r
- ret = RunCmd("git", "config --file .gitmodules --get-regexp path", workingdir=self.GetWorkspaceRoot(), outstream=result)\r
- # Cmd output is expected to look like:\r
- # submodule.CryptoPkg/Library/OpensslLib/openssl.path CryptoPkg/Library/OpensslLib/openssl\r
- # submodule.SoftFloat.path ArmPkg/Library/ArmSoftFloatLib/berkeley-softfloat-3\r
- if ret == 0:\r
- for line in result.getvalue().splitlines():\r
- _, _, path = line.partition(" ")\r
- if path is not None:\r
- if path not in [x.path for x in rs]:\r
- rs.append(RequiredSubmodule(path, True)) # add it with recursive since we don't know\r
- return rs\r
-\r
- def SetArchitectures(self, list_of_requested_architectures):\r
- ''' Confirm the requests architecture list is valid and configure SettingsManager\r
- to run only the requested architectures.\r
-\r
- Raise Exception if a list_of_requested_architectures is not supported\r
- '''\r
- unsupported = set(list_of_requested_architectures) - \\r
- set(self.GetArchitecturesSupported())\r
- if(len(unsupported) > 0):\r
- errorString = (\r
- "Unsupported Architecture Requested: " + " ".join(unsupported))\r
- logging.critical(errorString)\r
- raise Exception(errorString)\r
- self.ActualArchitectures = list_of_requested_architectures\r
-\r
- def GetWorkspaceRoot(self):\r
- ''' get WorkspacePath '''\r
- return CommonPlatform.WorkspaceRoot\r
-\r
- def GetActiveScopes(self):\r
- ''' return tuple containing scopes that should be active for this process '''\r
-\r
- scopes = CommonPlatform.Scopes\r
- ActualToolChainTag = shell_environment.GetBuildVars().GetValue("TOOL_CHAIN_TAG", "")\r
-\r
- if GetHostInfo().os.upper() == "LINUX" and ActualToolChainTag.upper().startswith("GCC"):\r
- if "AARCH64" in self.ActualArchitectures:\r
- scopes += ("gcc_aarch64_linux",)\r
- if "ARM" in self.ActualArchitectures:\r
- scopes += ("gcc_arm_linux",)\r
- return scopes\r
-\r
- def FilterPackagesToTest(self, changedFilesList: list, potentialPackagesList: list) -> list:\r
- ''' Filter other cases that this package should be built\r
- based on changed files. This should cover things that can't\r
- be detected as dependencies. '''\r
- build_these_packages = []\r
- possible_packages = potentialPackagesList.copy()\r
- for f in changedFilesList:\r
- # BaseTools files that might change the build\r
- if "BaseTools" in f:\r
- if os.path.splitext(f) not in [".txt", ".md"]:\r
- build_these_packages = possible_packages\r
- break\r
-\r
- # if the azure pipeline platform template file changed\r
- if "platform-build-run-steps.yml" in f:\r
- build_these_packages = possible_packages\r
- break\r
-\r
-\r
- return build_these_packages\r
-\r
- def GetPlatformDscAndConfig(self) -> tuple:\r
- ''' If a platform desires to provide its DSC then Policy 4 will evaluate if\r
- any of the changes will be built in the dsc.\r
-\r
- The tuple should be (<workspace relative path to dsc file>, <input dictionary of dsc key value pairs>)\r
- '''\r
- return (os.path.join("ArmVirtPkg", "ArmVirtQemu.dsc"), {})\r
-\r
-\r
- # ####################################################################################### #\r
- # Actual Configuration for Platform Build #\r
- # ####################################################################################### #\r
-\r
-\r
-class PlatformBuilder(UefiBuilder, BuildSettingsManager):\r
- def __init__(self):\r
- UefiBuilder.__init__(self)\r
-\r
- def AddCommandLineOptions(self, parserObj):\r
- ''' Add command line options to the argparser '''\r
- parserObj.add_argument('-a', "--arch", dest="build_arch", type=str, default="AARCH64",\r
- help="Optional - Architecture to build. Default = AARCH64")\r
-\r
- def RetrieveCommandLineOptions(self, args):\r
- ''' Retrieve command line options from the argparser '''\r
-\r
- shell_environment.GetBuildVars().SetValue(\r
- "TARGET_ARCH", args.build_arch.upper(), "From CmdLine")\r
-\r
- shell_environment.GetBuildVars().SetValue(\r
- "ACTIVE_PLATFORM", "ArmVirtPkg/ArmVirtQemu.dsc", "From CmdLine")\r
-\r
- def GetWorkspaceRoot(self):\r
- ''' get WorkspacePath '''\r
- return CommonPlatform.WorkspaceRoot\r
-\r
- def GetPackagesPath(self):\r
- ''' Return a list of workspace relative paths that should be mapped as edk2 PackagesPath '''\r
- return ()\r
-\r
- def GetActiveScopes(self):\r
- ''' return tuple containing scopes that should be active for this process '''\r
- scopes = CommonPlatform.Scopes\r
- ActualToolChainTag = shell_environment.GetBuildVars().GetValue("TOOL_CHAIN_TAG", "")\r
- Arch = shell_environment.GetBuildVars().GetValue("TARGET_ARCH", "")\r
-\r
- if GetHostInfo().os.upper() == "LINUX" and ActualToolChainTag.upper().startswith("GCC"):\r
- if "AARCH64" == Arch:\r
- scopes += ("gcc_aarch64_linux",)\r
- elif "ARM" == Arch:\r
- scopes += ("gcc_arm_linux",)\r
- return scopes\r
-\r
- def GetName(self):\r
- ''' Get the name of the repo, platform, or product being build '''\r
- ''' Used for naming the log file, among others '''\r
- # check the startup nsh flag and if set then rename the log file.\r
- # this helps in CI so we don't overwrite the build log since running\r
- # uses the stuart_build command.\r
- if(shell_environment.GetBuildVars().GetValue("MAKE_STARTUP_NSH", "FALSE") == "TRUE"):\r
- return "ArmVirtPkg_With_Run"\r
- return "ArmVirtPkg"\r
-\r
- def GetLoggingLevel(self, loggerType):\r
- ''' Get the logging level for a given type\r
- base == lowest logging level supported\r
- con == Screen logging\r
- txt == plain text file logging\r
- md == markdown file logging\r
- '''\r
- return logging.DEBUG\r
-\r
- def SetPlatformEnv(self):\r
- logging.debug("PlatformBuilder SetPlatformEnv")\r
- self.env.SetValue("PRODUCT_NAME", "ArmVirtQemu", "Platform Hardcoded")\r
- self.env.SetValue("MAKE_STARTUP_NSH", "FALSE", "Default to false")\r
- self.env.SetValue("QEMU_HEADLESS", "FALSE", "Default to false")\r
- return 0\r
-\r
- def PlatformPreBuild(self):\r
- return 0\r
-\r
- def PlatformPostBuild(self):\r
- return 0\r
-\r
- def FlashRomImage(self):\r
- VirtualDrive = os.path.join(self.env.GetValue(\r
- "BUILD_OUTPUT_BASE"), "VirtualDrive")\r
- os.makedirs(VirtualDrive, exist_ok=True)\r
- OutputPath_FV = os.path.join(\r
- self.env.GetValue("BUILD_OUTPUT_BASE"), "FV")\r
- Built_FV = os.path.join(OutputPath_FV, "QEMU_EFI.fd")\r
-\r
- # pad fd to 64mb\r
- with open(Built_FV, "ab") as fvfile:\r
- fvfile.seek(0, os.SEEK_END)\r
- additional = b'\0' * ((64 * 1024 * 1024)-fvfile.tell())\r
- fvfile.write(additional)\r
-\r
- # QEMU must be on that path\r
-\r
- # Unique Command and Args parameters per ARCH\r
- if (self.env.GetValue("TARGET_ARCH").upper() == "AARCH64"):\r
- cmd = "qemu-system-aarch64"\r
- args = "-M virt"\r
- args += " -cpu cortex-a57" # emulate cpu\r
- elif(self.env.GetValue("TARGET_ARCH").upper() == "ARM"):\r
- cmd = "qemu-system-arm"\r
- args = "-M virt"\r
- args += " -cpu cortex-a15" # emulate cpu\r
- else:\r
- raise NotImplementedError()\r
-\r
- # Common Args\r
- args += " -pflash " + Built_FV # path to fw\r
- args += " -m 1024" # 1gb memory\r
- # turn off network\r
- args += " -net none"\r
- # Serial messages out\r
- args += " -serial stdio"\r
- # Mount disk with startup.nsh\r
- args += f" -drive file=fat:rw:{VirtualDrive},format=raw,media=disk"\r
-\r
- # Conditional Args\r
- if (self.env.GetValue("QEMU_HEADLESS").upper() == "TRUE"):\r
- args += " -display none" # no graphics\r
-\r
- if (self.env.GetValue("MAKE_STARTUP_NSH").upper() == "TRUE"):\r
- f = open(os.path.join(VirtualDrive, "startup.nsh"), "w")\r
- f.write("BOOT SUCCESS !!! \n")\r
- # add commands here\r
- f.write("reset -s\n")\r
- f.close()\r
-\r
- ret = RunCmd(cmd, args)\r
-\r
- if ret == 0xc0000005:\r
- # for some reason getting a c0000005 on successful return\r
- return 0\r
-\r
- return ret\r
--- /dev/null
+# @file\r
+# Script to Build ArmVirtPkg UEFI firmware\r
+#\r
+# Copyright (c) Microsoft Corporation.\r
+# SPDX-License-Identifier: BSD-2-Clause-Patent\r
+##\r
+import os\r
+import logging\r
+import io\r
+\r
+from edk2toolext.environment import shell_environment\r
+from edk2toolext.environment.uefi_build import UefiBuilder\r
+from edk2toolext.invocables.edk2_platform_build import BuildSettingsManager\r
+from edk2toolext.invocables.edk2_setup import SetupSettingsManager, RequiredSubmodule\r
+from edk2toolext.invocables.edk2_update import UpdateSettingsManager\r
+from edk2toolext.invocables.edk2_pr_eval import PrEvalSettingsManager\r
+from edk2toollib.utility_functions import RunCmd\r
+from edk2toollib.utility_functions import GetHostInfo\r
+\r
+\r
+ # ####################################################################################### #\r
+ # Configuration for Update & Setup #\r
+ # ####################################################################################### #\r
+\r
+\r
+class SettingsManager(UpdateSettingsManager, SetupSettingsManager, PrEvalSettingsManager):\r
+\r
+ def GetPackagesSupported(self):\r
+ ''' return iterable of edk2 packages supported by this build.\r
+ These should be edk2 workspace relative paths '''\r
+ return CommonPlatform.PackagesSupported\r
+\r
+ def GetArchitecturesSupported(self):\r
+ ''' return iterable of edk2 architectures supported by this build '''\r
+ return CommonPlatform.ArchSupported\r
+\r
+ def GetTargetsSupported(self):\r
+ ''' return iterable of edk2 target tags supported by this build '''\r
+ return CommonPlatform.TargetsSupported\r
+\r
+ def GetRequiredSubmodules(self):\r
+ ''' return iterable containing RequiredSubmodule objects.\r
+ If no RequiredSubmodules return an empty iterable\r
+ '''\r
+ rs = []\r
+\r
+ # intentionally declare this one with recursive false to avoid overhead\r
+ rs.append(RequiredSubmodule(\r
+ "CryptoPkg/Library/OpensslLib/openssl", False))\r
+\r
+ # To avoid maintenance of this file for every new submodule\r
+ # lets just parse the .gitmodules and add each if not already in list.\r
+ # The GetRequiredSubmodules is designed to allow a build to optimize\r
+ # the desired submodules but it isn't necessary for this repository.\r
+ result = io.StringIO()\r
+ ret = RunCmd("git", "config --file .gitmodules --get-regexp path", workingdir=self.GetWorkspaceRoot(), outstream=result)\r
+ # Cmd output is expected to look like:\r
+ # submodule.CryptoPkg/Library/OpensslLib/openssl.path CryptoPkg/Library/OpensslLib/openssl\r
+ # submodule.SoftFloat.path ArmPkg/Library/ArmSoftFloatLib/berkeley-softfloat-3\r
+ if ret == 0:\r
+ for line in result.getvalue().splitlines():\r
+ _, _, path = line.partition(" ")\r
+ if path is not None:\r
+ if path not in [x.path for x in rs]:\r
+ rs.append(RequiredSubmodule(path, True)) # add it with recursive since we don't know\r
+ return rs\r
+\r
+ def SetArchitectures(self, list_of_requested_architectures):\r
+ ''' Confirm the requests architecture list is valid and configure SettingsManager\r
+ to run only the requested architectures.\r
+\r
+ Raise Exception if a list_of_requested_architectures is not supported\r
+ '''\r
+ unsupported = set(list_of_requested_architectures) - \\r
+ set(self.GetArchitecturesSupported())\r
+ if(len(unsupported) > 0):\r
+ errorString = (\r
+ "Unsupported Architecture Requested: " + " ".join(unsupported))\r
+ logging.critical(errorString)\r
+ raise Exception(errorString)\r
+ self.ActualArchitectures = list_of_requested_architectures\r
+\r
+ def GetWorkspaceRoot(self):\r
+ ''' get WorkspacePath '''\r
+ return CommonPlatform.WorkspaceRoot\r
+\r
+ def GetActiveScopes(self):\r
+ ''' return tuple containing scopes that should be active for this process '''\r
+\r
+ scopes = CommonPlatform.Scopes\r
+ ActualToolChainTag = shell_environment.GetBuildVars().GetValue("TOOL_CHAIN_TAG", "")\r
+\r
+ if GetHostInfo().os.upper() == "LINUX" and ActualToolChainTag.upper().startswith("GCC"):\r
+ if "AARCH64" in self.ActualArchitectures:\r
+ scopes += ("gcc_aarch64_linux",)\r
+ if "ARM" in self.ActualArchitectures:\r
+ scopes += ("gcc_arm_linux",)\r
+ return scopes\r
+\r
+ def FilterPackagesToTest(self, changedFilesList: list, potentialPackagesList: list) -> list:\r
+ ''' Filter other cases that this package should be built\r
+ based on changed files. This should cover things that can't\r
+ be detected as dependencies. '''\r
+ build_these_packages = []\r
+ possible_packages = potentialPackagesList.copy()\r
+ for f in changedFilesList:\r
+ # BaseTools files that might change the build\r
+ if "BaseTools" in f:\r
+ if os.path.splitext(f) not in [".txt", ".md"]:\r
+ build_these_packages = possible_packages\r
+ break\r
+\r
+ # if the azure pipeline platform template file changed\r
+ if "platform-build-run-steps.yml" in f:\r
+ build_these_packages = possible_packages\r
+ break\r
+\r
+\r
+ return build_these_packages\r
+\r
+ def GetPlatformDscAndConfig(self) -> tuple:\r
+ ''' If a platform desires to provide its DSC then Policy 4 will evaluate if\r
+ any of the changes will be built in the dsc.\r
+\r
+ The tuple should be (<workspace relative path to dsc file>, <input dictionary of dsc key value pairs>)\r
+ '''\r
+ return (CommonPlatform.DscName, {})\r
+\r
+\r
+ # ####################################################################################### #\r
+ # Actual Configuration for Platform Build #\r
+ # ####################################################################################### #\r
+\r
+\r
+class PlatformBuilder(UefiBuilder, BuildSettingsManager):\r
+ def __init__(self):\r
+ UefiBuilder.__init__(self)\r
+\r
+ def AddCommandLineOptions(self, parserObj):\r
+ ''' Add command line options to the argparser '''\r
+ parserObj.add_argument('-a', "--arch", dest="build_arch", type=str, default="AARCH64",\r
+ help="Optional - Architecture to build. Default = AARCH64")\r
+\r
+ def RetrieveCommandLineOptions(self, args):\r
+ ''' Retrieve command line options from the argparser '''\r
+\r
+ shell_environment.GetBuildVars().SetValue(\r
+ "TARGET_ARCH", args.build_arch.upper(), "From CmdLine")\r
+\r
+ shell_environment.GetBuildVars().SetValue(\r
+ "ACTIVE_PLATFORM", CommonPlatform.DscName, "From CmdLine")\r
+\r
+ def GetWorkspaceRoot(self):\r
+ ''' get WorkspacePath '''\r
+ return CommonPlatform.WorkspaceRoot\r
+\r
+ def GetPackagesPath(self):\r
+ ''' Return a list of workspace relative paths that should be mapped as edk2 PackagesPath '''\r
+ return ()\r
+\r
+ def GetActiveScopes(self):\r
+ ''' return tuple containing scopes that should be active for this process '''\r
+ scopes = CommonPlatform.Scopes\r
+ ActualToolChainTag = shell_environment.GetBuildVars().GetValue("TOOL_CHAIN_TAG", "")\r
+ Arch = shell_environment.GetBuildVars().GetValue("TARGET_ARCH", "")\r
+\r
+ if GetHostInfo().os.upper() == "LINUX" and ActualToolChainTag.upper().startswith("GCC"):\r
+ if "AARCH64" == Arch:\r
+ scopes += ("gcc_aarch64_linux",)\r
+ elif "ARM" == Arch:\r
+ scopes += ("gcc_arm_linux",)\r
+ return scopes\r
+\r
+ def GetName(self):\r
+ ''' Get the name of the repo, platform, or product being build '''\r
+ ''' Used for naming the log file, among others '''\r
+ # check the startup nsh flag and if set then rename the log file.\r
+ # this helps in CI so we don't overwrite the build log since running\r
+ # uses the stuart_build command.\r
+ if(shell_environment.GetBuildVars().GetValue("MAKE_STARTUP_NSH", "FALSE") == "TRUE"):\r
+ return "ArmVirtPkg_With_Run"\r
+ return "ArmVirtPkg"\r
+\r
+ def GetLoggingLevel(self, loggerType):\r
+ ''' Get the logging level for a given type\r
+ base == lowest logging level supported\r
+ con == Screen logging\r
+ txt == plain text file logging\r
+ md == markdown file logging\r
+ '''\r
+ return logging.DEBUG\r
+\r
+ def SetPlatformEnv(self):\r
+ logging.debug("PlatformBuilder SetPlatformEnv")\r
+ self.env.SetValue("PRODUCT_NAME", "ArmVirtQemu", "Platform Hardcoded")\r
+ self.env.SetValue("MAKE_STARTUP_NSH", "FALSE", "Default to false")\r
+ self.env.SetValue("QEMU_HEADLESS", "FALSE", "Default to false")\r
+ return 0\r
+\r
+ def PlatformPreBuild(self):\r
+ return 0\r
+\r
+ def PlatformPostBuild(self):\r
+ return 0\r
+\r
+ def FlashRomImage(self):\r
+ VirtualDrive = os.path.join(self.env.GetValue(\r
+ "BUILD_OUTPUT_BASE"), "VirtualDrive")\r
+ os.makedirs(VirtualDrive, exist_ok=True)\r
+ OutputPath_FV = os.path.join(\r
+ self.env.GetValue("BUILD_OUTPUT_BASE"), "FV")\r
+ Built_FV = os.path.join(OutputPath_FV, "QEMU_EFI.fd")\r
+\r
+ # pad fd to 64mb\r
+ with open(Built_FV, "ab") as fvfile:\r
+ fvfile.seek(0, os.SEEK_END)\r
+ additional = b'\0' * ((64 * 1024 * 1024)-fvfile.tell())\r
+ fvfile.write(additional)\r
+\r
+ # QEMU must be on that path\r
+\r
+ # Unique Command and Args parameters per ARCH\r
+ if (self.env.GetValue("TARGET_ARCH").upper() == "AARCH64"):\r
+ cmd = "qemu-system-aarch64"\r
+ args = "-M virt"\r
+ args += " -cpu cortex-a57" # emulate cpu\r
+ elif(self.env.GetValue("TARGET_ARCH").upper() == "ARM"):\r
+ cmd = "qemu-system-arm"\r
+ args = "-M virt"\r
+ args += " -cpu cortex-a15" # emulate cpu\r
+ else:\r
+ raise NotImplementedError()\r
+\r
+ # Common Args\r
+ args += " -pflash " + Built_FV # path to fw\r
+ args += " -m 1024" # 1gb memory\r
+ # turn off network\r
+ args += " -net none"\r
+ # Serial messages out\r
+ args += " -serial stdio"\r
+ # Mount disk with startup.nsh\r
+ args += f" -drive file=fat:rw:{VirtualDrive},format=raw,media=disk"\r
+\r
+ # Conditional Args\r
+ if (self.env.GetValue("QEMU_HEADLESS").upper() == "TRUE"):\r
+ args += " -display none" # no graphics\r
+\r
+ if (self.env.GetValue("MAKE_STARTUP_NSH").upper() == "TRUE"):\r
+ f = open(os.path.join(VirtualDrive, "startup.nsh"), "w")\r
+ f.write("BOOT SUCCESS !!! \n")\r
+ # add commands here\r
+ f.write("reset -s\n")\r
+ f.close()\r
+\r
+ ret = RunCmd(cmd, args)\r
+\r
+ if ret == 0xc0000005:\r
+ # for some reason getting a c0000005 on successful return\r
+ return 0\r
+\r
+ return ret\r
--- /dev/null
+# @file\r
+# Script to Build OVMF UEFI firmware\r
+#\r
+# Copyright (c) Microsoft Corporation.\r
+# SPDX-License-Identifier: BSD-2-Clause-Patent\r
+##\r
+import os\r
+import sys\r
+\r
+sys.path.append(os.path.dirname(os.path.abspath(__file__)))\r
+from PlatformBuildLib import SettingsManager\r
+from PlatformBuildLib import PlatformBuilder\r
+\r
+ # ####################################################################################### #\r
+ # Common Configuration #\r
+ # ####################################################################################### #\r
+class CommonPlatform():\r
+ ''' Common settings for this platform. Define static data here and use\r
+ for the different parts of stuart\r
+ '''\r
+ PackagesSupported = ("ArmVirtPkg",)\r
+ ArchSupported = ("AARCH64", "ARM")\r
+ TargetsSupported = ("DEBUG", "RELEASE", "NOOPT")\r
+ Scopes = ('armvirt', 'edk2-build')\r
+ WorkspaceRoot = os.path.realpath(os.path.join(\r
+ os.path.dirname(os.path.abspath(__file__)), "..", ".."))\r
+\r
+ DscName = os.path.join("ArmVirtPkg", "ArmVirtQemu.dsc")\r
+\r
+import PlatformBuildLib\r
+PlatformBuildLib.CommonPlatform = CommonPlatform\r