summaryrefslogtreecommitdiff
path: root/BaseTools
AgeCommit message (Collapse)Author
2017-03-14BaseTools/UPT: Fix an issue in subst commandHess Chen
UPT used to use "B:" as the temp directory which may cause conflict, now it will choose a valid volume. Also UPT now accepts empty sections. Contributed-under: TianoCore Contribution Agreement 1.0 Signed-off-by: Hess Chen <hesheng.chen@intel.com> Reviewed-by: Yonghong Zhu <yonghong.zhu@intel.com>
2017-03-09BaseTools/UPT: Fix an issue of adding Event twiceHess Chen
Fix the issue of after installing a package the Event information is duplicated. The tool checks if the EVENT information existing in UserExtension or not. If already existing in UserExtension the tool will not add additional information. Contributed-under: TianoCore Contribution Agreement 1.0 Signed-off-by: Hess Chen <hesheng.chen@intel.com> Reviewed-by: Yonghong Zhu <yonghong.zhu@intel.com>
2017-03-09BaseTools/UPT: Man Page UpdateHess Chen
Update UPT man page to complete the description of options. Contributed-under: TianoCore Contribution Agreement 1.0 Signed-off-by: Hess Chen <hesheng.chen@intel.com> Reviewed-by: Yonghong Zhu <yonghong.zhu@intel.com>
2017-03-09BaseTools/UPT: Add a checkpoint for missing '"'Hess Chen
Add a checkpoint for UNI file which is missing '"' at the end of a line. Contributed-under: TianoCore Contribution Agreement 1.0 Signed-off-by: Hess Chen <hesheng.chen@intel.com> Reviewed-by: Yonghong Zhu <yonghong.zhu@intel.com>
2017-03-09BaseTools/ECC: Fix an issue of parameter parserHess Chen
The original solution of getting parameter name is to skip "_" but now it doesn't ignore "_" anymore. Contributed-under: TianoCore Contribution Agreement 1.0 Signed-off-by: Hess Chen <hesheng.chen@intel.com> Reviewed-by: Yonghong Zhu <yonghong.zhu@intel.com>
2017-03-07BaseTools/VolInfo: Fix VS2010/VS2012 build failureHao Wu
https://bugzilla.tianocore.org/show_bug.cgi?id=417 The commit makes the following refinements in VolInfo source codes to avoid VS2010/VS2012 build failure: 1. Refines coding style for function 'CombinePath' to declare local variables at the beginning of the function block. Contributed-under: TianoCore Contribution Agreement 1.0 Signed-off-by: Hao Wu <hao.a.wu@intel.com> Reviewed-by: Yonghong Zhu <yonghong.zhu@intel.com>
2017-03-07BaseTools/GenVtf: Fix VS2010/VS2012 build failureHao Wu
https://bugzilla.tianocore.org/show_bug.cgi?id=417 The commit makes the following refinements in GenVtf source codes to avoid VS2010/VS2012 build failure: 1. Refines coding style to declare local variables at the beginning of a code block in function 'main'. Contributed-under: TianoCore Contribution Agreement 1.0 Signed-off-by: Hao Wu <hao.a.wu@intel.com> Reviewed-by: Yonghong Zhu <yonghong.zhu@intel.com>
2017-03-07BaseTools/GenFw: Fix VS2010/VS2012 build failureHao Wu
https://bugzilla.tianocore.org/show_bug.cgi?id=417 The commit makes the following refinements in GenFw source codes to avoid VS2010/VS2012 build failure: 1. Replaces the uses of 'bool' with 'BOOLEAN' for accordance, and remove the header file dependency for '<stdbool.h>'. 2. Refines coding style for function 'GetSymName' to declare local variables at the beginning of the function block. Contributed-under: TianoCore Contribution Agreement 1.0 Signed-off-by: Hao Wu <hao.a.wu@intel.com> Reviewed-by: Yonghong Zhu <yonghong.zhu@intel.com>
2017-03-02BaseTools/Source/C/Makefiles: Fix NmakeSubdirs.bat always return 0Hao Wu
In batch script file NmakeSubdirs.bat, the value changes made to the variable 'TOOL_ERROR' within the 'setlocal...endlocal' block will not be reflected in the return value of the script. A value of 0 will always be returned. Thus, the script will not reflect the result of the 'nmake' command correctly when building BaseTool source codes. Contributed-under: TianoCore Contribution Agreement 1.0 Signed-off-by: Hao Wu <hao.a.wu@intel.com> Reviewed-by: Yonghong Zhu <yonghong.zhu@intel.com>
2017-03-01BaseTools/GenVtf & VolInfo: Fix build fail for 'snprintf' not definedHao Wu
Function snprintf() is not supported in Visual Studio 2013 or older version. The commit replaces the use of snprintf() with sprintf() to avoid build failure for VS compilers. Contributed-under: TianoCore Contribution Agreement 1.0 Signed-off-by: Hao Wu <hao.a.wu@intel.com> Reviewed-by: Liming Gao <liming.gao@intel.com> Reviewed-by: Yonghong Zhu <yonghong.zhu@intel.com>
2017-02-24BaseTools: GCC: move most AutoGen.obj contents back to .data sectionArd Biesheuvel
The generated AutoGen.c files mostly contain read-only data, but due to lacking annotations, all of it is emitted into the .data section by the compiler. Given that GUIDs are UEFI's gaffer tape, having writable GUIDs is a security hazard, and this was the main rationale for putting AutoGen.obj in the .text section. However, as it turns out, patchable PCDs are emitted there as well, which can legally be modified at runtime. So update the wildcard pattern to only match g...Guid sections, and move everything else back to .data (Note that this relies on -fdata-sections, without that option, everything is emitted into .data) Contributed-under: TianoCore Contribution Agreement 1.0 Signed-off-by: Ard Biesheuvel <ard.biesheuvel@linaro.org> Tested-by: Laszlo Ersek <lersek@redhat.com> Reviewed-by: Liming Gao <liming.gao@intel.com> Fixes: 233bd25b000f92fc4bbe181fa48edcd72808de8e [lersek@redhat.com: add reference to previous commit being fixed up] Signed-off-by: Laszlo Ersek <lersek@redhat.com>
2017-02-23BaseTools: Fix the regression issue caused by commit dc4c77Yonghong Zhu
In the last commit dc4c77, the _GetHeaderInfo will be called more than once, which cause the self._ConstructorList.append(Value) append some duplicate value. Cc: Liming Gao <liming.gao@intel.com> Contributed-under: TianoCore Contribution Agreement 1.0 Signed-off-by: Yonghong Zhu <yonghong.zhu@intel.com> Tested-by: Ard Biesheuvel <ard.biesheuvel@linaro.org> Reviewed-by: Liming Gao <liming.gao@intel.com>
2017-02-22BaseTool/Script: Add SmiHandleProfile OS tool to get symbol.Jiewen Yao
This tool accepts the input XML file generated by SmiHandlerProfile application and convert the RVA address to be a user readable symbol. It also converts the GUID to be a user readable string. Cc: Yonghong Zhu <yonghong.zhu@intel.com> Cc: Liming Gao <liming.gao@intel.com> Cc: Michael D Kinney <michael.d.kinney@intel.com> Cc: Laszlo Ersek <lersek@redhat.com> Contributed-under: TianoCore Contribution Agreement 1.0 Signed-off-by: Jiewen Yao <jiewen.yao@intel.com> Reviewed-by: Liming Gao <liming.gao@intel.com>
2017-02-22VfrCompile: fix invalid comparison between pointer and integerPaolo Bonzini
This would be valid C but is not valid C++, so change the comparison to do what it has always been doing. Contributed-under: TianoCore Contribution Agreement 1.0 Signed-off-by: Paolo Bonzini <pbonzini@redhat.com> Reviewed-by: Yonghong Zhu <yonghong.zhu@intel.com>
2017-02-22BaseTools: add error check for Macro usage in the INF fileYonghong Zhu
Use of MACRO statements in the EDK II INF files is limited to local usage only; global or external macros are not permitted. This patch add the check for not defined macros. Cc: Liming Gao <liming.gao@intel.com> Contributed-under: TianoCore Contribution Agreement 1.0 Signed-off-by: Yonghong Zhu <yonghong.zhu@intel.com> Reviewed-by: Liming Gao <liming.gao@intel.com>
2017-02-17BaseTools: Fix bug for GUIDED tool path override by DSC [BuildOptions]Yonghong Zhu
Current the GUIDED tool path can't be override to the different path in the [BuildOptions] of DSC file. This patch fix the bug. Fixes: https://bugzilla.tianocore.org/show_bug.cgi?id=283 Cc: Liming Gao <liming.gao@intel.com> Contributed-under: TianoCore Contribution Agreement 1.0 Signed-off-by: Yonghong Zhu <yonghong.zhu@intel.com> Reviewed-by: Liming Gao <liming.gao@intel.com>
2017-02-14BaseTools: Enhance BaseTools supports FixedAtBuild usage in VFR fileYonghong Zhu
This patch is to update BaseTools generate Fixed PCD APIs and Value into $(MODULE_NAME)StrDefs.h for VFR only. If the module has VFR files, and it directly consumes FixedAtBuild PCD, BaseTool will generate those FixedAtBuild PCD value into its $(MODULE_NAME)StrDefs.h. FixedPcdGetXX macro are always generated. Every FixedPcd _PCD_VALUE_PcdName will be generated without the postfix U or UL or ULL. Fixes: https://bugzilla.tianocore.org/show_bug.cgi?id=348 Cc: Liming Gao <liming.gao@intel.com> Contributed-under: TianoCore Contribution Agreement 1.0 Signed-off-by: Yonghong Zhu <yonghong.zhu@intel.com> Reviewed-by: Liming Gao <liming.gao@intel.com>
2017-02-13BaseTools: Add NOOPT target in CLANG38 tool chainLiming Gao
https://bugzilla.tianocore.org/show_bug.cgi?id=310 Cc: Yonghong Zhu <yonghong.zhu@intel.com> Contributed-under: TianoCore Contribution Agreement 1.0 Signed-off-by: Liming Gao <liming.gao@intel.com> Reviewed-by: Yonghong Zhu <yonghong.zhu@intel.com>
2017-02-08BaseTools: Fix the bug to parse the short varname in map fileYonghong Zhu
current in the map file, there have two ways for var to save its offset, if the varname is short, then the offset will in the same line with varname, otherwise, it saved in the next line. Cc: Liming Gao <liming.gao@intel.com> Contributed-under: TianoCore Contribution Agreement 1.0 Signed-off-by: Yonghong Zhu <yonghong.zhu@intel.com> Reviewed-by: Liming Gao <liming.gao@intel.com>
2017-02-06BaseTools: Update top VS Makefile with the absolute pathLiming Gao
After this update, BaseTools/Makefile can be trig at the other directory. Cc: Yonghong Zhu <yonghong.zhu@intel.com> Contributed-under: TianoCore Contribution Agreement 1.0 Signed-off-by: Liming Gao <liming.gao@intel.com> Reviewed-by: Yonghong Zhu <yonghong.zhu@intel.com>
2017-01-23BaseTools: Convert incomplete expression with dangling while()Nikolai SAOUKH
Contributed-under: TianoCore Contribution Agreement 1.0 Signed-off-by: Nikolai SAOUKH <nms@otdel-1.org> Reviewed-by: Yonghong Zhu <yonghong.zhu@intel.com> Reviewed-by: Liming Gao <liming.gao@intel.com>
2017-01-23BaseTools: Extend the Macro used in the FDF !include statementYonghong Zhu
Current it only support the system environment variables in the !include statement, $(WORKSPACE), $(PACKAGES_PATH), $(EFI_SOURCE), $(EDK_SOURCE), $(ECP_SOURCE), this patch extend the usage to support the Global macros and the macro which defined before the statement. Cc: Liming Gao <liming.gao@intel.com> Contributed-under: TianoCore Contribution Agreement 1.0 Signed-off-by: Yonghong Zhu <yonghong.zhu@intel.com> Reviewed-by: Liming Gao <liming.gao@intel.com>
2017-01-06BaseTools: not report error for the optional items in the FmpTokensYonghong Zhu
<FmpTokens> in the FDF spec defined some optional items, eg: IMAGE_INDEX, HARDWARE_INSTANCE. but current tool report error if no such item is exist in the FDF file. Fixes: https://bugzilla.tianocore.org/show_bug.cgi?id=293 Cc: Liming Gao <liming.gao@intel.com> Contributed-under: TianoCore Contribution Agreement 1.0 Signed-off-by: Yonghong Zhu <yonghong.zhu@intel.com> Reviewed-by: Liming Gao <liming.gao@intel.com>
2017-01-04BaseTools: fix the bug for Mixed Pcd display in the reportYonghong Zhu
Fix the bug to not display the mixed PCD in the Global PCD section, and correct the Pcd display name. Cc: Liming Gao <liming.gao@intel.com> Contributed-under: TianoCore Contribution Agreement 1.0 Signed-off-by: Yonghong Zhu <yonghong.zhu@intel.com> Reviewed-by: Liming Gao <liming.gao@intel.com>
2017-01-04BaseTools toolsetup.bat: set PATH to include Bin Win32 directoryLiming Gao
Bin Win32 directory includes antlr.exe. This tool is used when compile BaseTools source code. So, set it into PATH first. Cc: Yonghong Zhu <yonghong.zhu@intel.com> Contributed-under: TianoCore Contribution Agreement 1.0 Signed-off-by: Liming Gao <liming.gao@intel.com> Reviewed-by: Yonghong Zhu <yonghong.zhu@intel.com>
2017-01-04BaseTools toolsetup.bat: Set env when the binary tools are missingLiming Gao
BASE_TOOLS_PATH is required to be set when the binary tools are missing. Cc: Yonghong Zhu <yonghong.zhu@intel.com> Contributed-under: TianoCore Contribution Agreement 1.0 Signed-off-by: Liming Gao <liming.gao@intel.com> Reviewed-by: Yonghong Zhu <yonghong.zhu@intel.com>
2016-12-29BaseTools: Fix the bug for RAW file alignment value supportYonghong Zhu
Fix the bug for RAW file to support Align=32 and Align=64. Current FDF spec FfsAlignmentValues support this two values, while it is not the valid value for GenFfs. So this patch add the logic to handle it. Fixes: https://bugzilla.tianocore.org/show_bug.cgi?id=248 Cc: Liming Gao <liming.gao@intel.com> Contributed-under: TianoCore Contribution Agreement 1.0 Signed-off-by: Yonghong Zhu <yonghong.zhu@intel.com> Reviewed-by: Liming Gao <liming.gao@intel.com>
2016-12-29BaseTools/Ecc: Fix the issue of not recognizing "FILE_GUID"Hess Chen
Fix the issue of not recognizing "FILE_GUID" Contributed-under: TianoCore Contribution Agreement 1.0 Signed-off-by: Hess Chen <hesheng.chen@intel.com> Reviewed-by: Yonghong Zhu <yonghong.zhu@intel.com>
2016-12-23BaseTools/Pccts: Resolve GCC sting format mismatch build warningHao Wu
https://bugzilla.tianocore.org/show_bug.cgi?id=282 Contributed-under: TianoCore Contribution Agreement 1.0 Signed-off-by: Hao Wu <hao.a.wu@intel.com> Reviewed-by: Liming Gao <liming.gao@intel.com>
2016-12-20BaseTools GCC makefile: disable unused-result warning for CPP fileLiming Gao
This warning has been disabled for C file. To be same, it is also disabled for CPP file. Cc: Yonghong Zhu <yonghong.zhu@intel.com> Contributed-under: TianoCore Contribution Agreement 1.0 Signed-off-by: Liming Gao <liming.gao@intel.com> Reviewed-by: Yonghong Zhu <yonghong.zhu@intel.com>
2016-12-20BaseTools: fix write-strings build warningsHeyi Guo
Fix build warnings of "deprecated conversion from string constant to ?CHAR8* {aka char*}? [-Wwrite-strings]" for BaseTools, while using "gcc version 4.8.4 (Ubuntu 4.8.4-2ubuntu1~14.04.3)". Contributed-under: TianoCore Contribution Agreement 1.0 Signed-off-by: Heyi Guo <heyi.guo@linaro.org> Cc: Yonghong Zhu <yonghong.zhu@intel.com> Cc: Liming Gao <liming.gao@intel.com> Reviewed-by: Liming Gao <liming.gao@intel.com>
2016-12-20BaseTools: fix format type build warningsHeyi Guo
Fix build warnings of "format ?%d? expects argument of type ?int?, but argument 5 has type ?long unsigned int? [-Wformat=]" for BaseTools, while using "gcc version 4.8.4 (Ubuntu 4.8.4-2ubuntu1~14.04.3)". Contributed-under: TianoCore Contribution Agreement 1.0 Signed-off-by: Heyi Guo <heyi.guo@linaro.org> Cc: Yonghong Zhu <yonghong.zhu@intel.com> Cc: Liming Gao <liming.gao@intel.com> Reviewed-by: Liming Gao <liming.gao@intel.com>
2016-12-20BaseTools: fix format-security build warningsHeyi Guo
Fix build warnings of "format not a string literal and no format arguments [-Wformat-security]" for BaseTools, while using "gcc version 4.8.4 (Ubuntu 4.8.4-2ubuntu1~14.04.3)". Contributed-under: TianoCore Contribution Agreement 1.0 Signed-off-by: Heyi Guo <heyi.guo@linaro.org> Cc: Yonghong Zhu <yonghong.zhu@intel.com> Cc: Liming Gao <liming.gao@intel.com> Reviewed-by: Liming Gao <liming.gao@intel.com>
2016-12-20BaseTools: Correct bin wrappers for GenDepex.py pathYonghong Zhu
The WindowsLike and PosixLike bin wrappers for GenDepex.py do not use correct path. GenDepex.py is not in a GenDepex directory. Instead, it is in the AutoGen directory. Fixes: https://bugzilla.tianocore.org/show_bug.cgi?id=292 Cc: Liming Gao <liming.gao@intel.com> Contributed-under: TianoCore Contribution Agreement 1.0 Signed-off-by: Yonghong Zhu <yonghong.zhu@intel.com> Reviewed-by: Liming Gao <liming.gao@intel.com>
2016-12-05BaseTools/VolInfo: Fix printf issue using '%ls' in format stringHao Wu
https://bugzilla.tianocore.org/show_bug.cgi?id=257 For GCC compilers, when building with option '-fshort-wchar', wide char string format '%ls' does not work properly for printf() function. The string specified by '%ls' will not be printed. This commit avoids using '%ls' for printf() function and converts the wide char string to char string for printing. Cc: Liming Gao <liming.gao@intel.com> Cc: Yonghong Zhu <yonghong.zhu@intel.com> Contributed-under: TianoCore Contribution Agreement 1.0 Signed-off-by: Hao Wu <hao.a.wu@intel.com> Reviewed-by: Liming Gao <liming.gao@intel.com>
2016-12-02BaseTools: Support QuotedString for PREBUILD/POSTBUILD in DSC fileYonghong Zhu
If the prebuild/postbuild script statement start with double quotations, current tool report error, while DSC spec allow this usage. so update tool to support it. Cc: Liming Gao <liming.gao@intel.com> Contributed-under: TianoCore Contribution Agreement 1.0 Signed-off-by: Yonghong Zhu <yonghong.zhu@intel.com> Reviewed-by: Liming Gao <liming.gao@intel.com>
2016-12-02BaseTools: Fix the bug to parse the new map file formatYonghong Zhu
Current the variable and Pcd format save in the map file is changed, so this patch is to support this new format. Cc: Liming Gao <liming.gao@intel.com> Contributed-under: TianoCore Contribution Agreement 1.0 Signed-off-by: Yonghong Zhu <yonghong.zhu@intel.com> Reviewed-by: Liming Gao <liming.gao@intel.com>
2016-12-02BaseTools: add error check for "#image" for idf file formatYonghong Zhu
Add new error check for "#image" keyword used in the image definition file. Cc: Liming Gao <liming.gao@intel.com> Contributed-under: TianoCore Contribution Agreement 1.0 Signed-off-by: Yonghong Zhu <yonghong.zhu@intel.com> Reviewed-by: Liming Gao <liming.gao@intel.com>
2016-11-30BaseTools: fix the bug to add PaletteSize info into AutoGenYonghong Zhu
Fix the bug to add PaletteSize info into AutoGen.c when the flag UEFI_HII_RESOURCE_SECTION is set to FALSE. Cc: Liming Gao <liming.gao@intel.com> Contributed-under: TianoCore Contribution Agreement 1.0 Signed-off-by: Yonghong Zhu <yonghong.zhu@intel.com> Reviewed-by: Liming Gao <liming.gao@intel.com>
2016-11-30BaseTools CommonLib: Update ReadMemoryFileLine() to read line in file scopeLiming Gao
https://bugzilla.tianocore.org/show_bug.cgi?id=255 Check CurrentFilePointer to make sure it not exceed the end of file. Cc: Yonghong Zhu <yonghong.zhu@intel.com> Contributed-under: TianoCore Contribution Agreement 1.0 Signed-off-by: Liming Gao <liming.gao@intel.com> Reviewed-by: Yonghong Zhu <yonghong.zhu@intel.com>
2016-11-29BaseTools: Fix bug for decimal value of VPDPCD offset display in reportYonghong Zhu
current if we set VPD PCD's offset to a decimal value, eg: 22, this value is displayed incorrectly in the "FD VPD Region" section in the report.txt. Cc: Liming Gao <liming.gao@intel.com> Contributed-under: TianoCore Contribution Agreement 1.0 Signed-off-by: Yonghong Zhu <yonghong.zhu@intel.com> Reviewed-by: Liming Gao <liming.gao@intel.com>
2016-11-23BaseTools: report error for same Guid's Private definition conflictYonghong Zhu
Add error check for the same Guid/Protocol/PPIs/Includes defined as both Private and non-Private attribute. Fixes: https://bugzilla.tianocore.org/show_bug.cgi?id=209 Cc: Liming Gao <liming.gao@intel.com> Contributed-under: TianoCore Contribution Agreement 1.0 Signed-off-by: Yonghong Zhu <yonghong.zhu@intel.com> Reviewed-by: Liming Gao <liming.gao@intel.com>
2016-11-18BaseTools gitignore: Ignore VS intermediate files *.obj and *.pdbLiming Gao
In V2, ignore .exe and .ilk files Cc: Yonghong Zhu <yonghong.zhu@intel.com> Contributed-under: TianoCore Contribution Agreement 1.0 Signed-off-by: Liming Gao <liming.gao@intel.com> Reviewed-by: Michael Kinney <michael.d.kinney@intel.com> Reviewed-by: Yonghong Zhu <yonghong.zhu@intel.com>
2016-11-18BaseTools/BuildEnv: Do not modify the env 'PACKAGES_PATH' in BuildEnvHao Wu
https://bugzilla.tianocore.org/show_bug.cgi?id=236 The script 'BuildEnv' modifies the value of the environment variable 'PACKAGES_PATH' (line 44). The script will substitute the ':' symbol (separating multiple paths) with a space. This is not supposed to happen since users might later use 'PACKAGES_PATH' during the code-building process under a multiple-workspace scenario. Cc: Liming Gao <liming.gao@intel.com> Cc: Yonghong Zhu <yonghong.zhu@intel.com> Contributed-under: TianoCore Contribution Agreement 1.0 Signed-off-by: Hao Wu <hao.a.wu@intel.com> Reviewed-by: Liming Gao <liming.gao@intel.com>
2016-11-16BaseTools tools_def.txt: Include AutoGen.h in GCC ASLPP_FLAGSLiming Gao
https://bugzilla.tianocore.org/show_bug.cgi?id=227 Refer to VS ASLPP_FLAGS, force include AutoGen.h so that ASL code can use FixedPcdGetXX to get FixedPcd value. Cc: Yonghong Zhu <yonghong.zhu@intel.com> Contributed-under: TianoCore Contribution Agreement 1.0 Signed-off-by: Liming Gao <liming.gao@intel.com> Reviewed-by: Yonghong Zhu <yonghong.zhu@intel.com>
2016-11-16BaseTools tools_def.txt: Remove -P option in GCC ASLPP_FLAGSLiming Gao
https://bugzilla.tianocore.org/show_bug.cgi?id=227 After -P option is removed, the generated preprocessed ASL file will have line markers. The extra information can be removed by Trim script. ASL code can refer to the definition in C source file. This has been supported in VS and XCODE tool chains. Cc: Yonghong Zhu <yonghong.zhu@intel.com> Contributed-under: TianoCore Contribution Agreement 1.0 Signed-off-by: Liming Gao <liming.gao@intel.com> Reviewed-by: Yonghong Zhu <yonghong.zhu@intel.com>
2016-11-15BaseTools: FILE DATA to support relative path under Multiple workspaceYonghong Zhu
Fix the bug that FILE DATA to support relative path under Multiple workspace. Cc: Liming Gao <liming.gao@intel.com> Contributed-under: TianoCore Contribution Agreement 1.0 Signed-off-by: Yonghong Zhu <yonghong.zhu@intel.com> Reviewed-by: Liming Gao <liming.gao@intel.com>
2016-11-15BaseTools: Fix the bug to support generate FFS by Align=AutoYonghong Zhu
FDF spec support to use 'Auto' as <FfsAlignmentValues>, but current Tool report error about -a=Auto is invalid option when we set Align=Auto for RAW File. Cc: Liming Gao <liming.gao@intel.com> Contributed-under: TianoCore Contribution Agreement 1.0 Signed-off-by: Yonghong Zhu <yonghong.zhu@intel.com> Reviewed-by: Liming Gao <liming.gao@intel.com>
2016-11-14BaseTools/Scripts: Add BinToPcd utilityMichael Kinney
https://bugzilla.tianocore.org/show_bug.cgi?id=228 Add a utility that converts a binary file into a VOID* PCD value or a full DSC file VOID* PCD statement with support for all the DSC supported PCD sections. usage: BinToPcd [-h] [--version] -i INPUTFILE [-o OUTPUTFILE] [-p PCDNAME] [-t {VPD,HII}] [-m MAXSIZE] [-f OFFSET] [-n VARIABLENAME] [-g VARIABLEGUID] [-v] [-q] [--debug [0-9]] Convert a binary file to a VOID* PCD value or DSC file VOID* PCD statement. Copyright (c) 2016, Intel Corporation. All rights reserved. optional arguments: -h, --help show this help message and exit --version show program's version number and exit -i INPUTFILE, --input INPUTFILE Input binary filename -o OUTPUTFILE, --output OUTPUTFILE Output filename for PCD value or PCD statement -p PCDNAME, --pcd PCDNAME Name of the PCD in the form <PcdTokenSpaceGuidCName>.<PcdCName> -t {VPD,HII}, --type {VPD,HII} PCD statement type (HII or VPD). Default is standard. -m MAXSIZE, --max-size MAXSIZE Maximum size of the PCD. Ignored with --type HII. -f OFFSET, --offset OFFSET VPD offset if --type is VPD. UEFI Variable offset if --type is HII. -n VARIABLENAME, --variable-name VARIABLENAME UEFI variable name. Only used with --type HII. -g VARIABLEGUID, --variable-guid VARIABLEGUID UEFI variable GUID C name. Only used with --type HII. -v, --verbose Increase output messages -q, --quiet Reduce output messages --debug [0-9] Set debug level This utility can be used in PCD value mode to convert a binary file into a string that can then be copied into the PCD value field of a VOID* PCD. The following is an example of PCD value mode on an 8 byte test.bin file. BinToPcd.py -i test.bin {0x48, 0x65, 0x6c, 0x6c, 0x6f, 0x20, 0x0d, 0x0a} The DSC file VOID* PCD statement mode can be used to generate a complete PCD statement for the PCD section types that a DSC file supports: [PcdsFixedAtBuild] [PcdsPatchableInModule] [PcdsDynamicDefault] [PcdsDynamicExDefault] [PcdsDynamicVpd] [PcdsDynamicExVpd] [PcdsDynamicHii] [PcdsDynamicExHii] The PCD statement mode is useful when combined with a !include statement in a DSC file. BinToPcd.py can be used to convert a binary file to a PCD statement in an output file, and that output file can be included into a DSC file in the matching PCD section to set the value of the PCD to the value from the binary file without having to copy the value into the DSC file. Updates can be made to the included file without editing the DSC file. Some example use cases are the setting the public key PCDs such as: gEfiSecurityPkgTokenSpaceGuid.PcdRsa2048Sha256PublicKeyBuffer gEfiSecurityPkgTokenSpaceGuid.PcdPkcs7CertBuffer The following example converts a public key binary file to a [PcdsFixedAtBuild] compatible PCD statement: BinToPcd.py -i PublicKey.bin -o PublicKey.pcd --pcd gEfiSecurityPkgTokenSpaceGuid.PcdPkcs7CertBufferkenSpaceGuid The PublicKey.pcd output file contains a single line: gEfiSecurityPkgTokenSpaceGuid.PcdPkcs7CertBuffer|{0x48, ...} A DSC file can be updated to include the PublicKey.pcd file: [PcdsFixedAtBuild] !include PublicKey.pcd Value examples =============== BinToPcd.py -i test.bin {0x68, 0x65, 0x6c, 0x6c, 0x6f, 0x20, 0x0d, 0x0a} Normal examples: ================= BinToPcd.py -i test.bin -p Guid.Token Guid.Token|{0x68, 0x65, 0x6c, 0x6c, 0x6f, 0x20, 0x0d, 0x0a} BinToPcd.py -i test.bin -p Guid.Token -m 20 Guid.Token|{0x68, 0x65, 0x6c, 0x6c, 0x6f, 0x20, 0x0d, 0x0a}|VOID*|20 VPD examples: ============= BinToPcd.py -i test.bin -p Guid.Token -t VPD Guid.Name|*|8|{0x48, 0x65, 0x6c, 0x6c, 0x6f, 0x20, 0x0d, 0x0a} BinToPcd.py -i test.bin -p Guid.Token -t VPD -f 20 Guid.Name|20|8|{0x48, 0x65, 0x6c, 0x6c, 0x6f, 0x20, 0x0d, 0x0a} BinToPcd.py -i test.bin -p Guid.Token -t VPD -m 10 Guid.Name|*|10|{0x48, 0x65, 0x6c, 0x6c, 0x6f, 0x20, 0x0d, 0x0a} BinToPcd.py -i test.bin -p Guid.Token -t VPD -f 20 -m 10 Guid.Name|20|10|{0x48, 0x65, 0x6c, 0x6c, 0x6f, 0x20, 0x0d, 0x0a} HII examples: ============= BinToPcd.py -i test.bin -p Guid.Token -t HII -g VarGuid -n VarName Guid.Name|L"VarName"|VarGuid|0|{0x48, 0x65, 0x6c, 0x6c} BinToPcd.py -i test.bin -p Guid.Token -t HII -g VarGuid -n VarName -f 8 Guid.Name|L"VarName"|VarGuid|8|{0x48, 0x65, 0x6c, 0x6c} Cc: Yonghong Zhu <yonghong.zhu@intel.com> Cc: Liming Gao <liming.gao@intel.com> Contributed-under: TianoCore Contribution Agreement 1.0 Signed-off-by: Michael Kinney <michael.d.kinney@intel.com> Reviewed-by: Liming Gao <liming.gao@intel.com> Reviewed-by: Yonghong Zhu <yonghong.zhu@intel.com>
2016-11-10BaseTools/GenSec: Return correct status when input file size is 0Hao Wu
Cc: Liming Gao <liming.gao@intel.com> Cc: Yonghong Zhu <yonghong.zhu@intel.com> Contributed-under: TianoCore Contribution Agreement 1.0 Signed-off-by: Hao Wu <hao.a.wu@intel.com> Reviewed-by: Liming Gao <liming.gao@intel.com>