From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from NAM11-BN8-obe.outbound.protection.outlook.com (NAM11-BN8-obe.outbound.protection.outlook.com [40.107.236.105]) by mx.groups.io with SMTP id smtpd.web11.339.1587759751201108227 for ; Fri, 24 Apr 2020 13:22:31 -0700 Authentication-Results: mx.groups.io; dkim=pass header.i=@microsoft.com header.s=selector2 header.b=Z18im8cl; spf=pass (domain: microsoft.com, ip: 40.107.236.105, mailfrom: bret.barkelew@microsoft.com) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=GibP4VaK2uHFcZ66iUoCY8F/D4iNSNiOmbS2aqtWPcalOzx2Oh9EpMHR/7DiJq+dY8Xu/EcRejmxxftzmrIANxlLsWyH0nuRBmXkWwCJ3pf4lrbCxzls5ZLriufWiw2+VyO7cLOt6ay05sVkSFWJrPepoQkXrTVYa9UdNgYmSwkeQm6W+M8hfUYPqHjRW59wO+v5QmDIgcToRWSwjihubNHyqC0N30tOOGyiR3CvnAG2zslo+2Oho7ZmwlnpiZV/bQfb1nCX95txekm749n+4c+ZXyLuqEbnsRNDjQ3d/ijiPZHqoKC0hWlZdtmHGuxp2igkH/4nzoLLJmgKrwVOJw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=WgMnAv7uvCWrBSsL7MN0A7JdgHyO61KjL3aRVTjDBkk=; b=G0Uqg31IuWJ5jwepOpKYrxUj2De8gdU729+2nnL7epLdnWsg8geuFtaXhvQBq1puqjWs8LvujHjNthKdbS4iixeOAcMX517HeUbmH9AtORbxo22iihWXIBvJeRcBki3QmMravYj/psblGFjmAY19NFA3r74I3UlETAg+/tkqMjhbfZqkTu++FD+m3OO6hQHog1xPKYMVXPF8dUSpSPS5cxfRLVgf3YbXHffAb0ID4hJGp9SFG9iPO01SD6GHNjrbCJKw1yDzRVgy/URLZZ8MAR2JT01+bC/JrFnm6LJJ2bPaGxpRUrFzEy1g5TLDZ2D4FRn7/lmAqjYHA8trJ/1nkw== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=microsoft.com; dmarc=pass action=none header.from=microsoft.com; dkim=pass header.d=microsoft.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=selector2; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=WgMnAv7uvCWrBSsL7MN0A7JdgHyO61KjL3aRVTjDBkk=; b=Z18im8clW4oFy2NCh1U0ohie56ZaltEqT6yPTKYjlTLWBeGZIBhNEJbOvevWic1jCfpV1Xw/GjGjk/iL8MZZnQtEeotFqxtasmMPrmPodWLXIj/UxtOjACErSudiBNP9iQVIOcG/8NhpwATSqNfde2Gg5vBUKFrreaHks0ELWII= Received: from CY4PR21MB0743.namprd21.prod.outlook.com (2603:10b6:903:b2::9) by CY4PR21MB0744.namprd21.prod.outlook.com (2603:10b6:903:b2::10) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.2958.3; Fri, 24 Apr 2020 20:22:28 +0000 Received: from CY4PR21MB0743.namprd21.prod.outlook.com ([fe80::90d:10d9:c5bc:5318]) by CY4PR21MB0743.namprd21.prod.outlook.com ([fe80::90d:10d9:c5bc:5318%12]) with mapi id 15.20.2958.010; Fri, 24 Apr 2020 20:22:28 +0000 From: "Bret Barkelew" To: "devel@edk2.groups.io" , "michael.kubacki@outlook.com" CC: Laszlo Ersek , Ard Biesheuvel , Leif Lindholm Subject: Re: [EXTERNAL] [edk2-devel] [PATCH v2 2/6] ArmVirtPkg: Add Platform CI and configuration for Core CI Thread-Topic: [EXTERNAL] [edk2-devel] [PATCH v2 2/6] ArmVirtPkg: Add Platform CI and configuration for Core CI Thread-Index: AQHWF0e205Ggm6D5Q0q5wemlB39ZWqiIvZAV Date: Fri, 24 Apr 2020 20:22:27 +0000 Message-ID: References: <20200420191216.24572-1-michael.kubacki@outlook.com>, In-Reply-To: Accept-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: msip_labels: MSIP_Label_f42aa342-8706-4288-bd11-ebb85995028c_Enabled=True;MSIP_Label_f42aa342-8706-4288-bd11-ebb85995028c_SiteId=72f988bf-86f1-41af-91ab-2d7cd011db47;MSIP_Label_f42aa342-8706-4288-bd11-ebb85995028c_SetDate=2020-04-24T20:22:22.7923386Z;MSIP_Label_f42aa342-8706-4288-bd11-ebb85995028c_ContentBits=0;MSIP_Label_f42aa342-8706-4288-bd11-ebb85995028c_Method=Privileged authentication-results: spf=none (sender IP is ) smtp.mailfrom=Bret.Barkelew@microsoft.com; x-originating-ip: [174.21.83.205] x-ms-publictraffictype: Email x-ms-office365-filtering-ht: Tenant x-ms-office365-filtering-correlation-id: 17145013-3589-4f97-b35f-08d7e88d3566 x-ms-traffictypediagnostic: CY4PR21MB0744: x-microsoft-antispam-prvs: x-ms-oob-tlc-oobclassifiers: OLM:765; x-forefront-prvs: 03838E948C x-forefront-antispam-report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:CY4PR21MB0743.namprd21.prod.outlook.com;PTR:;CAT:NONE;SFTY:;SFS:(4636009)(366004)(346002)(376002)(396003)(39860400002)(136003)(186003)(66946007)(76116006)(2906002)(110136005)(66446008)(64756008)(66556008)(66476007)(8936002)(5660300002)(53546011)(26005)(52536014)(60390400001)(82950400001)(82960400001)(54906003)(55016002)(33656002)(8990500004)(7696005)(9686003)(6506007)(30864003)(86362001)(4326008)(478600001)(71200400001)(8676002)(83080400001)(81156014)(316002)(19627235002)(10290500003)(966005)(559001)(579004);DIR:OUT;SFP:1102; received-spf: None (protection.outlook.com: microsoft.com does not designate permitted sender hosts) x-ms-exchange-senderadcheck: 1 x-microsoft-antispam: BCL:0; x-microsoft-antispam-message-info: e/ORtjowdbtJ1CDKc2hB34j2zaZyFXmMfH4bV/way+GdBeLjkwGUZa+RdqM7kHyMHWrVXGvlXuOyTGRzofWmb+3VM0tTEtK48DNyOiteebWVAqmpRq83k8VcD/Rv980hS+VB6iKqPsDz/XUO0GY4VWDsfURNKxXMHleu562s8Yk1qVsyNsIu9mWvEOepmj8Q6vMQrWUnweYdyUUCcCE/o5zLIdFeqj5IZu0NJ6dr5Q04hJweU3+CCiJcdFZmGrS5BudaOso8Lu+DKFkCpeogq1B4fZBCcJ99w2pRKt5pXh+Wyu4olBmRa4mbxreqFAVvojLJVCydqq1TYM8C4tWlJp+zK+nml8/4hM9Hrxwrojaru5GdNxmDIoIbg9mtMjxWCP/p6JjRtCvQWNUNCBfvwriSyvo0GFa5BPs09mEn5hShixoPaLMNUL27vy8gOMyV6JvMI+uYxPCqBtUh+7iJ8yBgc+bzgpYBjRt8tz2bdwbiUw/ChBYPEepNqaVyPpQ6XmGspPZi75bbNTRPAXzI3g== x-ms-exchange-antispam-messagedata: DmaPOGIcucAlG7hJHldWwVB1dGLorI3DaE5M612vpu503IJ5aa46LBbsghiC6OTwf6VQzLy3BR38YsSKh/slJCoUsIpqtZKffvBcn7PpaWsau87yrPTWOTyCAJ1W3YK3a6CE6IMPL7ezcoY3g4McZm2f8d6uykOtH+MmXxpsYfhJG/0FBKrElO5NQpoRTlg8DdqCQxnI0BFCNqea3tE6T+BoROWzoFXyWuggqeLjXBF5WGJuCWJl/hAl90BbiYqQ8cYVYs1m/AQbEovX1nLeNRM5ZRw66H4DvVVCRUwaR4iW3hZxNXgGRZTHZc7ZWlOc59m6cknP8FgXyKH0UCVomJ171W8+8jDzakz80kcnnvDtvLAuTwvlTGiSNOkCa41srUBPJo6ic6c4J36Qh1rOj5azFmNDG23nNb5OSmbs+UGtUPCPa9nqg5znqDcmhyevpX8NowyiQ9tOajTXXYC3n13ErxHYSgByzMxXWRUpcG+Yo5xlsDcH8yOToYHvqRlcuCk9tPvPqgX1qddRsKnjpkME6gz5+tkY5iroduAVMrkjF143mpa4F+AQT1HOHqb6gLeNYvmuVeJPfDeJ9dNP4xvWQvju5V80XDptguN7pqmG9qlSwv7+b6AOKOAXOL2dRtmLCG1hdVMAXTxotQs4VonVPUv189FWtyHhL1pt5eR+2pXXwI2WNvqHsN+RpJsJ2UD1a5Fd/beTJyS76DrGmBYtlx9PHWStGeNQPfEW80AStVrAnnWLKAP3crUgzti4FQQ0Kr39S8Jx03M1KmYDog+pAe8tyjIPBFT6GUmHEw8= x-ms-exchange-transport-forked: True MIME-Version: 1.0 X-OriginatorOrg: microsoft.com X-MS-Exchange-CrossTenant-Network-Message-Id: 17145013-3589-4f97-b35f-08d7e88d3566 X-MS-Exchange-CrossTenant-originalarrivaltime: 24 Apr 2020 20:22:27.6851 (UTC) X-MS-Exchange-CrossTenant-fromentityheader: Hosted X-MS-Exchange-CrossTenant-id: 72f988bf-86f1-41af-91ab-2d7cd011db47 X-MS-Exchange-CrossTenant-mailboxtype: HOSTED X-MS-Exchange-CrossTenant-userprincipalname: 5N/NGn4hBa4wfnmXvR8TWG+S4mEu8mKJtN1UWzZmKhQfycX9dzfLNXDI9lwN9V9v8HgKchbxuQamFfTxjT2IQQ== X-MS-Exchange-Transport-CrossTenantHeadersStamped: CY4PR21MB0744 Content-Language: en-US Content-Type: multipart/alternative; boundary="_000_CY4PR21MB074322A75D8A417932CB33D3EFD00CY4PR21MB0743namp_" --_000_CY4PR21MB074322A75D8A417932CB33D3EFD00CY4PR21MB0743namp_ Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable Reviewed-by: Bret Barkelew - Bret ________________________________ From: devel@edk2.groups.io on behalf of Michael Kub= acki via groups.io Sent: Monday, April 20, 2020 12:12:12 PM To: devel@edk2.groups.io Cc: Laszlo Ersek ; Ard Biesheuvel ; Leif Lindholm Subject: [EXTERNAL] [edk2-devel] [PATCH v2 2/6] ArmVirtPkg: Add Platform C= I and configuration for Core CI From: Sean Brogan REF:https://nam06.safelinks.protection.outlook.com/?url=3Dhttps%3A%2F%2Fbu= gzilla.tianocore.org%2Fshow_bug.cgi%3Fid%3D2570&data=3D02%7C01%7CBret.B= arkelew%40microsoft.com%7Cc40ddb755edc46ef3b2608d7e55ed80d%7C72f988bf86f141= af91ab2d7cd011db47%7C1%7C0%7C637230067830885007&sdata=3Da6fVczCTqMGlZeT= Fwe6IRGnJE48jL00qa1W9qo1RU0A%3D&reserved=3D0 Add new Azure Pipeline definitions to build and run ArmVirtPkg with: * Ubuntu GCC5 Add PyTool based build of ArmVirtPkg Add extdep for managing the iasl dependency Add ArmVirtPkg.ci.yaml for Core CI Add ReadMe.rst for status, details, and instructions Cc: Laszlo Ersek Cc: Ard Biesheuvel Cc: Leif Lindholm Signed-off-by: Sean Brogan Signed-off-by: Michael Kubacki --- ArmVirtPkg/ArmVirtPkg.ci.yaml | 103 ++++++++ ArmVirtPkg/PlatformCI/.azurepipelines/Ubuntu-GCC5.yml | 89 +++++++ ArmVirtPkg/PlatformCI/PlatformBuild.py | 276 +++++++++++++= +++++++ ArmVirtPkg/PlatformCI/iasl_ext_dep.yaml | 21 ++ ArmVirtPkg/ReadMe.rst | 139 ++++++++++ 5 files changed, 628 insertions(+) diff --git a/ArmVirtPkg/ArmVirtPkg.ci.yaml b/ArmVirtPkg/ArmVirtPkg.ci.yaml new file mode 100644 index 000000000000..4553725ee528 --- /dev/null +++ b/ArmVirtPkg/ArmVirtPkg.ci.yaml @@ -0,0 +1,103 @@ +## @file +# Core CI configuration for ArmVirtPkg +# +# ArmVirtPkg is part of Platform Ci for builds so this is only +# used for code analysis. +# +# Copyright (c) Microsoft Corporation +# SPDX-License-Identifier: BSD-2-Clause-Patent +## +{ + ## options defined .pytool/Plugin/CompilerPlugin + "CompilerPlugin": { + "DscPath": "" # Don't support this test + }, + + ## options defined .pytool/Plugin/HostUnitTestCompilerPlugin + "HostUnitTestCompilerPlugin": { + "DscPath": "" # Don't support this test + }, + + ## options defined .pytool/Plugin/CharEncodingCheck + "CharEncodingCheck": { + "IgnoreFiles": [] + }, + + ## options defined .pytool/Plugin/DependencyCheck + "DependencyCheck": { + "AcceptableDependencies": [ + "MdePkg/MdePkg.dec", + "MdeModulePkg/MdeModulePkg.dec", + "ArmVirtPkg/ArmVirtPkg.dec", + "NetworkPkg/NetworkPkg.dec", + "ArmPkg/ArmPkg.dec", + "OvmfPkg/OvmfPkg.dec", + "EmbeddedPkg/EmbeddedPkg.dec", + "ArmPlatformPkg/ArmPlatformPkg.dec", + "SecurityPkg/SecurityPkg.dec", + "ShellPkg/ShellPkg.dec" #Is this ok? + ], + # For host based unit tests + "AcceptableDependencies-HOST_APPLICATION":[ + "UnitTestFrameworkPkg/UnitTestFrameworkPkg.dec" + ], + # For UEFI shell based apps + "AcceptableDependencies-UEFI_APPLICATION":[ + + ], + "IgnoreInf": [] + }, + + ## options defined .pytool/Plugin/DscCompleteCheck + "DscCompleteCheck": { + "IgnoreInf": [""], + "DscPath": "" # Don't support this test + }, + + ## options defined .pytool/Plugin/HostUnitTestDscCompleteCheck + "HostUnitTestDscCompleteCheck": { + "IgnoreInf": [""], + "DscPath": "" # Don't support this test + }, + + ## options defined .pytool/Plugin/GuidCheck + "GuidCheck": { + "IgnoreGuidName": [], + "IgnoreGuidValue": [], + "IgnoreFoldersAndFiles": [], + "IgnoreDuplicates": [], + }, + + ## options defined .pytool/Plugin/LibraryClassCheck + "LibraryClassCheck": { + "IgnoreHeaderFile": [] + }, + + ## options defined .pytool/Plugin/SpellCheck + "SpellCheck": { + "AuditOnly": False, # Fails right now with over 270 err= ors + "IgnoreFiles": [], # use gitignore syntax to ignore err= ors in matching files + "ExtendWords": [ + "setjump", + "plong", + "lparam", + "lpdword", + "lpthread", + "lresult", + "bootable", + "bsymbolic", + "endiannness", + "fvmain", + "multiboot", + "qemu's", + "ramdisk", + "ramfb", + "unbootable", + "virt's", + "werror", + "xenio" + ], # words to extend to the dictionary for this package + "IgnoreStandardPaths": [], # Standard Plugin defined paths that= should be ignore + "AdditionalIncludePaths": [] # Additional paths to spell check (w= ildcards supported) + } +} diff --git a/ArmVirtPkg/PlatformCI/.azurepipelines/Ubuntu-GCC5.yml b/ArmVi= rtPkg/PlatformCI/.azurepipelines/Ubuntu-GCC5.yml new file mode 100644 index 000000000000..b9452ec5bfaf --- /dev/null +++ b/ArmVirtPkg/PlatformCI/.azurepipelines/Ubuntu-GCC5.yml @@ -0,0 +1,89 @@ +## @file +# Azure Pipeline build file for building a platform. +# +# Platform: ArmVirtQemu +# OS: Ubuntu +# Toolchain: GCC5 +# +# Copyright (c) Microsoft Corporation. +# SPDX-License-Identifier: BSD-2-Clause-Patent +## +trigger: + - master +pr: + - master + +jobs: + - job: Platform_CI + variables: + package: 'ArmVirtPkg' + vm_image: 'ubuntu-latest' + should_run: true + run_flags: "MAKE_STARTUP_NSH=3DTRUE QEMU_HEADLESS=3DTRUE" + + #Use matrix to speed up the build process + strategy: + matrix: + QEMU_AARCH64_DEBUG: + Build.File: "$(package)/PlatformCI/PlatformBuild.py" + Build.Arch: "AARCH64" + Build.Flags: "" + Build.Target: "DEBUG" + Run.Flags: $(run_flags) + Run: $(should_run) + QEMU_AARCH64_RELEASE: + Build.File: "$(package)/PlatformCI/PlatformBuild.py" + Build.Arch: "AARCH64" + Build.Flags: "" + Build.Target: "RELEASE" + Run.Flags: $(run_flags) + Run: $(should_run) + QEMU_AARCH64_NOOPT: + Build.File: "$(package)/PlatformCI/PlatformBuild.py" + Build.Arch: "AARCH64" + Build.Flags: "" + Build.Target: "NOOPT" + Run.Flags: $(run_flags) + Run: $(should_run) + QEMU_ARM_DEBUG: + Build.File: "$(package)/PlatformCI/PlatformBuild.py" + Build.Arch: "ARM" + Build.Flags: "" + Build.Target: "DEBUG" + Run.Flags: $(run_flags) + Run: $(should_run) + QEMU_ARM_RELEASE: + Build.File: "$(package)/PlatformCI/PlatformBuild.py" + Build.Arch: "ARM" + Build.Flags: "" + Build.Target: "RELEASE" + Run.Flags: $(run_flags) + Run: $(should_run) + QEMU_ARM_NOOPT: + Build.File: "$(package)/PlatformCI/PlatformBuild.py" + Build.Arch: "ARM" + Build.Flags: "" + Build.Target: "NOOPT" + Run.Flags: $(run_flags) + Run: $(should_run) + + workspace: + clean: all + + pool: + vmImage: $(vm_image) + + steps: + - template: ../../../.azurepipelines/templates/platform-build-run-ste= ps.yml + parameters: + tool_chain_tag: GCC5 + build_pkg: $(package) + build_target: $(Build.Target) + build_arch: $(Build.Arch) + build_file: $(Build.File) + build_flags: $(Build.Flags) + run_flags: $(Run.Flags) + extra_install_step: + - bash: sudo apt-get install qemu + displayName: Install qemu + condition: and(gt(variables.pkg_count, 0), succeeded()) diff --git a/ArmVirtPkg/PlatformCI/PlatformBuild.py b/ArmVirtPkg/PlatformC= I/PlatformBuild.py new file mode 100644 index 000000000000..dff653e919eb --- /dev/null +++ b/ArmVirtPkg/PlatformCI/PlatformBuild.py @@ -0,0 +1,276 @@ +# @file +# Script to Build ArmVirtPkg UEFI firmware +# +# Copyright (c) Microsoft Corporation. +# SPDX-License-Identifier: BSD-2-Clause-Patent +## +import os +import logging +import io + +from edk2toolext.environment import shell_environment +from edk2toolext.environment.uefi_build import UefiBuilder +from edk2toolext.invocables.edk2_platform_build import BuildSettingsManag= er +from edk2toolext.invocables.edk2_setup import SetupSettingsManager, Requi= redSubmodule +from edk2toolext.invocables.edk2_update import UpdateSettingsManager +from edk2toolext.invocables.edk2_pr_eval import PrEvalSettingsManager +from edk2toollib.utility_functions import RunCmd +from edk2toollib.utility_functions import GetHostInfo + +# #######################################################################= ################ # +# Common Configuration = # +# #######################################################################= ################ # + + +class CommonPlatform(): + ''' Common settings for this platform. Define static data here and u= se + for the different parts of stuart + ''' + PackagesSupported =3D ("ArmVirtPkg",) + ArchSupported =3D ("AARCH64", "ARM") + TargetsSupported =3D ("DEBUG", "RELEASE", "NOOPT") + Scopes =3D ('armvirt', 'edk2-build') + WorkspaceRoot =3D os.path.realpath(os.path.join( + os.path.dirname(os.path.abspath(__file__)), "..", "..")) + + # ###################################################################= #################### # + # Configuration for Update & Setup = # + # ###################################################################= #################### # + + +class SettingsManager(UpdateSettingsManager, SetupSettingsManager, PrEval= SettingsManager): + + def GetPackagesSupported(self): + ''' return iterable of edk2 packages supported by this build. + These should be edk2 workspace relative paths ''' + return CommonPlatform.PackagesSupported + + def GetArchitecturesSupported(self): + ''' return iterable of edk2 architectures supported by this build= ''' + return CommonPlatform.ArchSupported + + def GetTargetsSupported(self): + ''' return iterable of edk2 target tags supported by this build '= '' + return CommonPlatform.TargetsSupported + + def GetRequiredSubmodules(self): + ''' return iterable containing RequiredSubmodule objects. + If no RequiredSubmodules return an empty iterable + ''' + rs =3D [] + + # intentionally declare this one with recursive false to avoid ov= erhead + rs.append(RequiredSubmodule( + "CryptoPkg/Library/OpensslLib/openssl", False)) + + # To avoid maintenance of this file for every new submodule + # lets just parse the .gitmodules and add each if not already in = list. + # The GetRequiredSubmodules is designed to allow a build to optim= ize + # the desired submodules but it isn't necessary for this reposito= ry. + result =3D io.StringIO() + ret =3D RunCmd("git", "config --file .gitmodules --get-regexp pat= h", workingdir=3Dself.GetWorkspaceRoot(), outstream=3Dresult) + # Cmd output is expected to look like: + # submodule.CryptoPkg/Library/OpensslLib/openssl.path CryptoPkg/L= ibrary/OpensslLib/openssl + # submodule.SoftFloat.path ArmPkg/Library/ArmSoftFloatLib/berkele= y-softfloat-3 + if ret =3D=3D 0: + for line in result.getvalue().splitlines(): + _, _, path =3D line.partition(" ") + if path is not None: + if path not in [x.path for x in rs]: + rs.append(RequiredSubmodule(path, True)) # add it= with recursive since we don't know + return rs + + def SetArchitectures(self, list_of_requested_architectures): + ''' Confirm the requests architecture list is valid and configure= SettingsManager + to run only the requested architectures. + + Raise Exception if a list_of_requested_architectures is not suppo= rted + ''' + unsupported =3D set(list_of_requested_architectures) - \ + set(self.GetArchitecturesSupported()) + if(len(unsupported) > 0): + errorString =3D ( + "Unsupported Architecture Requested: " + " ".join(unsuppo= rted)) + logging.critical(errorString) + raise Exception(errorString) + self.ActualArchitectures =3D list_of_requested_architectures + + def GetWorkspaceRoot(self): + ''' get WorkspacePath ''' + return CommonPlatform.WorkspaceRoot + + def GetActiveScopes(self): + ''' return tuple containing scopes that should be active for this= process ''' + + scopes =3D CommonPlatform.Scopes + ActualToolChainTag =3D shell_environment.GetBuildVars().GetValue(= "TOOL_CHAIN_TAG", "") + + if GetHostInfo().os.upper() =3D=3D "LINUX" and ActualToolChainTag= .upper().startswith("GCC"): + if "AARCH64" in self.ActualArchitectures: + scopes +=3D ("gcc_aarch64_linux",) + if "ARM" in self.ActualArchitectures: + scopes +=3D ("gcc_arm_linux",) + return scopes + + def FilterPackagesToTest(self, changedFilesList: list, potentialPacka= gesList: list) -> list: + ''' Filter other cases that this package should be built + based on changed files. This should cover things that can't + be detected as dependencies. ''' + build_these_packages =3D [] + possible_packages =3D potentialPackagesList.copy() + for f in changedFilesList: + # BaseTools files that might change the build + if "BaseTools" in f: + if os.path.splitext(f) not in [".txt", ".md"]: + build_these_packages =3D possible_packages + break + + # if the azure pipeline platform template file changed + if "platform-build-run-steps.yml" in f: + build_these_packages =3D possible_packages + break + + + return build_these_packages + + def GetPlatformDscAndConfig(self) -> tuple: + ''' If a platform desires to provide its DSC then Policy 4 will e= valuate if + any of the changes will be built in the dsc. + + The tuple should be (, ) + ''' + return (os.path.join("ArmVirtPkg", "ArmVirtQemu.dsc"), {}) + + + # ###################################################################= #################### # + # Actual Configuration for Platform Build = # + # ###################################################################= #################### # + + +class PlatformBuilder(UefiBuilder, BuildSettingsManager): + def __init__(self): + UefiBuilder.__init__(self) + + def AddCommandLineOptions(self, parserObj): + ''' Add command line options to the argparser ''' + parserObj.add_argument('-a', "--arch", dest=3D"build_arch", type= =3Dstr, default=3D"AARCH64", + help=3D"Optional - Architecture to build. = Default =3D AARCH64") + + def RetrieveCommandLineOptions(self, args): + ''' Retrieve command line options from the argparser ''' + + shell_environment.GetBuildVars().SetValue( + "TARGET_ARCH", args.build_arch.upper(), "From CmdLine") + + shell_environment.GetBuildVars().SetValue( + "ACTIVE_PLATFORM", "ArmVirtPkg/ArmVirtQemu.dsc", "From CmdLin= e") + + def GetWorkspaceRoot(self): + ''' get WorkspacePath ''' + return CommonPlatform.WorkspaceRoot + + def GetPackagesPath(self): + ''' Return a list of workspace relative paths that should be mapp= ed as edk2 PackagesPath ''' + return () + + def GetActiveScopes(self): + ''' return tuple containing scopes that should be active for this= process ''' + scopes =3D CommonPlatform.Scopes + ActualToolChainTag =3D shell_environment.GetBuildVars().GetValue(= "TOOL_CHAIN_TAG", "") + Arch =3D shell_environment.GetBuildVars().GetValue("TARGET_ARCH",= "") + + if GetHostInfo().os.upper() =3D=3D "LINUX" and ActualToolChainTag= .upper().startswith("GCC"): + if "AARCH64" =3D=3D Arch: + scopes +=3D ("gcc_aarch64_linux",) + elif "ARM" =3D=3D Arch: + scopes +=3D ("gcc_arm_linux",) + return scopes + + def GetName(self): + ''' Get the name of the repo, platform, or product being build ''= ' + ''' Used for naming the log file, among others ''' + # check the startup nsh flag and if set then rename the log file. + # this helps in CI so we don't overwrite the build log since runn= ing + # uses the stuart_build command. + if(shell_environment.GetBuildVars().GetValue("MAKE_STARTUP_NSH", = "FALSE") =3D=3D "TRUE"): + return "ArmVirtPkg_With_Run" + return "ArmVirtPkg" + + def GetLoggingLevel(self, loggerType): + ''' Get the logging level for a given type + base =3D=3D lowest logging level supported + con =3D=3D Screen logging + txt =3D=3D plain text file logging + md =3D=3D markdown file logging + ''' + return logging.DEBUG + + def SetPlatformEnv(self): + logging.debug("PlatformBuilder SetPlatformEnv") + self.env.SetValue("PRODUCT_NAME", "ArmVirtQemu", "Platform Hardco= ded") + self.env.SetValue("MAKE_STARTUP_NSH", "FALSE", "Default to false"= ) + self.env.SetValue("QEMU_HEADLESS", "FALSE", "Default to false") + return 0 + + def PlatformPreBuild(self): + return 0 + + def PlatformPostBuild(self): + return 0 + + def FlashRomImage(self): + VirtualDrive =3D os.path.join(self.env.GetValue( + "BUILD_OUTPUT_BASE"), "VirtualDrive") + os.makedirs(VirtualDrive, exist_ok=3DTrue) + OutputPath_FV =3D os.path.join( + self.env.GetValue("BUILD_OUTPUT_BASE"), "FV") + Built_FV =3D os.path.join(OutputPath_FV, "QEMU_EFI.fd") + + # pad fd to 64mb + with open(Built_FV, "ab") as fvfile: + fvfile.seek(0, os.SEEK_END) + additional =3D b'\0' * ((64 * 1024 * 1024)-fvfile.tell()) + fvfile.write(additional) + + # QEMU must be on that path + + # Unique Command and Args parameters per ARCH + if (self.env.GetValue("TARGET_ARCH").upper() =3D=3D "AARCH64"): + cmd =3D "qemu-system-aarch64" + args =3D "-M virt" + args +=3D " -cpu cortex-a57" = # emulate cpu + elif(self.env.GetValue("TARGET_ARCH").upper() =3D=3D "ARM"): + cmd =3D "qemu-system-arm" + args =3D "-M virt" + args +=3D " -cpu cortex-a15" = # emulate cpu + else: + raise NotImplementedError() + + # Common Args + args +=3D " -pflash " + Built_FV = # path to fw + args +=3D " -m 1024" = # 1gb memory + # turn off network + args +=3D " -net none" + # Serial messages out + args +=3D " -serial stdio" + # Mount disk with startup.nsh + args +=3D f" -drive file=3Dfat:rw:{VirtualDrive},format=3Draw,med= ia=3Ddisk" + + # Conditional Args + if (self.env.GetValue("QEMU_HEADLESS").upper() =3D=3D "TRUE"): + args +=3D " -display none" # no graphics + + if (self.env.GetValue("MAKE_STARTUP_NSH").upper() =3D=3D "TRUE"): + f =3D open(os.path.join(VirtualDrive, "startup.nsh"), "w") + f.write("BOOT SUCCESS !!! \n") + # add commands here + f.write("reset -s\n") + f.close() + + ret =3D RunCmd(cmd, args) + + if ret =3D=3D 0xc0000005: + # for some reason getting a c0000005 on successful return + return 0 + + return ret diff --git a/ArmVirtPkg/PlatformCI/iasl_ext_dep.yaml b/ArmVirtPkg/Platform= CI/iasl_ext_dep.yaml new file mode 100644 index 000000000000..8869ed3ecef1 --- /dev/null +++ b/ArmVirtPkg/PlatformCI/iasl_ext_dep.yaml @@ -0,0 +1,21 @@ +## @file +# Download iasl executable tool from a nuget.org package +# - package contains different binaries based on host +# Add the folder with the tool to the path +# +# This is only downloaded for scope armvirt thus +# should have no impact on the asl compiler used by any +# other platform build +# +# Copyright (c) Microsoft Corporation. +# SPDX-License-Identifier: BSD-2-Clause-Patent +## +{ + "id": "iasl-armvirt-1", + "scope": "armvirt", + "type": "nuget", + "name": "iasl", + "source": "https://nam06.safelinks.protection.outlook.com/?url=3Dhttps%= 3A%2F%2Fapi.nuget.org%2Fv3%2Findex.json&data=3D02%7C01%7CBret.Barkelew%= 40microsoft.com%7Cc40ddb755edc46ef3b2608d7e55ed80d%7C72f988bf86f141af91ab2d= 7cd011db47%7C1%7C0%7C637230067830885007&sdata=3DqlLxPSG8b46gi3efOGuAekE= 3IXWn%2F0fFib0ryThdnSs%3D&reserved=3D0", + "version": "20190215.0.0", + "flags": ["set_path", "host_specific"], +} diff --git a/ArmVirtPkg/ReadMe.rst b/ArmVirtPkg/ReadMe.rst new file mode 100644 index 000000000000..6149bff7032d --- /dev/null +++ b/ArmVirtPkg/ReadMe.rst @@ -0,0 +1,139 @@ +=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D +ArmVirtPkg +=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D + +This ReadMe.rst summarizes the current state of Azure DevOps based Platfo= rm CI +for ArmVirtPkg. It also describes how to *build* ArmVirtPkg locally using= the Pytools build system. + +Platform CI Current Status +-------------------------- + +AARCH64 Configuration +````````````````````` +=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D =3D=3D=3D=3D=3D=3D=3D=3D=3D= = =3D=3D=3D=3D =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D =3D=3D=3D=3D=3D=3D=3D= = =3D=3D=3D=3D=3D=3D + Toolchain DEBUG RELEASE NOOPT +=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D =3D=3D=3D=3D=3D=3D=3D=3D=3D= = =3D=3D=3D=3D =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D =3D=3D=3D=3D=3D=3D=3D= = =3D=3D=3D=3D=3D=3D +`Ubuntu GCC5`_ |apAArch64du| |apAArch64ru| |apAArch64nu| +=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D =3D=3D=3D=3D=3D=3D=3D=3D=3D= = =3D=3D=3D=3D =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D =3D=3D=3D=3D=3D=3D=3D= = =3D=3D=3D=3D=3D=3D + +ARM Configuration +````````````````` +=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D =3D=3D=3D=3D=3D=3D=3D=3D=3D= = =3D=3D=3D=3D =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D =3D=3D=3D=3D=3D=3D=3D= = =3D=3D=3D=3D=3D=3D + Toolchain DEBUG RELEASE NOOPT +=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D =3D=3D=3D=3D=3D=3D=3D=3D=3D= = =3D=3D=3D=3D =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D =3D=3D=3D=3D=3D=3D=3D= = =3D=3D=3D=3D=3D=3D +`Ubuntu GCC5`_ |apArmdu| |apArmru| |apArmnu| +=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D =3D=3D=3D=3D=3D=3D=3D=3D=3D= = =3D=3D=3D=3D =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D =3D=3D=3D=3D=3D=3D=3D= = =3D=3D=3D=3D=3D=3D + +Setup +----- + +The Usual EDK2 Build Setup +`````````````````````````` + +- `Python 3.8.x - Download & Install `_ +- `GIT - Download & Install `_ +- `GIT - Configure for EDK II `_ +- `QEMU - Download, Install, and add to your path `= _ +- `EDKII Source - Download/Checkout from Github `_ + +**NOTE:** Do *not* follow the EDK II Compile Tools and Build instructions= , see below... + +Differences from EDK Classic Build Setup +```````````````````````````````````````` + +- Build BaseTools using `python BaseTools/Edk2ToolsBuild.py [-t ]` + + - This replaces `edksetup Rebuild`" from the classic build system + +- **No Action:** edksetup, Submodule initialization and manual installati= on of NASM and iASL are **not** + required, it is handled by the Pytools build system. + +Building with Pytools for ArmVirtPkg +```````````````````````````````````` + +* Install Pytools + + .. code-block:: bash + + pip install --upgrade -r pip-requirements.txt + +* Initialize & Update Submodules + + .. code-block:: bash + + stuart_setup -c ArmVirtPkg/PlatformCI/PlatformBuild.py TOOL_CHAIN_TAG= = =3D -a + +* Initialize & Update Dependencies (e.g. iASL & NASM) + + .. code-block:: bash + + stuart_update -c ArmVirtPkg/PlatformCI/PlatformBuild.py TOOL_CHAIN_TA= G=3D -a + +* Compile + + .. code-block:: bash + + stuart_build -c ArmVirtPkg/PlatformCI/PlatformBuild.py TOOL_CHAIN_TAG= = =3D -a + +* Running Emulator + + - You can add `--FlashRom` to the end of your build command and the emu= lator will run after the build is complete. + - or use the `--FlashOnly` feature to just run the emulator. + + .. code-block:: bash + + stuart_build -c ArmVirtPkg/PlatformCI/PlatformBuild.py TOOL_CHAIN_TAG= = =3D -a --FlashOnly + +Notes +````` + +1. Including the expected build architecture and toolchain to the *stuart= _update* command is critical. This is because there + are extra scopes and tools that will be resolved during the update ste= p that need to match your build step. +2. Configuring *ACTIVE_PLATFORM* and *TARGET_ARCH* in Conf/target.txt is = *not* required. This environment is set by + PlatformBuild.py based upon the `[-a ]` parameter. +3. QEMU must be on your path. On Windows this is a manual process and no= t part of the QEMU installer. + +**NOTE:** Logging the execution output will be in the normal stuart log a= s well as to your console. + +Custom Build Options +```````````````````` + +**MAKE_STARTUP_NSH=3DTRUE** will output a *startup.nsh* file to the locat= ion mapped as fs0. This is used in CI in combination +with the `--FlashOnly` feature to run QEMU to the UEFI shell and then exe= cute the contents of startup.nsh. + +**QEMU_HEADLESS=3DTRUE** Since CI servers run headless QEMU must be told = to run with no display otherwise an error occurs. +Locally you don't need to set this. + +Passing Build Defines +````````````````````` +To pass build defines through stuart_build, prepend `BLD_*_` to the defin= e name and pass it on the commandline. stuart_build currently +requires values to be assigned, so add a `=3D1` suffix for bare defines. +For example, to enable TPM2 support, instead of the traditional "-D TPM2_= ENABLE=3DTRUE", the stuart_build command-line would be: + +.. code-block:: bash + + stuart_build -c ArmVirtPkg/PlatformCI/PlatformBuild.py BLD_*_TPM2_ENABL= E=3DTRUE + +References +---------- +- `Installing Pytools `_ +- For each workspace, consider creating & using a `Python Virtual Environ= ment `_ + + * `Sample Layout `_ + +- `stuart_build commandline parser `_ + + +.. =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D +.. This is a bunch of directives to make the README file more readable +.. =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D + +.. _Ubuntu GCC5: https://nam06.safelinks.protection.outlook.com/?url=3Dht= tps%3A%2F%2Fdev.azure.com%2Ftianocore%2Fedk2-ci-play%2F_build%2Flatest%3Fde= finitionId%3D41%26branchName%3Dmaster&data=3D02%7C01%7CBret.Barkelew%40= microsoft.com%7Cc40ddb755edc46ef3b2608d7e55ed80d%7C72f988bf86f141af91ab2d7c= d011db47%7C1%7C0%7C637230067830894972&sdata=3DJrL3ua6Tqg6KBegP6Pm6Gir3c= nZg%2BPHXeQRpygTKE8U%3D&reserved=3D0 + +.. |apAArch64du| image:: https://nam06.safelinks.protection.outlook.com/?= url=3Dhttps%3A%2F%2Fdev.azure.com%2Ftianocore%2Fedk2-ci-play%2F_apis%2Fbuil= d%2Fstatus%2FArmVirtPkg%2FArmVirtQemu%2520Ubuntu%2520GCC5%3FbranchName%3Dma= ster%26jobName%3DPlatform_CI%26configuration%3DPlatform_CI%2520QEMU_AARCH64= _DEBUG&data=3D02%7C01%7CBret.Barkelew%40microsoft.com%7Cc40ddb755edc46e= f3b2608d7e55ed80d%7C72f988bf86f141af91ab2d7cd011db47%7C1%7C0%7C637230067830= 894972&sdata=3DMLqtonE66Cdhyr6Fbf1n5ycJ0%2FGKynqUoKuydXxt3gI%3D&res= erved=3D0 +.. |apAArch64ru| image:: https://nam06.safelinks.protection.outlook.com/?= url=3Dhttps%3A%2F%2Fdev.azure.com%2Ftianocore%2Fedk2-ci-play%2F_apis%2Fbuil= d%2Fstatus%2FArmVirtPkg%2FArmVirtQemu%2520Ubuntu%2520GCC5%3FbranchName%3Dma= ster%26jobName%3DPlatform_CI%26configuration%3DPlatform_CI%2520QEMU_AARCH64= _RELEASE&data=3D02%7C01%7CBret.Barkelew%40microsoft.com%7Cc40ddb755edc4= 6ef3b2608d7e55ed80d%7C72f988bf86f141af91ab2d7cd011db47%7C1%7C0%7C6372300678= 30894972&sdata=3DC5yR%2FQ4AxHRTHSKt6rIm5b1zsr37q5YMq1wcsPbpP4g%3D&r= eserved=3D0 +.. |apAArch64nu| image:: https://nam06.safelinks.protection.outlook.com/?= url=3Dhttps%3A%2F%2Fdev.azure.com%2Ftianocore%2Fedk2-ci-play%2F_apis%2Fbuil= d%2Fstatus%2FArmVirtPkg%2FArmVirtQemu%2520Ubuntu%2520GCC5%3FbranchName%3Dma= ster%26jobName%3DPlatform_CI%26configuration%3DPlatform_CI%2520QEMU_AARCH64= _NOOPT&data=3D02%7C01%7CBret.Barkelew%40microsoft.com%7Cc40ddb755edc46e= f3b2608d7e55ed80d%7C72f988bf86f141af91ab2d7cd011db47%7C1%7C0%7C637230067830= 894972&sdata=3D3vVM69IyS5Bz2gHzC3X1ntFyj00ySv5sswPYgnZfg9c%3D&reser= ved=3D0 + +.. |apArmdu| image:: https://nam06.safelinks.protection.outlook.com/?url= =3Dhttps%3A%2F%2Fdev.azure.com%2Ftianocore%2Fedk2-ci-play%2F_apis%2Fbuild%= 2Fstatus%2FArmVirtPkg%2FArmVirtQemu%2520Ubuntu%2520GCC5%3FbranchName%3Dmast= er%26jobName%3DPlatform_CI%26configuration%3DPlatform_CI%2520QEMU_ARM_DEBUG= &data=3D02%7C01%7CBret.Barkelew%40microsoft.com%7Cc40ddb755edc46ef3b260= 8d7e55ed80d%7C72f988bf86f141af91ab2d7cd011db47%7C1%7C0%7C637230067830894972= &sdata=3DO8qCEy9sZ%2B7c2Xsslr4z4%2F0tJH1iRrj4Oh6C%2Fke9dH4%3D&reser= ved=3D0 +.. |apArmru| image:: https://nam06.safelinks.protection.outlook.com/?url= =3Dhttps%3A%2F%2Fdev.azure.com%2Ftianocore%2Fedk2-ci-play%2F_apis%2Fbuild%= 2Fstatus%2FArmVirtPkg%2FArmVirtQemu%2520Ubuntu%2520GCC5%3FbranchName%3Dmast= er%26jobName%3DPlatform_CI%26configuration%3DPlatform_CI%2520QEMU_ARM_RELEA= SE&data=3D02%7C01%7CBret.Barkelew%40microsoft.com%7Cc40ddb755edc46ef3b2= 608d7e55ed80d%7C72f988bf86f141af91ab2d7cd011db47%7C1%7C0%7C6372300678308949= 72&sdata=3Do8TQJPCSac6GkYzKeKWFI6Z7jk5EUk8p9lVUqjOm7%2FI%3D&reserve= d=3D0 +.. |apArmnu| image:: https://nam06.safelinks.protection.outlook.com/?url= =3Dhttps%3A%2F%2Fdev.azure.com%2Ftianocore%2Fedk2-ci-play%2F_apis%2Fbuild%= 2Fstatus%2FArmVirtPkg%2FArmVirtQemu%2520Ubuntu%2520GCC5%3FbranchName%3Dmast= er%26jobName%3DPlatform_CI%26configuration%3DPlatform_CI%2520QEMU_ARM_NOOPT= &data=3D02%7C01%7CBret.Barkelew%40microsoft.com%7Cc40ddb755edc46ef3b260= 8d7e55ed80d%7C72f988bf86f141af91ab2d7cd011db47%7C1%7C0%7C637230067830894972= &sdata=3DRWG%2BWyS%2FOsPb0HTXHjZuYVgjXqswoJRC5ZEj5eCXrCQ%3D&reserve= d=3D0 -- 2.16.3.windows.1 --_000_CY4PR21MB074322A75D8A417932CB33D3EFD00CY4PR21MB0743namp_ Content-Type: text/html; charset="us-ascii" Content-Transfer-Encoding: quoted-printable

Reviewed-by: Bret Barkelew <bret.barkelew@micros= oft.com>

 

- Bret

 


From: devel@edk2.groups.io= <devel@edk2.groups.io> on behalf of Michael Kubacki via groups.io &l= t;michael.kubacki=3Doutlook.com@groups.io>
Sent: Monday, April 20, 2020 12:12:12 PM
To: devel@edk2.groups.io <devel@edk2.groups.io>
Cc: Laszlo Ersek <lersek@redhat.com>; Ard Biesheuvel <ard.= biesheuvel@arm.com>; Leif Lindholm <leif@nuviainc.com>
Subject: [EXTERNAL] [edk2-devel] [PATCH v2 2/6] ArmVirtPkg: Add Pla= tform CI and configuration for Core CI
 
From: Sean Brogan <sean.brogan@microsoft.com&g= t;

REF:https://nam06.safelinks.protection.outlook.com/?url=3Dhttps%3A%2F%2Fbu= gzilla.tianocore.org%2Fshow_bug.cgi%3Fid%3D2570&amp;data=3D02%7C01%7CBr= et.Barkelew%40microsoft.com%7Cc40ddb755edc46ef3b2608d7e55ed80d%7C72f988bf86= f141af91ab2d7cd011db47%7C1%7C0%7C637230067830885007&amp;sdata=3Da6fVczC= TqMGlZeTFwe6IRGnJE48jL00qa1W9qo1RU0A%3D&amp;reserved=3D0

Add new Azure Pipeline definitions to build and run ArmVirtPkg with:
  * Ubuntu GCC5
Add PyTool based build of ArmVirtPkg
Add extdep for managing the iasl dependency
Add ArmVirtPkg.ci.yaml for Core CI
Add ReadMe.rst for status, details, and instructions

Cc: Laszlo Ersek <lersek@redhat.com>
Cc: Ard Biesheuvel <ard.biesheuvel@arm.com>
Cc: Leif Lindholm <leif@nuviainc.com>
Signed-off-by: Sean Brogan <sean.brogan@microsoft.com>
Signed-off-by: Michael Kubacki <michael.kubacki@microsoft.com>
---
 ArmVirtPkg/ArmVirtPkg.ci.yaml      &nb= sp;            =       | 103 +++++++= 3;
 ArmVirtPkg/PlatformCI/.azurepipelines/Ubuntu-GCC5.yml |  89 = 3;++++++
 ArmVirtPkg/PlatformCI/PlatformBuild.py     =            | 276 += 3;++++++++++++++= 3;+++
 ArmVirtPkg/PlatformCI/iasl_ext_dep.yaml     = ;          |  21 += 3;
 ArmVirtPkg/ReadMe.rst        = ;            &n= bsp;            | 13= 9 ++++++++++
 5 files changed, 628 insertions(+)

diff --git a/ArmVirtPkg/ArmVirtPkg.ci.yaml b/ArmVirtPkg/ArmVirtPkg.ci.yaml=
new file mode 100644
index 000000000000..4553725ee528
--- /dev/null
+++ b/ArmVirtPkg/ArmVirtPkg.ci.yaml
@@ -0,0 +1,103 @@
+## @file
+# Core CI configuration for ArmVirtPkg
+#
+# ArmVirtPkg is part of Platform Ci for builds so this is only
+# used for code analysis.
+#
+# Copyright (c) Microsoft Corporation
+# SPDX-License-Identifier: BSD-2-Clause-Patent
+##
+{
+    ## options defined .pytool/Plugin/CompilerPlugin +    "CompilerPlugin": {
+        "DscPath": "= ;" # Don't support this test
+    },
+
+    ## options defined .pytool/Plugin/HostUnitTestComp= ilerPlugin
+    "HostUnitTestCompilerPlugin": {
+        "DscPath": "= ;" # Don't support this test
+    },
+
+    ## options defined .pytool/Plugin/CharEncodingChec= k
+    "CharEncodingCheck": {
+        "IgnoreFiles": [= ]
+    },
+
+    ## options defined .pytool/Plugin/DependencyCheck<= br> +    "DependencyCheck": {
+        "AcceptableDependenci= es": [
+            &q= uot;MdePkg/MdePkg.dec",
+            &q= uot;MdeModulePkg/MdeModulePkg.dec",
+            &q= uot;ArmVirtPkg/ArmVirtPkg.dec",
+            &q= uot;NetworkPkg/NetworkPkg.dec",
+            &q= uot;ArmPkg/ArmPkg.dec",
+            &q= uot;OvmfPkg/OvmfPkg.dec",
+            &q= uot;EmbeddedPkg/EmbeddedPkg.dec",
+            &q= uot;ArmPlatformPkg/ArmPlatformPkg.dec",
+            &q= uot;SecurityPkg/SecurityPkg.dec",
+            &q= uot;ShellPkg/ShellPkg.dec"  #Is this ok?
+        ],
+        # For host based unit test= s
+        "AcceptableDependenci= es-HOST_APPLICATION":[
+            &q= uot;UnitTestFrameworkPkg/UnitTestFrameworkPkg.dec"
+        ],
+        # For UEFI shell based app= s
+        "AcceptableDependenci= es-UEFI_APPLICATION":[
+
+        ],
+        "IgnoreInf": []<= br> +    },
+
+    ## options defined .pytool/Plugin/DscCompleteCheck=
+    "DscCompleteCheck": {
+        "IgnoreInf": [&q= uot;"],
+        "DscPath": "= ;"  # Don't support this test
+    },
+
+    ## options defined .pytool/Plugin/HostUnitTestDscC= ompleteCheck
+    "HostUnitTestDscCompleteCheck": {
+        "IgnoreInf": [&q= uot;"],
+        "DscPath": "= ;" # Don't support this test
+    },
+
+    ## options defined .pytool/Plugin/GuidCheck
+    "GuidCheck": {
+        "IgnoreGuidName"= : [],
+        "IgnoreGuidValue"= ;: [],
+        "IgnoreFoldersAndFile= s": [],
+        "IgnoreDuplicates&quo= t;: [],
+    },
+
+    ## options defined .pytool/Plugin/LibraryClassChec= k
+    "LibraryClassCheck": {
+        "IgnoreHeaderFile&quo= t;: []
+    },
+
+    ## options defined .pytool/Plugin/SpellCheck
+    "SpellCheck": {
+        "AuditOnly": Fal= se,           # Fails rig= ht now with over 270 errors
+        "IgnoreFiles": [= ],           # use gitign= ore syntax to ignore errors in matching files
+        "ExtendWords": [=
+            &q= uot;setjump",
+            &q= uot;plong",
+            &q= uot;lparam",
+            &q= uot;lpdword",
+            &q= uot;lpthread",
+            &q= uot;lresult",
+            &q= uot;bootable",
+            &q= uot;bsymbolic",
+            &q= uot;endiannness",
+            &q= uot;fvmain",
+            &q= uot;multiboot",
+            &q= uot;qemu's",
+            &q= uot;ramdisk",
+            &q= uot;ramfb",
+            &q= uot;unbootable",
+            &q= uot;virt's",
+            &q= uot;werror",
+            &q= uot;xenio"
+        ],    =        # words to extend to the dictionary fo= r this package
+        "IgnoreStandardPaths&= quot;: [],   # Standard Plugin defined paths that should be ignor= e
+        "AdditionalIncludePat= hs": [] # Additional paths to spell check (wildcards supported)
+    }
+}
diff --git a/ArmVirtPkg/PlatformCI/.azurepipelines/Ubuntu-GCC5.yml b/ArmVi= rtPkg/PlatformCI/.azurepipelines/Ubuntu-GCC5.yml
new file mode 100644
index 000000000000..b9452ec5bfaf
--- /dev/null
+++ b/ArmVirtPkg/PlatformCI/.azurepipelines/Ubuntu-GCC5.yml @@ -0,0 +1,89 @@
+## @file
+# Azure Pipeline build file for building a platform.
+#
+# Platform: ArmVirtQemu
+# OS: Ubuntu
+# Toolchain: GCC5
+#
+# Copyright (c) Microsoft Corporation.
+# SPDX-License-Identifier: BSD-2-Clause-Patent
+##
+trigger:
+  - master
+pr:
+  - master
+
+jobs:
+  - job: Platform_CI
+    variables:
+      package: 'ArmVirtPkg'
+      vm_image: 'ubuntu-latest'
+      should_run: true
+      run_flags: "MAKE_STARTUP_NSH=3DTR= UE QEMU_HEADLESS=3DTRUE"
+
+    #Use matrix to speed up the build process
+    strategy:
+        matrix:
+          QEMU_AARCH64_D= EBUG:
+            Bu= ild.File: "$(package)/PlatformCI/PlatformBuild.py"
+            Bu= ild.Arch: "AARCH64"
+            Bu= ild.Flags: ""
+            Bu= ild.Target: "DEBUG"
+            Ru= n.Flags: $(run_flags)
+            Ru= n: $(should_run)
+          QEMU_AARCH64_R= ELEASE:
+            Bu= ild.File: "$(package)/PlatformCI/PlatformBuild.py"
+            Bu= ild.Arch: "AARCH64"
+            Bu= ild.Flags: ""
+            Bu= ild.Target: "RELEASE"
+            Ru= n.Flags: $(run_flags)
+            Ru= n: $(should_run)
+          QEMU_AARCH64_N= OOPT:
+            Bu= ild.File: "$(package)/PlatformCI/PlatformBuild.py"
+            Bu= ild.Arch: "AARCH64"
+            Bu= ild.Flags: ""
+            Bu= ild.Target: "NOOPT"
+            Ru= n.Flags: $(run_flags)
+            Ru= n: $(should_run)
+          QEMU_ARM_DEBUG= :
+            Bu= ild.File: "$(package)/PlatformCI/PlatformBuild.py"
+            Bu= ild.Arch: "ARM"
+            Bu= ild.Flags: ""
+            Bu= ild.Target: "DEBUG"
+            Ru= n.Flags: $(run_flags)
+            Ru= n: $(should_run)
+          QEMU_ARM_RELEA= SE:
+            Bu= ild.File: "$(package)/PlatformCI/PlatformBuild.py"
+            Bu= ild.Arch: "ARM"
+            Bu= ild.Flags: ""
+            Bu= ild.Target: "RELEASE"
+            Ru= n.Flags: $(run_flags)
+            Ru= n: $(should_run)
+          QEMU_ARM_NOOPT= :
+            Bu= ild.File: "$(package)/PlatformCI/PlatformBuild.py"
+            Bu= ild.Arch: "ARM"
+            Bu= ild.Flags: ""
+            Bu= ild.Target: "NOOPT"
+            Ru= n.Flags: $(run_flags)
+            Ru= n: $(should_run)
+
+    workspace:
+      clean: all
+
+    pool:
+      vmImage: $(vm_image)
+
+    steps:
+    - template: ../../../.azurepipelines/templates/pla= tform-build-run-steps.yml
+      parameters:
+        tool_chain_tag: GCC5
+        build_pkg: $(package)
+        build_target: $(Build.Targ= et)
+        build_arch: $(Build.Arch)<= br> +        build_file: $(Build.File)<= br> +        build_flags: $(Build.Flags= )
+        run_flags: $(Run.Flags) +        extra_install_step:
+        - bash: sudo apt-get insta= ll qemu
+          displayName: I= nstall qemu
+          condition: and= (gt(variables.pkg_count, 0), succeeded())
diff --git a/ArmVirtPkg/PlatformCI/PlatformBuild.py b/ArmVirtPkg/PlatformC= I/PlatformBuild.py
new file mode 100644
index 000000000000..dff653e919eb
--- /dev/null
+++ b/ArmVirtPkg/PlatformCI/PlatformBuild.py
@@ -0,0 +1,276 @@
+# @file
+# Script to Build ArmVirtPkg UEFI firmware
+#
+# Copyright (c) Microsoft Corporation.
+# SPDX-License-Identifier: BSD-2-Clause-Patent
+##
+import os
+import logging
+import io
+
+from edk2toolext.environment import shell_environment
+from edk2toolext.environment.uefi_build import UefiBuilder
+from edk2toolext.invocables.edk2_platform_build import BuildSettingsM= anager
+from edk2toolext.invocables.edk2_setup import SetupSettingsManager, R= equiredSubmodule
+from edk2toolext.invocables.edk2_update import UpdateSettingsManager<= br> +from edk2toolext.invocables.edk2_pr_eval import PrEvalSettingsManager=
+from edk2toollib.utility_functions import RunCmd
+from edk2toollib.utility_functions import GetHostInfo
+
+# ###################################################################= #################### #
+#           &n= bsp;            = ;        Common Configuration  = ;            &n= bsp;            = ;          #
+# ###################################################################= #################### #
+
+
+class CommonPlatform():
+    ''' Common settings for this platform.  Defin= e static data here and use
+        for the different parts of= stuart
+    '''
+    PackagesSupported =3D ("ArmVirtPkg",) +    ArchSupported =3D ("AARCH64", "ARM&= quot;)
+    TargetsSupported =3D ("DEBUG", "REL= EASE", "NOOPT")
+    Scopes =3D ('armvirt', 'edk2-build')
+    WorkspaceRoot =3D os.path.realpath(os.path.join( +        os.path.dirname(os.path.ab= spath(__file__)), "..", ".."))
+
+    # ################################################= ####################################### #
+    #        &= nbsp;           &nbs= p;    Configuration for Update & Setup   =             &nb= sp;            =     #
+    # ################################################= ####################################### #
+
+
+class SettingsManager(UpdateSettingsManager, SetupSettingsManager, Pr= EvalSettingsManager):
+
+    def GetPackagesSupported(self):
+        ''' return iterable of edk= 2 packages supported by this build.
+        These should be edk2 works= pace relative paths '''
+        return CommonPlatform.Pack= agesSupported
+
+    def GetArchitecturesSupported(self):
+        ''' return iterable of edk= 2 architectures supported by this build '''
+        return CommonPlatform.Arch= Supported
+
+    def GetTargetsSupported(self):
+        ''' return iterable of edk= 2 target tags supported by this build '''
+        return CommonPlatform.Targ= etsSupported
+
+    def GetRequiredSubmodules(self):
+        ''' return iterable contai= ning RequiredSubmodule objects.
+        If no RequiredSubmodules r= eturn an empty iterable
+        '''
+        rs =3D []
+
+        # intentionally declare th= is one with recursive false to avoid overhead
+        rs.append(RequiredSubmodul= e(
+            &q= uot;CryptoPkg/Library/OpensslLib/openssl", False))
+
+        # To avoid maintenance of = this file for every new submodule
+        # lets just parse the .git= modules and add each if not already in list.
+        # The GetRequiredSubmodule= s is designed to allow a build to optimize
+        # the desired submodules b= ut it isn't necessary for this repository.
+        result =3D io.StringIO() +        ret =3D RunCmd("git&q= uot;, "config --file .gitmodules --get-regexp path", workingdir= =3Dself.GetWorkspaceRoot(), outstream=3Dresult)
+        # Cmd output is expected t= o look like:
+        # submodule.CryptoPkg/Libr= ary/OpensslLib/openssl.path CryptoPkg/Library/OpensslLib/openssl
+        # submodule.SoftFloat.path= ArmPkg/Library/ArmSoftFloatLib/berkeley-softfloat-3
+        if ret =3D=3D 0:
+            fo= r line in result.getvalue().splitlines():
+           &nb= sp;    _, _, path =3D line.partition(" ")
+           &nb= sp;    if path is not None:
+           &nb= sp;        if path not in [x.path for x = in rs]:
+           &nb= sp;            rs.ap= pend(RequiredSubmodule(path, True)) # add it with recursive since we don't = know
+        return rs
+
+    def SetArchitectures(self, list_of_requested_archi= tectures):
+        ''' Confirm the requests a= rchitecture list is valid and configure SettingsManager
+        to run only the requested = architectures.
+
+        Raise Exception if a list_= of_requested_architectures is not supported
+        '''
+        unsupported =3D set(list_o= f_requested_architectures) - \
+            se= t(self.GetArchitecturesSupported())
+        if(len(unsupported) > 0= ):
+            er= rorString =3D (
+           &nb= sp;    "Unsupported Architecture Requested: " += ; " ".join(unsupported))
+            lo= gging.critical(errorString)
+            ra= ise Exception(errorString)
+        self.ActualArchitectures = =3D list_of_requested_architectures
+
+    def GetWorkspaceRoot(self):
+        ''' get WorkspacePath '''<= br> +        return CommonPlatform.Work= spaceRoot
+
+    def GetActiveScopes(self):
+        ''' return tuple containin= g scopes that should be active for this process '''
+
+        scopes =3D CommonPlatform.= Scopes
+        ActualToolChainTag =3D she= ll_environment.GetBuildVars().GetValue("TOOL_CHAIN_TAG", "&q= uot;)
+
+        if GetHostInfo().os.upper(= ) =3D=3D "LINUX" and ActualToolChainTag.upper().startswith("= GCC"):
+            if= "AARCH64" in self.ActualArchitectures:
+           &nb= sp;    scopes +=3D ("gcc_aarch64_linux",)
+            if= "ARM" in self.ActualArchitectures:
+           &nb= sp;    scopes +=3D ("gcc_arm_linux",)
+        return scopes
+
+    def FilterPackagesToTest(self, changedFilesList: l= ist, potentialPackagesList: list) -> list:
+        ''' Filter other cases tha= t this package should be built
+        based on changed files. Th= is should cover things that can't
+        be detected as dependencie= s. '''
+        build_these_packages =3D [= ]
+        possible_packages =3D pote= ntialPackagesList.copy()
+        for f in changedFilesList:=
+            # = BaseTools files that might change the build
+            if= "BaseTools" in f:
+           &nb= sp;    if os.path.splitext(f) not in [".txt", &quo= t;.md"]:
+           &nb= sp;        build_these_packages =3D poss= ible_packages
+           &nb= sp;        break
+
+            # = if the azure pipeline platform template file changed
+            if= "platform-build-run-steps.yml" in f:
+           &nb= sp;    build_these_packages =3D possible_packages
+           &nb= sp;    break
+
+
+        return build_these_package= s
+
+    def GetPlatformDscAndConfig(self) -> tuple:
+        ''' If a platform desires = to provide its DSC then Policy 4 will evaluate if
+        any of the changes will be= built in the dsc.
+
+        The tuple should be (<w= orkspace relative path to dsc file>, <input dictionary of dsc key val= ue pairs>)
+        '''
+        return (os.path.join("= ;ArmVirtPkg", "ArmVirtQemu.dsc"), {})
+
+
+    # ################################################= ####################################### #
+    #        &= nbsp;           &nbs= p;    Actual Configuration for Platform Build  &nb= sp;            =           #
+    # ################################################= ####################################### #
+
+
+class PlatformBuilder(UefiBuilder, BuildSettingsManager):
+    def __init__(self):
+        UefiBuilder.__init__(self)=
+
+    def AddCommandLineOptions(self, parserObj):
+        ''' Add command line optio= ns to the argparser '''
+        parserObj.add_argument('-a= ', "--arch", dest=3D"build_arch", type=3Dstr, default= =3D"AARCH64",
+           &nb= sp;            =        help=3D"Optional - Architecture t= o build.  Default =3D AARCH64")
+
+    def RetrieveCommandLineOptions(self, args):
+        '''  Retrieve command= line options from the argparser '''
+
+        shell_environment.GetBuild= Vars().SetValue(
+            &q= uot;TARGET_ARCH", args.build_arch.upper(), "From CmdLine") +
+        shell_environment.GetBuild= Vars().SetValue(
+            &q= uot;ACTIVE_PLATFORM", "ArmVirtPkg/ArmVirtQemu.dsc", "Fr= om CmdLine")
+
+    def GetWorkspaceRoot(self):
+        ''' get WorkspacePath '''<= br> +        return CommonPlatform.Work= spaceRoot
+
+    def GetPackagesPath(self):
+        ''' Return a list of works= pace relative paths that should be mapped as edk2 PackagesPath '''
+        return ()
+
+    def GetActiveScopes(self):
+        ''' return tuple containin= g scopes that should be active for this process '''
+        scopes =3D CommonPlatform.= Scopes
+        ActualToolChainTag =3D she= ll_environment.GetBuildVars().GetValue("TOOL_CHAIN_TAG", "&q= uot;)
+        Arch =3D shell_environment= .GetBuildVars().GetValue("TARGET_ARCH", "")
+
+        if GetHostInfo().os.upper(= ) =3D=3D "LINUX" and ActualToolChainTag.upper().startswith("= GCC"):
+            if= "AARCH64" =3D=3D Arch:
+           &nb= sp;    scopes +=3D ("gcc_aarch64_linux",)
+            el= if "ARM" =3D=3D Arch:
+           &nb= sp;    scopes +=3D ("gcc_arm_linux",)
+        return scopes
+
+    def GetName(self):
+        ''' Get the name of the re= po, platform, or product being build '''
+        ''' Used for naming the lo= g file, among others '''
+        # check the startup nsh fl= ag and if set then rename the log file.
+        # this helps in CI so we d= on't overwrite the build log since running
+        # uses the stuart_build co= mmand.
+        if(shell_environment.GetBu= ildVars().GetValue("MAKE_STARTUP_NSH", "FALSE") =3D=3D = "TRUE"):
+            re= turn "ArmVirtPkg_With_Run"
+        return "ArmVirtPkg&qu= ot;
+
+    def GetLoggingLevel(self, loggerType):
+        ''' Get the logging level = for a given type
+        base =3D=3D lowest logging= level supported
+        con  =3D=3D Screen lo= gging
+        txt  =3D=3D plain tex= t file logging
+        md   =3D=3D mark= down file logging
+        '''
+        return logging.DEBUG
+
+    def SetPlatformEnv(self):
+        logging.debug("Platfo= rmBuilder SetPlatformEnv")
+        self.env.SetValue("PR= ODUCT_NAME", "ArmVirtQemu", "Platform Hardcoded")<= br> +        self.env.SetValue("MA= KE_STARTUP_NSH", "FALSE", "Default to false")
+        self.env.SetValue("QE= MU_HEADLESS", "FALSE", "Default to false")
+        return 0
+
+    def PlatformPreBuild(self):
+        return 0
+
+    def PlatformPostBuild(self):
+        return 0
+
+    def FlashRomImage(self):
+        VirtualDrive =3D os.path.j= oin(self.env.GetValue(
+            &q= uot;BUILD_OUTPUT_BASE"), "VirtualDrive")
+        os.makedirs(VirtualDrive, = exist_ok=3DTrue)
+        OutputPath_FV =3D os.path.= join(
+            se= lf.env.GetValue("BUILD_OUTPUT_BASE"), "FV")
+        Built_FV =3D os.path.join(= OutputPath_FV, "QEMU_EFI.fd")
+
+        # pad fd to 64mb
+        with open(Built_FV, "= ab") as fvfile:
+            fv= file.seek(0, os.SEEK_END)
+            ad= ditional =3D b'\0' * ((64 * 1024 * 1024)-fvfile.tell())
+            fv= file.write(additional)
+
+        # QEMU must be on that pat= h
+
+        # Unique Command and Args = parameters per ARCH
+        if (self.env.GetValue(&quo= t;TARGET_ARCH").upper() =3D=3D "AARCH64"):
+            cm= d =3D "qemu-system-aarch64"
+            ar= gs =3D "-M virt"
+            ar= gs +=3D " -cpu cortex-a57"      = ;            &n= bsp;            = ;           # emulate cpu=
+        elif(self.env.GetValue(&qu= ot;TARGET_ARCH").upper() =3D=3D "ARM"):
+            cm= d =3D "qemu-system-arm"
+            ar= gs =3D "-M virt"
+            ar= gs +=3D " -cpu cortex-a15"      = ;            &n= bsp;            = ;           # emulate cpu=
+        else:
+            ra= ise NotImplementedError()
+
+        # Common Args
+        args +=3D " -pfla= sh " + Built_FV        &nb= sp;            =             &nb= sp;   # path to fw
+        args +=3D " -m 10= 24"           &= nbsp;           &nbs= p;            &= nbsp;           &nbs= p; # 1gb memory
+        # turn off network
+        args +=3D " -net = none"
+        # Serial messages out
+        args +=3D " -seri= al stdio"
+        # Mount disk with startup.= nsh
+        args +=3D f" -dri= ve file=3Dfat:rw:{VirtualDrive},format=3Draw,media=3Ddisk"
+
+        # Conditional Args
+        if (self.env.GetValue(&quo= t;QEMU_HEADLESS").upper() =3D=3D "TRUE"):
+            ar= gs +=3D " -display none"  # no graphics
+
+        if (self.env.GetValue(&quo= t;MAKE_STARTUP_NSH").upper() =3D=3D "TRUE"):
+            f = = =3D open(os.path.join(VirtualDrive, "startup.nsh"), "w"= ;)
+            f.= write("BOOT SUCCESS !!! \n")
+            # = add commands here
+            f.= write("reset -s\n")
+            f.= close()
+
+        ret =3D RunCmd(cmd, args)<= br> +
+        if ret =3D=3D 0xc0000005:<= br> +            # = for some reason getting a c0000005 on successful return
+            re= turn 0
+
+        return ret
diff --git a/ArmVirtPkg/PlatformCI/iasl_ext_dep.yaml b/ArmVirtPkg/Platform= CI/iasl_ext_dep.yaml
new file mode 100644
index 000000000000..8869ed3ecef1
--- /dev/null
+++ b/ArmVirtPkg/PlatformCI/iasl_ext_dep.yaml
@@ -0,0 +1,21 @@
+## @file
+# Download iasl executable tool from a nuget.org package
+# - package contains different binaries based on host
+# Add the folder with the tool to the path
+#
+# This is only downloaded for scope armvirt thus
+# should have no impact on the asl compiler used by any
+# other platform build
+#
+# Copyright (c) Microsoft Corporation.
+# SPDX-License-Identifier: BSD-2-Clause-Patent
+##
+{
+  "id": "iasl-armvirt-1",
+  "scope": "armvirt",
+  "type": "nuget",
+  "name": "iasl",
+  "source": "https://nam06.safelinks.protection.outlook.com/?url=3Dhttps= %3A%2F%2Fapi.nuget.org%2Fv3%2Findex.json&amp;data=3D02%7C01%7CBret.Bark= elew%40microsoft.com%7Cc40ddb755edc46ef3b2608d7e55ed80d%7C72f988bf86f141af9= 1ab2d7cd011db47%7C1%7C0%7C637230067830885007&amp;sdata=3DqlLxPSG8b46gi3= efOGuAekE3IXWn%2F0fFib0ryThdnSs%3D&amp;reserved=3D0",
+  "version": "20190215.0.0",
+  "flags": ["set_path", "host_specific&= quot;],
+}
diff --git a/ArmVirtPkg/ReadMe.rst b/ArmVirtPkg/ReadMe.rst
new file mode 100644
index 000000000000..6149bff7032d
--- /dev/null
+++ b/ArmVirtPkg/ReadMe.rst
@@ -0,0 +1,139 @@
+=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
+ArmVirtPkg
+=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
+
+This ReadMe.rst summarizes the current state of Azure DevOps based Pl= atform CI
+for ArmVirtPkg. It also describes how to *build* ArmVirtPkg locally u= sing the Pytools build system.
+
+Platform CI Current Status
+--------------------------
+
+AARCH64 Configuration
+`````````````````````
+=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D =3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D =3D=3D=3D=3D=3D= = =3D=3D=3D=3D=3D=3D=3D=3D
+ Toolchain      DEBUG    = ;     RELEASE       NOOPT=
+=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D =3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D =3D=3D=3D=3D=3D= = =3D=3D=3D=3D=3D=3D=3D=3D
+`Ubuntu GCC5`_  |apAArch64du| |apAArch64ru| |apAArch64nu|
+=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D =3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D =3D=3D=3D=3D=3D= = =3D=3D=3D=3D=3D=3D=3D=3D
+
+ARM Configuration
+`````````````````
+=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D =3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D =3D=3D=3D=3D=3D= = =3D=3D=3D=3D=3D=3D=3D=3D
+ Toolchain      DEBUG    = ;     RELEASE       NOOPT=
+=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D =3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D =3D=3D=3D=3D=3D= = =3D=3D=3D=3D=3D=3D=3D=3D
+`Ubuntu GCC5`_  |apArmdu|     |apArmru| = ;    |apArmnu|
+=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D =3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D =3D=3D=3D=3D=3D= = =3D=3D=3D=3D=3D=3D=3D=3D
+
+Setup
+-----
+
+The Usual EDK2 Build Setup
+``````````````````````````
+
+- `Python 3.8.x - Download & Install <https://nam06.safelinks.protection.outlook.com/?u= rl=3Dhttps%3A%2F%2Fwww.python.org%2Fdownloads%2F&amp;data=3D02%7C01%7CB= ret.Barkelew%40microsoft.com%7Cc40ddb755edc46ef3b2608d7e55ed80d%7C72f988bf8= 6f141af91ab2d7cd011db47%7C1%7C0%7C637230067830885007&amp;sdata=3DgwuWIP= hl4PqU3XTw6jU3ABBaR%2BCmTC24e17Fd0ZiuTU%3D&amp;reserved=3D0>`_ +- `GIT - Download & Install <https://nam06.safelinks.protection.outlook.com/?url=3Dhttps%3A= %2F%2Fgit-scm.com%2Fdownload%2F&amp;data=3D02%7C01%7CBret.Barkelew%40mi= crosoft.com%7Cc40ddb755edc46ef3b2608d7e55ed80d%7C72f988bf86f141af91ab2d7cd0= 11db47%7C1%7C0%7C637230067830885007&amp;sdata=3DQuy06b0GasA9Ag%2BS5VlgN= J9bYgEKmV7ABkRPCwfl6Gw%3D&amp;reserved=3D0>`_
+- `GIT - Configure for EDK II <https:= //nam06.safelinks.protection.outlook.com/?url=3Dhttps%3A%2F%2Fgithub.com%2F= tianocore%2Ftianocore.github.io%2Fwiki%2FWindows-systems%23github-help&= amp;data=3D02%7C01%7CBret.Barkelew%40microsoft.com%7Cc40ddb755edc46ef3b2608= d7e55ed80d%7C72f988bf86f141af91ab2d7cd011db47%7C1%7C0%7C637230067830885007&= amp;amp;sdata=3DwFBQ7CGdPSZp6pHv6fTW9oYb1B%2BUK3diHsviATPWVSI%3D&amp;re= served=3D0>`_
+- `QEMU - Download, Install, and add to your path <https://nam06.safelinks.protection.outlook.co= m/?url=3Dhttps%3A%2F%2Fwww.qemu.org%2Fdownload%2F&amp;data=3D02%7C01%7C= Bret.Barkelew%40microsoft.com%7Cc40ddb755edc46ef3b2608d7e55ed80d%7C72f988bf= 86f141af91ab2d7cd011db47%7C1%7C0%7C637230067830885007&amp;sdata=3DVKtID= DMygxYY97DzwENxknWIltDw4fyrsJ4GEj7MFlM%3D&amp;reserved=3D0>`_ +- `EDKII Source - Download/Checkout from Github <https://nam06.safelinks.protection.outlook.com/?url=3Dhttps%3A%2F%= 2Fgithub.com%2Ftianocore%2Ftianocore.github.io%2Fwiki%2FWindows-systems%23d= ownload&amp;data=3D02%7C01%7CBret.Barkelew%40microsoft.com%7Cc40ddb755e= dc46ef3b2608d7e55ed80d%7C72f988bf86f141af91ab2d7cd011db47%7C1%7C0%7C6372300= 67830885007&amp;sdata=3DVB95DDiiFsmvpVwOT2G7PMnumUcIXsAD7YmE%2BWPQaSE%3= D&amp;reserved=3D0>`_
+
+**NOTE:** Do *not* follow the EDK II Compile Tools and Build instruct= ions, see below...
+
+Differences from EDK Classic Build Setup
+````````````````````````````````````````
+
+- Build BaseTools using `python BaseTools/Edk2ToolsBuild.py [-t <T= oolChainTag>]`
+
+  - This replaces `edksetup Rebuild`" from the classic buil= d system
+
+- **No Action:** edksetup, Submodule initialization and manual instal= lation of NASM and iASL are **not**
+  required, it is handled by the Pytools build system.
+
+Building with Pytools for ArmVirtPkg
+````````````````````````````````````
+
+* Install Pytools
+
+  .. code-block:: bash
+
+    pip install --upgrade -r pip-requirements.txt
+
+* Initialize & Update Submodules
+
+  .. code-block:: bash
+
+    stuart_setup -c ArmVirtPkg/PlatformCI/PlatformBuil= d.py TOOL_CHAIN_TAG=3D<TOOL_CHAIN_TAG> -a <TARGET_ARCH>
+
+* Initialize & Update Dependencies (e.g. iASL & NASM)
+
+  .. code-block:: bash
+
+    stuart_update -c ArmVirtPkg/PlatformCI/PlatformBui= ld.py TOOL_CHAIN_TAG=3D<TOOL_CHAIN_TAG> -a <TARGET_ARCH>
+
+* Compile
+
+  .. code-block:: bash
+
+    stuart_build -c ArmVirtPkg/PlatformCI/PlatformBuil= d.py TOOL_CHAIN_TAG=3D<TOOL_CHAIN_TAG> -a <TARGET_ARCH>
+
+* Running Emulator
+
+  - You can add `--FlashRom` to the end of your build command an= d the emulator will run after the build is complete.
+  - or use the `--FlashOnly` feature to just run the emulator. +
+  .. code-block:: bash
+
+    stuart_build -c ArmVirtPkg/PlatformCI/PlatformBuil= d.py TOOL_CHAIN_TAG=3D<TOOL_CHAIN_TAG> -a <TARGET_ARCH> --Flash= Only
+
+Notes
+`````
+
+1. Including the expected build architecture and toolchain to the *st= uart_update* command is critical. This is because there
+   are extra scopes and tools that will be resolved during = the update step that need to match your build step.
+2. Configuring *ACTIVE_PLATFORM* and *TARGET_ARCH* in Conf/target.txt= is *not* required. This environment is set by
+   PlatformBuild.py based upon the `[-a <TARGET_ARCH>= ]` parameter.
+3. QEMU must be on your path.  On Windows this is a manual proce= ss and not part of the QEMU installer.
+
+**NOTE:** Logging the execution output will be in the normal stuart l= og as well as to your console.
+
+Custom Build Options
+````````````````````
+
+**MAKE_STARTUP_NSH=3DTRUE** will output a *startup.nsh* file to the l= ocation mapped as fs0. This is used in CI in combination
+with the `--FlashOnly` feature to run QEMU to the UEFI shell and then= execute the contents of startup.nsh.
+
+**QEMU_HEADLESS=3DTRUE** Since CI servers run headless QEMU must be t= old to run with no display otherwise an error occurs.
+Locally you don't need to set this.
+
+Passing Build Defines
+`````````````````````
+To pass build defines through stuart_build, prepend `BLD_*_` to the d= efine name and pass it on the commandline. stuart_build currently
+requires values to be assigned, so add a `=3D1` suffix for bare defin= es.
+For example, to enable TPM2 support, instead of the traditional "= ;-D TPM2_ENABLE=3DTRUE", the stuart_build command-line would be:
+
+.. code-block:: bash
+
+  stuart_build -c ArmVirtPkg/PlatformCI/PlatformBuild.py BLD_*_T= PM2_ENABLE=3DTRUE
+
+References
+----------
+- `Installing Pytools <https://nam06.safelinks.protection.outlook.com/?url=3Dhttps%3A%2F%2F= github.com%2Ftianocore%2Fedk2-pytool-extensions%2Fblob%2Fmaster%2Fdocs%2Fus= ing.md%23installing&amp;data=3D02%7C01%7CBret.Barkelew%40microsoft.com%= 7Cc40ddb755edc46ef3b2608d7e55ed80d%7C72f988bf86f141af91ab2d7cd011db47%7C1%7= C0%7C637230067830885007&amp;sdata=3DZVcDVndxMu%2FMS8P%2BVgq4mNjR%2FEBk4= Y14D9eCgM9srl8%3D&amp;reserved=3D0>`_
+- For each workspace, consider creating & using a `Python Virtual= Environment <https://nam06.safelinks.protection.outlook.com/?url=3Dhttps%3A%2F%2Fdocs= .python.org%2F3%2Flibrary%2Fvenv.html&amp;data=3D02%7C01%7CBret.Barkele= w%40microsoft.com%7Cc40ddb755edc46ef3b2608d7e55ed80d%7C72f988bf86f141af91ab= 2d7cd011db47%7C1%7C0%7C637230067830885007&amp;sdata=3DLg0mroOCdLdORiehC= i4xX93PbBQy8vDUrjOvNXA1JJU%3D&amp;reserved=3D0>`_
+
+  * `Sample Layout <https://nam06.safelinks.protection.outlook.com/?url=3Dhttps%3A%= 2F%2Fmicrosoft.github.io%2Fmu%2FCodeDevelopment%2Fprerequisites%2F%23worksp= ace-virtual-environment-setup-process&amp;data=3D02%7C01%7CBret.Barkele= w%40microsoft.com%7Cc40ddb755edc46ef3b2608d7e55ed80d%7C72f988bf86f141af91ab= 2d7cd011db47%7C1%7C0%7C637230067830885007&amp;sdata=3Djc9S0%2BDc0k724g5= zsmWIDxtKF49RuZyHp2nsebowFXs%3D&amp;reserved=3D0>`_
+
+- `stuart_build commandline parser <https://nam06.safelinks= .protection.outlook.com/?url=3Dhttps%3A%2F%2Fgithub.com%2Ftianocore%2Fedk2-= pytool-extensions%2Fblob%2F56f6a7aee09995c2f22da4765e8b0a29c1cbf5de%2Fedk2t= oolext%2Fedk2_invocable.py%23L109&amp;data=3D02%7C01%7CBret.Barkelew%40= microsoft.com%7Cc40ddb755edc46ef3b2608d7e55ed80d%7C72f988bf86f141af91ab2d7c= d011db47%7C1%7C0%7C637230067830885007&amp;sdata=3DRsQxmP7nIewfcb67uRjn0= C8SCCifKxTENQ3sT7gYX9w%3D&amp;reserved=3D0>`_
+
+
+.. =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= = =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
+.. This is a bunch of directives to make the README file more readabl= e
+.. =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= = =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
+
+.. _Ubuntu GCC5: https://nam06.safelinks.protection.outlook.com/?url=3Dhttps%3A%2F%2Fdev.az= ure.com%2Ftianocore%2Fedk2-ci-play%2F_build%2Flatest%3FdefinitionId%3D41%26= branchName%3Dmaster&amp;data=3D02%7C01%7CBret.Barkelew%40microsoft.com%= 7Cc40ddb755edc46ef3b2608d7e55ed80d%7C72f988bf86f141af91ab2d7cd011db47%7C1%7= C0%7C637230067830894972&amp;sdata=3DJrL3ua6Tqg6KBegP6Pm6Gir3cnZg%2BPHXe= QRpygTKE8U%3D&amp;reserved=3D0
+
+.. |apAArch64du| image:: https://nam06.safelinks.protection.outlook.com/?url=3Dhttps%3A%2F%2Fdev.az= ure.com%2Ftianocore%2Fedk2-ci-play%2F_apis%2Fbuild%2Fstatus%2FArmVirtPkg%2F= ArmVirtQemu%2520Ubuntu%2520GCC5%3FbranchName%3Dmaster%26jobName%3DPlatform_= CI%26configuration%3DPlatform_CI%2520QEMU_AARCH64_DEBUG&amp;data=3D02%7= C01%7CBret.Barkelew%40microsoft.com%7Cc40ddb755edc46ef3b2608d7e55ed80d%7C72= f988bf86f141af91ab2d7cd011db47%7C1%7C0%7C637230067830894972&amp;sdata= =3DMLqtonE66Cdhyr6Fbf1n5ycJ0%2FGKynqUoKuydXxt3gI%3D&amp;reserved=3D0
+.. |apAArch64ru| image::
https://nam06.safelinks.protection.outlook.com/?url=3Dhttps%3A%2F%2Fdev.az= ure.com%2Ftianocore%2Fedk2-ci-play%2F_apis%2Fbuild%2Fstatus%2FArmVirtPkg%2F= ArmVirtQemu%2520Ubuntu%2520GCC5%3FbranchName%3Dmaster%26jobName%3DPlatform_= CI%26configuration%3DPlatform_CI%2520QEMU_AARCH64_RELEASE&amp;data=3D02= %7C01%7CBret.Barkelew%40microsoft.com%7Cc40ddb755edc46ef3b2608d7e55ed80d%7C= 72f988bf86f141af91ab2d7cd011db47%7C1%7C0%7C637230067830894972&amp;sdata= = =3DC5yR%2FQ4AxHRTHSKt6rIm5b1zsr37q5YMq1wcsPbpP4g%3D&amp;reserved=3D0
+.. |apAArch64nu| image::
https://nam06.safelinks.protection.outlook.com/?url=3Dhttps%3A%2F%2Fdev.az= ure.com%2Ftianocore%2Fedk2-ci-play%2F_apis%2Fbuild%2Fstatus%2FArmVirtPkg%2F= ArmVirtQemu%2520Ubuntu%2520GCC5%3FbranchName%3Dmaster%26jobName%3DPlatform_= CI%26configuration%3DPlatform_CI%2520QEMU_AARCH64_NOOPT&amp;data=3D02%7= C01%7CBret.Barkelew%40microsoft.com%7Cc40ddb755edc46ef3b2608d7e55ed80d%7C72= f988bf86f141af91ab2d7cd011db47%7C1%7C0%7C637230067830894972&amp;sdata= =3D3vVM69IyS5Bz2gHzC3X1ntFyj00ySv5sswPYgnZfg9c%3D&amp;reserved=3D0=
+
+.. |apArmdu| image:: https://nam06.safelinks.protection.outlook.com/?url=3Dhttps%3A%2F%2Fdev.az= ure.com%2Ftianocore%2Fedk2-ci-play%2F_apis%2Fbuild%2Fstatus%2FArmVirtPkg%2F= ArmVirtQemu%2520Ubuntu%2520GCC5%3FbranchName%3Dmaster%26jobName%3DPlatform_= CI%26configuration%3DPlatform_CI%2520QEMU_ARM_DEBUG&amp;data=3D02%7C01%= 7CBret.Barkelew%40microsoft.com%7Cc40ddb755edc46ef3b2608d7e55ed80d%7C72f988= bf86f141af91ab2d7cd011db47%7C1%7C0%7C637230067830894972&amp;sdata=3DO8q= CEy9sZ%2B7c2Xsslr4z4%2F0tJH1iRrj4Oh6C%2Fke9dH4%3D&amp;reserved=3D0<= br> +.. |apArmru| image:: https://nam06.safelinks.protection.outlook.com/?url=3Dhttps%3A%2F%2Fdev.az= ure.com%2Ftianocore%2Fedk2-ci-play%2F_apis%2Fbuild%2Fstatus%2FArmVirtPkg%2F= ArmVirtQemu%2520Ubuntu%2520GCC5%3FbranchName%3Dmaster%26jobName%3DPlatform_= CI%26configuration%3DPlatform_CI%2520QEMU_ARM_RELEASE&amp;data=3D02%7C0= 1%7CBret.Barkelew%40microsoft.com%7Cc40ddb755edc46ef3b2608d7e55ed80d%7C72f9= 88bf86f141af91ab2d7cd011db47%7C1%7C0%7C637230067830894972&amp;sdata=3Do= 8TQJPCSac6GkYzKeKWFI6Z7jk5EUk8p9lVUqjOm7%2FI%3D&amp;reserved=3D0 +.. |apArmnu| image:: https://nam06.safelinks.protection.outlook.com/?url=3Dhttps%3A%2F%2Fdev.az= ure.com%2Ftianocore%2Fedk2-ci-play%2F_apis%2Fbuild%2Fstatus%2FArmVirtPkg%2F= ArmVirtQemu%2520Ubuntu%2520GCC5%3FbranchName%3Dmaster%26jobName%3DPlatform_= CI%26configuration%3DPlatform_CI%2520QEMU_ARM_NOOPT&amp;data=3D02%7C01%= 7CBret.Barkelew%40microsoft.com%7Cc40ddb755edc46ef3b2608d7e55ed80d%7C72f988= bf86f141af91ab2d7cd011db47%7C1%7C0%7C637230067830894972&amp;sdata=3DRWG= %2BWyS%2FOsPb0HTXHjZuYVgjXqswoJRC5ZEj5eCXrCQ%3D&amp;reserved=3D0 --
2.16.3.windows.1




--_000_CY4PR21MB074322A75D8A417932CB33D3EFD00CY4PR21MB0743namp_--