summaryrefslogtreecommitdiffstats
path: root/BaseTools/Source
Commit message (Collapse)AuthorAgeFilesLines
...
* Basetools: turn off gcc12 warningGerd Hoffmann2022-03-281-0/+3
| | | | | | | | | | | | | | | | | In function ?SetDevicePathEndNode?, inlined from ?FileDevicePath? at DevicePathUtilities.c:857:5: DevicePathUtilities.c:321:3: error: writing 4 bytes into a region of size 1 [-Werror=stringop-overflow=] 321 | memcpy (Node, &mUefiDevicePathLibEndDevicePath, sizeof (mUefiDevicePathLibEndDevicePath)); | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ In file included from UefiDevicePathLib.h:22, from DevicePathUtilities.c:16: ../Include/Protocol/DevicePath.h: In function ?FileDevicePath?: ../Include/Protocol/DevicePath.h:51:9: note: destination object ?Type? of size 1 51 | UINT8 Type; ///< 0x01 Hardware Device Path. | ^~~~ Signed-off-by: Gerd Hoffmann <kraxel@redhat.com> Reviewed-by: Bob Feng <bob.c.feng@intel.com>
* BaseTools: fix gcc12 warningGerd Hoffmann2022-03-281-1/+2
| | | | | | | | | | | | | | | | | | | | | | Sdk/C/LzmaEnc.c: In function ?LzmaEnc_CodeOneMemBlock?: Sdk/C/LzmaEnc.c:2828:19: error: storing the address of local variable ?outStream? in ?*p.rc.outStream? [-Werror=dangling-pointer=] 2828 | p->rc.outStream = &outStream.vt; | ~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~ Sdk/C/LzmaEnc.c:2811:28: note: ?outStream? declared here 2811 | CLzmaEnc_SeqOutStreamBuf outStream; | ^~~~~~~~~ Sdk/C/LzmaEnc.c:2811:28: note: ?pp? declared here Sdk/C/LzmaEnc.c:2828:19: error: storing the address of local variable ?outStream? in ?*(CLzmaEnc *)pp.rc.outStream? [-Werror=dangling-pointer=] 2828 | p->rc.outStream = &outStream.vt; | ~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~ Sdk/C/LzmaEnc.c:2811:28: note: ?outStream? declared here 2811 | CLzmaEnc_SeqOutStreamBuf outStream; | ^~~~~~~~~ Sdk/C/LzmaEnc.c:2811:28: note: ?pp? declared here cc1: all warnings being treated as errors Signed-off-by: Gerd Hoffmann <kraxel@redhat.com> Reviewed-by: Bob Feng <bob.c.feng@intel.com>
* BaseTools: fix gcc12 warningGerd Hoffmann2022-03-282-2/+2
| | | | | | | | | | | | GenFfs.c:545:5: error: pointer ?InFileHandle? used after ?fclose? [-Werror=use-after-free] 545 | Error(NULL, 0, 4001, "Resource", "memory cannot be allocated of %s", InFileHandle); | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ GenFfs.c:544:5: note: call to ?fclose? here 544 | fclose (InFileHandle); | ^~~~~~~~~~~~~~~~~~~~~ Signed-off-by: Gerd Hoffmann <kraxel@redhat.com> Reviewed-by: Bob Feng <bob.c.feng@intel.com>
* BaseTools: Remove the redundant __FLEXIBLE_SIZE from PcdValueInit.cBob Feng2022-03-261-0/+5
| | | | | | | | | | | | | | | For the multiple SKU case, basetools generates multiple redundant __FLEXIBLE_SIZE statement that is from the same line in dsc file. This behavior causes the generated PcdValueInit.c file to have huge size, and the compilation time is very long. This patch is going to fix this issue. Signed-off-by: Bob Feng <bob.c.feng@intel.com> Cc: Liming Gao <gaoliming@byosoft.com.cn> Cc: Yuwei Chen <yuwei.chen@intel.com> Reviewed-by: Yuwei Chen <yuwei.chen@intel.com>
* BaseTools: Add the FeatureFlagExpression usage to the Source SectionYi Li2022-03-265-5/+59
| | | | | | | | | | | | | | | | | | REF:https://bugzilla.tianocore.org/show_bug.cgi?id=3828 FeatureFlagExpression Support in Source section of INF file. The Pcd value in the expression is from INF or DEC. When a FeatureFlagExpression is present,if the expression evaluates to TRUE,then the entry is valid. If the expression evaluates to FALSE, then the EDK II build tools must ignore the entry. This patch is going to add this feature. Cc: Bob Feng <bob.c.feng@intel.com> Cc: Liming Gao <gaoliming@byosoft.com.cn> Cc: Heng Luo <heng.luo@intel.com> Reviewed-by: Bob Feng <bob.c.feng@intel.com> Signed-off-by: Yi Li <yi1.li@intel.com>
* BaseTools/GenFw: Enhance GenFw to support PRM GCC buildHuang, Li-Xia2022-03-165-5/+315
| | | | | | | | | | | | | | | | | | | | | | | REF: https://bugzilla.tianocore.org/show_bug.cgi?id=3802 Since PRM module needs to support export table in PE-COFF, we'll enhance GenFw tool to support this. Add one export flag in GenFw tool. If export flag is set: Step1: Scan ELF symbol table based on PRM module descriptor to get descriptor offset address; Step2: Find PRM handlers number and name in COFF file based on the address from step1; Step3: Write PRM info such as handler name and export RVA into COFF export table. PRM option currently only supports DXE RUNTIME driver and X64 arch. Cc: Liming Gao <gaoliming@byosoft.com.cn> Cc: Bob Feng <bob.c.feng@intel.com> Cc: Yuwei Chen <yuwei.chen@intel.com> Signed-off-by: Lixia Huang <lisa.huang@intel.com> Reviewed-by: Bob Feng <bob.c.feng@intel.com>
* BaseTools: Update brotli submoduleBob Feng2022-02-153-1/+17
| | | | | | | | | | | | REF: https://bugzilla.tianocore.org/show_bug.cgi?id=3D3417 Update the brotli submodule to the latest commit (f4153a0) so that the build isn't broken in GCC 11 compilers. Signed-off-by: Bob Feng <bob.c.feng@intel.com> Cc: Liming Gao <gaoliming@byosoft.com.cn> Cc: Yuwei Chen <yuwei.chen@intel.com> Cc: Pedro Falcato <pedro.falcato@gmail.com> Reviewed-by: Liming Gao <gaoliming@byosoft.com.cn>
* BaseTools: Fix error leg in DscBuildData.pyJake Garver via groups.io2022-02-071-1/+1
| | | | | | | | | | | Fix a Edk2Logger.warn() message format to match the arguments. We ran into this after a failure in PcdValueInit. The failure was masked by a new exception, "TypeError: not all arguments converted during string formatting". Signed-off-by: Jake Garver <jake@nvidia.com> Reviewed-by: Liming Gao <gaoliming@byosoft.com.cn>
* BaseTools: Fix wrong variable header sizeChen, Lin Z2022-01-131-1/+5
| | | | | | | | | There are two type variable header and their size are different, need to use matched size when calculating offset info, otherwise it'll destroy other variables content when patching. Signed-off-by: Chen, Lin Z <lin.z.chen@intel.com> Reviewed-by: Bob Feng <bob.c.feng@intel.com>
* BaseTools: Fix the bug of --cmd-len build optionBob Feng2021-12-282-0/+3
| | | | | | | | | | currently the --cmd-len build option does not work. This patch is going to fix this bug. Signed-off-by: Bob Feng <bob.c.feng@intel.com> Cc: Liming Gao <gaoliming@byosoft.com.cn> Cc: Yuwei Chen <yuwei.chen@intel.com> Reviewed-by: Yuwei Chen <yuwei.chen@intel.com>
* BaseTools/VfrCompile: Correct Bit Field Flags for numeric/one ofHuang, Long12021-12-092-1/+4
| | | | | | | | | | | | | | | | REF:https://bugzilla.tianocore.org/show_bug.cgi?id=3752 Add Bit mask to numeric/one of opcode to set correctly Flags for Bit Field. VfrSyntax.g: Set "LFlags &= EDKII_IFR_DISPLAY_BIT" before "LFlags |= (EDKII_IFR_NUMERIC_SIZE_BIT & (_GET_CURRQEST_VARSIZE()));" VfrFormPkg.h: update "if (LFlags & EFI_IFR_DISPLAY)" with "if (LFlags & EDKII_IFR_DISPLAY_BIT)" in SetFlagsForBitField() Cc: Bob Feng <bob.c.feng@intel.com> Cc: Liming Gao <gaoliming@byosoft.com.cn> Cc: Yuwei Chen <yuwei.chen@intel.com> Cc: Dandan Bi <dandan.bi@intel.com> Signed-off-by: Long1 Huang <long1.huang@intel.com> Reviewed-by: Dandan Bi <dandan.bi@intel.com>
* BaseTools: Increase the DevicePath length for support more PCD value.Jiang, Xiaolu2021-12-091-1/+1
| | | | | | | | | | | | | | | Currently the PCD Value only support 13 Guid,When use more 13 pcd will cause the build tool fail, Need calculate the required memory,then allocate it. REF: https://bugzilla.tianocore.org/show_bug.cgi?id=3718 Cc: Bob Feng <bob.c.feng@intel.com> Cc: Liming Gao <gaoliming@byosoft.com.cn> Cc: Yuwei Chen <yuwei.chen@intel.com> Signed-off-by: Xiaolu Jiang <xiaolu.jiang@intel.com> Reviewed-by: Liming Gao <gaoliming@byosoft.com.cn> Reviewed-by: Bob Feng <bob.c.feng@intel.com>
* BaseTools: Add authenticated variable store supportChen, Lin Z2021-11-113-3/+59
| | | | | | | | | | | | | | | | | | | | In order to support secure boot with authenticated type variable store and non secure boot with normal type variable store, add one flag to switch them. User can append '-D VPD_AUTHENTICATED_VARIABLE_STORE' to build command to enable authenticated type varaible store. Also, user can add 'VPD_AUTHENTICATED_VARIABLE_STORE = TRUE/FALSE' to the defines section of Dsc file to switch authenticated/normal type variable store. VPD_AUTHENTICATED_VARIABLE_STORE is a new reserved key word for this function. Signed-off-by: Chen Lin Z <lin.z.chen@intel.com> Cc: Bob Feng <bob.c.feng@intel.com> Cc: Liming Gao <gaoliming@byosoft.com.cn> Reviewed-by: Bob Feng <bob.c.feng@intel.com>
* BaseTools/VrfCompile: Fix uninitialized field from unnamed fieldMichael D Kinney2021-11-031-2/+2
| | | | | | | | | | | | | | | | | | REF: https://bugzilla.tianocore.org/show_bug.cgi?id=3687 If a C structure parsed by the VFR compiler contains an unnamed field, then mFieldName is left uninitialized, which generates random data in the VFR compiler output file. If the FieldName is NULL, then initialize pNewField->mFieldName to a Null-terminated empty string. Cc: Bob Feng <bob.c.feng@intel.com> Cc: Liming Gao <gaoliming@byosoft.com.cn> Cc: Yuwei Chen <yuwei.chen@intel.com> Signed-off-by: Michael D Kinney <michael.d.kinney@intel.com> Reviewed-by: Liming Gao <gaoliming@byosoft.com.cn> Reviewed-by: Bob Feng <bob.c.feng@intel.com>
* BaseTools: Change RealPath to AbsPathChen, Christine2021-10-133-6/+6
| | | | | | | | | | | | | | | | Currently the realpath is used when parse modules, which shows the path with a drive letter in build log. In Windows 'subst' comand is used to associates a path with a drive letter, when use the mapped drive letter for build, with realpath function the build log will have different disk letter info which will cause confusion. In this situation, if use adspath function to show the path info, it will keep same letter with the mapped drive letter, which avoids confusion. This patch modifies the realpath to abspath. Cc: Bob Feng <bob.c.feng@intel.com> Cc: Liming Gao <gaoliming@byosoft.com.cn> Signed-off-by: Yuwei Chen <yuwei.chen@intel.com> Reviewed-by: Bob Feng <bob.c.feng@Intel.com>
* BaseTools: Remove hard-coded strings for target and tools_defPierre Gondois2021-09-295-14/+10
| | | | | | | | | | | | | | | | | | | | | | REF: https://bugzilla.tianocore.org/show_bug.cgi?id=3653 The "target.txt" and "tools_def.txt" filenames are hard-coded at some places when global definitions are available at: BaseTools/Source/Python/Common/TargetTxtClassObject.py: DefaultTargetTxtFile and BaseTools/Source/Python/Common/ToolDefClassObject.py: DefaultToolsDefFile Use these global definitions instead. Also remove the unused gBuildConfiguration and gToolsDefinition variables from build.py Signed-off-by: Pierre Gondois <Pierre.Gondois@arm.com> Reviewed-by: Chris Jones <christopher.jones@arm.com> Reviewed-by: Liming Gao <gaoliming@byosoft.com.cn> Reviewed-by: Bob Feng <bob.c.feng@intel.com>
* BaseTools: Remove Makefile/MakefileName fieldsPierre Gondois2021-09-293-5/+0
| | | | | | | | | | | | | | REF: https://bugzilla.tianocore.org/show_bug.cgi?id=3653 The Makefile and MakefilName fields are never set/used. Remove them. To check this, the following commands can be used: - grep -rIn "\.Makefile" - grep -rIn "\.MakefileName" Signed-off-by: Pierre Gondois <Pierre.Gondois@arm.com> Reviewed-by: Chris Jones <christopher.jones@arm.com> Reviewed-by: Liming Gao <gaoliming@byosoft.com.cn> Reviewed-by: Bob Feng <bob.c.feng@intel.com>
* BaseTools/build: Set MakefileNamePierre Gondois2021-09-291-1/+4
| | | | | | | | | | | | | | | | | | | REF: https://bugzilla.tianocore.org/show_bug.cgi?id=3653 Running the following command: python3 build/build.py -a AARCH64 -t GCC5 -p ArmPlatformPkg/ArmPlatformPkg.dsc -b DEBUG libraries triggers the following error: make: *** Build/ArmPlatform/DEBUG_GCC5/AARCH64/MdePkg/Library/ BasePcdLibNull/BasePcdLibNull: Is a directory. Stop. Indeed, MakefileName is set to en empty string. Setting MakefileName resolves the error. Signed-off-by: Pierre Gondois <Pierre.Gondois@arm.com> Reviewed-by: Chris Jones <christopher.jones@arm.com> Reviewed-by: Liming Gao <gaoliming@byosoft.com.cn> Reviewed-by: Bob Feng <bob.c.feng@intel.com>
* BaseTools/GenMake: Use ToolDefinition as fallback optionPierre Gondois2021-09-291-4/+4
| | | | | | | | | | | | | | | REF: https://bugzilla.tianocore.org/show_bug.cgi?id=3653 Use the value set in tools_def.txt when the makefile type is not explicitly set via BuildOption. This allows to have a valid default makefile name instead of an empty string. Also use GMAKE_FILETYPE instead of hard-coded "gmake". Signed-off-by: Pierre Gondois <Pierre.Gondois@arm.com> Reviewed-by: Chris Jones <christopher.jones@arm.com> Reviewed-by: Liming Gao <gaoliming@byosoft.com.cn> Reviewed-by: Bob Feng <bob.c.feng@intel.com>
* GenFv: Arm: support images entered in Thumb modeEtienne Carriere2021-08-111-9/+29
| | | | | | | | | | | | Change GenFv for Arm architecture to generate a specific jump instruction as image entry instruction, when the target entry label is assembled with Thumb instruction set. This is possible since SecCoreEntryAddress value fetched from the PE32 has its LSBit set when the entry instruction executes in Thumb mode. Signed-off-by: Etienne Carriere <etienne.carriere@linaro.org> Acked-by: Liming Gao <gaoliming@byosoft.com.cn> Reviewed-by: Sami Mujawar <sami.mujawar@arm.com>
* BaseTools: use shutil.copyfile instead shutil.copy2Bob Feng2021-08-021-4/+4
| | | | | | | | | | | | | | | In Split tool, the copy file actions only need to copy file content but not need to copy file metadata. copy2() copies the file metadata that causes split unit test failed under edk2-basetools CI environment. So this patch changes the call of copy2() to copyfile(). Signed-off-by: Bob Feng <bob.c.feng@intel.com> Cc: Liming Gao <gaoliming@byosoft.com.cn> Cc: Yuwei Chen <yuwei.chen@intel.com> Reviewed-by: Yuwei Chen <yuwei.chen@intel.com>
* python: Replace distutils.utils.split_quotes with shlex.splitCole2021-08-022-4/+4
| | | | | | | | | | | | | distutils is deprecated and may be removed in python 3.12. Use shlex.split which has been around since python 2.3. shlex.split does not split on all the ASCII control characters that split_quoted will[1], but for edk2 usage I don't think that matters. [1] https://stackoverflow.com/questions/54999301/what-is-the-difference-between-distutils-util-split-quoted-and-shlex-split Signed-off-by: Cole Robinson <crobinso@redhat.com> Reviewed-by: Bob Feng <bob.c.feng@intel.com>
* build: Fix python3.10 threading DeprecationWarningsCole2021-08-021-24/+24
| | | | | | | | | threading camelCase functions have preferred alternatives since python2.6. python3.10 has started emitting DeprecationWarnings for them Signed-off-by: Cole Robinson <crobinso@redhat.com> Reviewed-by: Bob Feng <bob.c.feng@intel.com>
* BaseTools GenFw: Add support for R_RISCV_PCREL_LO12_S relocationSunil V L2021-07-211-0/+55
| | | | | | | | | | | | | | | | | | | | Ref: https://bugzilla.tianocore.org/show_bug.cgi?id=3459 This patch adds support for R_RISCV_PCREL_LO12_S relocation type. The logic is same as existing R_RISCV_PCREL_LO12_I relocation except the difference between load vs store instruction formats. Signed-off-by: Sunil V L <sunilvl@ventanamicro.com> Cc: Liming Gao <gaoliming@byosoft.com.cn> Cc: Bob Feng <bob.c.feng@intel.com> Cc: Yuwei Chen <yuwei.chen@intel.com> Cc: Pete Batard <pete@akeo.ie> Cc: Abner Chang <abner.chang@hpe.com> Cc: Daniel Schaefer <daniel.schaefer@hpe.com> Reviewed-by: Daniel Schaefer <daniel.schaefer@hpe.com> Acked-by: Abner Chang <abner.chang@hpe.com> Acked-by: Liming Gao <gaoliming@byosoft.com.cn>
* BaseTools: Enable the flag to treat dynamic pcd as dynamicExBob Feng2021-07-125-131/+73
| | | | | | | | | | | | | | | | | | | | Ref: https://bugzilla.tianocore.org/show_bug.cgi?id=1688 In order to support binary build, build tool add a flag to convert type of Dynamic Pcd to DynamicEx Pcd User can append -D PCD_DYNAMIC_AS_DYNAMICEX to build command to enable this function. Also, user can add "PCD_DYNAMIC_AS_DYNAMICEX = TRUE/FALSE" to the defines section of Dsc file to enable this function. PCD_DYNAMIC_AS_DYNAMICEX is a new reserved key word for this function. Signed-off-by: Bob Feng <bob.c.feng@intel.com> Cc: Liming Gao <liming.gao@intel.com> Cc: Yuwei Chen <yuwei.chen@intel.com> Cc: Michael D Kinney <michael.d.kinney@intel.com> Cc: Nate DeSimone <nathaniel.l.desimone@intel.com> Reviewed-by: Liming Gao <liming.gao@intel.com>
* BaseTools GenFw: Add support for RISCV GOT/PLT relocationsSunil V L2021-06-291-6/+53
| | | | | | | | | | | | | | | | | | | | | | | | | | Ref: https://bugzilla.tianocore.org/show_bug.cgi?id=3096 This patch adds support for R_RISCV_CALL_PLT and R_RISCV_GOT_HI20 relocations generated by PIE enabled compiler. This also needed changes to R_RISCV_32 and R_RISCV_64 relocations as explained in https://github.com/riscv/riscv-gnu-toolchain/issues/905#issuecomment-846682710 Testing: 1) Debian GCC 8.3.0 and booted sifive_u and QMEU virt models. 2) Debian 10.2.0 and booted QEMU virt model. 3) riscv-gnu-tool chain 9.2 and booted QEMU virt model. Signed-off-by: Sunil V L <sunilvl@ventanamicro.com> Acked-by: Abner Chang <abner.chang@hpe.com> Reviewed-by: Daniel Schaefer <daniel.schaefer@hpe.com> Tested-by: Daniel Schaefer <daniel.schaefer@hpe.com> Reviewed-by: Liming Gao <gaoliming@byosoft.com.cn> Cc: Bob Feng <bob.c.feng@intel.com> Cc: Liming Gao <gaoliming@byosoft.com.cn> Cc: Yuwei Chen <yuwei.chen@intel.com> Cc: Heinrich Schuchardt <xypron.glpk@gmx.de>
* BaseTools GenFw: Keep read only alloc section as text when convert ELFgaoliming2021-06-162-2/+4
| | | | | | | | | | | | This is the fix of the regression issue at c6b872c6. Based on ELF spec, readonly alloc section is .rodata section. It is used. This fix is to add back original check logic for ELF section. Now, the readonly alloc section and execute alloc section are regarded as .text. Signed-off-by: Liming Gao <gaoliming@byosoft.com.cn> Cc: Bob Feng <bob.c.feng@intel.com> Cc: Ray Ni <ray.ni@intel.com> Reviewed-by: Bob Feng <bob.c.feng@intel.com>
* BaseTools GenFw: Fix regression issue to convert the image to ACPI dataLiming Gao2021-06-062-2/+2
| | | | | | | | | | | | | | | | | Commit c6b872c updates GenFw base code attribute to find .text section. With GCC49 tool chain, aslc file is compiled into elf image. But, its text section has no CODE attribute. So, it can't be detected by new GenFw tool.For this type file. its text section is not required. Its data section will be converted to acpi table. This fix is to remove assert check when the generated image is ACPI data. Signed-off-by: Liming Gao <gaoliming@byosoft.com.cn> Cc: Ray Ni <ray.ni@intel.com> Cc: Leif Lindholm <leif@nuviainc.com> Cc: Bob Feng <bob.c.feng@intel.com> Reviewed-by: Bob Feng <bob.c.feng@intel.com> Tested-by: Leif Lindholm <leif@nuviainc.com>
* BaseTools GenFw: Support CLANG8ELF with conversion ELF to PE/COFF imageLiming Gao2021-06-042-11/+6
| | | | | | | | | | CLANG8ELF tool chain generated ELF image with the different attributes in section. Update GenFw to handle them. 1. .text section with writable attribute (support) 2. .reloc section has the symbol for *ABS* (skip) Signed-off-by: Liming Gao <gaoliming@byosoft.com.cn> Reviewed-by: Feng Bob C <bob.c.feng@intel.com>
* BaseTools: build: Set ReturnCode on POSTBUILD failGarrett Kirkendall2021-05-211-0/+1
| | | | | | | | | | | | | | | When build.by POSTBUILD handling section returns other than 0, set ReturnCode to POSTBUILD_ERROR so build.py exits with return code other than 0. Fix for https://bugzilla.tianocore.org/show_bug.cgi?id=1977 Cc: Bob Feng <bob.c.feng@intel.com> Cc: Liming Gao <gaoliming@byosoft.com.cn> Cc: Yuwei Chen <yuwei.chen@intel.com> Signed-off-by: Garrett Kirkendall <garrett.kirkendall@amd.com> Reviewed-by: Liming Gao <gaoliming@byosoft.com.cn>
* BaseTools/Brotli: Fix compressed data loss issueChen, Christine2021-05-171-23/+38
| | | | | | | | | | | | | | | | | | | | | | | | REF: https://bugzilla.tianocore.org/show_bug.cgi?id=2946 Currenly, when using the Brotli tool to compress data, the output compressed binary file does not record complete compressed data when size of input file is too large, which makes the data loss and will trigger decompress-check issue. The Brotli document mentioned: The brotli tool use BrotliEncoderCompressStream method to compresses input stream to output stream. Under some circumstances (e.g. lack of output stream capacity) the BrotliEncoderOperation would require several calls to BrotliEncoderCompressStream. The method must be called again until both input stream is depleted and encoder has no more output after the method is called. This patch fixes this issue based on the Brotli document. Cc: Bob Feng <bob.c.feng@intel.com> Cc: Liming Gao <gaoliming@byosoft.com.cn> Signed-off-by: Yuwei Chen <yuwei.chen@intel.com> Reviewed-by: Bob Feng <bob.c.feng@intel.com>
* BaseTools: Add support for version 3 of FMP Image Header structureSughosh Ganu2021-05-122-9/+24
| | | | | | | | | | | Add support for the ImageCapsuleSupport field, introduced in version 3 of the EFI_FIRMWARE_MANAGEMENT_CAPSULE_IMAGE_HEADER structure. This structure member is used to indicate if the corresponding payload has support for authentication and dependency. Signed-off-by: Sughosh Ganu <sughosh.ganu@linaro.org> Reviewed-by: Michael D Kinney <michael.d.kinney@intel.com> Reviewed-by: Bob Feng <bob.c.feng@intel.com>
* BaseTools: Fix DSC override of Guided toolMichael D Kinney2021-05-103-97/+190
| | | | | | | | | | | | | | | | REF: https://bugzilla.tianocore.org/show_bug.cgi?id=3359 If the DSC file provides an override of a Guided tool path and/or Guided tool GUID value, then make sure the one from the DSC file is used if it is higher priority than the Guided tool in the tools_def.txt file. This makes the Guided tool used by GenFds match the tool listed GuidedSectionTools.txt. Cc: Bob Feng <bob.c.feng@intel.com> Cc: Liming Gao <gaoliming@byosoft.com.cn> Cc: Yuwei Chen <yuwei.chen@intel.com> Signed-off-by: Michael D Kinney <michael.d.kinney@intel.com> Reviewed-by: Bob Feng <bob.c.feng@intel.com>
* BaseTools: Fix New Target/ToolChain/Arch in DSC [BuildOptions] issuesMichael D Kinney2021-05-033-30/+26
| | | | | | | | | | | | | | | | | | | | | | | | | | | REF: https://bugzilla.tianocore.org/show_bug.cgi?id=3359 * Save/Restore global state in GetToolChainAndFamilyFromDsc() This resolves an issue where the multi-arch build for UefiPayloadPkg would skip the autogen and build of IA32 components. * Expand tools wildcard. This resolves the issue where autogen makefile contents would have a BUIDLRULEFAMILY tools definitions with an '*' in the tool field that breaks the build from invalid makefile syntax. * Build rule family higher priority than Family. This resolves the issue where flags were appended from both the BUILDRULEFAMILY and FAMILY when only BUILDRULEFAMILY should be appended when present. Cc: Bob Feng <bob.c.feng@intel.com> Cc: Liming Gao <gaoliming@byosoft.com.cn> Cc: Yuwei Chen <yuwei.chen@intel.com> Cc: Ray Ni <ray.ni@intel.com> Cc: Steven Shi <steven.shi@intel.com> Signed-off-by: Michael D Kinney <michael.d.kinney@intel.com> Acked-by: Rebecca Cran <rebecca@bsdio.com> Reviewed-by: Andrew Fish <afish@apple.com>
* BaseTools/Source/Python: New Target/ToolChain/Arch in DSC [BuildOptions]Michael D Kinney2021-04-295-96/+230
| | | | | | | | | | | | | | | | | | | | | | REF: https://bugzilla.tianocore.org/show_bug.cgi?id=3359 Update BaseTools to support new build targets, new tool chains, and new architectures declared in DSC file [BuildOptions] sections. * Do not expand * when tools_def.txt is parsed. Only expand when both tools_def.txt and DSC [BuilsOptions] sections have been parsed. This also requires more flexible matching of tool keys that contain * in tool key fields. * Pre-scan the platform DSC file for FAMILY and TOOLCHAIN declarations DSC in [BuildOptions] sections before the FAMILY and TOOLCHAIN need to be known. Cc: Bob Feng <bob.c.feng@intel.com> Cc: Liming Gao <gaoliming@byosoft.com.cn> Cc: Yuwei Chen <yuwei.chen@intel.com> Signed-off-by: Michael D Kinney <michael.d.kinney@intel.com> Reviewed-by: Bob Feng <bob.c.feng@intel.com>
* BaseTools/GenMake: Sort generated makefile tool definitionsMichael D Kinney2021-04-271-4/+8
| | | | | | | | | | | | | | | REF: https://bugzilla.tianocore.org/show_bug.cgi?id=3353 Sort the tool definition content of generated makefiles to help verify that makefile contents have not changed after BaseTools code changes. Cc: Bob Feng <bob.c.feng@intel.com> Cc: Liming Gao <gaoliming@byosoft.com.cn> Cc: Yuwei Chen <yuwei.chen@intel.com> Signed-off-by: Michael D Kinney <michael.d.kinney@intel.com> Reviewed-by: Bob Feng <bob.c.feng@intel.com> Reviewed-by: Yuwei Chen <yuwei.chen@intel.com>
* BaseTools/Source/Python: Verify TAB_TOD_DEFINES_FAMILY key presentMichael D Kinney2021-04-232-5/+15
| | | | | | | | | | | | | REF: https://bugzilla.tianocore.org/show_bug.cgi?id=3344 Veify that TAB_TOD_DEFINES_FAMILY key is present in ToolDef dictionary before access. Cc: Bob Feng <bob.c.feng@intel.com> Cc: Liming Gao <gaoliming@byosoft.com.cn> Cc: Yuwei Chen <yuwei.chen@intel.com> Signed-off-by: Michael D Kinney <michael.d.kinney@intel.com> Reviewed-by: Bob Feng <bob.c.feng@intel.com>
* BaseTools/Source/Python: Remove CPU architecture assumptionsMichael D Kinney2021-04-153-7/+5
| | | | | | | | | | | | | | | | | | | | | | | | REF: https://bugzilla.tianocore.org/show_bug.cgi?id=3308 The EDK II Build Specifications do not restrict the set of CPU architectures that can be supported. Remove places in the EDK II that assume a fixed set of CPU architectures. Remove build breaks in the following tools when a check against a fixed set of CPU architectures is made. * Build * GenFds * TargetTool Cc: Bob Feng <bob.c.feng@intel.com> Cc: Liming Gao <gaoliming@byosoft.com.cn> Cc: Yuwei Chen <yuwei.chen@intel.com> Cc: Andrew Fish <afish@apple.com> Cc: Abner Chang <abner.chang@hpe.com> Signed-off-by: Michael D Kinney <michael.d.kinney@intel.com> Reviewed-by: Liming Gao <gaoliming@byosoft.com.cn> Reviewed-by: Bob Feng <bob.c.feng@intel.com>
* BaseTools/Source/C: Remove CPU architecture assumptionsMichael D Kinney2021-04-152-6/+4
| | | | | | | | | | | | | | | | | | | | | | REF: https://bugzilla.tianocore.org/show_bug.cgi?id=3308 The EDK II Build Specifications do not restrict the set of CPU architectures that can be supported. Remove places in the EDK II that assume a fixed set of CPU architectures. Remove build breaks in the following tools when a check against a fixed set of CPU architectures is made. * GenFw Cc: Bob Feng <bob.c.feng@intel.com> Cc: Liming Gao <gaoliming@byosoft.com.cn> Cc: Yuwei Chen <yuwei.chen@intel.com> Cc: Andrew Fish <afish@apple.com> Cc: Abner Chang <abner.chang@hpe.com> Signed-off-by: Michael D Kinney <michael.d.kinney@intel.com> Reviewed-by: Liming Gao <gaoliming@byosoft.com.cn> Reviewed-by: Bob Feng <bob.c.feng@intel.com>
* BaseTools/PlatformAutoGen: MAKE_FLAGS and MAKE_PATH fixesMichael D Kinney2021-04-141-15/+21
| | | | | | | | | | | | | | | | | | | | | | | REF: https://bugzilla.tianocore.org/show_bug.cgi?id=3312 Update parsing of MAKE_FLAGS in DSC [BuildOptions] sections to split the flags into a list to be compatible with running the make command using Popen(). Parsing MAKE_FLAGS from tools_def.txt already uses _SplitOption(). This change uses the same _SplitOption() method for MAKE_FLAGS from a DSC [BuildOptions] section. Also update the parsing of MAKE_PATH to support MAKE_PATH from tools_def.txt or the DSC [BuildOptions] section. MAKE_PATH in DSC [BuildOptions] section is higher priority than MAKE_PATH in tools_def.txt. Cc: Bob Feng <bob.c.feng@intel.com> Cc: Liming Gao <gaoliming@byosoft.com.cn> Cc: Yuwei Chen <yuwei.chen@intel.com> Signed-off-by: Michael D Kinney <michael.d.kinney@intel.com> Reviewed-by: Yuwei Chen <yuwei.chen@intel.com> Reviewed-by: Bob Feng <bob.c.feng@intel.com>
* BaseTools/Ecc: Make Ecc only check first include guardPierre Gondois2021-03-181-3/+5
| | | | | | | | | | | The Ecc tool checks the format of the include guard. This check is currently done on all the names following the '#ifndef' statement. It should only be done on the first include guard. REF: https://bugzilla.tianocore.org/show_bug.cgi?id=3252 Signed-off-by: Pierre Gondois <Pierre.Gondois@arm.com> Reviewed-by: Liming Gao <liming.gao@intel.com> Reviewed-by: Bob Feng <bob.c.feng@intel.com>
* BaseTools: Align include guards policyPierre Gondois2021-02-262-2/+4
| | | | | | | | | | | | | | | | | | | | | | | | | The EDK II C Coding Standards Specification states that: "Names starting with one or two underscores, such as _MACRO_GUARD_FILE_NAME_H_, must not be used. They are reserved for compiler implementation." [1] The Ecc tool currently checks that the include guard end with a trailing underscore. Thus, the check and the error message should both be modified. The new check forces having one sole trailing underscore character, as the example in the specification shows: "FILE_NAME_H_" [1] This would allow to have more consistency. [1] Section 5.3.5 "All include file contents must be protected by a #include guard": https://edk2-docs.gitbook.io/ edk-ii-c-coding-standards-specification/5_source_files/53_include_files Signed-off-by: Pierre Gondois <Pierre.Gondois@arm.com> Reviewed-by: Sami Mujawar <Sami.Mujawar@arm.com> Reviewed-by: Liming Gao <gaoliming@byosoft.com.cn>
* BaseTools: Use pip module if available, CI uses it by defaultMatthew Carlson2021-02-091-0/+29
| | | | | | | | | | | | | | | Use the new edk2-basetools pip module. Includes a helpful message in setup to let users know which has been selected. Cc: Bob Feng <bob.c.feng@intel.com> Cc: Liming Gao <gaoliming@byosoft.com.cn> Cc: Yuwei Chen <yuwei.chen@intel.com> Reviewed-by: Bob Feng <bob.c.feng@intel.com> Reviewed-by: Yuwei <Chen<yuwei.chen@intel.com> Signed-off-by: Matthew Carlson <matthewfcarlson@gmail.com>
* BaseTools: fix the split output files root dirBob Feng2021-02-072-75/+87
| | | | | | | | | | | | | | | | | If the output file path is a relative path, the split tool will create the output file under the input file path. But the expected behavior for this case is the output file should be relative to the current directory. This patch will fix this bug. If the output file path is not specified and output prefix is not specified, the output file should be under the input file path Signed-off-by: Bob Feng <bob.c.feng@intel.com> Cc: Liming Gao <gaoliming@byosoft.com.cn> Cc: Yuwei Chen <yuwei.chen@intel.com> Acked-by: Liming Gao <gaoliming@byosoft.com.cn> Reviewed-by: Yuwei Chen <yuwei.chen@intel.com>
* BaseTools: Ecc/exception: Added _ModuleEntryPoint into exception listKun Qin2021-02-011-0/+4
| | | | | | | | | | | | | | | Function '_ModuleEntryPoint' is a pre-defined interface for various EFI module types and should not be caught violating EFI coding style. This change added '_ModuleEntryPoint' into exception list to fix EFI coding style error 8006 during CI build. Cc: Bob Feng <bob.c.feng@intel.com> Cc: Liming Gao <gaoliming@byosoft.com.cn> Cc: Yuwei Chen <yuwei.chen@intel.com> Signed-off-by: Kun Qin <kun.q@outlook.com> Reviewed-by: Liming Gao <gaoliming@byosoft.com.cn> Reviewed-by: Bob Feng <bob.c.feng@intel.com>
* BaseTools: Add unittest for Split toolBob Feng2021-01-211-0/+111
| | | | | | | | | | | | | REF: https://bugzilla.tianocore.org/show_bug.cgi?id=3165 This patch is to add the unit test for Split python tool Signed-off-by: Bob Feng <bob.c.feng@intel.com> Cc: Liming Gao <gaoliming@byosoft.com.cn> Cc: Yuwei Chen <yuwei.chen@intel.com> Reviewed-by: Liming Gao <gaoliming@byosoft.com.cn> Reviewed-by: Yuwei Chen <yuwei.chen@intel.com>
* BaseTools: Convert Split tool to pythonBob Feng2021-01-217-501/+212
| | | | | | | | | | | | | | | | | | | REF: https://bugzilla.tianocore.org/show_bug.cgi?id=3165 There are 2 reasons to convert Split tool from C to Python. 1. We are in the process of moving the Basetools Python code to a separate repository. But there still are many C tools under edk2/BaseTools. To make all Basetools be in the separate repo, we can convert the C tools to Python tools. 2. The original Split tool is very slow. This python tool can reduce 90% time. Signed-off-by: Bob Feng <bob.c.feng@intel.com> Cc: Liming Gao <gaoliming@byosoft.com.cn> Cc: Yuwei Chen <yuwei.chen@intel.com> Reviewed-by: Liming Gao <gaoliming@byosoft.com.cn> Reviewed-by: Yuwei Chen <yuwei.chen@intel.com>
* BaseTools: Fix the build report crash issueBob Feng2021-01-141-7/+9
| | | | | | | | | | | | | | | | In the following corner case, the build report will crash. This patch is to fix this problem. Case: Multiple SKU are used and 2 more DynamicHii structure Pcds are set in dsc file under different SKU. And 1 more of those Pcds are not used in any INF file. Signed-off-by: Bob Feng <bob.c.feng@intel.com> Cc: Liming Gao <gaoliming@byosoft.com.cn> Cc: Yuwei Chen <yuwei.chen@intel.com> Reviewed-by: Liming Gao <gaoliming@byosoft.com.cn> Reviewed-by: Yuwei Chen<yuwei.chen@intel.com>
* BaseTools LzmaCompress: Update LZMA to new 19.00 versionLiu, WeiX C2021-01-0812-575/+877
| | | | | | | | | REF: https://bugzilla.tianocore.org/show_bug.cgi?id=3101 New formal release in https://www.7-zip.org/sdk.html is 19.00. Cc: Liming Gao <gaoliming@byosoft.com.cn> Signed-off-by: Wei Liu <weix.c.liu@intel.com> Reviewed-by: Liming Gao <gaoliming@byosoft.com.cn>
* BaseTools/CommonLib.h: Build failed due to MAX_LONG_FILE_PATHEnze Zhu2021-01-061-0/+8
| | | | | | | | | | | | | | | REF:https://bugzilla.tianocore.org/show_bug.cgi?id=3032 We had a build fail due to the hard coded MAX_LONG_FILE_PATH value. We should use PATH_MAX if it is available. Cc: Bob Feng <bob.c.feng@intel.com> Cc: Liming Gao <gaoliming@byosoft.com.cn> Cc: Yuwei Chen <yuwei.chen@intel.com> Signed-off-by: Enze Zhu <zhuenze@byosoft.com.cn> Reviewed-by: Liming Gao <gaoliming@byosoft.com.cn> Reviewed-by: Bob Feng <bob.c.feng@intel.com>