From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mga05.intel.com (mga05.intel.com []) by mx.groups.io with SMTP id smtpd.web12.2802.1571179871556739360 for ; Tue, 15 Oct 2019 15:51:11 -0700 Authentication-Results: mx.groups.io; dkim=missing; spf=fail (domain: intel.com, ip: , mailfrom: prince.agyeman@intel.com) X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from orsmga008.jf.intel.com ([10.7.209.65]) by fmsmga105.fm.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 15 Oct 2019 15:51:10 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.67,301,1566889200"; d="scan'208";a="189501347" Received: from paagyema-desk2.amr.corp.intel.com ([10.24.15.58]) by orsmga008.jf.intel.com with ESMTP; 15 Oct 2019 15:51:10 -0700 From: "Agyeman, Prince" To: devel@edk2.groups.io Cc: Ankit Sinha , Nate DeSimone , Michael Kubacki Subject: [edk2-platforms] [PATCH v2 4/4] Platform/Intel: Add FIT generation tool Date: Tue, 15 Oct 2019 15:51:09 -0700 Message-Id: <20191015225109.18992-5-prince.agyeman@intel.com> X-Mailer: git-send-email 2.19.1.windows.1 In-Reply-To: <20191015225109.18992-1-prince.agyeman@intel.com> References: <20191015225109.18992-1-prince.agyeman@intel.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Added FitGen tool build and FIT generation to the BIOS build process. What was done: - Build the FIT generation tool - Added default/empty BIOS_INFO_GUID to the build.cfg - Added BIOS_INFO_GUID to GalagoPro3,KabylakeRvp3 and WhiskeylakeURvp's build_config.cfg This allows a board to specify the GUID associated with the BIOS Info PEIM to be used in the board's FIT generation. BIOS_INFO_GUID is passed as an argument to FitGen tool which allow the tool to locate the BIOS Info module to be used in FIT generation. Cc: Ankit Sinha Cc: Nate DeSimone Cc: Michael Kubacki Signed-off-by: Prince Agyeman --- .../GalagoPro3/build_config.cfg | 1 + .../KabylakeRvp3/build_config.cfg | 1 + .../WhiskeylakeURvp/build_config.cfg | 1 + Platform/Intel/build.cfg | 1 + Platform/Intel/build_bios.py | 57 +++++++++++++++++++ 5 files changed, 61 insertions(+) diff --git a/Platform/Intel/KabylakeOpenBoardPkg/GalagoPro3/build_config.cfg b/Platform/Intel/KabylakeOpenBoardPkg/GalagoPro3/build_config.cfg index 8c6c51abb4..458fe3d35d 100644 --- a/Platform/Intel/KabylakeOpenBoardPkg/GalagoPro3/build_config.cfg +++ b/Platform/Intel/KabylakeOpenBoardPkg/GalagoPro3/build_config.cfg @@ -31,3 +31,4 @@ FSP_PKG_NAME = KabylakeFspPkg FSP_BINARY_BUILD = FALSE FSP_TEST_RELEASE = FALSE SECURE_BOOT_ENABLE = FALSE +BIOS_INFO_GUID = C83BCE0E-6F16-4D3C-8D9F-4D6F5A032929 diff --git a/Platform/Intel/KabylakeOpenBoardPkg/KabylakeRvp3/build_config.cfg b/Platform/Intel/KabylakeOpenBoardPkg/KabylakeRvp3/build_config.cfg index 78f808bfaf..f6ae4b342a 100644 --- a/Platform/Intel/KabylakeOpenBoardPkg/KabylakeRvp3/build_config.cfg +++ b/Platform/Intel/KabylakeOpenBoardPkg/KabylakeRvp3/build_config.cfg @@ -33,3 +33,4 @@ FSP_PKG_NAME = AmberLakeFspPkg FSP_BINARY_BUILD = FALSE FSP_TEST_RELEASE = FALSE SECURE_BOOT_ENABLE = FALSE +BIOS_INFO_GUID = C83BCE0E-6F16-4D3C-8D9F-4D6F5A032929 diff --git a/Platform/Intel/WhiskeylakeOpenBoardPkg/WhiskeylakeURvp/build_config.cfg b/Platform/Intel/WhiskeylakeOpenBoardPkg/WhiskeylakeURvp/build_config.cfg index 1b0619bc1c..1dfe5ffd10 100644 --- a/Platform/Intel/WhiskeylakeOpenBoardPkg/WhiskeylakeURvp/build_config.cfg +++ b/Platform/Intel/WhiskeylakeOpenBoardPkg/WhiskeylakeURvp/build_config.cfg @@ -31,3 +31,4 @@ FSP_PKG_NAME = CoffeelakeSiliconPkg FSP_BINARY_BUILD = FALSE FSP_TEST_RELEASE = FALSE SECURE_BOOT_ENABLE = FALSE +BIOS_INFO_GUID = A842B2D2-5C88-44E9-A9E2-4830F26662B7 diff --git a/Platform/Intel/build.cfg b/Platform/Intel/build.cfg index 2040774d1b..6aee96694c 100644 --- a/Platform/Intel/build.cfg +++ b/Platform/Intel/build.cfg @@ -48,6 +48,7 @@ SECURE_BOOT_ENABLE = FALSE REBUILD_MODE = BUILD_ROM_ONLY = NUMBER_OF_PROCESSORS = 0 +BIOS_INFO_GUID = [PLATFORMS] diff --git a/Platform/Intel/build_bios.py b/Platform/Intel/build_bios.py index 46285df19a..ea098de705 100644 --- a/Platform/Intel/build_bios.py +++ b/Platform/Intel/build_bios.py @@ -196,6 +196,31 @@ def pre_build(build_config, build_type="DEBUG", silent=False, toolchain=None): if return_code != 0: build_failed(config) + # + # build platform silicon tools + # + # save the current workspace + saved_work_directory = config["WORKSPACE"] + # change the workspace to silicon tools directory + config["WORKSPACE"] = os.path.join(config["WORKSPACE_SILICON"], "Tools") + + command = ["nmake"] + if os.name == "posix": # linux + command = ["make"] + # add path to generated FitGen binary to + # environment path variable + config["PATH"] += os.pathsep + \ + os.path.join(config["BASE_TOOLS_PATH"], + "Source", "C", "bin") + + # build the silicon tools + _, _, result, return_code = execute_script(command, config, shell=shell) + if return_code != 0: + build_failed(config) + + # restore WORKSPACE environment variable + config["WORKSPACE"] = saved_work_directory + config["SILENT_MODE"] = 'TRUE' if silent else 'FALSE' print("==============================================") @@ -404,6 +429,35 @@ def post_build(config): :returns: nothing """ print("Running post_build to complete the build process.") + board_fd = config["BOARD"].upper() + final_fd = os.path.join(config["BUILD_DIR_PATH"], "FV", + "{}.fd".format(board_fd)) + + if config["BIOS_INFO_GUID"]: + # Generate the fit table + print("Generating FIT ...") + if os.path.isfile(final_fd): + temp_fd = os.path.join(config["BUILD_DIR_PATH"], "FV", + "{}_.fd".format(board_fd)) + shell = True + command = ["FitGen", "-D", + final_fd, temp_fd, "-NA", + "-I", config["BIOS_INFO_GUID"]] + + if os.name == "posix": # linux + shell = False + + _, _, result, return_code = execute_script(command, config, shell=shell) + if return_code != 0: + print("Error while generating fit") + else: + # copy output to final binary + shutil.copyfile(temp_fd, final_fd) + # remove temp file + os.remove(temp_fd) + else: + print("{} does not exist".format(final_fd)) + # remove temp file # Additional build scripts for this platform result = post_build_ex(config) @@ -426,6 +480,9 @@ def post_build(config): except OSError: pass + print("Done") + if os.path.isfile(final_fd): + print("Fd file can be found at {}".format(final_fd)) def build_failed(config): """Displays results when build fails -- 2.19.1.windows.1