From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from NAM04-BN3-obe.outbound.protection.outlook.com (NAM04-BN3-obe.outbound.protection.outlook.com [40.92.9.11]) by mx.groups.io with SMTP id smtpd.web10.997.1586369650106663591 for ; Wed, 08 Apr 2020 11:14:10 -0700 Authentication-Results: mx.groups.io; dkim=fail reason="body hash did not verify" header.i=@outlook.com header.s=selector1 header.b=tauGWSc4; spf=pass (domain: outlook.com, ip: 40.92.9.11, mailfrom: michael.kubacki@outlook.com) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=Rmi+bGBil1RDPru0DxyGERiIlTiAl/Fl6RqIyCuvEmBehg6jDqq6+VR3kfb3psbuvuaOY7/spS1+pZdIvHPqZ8kOXkfkKPoUOGivQ+vqcyfonTKmZqxCUIhIlZ8s7cLVTLD7y7GgR2eb44NHqHATL+p+6DvtYPmgyCU8jHXhBk8Ko48NNI0w96kwGHd/lBNfRqFRzrqfW0GbOI7UU985789K4byGs+qeNRGZ3EJJ5MLxjFBHA0UOOdJvbt/xyw1zKyJpkOnxSP2EEBlSUrEb17zTl4DuDFzRi1kPVKMa5qmPZEHpRUefg85JsxQspQqSkat3yoWE1T/Os7sOYbznpQ== 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=Qpj1UJHLMZNpm8DFX7HQmV3NkJBHKtuJ2lVA0iGIBFg=; b=Gx6YsUz2gRpBadvCFOg8/xdl2F/DhYVQXHEq9p3yAHOFjr7/pR/j+DmmF5fiBTt/kxpmHnAjKkBC0C6/SRJSLSxrzEsHoAjl6fj4nZACqThlFa+hcqZCzIS2ix9vVC3Nd1RM4P5sQYVZiqCKRR+6gBZOz/LysJYmR83+I6tXAaFCDDNlPjJu0OWTRSYpDB1CDvxUrSE8KaxAaX0Mewm9r4EW5EwLnlelX3ovwkSCeNikHplBLfwviAdl3d/M0kaLbsg4O0z0R7QijLsdfaHH7Io43/0deKDniWO0FK4NIkLZjtSdj3hNbT9qAktI3MCyH0Yhq6wJcEltr3HaLvbKgA== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=outlook.com; dmarc=pass action=none header.from=outlook.com; dkim=pass header.d=outlook.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=outlook.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=Qpj1UJHLMZNpm8DFX7HQmV3NkJBHKtuJ2lVA0iGIBFg=; b=tauGWSc4wQtm5yfdXQxTj6X/89g+vEzJDzPMipvgb4rpuAPMrs41zHeUpeg7i16hUb5kdyTSQyi3ZbJLGXpYZYNGn6dwwO+ObjLxXqe+k8eEV8VnlgUQs8heYjjYJJzp9uRoIV72QKeHPnmh/amYsEAxmkZJfD/vIASZA3nCvXsBpgjzBmNv23AkKNrnQWpKR4hSCEXJB9W/xAxe65MKVCfTJambR71R7tWVeb7B8ZUjLpv/YwrHm43xVSzBL2O0knnWOxqlBvqSoYFXeefnjsMKRPpZdiXzDYs2MhIYJzLBUQ6BYNP8v3/Fbdpx8oAvtgoD26b9jt6Gb9xVimGgcA== Received: from CO1NAM04FT025.eop-NAM04.prod.protection.outlook.com (10.152.90.60) by CO1NAM04HT203.eop-NAM04.prod.protection.outlook.com (10.152.91.156) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.2878.19; Wed, 8 Apr 2020 18:14:08 +0000 Received: from MWHPR07MB3440.namprd07.prod.outlook.com (2a01:111:e400:7e4d::42) by CO1NAM04FT025.mail.protection.outlook.com (2a01:111:e400:7e4d::160) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.2878.19 via Frontend Transport; Wed, 8 Apr 2020 18:14:08 +0000 X-IncomingTopHeaderMarker: OriginalChecksum:714840FB912E78AA49E356DA88EE1F69A9A7C63EF01B5581A7C13AFA5F035926;UpperCasedChecksum:88DE2F1FF1A0DFD76B45E07DC1FD5E72261C06132921AC0802C84F0625F075C1;SizeAsReceived:8945;Count:50 Received: from MWHPR07MB3440.namprd07.prod.outlook.com ([fe80::f5a7:e51b:e22a:959f]) by MWHPR07MB3440.namprd07.prod.outlook.com ([fe80::f5a7:e51b:e22a:959f%7]) with mapi id 15.20.2878.022; Wed, 8 Apr 2020 18:14:08 +0000 From: "Michael Kubacki" To: devel@edk2.groups.io CC: Jordan Justen , Andrew Fish , Ray Ni Subject: [PATCH v1 3/6] EmulatorPkg: Add Platform CI and configuration for Core CI Date: Wed, 8 Apr 2020 11:13:24 -0700 Message-ID: X-Mailer: git-send-email 2.16.3.windows.1 In-Reply-To: <20200408181327.4324-1-michael.kubacki@outlook.com> References: <20200408181327.4324-1-michael.kubacki@outlook.com> X-ClientProxiedBy: MWHPR10CA0054.namprd10.prod.outlook.com (2603:10b6:300:2c::16) To MWHPR07MB3440.namprd07.prod.outlook.com (2603:10b6:301:69::28) Return-Path: michael.kubacki@outlook.com X-Microsoft-Original-Message-ID: <20200408181327.4324-4-michael.kubacki@outlook.com> MIME-Version: 1.0 X-MS-Exchange-MessageSentRepresentingType: 1 Received: from localhost.localdomain (2001:4898:80e8:2:c970:b9b:c52f:94cf) by MWHPR10CA0054.namprd10.prod.outlook.com (2603:10b6:300:2c::16) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.2900.15 via Frontend Transport; Wed, 8 Apr 2020 18:14:08 +0000 X-Mailer: git-send-email 2.16.3.windows.1 X-Microsoft-Original-Message-ID: <20200408181327.4324-4-michael.kubacki@outlook.com> X-TMN: [ThIfSMVJNdFTZqUeO8h3Tx2o/C6/4YUY7+ry9Ng0qEDB0TIjxPKpL4ggz33vlgaQ] X-MS-PublicTrafficType: Email X-IncomingHeaderCount: 50 X-EOPAttributedMessage: 0 X-MS-Office365-Filtering-Correlation-Id: f1996885-cf1c-4d1f-ae13-08d7dbe8a15b X-MS-TrafficTypeDiagnostic: CO1NAM04HT203: X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: 6nz8hthC3irLEZePaWMQ5Wi2+FGJWH62D9nM5Ea8FfLBPUtFHZAgVBOmom9tKgUsT17giuEkxc6t6AxcNcF4ymKERrBbTCk9casykNV9aABAB3uQNkzMFW4zxlzLrhfUgtj8s//0Tj69xyvArO28XvAo7jIhDsmHL0Xil5BIeYcxART+nw+KJO80KrhW3ysORcPJTeWilF1LaXCGcBz221Cusi4XtcwZoxBlQBYEU8M= X-Forefront-Antispam-Report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:0;SRV:;IPV:NLI;SFV:NSPM;H:MWHPR07MB3440.namprd07.prod.outlook.com;PTR:;CAT:NONE;SFTY:;SFS:;DIR:OUT;SFP:1901; X-MS-Exchange-AntiSpam-MessageData: Dn2qPETOdJEY0w5ZC5LR3muBai3QS8vGKDEARBYAiUifi5j7N/ri/CgA4Hbv+/ZbwJj0oESimjfDyNi8tkAMKDOh077pz6rBQBkoS8O2G/x96UpWntLGXwYlVc05j1vjLohRIhxo2WU+wTQi9Ozwr6QuxE9xCI+YcbW7FNzV41xWw7aHxyoLq8gDaqoRkTAIasVCcd969wT7N56CVImJEw== X-OriginatorOrg: outlook.com X-MS-Exchange-CrossTenant-Network-Message-Id: f1996885-cf1c-4d1f-ae13-08d7dbe8a15b X-MS-Exchange-CrossTenant-OriginalArrivalTime: 08 Apr 2020 18:14:08.4730 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 84df9e7f-e9f6-40af-b435-aaaaaaaaaaaa X-MS-Exchange-CrossTenant-FromEntityHeader: Internet X-MS-Exchange-CrossTenant-RMS-PersistedConsumerOrg: 00000000-0000-0000-0000-000000000000 X-MS-Exchange-Transport-CrossTenantHeadersStamped: CO1NAM04HT203 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable From: Sean Brogan REF:https://bugzilla.tianocore.org/show_bug.cgi?id=3D2570 Add new Azure Pipeline definitions to build and run EmulatorPkg with: * Ubuntu GCC5 * Windows VS2019 Add PyTool based build of EmulatorPkg Add EmulatorPkg.ci.yaml for Core CI Add README-pytools for details and instructions Cc: Jordan Justen Cc: Andrew Fish Cc: Ray Ni Signed-off-by: Sean Brogan --- EmulatorPkg/.azurepipelines/Ubuntu-GCC5.yml | 95 ++++++++ EmulatorPkg/.azurepipelines/Windows-VS2019.yml | 85 +++++++ EmulatorPkg/EmulatorPkg.ci.yaml | 85 +++++++ EmulatorPkg/PlatformBuild.py | 252 ++++++++++++++++++++ EmulatorPkg/README-pytools.md | 173 ++++++++++++++ 5 files changed, 690 insertions(+) diff --git a/EmulatorPkg/.azurepipelines/Ubuntu-GCC5.yml b/EmulatorPkg/.azu= repipelines/Ubuntu-GCC5.yml new file mode 100644 index 000000000000..1aa5904bb379 --- /dev/null +++ b/EmulatorPkg/.azurepipelines/Ubuntu-GCC5.yml @@ -0,0 +1,95 @@ +## @file +# Azure Pipeline build file for building a platform. +# +# Platform: EmulatorPkg +# 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: 'EmulatorPkg' + vm_image: 'ubuntu-latest' + should_run: false + run_flags: "MAKE_STARTUP_NSH=3DTRUE" + + #Use matrix to speed up the build process + strategy: + matrix: + EmulatorPkg_X64_DEBUG: + Build.File: "$(package)/PlatformBuild.py" + Build.Arch: "X64" + Build.Flags: "" + Build.Target: "DEBUG" + Run.Flags: $(run_flags) + Run: $(should_run) + EmulatorPkg_X64_RELEASE: + Build.File: "$(package)/PlatformBuild.py" + Build.Arch: "X64" + Build.Flags: "" + Build.Target: "RELEASE" + Run.Flags: $(run_flags) + Run: $(should_run) + EmulatorPkg_X64_NOOPT: + Build.File: "$(package)/PlatformBuild.py" + Build.Arch: "X64" + Build.Flags: "" + Build.Target: "NOOPT" + Run.Flags: $(run_flags) + Run: $(should_run) + EmulatorPkg_IA32_DEBUG: + Build.File: "$(package)/PlatformBuild.py" + Build.Arch: "IA32" + Build.Flags: "" + Build.Target: "DEBUG" + Run.Flags: $(run_flags) + Run: $(should_run) + EmulatorPkg_IA32_RELEASE: + Build.File: "$(package)/PlatformBuild.py" + Build.Arch: "IA32" + Build.Flags: "" + Build.Target: "RELEASE" + Run.Flags: $(run_flags) + Run: $(should_run) + EmulatorPkg_IA32_NOOPT: + Build.File: "$(package)/PlatformBuild.py" + Build.Arch: "IA32" + 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-steps.y= ml + 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) + # Add steps to install some IA32 only dependencies + extra_install_step: + - bash: sudo dpkg --add-architecture i386 + displayName: Add i386 to dpkg + condition: and(gt(variables.pkg_count, 0), eq(variables['Build.A= rch'], 'IA32'), succeeded()) + - bash: sudo apt-get update + displayName: do apt-get update + condition: and(gt(variables.pkg_count, 0), eq(variables['Build.A= rch'], 'IA32'), succeeded()) + - bash: sudo apt-get install libc6-dev:i386 libx11-dev:i386 libxex= t-dev:i386 lib32gcc-7-dev + displayName: Add additional i386 packages + condition: and(gt(variables.pkg_count, 0), eq(variables['Build.A= rch'], 'IA32'), succeeded()) diff --git a/EmulatorPkg/.azurepipelines/Windows-VS2019.yml b/EmulatorPkg/.= azurepipelines/Windows-VS2019.yml new file mode 100644 index 000000000000..e73eb910e04b --- /dev/null +++ b/EmulatorPkg/.azurepipelines/Windows-VS2019.yml @@ -0,0 +1,85 @@ +## @file +# Azure Pipeline build file for building a platform. +# +# Platform: EMULATORPKG +# OS: Windows +# Toolchain: VS2019 +# +# Copyright (c) Microsoft Corporation. +# SPDX-License-Identifier: BSD-2-Clause-Patent +## +trigger: + - master +pr: + - master + +jobs: + - job: Platform_CI + variables: + package: 'EmulatorPkg' + vm_image: 'windows-latest' + should_run: true + run_flags: "MAKE_STARTUP_NSH=3DTRUE" + + #Use matrix to speed up the build process + strategy: + matrix: + EmulatorPkg_X64_DEBUG: + Build.File: "$(package)/PlatformBuild.py" + Build.Arch: "X64" + Build.Flags: "" + Build.Target: "DEBUG" + Run.Flags: $(run_flags) + Run: $(should_run) + EmulatorPkg_X64_RELEASE: + Build.File: "$(package)/PlatformBuild.py" + Build.Arch: "X64" + Build.Flags: "" + Build.Target: "RELEASE" + Run.Flags: $(run_flags) + Run: $(should_run) + EmulatorPkg_X64_NOOPT: + Build.File: "$(package)/PlatformBuild.py" + Build.Arch: "X64" + Build.Flags: "" + Build.Target: "NOOPT" + Run.Flags: $(run_flags) + Run: $(should_run) + EmulatorPkg_IA32_DEBUG: + Build.File: "$(package)/PlatformBuild.py" + Build.Arch: "IA32 " + Build.Flags: "" + Build.Target: "DEBUG" + Run.Flags: $(run_flags) + Run: $(should_run) + EmulatorPkg_IA32_RELEASE: + Build.File: "$(package)/PlatformBuild.py" + Build.Arch: "IA32 " + Build.Flags: "" + Build.Target: "RELEASE" + Run.Flags: $(run_flags) + Run: $(should_run) + EmulatorPkg_IA32_NOOPT: + Build.File: "$(package)/PlatformBuild.py" + Build.Arch: "IA32 " + 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-steps.y= ml + parameters: + tool_chain_tag: VS2019 + build_pkg: $(package) + build_target: $(Build.Target) + build_arch: $(Build.Arch) + build_file: $(Build.File) + build_flags: $(Build.Flags) + run_flags: $(Run.Flags) diff --git a/EmulatorPkg/EmulatorPkg.ci.yaml b/EmulatorPkg/EmulatorPkg.ci.y= aml new file mode 100644 index 000000000000..81f81780ec76 --- /dev/null +++ b/EmulatorPkg/EmulatorPkg.ci.yaml @@ -0,0 +1,85 @@ +## @file +# Core CI configuration for EmulatorPkg +# +# EmulatorPkg 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": [ + # For this platform all packages are allowed??? + "MdePkg/MdePkg.dec", + "MdeModulePkg/MdeModulePkg.dec", + "EmulatorPkg/EmulatorPkg.dec", + "NetworkPkg/NetworkPkg.dec", + "EmbeddedPkg/EmbeddedPkg.dec", ## is this one 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": True, # Fails right now with over 270 error= s + "IgnoreFiles": [], # use gitignore syntax to ignore erro= rs in matching files + "ExtendWords": [ + "setjump", + "plong", + "lparam", + "lpdword", + "lpthread", + "lresult", + ], # words to extend to the dictionary for this package + "IgnoreStandardPaths": [], # Standard Plugin defined paths that = should be ignore + "AdditionalIncludePaths": [] # Additional paths to spell check (wi= ldcards supported) + } +} diff --git a/EmulatorPkg/PlatformBuild.py b/EmulatorPkg/PlatformBuild.py new file mode 100644 index 000000000000..4ed87f58e14d --- /dev/null +++ b/EmulatorPkg/PlatformBuild.py @@ -0,0 +1,252 @@ +=EF=BB=BF# @file +# Script to Build EmulatorPkg UEFI firmware +# +# Copyright (c) Microsoft Corporation. +# SPDX-License-Identifier: BSD-2-Clause-Patent +## +import os +import logging + +from edk2toolext.environment import shell_environment +from edk2toolext.environment.uefi_build import UefiBuilder +from edk2toolext.invocables.edk2_platform_build import BuildSettingsManage= r +from edk2toolext.invocables.edk2_setup import SetupSettingsManager, Requir= edSubmodule +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 us= e + for the different parts of stuart + ''' + PackagesSupported =3D ("EmulatorPkg",) + ArchSupported =3D ("X64", "IA32") + TargetsSupported =3D ("DEBUG", "RELEASE", "NOOPT") + Scopes =3D ('emulatorpkg', '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, PrEvalS= ettingsManager): + + 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 [] + rs.append(RequiredSubmodule( + "ArmPkg/Library/ArmSoftFloatLib/berkeley-softfloat-3", False)) + rs.append(RequiredSubmodule( + "CryptoPkg/Library/OpensslLib/openssl", False)) + 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 suppor= ted + ''' + unsupported =3D set(list_of_requested_architectures) - \ + set(self.GetArchitecturesSupported()) + if(len(unsupported) > 0): + errorString =3D ( + "Unsupported Architecture Requested: " + " ".join(unsuppor= ted)) + 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 ''' + return CommonPlatform.Scopes + + def FilterPackagesToTest(self, changedFilesList: list, potentialPackag= esList: 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 + return build_these_packages + + def GetPlatformDscAndConfig(self) -> tuple: + ''' If a platform desires to provide its DSC then Policy 4 will ev= aluate if + any of the changes will be built in the dsc. + + The tuple should be (, ) + ''' + return (os.path.join("EmulatorPkg", "EmulatorPkg.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"X64", + help=3D"Optional - architecture to build. = IA32 will use IA32 for Pei & Dxe. " + "X64 will use X64 for both PEI and DXE.") + + 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", "EmulatorPkg/EmulatorPkg.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 mappe= d as edk2 PackagesPath ''' + return () + + def GetActiveScopes(self): + ''' return tuple containing scopes that should be active for this = process ''' + return CommonPlatform.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 runni= ng + # uses the stuart_build command. + if(shell_environment.GetBuildVars().GetValue("MAKE_STARTUP_NSH", "= FALSE") =3D=3D "TRUE"): + return "EmulatorPkg_With_Run" + return "EmulatorPkg" + + 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", "EmulatorPkg", "Platform Hardcod= ed") + self.env.SetValue("TOOL_CHAIN_TAG", "VS2019", "Default Toolchain") + + # Add support for using the correct Platform Headers, tools, and L= ibs based on emulator architecture + # requested to be built when building VS2019 or VS2017 + if self.env.GetValue("TOOL_CHAIN_TAG") =3D=3D "VS2019" or self.env= .GetValue("TOOL_CHAIN_TAG") =3D=3D "VS2017": + key =3D self.env.GetValue("TOOL_CHAIN_TAG") + "_HOST" + if self.env.GetValue("TARGET_ARCH") =3D=3D "IA32": + shell_environment.ShellEnvironment().set_shell_var(key, "x= 86") + elif self.env.GetValue("TARGET_ARCH") =3D=3D "X64": + shell_environment.ShellEnvironment().set_shell_var(key, "x= 64") + + # Add support for using the correct Platform Headers, tools, and L= ibs based on emulator architecture + # requested to be built when building on linux. + if GetHostInfo().os.upper() =3D=3D "LINUX": + self.ConfigureLinuxDLinkPath() + + if GetHostInfo().os.upper() =3D=3D "WINDOWS": + self.env.SetValue("BLD_*_WIN_HOST_BUILD", "TRUE", + "Trigger Windows host build") + + self.env.SetValue("MAKE_STARTUP_NSH", "FALSE", "Default to false") + + # I don't see what this does but it is in build.sh + key =3D "BLD_*_BUILD_" + self.env.GetValue("TARGET_ARCH") + self.env.SetValue(key, "TRUE", "match script in build.sh") + return 0 + + def PlatformPreBuild(self): + return 0 + + def PlatformPostBuild(self): + return 0 + + def FlashRomImage(self): + ''' Use the FlashRom Function to run the emulator. This gives an = easy stuart command line to + activate the emulator. ''' + + OutputPath =3D os.path.join(self.env.GetValue( + "BUILD_OUTPUT_BASE"), self.env.GetValue("TARGET_ARCH")) + + if (self.env.GetValue("MAKE_STARTUP_NSH") =3D=3D "TRUE"): + f =3D open(os.path.join(OutputPath, "startup.nsh"), "w") + f.write("BOOT SUCCESS !!! \n") + # add commands here + f.write("reset\n") + f.close() + + if GetHostInfo().os.upper() =3D=3D "WINDOWS": + cmd =3D "WinHost.exe" + elif GetHostInfo().os.upper() =3D=3D "LINUX": + cmd =3D "./Host" + else: + logging.critical("Unsupported Host") + return -1 + return RunCmd(cmd, "", workingdir=3DOutputPath) + + def ConfigureLinuxDLinkPath(self): + ''' + logic copied from build.sh to setup the correct libraries + ''' + if self.env.GetValue("TARGET_ARCH") =3D=3D "IA32": + LIB_NAMES =3D ["ld-linux.so.2", "libdl.so.2 crt1.o", "crti.o c= rtn.o"] + LIB_SEARCH_PATHS =3D ["/usr/lib/i386-linux-gnu", + "/usr/lib32", "/lib32", "/usr/lib", "/lib"= ] + elif self.env.GetValue("TARGET_ARCH") =3D=3D "X64": + LIB_NAMES =3D ["ld-linux-x86-64.so.2", + "libdl.so.2", "crt1.o", "crti.o", "crtn.o"] + LIB_SEARCH_PATHS =3D ["/usr/lib/x86_64-linux-gnu", + "/usr/lib64", "/lib64", "/usr/lib", "/lib"= ] + + HOST_DLINK_PATHS =3D "" + for lname in LIB_NAMES: + logging.debug(f"Looking for {lname}") + for dname in LIB_SEARCH_PATHS: + logging.debug(f"In {dname}") + if os.path.isfile(os.path.join(dname, lname)): + logging.debug(f"Found {lname} in {dname}") + HOST_DLINK_PATHS +=3D os.path.join( + os.path.join(dname, lname)) + os.pathsep + break + HOST_DLINK_PATHS =3D HOST_DLINK_PATHS.rstrip(os.pathsep) + logging.critical(f"Setting HOST_DLINK_PATHS to {HOST_DLINK_PATHS}"= ) + shell_environment.ShellEnvironment().set_shell_var( + "HOST_DLINK_PATHS", HOST_DLINK_PATHS) diff --git a/EmulatorPkg/README-pytools.md b/EmulatorPkg/README-pytools.md new file mode 100644 index 000000000000..a99b050bfa65 --- /dev/null +++ b/EmulatorPkg/README-pytools.md @@ -0,0 +1,173 @@ +# EmulatorPkg + +This README-pytools.md summarizes the current state of Platform CI for Emu= latorPkg. +It also describes how to _build_ EmulatorPkg using the Pytools build syste= m. +For general documentation on EmulatorPkg, refer to the [local README](./RE= ADME). + +## Platform CI Current Status + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
ConfigBuild & RunNotes
DEBUGRELEASENOOPT
+ Windows VS2019 +
IA32 + + + + + = + + + +
X64 + + + + + + + + +
+ Ubuntu 18.04 GCC5 +
IA32 + + + + + + + + + Run to shell disabled due to SegFault
X64 + + + + + + + + + Run to shell disabled due to SegFault
+ +### Config Details + +| Config | Architectures |Additional Flags | +| :---- | :----- | :---- | +| IA32 | IA32 | None | +| X64 | X64 | None | + +## Setup + +### The Usual EDK2 Build Setup + +- [Download & Install Python 3.x](https://www.python.org/downloads/) +- [Download & Install git](https://git-scm.com/download/) +- [Configure Git for EDK II](https://github.com/tianocore/tianocore.github= .io/wiki/Windows-systems#github-help) +- [Download/Checkout the EDK II source tree from Github](https://github.co= m/tianocore/tianocore.github.io/wiki/Windows-systems#download) + - **NOTE:** Do _not_ follow the EDK II Compile Tools and Build instructi= ons, see below... + +### Install the necessary development packages for your distribution + +This varies by distribution, toolchain, and your configuration but here ar= e a few hints. + +- For building ARCH IA32 on X64 Ubuntu 18.04 LTS these steps where needed. + + ``` bash + sudo dpkg --add-architecture i386 + sudo apt-get update + sudo apt-get install libc6-dev:i386 libx11-dev:i386 libxext-dev:i386 lib= 32gcc-7-dev + ``` + +- For building Basetools and other host applications + + ``` bash + sudo apt-get update + sudo apt-get install gcc g++ make uuid-dev + + ``` + +### Differences from EDK Classic Build Setup + +- Build BaseTools using "`C:\git\edk2>python BaseTools\Edk2ToolsBuild.py [= -t ]`" + - This replaces "`edksetup Rebuild`" from the classic build system + - For Windows `` examples, refer to [Windows ToolChain Mat= rix](https://github.com/tianocore/tianocore.github.io/wiki/Windows-systems-= ToolChain-Matrix), defaults to `VS2017` if not specified +- **No Action:** Submodule initialization and manual installation/setup of= NASM and iASL is **not** required, it is handled by the Pytools build syst= em + +### Install & Configure Pytools for EmulatorPkg + +- Install Pytools + - `pip install --upgrade -r pip-requirements.txt` +- Initialize & Update Submodules + - `stuart_setup -c EmulatorPkg\PlatformBuild.py` +- Initialize & Update Dependencies (e.g. iASL & NASM) + - `stuart_update -c EmulatorPkg\PlatformBuild.py` +- Compile (IA32 or X64 supported) + - `stuart_build -c EmulatorPkg\PlatformBuild.py [TOOL_CHAIN_TAG=3D] -a ` +- Running Emulator + - You can add `--FlashRom` to the end of your build command and the emul= ator will run after the build is complete. + - or use the FlashOnly feature like `stuart_build -c EmulatorPkg\Platfor= mBuild.py [TOOL_CHAIN_TAG=3D] -a --FlashOnly`= to just run the emulator. + +**NOTE:** configuring ACTIVE_PLATFORM and TARGET_ARCH in Conf/target.txt i= s __not__ required. This environment is set by PlatformBuild.py based upon = the `[-a ]` parameter. + +## Custom Build Options + +**MAKE_STARTUP_NSH=3DTRUE** will output a _startup.nsh_ file to the locati= on mapped as fs0. This is used in CI in combination with the --FlashOnly fe= ature to run the emulator to the UEFI shell and then execute the contents o= f startup.nsh. + +## Passing Build Defines + +To pass build defines through stuart*build to the edk2 build, prepend `BLD= _*_` to the define name and pass it on the command-line. stuart_build curre= ntly requires values to be assigned, so add an `=3D1` suffix for bare defin= es. +For example, to enable the IP6 Network Stack, the stuart_build command-lin= e would be: + +`stuart_build -c EmulatorPkg/PlatformBuild.py BLD_*_NETWORK_IP6_ENABLE=3D1= ` + +## References + +- [Installing Pytools](https://github.com/tianocore/edk2-pytool-extensions= /blob/master/docs/using.md#installing) +- For each workspace, consider creating & using a [Python Virtual Environm= ent](https://docs.python.org/3/library/venv.html). For example +- [stuart_build command-line parser](https://github.com/tianocore/edk2-pyt= ool-extensions/blob/56f6a7aee09995c2f22da4765e8b0a29c1cbf5de/edk2toolext/ed= k2_invocable.py#L109) --=20 2.16.3.windows.1