* [edk2-platforms/devel-MinPlatform] [PATCH v2 0/3] Added python build scipts to minplaform @ 2019-04-17 22:55 Agyeman, Prince 2019-04-17 22:55 ` [edk2-platforms/devel-MinPlatform] [PATCH v2 1/3] Platform/Intel: Added python build script Agyeman, Prince ` (2 more replies) 0 siblings, 3 replies; 5+ messages in thread From: Agyeman, Prince @ 2019-04-17 22:55 UTC (permalink / raw) To: devel Cc: Michael Kubacki, Nate DeSimone, Ankit Sinha, Michael D Kinney, Isaac W Oram, Liming Gao, Bowen Zhou, Shifei A Lu [-- Warning: decoded text below may be mangled, UTF-8 assumed --] [-- Attachment #1: Type: text/plain; charset=y, Size: 10489 bytes --] * changes since v1: - Updates per Michael Kubacki's feedback - JSON files to INI - Removed batch build scripts - Removed batch build instructions from Readme.md Overview: WORKSPACE │ ├───edk2 ├───edk2-non-osi ├───edk2-platforms │ └───Platform │ ├───Intel │ │ └──────Build.cfg: Default build settings.These shall be overridden by | | | platform specific settings │ │ │ │ │ └───BuildBios.py: Generic prebuild, build ,postbuild, │ │ │ clean functions │ │ | │ │ ├───ClevoOpenBoardPkg │ │ │ └───N1xxWU │ │ │ └───BuildConfig.cfg: N1xxWU specific build │ │ │ settings │ │ | enviroment variables │ │ │ │ │ ├───KabylakeOpenBoardPkg │ │ │ └───KabylakeRvp3 │ │ │ │ │ │ │ │───BuildConfig.cfg: KabylakeRvp3 specific │ │ │ │ build settings, enviroment variables │ │ │ │ │ │ │ └───BuildEx.py: Optional prebuild, build │ │ │ and clean postbuild functions │ │ | │ │ └───PurleyOpenBoardPkg │ │ │ └───BoardMtOlympus │ │ │ │───BuildBoard.py: Optional prebuild, │ │ │ │ build, postbuild and clean functions │ │ │ │ │ │ │ └───BuildConfig.cfg: BoardMtOlympus specific │ │ │ build settings, enviroment variables ------------------- Details: ------------------- What it is ---------- These patches add python BIOS build scripts and build configuration files to build platforms under Intel/Platform. Why ---- The reason behind this implementation is to use a cross platform build script to build minplaform BIOS. How it is done ---------------- The python files: ----------------- BuildBios.py: The main build file. This script sets up the edk2 build enviroment using the default Build.cfg settings and platform specific settings. It uses the configurations found in the Build.cfg file to locate the platforms that are configured to use this build script. The path to each of the platform settings can be found under the "PLATFORMS" field within the Build.cfg file. The platform specific settings are located in the platform's main directory. Example edk2-platforms/Platform/Intel/ClevoOpenBoardPkg/N1xxWU/BuildConfig.cfg. The BuildBios.py script contains the four main functions: - preBuild: Sets up the edk2 build enviroment variables, target.txt file - build: Uses the configurations to Build BIOS - postBuild: Does post build processes like cleaning up files generated during the build process - clean: Cleans up the build directory. There are four addtional functions that dynamically import functions from the board's Optional/Additional python script if specified in board settings file's ADDITIONAL_SCRIPTS These four functions are the preBuildEx, buildEx, postBuildEx, cleanEx functions Board additional (Optional) python build script: ------------------------------------------------ These are python scripts located in the board's main directory, An example Intel/KabylakeOpenBoardPkg/KabylakeRvp3/BuildEx.py If added, its path must be specified in board's settings file, under the field ADDITIONAL_SCRIPTS. Example ADDITIONAL_SCRIPTS = PurleyOpenBoardPkg/BoardMtOlympus/BuildBoard.py If specified, the buildEx, preBuildEx, postBuildEx, cleanEx must be defined even if they are not use The config files ----------------- Build.cfg: ----------- This is file contains the default BIOS build configuration. The default configurations are defined under the "DEFAULT_CONFIG" section of the file. Each of these can be overridden by the board specific setting as defined in the board's build config file. All paths must be separated by forward slashes. All the paths in the main Build.cfg are relative to the minplaform WORKSPACE. Example: -------- [DEFAULT_CONFIG] MIN_PACKAGE_TOOLS = edk2-platforms/Platform/Intel/MinPlatformPkg/Tools The PLATFORMS field in the Build.cfg file informs BuildBios.py about the available platforms that can be built with the BuildBios.py. The path to the board specific config file must be relative to location of BuildBios.py, Platform/Intel. It is in the format Boardname = BoardPath Example: -------- [PLATFORMS] KabylakeRvp3 = KabylakeOpenBoardPkg/KabylakeRvp3/BuildConfig.cfg Board Specific Build Settings file: ---------------------------------------- This file is located in the board's main directory. The CONFIG field contains all the build enviroment variables. These values will override any the were specific under DEFAULT_CONFIG in the default Build.cfg file. Example is Intel/KabylakeOpenBoardPkg/KabylakeRvp3/BuildConfig.cfg Building BIOS ------------- python BuildBios.py -p BOARDNAME -t TOOLCHAIN usage: BuildBios.py [-h] --platform {N1xxWU,KabylakeRvp3,BoardMtOlympus} [--toolchain TOOLCHAIN] [--DEBUG] [--RELEASE] [--TEST_RELEASE] [--RELEASE_PDB] [--list] [--cleanall] [--capsule] [--silent] [--performance] [--fsp] Build Help optional arguments: -h, --help show this help message and exit --platform {N1xxWU,KabylakeRvp3,BoardMtOlympus}, -p {N1xxWU,KabylakeRvp3,BoardMtOlympus} The platform to build --toolchain TOOLCHAIN, -t TOOLCHAIN Using the Tool Chain Tagname to build the platform,overriding target.txt's TOOL_CHAIN_TAG definition --DEBUG, -d Debug flag --RELEASE, -r Release flag --TEST_RELEASE, -tr Test Release flag --RELEASE_PDB, -rp Release flag --list, -l Lists available platforms --cleanall Cleans all --capsule Capsule build enabled --silent Silent build enabled --performance Performance build enabled --fsp FSP build enabled Cc: Michael Kubacki <michael.a.kubacki@intel.com> Cc: Nate DeSimone <nathaniel.l.desimone@intel.com> Cc: Ankit Sinha <ankit.sinha@intel.com> Cc: Michael D Kinney <michael.d.kinney@intel.com> Cc: Isaac W Oram <isaac.w.oram@intel.com> Cc: Liming Gao <liming.gao@intel.com> Cc: Bowen Zhou<bowen.zhou@intel.com> Cc: Shifei A Lu <shifei.a.lu@intel.com> Contributed-under: TianoCore Contribution Agreement 0.1 Signed-off-by: Agyeman <prince.agyeman@intel.com> Agyeman (3): Platform/Intel: Added python build script. ReadMe.md: Update the build instructions Removing build batch files from ClevoOpenBoardPkg, KabylakeOpenBoardPkg and PurleyOpenBoardPkg Platform/Intel/Build.cfg | 60 ++ Platform/Intel/BuildBios.py | 990 ++++++++++++++++++ .../ClevoOpenBoardPkg/N1xxWU/BuildConfig.cfg | 40 + .../ClevoOpenBoardPkg/N1xxWU/GitEdk2Clevo.bat | 85 -- .../Intel/ClevoOpenBoardPkg/N1xxWU/bld.bat | 165 --- .../Intel/ClevoOpenBoardPkg/N1xxWU/cln.bat | 54 - .../ClevoOpenBoardPkg/N1xxWU/postbuild.bat | 45 - .../ClevoOpenBoardPkg/N1xxWU/prebuild.bat | 220 ---- .../Intel/ClevoOpenBoardPkg/N1xxWU/prep.bat | 85 -- .../KabylakeRvp3/BuildConfig.cfg | 27 + .../KabylakeRvp3/BuildEx.py | 72 ++ .../KabylakeRvp3/GitEdk2MinKabylake.bat | 85 -- .../KabylakeOpenBoardPkg/KabylakeRvp3/bld.bat | 165 --- .../KabylakeOpenBoardPkg/KabylakeRvp3/cln.bat | 54 - .../KabylakeRvp3/postbuild.bat | 45 - .../KabylakeRvp3/prebuild.bat | 221 ---- .../KabylakeRvp3/prep.bat | 85 -- .../BoardMtOlympus/BuildBoard.py | 177 ++++ .../BoardMtOlympus/BuildConfig.cfg | 44 + .../BoardMtOlympus/GitEdk2MinMtOlympus.bat | 86 -- .../PurleyOpenBoardPkg/BoardMtOlympus/bld.bat | 144 --- .../BoardMtOlympus/postbuild.bat | 101 -- .../BoardMtOlympus/prebuild.bat | 203 ---- ReadMe.md | 54 +- 24 files changed, 1442 insertions(+), 1865 deletions(-) create mode 100644 Platform/Intel/Build.cfg create mode 100644 Platform/Intel/BuildBios.py create mode 100644 Platform/Intel/ClevoOpenBoardPkg/N1xxWU/BuildConfig.cfg delete mode 100644 Platform/Intel/ClevoOpenBoardPkg/N1xxWU/GitEdk2Clevo.bat delete mode 100644 Platform/Intel/ClevoOpenBoardPkg/N1xxWU/bld.bat delete mode 100644 Platform/Intel/ClevoOpenBoardPkg/N1xxWU/cln.bat delete mode 100644 Platform/Intel/ClevoOpenBoardPkg/N1xxWU/postbuild.bat delete mode 100644 Platform/Intel/ClevoOpenBoardPkg/N1xxWU/prebuild.bat delete mode 100644 Platform/Intel/ClevoOpenBoardPkg/N1xxWU/prep.bat create mode 100644 Platform/Intel/KabylakeOpenBoardPkg/KabylakeRvp3/BuildConfig.cfg create mode 100644 Platform/Intel/KabylakeOpenBoardPkg/KabylakeRvp3/BuildEx.py delete mode 100644 Platform/Intel/KabylakeOpenBoardPkg/KabylakeRvp3/GitEdk2MinKabylake.bat delete mode 100644 Platform/Intel/KabylakeOpenBoardPkg/KabylakeRvp3/bld.bat delete mode 100644 Platform/Intel/KabylakeOpenBoardPkg/KabylakeRvp3/cln.bat delete mode 100644 Platform/Intel/KabylakeOpenBoardPkg/KabylakeRvp3/postbuild.bat delete mode 100644 Platform/Intel/KabylakeOpenBoardPkg/KabylakeRvp3/prebuild.bat delete mode 100644 Platform/Intel/KabylakeOpenBoardPkg/KabylakeRvp3/prep.bat create mode 100644 Platform/Intel/PurleyOpenBoardPkg/BoardMtOlympus/BuildBoard.py create mode 100644 Platform/Intel/PurleyOpenBoardPkg/BoardMtOlympus/BuildConfig.cfg delete mode 100644 Platform/Intel/PurleyOpenBoardPkg/BoardMtOlympus/GitEdk2MinMtOlympus.bat delete mode 100644 Platform/Intel/PurleyOpenBoardPkg/BoardMtOlympus/bld.bat delete mode 100644 Platform/Intel/PurleyOpenBoardPkg/BoardMtOlympus/postbuild.bat delete mode 100644 Platform/Intel/PurleyOpenBoardPkg/BoardMtOlympus/prebuild.bat -- 2.19.1.windows.1 ^ permalink raw reply [flat|nested] 5+ messages in thread
* [edk2-platforms/devel-MinPlatform] [PATCH v2 1/3] Platform/Intel: Added python build script. 2019-04-17 22:55 [edk2-platforms/devel-MinPlatform] [PATCH v2 0/3] Added python build scipts to minplaform Agyeman, Prince @ 2019-04-17 22:55 ` Agyeman, Prince 2019-04-20 0:31 ` [edk2-devel] " Nate DeSimone 2019-04-17 22:55 ` [edk2-platforms/devel-MinPlatform] [PATCH v2 2/3] ReadMe.md: Update the build instructions Agyeman, Prince 2019-04-17 22:55 ` [edk2-platforms/devel-MinPlatform] [PATCH v2 3/3] Removing build batch files from ClevoOpenBoardPkg, KabylakeOpenBoardPkg and PurleyOpenBoardPkg Agyeman, Prince 2 siblings, 1 reply; 5+ messages in thread From: Agyeman, Prince @ 2019-04-17 22:55 UTC (permalink / raw) To: devel Cc: Michael Kubacki, Nate DeSimone, Ankit Sinha, Michael D Kinney, Isaac W Oram, Liming Gao, Bowen Zhou, Shifei A Lu 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 <michael.a.kubacki@intel.com> Cc: Nate DeSimone <nathaniel.l.desimone@intel.com> Cc: Ankit Sinha <ankit.sinha@intel.com> Cc: Michael D Kinney <michael.d.kinney@intel.com> Cc: Isaac W Oram <isaac.w.oram@intel.com> Cc: Liming Gao <liming.gao@intel.com> Cc: Bowen Zhou<bowen.zhou@intel.com> Cc: Shifei A Lu <shifei.a.lu@intel.com> Contributed-under: TianoCore Contribution Agreement 0.1 Signed-off-by: Agyeman <prince.agyeman@intel.com> --- 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.cfg create mode 100644 Platform/Intel/KabylakeOpenBoardPkg/KabylakeRvp3/BuildConfig.cfg create mode 100644 Platform/Intel/KabylakeOpenBoardPkg/KabylakeRvp3/BuildEx.py create mode 100644 Platform/Intel/PurleyOpenBoardPkg/BoardMtOlympus/BuildBoard.py create mode 100644 Platform/Intel/PurleyOpenBoardPkg/BoardMtOlympus/BuildConfig.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.<BR> +# 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 = + WORKSPACE_FSP_BIN = FSP + EDK_TOOLS_BIN = edk2-BaseTools-win32 + EDK_BASETOOLS = BaseTools + WORKSPACE_PLATFORM = edk2-platforms/Platform/Intel + WORKSPACE_SILICON = edk2-platforms/Silicon/Intel + WORKSPACE_PLATFORM_BIN = WORKSPACE_PLATFORM_BIN + WORKSPACE_SILICON_BIN = edk2-non-osi/Silicon/Intel + MIN_PACKAGE_TOOLS = edk2-platforms/Platform/Intel/MinPlatformPkg/Tools + PACKAGES_PATH = + EDK_SETUP_OPTION = + BASE_TOOLS_PATH = edk2/BaseTools + EDK_TOOLS_PATH = edk2/BaseTools + openssl_path = + PLATFORM_BOARD_PACKAGE = KabylakeOpenBoardPkg + BIOS_SIZE_OPTION = -DBIOS_SIZE_OPTION=SIZE_70 + WORKSPACE_CORE = edk2 + EFI_SOURCE = edk2 + PATHEXT = .COM;.EXE;.BAT;.CMD;.VBS;.JS;.WS;.MSC + PROMPT = $P$G + PLATFORM_PACKAGE = MinPlatformPkg + BOARD = KabylakeRvp3 + PrepRELEASE = DEBUG + SILENT_MODE = FALSE + EXT_CONFIG_CLEAR = + CapsuleBuild = FALSE + EXT_BUILD_FLAGS = + CAPSULE_BUILD = 0 + TARGET = DEBUG + TARGET_SHORT = D + PERFORMANCE_BUILD = FALSE + FSP_WRAPPER_BUILD = TRUE + FSP_BIN_PKG = KabylakeFspBinPkg + FSP_BINARY_BUILD = FALSE + FSP_TEST_RELEASE = FALSE + SECURE_BOOT_ENABLE = FALSE + REBUILD_MODE = + BUILD_ROM_ONLY = + NUMBER_OF_PROCESSORS = 1 + +[PLATFORMS] + KabylakeRvp3 = KabylakeOpenBoardPkg/KabylakeRvp3/BuildConfig.cfg + N1xxWU = ClevoOpenBoardPkg/N1xxWU/BuildConfig.cfg + BoardMtOlympus = 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.<BR> +# +# 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="DEBUG", silent=False, toolchain=None): + """Sets the environment variables that shall be used for the build + + :param buildConfig: The build configuration as defined in the JOSN + 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 build + :type toolchain: String + :returns: The updated environment variables + :rtype: Dictionary + """ + + # get current environment variables + config = os.environ.copy() + + # patch the config + buildConfig = patchConfig(buildConfig) + + # make sure all values are strings + config.update(buildConfig) + + # make the config python 2.7 compartible + config = py27Fix(config) + + # Set WORKSPACE environment. + config["WORKSPACE"] = 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=subprocess.PIPE) + except OSError as error: + if error.errno == 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 = os.path.join(config["WORKSPACE"], + config["BASE_TOOLS_PATH"], + "Conf") + configPath = 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"] = os.path.join(config["WORKSPACE"], + config["WORKSPACE_PLATFORM"]) + config["WORKSPACE_SILICON"] = os.path.join(config["WORKSPACE"], + config["WORKSPACE_SILICON"]) + config["WORKSPACE_PLATFORM_BIN"] = \ + os.path.join(config["WORKSPACE"], config["WORKSPACE_PLATFORM_BIN"]) + config["WORKSPACE_SILICON_BIN"] = \ + os.path.join(config["WORKSPACE"], config["WORKSPACE_SILICON_BIN"]) + config["WORKSPACE_FSP_BIN"] = os.path.join(config["WORKSPACE"], + config["WORKSPACE_FSP_BIN"]) + + # add to package path + pathSep = ";" + config["EDK_SETUP_OPTION"] = "--nt32" + if os.name == "posix": + pathSep = ":" + config["EDK_SETUP_OPTION"] = " " + + config["PACKAGES_PATH"] = config["WORKSPACE_PLATFORM"] + config["PACKAGES_PATH"] += pathSep + config["WORKSPACE_SILICON"] + config["PACKAGES_PATH"] += pathSep + config["WORKSPACE_SILICON_BIN"] + config["PACKAGES_PATH"] += pathSep + \ + os.path.join(config["WORKSPACE"], "FSP") + config["PACKAGES_PATH"] += pathSep + \ + os.path.join(config["WORKSPACE"], "edk2") + config["PACKAGES_PATH"] += pathSep + os.path.join(config["WORKSPACE"]) + config["EDK_TOOLS_PATH"] = os.path.join(config["WORKSPACE"], + config["EDK_TOOLS_PATH"]) + config["BASE_TOOLS_PATH"] = config["EDK_TOOLS_PATH"] + config["EDK_TOOLS_BIN"] = os.path.join(config["WORKSPACE"], + config["EDK_TOOLS_BIN"]) + config["PLATFORM_FSP_BIN_PACKAGE"] = \ + os.path.join(config['WORKSPACE_FSP_BIN'], config['FSP_BIN_PKG']) + config['PROJECT_DSC'] = os.path.join(config["WORKSPACE_PLATFORM"], + config['PROJECT_DSC']) + config['BOARD_PKG_PCD_DSC'] = os.path.join(config["WORKSPACE_PLATFORM"], + config['BOARD_PKG_PCD_DSC']) + config["CONF_PATH"] = os.path.join(config["WORKSPACE"], "Conf") + + # get the python path + if os.environ.get("PYTHON_HOME") is None: + config["PYTHON_HOME"] = None + if os.environ.get("PYTHONPATH") is not None: + config["PYTHON_HOME"] = 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 = [os.path.join(config["EFI_SOURCE"], "edksetup")] + if os.name == "nt": + + if config.get("EDK_SETUP_OPTION") and \ + config["EDK_SETUP_OPTION"] != " ": + edk2SetupCmd.append(config["EDK_SETUP_OPTION"]) + + out, err, result, returnCode = executeScript(edk2SetupCmd, + config, + collectEnv=True, + shell=True) + 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 = ["nmake", "-f", os.path.join(config["BASE_TOOLS_PATH"], + "Makefile")] + if os.name == "posix": # linux + command = ["make", "-C", os.path.join(config["BASE_TOOLS_PATH"])] + + out, err, result, returnCode = executeScript(command, config, shell=True) + if returnCode is not 0: + buildFailed(config) + + config["SILENT_MODE"] = 'TRUE' if silent else 'FALSE' + + print ("==============================================") + + if os.path.isfile(os.path.join(config['WORKSPACE'], "Prep.log")): + os.remove(os.path.join(config['WORKSPACE'], "Prep.log")) + + config["PROJECT"] = os.path.join(config["PLATFORM_BOARD_PACKAGE"], + config["BOARD"]) + + # + # Setup Build + # + if toolchain is not None: + config["TOOL_CHAIN_TAG"] = toolchain + elif config.get("TOOL_CHAIN_TAG") is None: + if os.name == 'nt': + config["TOOL_CHAIN_TAG"] = "VS2015" + else: + config["TOOL_CHAIN_TAG"] = "GCC5" + + # echo Show CL revision + config["PrepRELEASE"] = buildType + + if buildType == "DEBUG": + config["TARGET"] = 'DEBUG' + config["TARGET_SHORT"] = 'D' + else: + config["TARGET"] = 'RELEASE' + config["TARGET_SHORT"] = 'R' + + # set BUILD_DIR_PATH path + config["BUILD_DIR_PATH"] = os.path.join(config["WORKSPACE"], + 'Build', + config["PROJECT"], + "{}_{}".format( + config["TARGET"], + config["TOOL_CHAIN_TAG"])) + # set BUILD_DIR path + config["BUILD_DIR"] = os.path.join('Build', + config["PROJECT"], + "{}_{}".format( + config["TARGET"], + config["TOOL_CHAIN_TAG"])) + + config["BUILD_X64"] = os.path.join(config["BUILD_DIR_PATH"], 'X64') + config["BUILD_IA32"] = 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'] == "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"] == "TRUE": + if config['FSP_WRAPPER_BUILD'] == '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 = preBuildEx(config) + if result is not None and type(result) is dict: + config.update(result) + + # print user settings + print ("BIOS_SIZE_OPTION = {}".format(config["BIOS_SIZE_OPTION"])) + print ("EFI_SOURCE = {}".format(config["EFI_SOURCE"])) + print ("TARGET = {}".format(config["TARGET"])) + print ("TARGET_ARCH = {}".format("IA32 X64")) + print ("TOOL_CHAIN_TAG = {}".format(config["TOOL_CHAIN_TAG"])) + print ("WORKSPACE = {}".format(config["WORKSPACE"])) + print ("WORKSPACE_CORE = {}".format(config["WORKSPACE_CORE"])) + print ("EXT_BUILD_FLAGS = {}".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"] == 'TRUE': + config["FSP_BUILD_PARAMETER"] = "/d" + if config["TARGET"] == "RELEASE": + config["FSP_BUILD_PARAMETER"] = "/tr" + else: + config["FSP_BUILD_PARAMETER"] = "/r" + + # @if %FSP_WRAPPER_BUILD% EQU FALSE goto :BldEnd TODO + + if config["FSP_WRAPPER_BUILD"] == "TRUE": + pattern = "Fsp_Rebased.*\\.fd$" + file_dir = 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 = os.path.join(config['WORKSPACE_PLATFORM'], + config['PROJECT'], config['BOARD_PKG_PCD_DSC']) + + command = [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 = executeScript(command, config) + + if returnCode != 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 fsp_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 = 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("==========================================") + print(" User Selected build options:") + print(" SILENT_MODE = ", config["SILENT_MODE"]) + print(" REBUILD_MODE = ", config["REBUILD_MODE"]) + print(" BUILD_ROM_ONLY = ", config["BUILD_ROM_ONLY"]) + print("==========================================") + + command = ["build", "-n", config["NUMBER_OF_PROCESSORS"]] + + if config["REBUILD_MODE"] and config["REBUILD_MODE"] != "": + command.append(config["REBUILD_MODE"]) + + if config["EXT_BUILD_FLAGS"] and config["EXT_BUILD_FLAGS"] != "": + command.append(config["EXT_BUILD_FLAGS"]) + + if config.get("SILENT_MODE", "FALSE") == "TRUE": + command.append("--silent") + command.append("--quiet") + + else: + command.append("--log=" + config.get("BUILD_LOG", "Build.log")) + command.append("--report-file=" + + config.get("BUILD_REPORT", "BuildReport.log")) + + if config.get("VERBOSE", "FALSE") == "TRUE": + command.append("--verbose") + + if config.get("MAX_SOCKET") is not None: + command.append("-D") + command.append("MAX_SOCKET=" + config["MAX_SOCKET"]) + + out, err, result, exitCode = executeScript(command, config) + if exitCode != 0: + buildFailed(config) + + # Additional build scripts for this platform + result = 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 process + :type config: Dictionary + :returns: nothing + """ + print("Running postbuild to complete the build process.") + + # Additional build scripts for this platform + result = postBuildEx(config) + if result is not None and type(result) is dict: + config.update(result) + + # cleanup + pattern = "Fsp_Rebased.*\\.fd$" + file_dir = 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 process + :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 executed + :type path: String + :param path: the function to be executed + :type path: String + :returns: nothing + """ + if path.endswith(".py"): + path = path[:-3] + path = path.replace("\\\\", os.sep).replace(os.sep, ".") + module = import_module(path) + lib = 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 process + :type config: Dictionary + :returns: config dictionary + :rtype: Dictionary + """ + if config.get("ADDITIONAL_SCRIPTS"): + try: + platformFunction = importPlatformLib(config["ADDITIONAL_SCRIPTS"], + "preBuildEx") + functions = {"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 process + :type config: Dictionary + :returns: config dictionary + :rtype: Dictionary + """ + if config.get("ADDITIONAL_SCRIPTS"): + try: + platformFunction = importPlatformLib(config["ADDITIONAL_SCRIPTS"], + "buildEx") + functions = {"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 = importPlatformLib(config["ADDITIONAL_SCRIPTS"], + "postBuildEx") + functions = {"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 process + :type config: Dictionary + :returns: config dictionary + :rtype: Dictionary + """ + if config.get("ADDITIONAL_SCRIPTS"): + try: + platformFunction = importPlatformLib(config["ADDITIONAL_SCRIPTS"], + "cleanEx") + functions = {"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 = False + environmentVars = {} + outPut = "" + for line in stdoutStr.split("\n"): + if startEnvUpdate and len(line.split("=")) == 2: + key, value = line.split("=") + environmentVars[key] = value + else: + outPut += "\n" + line.replace(marker, "") + + if marker in line: + if startEnvUpdate: + startEnvUpdate = False + else: + startEnvUpdate = True + return (outPut, environmentVars) + + +def executeScript(command, envVariables, collectEnv=False, + enableStdPipe=False, shell=True): + """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 = '-----env-----' + env = {} + kwarg = {"env": envVariables, + "universal_newlines": True, + "shell": shell, + "cwd": envVariables["WORKSPACE"]} + + if enableStdPipe or collectEnv: + kwarg["stdout"] = subprocess.PIPE + kwarg["stderr"] = subprocess.PIPE + + # collect environment variables + if collectEnv: + # get the binary that prints environment variables based on os + if os.name == 'nt': + getVarCommand = "set" + else: + getVarCommand = "env" + # modify the command to print the environment variables + if type(command) == list: + command += ["&&", "echo", envMarker, "&&", + getVarCommand, "&&", "echo", envMarker] + else: + command += " " + " ".join(["&&", "echo", envMarker, + "&&", getVarCommand, + "&&", "echo", envMarker]) + + # execute the command + execute = subprocess.Popen(command, **kwarg) + stdout, stderr = execute.communicate() + code = execute.returncode + + # wait for process to be done + execute.wait() + + # if collect enviroment variables + if collectEnv: + # get the new environment variables + stdout, env = 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 process + :type config: Dictionary + :returns: config dictionary + :rtype: Dictionary + """ + newconfig = {} + for key in config: + newconfig[str(key)] = str(config[key].replace("/", os.sep)) + return newconfig + + +def py27Fix(config): + """ Prepares build for python 2.7 => build + :param config: The environment variables used in the build process + :type config: Dictionary + :returns: config dictionary + :rtype: Dictionary + """ + if not (sys.version_info > (3, 0)): + pathList = [] + # create __init__.py in directories in this path + if config.get("ADDITIONAL_SCRIPTS"): + # get the directory + pathToDirectory = os.path.dirname(config.get("ADDITIONAL_SCRIPTS")) + path = "" + for directories in pathToDirectory.split(os.sep): + path += directories + os.sep + initFile = path + os.sep + "__init__.py" + if not os.path.isfile(initFile): + open(initFile, 'w').close() + pathList.append(initFile) + config["DYNAMIC_BUILD_INIT_FILES"] = ",".join(pathList) + + return config + + +def clean(buildConfig, platform=""): + """Cleans the build workspace + + :param config: The environment variables used in the build process + :type config: Dictionary + :param platform: The platform to clean + :type platform: String + :returns: nothing + """ + print(" Run build cleanall...") + + # patch the config + buildConfig = patchConfig(buildConfig) + + # get current environment variables + config = os.environ.copy() + + # update it with the build variables + config.update(buildConfig) + + if not config.get('WORKSPACE') and \ + config.get('WORKSPACE') != "": + config["WORKSPACE"] = os.path.abspath(os.path.join("..", "..", + "..", "")) + + config["WORKSPACE_PLATFORM"] = os.path.join(config["WORKSPACE"], + config["WORKSPACE_PLATFORM"]) + config["WORKSPACE_SILICON"] = 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 process + :type config: Dictionary + :returns: True if update was successful and False if update fails + :rtype: Boolean + """ + contents = None + result = False + with open(os.path.join(config["CONF_PATH"], "target.txt"), 'r') as target: + contents = target.readlines() + optionsList = ['ACTIVE_PLATFORM', 'TARGET', + 'TARGET_ARCH', 'TOOL_CHAIN_TAG', 'BUILD_RULE_CONF'] + modified = [] + + # remove these options from the config file + for line in contents: + if '#' != line.replace(" ", "")[0] and\ + any(opt in line for opt in optionsList): + continue + modified.append(line) + + # replace with config options provided + string = "{} = {}\n".format("ACTIVE_PLATFORM", + os.path.join( + config['WORKSPACE_PLATFORM'], + config['PLATFORM_BOARD_PACKAGE'], + config['BOARD'], + config['PROJECT_DSC'])) + modified.append(string) + + string = "{} = {}\n".format("TARGET", config['TARGET']) + modified.append(string) + + string = "TARGET_ARCH = IA32 X64\n" + modified.append(string) + + string = "{} = {}\n".format("TOOL_CHAIN_TAG", config['TOOL_CHAIN_TAG']) + modified.append(string) + + string = "{} = {}\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 = True + + return result + + +def getConfig(): + """Reads the default projects config file + + :returns: The config defined in the the Build.cfg file + :rtype: Dictionary + """ + configFile = Configparser.RawConfigParser() + configFile.optionxform = str + configFile.read('Build.cfg', encoding='utf-8') + configDictionary = {} + for section in configFile.sections(): + dictionary = dict(configFile.items(section)) + configDictionary[section] = 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 = {} + platformData = configData.get("PLATFORMS") + try: + path = platformData.get(platformName) + configFile = Configparser.RawConfigParser() + configFile.optionxform = str + configFile.read(path) + for section in configFile.sections(): + config[section] = 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 process + :type arguments: argparse + :returns: The config dictionary built from the commandline arguments + :rtype: Dictionary + """ + result = {} + if arguments.capsule is True: + result["CAPSULE_BUILD"] = "1" + + if arguments.performance is True: + result["PERFORMANCE_BUILD"] = "TRUE" + + if arguments.fsp is True: + result["FSP_WRAPPER_BUILD"] = "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=None): + config = getConfig() + print("Platforms:") + for key in buildConfig.get("PLATFORMS"): + print(" " + key) + setattr(namespace, self.dest, values) + exit(0) + + buildChoices = ['DEBUG', 'RELEASE', 'TEST_RELEASE', 'RELEASE_PDB'] + # get the build commands + Parser = argparse.ArgumentParser(description="Build Help") + Parser.add_argument('--platform', '-p', dest="platform", + help='the platform to build', + choices=buildConfig.get("PLATFORMS"), + required=('-l' not in sys.argv and + '--cleanall' not in sys.argv)) + + Parser.add_argument('--toolchain', '-t', dest="toolchain", + help="using the Tool Chain Tagname to build \ + the platform,overriding \ + target.txt's TOOL_CHAIN_TAG definition") + + Parser.add_argument("--DEBUG", '-d', help="debug flag", + action='store_const', dest="target", + const="DEBUG", default="DEBUG") + + Parser.add_argument("--RELEASE", '-r', help="release flag", + action='store_const', + dest="target", const="RELEASE") + + Parser.add_argument("--TEST_RELEASE", '-tr', help="test Release flag", + action='store_const', + dest="target", const="TEST_RELEASE") + + Parser.add_argument("--RELEASE_PDB", '-rp', help="release flag", + action='store_const', dest="target", + const="RELEASE_PDB") + + Parser.add_argument('--list', '-l', action=printPlatforms, + help='lists available platforms', nargs=0) + + Parser.add_argument('--cleanall', dest='cleanall', + help='cleans all', action='store_true') + + Parser.add_argument("--capsule", help="capsule build enabled", + action='store_true', dest="capsule") + + Parser.add_argument("--silent", help="silent build enabled", + action='store_true', dest="silent") + + Parser.add_argument("--performance", help="performance build enabled", + action='store_true', dest="performance") + + Parser.add_argument("--fsp", help="fsp build enabled", + action='store_true', dest="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__ == "__main__": + + # to quit the build + signal.signal(signal.SIGINT, keyboardInterruption) + + # get general build configurations + buildConfig = getConfig() + + # get commandline parameters + arguments = getCmdArguments(buildConfig) + + if arguments.cleanall: + clean(buildConfig.get("DEFAULT_CONFIG")) + + # get platform specific config + platform_config = getPlatformConfig(arguments.platform, buildConfig) + + # update general build config with platform specific config + config = buildConfig.get("DEFAULT_CONFIG") + config.update(platform_config.get("CONFIG")) + + # Override config with cmd arguments + cmdConfigArgs = getCmdConfigArguments(arguments) + config.update(cmdConfigArgs) + + # get prebuild configurations + config = preBuild(config, + buildType=arguments.target, + toolchain=arguments.toolchain, + silent=arguments.silent) + + # build selected platform + config = build(config) + + # post build + postBuild(config) diff --git a/Platform/Intel/ClevoOpenBoardPkg/N1xxWU/BuildConfig.cfg b/Platform/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.<BR> +# 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 = WORKSPACE_PLATFORM_BIN + EDK_SETUP_OPTION = + openssl_path = + PLATFORM_BOARD_PACKAGE = ClevoOpenBoardPkg + PROJECT = ClevoOpenBoardPkg/N1xxWU + BOARD = N1xxWU + FLASH_MAP_FDF = ClevoOpenBoardPkg/N1xxWU/Include/Fdf/FlashMapInclude.fdf + PROJECT_DSC = ClevoOpenBoardPkg/N1xxWU/OpenBoardPkg.dsc + BOARD_PKG_PCD_DSC = ClevoOpenBoardPkg/N1xxWU/OpenBoardPkgPcd.dsc + PrepRELEASE = DEBUG + SILENT_MODE = FALSE + EXT_CONFIG_CLEAR = + CapsuleBuild = FALSE + EXT_BUILD_FLAGS = + CAPSULE_BUILD = 0 + TARGET = DEBUG + TARGET_SHORT = D + PERFORMANCE_BUILD = FALSE + FSP_WRAPPER_BUILD = TRUE + FSP_BIN_PKG = KabylakeFspBinPkg + FSP_PKG_NAME = KabylakeFspPkg + FSP_BINARY_BUILD = FALSE + FSP_TEST_RELEASE = FALSE + SECURE_BOOT_ENABLE = 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 = WORKSPACE_PLATFORM_BIN + EDK_SETUP_OPTION = + openssl_path = + PLATFORM_BOARD_PACKAGE = KabylakeOpenBoardPkg + PROJECT = KabylakeOpenBoardPkg/KabylakeRvp3 + BOARD = KabylakeRvp3 + FLASH_MAP_FDF = KabylakeOpenBoardPkg/Include/Fdf/FlashMapInclude.fdf + PROJECT_DSC = KabylakeOpenBoardPkg/KabylakeRvp3/OpenBoardPkg.dsc + BOARD_PKG_PCD_DSC = KabylakeOpenBoardPkg/KabylakeRvp3/OpenBoardPkgPcd.dsc + ADDITIONAL_SCRIPTS = KabylakeOpenBoardPkg/KabylakeRvp3/BuildEx.py + PrepRELEASE = DEBUG + SILENT_MODE = FALSE + EXT_CONFIG_CLEAR = + CapsuleBuild = FALSE + EXT_BUILD_FLAGS = + CAPSULE_BUILD = 0 + TARGET = DEBUG + TARGET_SHORT = D + PERFORMANCE_BUILD = FALSE + FSP_WRAPPER_BUILD = TRUE + FSP_BIN_PKG = KabylakeFspBinPkg + FSP_PKG_NAME = KabylakeFspPkg + FSP_BINARY_BUILD = FALSE + FSP_TEST_RELEASE = FALSE + SECURE_BOOT_ENABLE = 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.<BR> +# 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): + """Additional Pre 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: nothing + """ + print("preBuildEx") + return None + + +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") + return None + + +def cleanEx(config, functions): + """Additional clean 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("cleanEx") + return None diff --git a/Platform/Intel/PurleyOpenBoardPkg/BoardMtOlympus/BuildBoard.py 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.<BR> +# 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 = functions.get("executeScript") + + command = ["build", "-D", "MAX_SOCKET=" + 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=" + config.get("PRE_BUILD_LOG", + os.path.join(config["WORKSPACE"], + "prebuild.log"))] + + stdout, stderr, env, code = executeScript(command, config) + if code != 0: + print(" ".join(command)) + print("Error re-generating PlatformOffset header files") + exit(1) + + config["AML_FILTER"] = "\"PSYS\" .MCTL\" .FIX[0-9,A-Z]\"" + print("AML_FILTER= ", config.get("AML_FILTER")) + + # build the command with arguments + command = ["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 = executeScript(command, config) + if code != 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 = functions.get("executeScript") + + if not executeScript: + print("postBuildEx Error") + exit(1) + + print("BoardPostBuild: python PatchBinFv.py") + + commonPatchCommand = [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 = ["FvTempMemorySilicon", + "FvPreMemorySilicon", + "FvPostMemorySilicon", + "FvLateSilicon"] + for fv in fvsToPatch: + patchCommand = commonPatchCommand + [fv] + stdout, stderr, env, code = executeScript(patchCommand, config) + if code != 0: + print(" ".join(patchCommand)) + print("Patch Error!") + exit(1) + + print("BoardPostBuild: python RebaseBinFv.py") + + commonRebaseCommand = [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 = commonRebaseCommand +\ + ["FvPreMemorySilicon", + "gMinPlatformPkgTokenSpaceGuid.PcdFlashFvFspMBase"] + + stdout, stderr, env, code = executeScript(rebaseCommand, config) + if code != 0: + print(" ".join(rebaseCommand)) + print("Patch Error!") + exit(1) + + rebaseCommand = commonRebaseCommand +\ + ["FvPostMemorySilicon", + "gMinPlatformPkgTokenSpaceGuid.PcdFlashFvFspSBase"] + + stdout, stderr, env, code = executeScript(rebaseCommand, config) + if code != 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 process + :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.<BR> +# 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 = WORKSPACE_PLATFORM_BIN + EDK_SETUP_OPTION = + openssl_path = + PLATFORM_BOARD_PACKAGE = PurleyOpenBoardPkg + PROJECT = PurleyOpenBoardPkg/BoardMtOlympus + BOARD = BoardMtOlympus + FLASH_MAP_FDF = PurleyOpenBoardPkg/Include/Fdf/FlashMapInclude.fdf + PROJECT_DSC = PurleyOpenBoardPkg/BoardMtOlympus/PlatformPkg.dsc + BOARD_PKG_PCD_DSC = PurleyOpenBoardPkg/BoardMtOlympus/PlatformPkgPcd.dsc + ADDITIONAL_SCRIPTS = PurleyOpenBoardPkg/BoardMtOlympus/BuildBoard.py + PRE_BUILD_LOG = prebuild.log + PRE_BUILD_REPORT = prebuildReport.log + PrepRELEASE = DEBUG + SILENT_MODE = FALSE + EXT_CONFIG_CLEAR = + CapsuleBuild = FALSE + EXT_BUILD_FLAGS = + CAPSULE_BUILD = 0 + TARGET = DEBUG + TARGET_SHORT = D + PERFORMANCE_BUILD = FALSE + FSP_WRAPPER_BUILD = FALSE + FSP_BIN_PKG = KabylakeFspBinPkg + FSP_PKG_NAME = KabylakeFspPkg + FSP_BINARY_BUILD = FALSE + FSP_TEST_RELEASE = FALSE + SECURE_BOOT_ENABLE = FALSE + MAX_SOCKET = 2 -- 2.19.1.windows.1 ^ permalink raw reply related [flat|nested] 5+ messages in thread
* Re: [edk2-devel] [edk2-platforms/devel-MinPlatform] [PATCH v2 1/3] Platform/Intel: Added python build script. 2019-04-17 22:55 ` [edk2-platforms/devel-MinPlatform] [PATCH v2 1/3] Platform/Intel: Added python build script Agyeman, Prince @ 2019-04-20 0:31 ` Nate DeSimone 0 siblings, 0 replies; 5+ messages in thread From: Nate DeSimone @ 2019-04-20 0:31 UTC (permalink / raw) 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 1. There are PEP8 coding style violations all over. Functions are supposed to be lower case with underscores, same with variables and module names. For example: a. BuildBios.py should be build_bios.py b. def preBuild(buildConfig, buildType="DEBUG", silent=False, toolchain=None) should be def pre_build(build_config, build_type="DEBUG", silent=False, tool_chain=None): c. Read this: https://www.python.org/dev/peps/pep-0008/ 2. Why is the KabyLakeOpenBoardPkg script named BuildEx.py and the PurleyOpenBoardPkg script named BuildBoard.py? Make it consistent... and PEP8 compliant! 3. BuildBios.py, Line 29 - This is incorrect. Python 3.x has a module named "configparser". Python 2.x has a module named "ConfigParser". There is no version of Python that ever has a "Configparser" module. What is really happening is on Python 3.x you are hitting an ImportError on line 29 which the except fixes. It is clear you never bothered to test your script on Python 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 "ConfigParser". 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 = executeScript(edk2SetupCmd, But you should be doing this: _, _, result, returnCode = executeScript(edk2SetupCmd, a. The same error is made on line 328. 8. BuildBios.py, Line 246 - You declare the variable "fd" but you don't actually 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 value to a variable called "path"... but then you don't use the value of path anywhere. Why do this call? Its dead code. 10. BuildBios.py, Line 422 - You don't use the value of "ex" why declare it? 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 anything with the output. Why? 12. BuildBios.py, Line 893 - You declare the buildChoices list but then you don't use it. Why? 13. BuildBios.py, Line 955 - Why are you too lazy to define a main() function? It is not acceptable to put the contents of your main() function in if __name__ == "__main__": 14. Build.cfg, Line 23 - What is this for? WORKSPACE_PLATFORM_BIN = WORKSPACE_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 <devel@edk2.groups.io> On Behalf Of Agyeman, Prince Sent: Wednesday, April 17, 2019 3:56 PM To: devel@edk2.groups.io Cc: Kubacki, Michael A <michael.a.kubacki@intel.com>; Desimone, Nathaniel L <nathaniel.l.desimone@intel.com>; Sinha, Ankit <ankit.sinha@intel.com>; Kinney, Michael D <michael.d.kinney@intel.com>; Oram, Isaac W <isaac.w.oram@intel.com>; Gao, Liming <liming.gao@intel.com>; Zhou, Bowen <bowen.zhou@intel.com>; Lu, Shifei A <shifei.a.lu@intel.com> Subject: [edk2-devel] [edk2-platforms/devel-MinPlatform] [PATCH v2 1/3] Platform/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 <mailto:michael.a.kubacki@intel.com> Cc: Nate DeSimone <mailto:nathaniel.l.desimone@intel.com> Cc: Ankit Sinha <mailto:ankit.sinha@intel.com> Cc: Michael D Kinney <mailto:michael.d.kinney@intel.com> Cc: Isaac W Oram <mailto:isaac.w.oram@intel.com> Cc: Liming Gao <mailto:liming.gao@intel.com> Cc: Bowen Zhou<mailto:bowen.zhou@intel.com> Cc: Shifei A Lu <mailto:shifei.a.lu@intel.com> Contributed-under: TianoCore Contribution Agreement 0.1 Signed-off-by: Agyeman <mailto:prince.agyeman@intel.com> --- 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.cfg create mode 100644 Platform/Intel/KabylakeOpenBoardPkg/KabylakeRvp3/BuildConfig.cfg create mode 100644 Platform/Intel/KabylakeOpenBoardPkg/KabylakeRvp3/BuildEx.py create mode 100644 Platform/Intel/PurleyOpenBoardPkg/BoardMtOlympus/BuildBoard.py create mode 100644 Platform/Intel/PurleyOpenBoardPkg/BoardMtOlympus/BuildConfig.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.<BR> +# 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 = + WORKSPACE_FSP_BIN = FSP + EDK_TOOLS_BIN = edk2-BaseTools-win32 + EDK_BASETOOLS = BaseTools + WORKSPACE_PLATFORM = edk2-platforms/Platform/Intel + WORKSPACE_SILICON = edk2-platforms/Silicon/Intel + WORKSPACE_PLATFORM_BIN = WORKSPACE_PLATFORM_BIN + WORKSPACE_SILICON_BIN = edk2-non-osi/Silicon/Intel + MIN_PACKAGE_TOOLS = edk2-platforms/Platform/Intel/MinPlatformPkg/Tools + PACKAGES_PATH = + EDK_SETUP_OPTION = + BASE_TOOLS_PATH = edk2/BaseTools + EDK_TOOLS_PATH = edk2/BaseTools + openssl_path = + PLATFORM_BOARD_PACKAGE = KabylakeOpenBoardPkg + BIOS_SIZE_OPTION = -DBIOS_SIZE_OPTION=SIZE_70 + WORKSPACE_CORE = edk2 + EFI_SOURCE = edk2 + PATHEXT = .COM;.EXE;.BAT;.CMD;.VBS;.JS;.WS;.MSC + PROMPT = $P$G + PLATFORM_PACKAGE = MinPlatformPkg + BOARD = KabylakeRvp3 + PrepRELEASE = DEBUG + SILENT_MODE = FALSE + EXT_CONFIG_CLEAR = + CapsuleBuild = FALSE + EXT_BUILD_FLAGS = + CAPSULE_BUILD = 0 + TARGET = DEBUG + TARGET_SHORT = D + PERFORMANCE_BUILD = FALSE + FSP_WRAPPER_BUILD = TRUE + FSP_BIN_PKG = KabylakeFspBinPkg + FSP_BINARY_BUILD = FALSE + FSP_TEST_RELEASE = FALSE + SECURE_BOOT_ENABLE = FALSE + REBUILD_MODE = + BUILD_ROM_ONLY = + NUMBER_OF_PROCESSORS = 1 + +[PLATFORMS] + KabylakeRvp3 = KabylakeOpenBoardPkg/KabylakeRvp3/BuildConfig.cfg + N1xxWU = ClevoOpenBoardPkg/N1xxWU/BuildConfig.cfg + BoardMtOlympus = 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.<BR> +# +# 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="DEBUG", silent=False, toolchain=None): + """Sets the environment variables that shall be used for the build + + :param buildConfig: The build configuration as defined in the JOSN + 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 build + :type toolchain: String + :returns: The updated environment variables + :rtype: Dictionary + """ + + # get current environment variables + config = os.environ.copy() + + # patch the config + buildConfig = patchConfig(buildConfig) + + # make sure all values are strings + config.update(buildConfig) + + # make the config python 2.7 compartible + config = py27Fix(config) + + # Set WORKSPACE environment. + config["WORKSPACE"] = 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=subprocess.PIPE) + except OSError as error: + if error.errno == 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 = os.path.join(config["WORKSPACE"], + config["BASE_TOOLS_PATH"], + "Conf") + configPath = 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"] = os.path.join(config["WORKSPACE"], + config["WORKSPACE_PLATFORM"]) + config["WORKSPACE_SILICON"] = os.path.join(config["WORKSPACE"], + config["WORKSPACE_SILICON"]) + config["WORKSPACE_PLATFORM_BIN"] = \ + os.path.join(config["WORKSPACE"], config["WORKSPACE_PLATFORM_BIN"]) + config["WORKSPACE_SILICON_BIN"] = \ + os.path.join(config["WORKSPACE"], config["WORKSPACE_SILICON_BIN"]) + config["WORKSPACE_FSP_BIN"] = os.path.join(config["WORKSPACE"], + config["WORKSPACE_FSP_BIN"]) + + # add to package path + pathSep = ";" + config["EDK_SETUP_OPTION"] = "--nt32" + if os.name == "posix": + pathSep = ":" + config["EDK_SETUP_OPTION"] = " " + + config["PACKAGES_PATH"] = config["WORKSPACE_PLATFORM"] + config["PACKAGES_PATH"] += pathSep + config["WORKSPACE_SILICON"] + config["PACKAGES_PATH"] += pathSep + config["WORKSPACE_SILICON_BIN"] + config["PACKAGES_PATH"] += pathSep + \ + os.path.join(config["WORKSPACE"], "FSP") + config["PACKAGES_PATH"] += pathSep + \ + os.path.join(config["WORKSPACE"], "edk2") + config["PACKAGES_PATH"] += pathSep + os.path.join(config["WORKSPACE"]) + config["EDK_TOOLS_PATH"] = os.path.join(config["WORKSPACE"], + config["EDK_TOOLS_PATH"]) + config["BASE_TOOLS_PATH"] = config["EDK_TOOLS_PATH"] + config["EDK_TOOLS_BIN"] = os.path.join(config["WORKSPACE"], + config["EDK_TOOLS_BIN"]) + config["PLATFORM_FSP_BIN_PACKAGE"] = \ + os.path.join(config['WORKSPACE_FSP_BIN'], config['FSP_BIN_PKG']) + config['PROJECT_DSC'] = os.path.join(config["WORKSPACE_PLATFORM"], + config['PROJECT_DSC']) + config['BOARD_PKG_PCD_DSC'] = os.path.join(config["WORKSPACE_PLATFORM"], + config['BOARD_PKG_PCD_DSC']) + config["CONF_PATH"] = os.path.join(config["WORKSPACE"], "Conf") + + # get the python path + if os.environ.get("PYTHON_HOME") is None: + config["PYTHON_HOME"] = None + if os.environ.get("PYTHONPATH") is not None: + config["PYTHON_HOME"] = 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 = [os.path.join(config["EFI_SOURCE"], "edksetup")] + if os.name == "nt": + + if config.get("EDK_SETUP_OPTION") and \ + config["EDK_SETUP_OPTION"] != " ": + edk2SetupCmd.append(config["EDK_SETUP_OPTION"]) + + out, err, result, returnCode = executeScript(edk2SetupCmd, + config, + collectEnv=True, + shell=True) + 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 = ["nmake", "-f", os.path.join(config["BASE_TOOLS_PATH"], + "Makefile")] + if os.name == "posix": # linux + command = ["make", "-C", os.path.join(config["BASE_TOOLS_PATH"])] + + out, err, result, returnCode = executeScript(command, config, shell=True) + if returnCode is not 0: + buildFailed(config) + + config["SILENT_MODE"] = 'TRUE' if silent else 'FALSE' + + print ("==============================================") + + if os.path.isfile(os.path.join(config['WORKSPACE'], "Prep.log")): + os.remove(os.path.join(config['WORKSPACE'], "Prep.log")) + + config["PROJECT"] = os.path.join(config["PLATFORM_BOARD_PACKAGE"], + config["BOARD"]) + + # + # Setup Build + # + if toolchain is not None: + config["TOOL_CHAIN_TAG"] = toolchain + elif config.get("TOOL_CHAIN_TAG") is None: + if os.name == 'nt': + config["TOOL_CHAIN_TAG"] = "VS2015" + else: + config["TOOL_CHAIN_TAG"] = "GCC5" + + # echo Show CL revision + config["PrepRELEASE"] = buildType + + if buildType == "DEBUG": + config["TARGET"] = 'DEBUG' + config["TARGET_SHORT"] = 'D' + else: + config["TARGET"] = 'RELEASE' + config["TARGET_SHORT"] = 'R' + + # set BUILD_DIR_PATH path + config["BUILD_DIR_PATH"] = os.path.join(config["WORKSPACE"], + 'Build', + config["PROJECT"], + "{}_{}".format( + config["TARGET"], + config["TOOL_CHAIN_TAG"])) + # set BUILD_DIR path + config["BUILD_DIR"] = os.path.join('Build', + config["PROJECT"], + "{}_{}".format( + config["TARGET"], + config["TOOL_CHAIN_TAG"])) + + config["BUILD_X64"] = os.path.join(config["BUILD_DIR_PATH"], 'X64') + config["BUILD_IA32"] = 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'] == "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"] == "TRUE": + if config['FSP_WRAPPER_BUILD'] == '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 = preBuildEx(config) + if result is not None and type(result) is dict: + config.update(result) + + # print user settings + print ("BIOS_SIZE_OPTION = {}".format(config["BIOS_SIZE_OPTION"])) + print ("EFI_SOURCE = {}".format(config["EFI_SOURCE"])) + print ("TARGET = {}".format(config["TARGET"])) + print ("TARGET_ARCH = {}".format("IA32 X64")) + print ("TOOL_CHAIN_TAG = {}".format(config["TOOL_CHAIN_TAG"])) + print ("WORKSPACE = {}".format(config["WORKSPACE"])) + print ("WORKSPACE_CORE = {}".format(config["WORKSPACE_CORE"])) + print ("EXT_BUILD_FLAGS = {}".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"] == 'TRUE': + config["FSP_BUILD_PARAMETER"] = "/d" + if config["TARGET"] == "RELEASE": + config["FSP_BUILD_PARAMETER"] = "/tr" + else: + config["FSP_BUILD_PARAMETER"] = "/r" + + # @if %FSP_WRAPPER_BUILD% EQU FALSE goto :BldEnd TODO + + if config["FSP_WRAPPER_BUILD"] == "TRUE": + pattern = "Fsp_Rebased.*\\.fd$" + file_dir = 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 = os.path.join(config['WORKSPACE_PLATFORM'], + config['PROJECT'], config['BOARD_PKG_PCD_DSC']) + + command = [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 = executeScript(command, config) + + if returnCode != 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 fsp_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 = 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("==========================================") + print(" User Selected build options:") + print(" SILENT_MODE = ", config["SILENT_MODE"]) + print(" REBUILD_MODE = ", config["REBUILD_MODE"]) + print(" BUILD_ROM_ONLY = ", config["BUILD_ROM_ONLY"]) + print("==========================================") + + command = ["build", "-n", config["NUMBER_OF_PROCESSORS"]] + + if config["REBUILD_MODE"] and config["REBUILD_MODE"] != "": + command.append(config["REBUILD_MODE"]) + + if config["EXT_BUILD_FLAGS"] and config["EXT_BUILD_FLAGS"] != "": + command.append(config["EXT_BUILD_FLAGS"]) + + if config.get("SILENT_MODE", "FALSE") == "TRUE": + command.append("--silent") + command.append("--quiet") + + else: + command.append("--log=" + config.get("BUILD_LOG", "Build.log")) + command.append("--report-file=" + + config.get("BUILD_REPORT", "BuildReport.log")) + + if config.get("VERBOSE", "FALSE") == "TRUE": + command.append("--verbose") + + if config.get("MAX_SOCKET") is not None: + command.append("-D") + command.append("MAX_SOCKET=" + config["MAX_SOCKET"]) + + out, err, result, exitCode = executeScript(command, config) + if exitCode != 0: + buildFailed(config) + + # Additional build scripts for this platform + result = 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 process + :type config: Dictionary + :returns: nothing + """ + print("Running postbuild to complete the build process.") + + # Additional build scripts for this platform + result = postBuildEx(config) + if result is not None and type(result) is dict: + config.update(result) + + # cleanup + pattern = "Fsp_Rebased.*\\.fd$" + file_dir = 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 process + :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 executed + :type path: String + :param path: the function to be executed + :type path: String + :returns: nothing + """ + if path.endswith(".py"): + path = path[:-3] + path = path.replace("\\\\", os.sep).replace(os.sep, ".") + module = import_module(path) + lib = 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 process + :type config: Dictionary + :returns: config dictionary + :rtype: Dictionary + """ + if config.get("ADDITIONAL_SCRIPTS"): + try: + platformFunction = importPlatformLib(config["ADDITIONAL_SCRIPTS"], + "preBuildEx") + functions = {"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 process + :type config: Dictionary + :returns: config dictionary + :rtype: Dictionary + """ + if config.get("ADDITIONAL_SCRIPTS"): + try: + platformFunction = importPlatformLib(config["ADDITIONAL_SCRIPTS"], + "buildEx") + functions = {"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 = importPlatformLib(config["ADDITIONAL_SCRIPTS"], + "postBuildEx") + functions = {"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 process + :type config: Dictionary + :returns: config dictionary + :rtype: Dictionary + """ + if config.get("ADDITIONAL_SCRIPTS"): + try: + platformFunction = importPlatformLib(config["ADDITIONAL_SCRIPTS"], + "cleanEx") + functions = {"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 = False + environmentVars = {} + outPut = "" + for line in stdoutStr.split("\n"): + if startEnvUpdate and len(line.split("=")) == 2: + key, value = line.split("=") + environmentVars[key] = value + else: + outPut += "\n" + line.replace(marker, "") + + if marker in line: + if startEnvUpdate: + startEnvUpdate = False + else: + startEnvUpdate = True + return (outPut, environmentVars) + + +def executeScript(command, envVariables, collectEnv=False, + enableStdPipe=False, shell=True): + """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 = '-----env-----' + env = {} + kwarg = {"env": envVariables, + "universal_newlines": True, + "shell": shell, + "cwd": envVariables["WORKSPACE"]} + + if enableStdPipe or collectEnv: + kwarg["stdout"] = subprocess.PIPE + kwarg["stderr"] = subprocess.PIPE + + # collect environment variables + if collectEnv: + # get the binary that prints environment variables based on os + if os.name == 'nt': + getVarCommand = "set" + else: + getVarCommand = "env" + # modify the command to print the environment variables + if type(command) == list: + command += ["&&", "echo", envMarker, "&&", + getVarCommand, "&&", "echo", envMarker] + else: + command += " " + " ".join(["&&", "echo", envMarker, + "&&", getVarCommand, + "&&", "echo", envMarker]) + + # execute the command + execute = subprocess.Popen(command, **kwarg) + stdout, stderr = execute.communicate() + code = execute.returncode + + # wait for process to be done + execute.wait() + + # if collect enviroment variables + if collectEnv: + # get the new environment variables + stdout, env = 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 process + :type config: Dictionary + :returns: config dictionary + :rtype: Dictionary + """ + newconfig = {} + for key in config: + newconfig[str(key)] = str(config[key].replace("/", os.sep)) + return newconfig + + +def py27Fix(config): + """ Prepares build for python 2.7 => build + :param config: The environment variables used in the build process + :type config: Dictionary + :returns: config dictionary + :rtype: Dictionary + """ + if not (sys.version_info > (3, 0)): + pathList = [] + # create __init__.py in directories in this path + if config.get("ADDITIONAL_SCRIPTS"): + # get the directory + pathToDirectory = os.path.dirname(config.get("ADDITIONAL_SCRIPTS")) + path = "" + for directories in pathToDirectory.split(os.sep): + path += directories + os.sep + initFile = path + os.sep + "__init__.py" + if not os.path.isfile(initFile): + open(initFile, 'w').close() + pathList.append(initFile) + config["DYNAMIC_BUILD_INIT_FILES"] = ",".join(pathList) + + return config + + +def clean(buildConfig, platform=""): + """Cleans the build workspace + + :param config: The environment variables used in the build process + :type config: Dictionary + :param platform: The platform to clean + :type platform: String + :returns: nothing + """ + print(" Run build cleanall...") + + # patch the config + buildConfig = patchConfig(buildConfig) + + # get current environment variables + config = os.environ.copy() + + # update it with the build variables + config.update(buildConfig) + + if not config.get('WORKSPACE') and \ + config.get('WORKSPACE') != "": + config["WORKSPACE"] = os.path.abspath(os.path.join("..", "..", + "..", "")) + + config["WORKSPACE_PLATFORM"] = os.path.join(config["WORKSPACE"], + config["WORKSPACE_PLATFORM"]) + config["WORKSPACE_SILICON"] = 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 process + :type config: Dictionary + :returns: True if update was successful and False if update fails + :rtype: Boolean + """ + contents = None + result = False + with open(os.path.join(config["CONF_PATH"], "target.txt"), 'r') as target: + contents = target.readlines() + optionsList = ['ACTIVE_PLATFORM', 'TARGET', + 'TARGET_ARCH', 'TOOL_CHAIN_TAG', 'BUILD_RULE_CONF'] + modified = [] + + # remove these options from the config file + for line in contents: + if '#' != line.replace(" ", "")[0] and\ + any(opt in line for opt in optionsList): + continue + modified.append(line) + + # replace with config options provided + string = "{} = {}\n".format("ACTIVE_PLATFORM", + os.path.join( + config['WORKSPACE_PLATFORM'], + config['PLATFORM_BOARD_PACKAGE'], + config['BOARD'], + config['PROJECT_DSC'])) + modified.append(string) + + string = "{} = {}\n".format("TARGET", config['TARGET']) + modified.append(string) + + string = "TARGET_ARCH = IA32 X64\n" + modified.append(string) + + string = "{} = {}\n".format("TOOL_CHAIN_TAG", config['TOOL_CHAIN_TAG']) + modified.append(string) + + string = "{} = {}\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 = True + + return result + + +def getConfig(): + """Reads the default projects config file + + :returns: The config defined in the the Build.cfg file + :rtype: Dictionary + """ + configFile = Configparser.RawConfigParser() + configFile.optionxform = str + configFile.read('Build.cfg', encoding='utf-8') + configDictionary = {} + for section in configFile.sections(): + dictionary = dict(configFile.items(section)) + configDictionary[section] = 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 = {} + platformData = configData.get("PLATFORMS") + try: + path = platformData.get(platformName) + configFile = Configparser.RawConfigParser() + configFile.optionxform = str + configFile.read(path) + for section in configFile.sections(): + config[section] = 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 process + :type arguments: argparse + :returns: The config dictionary built from the commandline arguments + :rtype: Dictionary + """ + result = {} + if arguments.capsule is True: + result["CAPSULE_BUILD"] = "1" + + if arguments.performance is True: + result["PERFORMANCE_BUILD"] = "TRUE" + + if arguments.fsp is True: + result["FSP_WRAPPER_BUILD"] = "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=None): + config = getConfig() + print("Platforms:") + for key in buildConfig.get("PLATFORMS"): + print(" " + key) + setattr(namespace, self.dest, values) + exit(0) + + buildChoices = ['DEBUG', 'RELEASE', 'TEST_RELEASE', 'RELEASE_PDB'] + # get the build commands + Parser = argparse.ArgumentParser(description="Build Help") + Parser.add_argument('--platform', '-p', dest="platform", + help='the platform to build', + choices=buildConfig.get("PLATFORMS"), + required=('-l' not in sys.argv and + '--cleanall' not in sys.argv)) + + Parser.add_argument('--toolchain', '-t', dest="toolchain", + help="using the Tool Chain Tagname to build \ + the platform,overriding \ + target.txt's TOOL_CHAIN_TAG definition") + + Parser.add_argument("--DEBUG", '-d', help="debug flag", + action='store_const', dest="target", + const="DEBUG", default="DEBUG") + + Parser.add_argument("--RELEASE", '-r', help="release flag", + action='store_const', + dest="target", const="RELEASE") + + Parser.add_argument("--TEST_RELEASE", '-tr', help="test Release flag", + action='store_const', + dest="target", const="TEST_RELEASE") + + Parser.add_argument("--RELEASE_PDB", '-rp', help="release flag", + action='store_const', dest="target", + const="RELEASE_PDB") + + Parser.add_argument('--list', '-l', action=printPlatforms, + help='lists available platforms', nargs=0) + + Parser.add_argument('--cleanall', dest='cleanall', + help='cleans all', action='store_true') + + Parser.add_argument("--capsule", help="capsule build enabled", + action='store_true', dest="capsule") + + Parser.add_argument("--silent", help="silent build enabled", + action='store_true', dest="silent") + + Parser.add_argument("--performance", help="performance build enabled", + action='store_true', dest="performance") + + Parser.add_argument("--fsp", help="fsp build enabled", + action='store_true', dest="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__ == "__main__": + + # to quit the build + signal.signal(signal.SIGINT, keyboardInterruption) + + # get general build configurations + buildConfig = getConfig() + + # get commandline parameters + arguments = getCmdArguments(buildConfig) + + if arguments.cleanall: + clean(buildConfig.get("DEFAULT_CONFIG")) + + # get platform specific config + platform_config = getPlatformConfig(arguments.platform, buildConfig) + + # update general build config with platform specific config + config = buildConfig.get("DEFAULT_CONFIG") + config.update(platform_config.get("CONFIG")) + + # Override config with cmd arguments + cmdConfigArgs = getCmdConfigArguments(arguments) + config.update(cmdConfigArgs) + + # get prebuild configurations + config = preBuild(config, + buildType=arguments.target, + toolchain=arguments.toolchain, + silent=arguments.silent) + + # build selected platform + config = build(config) + + # post build + postBuild(config) diff --git a/Platform/Intel/ClevoOpenBoardPkg/N1xxWU/BuildConfig.cfg b/Platform/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.<BR> +# 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 = WORKSPACE_PLATFORM_BIN + EDK_SETUP_OPTION = + openssl_path = + PLATFORM_BOARD_PACKAGE = ClevoOpenBoardPkg + PROJECT = ClevoOpenBoardPkg/N1xxWU + BOARD = N1xxWU + FLASH_MAP_FDF = ClevoOpenBoardPkg/N1xxWU/Include/Fdf/FlashMapInclude.fdf + PROJECT_DSC = ClevoOpenBoardPkg/N1xxWU/OpenBoardPkg.dsc + BOARD_PKG_PCD_DSC = ClevoOpenBoardPkg/N1xxWU/OpenBoardPkgPcd.dsc + PrepRELEASE = DEBUG + SILENT_MODE = FALSE + EXT_CONFIG_CLEAR = + CapsuleBuild = FALSE + EXT_BUILD_FLAGS = + CAPSULE_BUILD = 0 + TARGET = DEBUG + TARGET_SHORT = D + PERFORMANCE_BUILD = FALSE + FSP_WRAPPER_BUILD = TRUE + FSP_BIN_PKG = KabylakeFspBinPkg + FSP_PKG_NAME = KabylakeFspPkg + FSP_BINARY_BUILD = FALSE + FSP_TEST_RELEASE = FALSE + SECURE_BOOT_ENABLE = 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 = WORKSPACE_PLATFORM_BIN + EDK_SETUP_OPTION = + openssl_path = + PLATFORM_BOARD_PACKAGE = KabylakeOpenBoardPkg + PROJECT = KabylakeOpenBoardPkg/KabylakeRvp3 + BOARD = KabylakeRvp3 + FLASH_MAP_FDF = KabylakeOpenBoardPkg/Include/Fdf/FlashMapInclude.fdf + PROJECT_DSC = KabylakeOpenBoardPkg/KabylakeRvp3/OpenBoardPkg.dsc + BOARD_PKG_PCD_DSC = KabylakeOpenBoardPkg/KabylakeRvp3/OpenBoardPkgPcd.dsc + ADDITIONAL_SCRIPTS = KabylakeOpenBoardPkg/KabylakeRvp3/BuildEx.py + PrepRELEASE = DEBUG + SILENT_MODE = FALSE + EXT_CONFIG_CLEAR = + CapsuleBuild = FALSE + EXT_BUILD_FLAGS = + CAPSULE_BUILD = 0 + TARGET = DEBUG + TARGET_SHORT = D + PERFORMANCE_BUILD = FALSE + FSP_WRAPPER_BUILD = TRUE + FSP_BIN_PKG = KabylakeFspBinPkg + FSP_PKG_NAME = KabylakeFspPkg + FSP_BINARY_BUILD = FALSE + FSP_TEST_RELEASE = FALSE + SECURE_BOOT_ENABLE = 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.<BR> +# 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): + """Additional Pre 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: nothing + """ + print("preBuildEx") + return None + + +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") + return None + + +def cleanEx(config, functions): + """Additional clean 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("cleanEx") + return None diff --git a/Platform/Intel/PurleyOpenBoardPkg/BoardMtOlympus/BuildBoard.py 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.<BR> +# 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 = functions.get("executeScript") + + command = ["build", "-D", "MAX_SOCKET=" + 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=" + config.get("PRE_BUILD_LOG", + os.path.join(config["WORKSPACE"], + "prebuild.log"))] + + stdout, stderr, env, code = executeScript(command, config) + if code != 0: + print(" ".join(command)) + print("Error re-generating PlatformOffset header files") + exit(1) + + config["AML_FILTER"] = "\"PSYS\" .MCTL\" .FIX[0-9,A-Z]\"" + print("AML_FILTER= ", config.get("AML_FILTER")) + + # build the command with arguments + command = ["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 = executeScript(command, config) + if code != 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 = functions.get("executeScript") + + if not executeScript: + print("postBuildEx Error") + exit(1) + + print("BoardPostBuild: python PatchBinFv.py") + + commonPatchCommand = [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 = ["FvTempMemorySilicon", + "FvPreMemorySilicon", + "FvPostMemorySilicon", + "FvLateSilicon"] + for fv in fvsToPatch: + patchCommand = commonPatchCommand + [fv] + stdout, stderr, env, code = executeScript(patchCommand, config) + if code != 0: + print(" ".join(patchCommand)) + print("Patch Error!") + exit(1) + + print("BoardPostBuild: python RebaseBinFv.py") + + commonRebaseCommand = [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 = commonRebaseCommand +\ + ["FvPreMemorySilicon", + "gMinPlatformPkgTokenSpaceGuid.PcdFlashFvFspMBase"] + + stdout, stderr, env, code = executeScript(rebaseCommand, config) + if code != 0: + print(" ".join(rebaseCommand)) + print("Patch Error!") + exit(1) + + rebaseCommand = commonRebaseCommand +\ + ["FvPostMemorySilicon", + "gMinPlatformPkgTokenSpaceGuid.PcdFlashFvFspSBase"] + + stdout, stderr, env, code = executeScript(rebaseCommand, config) + if code != 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 process + :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.<BR> +# 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 = WORKSPACE_PLATFORM_BIN + EDK_SETUP_OPTION = + openssl_path = + PLATFORM_BOARD_PACKAGE = PurleyOpenBoardPkg + PROJECT = PurleyOpenBoardPkg/BoardMtOlympus + BOARD = BoardMtOlympus + FLASH_MAP_FDF = PurleyOpenBoardPkg/Include/Fdf/FlashMapInclude.fdf + PROJECT_DSC = PurleyOpenBoardPkg/BoardMtOlympus/PlatformPkg.dsc + BOARD_PKG_PCD_DSC = PurleyOpenBoardPkg/BoardMtOlympus/PlatformPkgPcd.dsc + ADDITIONAL_SCRIPTS = PurleyOpenBoardPkg/BoardMtOlympus/BuildBoard.py + PRE_BUILD_LOG = prebuild.log + PRE_BUILD_REPORT = prebuildReport.log + PrepRELEASE = DEBUG + SILENT_MODE = FALSE + EXT_CONFIG_CLEAR = + CapsuleBuild = FALSE + EXT_BUILD_FLAGS = + CAPSULE_BUILD = 0 + TARGET = DEBUG + TARGET_SHORT = D + PERFORMANCE_BUILD = FALSE + FSP_WRAPPER_BUILD = FALSE + FSP_BIN_PKG = KabylakeFspBinPkg + FSP_PKG_NAME = KabylakeFspPkg + FSP_BINARY_BUILD = FALSE + FSP_TEST_RELEASE = FALSE + SECURE_BOOT_ENABLE = FALSE + MAX_SOCKET = 2 -- 2.19.1.windows.1 ^ permalink raw reply related [flat|nested] 5+ messages in thread
* [edk2-platforms/devel-MinPlatform] [PATCH v2 2/3] ReadMe.md: Update the build instructions 2019-04-17 22:55 [edk2-platforms/devel-MinPlatform] [PATCH v2 0/3] Added python build scipts to minplaform Agyeman, Prince 2019-04-17 22:55 ` [edk2-platforms/devel-MinPlatform] [PATCH v2 1/3] Platform/Intel: Added python build script Agyeman, Prince @ 2019-04-17 22:55 ` Agyeman, Prince 2019-04-17 22:55 ` [edk2-platforms/devel-MinPlatform] [PATCH v2 3/3] Removing build batch files from ClevoOpenBoardPkg, KabylakeOpenBoardPkg and PurleyOpenBoardPkg Agyeman, Prince 2 siblings, 0 replies; 5+ messages in thread From: Agyeman, Prince @ 2019-04-17 22:55 UTC (permalink / raw) To: devel Cc: Michael Kubacki, Michael D Kinney, Nate DeSimone, Liming Gao, Ankit Sinha, Bowen Zhou, Shifei A Lu Updated the build instructions to include the python script build instructions Cc: Michael Kubacki <michael.a.kubacki@intel.com> Cc: Michael D Kinney <michael.d.kinney@intel.com> Cc: Nate DeSimone <nathaniel.l.desimone@intel.com> Cc: Liming Gao <liming.gao@intel.com> Cc: Ankit Sinha <ankit.sinha@intel.com> Cc: Bowen Zhou<bowen.zhou@intel.com> Cc: Shifei A Lu <shifei.a.lu@intel.com> Contributed-under: TianoCore Contribution Agreement 1.0 Signed-off-by: Agyeman <prince.agyeman@intel.com> --- ReadMe.md | 37 +++++++++++++++++++++++++++++++++++++ 1 file changed, 37 insertions(+) diff --git a/ReadMe.md b/ReadMe.md index 72e332a476..a94d8051d6 100644 --- a/ReadMe.md +++ b/ReadMe.md @@ -105,6 +105,43 @@ return back to the minimum platform caller. ### Build +**Building with the python script** + +1. Open command window, go to the workspace directory, e.g. c:\Kabylake. +2. Type "cd edk2-platforms\Platform\Intel +3. Type "python BuildBios.py -p REPLACE_WITH_BOARD_NAME" + +* BuildBios.py Arguments: + + | Argument | Function | + | ----------------------|-------------------------------------| + | -h, --help | Show this help message and exit | + | --platform, -p | The platform to build | + | --toolchain, -t | Tool Chain to use in build process | + | --DEBUG, -d | Debug flag | + | --RELEASE, -r | Release flag | + | --TEST_RELEASE, -tr | Test Release flag | + | --RELEASE_PDB, -rp | Release flag | + | --list, -l | Lists available platforms | + | --cleanall | Cleans all | + | --capsule | Capsule build enabled | + | --silent | Silent build enabled | + | --performance | Performance build enabled | + | --fsp | Fsp build enabled | + | | + +* For more information on build options + * ``Type "python BuildBios.py -h"`` + +* Configuration Files + * ``The edk2-platforms\Platform\Intel\Build.json file contains the default settings used by BuildBios.py`` + * ``The default settings are under the DEFAULT_CONFIG field`` + * ``Each board can have a settings JSON file that will override the edk2-platforms\Platform\Intel\Build.json settings`` + * ``An example of a board specific settings:`` + * ``edk2-platforms\Platform\Intel\KabylakeOpenBoardPkg\KabylakeRvp3\BuildConfig.json`` + + +**Building with the batch scripts** For KabylakeOpenBoardPkg 1. Open command window, go to the workspace directory, e.g. c:\Kabylake. 2. Type "cd edk2-platforms\Platform\Intel\KabylakeOpenBoardPkg\KabylakeRvp3". -- 2.19.1.windows.1 ^ permalink raw reply related [flat|nested] 5+ messages in thread
* [edk2-platforms/devel-MinPlatform] [PATCH v2 3/3] Removing build batch files from ClevoOpenBoardPkg, KabylakeOpenBoardPkg and PurleyOpenBoardPkg 2019-04-17 22:55 [edk2-platforms/devel-MinPlatform] [PATCH v2 0/3] Added python build scipts to minplaform Agyeman, Prince 2019-04-17 22:55 ` [edk2-platforms/devel-MinPlatform] [PATCH v2 1/3] Platform/Intel: Added python build script Agyeman, Prince 2019-04-17 22:55 ` [edk2-platforms/devel-MinPlatform] [PATCH v2 2/3] ReadMe.md: Update the build instructions Agyeman, Prince @ 2019-04-17 22:55 ` Agyeman, Prince 2 siblings, 0 replies; 5+ messages in thread From: Agyeman, Prince @ 2019-04-17 22:55 UTC (permalink / raw) To: devel Cc: Michael Kubacki, Nate DeSimone, Ankit Sinha, Michael D Kinney, Isaac W Oram, Liming Gao, Bowen Zhou, Shifei A Lu These are being removed as they have been replaced with the python build scripts Cc: Michael Kubacki <michael.a.kubacki@intel.com> Cc: Nate DeSimone <nathaniel.l.desimone@intel.com> Cc: Ankit Sinha <ankit.sinha@intel.com> Cc: Michael D Kinney <michael.d.kinney@intel.com> Cc: Isaac W Oram <isaac.w.oram@intel.com> Cc: Liming Gao <liming.gao@intel.com> Cc: Bowen Zhou<bowen.zhou@intel.com> Cc: Shifei A Lu <shifei.a.lu@intel.com> Contributed-under: TianoCore Contribution Agreement 0.1 Signed-off-by: Agyeman <prince.agyeman@intel.com> --- .../ClevoOpenBoardPkg/N1xxWU/GitEdk2Clevo.bat | 85 ------- .../Intel/ClevoOpenBoardPkg/N1xxWU/bld.bat | 165 ------------- .../Intel/ClevoOpenBoardPkg/N1xxWU/cln.bat | 54 ----- .../ClevoOpenBoardPkg/N1xxWU/postbuild.bat | 45 ---- .../ClevoOpenBoardPkg/N1xxWU/prebuild.bat | 220 ----------------- .../Intel/ClevoOpenBoardPkg/N1xxWU/prep.bat | 85 ------- .../KabylakeRvp3/GitEdk2MinKabylake.bat | 85 ------- .../KabylakeOpenBoardPkg/KabylakeRvp3/bld.bat | 165 ------------- .../KabylakeOpenBoardPkg/KabylakeRvp3/cln.bat | 54 ----- .../KabylakeRvp3/postbuild.bat | 45 ---- .../KabylakeRvp3/prebuild.bat | 221 ------------------ .../KabylakeRvp3/prep.bat | 85 ------- .../BoardMtOlympus/GitEdk2MinMtOlympus.bat | 86 ------- .../PurleyOpenBoardPkg/BoardMtOlympus/bld.bat | 144 ------------ .../BoardMtOlympus/postbuild.bat | 101 -------- .../BoardMtOlympus/prebuild.bat | 203 ---------------- ReadMe.md | 27 --- 17 files changed, 1870 deletions(-) delete mode 100644 Platform/Intel/ClevoOpenBoardPkg/N1xxWU/GitEdk2Clevo.bat delete mode 100644 Platform/Intel/ClevoOpenBoardPkg/N1xxWU/bld.bat delete mode 100644 Platform/Intel/ClevoOpenBoardPkg/N1xxWU/cln.bat delete mode 100644 Platform/Intel/ClevoOpenBoardPkg/N1xxWU/postbuild.bat delete mode 100644 Platform/Intel/ClevoOpenBoardPkg/N1xxWU/prebuild.bat delete mode 100644 Platform/Intel/ClevoOpenBoardPkg/N1xxWU/prep.bat delete mode 100644 Platform/Intel/KabylakeOpenBoardPkg/KabylakeRvp3/GitEdk2MinKabylake.bat delete mode 100644 Platform/Intel/KabylakeOpenBoardPkg/KabylakeRvp3/bld.bat delete mode 100644 Platform/Intel/KabylakeOpenBoardPkg/KabylakeRvp3/cln.bat delete mode 100644 Platform/Intel/KabylakeOpenBoardPkg/KabylakeRvp3/postbuild.bat delete mode 100644 Platform/Intel/KabylakeOpenBoardPkg/KabylakeRvp3/prebuild.bat delete mode 100644 Platform/Intel/KabylakeOpenBoardPkg/KabylakeRvp3/prep.bat delete mode 100644 Platform/Intel/PurleyOpenBoardPkg/BoardMtOlympus/GitEdk2MinMtOlympus.bat delete mode 100644 Platform/Intel/PurleyOpenBoardPkg/BoardMtOlympus/bld.bat delete mode 100644 Platform/Intel/PurleyOpenBoardPkg/BoardMtOlympus/postbuild.bat delete mode 100644 Platform/Intel/PurleyOpenBoardPkg/BoardMtOlympus/prebuild.bat diff --git a/Platform/Intel/ClevoOpenBoardPkg/N1xxWU/GitEdk2Clevo.bat b/Platform/Intel/ClevoOpenBoardPkg/N1xxWU/GitEdk2Clevo.bat deleted file mode 100644 index 9a34a9a2d2..0000000000 --- a/Platform/Intel/ClevoOpenBoardPkg/N1xxWU/GitEdk2Clevo.bat +++ /dev/null @@ -1,85 +0,0 @@ -@REM @file -@REM -@REM Copyright (c) 2019, Intel Corporation. All rights reserved.<BR> -@REM This program and the accompanying materials -@REM are licensed and made available under the terms and conditions of the BSD License -@REM which accompanies this distribution. The full text of the license may be found at -@REM http://opensource.org/licenses/bsd-license.php -@REM -@REM THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, -@REM WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. -@REM - -@echo off - -pushd ..\..\..\..\..\ - -@REM Set WORKSPACE environment. -set WORKSPACE=%cd% -echo. -echo Set WORKSPACE as: %WORKSPACE% -echo. - -@REM Check whether Git has been installed and been added to system path. -git --help >nul 2>nul -if %ERRORLEVEL% NEQ 0 ( - echo. - echo The 'git' command is not recognized. - echo Please make sure that Git is installed and has been added to system path. - echo. - goto :EOF -) - -@REM Create the Conf directory under WORKSPACE -if not exist %WORKSPACE%\Conf ( - mkdir Conf -) - -@REM Set other environments. -@REM Basic Rule: -@REM Platform override Silicon override Core -@REM Source override Binary - -set PACKAGES_PATH=%WORKSPACE%\edk2-platforms\Platform\Intel;%WORKSPACE%\edk2-platforms\Silicon\Intel;%WORKSPACE%\edk2-non-osi\Silicon\Intel;%WORKSPACE%\FSP;%WORKSPACE%\edk2;%WORKSPACE% -set EDK_TOOLS_BIN=%WORKSPACE%\edk2-BaseTools-win32 - -@if not defined PYTHON_HOME ( - @if exist C:\Python27 ( - set PYTHON_HOME=C:\Python27 - ) -) - -set EDK_SETUP_OPTION= -@rem if python is installed, disable the binary base tools. -if defined PYTHON_HOME ( - set EDK_TOOLS_BIN= - set EDK_SETUP_OPTION=--nt32 -) -pushd %WORKSPACE%\edk2 -call edksetup.bat %EDK_SETUP_OPTION% -popd -pushd %WORKSPACE% -@rem if python is installed, nmake BaseTools source and enable BaseTools source build -@if defined PYTHON_HOME ( - nmake -f %BASE_TOOLS_PATH%\Makefile -) -popd - -set openssl_path=%WORKSPACE% - -popd - -goto :EOF - -:Help -echo. -echo Usage: -echo GitEdk2.bat [-w Workspace_Directory] (optional) [-b Branch_Name] (optional) -echo. -echo -w A absolute/relative path to be the workspace. -echo Default value is the current directory. -echo. -echo -b The branch name of the repository. Currently, only master, udk2015, -echo trunk (same as master) and bp13 (same as udk2015) are supported. -echo Default value is master. -echo. diff --git a/Platform/Intel/ClevoOpenBoardPkg/N1xxWU/bld.bat b/Platform/Intel/ClevoOpenBoardPkg/N1xxWU/bld.bat deleted file mode 100644 index 03c8f98d93..0000000000 --- a/Platform/Intel/ClevoOpenBoardPkg/N1xxWU/bld.bat +++ /dev/null @@ -1,165 +0,0 @@ -@REM @file -@REM -@REM Copyright (c) 2019, Intel Corporation. All rights reserved.<BR> -@REM This program and the accompanying materials -@REM are licensed and made available under the terms and conditions of the BSD License -@REM which accompanies this distribution. The full text of the license may be found at -@REM http://opensource.org/licenses/bsd-license.php -@REM -@REM THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, -@REM WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. -@REM - -:: Useage: bld [/s] [/f <FEATURE_PCD_NAME> <FALSE or TRUE>] [/r] -:: -:: For a given build command, 3 options may be passed into this batch file via command prompt: -:: 1) /s = Redirects all output to a file called EDK2.log(Prep.log must be existed), which will be located at the root. -:: 2) /f = Defines the passing in of a single override to a feature PCD that is used in the platform -:: DSC file. If this parameter is used, it is to be followed immediately after by both the feature -:: pcd name and value. FeaturePcd is the full PCD name, like gMinPlatformPkgTokenSpaceGuid.PcdOptimizeCompilerEnable -:: 3) /r = Useful for faster rebuilds when no changes have been made to .inf files. Passes -u to -:: build.exe to skip the generation of makefiles. -:: 4) rom = Build Bios.rom only and building SPIs will be skipped. -:: - -@echo on - -cd %WORKSPACE% - -@REM -@REM Build FSP Binary -@REM -@if not defined FSP_BINARY_BUILD goto :SkipFspBinaryBuild -@if %FSP_BINARY_BUILD% EQU FALSE goto :SkipFspBinaryBuild -@set FSP_BUILD_PARAMETER=/d -@set FSP_PKG_NAME=KabylakeFspPkg -@if /I "%TARGET%" == "RELEASE" ( - @if "%FSP_TEST_RELEASE%"=="TRUE" ( - set FSP_BUILD_PARAMETER=/tr - ) else ( - set FSP_BUILD_PARAMETER=/r - ) -) - -@if %FSP_WRAPPER_BUILD% EQU FALSE goto :BldEnd -:SkipFspBinaryBuild - -@if %FSP_WRAPPER_BUILD% EQU FALSE goto :SkipPatchFspBinFvsBaseAddress -del /f %WORKSPACE_FSP_BIN%\KabylakeFspBinPkg\Fsp_Rebased*.fd - -cd %WORKSPACE% - -if exist %WORKSPACE_PLATFORM%\%PROJECT%\OpenBoardPkgPcd.dsc attrib -r %WORKSPACE_PLATFORM%\%PROJECT%\OpenBoardPkgPcd.dsc -@call %PYTHON_HOME%\python.exe %WORKSPACE_PLATFORM%\%PLATFORM_PACKAGE%\Tools\Fsp\RebaseAndPatchFspBinBaseAddress.py %WORKSPACE_PLATFORM%\%PROJECT%\Include\Fdf\FlashMapInclude.fdf %WORKSPACE_FSP_BIN%\KabylakeFspBinPkg Fsp.fd %WORKSPACE_PLATFORM%\%PROJECT%\OpenBoardPkgPcd.dsc 0x0 - -@if %ERRORLEVEL% NEQ 0 ( - @echo !!! ERROR:RebaseAndPatchFspBinBaseAddress failed!!! - set SCRIPT_ERROR=1 - goto :BldFail -) - -cd %WORKSPACE% - -copy /y /b %WORKSPACE_FSP_BIN%\KabylakeFspBinPkg\Fsp_Rebased_S.fd+%WORKSPACE_FSP_BIN%\KabylakeFspBinPkg\Fsp_Rebased_M.fd+%WORKSPACE_FSP_BIN%\KabylakeFspBinPkg\Fsp_Rebased_T.fd %WORKSPACE_FSP_BIN%\KabylakeFspBinPkg\Fsp_Rebased.fd -:SkipPatchFspBinFvsBaseAddress - - -@SET SILENT_MODE=FALSE -@SET REBUILD_MODE= -@SET BUILD_ROM_ONLY= - -:: Loop through arguements until all are processed - -:BUILD_FLAGS_LOOP - -@if "%~1" == "" goto BUILD_FLAGS_LOOP_DONE - -@if "%~1" == "/f" ( - shift - goto BUILD_FLAGS_LOOP -) -@if "%~1" == "/s" ( - SET SILENT_MODE=TRUE - shift - goto BUILD_FLAGS_LOOP -) -@if "%~1" == "/r" ( - SET REBUILD_MODE=-u - shift - goto BUILD_FLAGS_LOOP -) -@if "%~1" == "rom" ( - SET BUILD_ROM_ONLY=rom - shift - goto BUILD_FLAGS_LOOP -) -:: Unknown build flag. -shift -goto BUILD_FLAGS_LOOP -:BUILD_FLAGS_LOOP_DONE - -:: Output the build variables the user has selected. - -@echo. -@echo User Selected build options: -@echo SILENT_MODE = %SILENT_MODE% -@echo REBUILD_MODE = %REBUILD_MODE% -@echo BUILD_ROM_ONLY = %BUILD_ROM_ONLY% -@echo. - -@if %SILENT_MODE% EQU TRUE goto BldSilent - -call build -n %NUMBER_OF_PROCESSORS% %REBUILD_MODE% %EXT_BUILD_FLAGS% - -@if %ERRORLEVEL% NEQ 0 goto BldFail -@echo. -@echo Running postbuild.bat to complete the build process. -@echo. -call %WORKSPACE_PLATFORM%\%PROJECT%\postbuild.bat %BUILD_ROM_ONLY% -@if %SCRIPT_ERROR% EQU 1 goto BldFail -@goto BldSuccess - -:BldSilent -@if exist Build.log del Build.log - -@echo. > Build.log -@echo ************************************************************************ >> Build.log -@echo *********** Build.bat is launched here *********** >> Build.log -@echo ************************************************************************ >> Build.log -@echo. >> Build.log - -call build -n %NUMBER_OF_PROCESSORS% %REBUILD_MODE% %EXT_BUILD_FLAGS% 1>>Build.log 2>&1 - -@if %ERRORLEVEL% NEQ 0 goto BldFail -@echo. >> Build.log -@echo Running postbuild.bat to complete the build process. >> Build.log -@echo. >> Build.log -@call %WORKSPACE_PLATFORM%\%PROJECT%\postbuild.bat %BUILD_ROM_ONLY% 1>>Build.log 2>&1 -@If %SCRIPT_ERROR% EQU 1 goto BldFail - -:BldSuccess -@echo. -@echo TARGET: %TARGET% -@echo TOOL_CHAIN_TAG: %TOOL_CHAIN_TAG% -@echo BIOS location: %BUILD_DIR%\FV -@echo. -@echo The EDKII BIOS build has successfully completed! -@echo. -@REM - -@goto BldEnd - -:BldFail -cd %WORKSPACE_PLATFORM%\%PROJECT% -@echo. -@echo The EDKII BIOS Build has failed! -@echo. -@exit /b 1 - -:BldEnd -@if %SILENT_MODE% EQU TRUE ( - @if exist EDK2.log del EDK2.log - @if exist Prep.log if exist Build.log copy Prep.log+Build.log EDK2.log -) - -cd %WORKSPACE_PLATFORM%\%PROJECT% \ No newline at end of file diff --git a/Platform/Intel/ClevoOpenBoardPkg/N1xxWU/cln.bat b/Platform/Intel/ClevoOpenBoardPkg/N1xxWU/cln.bat deleted file mode 100644 index d4d98dd135..0000000000 --- a/Platform/Intel/ClevoOpenBoardPkg/N1xxWU/cln.bat +++ /dev/null @@ -1,54 +0,0 @@ -@REM @file -@REM -@REM Copyright (c) 2019, Intel Corporation. All rights reserved.<BR> -@REM This program and the accompanying materials -@REM are licensed and made available under the terms and conditions of the BSD License -@REM which accompanies this distribution. The full text of the license may be found at -@REM http://opensource.org/licenses/bsd-license.php -@REM -@REM THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, -@REM WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. -@REM - -@echo off -echo. -echo Run build cleanall... -echo. - -cd .. - -if not defined WORKSPACE set WORKSPACE=%cd% -if not defined WORKSPACE_PLATFORM set WORKSPACE_PLATFORM=%cd% -if not defined WORKSPACE_SILICON set WORKSPACE_SILICON=%cd% - -REM build cleanall - -echo. -echo Directories to clean... -echo. - -if exist %WORKSPACE%\build rmdir /q /s %WORKSPACE%\build -if exist %WORKSPACE%\conf\.cache rmdir /q /s %WORKSPACE%\conf\.cache - -echo. -echo Files to clean... -echo. - -if exist %WORKSPACE%\edk2.log del %WORKSPACE%\edk2.log -if exist %WORKSPACE%\Conf\build_rule.txt del %WORKSPACE%\Conf\build_rule.txt -if exist %WORKSPACE%\Conf\FrameworkDatabase.db del %WORKSPACE%\Conf\FrameworkDatabase.db -if exist %WORKSPACE%\Conf\target.txt del %WORKSPACE%\Conf\target.txt -if exist %WORKSPACE%\Conf\tools_def.txt del %WORKSPACE%\Conf\tools_def.txt -@REM *.c.c is generated by Catalog Debug feature across code tree. -@REM -del /s *.c.c > nul 2>&1 - -cd %WORKSPACE_PLATFORM%\%PROJECT% - -del /f /q Prep.log > nul 2>&1 -del /f /q ..\Build.log > nul 2>&1 - -echo. -echo All done... -echo. -@echo on diff --git a/Platform/Intel/ClevoOpenBoardPkg/N1xxWU/postbuild.bat b/Platform/Intel/ClevoOpenBoardPkg/N1xxWU/postbuild.bat deleted file mode 100644 index 70be663897..0000000000 --- a/Platform/Intel/ClevoOpenBoardPkg/N1xxWU/postbuild.bat +++ /dev/null @@ -1,45 +0,0 @@ -@REM @file -@REM -@REM Copyright (c) 2019, Intel Corporation. All rights reserved.<BR> -@REM This program and the accompanying materials -@REM are licensed and made available under the terms and conditions of the BSD License -@REM which accompanies this distribution. The full text of the license may be found at -@REM http://opensource.org/licenses/bsd-license.php -@REM -@REM THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, -@REM WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. -@REM - -@REM # -@REM # Module Name: -@REM # -@REM # postbuild.bat -@REM # -@REM # Abstract: -@REM # -@REM # Post build script. -@REM # -@REM #--*/ - -@set SCRIPT_ERROR=0 - -@if /I not "%0" == "%WORKSPACE_PLATFORM%\%PROJECT%\postbuild.bat" ( - if /I not "%0" == "%WORKSPACE_PLATFORM%\%PROJECT%\postbuild" ( - echo. - echo !!! ERROR !!! This postbuild.bat must run under workspace root using "%WORKSPACE_PLATFORM%\%PROJECT%\postbuild.bat" !!! - echo. - set SCRIPT_ERROR=1 - goto :EOF - ) -) - -@cd %WORKSPACE_PLATFORM% - -@cd %WORKSPACE% - -@if %FSP_WRAPPER_BUILD% EQU TRUE ( - del /f %WORKSPACE_FSP_BIN%\KabylakeFspBinPkg\Fsp_Rebased*.fd -) - -@if %FSP_WRAPPER_BUILD% EQU TRUE exit /b - diff --git a/Platform/Intel/ClevoOpenBoardPkg/N1xxWU/prebuild.bat b/Platform/Intel/ClevoOpenBoardPkg/N1xxWU/prebuild.bat deleted file mode 100644 index c3360403f1..0000000000 --- a/Platform/Intel/ClevoOpenBoardPkg/N1xxWU/prebuild.bat +++ /dev/null @@ -1,220 +0,0 @@ -@REM @file -@REM Pre build script. -@REM -@REM Copyright (c) 2019, Intel Corporation. All rights reserved.<BR> -@REM This program and the accompanying materials -@REM are licensed and made available under the terms and conditions of the BSD License -@REM which accompanies this distribution. The full text of the license may be found at -@REM http://opensource.org/licenses/bsd-license.php -@REM -@REM THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, -@REM WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. -@REM - -cd .. - -@REM -@REM Set build capsule flag with default being OFF -@REM - -@set CAPSULE_BUILD=0 - -@if /I "%2" == "TRUE" ( - @set CAPSULE_BUILD=1 - goto StartCapsulePrep -) - -:StartCapsulePrep -@REM -@REM Define platform specific environment variables. -@REM -if not defined WORKSPACE_PLATFORM set WORKSPACE_PLATFORM=%WORKSPACE%\edk2-platforms\Platform\Intel -if not defined WORKSPACE_SILICON set WORKSPACE_SILICON=%WORKSPACE%\edk2-platforms\Silicon\Intel -if not defined WORKSPACE_PLATFORM_BIN set WORKSPACE_PLATFORM_BIN=%WORKSPACE%\edk2-non-osi\Platform\Intel -if not defined WORKSPACE_SILICON_BIN set WORKSPACE_SILICON_BIN=%WORKSPACE%\edk2-non-osi\Silicon\Intel -if not defined WORKSPACE_FSP_BIN set WORKSPACE_FSP_BIN=%WORKSPACE%\FSP -if not defined WORKSPACE_CORE set WORKSPACE_CORE=%WORKSPACE%\edk2 -if not defined PLATFORM_PACKAGE set PLATFORM_PACKAGE=MinPlatformPkg -if not defined PLATFORM_BOARD_PACKAGE set PLATFORM_BOARD_PACKAGE=ClevoOpenBoardPkg -if not defined BOARD set BOARD=N1xxWU -if not defined PROJECT set PROJECT=%PLATFORM_BOARD_PACKAGE%\%BOARD% - -@set SCRIPT_ERROR=0 - -@set CATALOG_DEBUG=0 - -@REM Set basic environment. -@echo. -@echo Prebuild: Run edksetup.bat batch file. -@echo. -@if %CATALOG_DEBUG% == 0 ( - @del Conf\build_rule.txt -) -cd %WORKSPACE_CORE% -@call edksetup.bat -cd %WORKSPACE% -@set EFI_SOURCE=%WORKSPACE_CORE% - -@REM -@REM Setup Visual Studio environment. Order of precedence is 2012, 2013, 2010 and then 2008. -@REM -@REM NOTE: To override precedence set TOOL_CHAIN_TAG before calling prep.bat. -@REM Example: set TOOL_CHAIN_TAG=VS2008 -@REM - -@REM Check if tool chain has not been selected and Visual Studio 2014 is installed. -@if not defined TOOL_CHAIN_TAG ( - if defined VS140COMNTOOLS ( - set TOOL_CHAIN_TAG=VS2015 - ) -) - -@REM If Visual Studio 2014 is selected by priority or by preference, setup the environment variables. -@if /I "%TOOL_CHAIN_TAG%"=="VS2015" ( - echo. - echo Prebuild: Set the VS2015 environment. - echo. - if not defined VSINSTALLDIR call "%VS140COMNTOOLS%\vsvars32.bat" - if /I "%VS140COMNTOOLS%" == "C:\Program Files\Microsoft Visual Studio 14.0\Common7\Tools\" ( - set TOOL_CHAIN_TAG=VS2015 - ) else ( - set TOOL_CHAIN_TAG=VS2015x86 - ) -) - -@REM Check if tool chain has not been selected and Visual Studio 2013 is installed. -@if not defined TOOL_CHAIN_TAG ( - if defined VS120COMNTOOLS ( - set TOOL_CHAIN_TAG=VS2013 - ) -) - -@REM If Visual Studio 2013 is selected by priority or by preference, setup the environment variables. -@if /I "%TOOL_CHAIN_TAG%"=="VS2013" ( - echo. - echo Prebuild: Set the VS2013 environment. - echo. - if not defined VSINSTALLDIR call "%VS120COMNTOOLS%\vsvars32.bat" - if /I "%VS120COMNTOOLS%" == "C:\Program Files\Microsoft Visual Studio 12.0\Common7\Tools\" ( - set TOOL_CHAIN_TAG=VS2013 - ) else ( - set TOOL_CHAIN_TAG=VS2013x86 - ) -) - -@REM If no supported version of Visual Studio was detected, return an error. -@if not defined TOOL_CHAIN_TAG ( - echo. - echo !!! ERROR !!! Visual Studio not installed correctly!!! - echo. - set SCRIPT_ERROR=1 - goto :EndPreBuild -) - -echo Show CL revision -cl - -@REM Set build TARGET. -@if /I "%1" == "" ( - set TARGET=DEBUG - set TARGET_SHORT=D -) else if /I "%1" == "DEBUG" ( - set TARGET=DEBUG - set TARGET_SHORT=D -) else if /I "%1" == "TEST_RELEASE" ( - set TARGET=RELEASE - set TARGET_SHORT=R -) else if /I "%1" == "RELEASE" ( - set TARGET=RELEASE - set TARGET_SHORT=R -) else if /I "%1" == "RELEASE_PDB" ( - set TARGET=RELEASE - set TARGET_SHORT=R -) else ( - echo. - echo !!! ERROR !!! Incorrect TARGET option for prebuild.bat. !!! - echo. - set SCRIPT_ERROR=1 - goto :EndPreBuild -) - -@set BUILD_DIR_PATH=%WORKSPACE%\Build\%PROJECT%\%TARGET%_%TOOL_CHAIN_TAG% -@set BUILD_DIR=Build\%PROJECT%\%TARGET%_%TOOL_CHAIN_TAG% -@set BUILD_X64=%BUILD_DIR_PATH%\X64 -@set BUILD_IA32=%BUILD_DIR_PATH%\IA32 - - -@echo. -@echo Prebuild: Set build environment. -@echo. -@if not exist %BUILD_DIR_PATH% ( - mkdir %BUILD_DIR_PATH% -) - -@findstr /V "ACTIVE_PLATFORM TARGET TARGET_ARCH TOOL_CHAIN_TAG BUILD_RULE_CONF" %WORKSPACE%\Conf\target.txt > %BUILD_DIR_PATH%\target.txt -@echo ACTIVE_PLATFORM = %WORKSPACE_PLATFORM%/%PLATFORM_BOARD_PACKAGE%/%BOARD%/OpenBoardPkg.dsc >> %BUILD_DIR_PATH%\target.txt -@echo TARGET = %TARGET% >> %BUILD_DIR_PATH%\target.txt -@echo TARGET_ARCH = IA32 X64 >> %BUILD_DIR_PATH%\target.txt -@echo TOOL_CHAIN_TAG = %TOOL_CHAIN_TAG% >> %BUILD_DIR_PATH%\target.txt -@echo BUILD_RULE_CONF = Conf/build_rule.txt >> %BUILD_DIR_PATH%\target.txt -@move /Y %BUILD_DIR_PATH%\target.txt Conf - -@if %CAPSULE_BUILD% == 1 ( - goto EndCapsulePrep -) - -@REM -@REM Set %FSP_WRAPPER_BUILD% -@REM -@set FSP_WRAPPER_BUILD=TRUE - -@if %FSP_WRAPPER_BUILD% EQU TRUE ( - @REM Create dummy Fsp_Rebased_S_padded.fd to build the BiosInfo.inf if it is wrapper build, due to the SECTION inclusion - echo "" > %WORKSPACE_FSP_BIN%\KabylakeFspBinPkg\Fsp_Rebased_S_padded.fd - attrib -r %WORKSPACE_FSP_BIN%\KabylakeFspBinPkg\Fsp_Rebased_S_padded.fd -) - -@REM -@REM Set %PERFORMANCE_BUILD% -@REM -@set PERFORMANCE_BUILD=FALSE - -@REM -@REM Set %FSP_BINARY_BUILD% and %FSP_TEST_RELEASE% -@REM -@set FSP_BINARY_BUILD=FALSE -@set FSP_TEST_RELEASE=FALSE - -@if "FSP_BINARY_BUILD"=="TRUE" ( - @if %FSP_WRAPPER_BUILD% EQU FALSE goto :EndPreBuild -) - -@if not exist %BUILD_X64% ( - mkdir %BUILD_X64% -) - -@set SECURE_BOOT_ENABLE=FALSE - -@REM -@REM Skip BIOS_SIZE_OPTION if it is predefined -@REM -@if NOT "%BIOS_SIZE_OPTION%" == "" goto BiosSizeDone - -@set BIOS_SIZE_OPTION= - -@REM default size option is 6M -@set BIOS_SIZE_OPTION=-DBIOS_SIZE_OPTION=SIZE_60 - -:BiosSizeDone -@echo BIOS_SIZE_OPTION=%BIOS_SIZE_OPTION% - -@echo EFI_SOURCE = %EFI_SOURCE% -@echo TARGET = %TARGET% -@echo TARGET_ARCH = IA32 X64 -@echo TOOL_CHAIN_TAG = %TOOL_CHAIN_TAG% -@echo WORKSPACE = %WORKSPACE% -@echo WORKSPACE_CORE = %WORKSPACE_CORE% -@echo EXT_BUILD_FLAGS = %EXT_BUILD_FLAGS% -@echo. -:EndPreBuild -cd %WORKSPACE_PLATFORM%\%PROJECT% diff --git a/Platform/Intel/ClevoOpenBoardPkg/N1xxWU/prep.bat b/Platform/Intel/ClevoOpenBoardPkg/N1xxWU/prep.bat deleted file mode 100644 index 46a514b9ed..0000000000 --- a/Platform/Intel/ClevoOpenBoardPkg/N1xxWU/prep.bat +++ /dev/null @@ -1,85 +0,0 @@ -@REM @file -@REM -@REM Copyright (c) 2019, Intel Corporation. All rights reserved.<BR> -@REM This program and the accompanying materials -@REM are licensed and made available under the terms and conditions of the BSD License -@REM which accompanies this distribution. The full text of the license may be found at -@REM http://opensource.org/licenses/bsd-license.php -@REM -@REM THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, -@REM WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. -@REM - -@echo OFF -@set PrepRELEASE=DEBUG -@set SILENT_MODE=FALSE -@set CapsuleBuild=FALSE - -@set EXT_CONFIG_CLEAR= -@set EXT_BUILD_FLAGS= - -:CmdLineParse -if "" == "%1" ( - goto Continue -) else if "r" == "%1" ( - set PrepRELEASE=RELEASE -) else if "tr" == "%1" ( - set PrepRELEASE=TEST_RELEASE -) else if "rp" == "%1" ( - set PrepRELEASE=RELEASE_PDB -) else if "s" == "%1" ( - set SILENT_MODE=TRUE -) else if "help" == "%1" ( - goto PrepHelp -) else ( - echo Invalid input arguments: %1 - echo. - goto PrepHelp -) -SHIFT -goto CmdLineParse - -:PrepHelp -@echo Preparation for BIOS build. -@echo. -@echo prep [r][rp][s][help] -@echo. -@echo r To do release build. Default is debug build. See note 1 -@echo rp To do release build with Symbols - For source level debugging. See note 1 -@echo s To build in silent mode. . See note 1 -@echo. -@echo 1) Re-running prep without these arguments cannot be used for -@echo incremental build. Hence, these inputs must be supplied each time -@echo prep are desired to be re-run. -@echo. -goto PrepDone - -:Continue -@echo ============================================== - -if exist %WORKSPACE%\Prep.log del %WORKSPACE%\Prep.log - -:PrepReleaseCheck - -@if %SILENT_MODE% EQU TRUE goto BldSilent - -call prebuild.bat %PrepRelease% %CapsuleBuild% -goto PrePrepDone - -:BldSilent -@echo ************************************************************************ >> %WORKSPACE%\Prep.log -@echo *********** Prebuild.bat is launched here *********** >> %WORKSPACE%\Prep.log -@echo ************************************************************************ >> %WORKSPACE%\Prep.log -call prebuild.bat %PrepRelease% %CapsuleBuild% 1>>%WORKSPACE%\Prep.log 2>&1 - -:PrePrepDone -@If %SCRIPT_ERROR% EQU 1 goto PrepFail -@goto PrepDone - -:PrepFail -@echo. -@echo !! The EDKII BIOS build has failed in prep! -@echo. -@exit /b 1 - -:PrepDone \ No newline at end of file diff --git a/Platform/Intel/KabylakeOpenBoardPkg/KabylakeRvp3/GitEdk2MinKabylake.bat b/Platform/Intel/KabylakeOpenBoardPkg/KabylakeRvp3/GitEdk2MinKabylake.bat deleted file mode 100644 index 4e13ed18e5..0000000000 --- a/Platform/Intel/KabylakeOpenBoardPkg/KabylakeRvp3/GitEdk2MinKabylake.bat +++ /dev/null @@ -1,85 +0,0 @@ -@REM @file -@REM -@REM Copyright (c) 2017, Intel Corporation. All rights reserved.<BR> -@REM This program and the accompanying materials -@REM are licensed and made available under the terms and conditions of the BSD License -@REM which accompanies this distribution. The full text of the license may be found at -@REM http://opensource.org/licenses/bsd-license.php -@REM -@REM THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, -@REM WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. -@REM - -@echo off - -pushd ..\..\..\..\..\ - -@REM Set WORKSPACE environment. -set WORKSPACE=%cd% -echo. -echo Set WORKSPACE as: %WORKSPACE% -echo. - -@REM Check whether Git has been installed and been added to system path. -git --help >nul 2>nul -if %ERRORLEVEL% NEQ 0 ( - echo. - echo The 'git' command is not recognized. - echo Please make sure that Git is installed and has been added to system path. - echo. - goto :EOF -) - -@REM Create the Conf directory under WORKSPACE -if not exist %WORKSPACE%\Conf ( - mkdir Conf -) - -@REM Set other environments. -@REM Basic Rule: -@REM Platform override Silicon override Core -@REM Source override Binary - -set PACKAGES_PATH=%WORKSPACE%\edk2-platforms\Platform\Intel;%WORKSPACE%\edk2-platforms\Silicon\Intel;%WORKSPACE%\edk2-non-osi\Silicon\Intel;%WORKSPACE%\FSP;%WORKSPACE%\edk2;%WORKSPACE% -set EDK_TOOLS_BIN=%WORKSPACE%\edk2-BaseTools-win32 - -@if not defined PYTHON_HOME ( - @if exist C:\Python27 ( - set PYTHON_HOME=C:\Python27 - ) -) - -set EDK_SETUP_OPTION= -@rem if python is installed, disable the binary base tools. -if defined PYTHON_HOME ( - set EDK_TOOLS_BIN= - set EDK_SETUP_OPTION=--nt32 -) -pushd %WORKSPACE%\edk2 -call edksetup.bat %EDK_SETUP_OPTION% -popd -pushd %WORKSPACE% -@rem if python is installed, nmake BaseTools source and enable BaseTools source build -@if defined PYTHON_HOME ( - nmake -f %BASE_TOOLS_PATH%\Makefile -) -popd - -set openssl_path=%WORKSPACE% - -popd - -goto :EOF - -:Help -echo. -echo Usage: -echo GitEdk2.bat [-w Workspace_Directory] (optional) [-b Branch_Name] (optional) -echo. -echo -w A absolute/relative path to be the workspace. -echo Default value is the current directory. -echo. -echo -b The branch name of the repository. Currently, only master, udk2015, -echo trunk (same as master) and bp13 (same as udk2015) are supported. -echo Default value is master. -echo. diff --git a/Platform/Intel/KabylakeOpenBoardPkg/KabylakeRvp3/bld.bat b/Platform/Intel/KabylakeOpenBoardPkg/KabylakeRvp3/bld.bat deleted file mode 100644 index e0ad5eefdc..0000000000 --- a/Platform/Intel/KabylakeOpenBoardPkg/KabylakeRvp3/bld.bat +++ /dev/null @@ -1,165 +0,0 @@ -@REM @file -@REM -@REM Copyright (c) 2017, Intel Corporation. All rights reserved.<BR> -@REM This program and the accompanying materials -@REM are licensed and made available under the terms and conditions of the BSD License -@REM which accompanies this distribution. The full text of the license may be found at -@REM http://opensource.org/licenses/bsd-license.php -@REM -@REM THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, -@REM WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. -@REM - -:: Useage: bld [/s] [/f <FEATURE_PCD_NAME> <FALSE or TRUE>] [/r] -:: -:: For a given build command, 3 options may be passed into this batch file via command prompt: -:: 1) /s = Redirects all output to a file called EDK2.log(Prep.log must be existed), which will be located at the root. -:: 2) /f = Defines the passing in of a single override to a feature PCD that is used in the platform -:: DSC file. If this parameter is used, it is to be followed immediately after by both the feature -:: pcd name and value. FeaturePcd is the full PCD name, like gMinPlatformPkgTokenSpaceGuid.PcdOptimizeCompilerEnable -:: 3) /r = Useful for faster rebuilds when no changes have been made to .inf files. Passes -u to -:: build.exe to skip the generation of makefiles. -:: 4) rom = Build Bios.rom only and building SPIs will be skipped. -:: - -@echo on - -cd %WORKSPACE% - -@REM -@REM Build FSP Binary -@REM -@if not defined FSP_BINARY_BUILD goto :SkipFspBinaryBuild -@if %FSP_BINARY_BUILD% EQU FALSE goto :SkipFspBinaryBuild -@set FSP_BUILD_PARAMETER=/d -@set FSP_PKG_NAME=KabylakeFspPkg -@if /I "%TARGET%" == "RELEASE" ( - @if "%FSP_TEST_RELEASE%"=="TRUE" ( - set FSP_BUILD_PARAMETER=/tr - ) else ( - set FSP_BUILD_PARAMETER=/r - ) -) - -@if %FSP_WRAPPER_BUILD% EQU FALSE goto :BldEnd -:SkipFspBinaryBuild - -@if %FSP_WRAPPER_BUILD% EQU FALSE goto :SkipPatchFspBinFvsBaseAddress -del /f %WORKSPACE_FSP_BIN%\KabylakeFspBinPkg\Fsp_Rebased*.fd - -cd %WORKSPACE% - -if exist %WORKSPACE_PLATFORM%\%PROJECT%\OpenBoardPkgPcd.dsc attrib -r %WORKSPACE_PLATFORM%\%PROJECT%\OpenBoardPkgPcd.dsc -@call %PYTHON_HOME%\python.exe %WORKSPACE_PLATFORM%\%PLATFORM_PACKAGE%\Tools\Fsp\RebaseAndPatchFspBinBaseAddress.py %WORKSPACE_PLATFORM%\%PLATFORM_BOARD_PACKAGE%\Include\Fdf\FlashMapInclude.fdf %WORKSPACE_FSP_BIN%\KabylakeFspBinPkg Fsp.fd %WORKSPACE_PLATFORM%\%PROJECT%\OpenBoardPkgPcd.dsc 0x0 - -@if %ERRORLEVEL% NEQ 0 ( - @echo !!! ERROR:RebaseAndPatchFspBinBaseAddress failed!!! - set SCRIPT_ERROR=1 - goto :BldFail -) - -cd %WORKSPACE% - -copy /y /b %WORKSPACE_FSP_BIN%\KabylakeFspBinPkg\Fsp_Rebased_S.fd+%WORKSPACE_FSP_BIN%\KabylakeFspBinPkg\Fsp_Rebased_M.fd+%WORKSPACE_FSP_BIN%\KabylakeFspBinPkg\Fsp_Rebased_T.fd %WORKSPACE_FSP_BIN%\KabylakeFspBinPkg\Fsp_Rebased.fd -:SkipPatchFspBinFvsBaseAddress - - -@SET SILENT_MODE=FALSE -@SET REBUILD_MODE= -@SET BUILD_ROM_ONLY= - -:: Loop through arguements until all are processed - -:BUILD_FLAGS_LOOP - -@if "%~1" == "" goto BUILD_FLAGS_LOOP_DONE - -@if "%~1" == "/f" ( - shift - goto BUILD_FLAGS_LOOP -) -@if "%~1" == "/s" ( - SET SILENT_MODE=TRUE - shift - goto BUILD_FLAGS_LOOP -) -@if "%~1" == "/r" ( - SET REBUILD_MODE=-u - shift - goto BUILD_FLAGS_LOOP -) -@if "%~1" == "rom" ( - SET BUILD_ROM_ONLY=rom - shift - goto BUILD_FLAGS_LOOP -) -:: Unknown build flag. -shift -goto BUILD_FLAGS_LOOP -:BUILD_FLAGS_LOOP_DONE - -:: Output the build variables the user has selected. - -@echo. -@echo User Selected build options: -@echo SILENT_MODE = %SILENT_MODE% -@echo REBUILD_MODE = %REBUILD_MODE% -@echo BUILD_ROM_ONLY = %BUILD_ROM_ONLY% -@echo. - -@if %SILENT_MODE% EQU TRUE goto BldSilent - -call build -n %NUMBER_OF_PROCESSORS% %REBUILD_MODE% %EXT_BUILD_FLAGS% - -@if %ERRORLEVEL% NEQ 0 goto BldFail -@echo. -@echo Running postbuild.bat to complete the build process. -@echo. -call %WORKSPACE_PLATFORM%\%PROJECT%\postbuild.bat %BUILD_ROM_ONLY% -@if %SCRIPT_ERROR% EQU 1 goto BldFail -@goto BldSuccess - -:BldSilent -@if exist Build.log del Build.log - -@echo. > Build.log -@echo ************************************************************************ >> Build.log -@echo *********** Build.bat is launched here *********** >> Build.log -@echo ************************************************************************ >> Build.log -@echo. >> Build.log - -call build -n %NUMBER_OF_PROCESSORS% %REBUILD_MODE% %EXT_BUILD_FLAGS% 1>>Build.log 2>&1 - -@if %ERRORLEVEL% NEQ 0 goto BldFail -@echo. >> Build.log -@echo Running postbuild.bat to complete the build process. >> Build.log -@echo. >> Build.log -@call %WORKSPACE_PLATFORM%\%PROJECT%\postbuild.bat %BUILD_ROM_ONLY% 1>>Build.log 2>&1 -@If %SCRIPT_ERROR% EQU 1 goto BldFail - -:BldSuccess -@echo. -@echo TARGET: %TARGET% -@echo TOOL_CHAIN_TAG: %TOOL_CHAIN_TAG% -@echo BIOS location: %BUILD_DIR%\FV -@echo. -@echo The EDKII BIOS build has successfully completed! -@echo. -@REM - -@goto BldEnd - -:BldFail -cd %WORKSPACE_PLATFORM%\%PROJECT% -@echo. -@echo The EDKII BIOS Build has failed! -@echo. -@exit /b 1 - -:BldEnd -@if %SILENT_MODE% EQU TRUE ( - @if exist EDK2.log del EDK2.log - @if exist Prep.log if exist Build.log copy Prep.log+Build.log EDK2.log -) - -cd %WORKSPACE_PLATFORM%\%PROJECT% \ No newline at end of file diff --git a/Platform/Intel/KabylakeOpenBoardPkg/KabylakeRvp3/cln.bat b/Platform/Intel/KabylakeOpenBoardPkg/KabylakeRvp3/cln.bat deleted file mode 100644 index 8c4e0f51e6..0000000000 --- a/Platform/Intel/KabylakeOpenBoardPkg/KabylakeRvp3/cln.bat +++ /dev/null @@ -1,54 +0,0 @@ -@REM @file -@REM -@REM Copyright (c) 2017, Intel Corporation. All rights reserved.<BR> -@REM This program and the accompanying materials -@REM are licensed and made available under the terms and conditions of the BSD License -@REM which accompanies this distribution. The full text of the license may be found at -@REM http://opensource.org/licenses/bsd-license.php -@REM -@REM THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, -@REM WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. -@REM - -@echo off -echo. -echo Run build cleanall... -echo. - -cd .. - -if not defined WORKSPACE set WORKSPACE=%cd% -if not defined WORKSPACE_PLATFORM set WORKSPACE_PLATFORM=%cd% -if not defined WORKSPACE_SILICON set WORKSPACE_SILICON=%cd% - -REM build cleanall - -echo. -echo Directories to clean... -echo. - -if exist %WORKSPACE%\build rmdir /q /s %WORKSPACE%\build -if exist %WORKSPACE%\conf\.cache rmdir /q /s %WORKSPACE%\conf\.cache - -echo. -echo Files to clean... -echo. - -if exist %WORKSPACE%\edk2.log del %WORKSPACE%\edk2.log -if exist %WORKSPACE%\Conf\build_rule.txt del %WORKSPACE%\Conf\build_rule.txt -if exist %WORKSPACE%\Conf\FrameworkDatabase.db del %WORKSPACE%\Conf\FrameworkDatabase.db -if exist %WORKSPACE%\Conf\target.txt del %WORKSPACE%\Conf\target.txt -if exist %WORKSPACE%\Conf\tools_def.txt del %WORKSPACE%\Conf\tools_def.txt -@REM *.c.c is generated by Catalog Debug feature across code tree. -@REM -del /s *.c.c > nul 2>&1 - -cd %WORKSPACE_PLATFORM%\%PROJECT% - -del /f /q Prep.log > nul 2>&1 -del /f /q ..\Build.log > nul 2>&1 - -echo. -echo All done... -echo. -@echo on diff --git a/Platform/Intel/KabylakeOpenBoardPkg/KabylakeRvp3/postbuild.bat b/Platform/Intel/KabylakeOpenBoardPkg/KabylakeRvp3/postbuild.bat deleted file mode 100644 index a39319fd9f..0000000000 --- a/Platform/Intel/KabylakeOpenBoardPkg/KabylakeRvp3/postbuild.bat +++ /dev/null @@ -1,45 +0,0 @@ -@REM @file -@REM -@REM Copyright (c) 2017, Intel Corporation. All rights reserved.<BR> -@REM This program and the accompanying materials -@REM are licensed and made available under the terms and conditions of the BSD License -@REM which accompanies this distribution. The full text of the license may be found at -@REM http://opensource.org/licenses/bsd-license.php -@REM -@REM THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, -@REM WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. -@REM - -@REM # -@REM # Module Name: -@REM # -@REM # postbuild.bat -@REM # -@REM # Abstract: -@REM # -@REM # Post build script. -@REM # -@REM #--*/ - -@set SCRIPT_ERROR=0 - -@if /I not "%0" == "%WORKSPACE_PLATFORM%\%PROJECT%\postbuild.bat" ( - if /I not "%0" == "%WORKSPACE_PLATFORM%\%PROJECT%\postbuild" ( - echo. - echo !!! ERROR !!! This postbuild.bat must run under workspace root using "%WORKSPACE_PLATFORM%\%PROJECT%\postbuild.bat" !!! - echo. - set SCRIPT_ERROR=1 - goto :EOF - ) -) - -@cd %WORKSPACE_PLATFORM% - -@cd %WORKSPACE% - -@if %FSP_WRAPPER_BUILD% EQU TRUE ( - del /f %WORKSPACE_FSP_BIN%\KabylakeFspBinPkg\Fsp_Rebased*.fd -) - -@if %FSP_WRAPPER_BUILD% EQU TRUE exit /b - diff --git a/Platform/Intel/KabylakeOpenBoardPkg/KabylakeRvp3/prebuild.bat b/Platform/Intel/KabylakeOpenBoardPkg/KabylakeRvp3/prebuild.bat deleted file mode 100644 index 2861eec08f..0000000000 --- a/Platform/Intel/KabylakeOpenBoardPkg/KabylakeRvp3/prebuild.bat +++ /dev/null @@ -1,221 +0,0 @@ -@REM @file -@REM Pre build script. -@REM -@REM Copyright (c) 2017, Intel Corporation. All rights reserved.<BR> -@REM This program and the accompanying materials -@REM are licensed and made available under the terms and conditions of the BSD License -@REM which accompanies this distribution. The full text of the license may be found at -@REM http://opensource.org/licenses/bsd-license.php -@REM -@REM THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, -@REM WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. -@REM - -cd .. - - -@REM -@REM Set build capsule flag with default being OFF -@REM - -@set CAPSULE_BUILD=0 - -@if /I "%2" == "TRUE" ( - @set CAPSULE_BUILD=1 - goto StartCapsulePrep -) - -:StartCapsulePrep -@REM -@REM Define platform specific environment variables. -@REM -if not defined WORKSPACE_PLATFORM set WORKSPACE_PLATFORM=%WORKSPACE%\edk2-platforms\Platform\Intel -if not defined WORKSPACE_SILICON set WORKSPACE_SILICON=%WORKSPACE%\edk2-platforms\Silicon\Intel -if not defined WORKSPACE_PLATFORM_BIN set WORKSPACE_PLATFORM_BIN=%WORKSPACE%\edk2-non-osi\Platform\Intel -if not defined WORKSPACE_SILICON_BIN set WORKSPACE_SILICON_BIN=%WORKSPACE%\edk2-non-osi\Silicon\Intel -if not defined WORKSPACE_FSP_BIN set WORKSPACE_FSP_BIN=%WORKSPACE%\FSP -if not defined WORKSPACE_CORE set WORKSPACE_CORE=%WORKSPACE%\edk2 -if not defined PLATFORM_PACKAGE set PLATFORM_PACKAGE=MinPlatformPkg -if not defined PLATFORM_BOARD_PACKAGE set PLATFORM_BOARD_PACKAGE=KabylakeOpenBoardPkg -if not defined BOARD set BOARD=KabylakeRvp3 -if not defined PROJECT set PROJECT=%PLATFORM_BOARD_PACKAGE%\%BOARD% - -@set SCRIPT_ERROR=0 - -@set CATALOG_DEBUG=0 - -@REM Set basic environment. -@echo. -@echo Prebuild: Run edksetup.bat batch file. -@echo. -@if %CATALOG_DEBUG% == 0 ( - @del Conf\build_rule.txt -) -cd %WORKSPACE_CORE% -@call edksetup.bat -cd %WORKSPACE% -@set EFI_SOURCE=%WORKSPACE_CORE% - -@REM -@REM Setup Visual Studio environment. Order of precedence is 2012, 2013, 2010 and then 2008. -@REM -@REM NOTE: To override precedence set TOOL_CHAIN_TAG before calling prep.bat. -@REM Example: set TOOL_CHAIN_TAG=VS2008 -@REM - -@REM Check if tool chain has not been selected and Visual Studio 2014 is installed. -@if not defined TOOL_CHAIN_TAG ( - if defined VS140COMNTOOLS ( - set TOOL_CHAIN_TAG=VS2015 - ) -) - -@REM If Visual Studio 2014 is selected by priority or by preference, setup the environment variables. -@if /I "%TOOL_CHAIN_TAG%"=="VS2015" ( - echo. - echo Prebuild: Set the VS2015 environment. - echo. - if not defined VSINSTALLDIR call "%VS140COMNTOOLS%\vsvars32.bat" - if /I "%VS140COMNTOOLS%" == "C:\Program Files\Microsoft Visual Studio 14.0\Common7\Tools\" ( - set TOOL_CHAIN_TAG=VS2015 - ) else ( - set TOOL_CHAIN_TAG=VS2015x86 - ) -) - -@REM Check if tool chain has not been selected and Visual Studio 2013 is installed. -@if not defined TOOL_CHAIN_TAG ( - if defined VS120COMNTOOLS ( - set TOOL_CHAIN_TAG=VS2013 - ) -) - -@REM If Visual Studio 2013 is selected by priority or by preference, setup the environment variables. -@if /I "%TOOL_CHAIN_TAG%"=="VS2013" ( - echo. - echo Prebuild: Set the VS2013 environment. - echo. - if not defined VSINSTALLDIR call "%VS120COMNTOOLS%\vsvars32.bat" - if /I "%VS120COMNTOOLS%" == "C:\Program Files\Microsoft Visual Studio 12.0\Common7\Tools\" ( - set TOOL_CHAIN_TAG=VS2013 - ) else ( - set TOOL_CHAIN_TAG=VS2013x86 - ) -) - -@REM If no supported version of Visual Studio was detected, return an error. -@if not defined TOOL_CHAIN_TAG ( - echo. - echo !!! ERROR !!! Visual Studio not installed correctly!!! - echo. - set SCRIPT_ERROR=1 - goto :EndPreBuild -) - -echo Show CL revision -cl - -@REM Set build TARGET. -@if /I "%1" == "" ( - set TARGET=DEBUG - set TARGET_SHORT=D -) else if /I "%1" == "DEBUG" ( - set TARGET=DEBUG - set TARGET_SHORT=D -) else if /I "%1" == "TEST_RELEASE" ( - set TARGET=RELEASE - set TARGET_SHORT=R -) else if /I "%1" == "RELEASE" ( - set TARGET=RELEASE - set TARGET_SHORT=R -) else if /I "%1" == "RELEASE_PDB" ( - set TARGET=RELEASE - set TARGET_SHORT=R -) else ( - echo. - echo !!! ERROR !!! Incorrect TARGET option for prebuild.bat. !!! - echo. - set SCRIPT_ERROR=1 - goto :EndPreBuild -) - -@set BUILD_DIR_PATH=%WORKSPACE%\Build\%PROJECT%\%TARGET%_%TOOL_CHAIN_TAG% -@set BUILD_DIR=Build\%PROJECT%\%TARGET%_%TOOL_CHAIN_TAG% -@set BUILD_X64=%BUILD_DIR_PATH%\X64 -@set BUILD_IA32=%BUILD_DIR_PATH%\IA32 - - -@echo. -@echo Prebuild: Set build environment. -@echo. -@if not exist %BUILD_DIR_PATH% ( - mkdir %BUILD_DIR_PATH% -) - -@findstr /V "ACTIVE_PLATFORM TARGET TARGET_ARCH TOOL_CHAIN_TAG BUILD_RULE_CONF" %WORKSPACE%\Conf\target.txt > %BUILD_DIR_PATH%\target.txt -@echo ACTIVE_PLATFORM = %WORKSPACE_PLATFORM%/%PLATFORM_BOARD_PACKAGE%/%BOARD%/OpenBoardPkg.dsc >> %BUILD_DIR_PATH%\target.txt -@echo TARGET = %TARGET% >> %BUILD_DIR_PATH%\target.txt -@echo TARGET_ARCH = IA32 X64 >> %BUILD_DIR_PATH%\target.txt -@echo TOOL_CHAIN_TAG = %TOOL_CHAIN_TAG% >> %BUILD_DIR_PATH%\target.txt -@echo BUILD_RULE_CONF = Conf/build_rule.txt >> %BUILD_DIR_PATH%\target.txt -@move /Y %BUILD_DIR_PATH%\target.txt Conf - -@if %CAPSULE_BUILD% == 1 ( - goto EndCapsulePrep -) - -@REM -@REM Set %FSP_WRAPPER_BUILD% -@REM -@set FSP_WRAPPER_BUILD=TRUE - -@if %FSP_WRAPPER_BUILD% EQU TRUE ( - @REM Create dummy Fsp_Rebased_S_padded.fd to build the BiosInfo.inf if it is wrapper build, due to the SECTION inclusion - echo "" > %WORKSPACE_FSP_BIN%\KabylakeFspBinPkg\Fsp_Rebased_S_padded.fd - attrib -r %WORKSPACE_FSP_BIN%\KabylakeFspBinPkg\Fsp_Rebased_S_padded.fd -) - -@REM -@REM Set %PERFORMANCE_BUILD% -@REM -@set PERFORMANCE_BUILD=FALSE - -@REM -@REM Set %FSP_BINARY_BUILD% and %FSP_TEST_RELEASE% -@REM -@set FSP_BINARY_BUILD=FALSE -@set FSP_TEST_RELEASE=FALSE - -@if "FSP_BINARY_BUILD"=="TRUE" ( - @if %FSP_WRAPPER_BUILD% EQU FALSE goto :EndPreBuild -) - -@if not exist %BUILD_X64% ( - mkdir %BUILD_X64% -) - -@set SECURE_BOOT_ENABLE=FALSE - -@REM -@REM Skip BIOS_SIZE_OPTION if it is predefined -@REM -@if NOT "%BIOS_SIZE_OPTION%" == "" goto BiosSizeDone - -@set BIOS_SIZE_OPTION= - -@REM default size option is 7M -@set BIOS_SIZE_OPTION=-DBIOS_SIZE_OPTION=SIZE_70 - -:BiosSizeDone -@echo BIOS_SIZE_OPTION=%BIOS_SIZE_OPTION% - -@echo EFI_SOURCE = %EFI_SOURCE% -@echo TARGET = %TARGET% -@echo TARGET_ARCH = IA32 X64 -@echo TOOL_CHAIN_TAG = %TOOL_CHAIN_TAG% -@echo WORKSPACE = %WORKSPACE% -@echo WORKSPACE_CORE = %WORKSPACE_CORE% -@echo EXT_BUILD_FLAGS = %EXT_BUILD_FLAGS% -@echo. -:EndPreBuild -cd %WORKSPACE_PLATFORM%\%PROJECT% diff --git a/Platform/Intel/KabylakeOpenBoardPkg/KabylakeRvp3/prep.bat b/Platform/Intel/KabylakeOpenBoardPkg/KabylakeRvp3/prep.bat deleted file mode 100644 index 68e664e435..0000000000 --- a/Platform/Intel/KabylakeOpenBoardPkg/KabylakeRvp3/prep.bat +++ /dev/null @@ -1,85 +0,0 @@ -@REM @file -@REM -@REM Copyright (c) 2017, Intel Corporation. All rights reserved.<BR> -@REM This program and the accompanying materials -@REM are licensed and made available under the terms and conditions of the BSD License -@REM which accompanies this distribution. The full text of the license may be found at -@REM http://opensource.org/licenses/bsd-license.php -@REM -@REM THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, -@REM WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. -@REM - -@echo OFF -@set PrepRELEASE=DEBUG -@set SILENT_MODE=FALSE -@set CapsuleBuild=FALSE - -@set EXT_CONFIG_CLEAR= -@set EXT_BUILD_FLAGS= - -:CmdLineParse -if "" == "%1" ( - goto Continue -) else if "r" == "%1" ( - set PrepRELEASE=RELEASE -) else if "tr" == "%1" ( - set PrepRELEASE=TEST_RELEASE -) else if "rp" == "%1" ( - set PrepRELEASE=RELEASE_PDB -) else if "s" == "%1" ( - set SILENT_MODE=TRUE -) else if "help" == "%1" ( - goto PrepHelp -) else ( - echo Invalid input arguments: %1 - echo. - goto PrepHelp -) -SHIFT -goto CmdLineParse - -:PrepHelp -@echo Preparation for BIOS build. -@echo. -@echo prep [r][rp][s][help] -@echo. -@echo r To do release build. Default is debug build. See note 1 -@echo rp To do release build with Symbols - For source level debugging. See note 1 -@echo s To build in silent mode. . See note 1 -@echo. -@echo 1) Re-running prep without these arguments cannot be used for -@echo incremental build. Hence, these inputs must be supplied each time -@echo prep are desired to be re-run. -@echo. -goto PrepDone - -:Continue -@echo ============================================== - -if exist %WORKSPACE%\Prep.log del %WORKSPACE%\Prep.log - -:PrepReleaseCheck - -@if %SILENT_MODE% EQU TRUE goto BldSilent - -call prebuild.bat %PrepRelease% %CapsuleBuild% -goto PrePrepDone - -:BldSilent -@echo ************************************************************************ >> %WORKSPACE%\Prep.log -@echo *********** Prebuild.bat is launched here *********** >> %WORKSPACE%\Prep.log -@echo ************************************************************************ >> %WORKSPACE%\Prep.log -call prebuild.bat %PrepRelease% %CapsuleBuild% 1>>%WORKSPACE%\Prep.log 2>&1 - -:PrePrepDone -@If %SCRIPT_ERROR% EQU 1 goto PrepFail -@goto PrepDone - -:PrepFail -@echo. -@echo !! The EDKII BIOS build has failed in prep! -@echo. -@exit /b 1 - -:PrepDone \ No newline at end of file diff --git a/Platform/Intel/PurleyOpenBoardPkg/BoardMtOlympus/GitEdk2MinMtOlympus.bat b/Platform/Intel/PurleyOpenBoardPkg/BoardMtOlympus/GitEdk2MinMtOlympus.bat deleted file mode 100644 index d1d488c131..0000000000 --- a/Platform/Intel/PurleyOpenBoardPkg/BoardMtOlympus/GitEdk2MinMtOlympus.bat +++ /dev/null @@ -1,86 +0,0 @@ -@REM @file -@REM -@REM Copyright (c) 2018, Intel Corporation. All rights reserved.<BR> -@REM This program and the accompanying materials -@REM are licensed and made available under the terms and conditions of the BSD License -@REM which accompanies this distribution. The full text of the license may be found at -@REM http://opensource.org/licenses/bsd-license.php -@REM -@REM THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, -@REM WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. -@REM - -@echo off - -pushd ..\..\..\..\..\ - -@REM Set WORKSPACE environment. -set WORKSPACE=%cd% -echo. -echo Set WORKSPACE as: %WORKSPACE% -echo. - -@REM Check whether Git has been installed and been added to system path. -git --help >nul 2>nul -if %ERRORLEVEL% NEQ 0 ( - echo. - echo The 'git' command is not recognized. - echo Please make sure that Git is installed and has been added to system path. - echo. - goto :EOF -) - -@REM Create the Conf directory under WORKSPACE -if not exist %WORKSPACE%\Conf ( - mkdir Conf -) - -@REM Set other environments. -@REM Basic Rule: -@REM Platform override Silicon override Core -@REM Source override Binary - -set PACKAGES_PATH=%WORKSPACE%\edk2-platforms\Platform\Intel;%WORKSPACE%\edk2-platforms\Silicon\Intel;%WORKSPACE%\edk2-non-osi\Silicon\Intel;%WORKSPACE%\edk2;%WORKSPACE% - -set EDK_TOOLS_BIN=%WORKSPACE%\edk2-BaseTools-win32 - -@if not defined PYTHON_HOME ( - @if exist C:\Python27 ( - set PYTHON_HOME=C:\Python27 - ) -) - -set EDK_SETUP_OPTION= -@rem if python is installed, disable the binary base tools. -if defined PYTHON_HOME ( - set EDK_TOOLS_BIN= - set EDK_SETUP_OPTION=--nt32 -) -pushd %WORKSPACE%\edk2 -call edksetup.bat %EDK_SETUP_OPTION% -popd -pushd %WORKSPACE% -@rem if python is installed, nmake BaseTools source and enable BaseTools source build -@if defined PYTHON_HOME ( - nmake -f %BASE_TOOLS_PATH%\Makefile -) -popd - -set openssl_path=%WORKSPACE% - -popd - -goto :EOF - -:Help -echo. -echo Usage: -echo GitEdk2.bat [-w Workspace_Directory] (optional) [-b Branch_Name] (optional) -echo. -echo -w A absolute/relative path to be the workspace. -echo Default value is the current directory. -echo. -echo -b The branch name of the repository. Currently, only master, udk2015, -echo trunk (same as master) and bp13 (same as udk2015) are supported. -echo Default value is master. -echo. diff --git a/Platform/Intel/PurleyOpenBoardPkg/BoardMtOlympus/bld.bat b/Platform/Intel/PurleyOpenBoardPkg/BoardMtOlympus/bld.bat deleted file mode 100644 index a66d19e66e..0000000000 --- a/Platform/Intel/PurleyOpenBoardPkg/BoardMtOlympus/bld.bat +++ /dev/null @@ -1,144 +0,0 @@ -@REM @file -@REM -@REM Copyright (c) 2018, Intel Corporation. All rights reserved.<BR> -@REM This program and the accompanying materials -@REM are licensed and made available under the terms and conditions of the BSD License -@REM which accompanies this distribution. The full text of the license may be found at -@REM http://opensource.org/licenses/bsd-license.php -@REM -@REM THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, -@REM WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. -@REM - -@echo off - -REM Run setlocal to take a snapshot of the environment variables. endlocal is called to restore the environment. -setlocal -set SCRIPT_ERROR=0 - -REM ---- Do NOT use :: for comments Inside of code blocks() ---- - -::********************************************************************** -:: Initial Setup -::********************************************************************** - -:parseCmdLine -if "%1"=="" goto :argumentCheck - -if /I "%1"=="debug" set TARGET=DEBUG -if /I "%1"=="release" set TARGET=RELEASE - -if /I "%1"=="clean" ( - set BUILD_TYPE=cleantree - call :cleantree - goto :EOF -) - -shift -GOTO :parseCmdLine - -:argumentCheck: - -if /I "%TARGET%" == "" ( - echo Info: debug/release argument is empty, use DEBUG as default - set TARGET=DEBUG -) - -REM Art to notify which board you're working on -echo. -type logo.txt -echo. - -:: -:: Build configuration -:: -set BUILD_REPORT_FLAGS= -set BUILD_CMD_LINE= -set BUILD_LOG=%WORKSPACE%\Build\build.log -set BUILD_REPORT=%WORKSPACE%\Build\BuildReport.txt - -del %BUILD_LOG% *.efi *.log 2>NUL - -echo -------------------------------------------------------------------------------------------- -echo. -echo Purley Build Start -echo. -echo -------------------------------------------------------------------------------------------- - - -:doPreBuild -echo. -echo -------------------------------------------------------------------- -echo. -echo Prebuild Start -echo. -echo -------------------------------------------------------------------- -call prebuild.bat -if %SCRIPT_ERROR% NEQ 0 EXIT /b %ERRORLEVEL% - -echo -------------------------------------------------------------------- -echo. -echo Prebuild End -echo. -echo -------------------------------------------------------------------- -if %ERRORLEVEL% NEQ 0 EXIT /b %ERRORLEVEL% -timeout 1 - -:buildBios -set BUILD_CMD_LINE=%BUILD_CMD_LINE% -D MAX_SOCKET=%MAX_SOCKET% -y %BUILD_REPORT% -echo -------------------------------------------------------------------- -echo. -echo Build Start -echo. -echo -------------------------------------------------------------------- -echo. -echo build %BUILD_CMD_LINE% --log=%BUILD_LOG% %BUILD_REPORT_FLAGS% -call build %BUILD_CMD_LINE% --log=%BUILD_LOG% %BUILD_REPORT_FLAGS% -echo -------------------------------------------------------------------- -echo. -echo Build End -echo. -echo -------------------------------------------------------------------- -if %ERRORLEVEL% NEQ 0 EXIT /b %ERRORLEVEL% -timeout 1 - -:postBuild - -echo -------------------------------------------------------------------- -echo. -echo PostBuild Start -echo. -echo -------------------------------------------------------------------- -echo. -call postbuild.bat -if %ERRORLEVEL% NEQ 0 EXIT /b %ERRORLEVEL% -timeout 1 -echo -------------------------------------------------------------------- -echo. -echo PostBuild End -echo. -echo -------------------------------------------------------------------- - -echo %date% %time% -echo. - -echo -------------------------------------------------------------------------------------------- -echo. -echo Purley Build End -echo. -echo -------------------------------------------------------------------------------------------- - -:done -endlocal & EXIT /b %SCRIPT_ERROR% - -::-------------------------------------------------------- -::-- Function section starts below here -::-------------------------------------------------------- -:cleantree -choice /t 3 /d y /m "Confirm: clean tree of intermediate files created in tree during build" -if %ERRORLEVEL% EQU 2 goto :EOF -goto :EOF - - -:ErrorHandler: -echo Error handler \ No newline at end of file diff --git a/Platform/Intel/PurleyOpenBoardPkg/BoardMtOlympus/postbuild.bat b/Platform/Intel/PurleyOpenBoardPkg/BoardMtOlympus/postbuild.bat deleted file mode 100644 index 5c787bb647..0000000000 --- a/Platform/Intel/PurleyOpenBoardPkg/BoardMtOlympus/postbuild.bat +++ /dev/null @@ -1,101 +0,0 @@ -@REM @file -@REM -@REM Copyright (c) 2018, Intel Corporation. All rights reserved.<BR> -@REM This program and the accompanying materials -@REM are licensed and made available under the terms and conditions of the BSD License -@REM which accompanies this distribution. The full text of the license may be found at -@REM http://opensource.org/licenses/bsd-license.php -@REM -@REM THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, -@REM WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. -@REM - -@set SCRIPT_ERROR=0 - -set /a postbuildstep=0 - -@echo. -@echo BoardPostBuild.%postbuildstep% python PatchBinFv.py -@set /a postbuildstep=%postbuildstep%+1 -echo python %WORKSPACE%\edk2-platforms\Platform\Intel\MinPlatformPkg\Tools\PatchFv\PatchBinFv.py %TARGET% %WORKSPACE%\edk2-non-osi\Silicon\Intel\PurleySiliconBinPkg %WORKSPACE%\Build\BuildReport.txt FvTempMemorySilicon -call %PYTHON_HOME%\python.exe %WORKSPACE%\edk2-platforms\Platform\Intel\MinPlatformPkg\Tools\PatchFv\PatchBinFv.py %TARGET% %WORKSPACE%\edk2-non-osi\Silicon\Intel\PurleySiliconBinPkg %WORKSPACE%\Build\BuildReport.txt FvTempMemorySilicon -if %ERRORLEVEL% NEQ 0 ( - set SCRIPT_ERROR=1 - echo PatchBinFv Error. Exit - goto :EOF -) -echo python %WORKSPACE%\edk2-platforms\Platform\Intel\MinPlatformPkg\Tools\PatchFv\PatchBinFv.py %TARGET% %WORKSPACE%\edk2-non-osi\Silicon\Intel\PurleySiliconBinPkg %WORKSPACE%\Build\BuildReport.txt FvPreMemorySilicon -call %PYTHON_HOME%\python.exe %WORKSPACE%\edk2-platforms\Platform\Intel\MinPlatformPkg\Tools\PatchFv\PatchBinFv.py %TARGET% %WORKSPACE%\edk2-non-osi\Silicon\Intel\PurleySiliconBinPkg %WORKSPACE%\Build\BuildReport.txt FvPreMemorySilicon -if %ERRORLEVEL% NEQ 0 ( - set SCRIPT_ERROR=1 - echo PatchBinFv Error. Exit - goto :EOF -) -echo python %WORKSPACE%\edk2-platforms\Platform\Intel\MinPlatformPkg\Tools\PatchFv\PatchBinFv.py %TARGET% %WORKSPACE%\edk2-non-osi\Silicon\Intel\PurleySiliconBinPkg %WORKSPACE%\Build\BuildReport.txt FvPostMemorySilicon -call %PYTHON_HOME%\python.exe %WORKSPACE%\edk2-platforms\Platform\Intel\MinPlatformPkg\Tools\PatchFv\PatchBinFv.py %TARGET% %WORKSPACE%\edk2-non-osi\Silicon\Intel\PurleySiliconBinPkg %WORKSPACE%\Build\BuildReport.txt FvPostMemorySilicon -if %ERRORLEVEL% NEQ 0 ( - set SCRIPT_ERROR=1 - echo PatchBinFv Error. Exit - goto :EOF -) -echo python %WORKSPACE%\edk2-platforms\Platform\Intel\MinPlatformPkg\Tools\PatchFv\PatchBinFv.py %TARGET% %WORKSPACE%\edk2-non-osi\Silicon\Intel\PurleySiliconBinPkg %WORKSPACE%\Build\BuildReport.txt FvLateSilicon -call %PYTHON_HOME%\python.exe %WORKSPACE%\edk2-platforms\Platform\Intel\MinPlatformPkg\Tools\PatchFv\PatchBinFv.py %TARGET% %WORKSPACE%\edk2-non-osi\Silicon\Intel\PurleySiliconBinPkg %WORKSPACE%\Build\BuildReport.txt FvLateSilicon -if %ERRORLEVEL% NEQ 0 ( - set SCRIPT_ERROR=1 - echo PatchBinFv Error. Exit - goto :EOF -) - -@echo. -@echo BoardPostBuild.%postbuildstep% python RebaseBinFv.py -@set /a postbuildstep=%postbuildstep%+1 -echo python %WORKSPACE%\edk2-platforms\Platform\Intel\MinPlatformPkg\Tools\PatchFv\RebaseBinFv.py %TARGET% %WORKSPACE%\edk2-non-osi\Silicon\Intel\PurleySiliconBinPkg %WORKSPACE%\Build\BuildReport.txt FvPreMemorySilicon gMinPlatformPkgTokenSpaceGuid.PcdFlashFvFspMBase -call %PYTHON_HOME%\python.exe %WORKSPACE%\edk2-platforms\Platform\Intel\MinPlatformPkg\Tools\PatchFv\RebaseBinFv.py %TARGET% %WORKSPACE%\edk2-non-osi\Silicon\Intel\PurleySiliconBinPkg %WORKSPACE%\Build\BuildReport.txt FvPreMemorySilicon gMinPlatformPkgTokenSpaceGuid.PcdFlashFvFspMBase -if %ERRORLEVEL% NEQ 0 ( - set SCRIPT_ERROR=1 - echo RebaseBinFv Error. Exit - goto :EOF -) - -echo python %WORKSPACE%\edk2-platforms\Platform\Intel\MinPlatformPkg\Tools\PatchFv\RebaseBinFv.py %TARGET% %WORKSPACE%\edk2-non-osi\Silicon\Intel\PurleySiliconBinPkg %WORKSPACE%\Build\BuildReport.txt FvPostMemorySilicon gMinPlatformPkgTokenSpaceGuid.PcdFlashFvFspSBase -call %PYTHON_HOME%\python.exe %WORKSPACE%\edk2-platforms\Platform\Intel\MinPlatformPkg\Tools\PatchFv\RebaseBinFv.py %TARGET% %WORKSPACE%\edk2-non-osi\Silicon\Intel\PurleySiliconBinPkg %WORKSPACE%\Build\BuildReport.txt FvPostMemorySilicon gMinPlatformPkgTokenSpaceGuid.PcdFlashFvFspSBase -if %ERRORLEVEL% NEQ 0 ( - set SCRIPT_ERROR=1 - echo RebaseBinFv Error. Exit - goto :EOF -) - -@echo. -@echo BoardPostBuild.%postbuildstep% re-generate FDS -@set /a postbuildstep=%postbuildstep%+1 -echo build fds -@REM call build fds -if %ERRORLEVEL% NEQ 0 ( - set SCRIPT_ERROR=1 - echo gen FDS Error. Exit - goto :EOF -) - -@echo. -@echo BoardPostBuild.%postbuildstep% python PatchBfv.py -@set /a postbuildstep=%postbuildstep%+1 -echo python %WORKSPACE%\edk2-platforms\Platform\Intel\MinPlatformPkg\Tools\PatchFv\PatchBfv.py %WORKSPACE%\Build\%BOARD_PKG%\%BOARD_NAME%\%TARGET%_%TOOL_CHAIN_TAG%\FV\PLATFORM.fd %WORKSPACE%\Build\BuildReport.txt gMinPlatformPkgTokenSpaceGuid.PcdFlashFvPreMemoryBase -call %PYTHON_HOME%\python.exe %WORKSPACE%\edk2-platforms\Platform\Intel\MinPlatformPkg\Tools\PatchFv\PatchBfv.py %WORKSPACE%\Build\%BOARD_PKG%\%BOARD_NAME%\%TARGET%_%TOOL_CHAIN_TAG%\FV\PLATFORM.fd %WORKSPACE%\Build\BuildReport.txt gMinPlatformPkgTokenSpaceGuid.PcdFlashFvPreMemoryBase -if %ERRORLEVEL% NEQ 0 ( - set SCRIPT_ERROR=1 - echo PatchBfv Error. Exit - goto :EOF -) - -:_done - -@echo. -@cd %WORKSPACE% -@if "%SCRIPT_ERROR%" == "0" ( - @echo PostBuild SUCCEEDED. -) else ( - @echo PostBuild FAILED. - Pause 0 -) - -EXIT /B %SCRIPT_ERROR% diff --git a/Platform/Intel/PurleyOpenBoardPkg/BoardMtOlympus/prebuild.bat b/Platform/Intel/PurleyOpenBoardPkg/BoardMtOlympus/prebuild.bat deleted file mode 100644 index 81a9634d51..0000000000 --- a/Platform/Intel/PurleyOpenBoardPkg/BoardMtOlympus/prebuild.bat +++ /dev/null @@ -1,203 +0,0 @@ -@REM @file -@REM -@REM Copyright (c) 2018, Intel Corporation. All rights reserved.<BR> -@REM This program and the accompanying materials -@REM are licensed and made available under the terms and conditions of the BSD License -@REM which accompanies this distribution. The full text of the license may be found at -@REM http://opensource.org/licenses/bsd-license.php -@REM -@REM THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, -@REM WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. -@REM - -@set SCRIPT_ERROR=0 - -set /a prebuildstep=0 - -call :check_BuildTools -if %SCRIPT_ERROR% NEQ 0 GOTO :done - -call :setBuildEnv -if %SCRIPT_ERROR% NEQ 0 GOTO :done - -call :createTargetTxt -if %SCRIPT_ERROR% NEQ 0 GOTO :done - -call :genPlatformOffsetHeaderFile -if %SCRIPT_ERROR% NEQ 0 GOTO :done - -:prebuildFinish -echo. -echo ACTIVE_PLATFORM = %WORKSPACE%\edk2-platforms\Platform\Intel\%BOARD_PKG%\%BOARD_NAME%\PlatformPkg.dsc -echo EDK_TOOLS_PATH = %EDK_TOOLS_PATH% -echo TARGET = %TARGET% -echo TARGET_ARCH = IA32 X64 -echo TOOL_CHAIN_TAG = %TOOL_CHAIN_TAG% -echo WORKSPACE = %WORKSPACE% -echo PACKAGES_PATH = %PACKAGES_PATH% -echo MAX_CONCURRENT_THREAD_NUMBER = %BUILD_MAX_CON_THREAD_NUM% -echo. -echo Build Path = %OUTPUT_DIR% -echo. - -REM Remove environment variable because it's no longer needed. -set BUILD_MAX_CON_THREAD_NUM= - -:done -REM Use done label to exit batch file and run any final steps; GOTO :EOF immediately exits. -EXIT /B %SCRIPT_ERROR% - -::-------------------------------------------------------- -::-- Function section starts below here -::-------------------------------------------------------- - -:cleanup_check_VSTools -set COMPILER_VERSION_STRING= -del cloutput.txt > nul -REM cleanup_check_VSTools is called below. When a label is called, 'GOTO :EOF' is used to return to caller. -GOTO :EOF - -:check_BuildTools -echo PreBuild.%prebuildstep% check_BuildTools -echo ..VSTools -set /a prebuildstep=%prebuildstep%+1 -set TOOL_CHAIN_TAG= -@if not defined TOOL_CHAIN_TAG ( - echo. - echo Prebuild: TOOL_CHAIN_TAG is not set before - echo. - - @if defined VS140COMNTOOLS ( - echo. - echo Set the VS2015 environment. - echo. - set CL_SEL=VS2015 - if /I "%VS140COMNTOOLS%" == "C:\Program Files\Microsoft Visual Studio 14.0\Common7\Tools\" ( - set TOOL_CHAIN_TAG=VS2015 - ) else ( - set TOOL_CHAIN_TAG=VS2015x86 - ) - if /I "%PROCESSOR_ARCHITECTURE%" == "AMD64" ( - set CL_CMDLINE="%VS140COMNTOOLS:~0,-14%VC\bin\amd64\cl.exe" - ) else ( - set CL_CMDLINE="%VS140COMNTOOLS:~0,-14%VC\bin\cl.exe" - ) - ) else if defined VS120COMNTOOLS ( - echo. - echo Set the VS2013 environment. - echo. - set CL_SEL=VS2013 - if /I "%VS120COMNTOOLS%" == "C:\Program Files\Microsoft Visual Studio 12.0\Common7\Tools\" ( - set TOOL_CHAIN_TAG=VS2013 - ) else ( - set TOOL_CHAIN_TAG=VS2013x86 - ) - if /I "%PROCESSOR_ARCHITECTURE%" == "AMD64" ( - set CL_CMDLINE="%VS120COMNTOOLS:~0,-14%VC\bin\amd64\cl.exe" - ) else ( - set CL_CMDLINE="%VS120COMNTOOLS:~0,-14%VC\bin\cl.exe" - ) - ) else ( - echo. - echo !!! ERROR !!! VS2015 or VS2013 not installed correctly. !!! - echo. - goto :ErrorExit - ) -) - -echo ..iASL -set CHECK_PATH_IASL=%IASL_PREFIX% -if not exist %CHECK_PATH_IASL%\iasl.exe ( - echo. - echo !!! ERROR !!! Could not find iASL compiler at %CHECK_PATH_IASL%\iasl.exe. !!! - echo. - set SCRIPT_ERROR=1 -) -set CHECK_PATH_IASL= - -echo ..NASM -set CHECK_PATH_NASM=c:\NASM -if not exist %CHECK_PATH_NASM%\nasm.exe ( - echo. - echo !!! ERROR !!! Could not find NASM compiler at %CHECK_PATH_NASM%\nasm.exe. !!! - echo. - set SCRIPT_ERROR=1 -) -set CHECK_PATH_NASM= - -echo ..Python -set CHECK_PATH_PYTHON=c:\Python27 -if not exist %CHECK_PATH_PYTHON%\python.exe ( - echo. - echo !!! ERROR !!! Could not find Python at %CHECK_PATH_PYTHON%\python.exe. !!! - echo. - set SCRIPT_ERROR=1 -) -set CHECK_PATH_PYTHON= -set PYTHON_HOME=C:\Python27 - -GOTO :EOF - -:setBuildEnv -echo PreBuild.%prebuildstep% SetBuildEnv -set /a prebuildstep=%prebuildstep%+1 - -@set BOARD_PKG=PurleyOpenBoardPkg -@set BOARD_NAME=BoardMtOlympus -@set MAX_SOCKET=2 - -echo. -echo BOARD_NAME=%BOARD_NAME% -echo BOARD_PKG=%BOARD_PKG% -echo MAX_SOCKET=%MAX_SOCKET% -echo TARGET=%TARGET% - -@set OUTPUT_DIR=%WORKSPACE%\Build\%BOARD_PKG%\%BOARD_NAME%\%TARGET%_%TOOL_CHAIN_TAG% - -if not exist %OUTPUT_DIR% mkdir %OUTPUT_DIR% -GOTO :EOF - -:createTargetTxt -echo PreBuild.%prebuildstep% CreateTargetTxt -set /a prebuildstep=%prebuildstep%+1 -set /a BUILD_MAX_CON_THREAD_NUM = %NUMBER_OF_PROCESSORS%-1 -@REM set /a BUILD_MAX_CON_THREAD_NUM = 1 -findstr /V "ACTIVE_PLATFORM TARGET TARGET_ARCH TOOL_CHAIN_TAG BUILD_RULE_CONF MAX_CONCURRENT_THREAD_NUMBER" %WORKSPACE%\Conf\target.txt > %OUTPUT_DIR%\target.txt 2>NUL -echo ACTIVE_PLATFORM = %WORKSPACE%/edk2-platforms/Platform/Intel/%BOARD_PKG%/%BOARD_NAME%/PlatformPkg.dsc >> %OUTPUT_DIR%\target.txt -echo TARGET = %TARGET% >> %OUTPUT_DIR%\target.txt -echo TARGET_ARCH = IA32 X64 >> %OUTPUT_DIR%\target.txt -echo TOOL_CHAIN_TAG = %TOOL_CHAIN_TAG% >> %OUTPUT_DIR%\target.txt -echo BUILD_RULE_CONF = Conf/build_rule.txt >> %OUTPUT_DIR%\target.txt -echo MAX_CONCURRENT_THREAD_NUMBER = %BUILD_MAX_CON_THREAD_NUM% >> %OUTPUT_DIR%\target.txt -if exist %WORKSPACE%\Conf\target.txt ( - del /f %WORKSPACE%\Conf\target.txt -) -move /Y %OUTPUT_DIR%\target.txt %WORKSPACE%\Conf\ > nul -if not exist %OUTPUT_DIR%\X64 mkdir %OUTPUT_DIR%\X64 -GOTO :EOF - - -:genPlatformOffsetHeaderFile -echo. -echo PreBuild.%prebuildstep% GenPlatformOffsetHeaderFile -set /a prebuildstep=%prebuildstep%+1 - -echo Info: re-generating PlatformOffset header files - -set PRE_BUILD_CMD_LINE=%BUILD_CMD_LINE% -D MAX_SOCKET=%MAX_SOCKET% -set PRE_BUILD_LOG=%WORKSPACE%\Build\prebuild.log -set PRE_BUILD_REPORT=%WORKSPACE%\Build\preBuildReport.txt - -echo build %PRE_BUILD_CMD_LINE% -m %BOARD_PKG%\Acpi\BoardAcpiDxe\Dsdt.inf -y %PRE_BUILD_REPORT% --log=%PRE_BUILD_LOG% -call build %PRE_BUILD_CMD_LINE% -m %BOARD_PKG%\Acpi\BoardAcpiDxe\Dsdt.inf -y %PRE_BUILD_REPORT% --log=%PRE_BUILD_LOG% -if %ERRORLEVEL% NEQ 0 EXIT /b %ERRORLEVEL% - -@REM PSYS == FIX0 -@REM MCTL == FIX8 -set AML_FILTER="\"PSYS\" .MCTL\" .FIX[0-9,A-Z]\"" -echo AML_FILTER=%AML_FILTER% -call %PYTHON_HOME%\python.exe %WORKSPACE%\edk2-platforms\Platform\Intel\MinPlatformPkg\Tools\AmlGenOffset\AmlGenOffset.py -d --aml_filter %AML_FILTER% -o %WORKSPACE%\edk2-platforms\Platform\Intel\%BOARD_PKG%\Acpi\BoardAcpiDxe\AmlOffsetTable.c %OUTPUT_DIR%\X64\PurleyOpenBoardPkg\Acpi\BoardAcpiDxe\DSDT\OUTPUT\Dsdt\WFPPlatform.offset.h -echo. -echo GenOffset done - -GOTO :EOF \ No newline at end of file diff --git a/ReadMe.md b/ReadMe.md index a94d8051d6..588e6be3a1 100644 --- a/ReadMe.md +++ b/ReadMe.md @@ -105,8 +105,6 @@ return back to the minimum platform caller. ### Build -**Building with the python script** - 1. Open command window, go to the workspace directory, e.g. c:\Kabylake. 2. Type "cd edk2-platforms\Platform\Intel 3. Type "python BuildBios.py -p REPLACE_WITH_BOARD_NAME" @@ -141,31 +139,6 @@ return back to the minimum platform caller. * ``edk2-platforms\Platform\Intel\KabylakeOpenBoardPkg\KabylakeRvp3\BuildConfig.json`` -**Building with the batch scripts** -For KabylakeOpenBoardPkg -1. Open command window, go to the workspace directory, e.g. c:\Kabylake. -2. Type "cd edk2-platforms\Platform\Intel\KabylakeOpenBoardPkg\KabylakeRvp3". -3. Type "GitEdk2MinKabylake.bat" to setup GIT environment. -4. Type "prep" and make prebuild finish for debug build, "prep r" for release build. -5. Type "bld" to build Kaby Lake reference platform UEFI firmware image. - -For PurleyOpenBoardPkg -1. Open command window, go to the workspace directory, e.g. c:\Purley. -2. Type "cd edk2-platforms\Platform\Intel\PurleyOpenBoardPkg\BoardMtOlympus". -3. Type "GitEdk2MinMtOlympus.bat" to setup GIT environment. -4. Type "bld" to build Purley Mt Olympus board UEFI firmware image, "bld release" for release build, "bld clean" to - remove intermediate files. - -The validated version of iasl compiler that can build MinPurley is 20180629. Older version may generate ACPI build -errors. - -For ClevoOpenBoardPkg -1. Open command window, go to the workspace directory, e.g. c:\Clevo. -2. Type "cd edk2-platforms\Platform\Intel\ClevoOpenBoardPkg\N1xxWU". -3. Type "GitEdk2Clevo.bat" to setup GIT environment. -4. Type "bld" to build Clevo UEFI firmware image, "bld release" for release build, "bld clean" to remove intermediate -files. - Users with access to the Intel proprietary FITC tool and ME ingredients can build full images for flash (BIOS + ME + DESC). -- 2.19.1.windows.1 ^ permalink raw reply related [flat|nested] 5+ messages in thread
end of thread, other threads:[~2019-04-20 0:36 UTC | newest] Thread overview: 5+ messages (download: mbox.gz follow: Atom feed -- links below jump to the message on this page -- 2019-04-17 22:55 [edk2-platforms/devel-MinPlatform] [PATCH v2 0/3] Added python build scipts to minplaform Agyeman, Prince 2019-04-17 22:55 ` [edk2-platforms/devel-MinPlatform] [PATCH v2 1/3] Platform/Intel: Added python build script Agyeman, Prince 2019-04-20 0:31 ` [edk2-devel] " Nate DeSimone 2019-04-17 22:55 ` [edk2-platforms/devel-MinPlatform] [PATCH v2 2/3] ReadMe.md: Update the build instructions Agyeman, Prince 2019-04-17 22:55 ` [edk2-platforms/devel-MinPlatform] [PATCH v2 3/3] Removing build batch files from ClevoOpenBoardPkg, KabylakeOpenBoardPkg and PurleyOpenBoardPkg Agyeman, Prince
This is a public inbox, see mirroring instructions for how to clone and mirror all data and code used for this inbox