From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mga02.intel.com (mga02.intel.com [134.134.136.20]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ml01.01.org (Postfix) with ESMTPS id 238FF21A18AA9 for ; Mon, 17 Apr 2017 19:20:05 -0700 (PDT) Received: from fmsmga004.fm.intel.com ([10.253.24.48]) by orsmga101.jf.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 17 Apr 2017 19:20:04 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.37,217,1488873600"; d="scan'208";a="250313521" Received: from fmsmsx106.amr.corp.intel.com ([10.18.124.204]) by fmsmga004.fm.intel.com with ESMTP; 17 Apr 2017 19:20:02 -0700 Received: from fmsmsx126.amr.corp.intel.com (10.18.125.43) by FMSMSX106.amr.corp.intel.com (10.18.124.204) with Microsoft SMTP Server (TLS) id 14.3.319.2; Mon, 17 Apr 2017 19:20:02 -0700 Received: from shsmsx104.ccr.corp.intel.com (10.239.4.70) by FMSMSX126.amr.corp.intel.com (10.18.125.43) with Microsoft SMTP Server (TLS) id 14.3.319.2; Mon, 17 Apr 2017 19:20:02 -0700 Received: from shsmsx103.ccr.corp.intel.com ([169.254.4.117]) by SHSMSX104.ccr.corp.intel.com ([10.239.4.70]) with mapi id 14.03.0319.002; Tue, 18 Apr 2017 10:19:59 +0800 From: "Zhu, Yonghong" To: "Kinney, Michael D" , "edk2-devel@lists.01.org" CC: "Gao, Liming" , "Shaw, Kevin W" , "Zhu, Yonghong" Thread-Topic: [edk2-BuildSpecification PATCH] Declare Pre/Post build scripts in [Defines] section Thread-Index: AQHSt9/whV/p8uY0J0WWrdzzkjBijaHKY6+Q Date: Tue, 18 Apr 2017 02:19:59 +0000 Message-ID: References: <1492477540-41700-1-git-send-email-michael.d.kinney@intel.com> <1492477540-41700-2-git-send-email-michael.d.kinney@intel.com> In-Reply-To: <1492477540-41700-2-git-send-email-michael.d.kinney@intel.com> Accept-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-originating-ip: [10.239.127.40] MIME-Version: 1.0 Subject: Re: [edk2-BuildSpecification PATCH] Declare Pre/Post build scripts in [Defines] section X-BeenThere: edk2-devel@lists.01.org X-Mailman-Version: 2.1.22 Precedence: list List-Id: EDK II Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 18 Apr 2017 02:20:05 -0000 Content-Language: en-US Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable Reviewed-by: Yonghong Zhu Best Regards, Zhu Yonghong -----Original Message----- From: Kinney, Michael D=20 Sent: Tuesday, April 18, 2017 9:06 AM To: edk2-devel@lists.01.org Cc: Gao, Liming ; Zhu, Yonghong ; Shaw, Kevin W Subject: [edk2-BuildSpecification PATCH] Declare Pre/Post build scripts in = [Defines] section https://bugzilla.tianocore.org/show_bug.cgi?id=3D483 Add support for PREBUILD and POSTBUILD defines in the [Defines] section of = an DSC to declare scripts that are executed before and after normal DSC/FDF= file processing. Cc: Liming Gao Cc: Yonghong Zhu Cc: Kevin W Shaw Contributed-under: TianoCore Contribution Agreement 1.1 Signed-off-by: Michael Kinney --- .../106_post_build_processing.md | 61 ++++++++++++++++++= ++++ .../82_auto-generation_process.md | 33 ++++++++++++ README.md | 1 + SUMMARY.md | 1 + 4 files changed, 96 insertions(+) create mode 100644 10_post-build_imagegen_stage_-_flash/106_post_build_pro= cessing.md diff --git a/10_post-build_imagegen_stage_-_flash/106_post_build_processing= .md b/10_post-build_imagegen_stage_-_flash/106_post_build_processing.md new file mode 100644 index 0000000..6b48a4f --- /dev/null +++ b/10_post-build_imagegen_stage_-_flash/106_post_build_processing.md @@ -0,0 +1,61 @@ + + + +## 10.6 Post Build Processing + +If the `[Defines]` section of the DSC file contains a `POSTBUILD =3D=20 +entry` statement, prior to exiting, the script specified in the=20 +`POSTBUILD` statement is executed. If the script file is not found, the=20 +**build** command exits with an appropriate error message. If the=20 +script fails, it must terminate with a non-zero exit code and the=20 +**build** command terminates with the exit value from the post-build=20 +script. The script is required to generate error messages that provide the= reason for the termination. + +All of the command line options passed into the **build** command are=20 +also passed into the script along with the command line options for=20 +`TARGET`, `ARCH`, and `TOOL_CHAIN_TAG`. The values for `TARGET`,=20 +`ARCH`, and `TOOL_CHAIN_TAG` are from the command line options passed=20 +into the **build** command. If these values are not passed into the=20 +**build** command, then they are retrieved from `target.txt`. + +If the script terminates successfully (exit value of 0), then the=20 +**build** command terminates normally. + +********** +**Note:** This entry may be wrapped in a conditional directive. Unlike=20 +the `PREBUILD` entry, there are no restrictions on the MACRO values=20 +used in a conditional directive. +********** +**Note:** Quotes are needed when the script's additional options are prese= nt. +Quotes are also required if the path to the post-build command contains=20 +space or special characters. +********** diff --git a/8_pre-build_autogen_stage/82_auto-generation_process.md b/8_pr= e-build_autogen_stage/82_auto-generation_process.md index deb1c47..4175552 100644 --- a/8_pre-build_autogen_stage/82_auto-generation_process.md +++ b/8_pre-build_autogen_stage/82_auto-generation_process.md @@ -958,6 +958,39 @@ If the `[Defines]` section has the `PCD_VAR_CHECK_GENE= RATION` entry set to TRUE, then a binary file will be created in the FV di= rectory for Dynamic and DynamicEx PCD HII Variable checking. =20 +#### 8.2.4.13 Pre Build Processing + +The DSC file is parsed after the tool meta-data files. If the=20 +`[Defines]` section of the DSC file contains a `PREBUILD =3D entry`=20 +statement, processing of the DSC file is suspended and the script=20 +specified in the `PREBUILD` statement is executed. If the script file=20 +is not found, the **build** command exits with an appropriate error=20 +message. If the script fails, it must terminate with a non-zero exit=20 +code and the **build** command terminates with the exit value from the=20 +pre-build script. The script is required to generate error messages that p= rovide the reason for the termination. + +All of the command line options passed into the **build** command are=20 +also passed into the script along with the command line options for=20 +`TARGET`, `ARCH`, and `TOOL_CHAIN_TAG`. The values for `TARGET`,=20 +`ARCH`, and `TOOL_CHAIN_TAG` are from the command line options passed=20 +into the **build** command. If these values are not passed into the=20 +**build** command, then they are retrieved from `target.txt`. + +If the script terminates successfully (exit value of 0), parsing of the=20 +DSC file continues, and build tools may retrieve environment variables=20 +that have been updated by the script. + +********** +**Note:** This entry may be wrapped in a conditional directive that=20 +uses the value of the `TOOL_CHAIN_TAG` determined earlier. Using a=20 +MACRO value other than `$(TOOL_CHAIN_TAG)` is prohibited, as the DSC=20 +file has not been processed at the time the ENTRY was found. +********** +**Note:** Quotes are needed when the script's additional options are prese= nt. +Quotes are also required if the path to the pre-build command contains=20 +space or special characters. +********** + ### 8.2.5 Post processing =20 Once all files are parsed, the build tools will do following work for each= EDK diff --git a/README.md b/README.md index 71c4511..3f9ef99 100644 --- a/README.md +++ b/README.md @@ -203,3 +203,4 @@ Copyright (c) 2008-2017, Intel Corporation. All rights = reserved. | 1.27 | Convert to Gitbook = = = = | A= pril 2017 | | | [#471](https://bugzilla.tianocore.org/show_bug.cgi?id=3D471= ) Build spec: only copy the "TianoCore" Userextension section into "As Buil= t" INF = = |= | | | [#472](https://bugzilla.tianocore.org/show_bug.cgi?id=3D472= ) [Build Spec] Extend macro usage in the !include statements for DSC/FDF fi= les = = |= | +| | [#483](https://bugzilla.tianocore.org/show_bug.cgi?id=3D483= ) Build Spec: add description for merge Pre-build and Post-build into build= process = = |= | diff --git a/SUMMARY.md b/SUMMARY.md index fb76372..e374319 100644 --- a/SUMMARY.md +++ b/SUMMARY.md @@ -90,6 +90,7 @@ * [10.3 Build Intermediate Images](10_post-build_imagegen_stage_-_flash/= 103_build_intermediate_images.md#103-build-intermediate-images) * [10.4 Create the FV Image File(s)](10_post-build_imagegen_stage_-_flas= h/104_create_the_fv_image_files.md#104-create-the-fv-image-files) * [10.5 Create the FD image file(s)](10_post-build_imagegen_stage_-_flas= h/105_create_the_fd_image_files.md#105-create-the-fd-image-files) + * [10.6 Post Build=20 + Processing](10_post-build_imagegen_stage_-_flash/106_post_build_proces + sing.md#106_post_build_processing) * [11 Post-Build ImageGen Stage - Other](11_post-build_imagegen_stage_-_ot= her/README.md#11-post-build-imagegen-stage---other) * [11.1 EFI PCI Option ROM Images](11_post-build_imagegen_stage_-_other/= 111_efi_pci_option_rom_images.md#111-efi-pci-option-rom-images) * [11.2 UEFI Applications](11_post-build_imagegen_stage_-_other/112_uefi= _applications.md#112-uefi-applications) -- 2.6.3.windows.1