From mboxrd@z Thu Jan 1 00:00:00 1970 Authentication-Results: mx.groups.io; dkim=missing; spf=pass (domain: intel.com, ip: 192.55.52.136, mailfrom: nathaniel.l.desimone@intel.com) Received: from mga12.intel.com (mga12.intel.com [192.55.52.136]) by groups.io with SMTP; Fri, 19 Apr 2019 17:36:03 -0700 X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from orsmga001.jf.intel.com ([10.7.209.18]) by fmsmga106.fm.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 19 Apr 2019 17:36:02 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.60,371,1549958400"; d="scan'208";a="225079224" Received: from orsmsx102.amr.corp.intel.com ([10.22.225.129]) by orsmga001.jf.intel.com with ESMTP; 19 Apr 2019 17:31:02 -0700 Received: from orsmsx162.amr.corp.intel.com (10.22.240.85) by ORSMSX102.amr.corp.intel.com (10.22.225.129) with Microsoft SMTP Server (TLS) id 14.3.408.0; Fri, 19 Apr 2019 17:31:01 -0700 Received: from orsmsx114.amr.corp.intel.com ([169.254.8.50]) by ORSMSX162.amr.corp.intel.com ([169.254.3.253]) with mapi id 14.03.0415.000; Fri, 19 Apr 2019 17:31:02 -0700 From: "Nate DeSimone" To: "devel@edk2.groups.io" , "Agyeman, Prince" CC: "Kubacki, Michael A" , "Sinha, Ankit" , "Kinney, Michael D" , "Oram, Isaac W" , "Gao, Liming" , "Zhou, Bowen" , "Lu, Shifei A" Subject: Re: [edk2-devel] [edk2-platforms/devel-MinPlatform] [PATCH v2 1/3] Platform/Intel: Added python build script. Thread-Topic: [edk2-devel] [edk2-platforms/devel-MinPlatform] [PATCH v2 1/3] Platform/Intel: Added python build script. Thread-Index: AQHU9XC5at/bW6pNUEK2UWNgX9tu4aZEIYdg Date: Sat, 20 Apr 2019 00:31:00 +0000 Message-ID: <02A34F284D1DA44BB705E61F7180EF0AAEA5C865@ORSMSX114.amr.corp.intel.com> References: <255cee7b7b41d6bda52c82144ed0103eabbe06b1.1555538295.git.prince.agyeman@intel.com> In-Reply-To: <255cee7b7b41d6bda52c82144ed0103eabbe06b1.1555538295.git.prince.agyeman@intel.com> Accept-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: dlp-product: dlpe-windows dlp-version: 11.0.600.7 dlp-reaction: no-action x-titus-metadata-40: eyJDYXRlZ29yeUxhYmVscyI6IiIsIk1ldGFkYXRhIjp7Im5zIjoiaHR0cDpcL1wvd3d3LnRpdHVzLmNvbVwvbnNcL0ludGVsMyIsImlkIjoiMDM3MTA3YWYtYzUyMi00NWFiLTgzN2MtYTc0YTY3M2ZkNWJiIiwicHJvcHMiOlt7Im4iOiJDVFBDbGFzc2lmaWNhdGlvbiIsInZhbHMiOlt7InZhbHVlIjoiQ1RQX05UIn1dfV19LCJTdWJqZWN0TGFiZWxzIjpbXSwiVE1DVmVyc2lvbiI6IjE3LjEwLjE4MDQuNDkiLCJUcnVzdGVkTGFiZWxIYXNoIjoiWEVSUkZaMTdEd2ZDcDdab01iRVYwRXZXSzJxSmxTd3VwVjc0bUV5cWcrWW5rUFNQUGFDR3ZnTlB6R1JRd3FtdiJ9 x-ctpclassification: CTP_NT x-originating-ip: [10.22.254.139] MIME-Version: 1.0 Return-Path: nathaniel.l.desimone@intel.com Content-Language: en-US Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable 1. There are PEP8 coding style violations all over. Functions are supposed = to be lower case with underscores, same with variables and module names. Fo= r example: a. BuildBios.py should be build_bios.py b. def preBuild(buildConfig, buildType=3D"DEBUG", silent=3DFalse, toolcha= in=3DNone) should be def pre_build(build_config, build_type=3D"DEBUG", sile= nt=3DFalse, tool_chain=3DNone): c. Read this: https://www.python.org/dev/peps/pep-0008/ 2. Why is the KabyLakeOpenBoardPkg script named BuildEx.py and the PurleyO= penBoardPkg script named BuildBoard.py? Make it consistent... and PEP8 comp= liant! 3. BuildBios.py, Line 29 - This is incorrect. Python 3.x has a module name= d "configparser". Python 2.x has a module named "ConfigParser". There is no= version of Python that ever has a "Configparser" module. What is really ha= ppening is on Python 3.x you are hitting an ImportError on line 29 which th= e except fixes. It is clear you never bothered to test your script on Pytho= n 2.x because you will get a ImportError immediately! Align with the Python= 3 definition. Fix your import to read as follows: try: # python 3 import configparser except ImportError: # python 2.7 import ConfigParser as configparser ...then fix the rest of your code to use "configparser" instead of "Config= Parser". 4. BuildBios.py, Line 76 - os.exit() is wrong. Its supposed to be sys.exit= () 5. BuildBios.py, Line 98 - You have a space between the function name and = the open parenthesis. This is a PEP8 violation. There should be no space. a. The same error is made on the following lines: 186, 236, 258, 269, 270= , 271, 272, 273, 274, 275, and 276. 6. BuildBios.py, Line 99 - exit() is wrong. It's supposed to be sys.exit() a. The same error is made on the following lines: 151, 252, 332, 349, 443= , 752, 848, 891, and 952. 7. BiosBios.py, Line 166 - You have two used variables, out and err, this = is considered bad style. You have this: out, err, result, returnCode =3D executeScript(edk2SetupCmd, But you should be doing this: _, _, result, returnCode =3D executeScript(edk2SetupCmd, a. The same error is made on line 328.=20 8. BuildBios.py, Line 246 - You declare the variable "fd" but you don't ac= tually use it. Why? Just do it this: with open(os.path.join(config["WORKSPACE_FSP_BIN"], config["FSP_BIN_PKG"], "Fsp_Rebased_S_padded.fd"), 'w'): 9. BuildBios.py, Line 310 - You call os.path.join and then assign the valu= e to a variable called "path"... but then you don't use the value of path a= nywhere. Why do this call? Its dead code. 10. BuildBios.py, Line 422 - You don't use the value of "ex" why declare i= t? Just do this: except: a. The same error is made on line 441. 11. BuildBios.py, Line 886 - You call getConfig() but then you don't do an= ything with the output. Why? 12. BuildBios.py, Line 893 - You declare the buildChoices list but then yo= u don't use it. Why? 13. BuildBios.py, Line 955 - Why are you too lazy to define a main() funct= ion? It is not acceptable to put the contents of your main() function in if= __name__ =3D=3D "__main__": 14. Build.cfg, Line 23 - What is this for? WORKSPACE_PLATFORM_BIN =3D WORK= SPACE_PLATFORM_BIN I don't see how this will do anything useful. 15. Please use the new BSD + Patent license instead of just BSD. -----Original Message----- From: devel@edk2.groups.io On Behalf Of Agyeman, Pr= ince Sent: Wednesday, April 17, 2019 3:56 PM To: devel@edk2.groups.io Cc: Kubacki, Michael A ; Desimone, Nathaniel = L ; Sinha, Ankit ; K= inney, Michael D ; Oram, Isaac W ; Gao, Liming ; Zhou, Bowen ; Lu, Shifei A Subject: [edk2-devel] [edk2-platforms/devel-MinPlatform] [PATCH v2 1/3] Pl= atform/Intel: Added python build script. This change allows building all the platforms in Platform/Intel with a single python script. This script works with python 2.7 and python 3.7 Files Added: * BuildBios.py: the main build script build.cfg: contains general/default build settings * ClevoOpenBoardPkg/N1xxWU/buildConfig.cfg: contains N1xxWU specific build settings * KabylakeOpenBoardPkg/KabylakeRvp3/BuildEx.py : contains KabylakeRvp3 custom build script * KabylakeOpenBoardPkg/KabylakeRvp3/buildConfig.cfg: contains KabylakeRvp3 build settings * PurleyOpenBoardPkg/BoardMtOlympus/BuildBoard.py: contains BoardMtOlympus custom build script * PurleyOpenBoardPkg/BoardMtOlympus/buildConfig.cfg: contains BoardMtOlympus custom build settings Cc: Michael Kubacki Cc: Nate DeSimone Cc: Ankit Sinha Cc: Michael D Kinney Cc: Isaac W Oram Cc: Liming Gao Cc: Bowen Zhou Cc: Shifei A Lu Contributed-under: TianoCore Contribution Agreement 0.1 Signed-off-by: Agyeman --- Platform/Intel/Build.cfg | 60 ++ Platform/Intel/BuildBios.py | 990 ++++++++++++++++++ .../ClevoOpenBoardPkg/N1xxWU/BuildConfig.cfg | 40 + .../KabylakeRvp3/BuildConfig.cfg | 27 + .../KabylakeRvp3/BuildEx.py | 72 ++ .../BoardMtOlympus/BuildBoard.py | 177 ++++ .../BoardMtOlympus/BuildConfig.cfg | 44 + 7 files changed, 1410 insertions(+) create mode 100644 Platform/Intel/Build.cfg create mode 100644 Platform/Intel/BuildBios.py create mode 100644 Platform/Intel/ClevoOpenBoardPkg/N1xxWU/BuildConfig.cf= g create mode 100644 Platform/Intel/KabylakeOpenBoardPkg/KabylakeRvp3/Build= Config.cfg create mode 100644 Platform/Intel/KabylakeOpenBoardPkg/KabylakeRvp3/Build= Ex.py create mode 100644 Platform/Intel/PurleyOpenBoardPkg/BoardMtOlympus/Build= Board.py create mode 100644 Platform/Intel/PurleyOpenBoardPkg/BoardMtOlympus/Build= Config.cfg diff --git a/Platform/Intel/Build.cfg b/Platform/Intel/Build.cfg new file mode 100644 index 0000000000..d6584f0448 --- /dev/null +++ b/Platform/Intel/Build.cfg @@ -0,0 +1,60 @@ +# @ Build.cfg +# This is the main/default build configuration file +# +# Copyright (c) 2019, Intel Corporation. All rights reserved.
+# This program and the accompanying materials are +# licensed and made available under the terms and +# conditions of the BSD License that accompanies this distribution. +# The full text of the license may be found at +# http://opensource.org/licenses/bsd-license.php. +# +# THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, +# WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, +# EITHER EXPRESS OR IMPLIED. +# + +[DEFAULT_CONFIG] + WORKSPACE =3D + WORKSPACE_FSP_BIN =3D FSP + EDK_TOOLS_BIN =3D edk2-BaseTools-win32 + EDK_BASETOOLS =3D BaseTools + WORKSPACE_PLATFORM =3D edk2-platforms/Platform/Intel + WORKSPACE_SILICON =3D edk2-platforms/Silicon/Intel + WORKSPACE_PLATFORM_BIN =3D WORKSPACE_PLATFORM_BIN + WORKSPACE_SILICON_BIN =3D edk2-non-osi/Silicon/Intel + MIN_PACKAGE_TOOLS =3D edk2-platforms/Platform/Intel/MinPlatformPkg/To= ols + PACKAGES_PATH =3D + EDK_SETUP_OPTION =3D + BASE_TOOLS_PATH =3D edk2/BaseTools + EDK_TOOLS_PATH =3D edk2/BaseTools + openssl_path =3D + PLATFORM_BOARD_PACKAGE =3D KabylakeOpenBoardPkg + BIOS_SIZE_OPTION =3D -DBIOS_SIZE_OPTION=3DSIZE_70 + WORKSPACE_CORE =3D edk2 + EFI_SOURCE =3D edk2 + PATHEXT =3D .COM;.EXE;.BAT;.CMD;.VBS;.JS;.WS;.MSC + PROMPT =3D $P$G + PLATFORM_PACKAGE =3D MinPlatformPkg + BOARD =3D KabylakeRvp3 + PrepRELEASE =3D DEBUG + SILENT_MODE =3D FALSE + EXT_CONFIG_CLEAR =3D + CapsuleBuild =3D FALSE + EXT_BUILD_FLAGS =3D + CAPSULE_BUILD =3D 0 + TARGET =3D DEBUG + TARGET_SHORT =3D D + PERFORMANCE_BUILD =3D FALSE + FSP_WRAPPER_BUILD =3D TRUE + FSP_BIN_PKG =3D KabylakeFspBinPkg + FSP_BINARY_BUILD =3D FALSE + FSP_TEST_RELEASE =3D FALSE + SECURE_BOOT_ENABLE =3D FALSE + REBUILD_MODE =3D + BUILD_ROM_ONLY =3D + NUMBER_OF_PROCESSORS =3D 1 + +[PLATFORMS] + KabylakeRvp3 =3D KabylakeOpenBoardPkg/KabylakeRvp3/BuildConfig.cfg + N1xxWU =3D ClevoOpenBoardPkg/N1xxWU/BuildConfig.cfg + BoardMtOlympus =3D PurleyOpenBoardPkg/BoardMtOlympus/BuildConfig.cfg diff --git a/Platform/Intel/BuildBios.py b/Platform/Intel/BuildBios.py new file mode 100644 index 0000000000..aa663a1c27 --- /dev/null +++ b/Platform/Intel/BuildBios.py @@ -0,0 +1,990 @@ +# @ BuildBios.py +# Builds BIOS using configuration files and dynamically +# imported functions from board directory +# +# Copyright (c) 2019, Intel Corporation. All rights reserved.
+# +# This program and the accompanying materials are licensed and made +# available under the terms and conditions of the BSD License which +# accompanies this distribution. The full text of the license may be +# found at http://opensource.org/licenses/bsd-license.php +# +# THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" +# BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER +# EXPRESS OR IMPLIED. + +import os +import re +import sys +import json +import stat +import signal +import shutil +import argparse +import subprocess +from importlib import import_module + +try: + # python 3 + import Configparser +except ImportError: + # python 2.7 + import configparser as Configparser + + +def preBuild(buildConfig, buildType=3D"DEBUG", silent=3DFalse, toolchain= =3DNone): + """Sets the environment variables that shall be used for the build + + :param buildConfig: The build configuration as defined in the JOS= N + configuration files + :type buildConfig: Dictionary + :param buildType: The build target, DEBUG, RELEASE, RELEASE_PDB, + TEST_RELEASE + :type buildType: String + :param silent: Enables build in silent mode + :type silent: Boolean + :param toolchain: Specifies the tool chain tag to use for the bui= ld + :type toolchain: String + :returns: The updated environment variables + :rtype: Dictionary + """ + + # get current environment variables + config =3D os.environ.copy() + + # patch the config + buildConfig =3D patchConfig(buildConfig) + + # make sure all values are strings + config.update(buildConfig) + + # make the config python 2.7 compartible + config =3D py27Fix(config) + + # Set WORKSPACE environment. + config["WORKSPACE"] =3D os.path.abspath(os.path.join("..", "..", ".."= , "")) + print("Set WORKSPACE as: {}".format(config["WORKSPACE"])) + + # Check whether Git has been installed and been added to system path. + try: + subprocess.Popen(["git", "--help"], stdout=3Dsubprocess.PIPE) + except OSError as error: + if error.errno =3D=3D os.errno.ENOENT: + print("The 'git' command is not recognized.") + print("Please make sure that Git is installed\ + and has been added to system path.") + os.exit(1) + + # Create the Conf directory under WORKSPACE + if not os.path.isdir(os.path.join(config["WORKSPACE"], "Conf")): + try: + # create directory + os.makedirs(os.path.join(config["WORKSPACE"], "Conf")) + # copy files to it + configTemplatePath =3D os.path.join(config["WORKSPACE"], + config["BASE_TOOLS_PATH"], + "Conf") + configPath =3D os.path.join(config["WORKSPACE"], "Conf") + shutil.copyfile(configTemplatePath + + os.sep + "target.template", + configPath + os.sep + "target.txt") + shutil.copyfile(configTemplatePath + + os.sep + "tools_def.template", + configPath + os.sep + "tools_def.txt") + shutil.copyfile(configTemplatePath + + os.sep + "build_rule.template", + configPath + os.sep + "build_rule.txt") + except OSError: + print ("Error while creating Conf") + exit(1) + + # Set other environments. + # Basic Rule: + # Platform override Silicon override Core + # Source override Binary + config["WORKSPACE_PLATFORM"] =3D os.path.join(config["WORKSPACE"], + config["WORKSPACE_PLATFOR= M"]) + config["WORKSPACE_SILICON"] =3D os.path.join(config["WORKSPACE"], + config["WORKSPACE_SILICON"= ]) + config["WORKSPACE_PLATFORM_BIN"] =3D \ + os.path.join(config["WORKSPACE"], config["WORKSPACE_PLATFORM_BIN"= ]) + config["WORKSPACE_SILICON_BIN"] =3D \ + os.path.join(config["WORKSPACE"], config["WORKSPACE_SILICON_BIN"]= ) + config["WORKSPACE_FSP_BIN"] =3D os.path.join(config["WORKSPACE"], + config["WORKSPACE_FSP_BIN"= ]) + + # add to package path + pathSep =3D ";" + config["EDK_SETUP_OPTION"] =3D "--nt32" + if os.name =3D=3D "posix": + pathSep =3D ":" + config["EDK_SETUP_OPTION"] =3D " " + + config["PACKAGES_PATH"] =3D config["WORKSPACE_PLATFORM"] + config["PACKAGES_PATH"] +=3D pathSep + config["WORKSPACE_SILICON"] + config["PACKAGES_PATH"] +=3D pathSep + config["WORKSPACE_SILICON_BIN"= ] + config["PACKAGES_PATH"] +=3D pathSep + \ + os.path.join(config["WORKSPACE"], "FSP") + config["PACKAGES_PATH"] +=3D pathSep + \ + os.path.join(config["WORKSPACE"], "edk2") + config["PACKAGES_PATH"] +=3D pathSep + os.path.join(config["WORKSPACE= "]) + config["EDK_TOOLS_PATH"] =3D os.path.join(config["WORKSPACE"], + config["EDK_TOOLS_PATH"]) + config["BASE_TOOLS_PATH"] =3D config["EDK_TOOLS_PATH"] + config["EDK_TOOLS_BIN"] =3D os.path.join(config["WORKSPACE"], + config["EDK_TOOLS_BIN"]) + config["PLATFORM_FSP_BIN_PACKAGE"] =3D \ + os.path.join(config['WORKSPACE_FSP_BIN'], config['FSP_BIN_PKG']) + config['PROJECT_DSC'] =3D os.path.join(config["WORKSPACE_PLATFORM"], + config['PROJECT_DSC']) + config['BOARD_PKG_PCD_DSC'] =3D os.path.join(config["WORKSPACE_PLATFO= RM"], + config['BOARD_PKG_PCD_DSC'= ]) + config["CONF_PATH"] =3D os.path.join(config["WORKSPACE"], "Conf") + + # get the python path + if os.environ.get("PYTHON_HOME") is None: + config["PYTHON_HOME"] =3D None + if os.environ.get("PYTHONPATH") is not None: + config["PYTHON_HOME"] =3D os.environ.get("PYTHONPATH") + else: + print("PYTHONPATH environment variable is not found") + exit(1) + + # if python is installed, disable the binary base tools. + if config.get("PYTHON_HOME") is not None: + if config.get("EDK_TOOLS_BIN") is not None: + del config["EDK_TOOLS_BIN"] + + # Run edk setup and update config + edk2SetupCmd =3D [os.path.join(config["EFI_SOURCE"], "edksetup")] + if os.name =3D=3D "nt": + + if config.get("EDK_SETUP_OPTION") and \ + config["EDK_SETUP_OPTION"] !=3D " ": + edk2SetupCmd.append(config["EDK_SETUP_OPTION"]) + + out, err, result, returnCode =3D executeScript(edk2SetupCmd, + config, + collectEnv=3DTrue, + shell=3DTrue) + if result is not None and type(result) is dict: + config.update(result) + + # if python is installed, nmake BaseTools source + # and enable BaseTools source build + command =3D ["nmake", "-f", os.path.join(config["BASE_TOOLS_PATH"], + "Makefile")] + if os.name =3D=3D "posix": # linux + command =3D ["make", "-C", os.path.join(config["BASE_TOOLS_PATH"]= )] + + out, err, result, returnCode =3D executeScript(command, config, shell= = =3DTrue) + if returnCode is not 0: + buildFailed(config) + + config["SILENT_MODE"] =3D 'TRUE' if silent else 'FALSE' + + print ("=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D") + + if os.path.isfile(os.path.join(config['WORKSPACE'], "Prep.log")): + os.remove(os.path.join(config['WORKSPACE'], "Prep.log")) + + config["PROJECT"] =3D os.path.join(config["PLATFORM_BOARD_PACKAGE"], + config["BOARD"]) + + # + # Setup Build + # + if toolchain is not None: + config["TOOL_CHAIN_TAG"] =3D toolchain + elif config.get("TOOL_CHAIN_TAG") is None: + if os.name =3D=3D 'nt': + config["TOOL_CHAIN_TAG"] =3D "VS2015" + else: + config["TOOL_CHAIN_TAG"] =3D "GCC5" + + # echo Show CL revision + config["PrepRELEASE"] =3D buildType + + if buildType =3D=3D "DEBUG": + config["TARGET"] =3D 'DEBUG' + config["TARGET_SHORT"] =3D 'D' + else: + config["TARGET"] =3D 'RELEASE' + config["TARGET_SHORT"] =3D 'R' + + # set BUILD_DIR_PATH path + config["BUILD_DIR_PATH"] =3D os.path.join(config["WORKSPACE"], + 'Build', + config["PROJECT"], + "{}_{}".format( + config["TARGET"], + config["TOOL_CHAIN_TA= G"])) + # set BUILD_DIR path + config["BUILD_DIR"] =3D os.path.join('Build', + config["PROJECT"], + "{}_{}".format( + config["TARGET"], + config["TOOL_CHAIN_TA= G"])) + + config["BUILD_X64"] =3D os.path.join(config["BUILD_DIR_PATH"], 'X64') + config["BUILD_IA32"] =3D os.path.join(config["BUILD_DIR_PATH"], 'IA32= ') + + if not os.path.isdir(config["BUILD_DIR_PATH"]): + try: + os.makedirs(config["BUILD_DIR_PATH"]) + except OSError: + print ("Error while creating Build folder") + + # + # Set FSP_WRAPPER_BUILD + # + if config['FSP_WRAPPER_BUILD'] =3D=3D "TRUE": + # Create dummy Fsp_Rebased_S_padded.fd to build the BiosInfo.inf + # if it is wrapper build, due to the SECTION inclusion + with open(os.path.join(config["WORKSPACE_FSP_BIN"], + config["FSP_BIN_PKG"], + "Fsp_Rebased_S_padded.fd"), 'w') as fd: + pass # fd.write("") + + if config["FSP_BINARY_BUILD"] =3D=3D "TRUE": + if config['FSP_WRAPPER_BUILD'] =3D=3D 'FALSE': + # EndPreBuild TODO return ? + exit(0) + + if not os.path.isdir(config["BUILD_X64"]): + try: + os.mkdir(config["BUILD_X64"]) + except OSError: + print ("Error while creating {}".format(config["BUILD_X64"])) + + # update config file with changes + updateTargetFile(config) + + # Additional pre build scripts for this platform + result =3D preBuildEx(config) + if result is not None and type(result) is dict: + config.update(result) + + # print user settings + print ("BIOS_SIZE_OPTION =3D {}".format(config["BIOS_SIZE_OPTION"= ])) + print ("EFI_SOURCE =3D {}".format(config["EFI_SOURCE"])) + print ("TARGET =3D {}".format(config["TARGET"])) + print ("TARGET_ARCH =3D {}".format("IA32 X64")) + print ("TOOL_CHAIN_TAG =3D {}".format(config["TOOL_CHAIN_TAG"])= ) + print ("WORKSPACE =3D {}".format(config["WORKSPACE"])) + print ("WORKSPACE_CORE =3D {}".format(config["WORKSPACE_CORE"])= ) + print ("EXT_BUILD_FLAGS =3D {}".format(config["EXT_BUILD_FLAGS"]= )) + + return config + + +def build(config): + """Builds the BIOS image + + :param config: The environment variables to be used + in the build process + :type config: Dictionary + :returns: nothing + """ + # # + # # Build FSP Binary + # # + if config.get("FSP_BINARY_BUILD") and \ + config["FSP_BINARY_BUILD"] =3D=3D 'TRUE': + config["FSP_BUILD_PARAMETER"] =3D "/d" + if config["TARGET"] =3D=3D "RELEASE": + config["FSP_BUILD_PARAMETER"] =3D "/tr" + else: + config["FSP_BUILD_PARAMETER"] =3D "/r" + + # @if %FSP_WRAPPER_BUILD% EQU FALSE goto :BldEnd TODO + + if config["FSP_WRAPPER_BUILD"] =3D=3D "TRUE": + pattern =3D "Fsp_Rebased.*\\.fd$" + file_dir =3D os.path.join(config['WORKSPACE_FSP_BIN'], + config['FSP_BIN_PKG']) + for item in os.listdir(file_dir): + if re.search(pattern, item): + os.remove(os.path.join(file_dir, item)) + + path =3D os.path.join(config['WORKSPACE_PLATFORM'], + config['PROJECT'], config['BOARD_PKG_PCD_DSC'= ]) + + command =3D [os.path.join(config['PYTHON_HOME'], "python"), + os.path.join(config['WORKSPACE_PLATFORM'], + config['PLATFORM_PACKAGE'], + 'Tools', 'Fsp', + 'RebaseAndPatchFspBinBaseAddress.py'), + os.path.join(config['WORKSPACE_PLATFORM'], + config['FLASH_MAP_FDF']), + os.path.join(config['WORKSPACE_FSP_BIN'], + config['FSP_BIN_PKG']), + "Fsp.fd", + os.path.join(config['WORKSPACE_PLATFORM'], + config['PROJECT'], + config['BOARD_PKG_PCD_DSC']), + "0x0"] + + out, err, result, returnCode =3D executeScript(command, config) + + if returnCode !=3D 0: + print("!!! ERROR:RebaseAndPatchFspBinBaseAddress failed!!!") + exit(returnCode) + + # create Fsp_Rebased.fd which is Fsp_Rebased_S.fd + + # Fsp_Rebased_M + Fsp_Rebased_T + with open(os.path.join(file_dir, "Fsp_Rebased_S.fd"), 'rb') as fs= p_S, \ + open(os.path.join(file_dir, + "Fsp_Rebased_M.fd"), 'rb') as fsp_M, \ + open(os.path.join(file_dir, + "Fsp_Rebased_T.fd"), 'rb') as fsp_T: + + fsp_rebased =3D fsp_S.read() + fsp_M.read() + fsp_T.read() + with open(os.path.join(file_dir, + "Fsp_Rebased.fd"), 'wb') as new_fsp: + new_fsp.write(fsp_rebased) + + if not os.path.isfile(os.path.join(file_dir, "Fsp_Rebased.fd")): + print("!!! ERROR:failed to create fsp!!!") + exit(1) + + # Output the build variables the user has selected. + print("=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D") + print(" User Selected build options:") + print(" SILENT_MODE =3D ", config["SILENT_MODE"]) + print(" REBUILD_MODE =3D ", config["REBUILD_MODE"]) + print(" BUILD_ROM_ONLY =3D ", config["BUILD_ROM_ONLY"]) + print("=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D") + + command =3D ["build", "-n", config["NUMBER_OF_PROCESSORS"]] + + if config["REBUILD_MODE"] and config["REBUILD_MODE"] !=3D "": + command.append(config["REBUILD_MODE"]) + + if config["EXT_BUILD_FLAGS"] and config["EXT_BUILD_FLAGS"] !=3D "": + command.append(config["EXT_BUILD_FLAGS"]) + + if config.get("SILENT_MODE", "FALSE") =3D=3D "TRUE": + command.append("--silent") + command.append("--quiet") + + else: + command.append("--log=3D" + config.get("BUILD_LOG", "Build.log")) + command.append("--report-file=3D" + + config.get("BUILD_REPORT", "BuildReport.log")) + + if config.get("VERBOSE", "FALSE") =3D=3D "TRUE": + command.append("--verbose") + + if config.get("MAX_SOCKET") is not None: + command.append("-D") + command.append("MAX_SOCKET=3D" + config["MAX_SOCKET"]) + + out, err, result, exitCode =3D executeScript(command, config) + if exitCode !=3D 0: + buildFailed(config) + + # Additional build scripts for this platform + result =3D buildEx(config) + if result is not None and type(result) is dict: + config.update(result) + + return config + + +def postBuild(config): + """Post build process of BIOS image + + :param config: The environment variables to be used in the build proc= ess + :type config: Dictionary + :returns: nothing + """ + print("Running postbuild to complete the build process.") + + # Additional build scripts for this platform + result =3D postBuildEx(config) + if result is not None and type(result) is dict: + config.update(result) + + # cleanup + pattern =3D "Fsp_Rebased.*\\.fd$" + file_dir =3D os.path.join(config['WORKSPACE_FSP_BIN'], + config['FSP_BIN_PKG']) + for item in os.listdir(file_dir): + if re.search(pattern, item): + os.remove(os.path.join(file_dir, item)) + + if config.get("DYNAMIC_BUILD_INIT_FILES") is not None: + for item in config["DYNAMIC_BUILD_INIT_FILES"].split(","): + try: + os.remove(item) # remove __init__.py + os.remove(item + "c") # remove __init__.pyc as well + except Exception as ex: + pass + + +def buildFailed(config): + """Displays results when build fails + + :param config: The environment variables used in the build proces= s + :type config: Dictionary + :returns: nothing + """ + print(" The EDKII BIOS Build has failed!") + # clean up + if config.get("DYNAMIC_BUILD_INIT_FILES") is not None: + for item in config["DYNAMIC_BUILD_INIT_FILES"].split(","): + if os.path.isfile(item): + try: + os.remove(item) # remove __init__.py + os.remove(item + "c") # remove __init__.pyc as well + except Exception as ex: + pass + exit(1) + + +def importPlatformLib(path, function): + """Imports custom functions for the platforms being built + + :param path: the location of the custom build script to be execut= ed + :type path: String + :param path: the function to be executed + :type path: String + :returns: nothing + """ + if path.endswith(".py"): + path =3D path[:-3] + path =3D path.replace("\\\\", os.sep).replace(os.sep, ".") + module =3D import_module(path) + lib =3D getattr(module, function) + return lib + + +def preBuildEx(config): + """ An extension of the prebuild process as defined platform + specific prebuild setup script + + :param config: The environment variables used in the pre build pr= ocess + :type config: Dictionary + :returns: config dictionary + :rtype: Dictionary + """ + if config.get("ADDITIONAL_SCRIPTS"): + try: + platformFunction =3D importPlatformLib(config["ADDITIONAL_SCR= IPTS"], + "preBuildEx") + functions =3D {"executeScript": executeScript} + return platformFunction(config, functions) + except Exception as e: + print(config["ADDITIONAL_SCRIPTS"], str(e)) + buildFailed(config) + return None + + +def buildEx(config): + """ An extension of the build process as defined platform + specific build setup script + + :param config: The environment variables used in the build proces= s + :type config: Dictionary + :returns: config dictionary + :rtype: Dictionary + """ + if config.get("ADDITIONAL_SCRIPTS"): + try: + platformFunction =3D importPlatformLib(config["ADDITIONAL_SCR= IPTS"], + "buildEx") + functions =3D {"executeScript": executeScript} + return platformFunction(config, functions) + except Exception as e: + print("error", config["ADDITIONAL_SCRIPTS"], str(e)) + buildFailed(config) + return None + + +def postBuildEx(config): + """ An extension of the post build process as defined platform + specific build setup script + + :param config: The environment variables used in the post build + process + :type config: Dictionary + :returns: config dictionary + :rtype: Dictionary + """ + if config.get("ADDITIONAL_SCRIPTS"): + try: + platformFunction =3D importPlatformLib(config["ADDITIONAL_SCR= IPTS"], + "postBuildEx") + functions =3D {"executeScript": executeScript} + return platformFunction(config, functions) + except Exception as e: + print(config["ADDITIONAL_SCRIPTS"], str(e)) + buildFailed(config) + return None + + +def cleanEx(config): + """ An extension of the platform cleanning + + :param config: The environment variables used in the clean proces= s + :type config: Dictionary + :returns: config dictionary + :rtype: Dictionary + """ + if config.get("ADDITIONAL_SCRIPTS"): + try: + platformFunction =3D importPlatformLib(config["ADDITIONAL_SCR= IPTS"], + "cleanEx") + functions =3D {"executeScript": executeScript} + return platformFunction(config, functions) + except Exception as e: + print(config["ADDITIONAL_SCRIPTS"], str(e)) + buildFailed(config) + return None + + +def getEnvironmentVariables(stdoutStr, marker): + """Gets the environment variables from a process + + :param stdoutStr: The stdout pipe + :type stdoutStr: String + :param marker: A begining and end mark of environment + variables printed to stdout + :type marker: String + :returns: The environment variables read from the process' stdout= pipe + :rtype: Tuple + """ + startEnvUpdate =3D False + environmentVars =3D {} + outPut =3D "" + for line in stdoutStr.split("\n"): + if startEnvUpdate and len(line.split("=3D")) =3D=3D 2: + key, value =3D line.split("=3D") + environmentVars[key] =3D value + else: + outPut +=3D "\n" + line.replace(marker, "") + + if marker in line: + if startEnvUpdate: + startEnvUpdate =3D False + else: + startEnvUpdate =3D True + return (outPut, environmentVars) + + +def executeScript(command, envVariables, collectEnv=3DFalse, + enableStdPipe=3DFalse, shell=3DTrue): + """launches a process that executes a script/shell command passed to = it + + :param command: The command/script with its commandline + arguments to be executed + :type command: List:String + :param envVariables: Environment variables passed to the process + :type envVariables: String + :param collectEnv: Enables the collection of evironment variables + when process execution is done + :type collectEnv: Boolean + :param enableStdPipe: Enables process out to be piped to + :type enableStdPipe: String + :returns: a tuple of stdout, stderr , environment variables, + return code + :rtype: Tuple: (stdout, stderr , enVar, returnCode) + """ + + print("Calling " + " ".join(command)) + + envMarker =3D '-----env-----' + env =3D {} + kwarg =3D {"env": envVariables, + "universal_newlines": True, + "shell": shell, + "cwd": envVariables["WORKSPACE"]} + + if enableStdPipe or collectEnv: + kwarg["stdout"] =3D subprocess.PIPE + kwarg["stderr"] =3D subprocess.PIPE + + # collect environment variables + if collectEnv: + # get the binary that prints environment variables based on os + if os.name =3D=3D 'nt': + getVarCommand =3D "set" + else: + getVarCommand =3D "env" + # modify the command to print the environment variables + if type(command) =3D=3D list: + command +=3D ["&&", "echo", envMarker, "&&", + getVarCommand, "&&", "echo", envMarker] + else: + command +=3D " " + " ".join(["&&", "echo", envMarker, + "&&", getVarCommand, + "&&", "echo", envMarker]) + + # execute the command + execute =3D subprocess.Popen(command, **kwarg) + stdout, stderr =3D execute.communicate() + code =3D execute.returncode + + # wait for process to be done + execute.wait() + + # if collect enviroment variables + if collectEnv: + # get the new environment variables + stdout, env =3D getEnvironmentVariables(stdout, envMarker) + return (stdout, stderr, env, code) + + +def patchConfig(config): + """ An extension of the platform cleanning + + :param config: The environment variables used in the build proces= s + :type config: Dictionary + :returns: config dictionary + :rtype: Dictionary + """ + newconfig =3D {} + for key in config: + newconfig[str(key)] =3D str(config[key].replace("/", os.sep)) + return newconfig + + +def py27Fix(config): + """ Prepares build for python 2.7 =3D> build + :param config: The environment variables used in the build proces= s + :type config: Dictionary + :returns: config dictionary + :rtype: Dictionary + """ + if not (sys.version_info > (3, 0)): + pathList =3D [] + # create __init__.py in directories in this path + if config.get("ADDITIONAL_SCRIPTS"): + # get the directory + pathToDirectory =3D os.path.dirname(config.get("ADDITIONAL_SC= RIPTS")) + path =3D "" + for directories in pathToDirectory.split(os.sep): + path +=3D directories + os.sep + initFile =3D path + os.sep + "__init__.py" + if not os.path.isfile(initFile): + open(initFile, 'w').close() + pathList.append(initFile) + config["DYNAMIC_BUILD_INIT_FILES"] =3D ",".join(pathList) + + return config + + +def clean(buildConfig, platform=3D""): + """Cleans the build workspace + + :param config: The environment variables used in the build proces= s + :type config: Dictionary + :param platform: The platform to clean + :type platform: String + :returns: nothing + """ + print(" Run build cleanall...") + + # patch the config + buildConfig =3D patchConfig(buildConfig) + + # get current environment variables + config =3D os.environ.copy() + + # update it with the build variables + config.update(buildConfig) + + if not config.get('WORKSPACE') and \ + config.get('WORKSPACE') !=3D "": + config["WORKSPACE"] =3D os.path.abspath(os.path.join("..", "..", + "..", "")) + + config["WORKSPACE_PLATFORM"] =3D os.path.join(config["WORKSPACE"], + config["WORKSPACE_PLATFOR= M"]) + config["WORKSPACE_SILICON"] =3D os.path.join(config["WORKSPACE"], + config["WORKSPACE_SILICON"= ]) + + # build cleanall + print("Directories to clean...") + + if os.path.isdir(os.path.join(config['WORKSPACE'], "Build", platform)= ): + shutil.rmtree(os.path.join(config['WORKSPACE'], "Build", platform= )) + + if os.path.isdir(os.path.join(config['WORKSPACE'], "conf", ".cache"))= : + shutil.rmtree(os.path.join(config['WORKSPACE'], "conf", ".cache")= ) + + print("Cleaning files...") + + if os.path.isfile(os.path.join(config['WORKSPACE'], "edk2.log")): + print("Removing ", os.path.join(config['WORKSPACE'], "edk2.log")) + os.remove(os.path.join(config['WORKSPACE'], "edk2.log")) + + if os.path.isfile(os.path.join(config['WORKSPACE'], "Conf", + "build_rule.txt")): + print("Removing ", os.path.join(config['WORKSPACE'], "Conf", + "build_rule.txt")) + os.remove(os.path.join(config['WORKSPACE'], "Conf", + "build_rule.txt")) + + if os.path.isfile(os.path.join(config['WORKSPACE'], "Conf", + "FrameworkDatabase.db")): + print("Removing ", os.path.join(config['WORKSPACE'], "Conf", + "FrameworkDatabase.db")) + os.remove(os.path.join(config['WORKSPACE'], "Conf", + "FrameworkDatabase.db")) + + if os.path.isfile(os.path.join(config['WORKSPACE'], "Conf", + "target.txt")): + print("Removing ", os.path.join(config['WORKSPACE'], "Conf", + "target.txt")) + os.remove(os.path.join(config['WORKSPACE'], "Conf", "target.txt")= ) + + if os.path.isfile(os.path.join(config['WORKSPACE'], "Conf", + "tools_def.txt")): + print("Removing ", os.path.join(config['WORKSPACE'], "Conf", + "tools_def.txt")) + os.remove(os.path.join(config['WORKSPACE'], "Conf", + "tools_def.txt")) + + print(" All done...") + + exit(0) + + +def updateTargetFile(config): + """Updates Conf's target file that will be used in the build + + :param config: The environment variables used in the build proces= s + :type config: Dictionary + :returns: True if update was successful and False if update fails + :rtype: Boolean + """ + contents =3D None + result =3D False + with open(os.path.join(config["CONF_PATH"], "target.txt"), 'r') as ta= rget: + contents =3D target.readlines() + optionsList =3D ['ACTIVE_PLATFORM', 'TARGET', + 'TARGET_ARCH', 'TOOL_CHAIN_TAG', 'BUILD_RULE_CONF'= ] + modified =3D [] + + # remove these options from the config file + for line in contents: + if '#' !=3D line.replace(" ", "")[0] and\ + any(opt in line for opt in optionsList): + continue + modified.append(line) + + # replace with config options provided + string =3D "{} =3D {}\n".format("ACTIVE_PLATFORM", + os.path.join( + config['WORKSPACE_PLATFORM'], + config['PLATFORM_BOARD_PACKAGE'], + config['BOARD'], + config['PROJECT_DSC'])) + modified.append(string) + + string =3D "{} =3D {}\n".format("TARGET", config['TARGET']) + modified.append(string) + + string =3D "TARGET_ARCH =3D IA32 X64\n" + modified.append(string) + + string =3D "{} =3D {}\n".format("TOOL_CHAIN_TAG", config['TOOL_CH= AIN_TAG']) + modified.append(string) + + string =3D "{} =3D {}\n".format("BUILD_RULE_CONF", + os.path.join("Conf", "build_rule.txt"= )) + modified.append(string) + + if modified is not None: + with open(os.path.join(config["WORKSPACE"], + "Conf", "target.txt"), 'w') as target: + for line in modified: + target.write(line) + result =3D True + + return result + + +def getConfig(): + """Reads the default projects config file + + :returns: The config defined in the the Build.cfg file + :rtype: Dictionary + """ + configFile =3D Configparser.RawConfigParser() + configFile.optionxform =3D str + configFile.read('Build.cfg', encoding=3D'utf-8') + configDictionary =3D {} + for section in configFile.sections(): + dictionary =3D dict(configFile.items(section)) + configDictionary[section] =3D dictionary + return configDictionary + + +def getPlatformConfig(platformName, configData): + """ Reads the platform specifig config file + + param platformName: The name of the platform to be built + :type platformName: String + param configData: The environment variables to be + used in the build process + :type configData: Dictionary + :returns: The config defined in the the Build.cfg file + :rtype: Dictionary + """ + config =3D {} + platformData =3D configData.get("PLATFORMS") + try: + path =3D platformData.get(platformName) + configFile =3D Configparser.RawConfigParser() + configFile.optionxform =3D str + configFile.read(path) + for section in configFile.sections(): + config[section] =3D dict(configFile.items(section)) + except Exception as e: + print("getPlatformConfig: " + str(e)) + exit(1) + return config + + +def getCmdConfigArguments(arguments): + """Get commandline config arguments + + param arguments: The environment variables to be used in the build pr= ocess + :type arguments: argparse + :returns: The config dictionary built from the commandline arguments + :rtype: Dictionary + """ + result =3D {} + if arguments.capsule is True: + result["CAPSULE_BUILD"] =3D "1" + + if arguments.performance is True: + result["PERFORMANCE_BUILD"] =3D "TRUE" + + if arguments.fsp is True: + result["FSP_WRAPPER_BUILD"] =3D "TRUE" + + return result + + +def getCmdArguments(buildConfig): + """ Get commandline inputs from user + + param configData: The environment variables to be + used in the build process + :type configData: Dictionary + :returns: The commandline arguments input by the user + :rtype: argparse object + """ + + # this is an argparse action that lists the available platforms + class printPlatforms(argparse.Action): + def __call__(self, parser, namespace, values, option_string=3DNon= e): + config =3D getConfig() + print("Platforms:") + for key in buildConfig.get("PLATFORMS"): + print(" " + key) + setattr(namespace, self.dest, values) + exit(0) + + buildChoices =3D ['DEBUG', 'RELEASE', 'TEST_RELEASE', 'RELEASE_PDB'] + # get the build commands + Parser =3D argparse.ArgumentParser(description=3D"Build Help") + Parser.add_argument('--platform', '-p', dest=3D"platform", + help=3D'the platform to build', + choices=3DbuildConfig.get("PLATFORMS"), + required=3D('-l' not in sys.argv and + '--cleanall' not in sys.argv)) + + Parser.add_argument('--toolchain', '-t', dest=3D"toolchain", + help=3D"using the Tool Chain Tagname to build \ + the platform,overriding \ + target.txt's TOOL_CHAIN_TAG definition") + + Parser.add_argument("--DEBUG", '-d', help=3D"debug flag", + action=3D'store_const', dest=3D"target", + const=3D"DEBUG", default=3D"DEBUG") + + Parser.add_argument("--RELEASE", '-r', help=3D"release flag", + action=3D'store_const', + dest=3D"target", const=3D"RELEASE") + + Parser.add_argument("--TEST_RELEASE", '-tr', help=3D"test Release fla= g", + action=3D'store_const', + dest=3D"target", const=3D"TEST_RELEASE") + + Parser.add_argument("--RELEASE_PDB", '-rp', help=3D"release flag", + action=3D'store_const', dest=3D"target", + const=3D"RELEASE_PDB") + + Parser.add_argument('--list', '-l', action=3DprintPlatforms, + help=3D'lists available platforms', nargs=3D0) + + Parser.add_argument('--cleanall', dest=3D'cleanall', + help=3D'cleans all', action=3D'store_true') + + Parser.add_argument("--capsule", help=3D"capsule build enabled", + action=3D'store_true', dest=3D"capsule") + + Parser.add_argument("--silent", help=3D"silent build enabled", + action=3D'store_true', dest=3D"silent") + + Parser.add_argument("--performance", help=3D"performance build enable= d", + action=3D'store_true', dest=3D"performance") + + Parser.add_argument("--fsp", help=3D"fsp build enabled", + action=3D'store_true', dest=3D"fsp") + + return Parser.parse_args() + + +def keyboardInterruption(signal, frame): + """ Catches a keyboard interruption handler + + param signal: The signal this handler is called with + :type configData: Signal + :rtype: nothing + """ + print("Quiting...") + exit(0) + + +if __name__ =3D=3D "__main__": + + # to quit the build + signal.signal(signal.SIGINT, keyboardInterruption) + + # get general build configurations + buildConfig =3D getConfig() + + # get commandline parameters + arguments =3D getCmdArguments(buildConfig) + + if arguments.cleanall: + clean(buildConfig.get("DEFAULT_CONFIG")) + + # get platform specific config + platform_config =3D getPlatformConfig(arguments.platform, buildConfig= ) + + # update general build config with platform specific config + config =3D buildConfig.get("DEFAULT_CONFIG") + config.update(platform_config.get("CONFIG")) + + # Override config with cmd arguments + cmdConfigArgs =3D getCmdConfigArguments(arguments) + config.update(cmdConfigArgs) + + # get prebuild configurations + config =3D preBuild(config, + buildType=3Darguments.target, + toolchain=3Darguments.toolchain, + silent=3Darguments.silent) + + # build selected platform + config =3D build(config) + + # post build + postBuild(config) diff --git a/Platform/Intel/ClevoOpenBoardPkg/N1xxWU/BuildConfig.cfg b/Pla= tform/Intel/ClevoOpenBoardPkg/N1xxWU/BuildConfig.cfg new file mode 100644 index 0000000000..775cf5c838 --- /dev/null +++ b/Platform/Intel/ClevoOpenBoardPkg/N1xxWU/BuildConfig.cfg @@ -0,0 +1,40 @@ +# @ BuildConfig.cfg +# This is the main/default build configuration file +# +# Copyright (c) 2019, Intel Corporation. All rights reserved.
+# This program and the accompanying materials are +# licensed and made available under the terms and +# conditions of the BSD License that accompanies this distribution. +# The full text of the license may be found at +# http://opensource.org/licenses/bsd-license.php. +# +# THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, +# WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, +# EITHER EXPRESS OR IMPLIED. +# + +[CONFIG] + WORKSPACE_PLATFORM_BIN =3D WORKSPACE_PLATFORM_BIN + EDK_SETUP_OPTION =3D + openssl_path =3D + PLATFORM_BOARD_PACKAGE =3D ClevoOpenBoardPkg + PROJECT =3D ClevoOpenBoardPkg/N1xxWU + BOARD =3D N1xxWU + FLASH_MAP_FDF =3D ClevoOpenBoardPkg/N1xxWU/Include/Fdf/FlashMapInclud= e.fdf + PROJECT_DSC =3D ClevoOpenBoardPkg/N1xxWU/OpenBoardPkg.dsc + BOARD_PKG_PCD_DSC =3D ClevoOpenBoardPkg/N1xxWU/OpenBoardPkgPcd.dsc + PrepRELEASE =3D DEBUG + SILENT_MODE =3D FALSE + EXT_CONFIG_CLEAR =3D + CapsuleBuild =3D FALSE + EXT_BUILD_FLAGS =3D + CAPSULE_BUILD =3D 0 + TARGET =3D DEBUG + TARGET_SHORT =3D D + PERFORMANCE_BUILD =3D FALSE + FSP_WRAPPER_BUILD =3D TRUE + FSP_BIN_PKG =3D KabylakeFspBinPkg + FSP_PKG_NAME =3D KabylakeFspPkg + FSP_BINARY_BUILD =3D FALSE + FSP_TEST_RELEASE =3D FALSE + SECURE_BOOT_ENABLE =3D FALSE diff --git a/Platform/Intel/KabylakeOpenBoardPkg/KabylakeRvp3/BuildConfig.= cfg b/Platform/Intel/KabylakeOpenBoardPkg/KabylakeRvp3/BuildConfig.cfg new file mode 100644 index 0000000000..188ac51765 --- /dev/null +++ b/Platform/Intel/KabylakeOpenBoardPkg/KabylakeRvp3/BuildConfig.cfg @@ -0,0 +1,27 @@ + +[CONFIG] + WORKSPACE_PLATFORM_BIN =3D WORKSPACE_PLATFORM_BIN + EDK_SETUP_OPTION =3D + openssl_path =3D + PLATFORM_BOARD_PACKAGE =3D KabylakeOpenBoardPkg + PROJECT =3D KabylakeOpenBoardPkg/KabylakeRvp3 + BOARD =3D KabylakeRvp3 + FLASH_MAP_FDF =3D KabylakeOpenBoardPkg/Include/Fdf/FlashMapInclude.fd= f + PROJECT_DSC =3D KabylakeOpenBoardPkg/KabylakeRvp3/OpenBoardPkg.dsc + BOARD_PKG_PCD_DSC =3D KabylakeOpenBoardPkg/KabylakeRvp3/OpenBoardPkgP= cd.dsc + ADDITIONAL_SCRIPTS =3D KabylakeOpenBoardPkg/KabylakeRvp3/BuildEx.py + PrepRELEASE =3D DEBUG + SILENT_MODE =3D FALSE + EXT_CONFIG_CLEAR =3D + CapsuleBuild =3D FALSE + EXT_BUILD_FLAGS =3D + CAPSULE_BUILD =3D 0 + TARGET =3D DEBUG + TARGET_SHORT =3D D + PERFORMANCE_BUILD =3D FALSE + FSP_WRAPPER_BUILD =3D TRUE + FSP_BIN_PKG =3D KabylakeFspBinPkg + FSP_PKG_NAME =3D KabylakeFspPkg + FSP_BINARY_BUILD =3D FALSE + FSP_TEST_RELEASE =3D FALSE + SECURE_BOOT_ENABLE =3D FALSE diff --git a/Platform/Intel/KabylakeOpenBoardPkg/KabylakeRvp3/BuildEx.py b= /Platform/Intel/KabylakeOpenBoardPkg/KabylakeRvp3/BuildEx.py new file mode 100644 index 0000000000..c3b962ec72 --- /dev/null +++ b/Platform/Intel/KabylakeOpenBoardPkg/KabylakeRvp3/BuildEx.py @@ -0,0 +1,72 @@ +# @ BuildEx.py +# This is a sample code provides Optional dynamic imports +# of build functions to the BuildBios.py script +# +# Copyright (c) 2019, Intel Corporation. All rights reserved.
+# This program and the accompanying materials are licensed and +# made available under the terms and conditions of the BSD +# License that accompanies this distribution. +# The full text of the license may be found at +# http://opensource.org/licenses/bsd-license.php. +# +# THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, +# WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IM= PLIED. +# +# +import os + + +def preBuildEx(config, functions): + """Additional Pre BIOS build function + + :param config: The environment variables to be used in the build proc= ess + :type config: Dictionary + :param functions: A dictionary of function pointers + :type functions: Dictionary + :returns: nothing + """ + print("preBuildEx") + return None + + +def buildEx(config, functions): + """Additional BIOS build function + + :param config: The environment variables to be used in the build proc= ess + :type config: Dictionary + :param functions: A dictionary of function pointers + :type functions: Dictionary + :returns: config dictionary + :rtype: Dictionary + """ + print("buildEx") + return None + + +def postBuildEx(config, functions): + """Additional Post BIOS build function + + :param config: The environment variables to be used in the post + build process + :type config: Dictionary + :param functions: A dictionary of function pointers + :type functions: Dictionary + :returns: config dictionary + :rtype: Dictionary + """ + print("postBuildEx") + return None + + +def cleanEx(config, functions): + """Additional clean function + + :param config: The environment variables to be used in the build proc= ess + :type config: Dictionary + :param functions: A dictionary of function pointers + :type functions: Dictionary + :returns: config dictionary + :rtype: Dictionary + """ + print("cleanEx") + return None diff --git a/Platform/Intel/PurleyOpenBoardPkg/BoardMtOlympus/BuildBoard.p= y b/Platform/Intel/PurleyOpenBoardPkg/BoardMtOlympus/BuildBoard.py new file mode 100644 index 0000000000..924016249f --- /dev/null +++ b/Platform/Intel/PurleyOpenBoardPkg/BoardMtOlympus/BuildBoard.py @@ -0,0 +1,177 @@ +# @ BuildBoard.py +# This adds additional functions to the BuildBios.py +# +# Copyright (c) 2019, Intel Corporation. All rights reserved.
+# This program and the accompanying materials are +# licensed and made available under the terms and +# conditions of the BSD License that accompanies this distribution. +# The full text of the license may be found at +# http://opensource.org/licenses/bsd-license.php. +# +# THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, +# WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, +# EITHER EXPRESS OR IMPLIED. +# +# +import os + + +def preBuildEx(config, functions): + + print("Info: re-generating PlatformOffset header files") + + executeScript =3D functions.get("executeScript") + + command =3D ["build", "-D", "MAX_SOCKET=3D" + config.get("MAX_SOCKET"= , "1"), + "-m", + os.path.join(config["PLATFORM_BOARD_PACKAGE"], + "Acpi", "BoardAcpiDxe", "Dsdt.inf"), + "-y", + config.get("PRE_BUILD_REPORT", + os.path.join(config["WORKSPACE"], + "preBuildReport.txt")), + "--log=3D" + config.get("PRE_BUILD_LOG", + os.path.join(config["WORKSPACE"], + "prebuild.log"))] + + stdout, stderr, env, code =3D executeScript(command, config) + if code !=3D 0: + print(" ".join(command)) + print("Error re-generating PlatformOffset header files") + exit(1) + + config["AML_FILTER"] =3D "\"PSYS\" .MCTL\" .FIX[0-9,A-Z]\"" + print("AML_FILTER=3D ", config.get("AML_FILTER")) + + # build the command with arguments + command =3D ["python", + os.path.join(config["MIN_PACKAGE_TOOLS"], + "AmlGenOffset", + "AmlGenOffset.py"), + "-d", "--aml_filter", config["AML_FILTER"], + "-o", os.path.join(config["WORKSPACE_PLATFORM"], + config["PLATFORM_BOARD_PACKAGE"], + "Acpi", "BoardAcpiDxe", + "AmlOffsetTable.c"), + os.path.join(config["BUILD_X64"], + "PurleyOpenBoardPkg", + "Acpi", + "BoardAcpiDxe", + "DSDT", + "OUTPUT", + "Dsdt", "WFPPlatform.offset.h")] + + # execute the command + stdout, stderr, env, code =3D executeScript(command, config) + if code !=3D 0: + print(" ".join(command)) + print("Error re-generating PlatformOffset header files") + exit(1) + + print("GenOffset done") + return config + + +def buildEx(config, functions): + """Additional BIOS build function + + :param config: The environment variables to be used in + the build process + :type config: Dictionary + :param functions: A dictionary of function pointers + :type functions: Dictionary + :returns: config dictionary + :rtype: Dictionary + """ + print("buildEx") + return None + + +def postBuildEx(config, functions): + """Additional Post BIOS build function + + :param config: The environment variables to be used in the post + build process + :type config: Dictionary + :param functions: A dictionary of function pointers + :type functions: Dictionary + :returns: config dictionary + :rtype: Dictionary + """ + print("postBuildEx") + + executeScript =3D functions.get("executeScript") + + if not executeScript: + print("postBuildEx Error") + exit(1) + + print("BoardPostBuild: python PatchBinFv.py") + + commonPatchCommand =3D [os.path.join(config["PYTHON_HOME"], "python")= , + os.path.join(config["MIN_PACKAGE_TOOLS"], + "PatchFv", "PatchBinFv.py"), + config["TARGET"], + os.path.join(config["WORKSPACE_SILICON_BIN"], + "PurleySiliconBinPkg"), + os.path.join(config["WORKSPACE"], + "BuildReport.log")] + + fvsToPatch =3D ["FvTempMemorySilicon", + "FvPreMemorySilicon", + "FvPostMemorySilicon", + "FvLateSilicon"] + for fv in fvsToPatch: + patchCommand =3D commonPatchCommand + [fv] + stdout, stderr, env, code =3D executeScript(patchCommand, config) + if code !=3D 0: + print(" ".join(patchCommand)) + print("Patch Error!") + exit(1) + + print("BoardPostBuild: python RebaseBinFv.py") + + commonRebaseCommand =3D [os.path.join(config["PYTHON_HOME"], "python"= ), + os.path.join(config["MIN_PACKAGE_TOOLS"], + "PatchFv", "RebaseBinFv.py"), + config["TARGET"], + os.path.join(config["WORKSPACE_SILICON_BIN"], + "PurleySiliconBinPkg"), + os.path.join(config["WORKSPACE"], + "BuildReport.log")] + + rebaseCommand =3D commonRebaseCommand +\ + ["FvPreMemorySilicon", + "gMinPlatformPkgTokenSpaceGuid.PcdFlashFvFspMBase"] + + stdout, stderr, env, code =3D executeScript(rebaseCommand, config) + if code !=3D 0: + print(" ".join(rebaseCommand)) + print("Patch Error!") + exit(1) + + rebaseCommand =3D commonRebaseCommand +\ + ["FvPostMemorySilicon", + "gMinPlatformPkgTokenSpaceGuid.PcdFlashFvFspSBase"] + + stdout, stderr, env, code =3D executeScript(rebaseCommand, config) + if code !=3D 0: + print(" ".join(rebaseCommand)) + print("Patch Error!") + exit(1) + + return None + + +def cleanEx(config, functions): + """Additional clean function + + :param config: The environment variables to be used in the build proc= ess + :type config: Dictionary + :param functions: A dictionary of function pointers + :type functions: Dictionary + :returns: config dictionary + :rtype: Dictionary + """ + print("cleanEx") + return None diff --git a/Platform/Intel/PurleyOpenBoardPkg/BoardMtOlympus/BuildConfig.= cfg b/Platform/Intel/PurleyOpenBoardPkg/BoardMtOlympus/BuildConfig.cfg new file mode 100644 index 0000000000..96f0a9d73f --- /dev/null +++ b/Platform/Intel/PurleyOpenBoardPkg/BoardMtOlympus/BuildConfig.cfg @@ -0,0 +1,44 @@ +# @ BuildConfig.cfg +# This is the main/default build configuration file +# +# Copyright (c) 2019, Intel Corporation. All rights reserved.
+# This program and the accompanying materials are +# licensed and made available under the terms and +# conditions of the BSD License that accompanies this distribution. +# The full text of the license may be found at +# http://opensource.org/licenses/bsd-license.php. +# +# THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, +# WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, +# EITHER EXPRESS OR IMPLIED. +# + +[CONFIG] + WORKSPACE_PLATFORM_BIN =3D WORKSPACE_PLATFORM_BIN + EDK_SETUP_OPTION =3D + openssl_path =3D + PLATFORM_BOARD_PACKAGE =3D PurleyOpenBoardPkg + PROJECT =3D PurleyOpenBoardPkg/BoardMtOlympus + BOARD =3D BoardMtOlympus + FLASH_MAP_FDF =3D PurleyOpenBoardPkg/Include/Fdf/FlashMapInclude.fdf + PROJECT_DSC =3D PurleyOpenBoardPkg/BoardMtOlympus/PlatformPkg.dsc + BOARD_PKG_PCD_DSC =3D PurleyOpenBoardPkg/BoardMtOlympus/PlatformPkgPc= d.dsc + ADDITIONAL_SCRIPTS =3D PurleyOpenBoardPkg/BoardMtOlympus/BuildBoard.p= y + PRE_BUILD_LOG =3D prebuild.log + PRE_BUILD_REPORT =3D prebuildReport.log + PrepRELEASE =3D DEBUG + SILENT_MODE =3D FALSE + EXT_CONFIG_CLEAR =3D + CapsuleBuild =3D FALSE + EXT_BUILD_FLAGS =3D + CAPSULE_BUILD =3D 0 + TARGET =3D DEBUG + TARGET_SHORT =3D D + PERFORMANCE_BUILD =3D FALSE + FSP_WRAPPER_BUILD =3D FALSE + FSP_BIN_PKG =3D KabylakeFspBinPkg + FSP_PKG_NAME =3D KabylakeFspPkg + FSP_BINARY_BUILD =3D FALSE + FSP_TEST_RELEASE =3D FALSE + SECURE_BOOT_ENABLE =3D FALSE + MAX_SOCKET =3D 2 --=20 2.19.1.windows.1