--- /dev/null
+## @file\r
+# Core CI configuration for EmulatorPkg\r
+#\r
+# EmulatorPkg 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
+ # For this platform all packages are allowed???\r
+ "MdePkg/MdePkg.dec",\r
+ "MdeModulePkg/MdeModulePkg.dec",\r
+ "EmulatorPkg/EmulatorPkg.dec",\r
+ "NetworkPkg/NetworkPkg.dec",\r
+ "EmbeddedPkg/EmbeddedPkg.dec", ## is this one OK??\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": [],\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
+ "setjump",\r
+ "plong",\r
+ "lparam",\r
+ "lpdword",\r
+ "lpthread",\r
+ "lresult",\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: EmulatorPkg\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
+jobs:\r
+ - job: Platform_CI\r
+ variables:\r
+ package: 'EmulatorPkg'\r
+ vm_image: 'ubuntu-latest'\r
+ should_run: false\r
+ run_flags: "MAKE_STARTUP_NSH=TRUE"\r
+\r
+ #Use matrix to speed up the build process\r
+ strategy:\r
+ matrix:\r
+ EmulatorPkg_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
+ EmulatorPkg_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
+ EmulatorPkg_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
+ EmulatorPkg_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
+ EmulatorPkg_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
+ EmulatorPkg_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
+ 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
+ # Add steps to install some IA32 only dependencies\r
+ extra_install_step:\r
+ - bash: sudo dpkg --add-architecture i386\r
+ displayName: Add i386 to dpkg\r
+ condition: and(gt(variables.pkg_count, 0), eq(variables['Build.Arch'], 'IA32'), succeeded())\r
+ - bash: sudo apt-get update\r
+ displayName: do apt-get update\r
+ condition: and(gt(variables.pkg_count, 0), eq(variables['Build.Arch'], 'IA32'), succeeded())\r
+ - bash: sudo apt-get install libc6-dev:i386 libx11-dev:i386 libxext-dev:i386 lib32gcc-7-dev\r
+ displayName: Add additional i386 packages\r
+ condition: and(gt(variables.pkg_count, 0), eq(variables['Build.Arch'], 'IA32'), succeeded())\r
--- /dev/null
+# @file\r
+# Script to Build EmulatorPkg 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 = ("EmulatorPkg",)\r
+ ArchSupported = ("X64", "IA32")\r
+ TargetsSupported = ("DEBUG", "RELEASE", "NOOPT")\r
+ Scopes = ('emulatorpkg', '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
+ # 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
+ 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
+ # 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
+ 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("EmulatorPkg", "EmulatorPkg.dsc"), {})\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="X64",\r
+ help="Optional - architecture to build. IA32 will use IA32 for Pei & Dxe. "\r
+ "X64 will use X64 for both PEI and DXE.")\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
+ shell_environment.GetBuildVars().SetValue(\r
+ "ACTIVE_PLATFORM", "EmulatorPkg/EmulatorPkg.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
+\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 "EmulatorPkg_With_Run"\r
+ return "EmulatorPkg"\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", "EmulatorPkg", "Platform Hardcoded")\r
+ self.env.SetValue("TOOL_CHAIN_TAG", "VS2019", "Default Toolchain")\r
+\r
+ # Add support for using the correct Platform Headers, tools, and Libs based on emulator architecture\r
+ # requested to be built when building VS2019 or VS2017\r
+ if self.env.GetValue("TOOL_CHAIN_TAG") == "VS2019" or self.env.GetValue("TOOL_CHAIN_TAG") == "VS2017":\r
+ key = self.env.GetValue("TOOL_CHAIN_TAG") + "_HOST"\r
+ if self.env.GetValue("TARGET_ARCH") == "IA32":\r
+ shell_environment.ShellEnvironment().set_shell_var(key, "x86")\r
+ elif self.env.GetValue("TARGET_ARCH") == "X64":\r
+ shell_environment.ShellEnvironment().set_shell_var(key, "x64")\r
+\r
+ # Add support for using the correct Platform Headers, tools, and Libs based on emulator architecture\r
+ # requested to be built when building on linux.\r
+ if GetHostInfo().os.upper() == "LINUX":\r
+ self.ConfigureLinuxDLinkPath()\r
+\r
+ if GetHostInfo().os.upper() == "WINDOWS":\r
+ self.env.SetValue("BLD_*_WIN_HOST_BUILD", "TRUE",\r
+ "Trigger Windows host build")\r
+\r
+ self.env.SetValue("MAKE_STARTUP_NSH", "FALSE", "Default to false")\r
+\r
+ # I don't see what this does but it is in build.sh\r
+ key = "BLD_*_BUILD_" + self.env.GetValue("TARGET_ARCH")\r
+ self.env.SetValue(key, "TRUE", "match script in build.sh")\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
+ ''' Use the FlashRom Function to run the emulator. This gives an easy stuart command line to\r
+ activate the emulator. '''\r
+\r
+ OutputPath = os.path.join(self.env.GetValue(\r
+ "BUILD_OUTPUT_BASE"), self.env.GetValue("TARGET_ARCH"))\r
+\r
+ if (self.env.GetValue("MAKE_STARTUP_NSH") == "TRUE"):\r
+ f = open(os.path.join(OutputPath, "startup.nsh"), "w")\r
+ f.write("BOOT SUCCESS !!! \n")\r
+ # add commands here\r
+ f.write("reset\n")\r
+ f.close()\r
+\r
+ if GetHostInfo().os.upper() == "WINDOWS":\r
+ cmd = "WinHost.exe"\r
+ elif GetHostInfo().os.upper() == "LINUX":\r
+ cmd = "./Host"\r
+ else:\r
+ logging.critical("Unsupported Host")\r
+ return -1\r
+ return RunCmd(cmd, "", workingdir=OutputPath)\r
+\r
+ def ConfigureLinuxDLinkPath(self):\r
+ '''\r
+ logic copied from build.sh to setup the correct libraries\r
+ '''\r
+ if self.env.GetValue("TARGET_ARCH") == "IA32":\r
+ LIB_NAMES = ["ld-linux.so.2", "libdl.so.2 crt1.o", "crti.o crtn.o"]\r
+ LIB_SEARCH_PATHS = ["/usr/lib/i386-linux-gnu",\r
+ "/usr/lib32", "/lib32", "/usr/lib", "/lib"]\r
+ elif self.env.GetValue("TARGET_ARCH") == "X64":\r
+ LIB_NAMES = ["ld-linux-x86-64.so.2",\r
+ "libdl.so.2", "crt1.o", "crti.o", "crtn.o"]\r
+ LIB_SEARCH_PATHS = ["/usr/lib/x86_64-linux-gnu",\r
+ "/usr/lib64", "/lib64", "/usr/lib", "/lib"]\r
+\r
+ HOST_DLINK_PATHS = ""\r
+ for lname in LIB_NAMES:\r
+ logging.debug(f"Looking for {lname}")\r
+ for dname in LIB_SEARCH_PATHS:\r
+ logging.debug(f"In {dname}")\r
+ if os.path.isfile(os.path.join(dname, lname)):\r
+ logging.debug(f"Found {lname} in {dname}")\r
+ HOST_DLINK_PATHS += os.path.join(\r
+ os.path.join(dname, lname)) + os.pathsep\r
+ break\r
+ HOST_DLINK_PATHS = HOST_DLINK_PATHS.rstrip(os.pathsep)\r
+ logging.critical(f"Setting HOST_DLINK_PATHS to {HOST_DLINK_PATHS}")\r
+ shell_environment.ShellEnvironment().set_shell_var(\r
+ "HOST_DLINK_PATHS", HOST_DLINK_PATHS)\r
--- /dev/null
+# EmulatorPkg - Platform CI\r
+\r
+This ReadMe.md describes the Azure DevOps based Platform CI for EmulatorPkg 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 EmulatorPkg has only been validated with Windows 10\r
+with VS2019 and Ubuntu 18.04 with GCC5 toolchain. Two different firmware builds are\r
+supported and are described below.\r
+\r
+| Configuration name | Architectures | DSC File |Additional Flags |\r
+| :---- | :----- | :---- | :---- |\r
+| IA32 | IA32 | EmulatorPkg.dsc | None |\r
+| X64 | X64 | EmulatorPkg.dsc | None |\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
+- [Edk2 Source](https://github.com/tianocore/edk2)\r
+- For building Basetools and other host applications\r
+\r
+ ``` bash\r
+ sudo apt-get update\r
+ sudo apt-get install gcc g++ make uuid-dev\r
+ ```\r
+\r
+- For building ARCH IA32 on X64 Ubuntu 18.04 LTS these steps where needed.\r
+\r
+ ``` bash\r
+ sudo dpkg --add-architecture i386\r
+ sudo apt-get update\r
+ sudo apt-get install libc6-dev:i386 libx11-dev:i386 libxext-dev:i386 lib32gcc-7-dev\r
+ ```\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 EmulatorPkg\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 EmulatorPkg/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 EmulatorPkg/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
+\r
+ ``` bash\r
+ stuart_build -c EmulatorPkg/PlatformCI/PlatformBuild.py TOOL_CHAIN_TAG=<TOOL_CHAIN_TAG> -a <TARGET_ARCH>\r
+ ```\r
+\r
+ - use `stuart_build -c EmulatorPkg/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 EmulatorPkg/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
+\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 the Emulator to the UEFI shell and then execute\r
+the contents of *startup.nsh*.\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 IP6 Network Stack, the stuart_build command-line would be:\r
+\r
+`stuart_build -c EmulatorPkg/PlatformCI/PlatformBuild.py BLD_*_NETWORK_IP6_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