--- /dev/null
+## @file\r
+# Core CI configuration for OvmfPkg\r
+#\r
+# OvmfPkg is part of Platform Ci for builds so this is only\r
+# used for code analysis.\r
+#\r
+# Copyright (c) Microsoft Corporation\r
+# SPDX-License-Identifier: BSD-2-Clause-Patent\r
+##\r
+{\r
+ ## options defined .pytool/Plugin/CompilerPlugin\r
+ "CompilerPlugin": {\r
+ "DscPath": "" # Don't support this test\r
+ },\r
+\r
+ ## options defined .pytool/Plugin/HostUnitTestCompilerPlugin\r
+ "HostUnitTestCompilerPlugin": {\r
+ "DscPath": "" # Don't support this test\r
+ },\r
+\r
+ ## options defined .pytool/Plugin/CharEncodingCheck\r
+ "CharEncodingCheck": {\r
+ "IgnoreFiles": []\r
+ },\r
+\r
+ ## options defined .pytool/Plugin/DependencyCheck\r
+ "DependencyCheck": {\r
+ "AcceptableDependencies": [\r
+ "MdePkg/MdePkg.dec",\r
+ "MdeModulePkg/MdeModulePkg.dec",\r
+ "OvmfPkg/OvmfPkg.dec",\r
+ "NetworkPkg/NetworkPkg.dec",\r
+ "SecurityPkg/SecurityPkg.dec",\r
+ "UefiCpuPkg/UefiCpuPkg.dec",\r
+ "ShellPkg/ShellPkg.dec",\r
+ "EmbeddedPkg/EmbeddedPkg.dec",\r
+ "SourceLevelDebugPkg/SourceLevelDebugPkg.dec"\r
+ ],\r
+ # For host based unit tests\r
+ "AcceptableDependencies-HOST_APPLICATION":[\r
+ "UnitTestFrameworkPkg/UnitTestFrameworkPkg.dec"\r
+ ],\r
+ # For UEFI shell based apps\r
+ "AcceptableDependencies-UEFI_APPLICATION":[],\r
+ "IgnoreInf": []\r
+ },\r
+\r
+ ## options defined .pytool/Plugin/DscCompleteCheck\r
+ "DscCompleteCheck": {\r
+ "IgnoreInf": [""],\r
+ "DscPath": "" # Don't support this test\r
+ },\r
+\r
+ ## options defined .pytool/Plugin/HostUnitTestDscCompleteCheck\r
+ "HostUnitTestDscCompleteCheck": {\r
+ "IgnoreInf": [""],\r
+ "DscPath": "" # Don't support this test\r
+ },\r
+\r
+ ## options defined .pytool/Plugin/GuidCheck\r
+ "GuidCheck": {\r
+ "IgnoreGuidName": ["ResetVector", "XenResetVector"], # Expected duplication for gEfiFirmwareVolumeTopFileGuid\r
+ "IgnoreGuidValue": [],\r
+ "IgnoreFoldersAndFiles": [],\r
+ "IgnoreDuplicates": [],\r
+ },\r
+\r
+ ## options defined .pytool/Plugin/LibraryClassCheck\r
+ "LibraryClassCheck": {\r
+ "IgnoreHeaderFile": []\r
+ },\r
+\r
+ ## options defined .pytool/Plugin/SpellCheck\r
+ "SpellCheck": {\r
+ "AuditOnly": True, # Fails right now with over 270 errors\r
+ "IgnoreFiles": [], # use gitignore syntax to ignore errors in matching files\r
+ "ExtendWords": [\r
+\r
+ ], # words to extend to the dictionary for this package\r
+ "IgnoreStandardPaths": [], # Standard Plugin defined paths that should be ignore\r
+ "AdditionalIncludePaths": [] # Additional paths to spell check (wildcards supported)\r
+ }\r
+}\r
--- /dev/null
+## @file\r
+# Azure Pipeline build file for building a platform.\r
+#\r
+# Platform: OVMF\r
+# OS: Ubuntu\r
+# Toolchain: GCC5\r
+#\r
+# Copyright (c) Microsoft Corporation.\r
+# SPDX-License-Identifier: BSD-2-Clause-Patent\r
+##\r
+trigger:\r
+ - master\r
+pr:\r
+ - master\r
+\r
+jobs:\r
+ - job: Platform_CI\r
+ variables:\r
+ package: 'OvmfPkg'\r
+ vm_image: 'ubuntu-latest'\r
+ should_run: true\r
+ run_flags: "MAKE_STARTUP_NSH=TRUE QEMU_HEADLESS=TRUE"\r
+\r
+ #Use matrix to speed up the build process\r
+ strategy:\r
+ matrix:\r
+ OVMF_IA32_DEBUG:\r
+ Build.File: "$(package)/PlatformCI/PlatformBuild.py"\r
+ Build.Arch: "IA32"\r
+ Build.Flags: ""\r
+ Build.Target: "DEBUG"\r
+ Run.Flags: $(run_flags)\r
+ Run: $(should_run)\r
+ OVMF_IA32_RELEASE:\r
+ Build.File: "$(package)/PlatformCI/PlatformBuild.py"\r
+ Build.Arch: "IA32"\r
+ Build.Flags: ""\r
+ Build.Target: "RELEASE"\r
+ Run.Flags: $(run_flags)\r
+ Run: $(should_run)\r
+ OVMF_IA32_NOOPT:\r
+ Build.File: "$(package)/PlatformCI/PlatformBuild.py"\r
+ Build.Arch: "IA32"\r
+ Build.Flags: ""\r
+ Build.Target: "NOOPT"\r
+ Run.Flags: $(run_flags)\r
+ Run: $(should_run)\r
+\r
+ OVMF_X64_DEBUG:\r
+ Build.File: "$(package)/PlatformCI/PlatformBuild.py"\r
+ Build.Arch: "X64"\r
+ Build.Flags: ""\r
+ Build.Target: "DEBUG"\r
+ Run.Flags: $(run_flags)\r
+ Run: $(should_run)\r
+ OVMF_X64_RELEASE:\r
+ Build.File: "$(package)/PlatformCI/PlatformBuild.py"\r
+ Build.Arch: "X64"\r
+ Build.Flags: ""\r
+ Build.Target: "RELEASE"\r
+ Run.Flags: $(run_flags)\r
+ Run: $(should_run)\r
+ OVMF_X64_NOOPT:\r
+ Build.File: "$(package)/PlatformCI/PlatformBuild.py"\r
+ Build.Arch: "X64"\r
+ Build.Flags: ""\r
+ Build.Target: "NOOPT"\r
+ Run.Flags: $(run_flags)\r
+ Run: $(should_run)\r
+\r
+ OVMF_IA32X64_DEBUG:\r
+ Build.File: "$(package)/PlatformCI/PlatformBuild.py"\r
+ Build.Arch: "IA32,X64"\r
+ Build.Flags: ""\r
+ Build.Target: "DEBUG"\r
+ Run.Flags: $(run_flags)\r
+ Run: $(should_run)\r
+ OVMF_IA32X64_RELEASE:\r
+ Build.File: "$(package)/PlatformCI/PlatformBuild.py"\r
+ Build.Arch: "IA32,X64"\r
+ Build.Flags: ""\r
+ Build.Target: "RELEASE"\r
+ Run.Flags: $(run_flags)\r
+ Run: $(should_run)\r
+ OVMF_IA32X64_NOOPT:\r
+ Build.File: "$(package)/PlatformCI/PlatformBuild.py"\r
+ Build.Arch: "IA32,X64"\r
+ Build.Flags: ""\r
+ Build.Target: "NOOPT"\r
+ Run.Flags: $(run_flags)\r
+ Run: $(should_run)\r
+\r
+ OVMF_IA32X64_FULL_DEBUG:\r
+ Build.File: "$(package)/PlatformCI/PlatformBuild.py"\r
+ Build.Arch: "IA32,X64"\r
+ Build.Flags: "BLD_*_SECURE_BOOT_ENABLE=1 BLD_*_SMM_REQUIRE=1 BLD_*_TPM_ENABLE=1 BLD_*_TPM_CONFIG_ENABLE=1 BLD_*_NETWORK_TLS_ENABLE=1 BLD_*_NETWORK_IP6_ENABLE=1 BLD_*_NETWORK_HTTP_BOOT_ENABLE=1"\r
+ Build.Target: "DEBUG"\r
+ Run.Flags: $(run_flags)\r
+ Run: $(should_run)\r
+ OVMF_IA32X64_FULL_RELEASE:\r
+ Build.File: "$(package)/PlatformCI/PlatformBuild.py"\r
+ Build.Arch: "IA32,X64"\r
+ Build.Flags: "BLD_*_SECURE_BOOT_ENABLE=1 BLD_*_SMM_REQUIRE=1 BLD_*_TPM_ENABLE=1 BLD_*_TPM_CONFIG_ENABLE=1 BLD_*_NETWORK_TLS_ENABLE=1 BLD_*_NETWORK_IP6_ENABLE=1 BLD_*_NETWORK_HTTP_BOOT_ENABLE=1"\r
+ Build.Target: "RELEASE"\r
+ Run.Flags: $(run_flags)\r
+ Run: $(should_run)\r
+ OVMF_IA32X64_FULL_NOOPT:\r
+ Build.File: "$(package)/PlatformCI/PlatformBuild.py"\r
+ Build.Arch: "IA32,X64"\r
+ Build.Flags: "BLD_*_SECURE_BOOT_ENABLE=1 BLD_*_SMM_REQUIRE=1 BLD_*_TPM_ENABLE=1 BLD_*_TPM_CONFIG_ENABLE=1 BLD_*_NETWORK_TLS_ENABLE=1 BLD_*_NETWORK_IP6_ENABLE=1 BLD_*_NETWORK_HTTP_BOOT_ENABLE=1"\r
+ Build.Target: "NOOPT"\r
+ Run.Flags: $(run_flags)\r
+ Run: $(should_run)\r
+ workspace:\r
+ clean: all\r
+\r
+ pool:\r
+ vmImage: $(vm_image)\r
+\r
+ steps:\r
+ - template: ../../../.azurepipelines/templates/platform-build-run-steps.yml\r
+ parameters:\r
+ tool_chain_tag: GCC5\r
+ build_pkg: $(package)\r
+ build_target: $(Build.Target)\r
+ build_arch: $(Build.Arch)\r
+ build_file: $(Build.File)\r
+ build_flags: $(Build.Flags)\r
+ run_flags: $(Run.Flags)\r
+ extra_install_step:\r
+ - bash: sudo apt-get install qemu\r
+ displayName: Install qemu\r
+ condition: and(gt(variables.pkg_count, 0), succeeded())\r
--- /dev/null
+## @file\r
+# Azure Pipeline build file for building a platform.\r
+#\r
+# Platform: OVMF\r
+# OS: Windows\r
+# Toolchain: VS2019\r
+#\r
+# Copyright (c) Microsoft Corporation.\r
+# SPDX-License-Identifier: BSD-2-Clause-Patent\r
+##\r
+trigger:\r
+ - master\r
+pr:\r
+ - master\r
+jobs:\r
+ - job: Platform_CI\r
+ variables:\r
+ package: 'OvmfPkg'\r
+ vm_image: 'windows-latest'\r
+ should_run: true\r
+ run_flags: "MAKE_STARTUP_NSH=TRUE QEMU_HEADLESS=TRUE"\r
+\r
+ #Use matrix to speed up the build process\r
+ strategy:\r
+ matrix:\r
+ OVMF_IA32_DEBUG:\r
+ Build.File: "$(package)/PlatformCI/PlatformBuild.py"\r
+ Build.Arch: "IA32"\r
+ Build.Flags: ""\r
+ Build.Target: "DEBUG"\r
+ Run.Flags: $(run_flags)\r
+ Run: $(should_run)\r
+ OVMF_IA32_RELEASE:\r
+ Build.File: "$(package)/PlatformCI/PlatformBuild.py"\r
+ Build.Arch: "IA32"\r
+ Build.Flags: ""\r
+ Build.Target: "RELEASE"\r
+ Run.Flags: $(run_flags)\r
+ Run: $(should_run)\r
+ OVMF_IA32_NOOPT:\r
+ Build.File: "$(package)/PlatformCI/PlatformBuild.py"\r
+ Build.Arch: "IA32"\r
+ Build.Flags: ""\r
+ Build.Target: "NOOPT"\r
+ Run.Flags: $(run_flags)\r
+ Run: $(should_run)\r
+\r
+ OVMF_X64_DEBUG:\r
+ Build.File: "$(package)/PlatformCI/PlatformBuild.py"\r
+ Build.Arch: "X64"\r
+ Build.Flags: ""\r
+ Build.Target: "DEBUG"\r
+ Run.Flags: $(run_flags)\r
+ Run: $(should_run)\r
+ OVMF_X64_RELEASE:\r
+ Build.File: "$(package)/PlatformCI/PlatformBuild.py"\r
+ Build.Arch: "X64"\r
+ Build.Flags: ""\r
+ Build.Target: "RELEASE"\r
+ Run.Flags: $(run_flags)\r
+ Run: $(should_run)\r
+ OVMF_X64_NOOPT:\r
+ Build.File: "$(package)/PlatformCI/PlatformBuild.py"\r
+ Build.Arch: "X64"\r
+ Build.Flags: ""\r
+ Build.Target: "NOOPT"\r
+ Run.Flags: $(run_flags)\r
+ Run: $(should_run)\r
+\r
+ OVMF_IA32X64_DEBUG:\r
+ Build.File: "$(package)/PlatformCI/PlatformBuild.py"\r
+ Build.Arch: "IA32,X64"\r
+ Build.Flags: ""\r
+ Build.Target: "DEBUG"\r
+ Run.Flags: $(run_flags)\r
+ Run: $(should_run)\r
+ OVMF_IA32X64_RELEASE:\r
+ Build.File: "$(package)/PlatformCI/PlatformBuild.py"\r
+ Build.Arch: "IA32,X64"\r
+ Build.Flags: ""\r
+ Build.Target: "RELEASE"\r
+ Run.Flags: $(run_flags)\r
+ Run: $(should_run)\r
+ OVMF_IA32X64_NOOPT:\r
+ Build.File: "$(package)/PlatformCI/PlatformBuild.py"\r
+ Build.Arch: "IA32,X64"\r
+ Build.Flags: ""\r
+ Build.Target: "NOOPT"\r
+ Run.Flags: $(run_flags)\r
+ Run: $(should_run)\r
+\r
+ OVMF_IA32X64_FULL_DEBUG:\r
+ Build.File: "$(package)/PlatformCI/PlatformBuild.py"\r
+ Build.Arch: "IA32,X64"\r
+ Build.Flags: "BLD_*_SECURE_BOOT_ENABLE=1 BLD_*_SMM_REQUIRE=1 BLD_*_TPM_ENABLE=1 BLD_*_TPM_CONFIG_ENABLE=1 BLD_*_NETWORK_TLS_ENABLE=1 BLD_*_NETWORK_IP6_ENABLE=1 BLD_*_NETWORK_HTTP_BOOT_ENABLE=1"\r
+ Build.Target: "DEBUG"\r
+ Run.Flags: $(run_flags)\r
+ Run: $(should_run)\r
+ OVMF_IA32X64_FULL_RELEASE:\r
+ Build.File: "$(package)/PlatformCI/PlatformBuild.py"\r
+ Build.Arch: "IA32,X64"\r
+ Build.Flags: "BLD_*_SECURE_BOOT_ENABLE=1 BLD_*_SMM_REQUIRE=1 BLD_*_TPM_ENABLE=1 BLD_*_TPM_CONFIG_ENABLE=1 BLD_*_NETWORK_TLS_ENABLE=1 BLD_*_NETWORK_IP6_ENABLE=1 BLD_*_NETWORK_HTTP_BOOT_ENABLE=1"\r
+ Build.Target: "RELEASE"\r
+ Run.Flags: $(run_flags)\r
+ Run: $(should_run)\r
+\r
+ # This currently creates a very large image which is too big for the FDF declared range\r
+ # Ovmf maintainers suggest to skip this build for now.\r
+ #\r
+ # OVMF_IA32X64_FULL_NOOPT:\r
+ # Build.File: "$(package)/PlatformCI/PlatformBuild.py"\r
+ # Build.Arch: "IA32,X64"\r
+ # Build.Flags: "BLD_*_SECURE_BOOT_ENABLE=1 BLD_*_SMM_REQUIRE=1 BLD_*_TPM_ENABLE=1 BLD_*_TPM_CONFIG_ENABLE=1 BLD_*_NETWORK_TLS_ENABLE=1 BLD_*_NETWORK_IP6_ENABLE=1 BLD_*_NETWORK_HTTP_BOOT_ENABLE=1"\r
+ # Build.Target: "NOOPT"\r
+ # Run.Flags: $(run_flags)\r
+ # Run: $(should_run)\r
+\r
+ workspace:\r
+ clean: all\r
+\r
+ pool:\r
+ vmImage: $(vm_image)\r
+\r
+ steps:\r
+ - template: ../../../.azurepipelines/templates/platform-build-run-steps.yml\r
+ parameters:\r
+ tool_chain_tag: VS2019\r
+ build_pkg: $(package)\r
+ build_target: $(Build.Target)\r
+ build_arch: $(Build.Arch)\r
+ build_file: $(Build.File)\r
+ build_flags: $(Build.Flags)\r
+ run_flags: $(Run.Flags)\r
+ extra_install_step:\r
+ - powershell: choco install qemu; Write-Host "##vso[task.prependpath]c:\Program Files\qemu"\r
+ displayName: Install QEMU and Set QEMU on path # friendly name displayed in the UI\r
+ condition: and(gt(variables.pkg_count, 0), succeeded())\r
+\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 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
+\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 = ("OvmfPkg",)\r
+ ArchSupported = ("IA32", "X64")\r
+ TargetsSupported = ("DEBUG", "RELEASE", "NOOPT")\r
+ Scopes = ('ovmf', 'edk2-build')\r
+ WorkspaceRoot = os.path.realpath(os.path.join(\r
+ os.path.dirname(os.path.abspath(__file__)), "..", ".."))\r
+\r
+ @classmethod\r
+ def GetDscName(cls, ArchCsv: str) -> str:\r
+ ''' return the DSC given the architectures requested.\r
+\r
+ ArchCsv: csv string containing all architectures to build\r
+ '''\r
+ dsc = "OvmfPkg"\r
+ if "IA32" in ArchCsv.upper().split(","):\r
+ dsc += "Ia32"\r
+ if "X64" in ArchCsv.upper().split(","):\r
+ dsc += "X64"\r
+ dsc += ".dsc"\r
+ return dsc\r
+\r
+\r
+ # ####################################################################################### #\r
+ # Configuration for Update & Setup #\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) - set(self.GetArchitecturesSupported())\r
+ if(len(unsupported) > 0):\r
+ errorString = ( "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
+ return CommonPlatform.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
+ 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
+ dsc = CommonPlatform.GetDscName(",".join(self.ActualArchitectures))\r
+ return (f"OvmfPkg/{dsc}", {})\r
+\r
+\r
+ # ####################################################################################### #\r
+ # Actual Configuration for Platform Build #\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="IA32,X64",\r
+ help="Optional - CSV of architecture to build. IA32 will use IA32 for Pei & Dxe. "\r
+ "X64 will use X64 for both PEI and DXE. IA32,X64 will use IA32 for PEI and "\r
+ "X64 for DXE. default is IA32,X64")\r
+\r
+ def RetrieveCommandLineOptions(self, args):\r
+ ''' Retrieve command line options from the argparser '''\r
+\r
+ shell_environment.GetBuildVars().SetValue("TARGET_ARCH"," ".join(args.build_arch.upper().split(",")), "From CmdLine")\r
+ dsc = CommonPlatform.GetDscName(args.build_arch)\r
+ shell_environment.GetBuildVars().SetValue("ACTIVE_PLATFORM", f"OvmfPkg/{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
+ return CommonPlatform.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 "OvmfPkg_With_Run"\r
+ return "OvmfPkg"\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", "OVMF", "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("BUILD_OUTPUT_BASE"), "VirtualDrive")\r
+ os.makedirs(VirtualDrive, exist_ok=True)\r
+ OutputPath_FV = os.path.join(self.env.GetValue("BUILD_OUTPUT_BASE"), "FV")\r
+\r
+ #\r
+ # QEMU must be on the path\r
+ #\r
+ cmd = "qemu-system-x86_64"\r
+ args = "-debugcon stdio" # write messages to stdio\r
+ args += " -global isa-debugcon.iobase=0x402" # debug messages out thru virtual io port\r
+ args += " -net none" # turn off network\r
+ args += f" -drive file=fat:rw:{VirtualDrive},format=raw,media=disk" # Mount disk with startup.nsh\r
+\r
+ if (self.env.GetValue("QEMU_HEADLESS").upper() == "TRUE"):\r
+ args += " -display none" # no graphics\r
+\r
+ if (self.env.GetBuildValue("SMM_REQUIRE") == "1"):\r
+ args += " -machine q35,smm=on" #,accel=(tcg|kvm)"\r
+ #args += " -m ..."\r
+ #args += " -smp ..."\r
+ args += " -global driver=cfi.pflash01,property=secure,value=on"\r
+ args += " -drive if=pflash,format=raw,unit=0,file=" + os.path.join(OutputPath_FV, "OVMF_CODE.fd") + ",readonly=on"\r
+ args += " -drive if=pflash,format=raw,unit=1,file=" + os.path.join(OutputPath_FV, "OVMF_VARS.fd")\r
+ else:\r
+ args += " -pflash " + os.path.join(OutputPath_FV, "OVMF.fd") # path to firmware\r
+\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
+\r
+\r
+\r
--- /dev/null
+# OvmfPkg - Platform CI\r
+\r
+This ReadMe.md describes the Azure DevOps based Platform CI for OvmfPkg and how\r
+to use the same Pytools based build infrastructure locally.\r
+\r
+## Supported Configuration Details\r
+\r
+This solution for building and running OvmfPkg has only been validated with Windows 10\r
+with VS2019 and Ubuntu 18.04 with GCC5 toolchain. Four different firmware builds are\r
+supported and are described below.\r
+\r
+| Configuration name | Architectures | DSC File |Additional Flags |\r
+| :---- | :----- | :---- | :---- |\r
+| IA32 | IA32 | OvmfPkgIa32.dsc | None |\r
+| X64 | X64 | OvmfPkgIa64.dsc | None |\r
+| IA32 X64 | PEI-IA32 DXE-X64 | OvmfPkgIa32X64.dsc | None |\r
+| IA32 X64 Full | PEI-IA32 DXE-X64 | OvmfPkgIa32X64.dsc | SECURE_BOOT_ENABLE=1 SMM_REQUIRE=1 TPM_ENABLE=1 TPM_CONFIG_ENABLE=1 NETWORK_TLS_ENABLE=1 NETWORK_IP6_ENABLE=1 NETWORK_HTTP_BOOT_ENABLE=1 |\r
+\r
+## EDK2 Developer environment\r
+\r
+- [Python 3.8.x - Download & Install](https://www.python.org/downloads/)\r
+- [GIT - Download & Install](https://git-scm.com/download/)\r
+- [QEMU - Download, Install, and add to your path](https://www.qemu.org/download/)\r
+- [Edk2 Source](https://github.com/tianocore/edk2)\r
+- Additional packages found necessary for Ubuntu 18.04\r
+ - apt-get install gcc g++ make uuid-dev\r
+\r
+Note: edksetup, Submodule initialization and manual installation of NASM, iASL, or\r
+the required cross-compiler toolchains are **not** required, this is handled by the\r
+Pytools build system.\r
+\r
+## Building with Pytools for OvmfPkg\r
+\r
+1. [Optional] Create a Python Virtual Environment - generally once per workspace\r
+\r
+ ``` bash\r
+ python -m venv <name of virtual environment>\r
+ ```\r
+\r
+2. [Optional] Activate Virtual Environment - each time new shell opened\r
+ - Linux\r
+\r
+ ```bash\r
+ source <name of virtual environment>/bin/activate\r
+ ```\r
+\r
+ - Windows\r
+\r
+ ``` bash\r
+ <name of virtual environment>/Scripts/activate.bat\r
+ ```\r
+\r
+3. Install Pytools - generally once per virtual env or whenever pip-requirements.txt changes\r
+\r
+ ``` bash\r
+ pip install --upgrade -r pip-requirements.txt\r
+ ```\r
+\r
+4. Initialize & Update Submodules - only when submodules updated\r
+\r
+ ``` bash\r
+ stuart_setup -c OvmfPkg/PlatformCI/PlatformBuild.py TOOL_CHAIN_TAG=<TOOL_CHAIN_TAG> -a <TARGET_ARCH>\r
+ ```\r
+\r
+5. Initialize & Update Dependencies - only as needed when ext_deps change\r
+\r
+ ``` bash\r
+ stuart_update -c OvmfPkg/PlatformCI/PlatformBuild.py TOOL_CHAIN_TAG=<TOOL_CHAIN_TAG> -a <TARGET_ARCH>\r
+ ```\r
+\r
+6. Compile the basetools if necessary - only when basetools C source files change\r
+\r
+ ``` bash\r
+ python BaseTools/Edk2ToolsBuild.py -t <ToolChainTag>\r
+ ```\r
+\r
+7. Compile Firmware\r
+ - To build IA32\r
+\r
+ ``` bash\r
+ stuart_build -c OvmfPkg/PlatformCI/PlatformBuild.py -a IA32 TOOL_CHAIN_TAG=<TOOL_CHAIN_TAG>\r
+ ```\r
+\r
+ - To build X64\r
+\r
+ ``` bash\r
+ stuart_build -c OvmfPkg/PlatformCI/PlatformBuild.py -a X64 TOOL_CHAIN_TAG=<TOOL_CHAIN_TAG>\r
+ ```\r
+\r
+ - To build IA32 X64\r
+\r
+ ``` bash\r
+ stuart_build -c OvmfPkg/PlatformCI/PlatformBuild.py -a IA32,X64 TOOL_CHAIN_TAG=<TOOL_CHAIN_TAG>\r
+ ```\r
+\r
+ - use `stuart_build -c OvmfPkg/PlatformCI/PlatformBuild.py -h` option to see additional\r
+ options like `--clean`\r
+\r
+8. Running Emulator\r
+ - You can add `--FlashRom` to the end of your build command and the emulator will run after the\r
+ build is complete.\r
+ - or use the `--FlashOnly` feature to just run the emulator.\r
+\r
+ ``` bash\r
+ stuart_build -c OvmfPkg/PlatformCI/PlatformBuild.py TOOL_CHAIN_TAG=<TOOL_CHAIN_TAG> -a <TARGET_ARCH> --FlashOnly\r
+ ```\r
+\r
+### Notes\r
+\r
+1. Configuring *ACTIVE_PLATFORM* and *TARGET_ARCH* in Conf/target.txt is **not** required. This\r
+ environment is set by PlatformBuild.py based upon the `[-a <TARGET_ARCH>]` parameter.\r
+2. QEMU must be on your path. On Windows this is a manual process and not part of the QEMU installer.\r
+\r
+**NOTE:** Logging the execution output will be in the normal stuart log as well as to your console.\r
+\r
+### Custom Build Options\r
+\r
+**MAKE_STARTUP_NSH=TRUE** will output a *startup.nsh* file to the location mapped as fs0. This is\r
+used in CI in combination with the `--FlashOnly` feature to run QEMU to the UEFI shell and then execute\r
+the contents of *startup.nsh*.\r
+\r
+**QEMU_HEADLESS=TRUE** Since CI servers run headless QEMU must be told to run with no display otherwise\r
+an error occurs. Locally you don't need to set this.\r
+\r
+### Passing Build Defines\r
+\r
+To pass build defines through _stuart_build_, prepend `BLD_*_`to the define name and pass it on the\r
+command-line. _stuart_build_ currently requires values to be assigned, so add an`=1` suffix for bare defines.\r
+For example, to enable the TPM2 support, instead of the traditional "-D E1000_ENABLE", the stuart_build\r
+command-line would be:\r
+\r
+`stuart_build -c OvmfPkg/PlatformCI/PlatformBuild.py BLD_*_E1000_ENABLE=1`\r
+\r
+## References\r
+\r
+- [Installing and using Pytools](https://github.com/tianocore/edk2-pytool-extensions/blob/master/docs/using.md#installing)\r
+- More on [python virtual environments](https://docs.python.org/3/library/venv.html)\r
--- /dev/null
+## @file\r
+# Download iasl executable tool from a nuget.org package\r
+# - package contains different binaries based on host\r
+# Add the folder with the tool to the path\r
+#\r
+# This is only downloaded for scope ovmf thus\r
+# should have no impact on the asl compiler used by any\r
+# other given platform to build.\r
+#\r
+# Copyright (c) Microsoft Corporation.\r
+# SPDX-License-Identifier: BSD-2-Clause-Patent\r
+##\r
+{\r
+ "id": "iasl-ovmf-1",\r
+ "scope": "ovmf",\r
+ "type": "nuget",\r
+ "name": "iasl",\r
+ "source": "https://api.nuget.org/v3/index.json",\r
+ "version": "20190215.0.0",\r
+ "flags": ["set_path", "host_specific"],\r
+}\r