Commit Graph

1141 Commits

Author SHA1 Message Date
Bob Feng 072418e553 BaseTools: Fix build fail when the number in validlist is long type.
Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: "Bob Feng" <bob.c.feng@intel.com>
Reviewed-by: "Chen, Hesheng" <hesheng.chen@intel.com>




git-svn-id: https://svn.code.sf.net/p/edk2/code/trunk/edk2@18256 6f19259b-4bc3-4df7-8a09-765794883524
2015-08-21 01:09:16 +00:00
Ard Biesheuvel 06cd723125 BaseTools AARCH64: use tiny code model by default
The AARCH64 tiny code model produces more efficient code, since it
uses relative symbol references rather than absolute references, i.e.,
an emitted relative reference refers to the symbol directly rather
than a literal containing its 64-bit absolute address. This saves
space in the binary, and reduces the number of relocation fixups that
need to be applied by the PE/COFF loader.

So now that we support relative relocations in GenFw, move to the
tiny code model by default. Note that the large model can still be
selected by individual modules by adding -mcmodel=large to the
appropriate CC_FLAGS.

Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Ard Biesheuvel <ard.biesheuvel@linaro.org>
Reviewed-by: Laszlo Ersek <lersek@redhat.com>
Reviewed-by: Leif Lindholm <leif.lindholm@linaro.org>
Tested-by: Leif Lindholm <leif.lindholm@linaro.org>

git-svn-id: https://svn.code.sf.net/p/edk2/code/trunk/edk2@18242 6f19259b-4bc3-4df7-8a09-765794883524
2015-08-20 06:39:12 +00:00
Liming Gao 71028ba2c4 BaseTools: Add /arch:IA32 option in VS2012 and VS2013
VS2012 and VS2013 turn on optimizations by default that generate the
use of CMOV instruction. This is a change from previous version VS2008.
This means when you build with VS2012 or VS2013, it will generate UD
exceptions on Quark.

To resolve it, add /arch:IA32 options to not use enhanced instructions.
https://msdn.microsoft.com/en-us/library/7t5yh4fd(v=vs.140).aspx

Update the default options of VS2012 & VS2013 tool chain IA32 arch in
BaseTools\Conf\tools_def.template to make sure the generated Quark
compatibility driver.

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>

git-svn-id: https://svn.code.sf.net/p/edk2/code/trunk/edk2@18230 6f19259b-4bc3-4df7-8a09-765794883524
2015-08-18 02:52:32 +00:00
Ard Biesheuvel 70bd69912a BaseTools GCC: prevent unaligned memory accesses on ARM GCC 4.6
In GCC 4.7, a feature was added to the ARM backend that allows
unaligned loads and stores to be emitted. Since it is enabled by
default on ARMv6 and later CPUs, and since such code is not suitable
in our case (i.e., bare metal code), we must disable it by passing the
-mno-unaligned-access option if we are using GCC 4.7 or later.

However, this particular feature and its enabling by default have been
backported to version 4.6 by Linaro. Since the Linaro toolchains are
widely used for ARM development, and also shipped by distros such as
Ubuntu, we should disable the feature on version 4.6 as well.
Unfortunately, since the upstream version does not support the feature,
it also does not understand the -mno-unaligned-access option.

Since GCC sets the builtin #define __ARM_FEATURE_UNALIGNED to 1 when
-munaligned-access is in effect, we can force the build to fail in this
case by passing -D__ARM_FEATURE_UNALIGNED=0 on the GCC command line.

This will produce the following error message:

  <command-line>:0:0: error: "__ARM_FEATURE_UNALIGNED" redefined [-Werror]
  <built-in>:0:0: note: this is the location of the previous definition

and terminate the build.

This patch may cause some existing builds to fail, but they will be
builds that were previously at risk of unexpected runtime exceptions.
Those builds can also easily be switched to the GCC47 profile instead,
generating safe binaries.

Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Ard Biesheuvel <ard.biesheuvel@linaro.org>
Reviewed-by: Leif Lindholm <leif.lindholm@linaro.org>

git-svn-id: https://svn.code.sf.net/p/edk2/code/trunk/edk2@18228 6f19259b-4bc3-4df7-8a09-765794883524
2015-08-17 12:02:50 +00:00
Ard Biesheuvel 26ecc55c02 BaseTools IA32/X64: prevent .eh_frame sections from being generated
After the recent GNU linker script changes, the following warning is
emitted many times during the OVMF build:

BFD: <...>: warning: Empty loadable segment detected, is this intentional ?

This is caused by the fact that, now that the section layout has changed
somewhat, the .eh_frame section is assigned an ELF segment of its own,
which ends up with no contents at all after we strip the .eh_frame
section from the output. (Note that the program headers that contain the
segment information are completely irrelevant to us since the PE/COFF
conversion does not rely on them.)

Since we only retain the .eh_frame data for external debugging, and not
for things like stack unwinding or generating backtraces at runtime, we
can remedy the situation by passing -fno-asynchronous-unwind-tables on
the GCC command line. This option instructs the compiler to emit the
unwind data into a debug section called .debug_frame instead of into
.eh_frame.

Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Ard Biesheuvel <ard.biesheuvel@linaro.org>
Reviewed-by: Laszlo Ersek <lersek@redhat.com>
Build-tested-by: Laszlo Ersek <lersek@redhat.com>
Reviewed-by: Liming Gao <liming.gao@intel.com>

git-svn-id: https://svn.code.sf.net/p/edk2/code/trunk/edk2@18217 6f19259b-4bc3-4df7-8a09-765794883524
2015-08-13 06:02:00 +00:00
Ard Biesheuvel 64ffb95441 BaseTools: remove ARMGCC and ARMLINUXGCC toolchains
The ARMGCC and ARMLINUXGCC toolchains are specific to the ARM and
AARCH64 architectures, and overlap with the toolchain configuration
that is provided by the GCC44 - GCC49 toolchains, which are defined
for all architectures.

To reduce the maintenance burden, and make it easier to keep these
different architectures aligned, remove the ARMGCC and ARMLINUXGCC
toolchains entirely.

Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Ard Biesheuvel <ard.biesheuvel@linaro.org>
Reviewed-by: Leif Lindholm <leif.lindholm@linaro.org>
Reviewed-by: Liming Gao <liming.gao@intel.com>

git-svn-id: https://svn.code.sf.net/p/edk2/code/trunk/edk2@18212 6f19259b-4bc3-4df7-8a09-765794883524
2015-08-12 05:25:48 +00:00
Ard Biesheuvel ad2a2e5623 BaseTools: add ARCH detection for AARCH64 and ARM
Add auto detection for the ARCH variable for AARCH64 and ARM
systems. This allows us to do a native build of the BaseTools
without the need to set ARCH externally.

Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Ard Biesheuvel <ard.biesheuvel@linaro.org>
Reviewed-by: Liming Gao <liming.gao@intel.com>

git-svn-id: https://svn.code.sf.net/p/edk2/code/trunk/edk2@18206 6f19259b-4bc3-4df7-8a09-765794883524
2015-08-12 05:22:49 +00:00
Qiu Shumin 9979bab783 BaseTools/GenFds: Fix 'NoneType' object is not iterable error.
When adding section VERSION in FDF file, for example:
FILE FREEFORM = PCD(gEfiIntelFrameworkModulePkgTokenSpaceGuid.PcdLogoFile) {
    SECTION RAW = MdeModulePkg/Logo/Logo.bmp
    SECTION UI = "Logo"
    SECTION VERSION = "0001"
  }
GenFds will report the following error:
Traceback (most recent call last):
  File "GenFds.py", line 276, in main
  File "GenFds.py", line 391, in GenFd
  File "Fd.py", line 93, in GenFd
  File "Region.py", line 106, in AddToBuffer
  File "Fv.py", line 114, in AddToBuffer
  File "FfsFileStatement.py", line 117, in GenFfs
  File "VerSection.py", line 80, in GenSection
  File "GenFdsGlobalVariable.py", line 401, in GenerateSection
TypeError: 'NoneType' object is not iterable.
We found in GenFdsGlobalVariable.py line 401 'list' requires a iteralbe object as parameter while the 'Input' is None.

Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Qiu Shumin <shumin.qiu@intel.com>
Reviewed-by: Yingke Liu <yingke.d.liu@intel.com>
Reviewed-by: Liming Gao <liming.gao@intel.com>

git-svn-id: https://svn.code.sf.net/p/edk2/code/trunk/edk2@18205 6f19259b-4bc3-4df7-8a09-765794883524
2015-08-12 01:27:31 +00:00
Ard Biesheuvel 5c02fc49ae BaseTools: add CLANG35 toolchain with AARCH64 support
This adds support for building the AARCH64 platforms using the
Clang compiler and assembler combined with the GNU (cross-)linker.

The chosen name CLANG35 is based on version 3.5 being the oldest
supported version, but no issues are known that should prevent its
use with any later version.

Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Ard Biesheuvel <ard.biesheuvel@linaro.org>
Reviewed-by: Leif Lindholm <leif.lindholm@linaro.org>
Tested-by: Leif Lindholm <leif.lindholm@linaro.org>
Reviewed-by: Liming Gao <liming.gao@intel.com>

git-svn-id: https://svn.code.sf.net/p/edk2/code/trunk/edk2@18198 6f19259b-4bc3-4df7-8a09-765794883524
2015-08-10 07:55:26 +00:00
Ard Biesheuvel 24d610e677 BaseTools/GenFw: allow AArch64 tiny and small code model relocations
The AArch64 small C model makes extensive use of ADRP/ADD and
ADRP/{LDR,STR} pairs to emit PC-relative symbol references with
a +/- 4 GB range. Since the relocation pair splits the relative
offset into a relative page offset and an absolute offset into
a 4 KB page, we need to take extra care to ensure that the target
of the relocation preserves its alignment relative to a 4 KB
alignment boundary.

Also, due to a problem with the --emit-relocs GNU ld option, where
it does not recalculate the addends for section relative relocations,
the only way to guarantee correct code is by requiring the relative
section offset to be equal in the ELF and PE/COFF versions of the
binary. This affects both the 'tiny' and 'small' GCC code models.

Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Ard Biesheuvel <ard.biesheuvel@linaro.org>
Reviewed-by: Leif Lindholm <leif.lindholm@linaro.org>
Tested-by: Leif Lindholm <leif.lindholm@linaro.org>
Reviewed-by: Liming Gao <liming.gao@intel.com>

git-svn-id: https://svn.code.sf.net/p/edk2/code/trunk/edk2@18197 6f19259b-4bc3-4df7-8a09-765794883524
2015-08-10 07:55:18 +00:00
Yingke Liu 55668ca245 BaseTools/Trim: Fixed a bug that cannot trim long values
The long value substitution must move to the front of
HEX substitution, and updated build_rule to add --trim-long

Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Yingke Liu <yingke.d.liu@intel.com>
Reviewed-by: Liming Gao <liming.gao@intel.com>

git-svn-id: https://svn.code.sf.net/p/edk2/code/trunk/edk2@18170 6f19259b-4bc3-4df7-8a09-765794883524
2015-08-06 08:05:59 +00:00
Ard Biesheuvel c4a59af8c1 BaseTools IA32/X64: Use GccBase.lds instead of gcc*-ld-script
These scripts all now have the same contents, so we only need to use
GccBase.lds. Therefore we can delete gcc-4K-align-ld-script,
gcc4.4-ld-script and gcc4.9-ld-script.

Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Ard Biesheuvel <ard.biesheuvel@linaro.org>
Reviewed-by: Jordan Justen <jordan.l.justen@intel.com>
Tested-by: Liming Gao <liming.gao@intel.com>

git-svn-id: https://svn.code.sf.net/p/edk2/code/trunk/edk2@18142 6f19259b-4bc3-4df7-8a09-765794883524
2015-08-03 08:23:59 +00:00
Ard Biesheuvel a7ab160209 BaseTools AARCH64: remove incremental linker script for 64K alignment
Now that we moved all users to the unified GCC linker script, remove
the old 64 KB incremental linker script for AARCH64 since it is now
unused.

Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Ard Biesheuvel <ard.biesheuvel@linaro.org>
Reviewed-by: Jordan Justen <jordan.l.justen@intel.com>
Reviewed-by: Leif Lindholm <leif.lindholm@linaro.org>
Tested-by: Leif Lindholm <leif.lindholm@linaro.org>

git-svn-id: https://svn.code.sf.net/p/edk2/code/trunk/edk2@18141 6f19259b-4bc3-4df7-8a09-765794883524
2015-08-03 08:23:36 +00:00
Ard Biesheuvel 6b3720e438 BaseTools AARCH64: move to unified GCC linker script
Drop the GCC AARCH64 specific linker script and use the new
unified one instead.

Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Ard Biesheuvel <ard.biesheuvel@linaro.org>
Reviewed-by: Jordan Justen <jordan.l.justen@intel.com>
Reviewed-by: Leif Lindholm <leif.lindholm@linaro.org>
Tested-by: Leif Lindholm <leif.lindholm@linaro.org>

git-svn-id: https://svn.code.sf.net/p/edk2/code/trunk/edk2@18138 6f19259b-4bc3-4df7-8a09-765794883524
2015-08-03 08:23:05 +00:00
Ard Biesheuvel 233bd25b00 BaseTools GCC: move AutoGen.obj contents to .text section
All AutoGen.obj files consist of global GUID definitions, fixed
and patchable PCDs and other data that is essentially read-only at
runtime but has not been declared as such for various reasons.

By moving these contents to .text we achieve two things:
- global GUIDs and other data items which must be constant for correct
  program operation can no longer be modified, for instance, when
  running a DXE_RUNTIME_MODULE binary under the OS with the Properties
  Table feature for memory protection enabled;
- the .data section becomes smaller, and may be dropped completely for
  many XIP modules, which reduces wasted FV space if the PE/COFF section
  alignment is large.

Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Ard Biesheuvel <ard.biesheuvel@linaro.org>
Reviewed-by: Jordan Justen <jordan.l.justen@intel.com>
Tested-by: Liming Gao <liming.gao@intel.com>
Tested-by: Leif Lindholm <leif.lindholm@linaro.org>

git-svn-id: https://svn.code.sf.net/p/edk2/code/trunk/edk2@18137 6f19259b-4bc3-4df7-8a09-765794883524
2015-08-03 08:22:50 +00:00
Ard Biesheuvel 56948ba190 BaseTools GCC: align start of .data to .text alignment
Now that GenFw honors the ELF section alignment when placing the
PE/COFF sections in the output, the start of the PE/COFF version of
.data will be aligned to the alignment of .text if its alignment is
higher than the default. So duplicate this behavior in the ELF output,
this will make the memory layout of the PE/COFF binary match the
layout of the ELF version more closely.

Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Ard Biesheuvel <ard.biesheuvel@linaro.org>
Reviewed-by: Jordan Justen <jordan.l.justen@intel.com>
Tested-by: Liming Gao <liming.gao@intel.com>
Tested-by: Leif Lindholm <leif.lindholm@linaro.org>

git-svn-id: https://svn.code.sf.net/p/edk2/code/trunk/edk2@18136 6f19259b-4bc3-4df7-8a09-765794883524
2015-08-03 08:22:39 +00:00
Ard Biesheuvel efe690cab3 BaseTools GCC: add unified GCC linker script for all archs and versions
This unifies all GCC linker scripts into a single parametrised GCC
linker script that can be used for all GCC versions and architectures.

The two parameters that can be set on the linker command line are:
- PECOFF_HEADER_SIZE, this is a build time property of GenFw, but
  its value is different between 32-bit and 64-bit;
- common-page-size, this can be set using -z on the ld command line,
  and controls the value of the COMMONPAGESIZE constant when used in
  a linker script. This value is used for the minimum section alignment.

Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Ard Biesheuvel <ard.biesheuvel@linaro.org>
Reviewed-by: Jordan Justen <jordan.l.justen@intel.com>
Tested-by: Liming Gao <liming.gao@intel.com>
Tested-by: Leif Lindholm <leif.lindholm@linaro.org>

git-svn-id: https://svn.code.sf.net/p/edk2/code/trunk/edk2@18135 6f19259b-4bc3-4df7-8a09-765794883524
2015-08-03 08:22:28 +00:00
Ard Biesheuvel c28a4ab663 BaseTools IA32/X64: get header size and alignment from ld commandline
Instead of hardcoding the values for the PE/COFF header size and the
section alignment, set them on the linker command line. This factors
out these values from the various linker scripts, which will allow us
to unify them in a subsequent patch.

Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Ard Biesheuvel <ard.biesheuvel@linaro.org>
Reviewed-by: Jordan Justen <jordan.l.justen@intel.com>
Tested-by: Liming Gao <liming.gao@intel.com>

git-svn-id: https://svn.code.sf.net/p/edk2/code/trunk/edk2@18134 6f19259b-4bc3-4df7-8a09-765794883524
2015-08-03 08:22:16 +00:00
Ard Biesheuvel 25e63063e3 BaseTools IA32/X64: move .got contents to the PE/COFF .text section
Move the .got contents to the PE/COFF .text section. This should be
a no-op, since we typically don't generate position independent code
(i.e., using -fPIC). But since the GOT contains variable addresses that
are updated at relocation time only, its contents are best kept in .text
to prevent them from being overwritten inadvertently.

Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Ard Biesheuvel <ard.biesheuvel@linaro.org>
Reviewed-by: Jordan Justen <jordan.l.justen@intel.com>
Tested-by: Liming Gao <liming.gao@intel.com>

git-svn-id: https://svn.code.sf.net/p/edk2/code/trunk/edk2@18133 6f19259b-4bc3-4df7-8a09-765794883524
2015-08-03 08:22:00 +00:00
Ard Biesheuvel cdeb268cb0 BaseTools IA32/X64: drop redundant alignment from linker script
There is no need to pad out the end of a section of the start of
the following section is aligned to the same value. So drop the
redundant ALIGN() statements.

Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Ard Biesheuvel <ard.biesheuvel@linaro.org>
Reviewed-by: Jordan Justen <jordan.l.justen@intel.com>
Tested-by: Liming Gao <liming.gao@intel.com>

git-svn-id: https://svn.code.sf.net/p/edk2/code/trunk/edk2@18132 6f19259b-4bc3-4df7-8a09-765794883524
2015-08-03 08:21:49 +00:00
Ard Biesheuvel fa1d29d5cc BaseTools IA32/X64: move .rodata to PE/COFF .text section
The .rodata ELF section contains constant non-executable data that
should never be modified by the program itself. Since the risk of
inadvertent modification is typically higher than the risk of
inadvertent execution, it makes sense to put this data in the
R-X .text section rather than in the RW- .data section.
So move it there.

Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Ard Biesheuvel <ard.biesheuvel@linaro.org>
Reviewed-by: Jordan Justen <jordan.l.justen@intel.com>
Tested-by: Liming Gao <liming.gao@intel.com>

git-svn-id: https://svn.code.sf.net/p/edk2/code/trunk/edk2@18131 6f19259b-4bc3-4df7-8a09-765794883524
2015-08-03 08:21:39 +00:00
Ard Biesheuvel e90ba6e1ea BaseTools IA32/X64: remove NOP padding from X86/IA32 GCC linker scripts
The NOP padding in the GCC linker scripts ensures that all empty
regions in the ELF binary are filled with x86 NOP instructions.

There is no upside to doing this: if the CPU ends up executing these
instructions, we have little hope of resuming normal execution of the
program anyway. And having NOP slides in memory only makes it easier
for attackers to launch exploits. So remove them.

Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Ard Biesheuvel <ard.biesheuvel@linaro.org>
Reviewed-by: Jordan Justen <jordan.l.justen@intel.com>
Tested-by: Liming Gao <liming.gao@intel.com>

git-svn-id: https://svn.code.sf.net/p/edk2/code/trunk/edk2@18130 6f19259b-4bc3-4df7-8a09-765794883524
2015-08-03 08:21:28 +00:00
Yingke Liu aaf8aa7b2c BaseTools: Add a keyword FvNameString in FDF
The keyword with value TRUE OR FALSE is used to
indicate whether the FV UI name is included in
FV EXT header as a entry or not.

Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Yingke Liu <yingke.d.liu@intel.com>
Reviewed-by: Liming Gao <liming.gao@intel.com>

git-svn-id: https://svn.code.sf.net/p/edk2/code/trunk/edk2@18090 6f19259b-4bc3-4df7-8a09-765794883524
2015-07-28 05:53:08 +00:00
Ard Biesheuvel 47746688e1 BaseTools/GenFv: optimize away redundant padding
To prevent double padding of XIP modules leading to excessive
waste of FV space, try to adjust existing padding rather than
adding more.

Instead of adding a pad file to the FV to line up an FFS file that
itself may contain padding to line up the payload, try to find a
dedicated padding section inside the FFS, and reduce its size to
place all subsequent aligned FFS section at their respective minimum
alignments.

When using 4 KB section alignment (which is required on AARCH64 in
some cases), this will save 4 KB for each XIP module.

Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Ard Biesheuvel <ard.biesheuvel@linaro.org>
Reviewed-by: Liming Gao <liming.gao@intel.com>
Reviewed-by: Yingke Liu <yingke.d.liu@intel.com>

git-svn-id: https://svn.code.sf.net/p/edk2/code/trunk/edk2@18080 6f19259b-4bc3-4df7-8a09-765794883524
2015-07-27 13:50:30 +00:00
Ard Biesheuvel 46d0f3f871 BaseTools: use GUID identifiable section for FFS alignment padding
Instead of using an anonymous section of type EFI_SECTION_RAW to pad
out the first aligned FFS section to its required alignment, use a
section with a dedicated GUID if the size of the padding permits it.

This allows for more flexibility when placing such FFS images in a
firmware volume, because we will now be able to remove padding rather
than add more, by shrinking the size of this section instead of
padding out the start of the FFS image to file alignment.

Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Ard Biesheuvel <ard.biesheuvel@linaro.org>
Reviewed-by: Liming Gao <liming.gao@intel.com>
Reviewed-by: Yingke Liu <yingke.d.liu@intel.com>

git-svn-id: https://svn.code.sf.net/p/edk2/code/trunk/edk2@18079 6f19259b-4bc3-4df7-8a09-765794883524
2015-07-27 13:50:19 +00:00
Ard Biesheuvel 02a5421f57 BaseTools/GenFw: move PE/COFF header closer to payload
The secondary header (not the DOS header) of a PE/COFF binary
does not reside at a fixed offset. Instead, its offset into the
file is recorded in the DOS header.

This gives us the flexibility to move it, along with the section
headers, to right before the first section if there is considerable
space before it, i.e., when the PE/COFF file alignment is substantially
larger than the size of the header.

Since the PE/COFF to TE conversion replaces everything before the
section headers with a simple TE header, this change removes all
the header padding from such images, leading to smaller files.

Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Ard Biesheuvel <ard.biesheuvel@linaro.org>
Reviewed-by: Liming Gao <liming.gao@intel.com>
Reviewed-by: Yingke Liu <yingke.d.liu@intel.com>

git-svn-id: https://svn.code.sf.net/p/edk2/code/trunk/edk2@18078 6f19259b-4bc3-4df7-8a09-765794883524
2015-07-27 13:50:09 +00:00
Ard Biesheuvel 0192b71ca3 BaseTools/GenFw: move .debug contents to .data to save space
In order to reduce the memory footprint of PE/COFF images when
using large values for the PE/COFF section alignment, move the
contents of the .debug section to data, and point the debug data
directory entry to it. This allows us to drop the .debug section
entirely, as well as any associated rounding. Since our .debug
section only contains the filename of the ELF input image, the
penalty of keeping this data in a non-discardable section is
negligible.

Note that the PE/COFF spec v6.3 explicitly mentions that this is
allowed.

Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Ard Biesheuvel <ard.biesheuvel@linaro.org>
Reviewed-by: Liming Gao <liming.gao@intel.com>
Reviewed-by: Yingke Liu <yingke.d.liu@intel.com>

git-svn-id: https://svn.code.sf.net/p/edk2/code/trunk/edk2@18077 6f19259b-4bc3-4df7-8a09-765794883524
2015-07-27 13:49:54 +00:00
Scott Duplichan 41ab153f85 BaseTools: Make AutoGen.h array declaration match AutoGen.c definition
When a quoted string is used as initialization data in a DEC file PCD
entry, the PCD data type in that entry must be VOID*. The created
AutoGen.c defines the PCD data as UINT8[] or UINT16[], depending on
the string type. The created AutoGen.h, however, declares the PCD data
as VOID*. For a standard compile/link, this works because AutoGen.c
doesn't include AutoGen.h. But when GCC LTO is used, the link time
code generation detects the mismatch and the build fails. This
change makes the AutoGen.h PCD data declaration match the AutoGen.c
definition.

Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Scott Duplichan <scott@notabs.org>
Reviewed-by: Yingke Liu <yingke.d.liu@intel.com>
Signed-off-by: Laszlo Ersek <lersek@redhat.com>

git-svn-id: https://svn.code.sf.net/p/edk2/code/trunk/edk2@18058 6f19259b-4bc3-4df7-8a09-765794883524
2015-07-26 08:04:10 +00:00
Ard Biesheuvel 2cec9ccde7 BaseTools/Common: fix heap overrun in ReadMemoryFileLine ()
ReadMemoryFileLine () appends a NULL character to the string
it returns, but it failed to account for it in the allocation.

Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Ard Biesheuvel <ard.biesheuvel@linaro.org>
Reviewed-by: Yingke Liu <yingke.d.liu@intel.com>
Signed-off-by: Laszlo Ersek <lersek@redhat.com>

git-svn-id: https://svn.code.sf.net/p/edk2/code/trunk/edk2@18047 6f19259b-4bc3-4df7-8a09-765794883524
2015-07-26 08:03:15 +00:00
Yingke Liu 547a650793 BaseTools: Fixed incorrect alignment bug.
The alignment in rule section is shared by modules to generate FFS,
it should not be modified by certain module.

Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Yingke Liu <yingke.d.liu@intel.com>
Reviewed-by: Liming Gao <liming.gao@intel.com>

git-svn-id: https://svn.code.sf.net/p/edk2/code/trunk/edk2@18016 6f19259b-4bc3-4df7-8a09-765794883524
2015-07-16 00:56:14 +00:00
Ard Biesheuvel 2c69d6ffee BaseTools/PeCoffLib: handle EFI_IMAGE_REL_BASED_DIR64 in generic code
Relocations of type EFI_IMAGE_REL_BASED_DIR64 are handled in exactly
the same way on all 64-bit machine types (IPF, X64 and AARCH64).
So move the handling of this type to the generic part of the relocation
routine PeCoffLoaderRelocateImage ().

Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Ard Biesheuvel <ard.biesheuvel@linaro.org>
Reviewed-by: Liming Gao <liming.gao@intel.com>
Reviewed-by: Yingke Liu <yingke.d.liu@intel.com>

git-svn-id: https://svn.code.sf.net/p/edk2/code/trunk/edk2@17942 6f19259b-4bc3-4df7-8a09-765794883524
2015-07-14 08:15:28 +00:00
Liming Gao 2a618e50b5 BaseTools: Fix BinWrappers LzmaF86Compress Script
LzmaF86Compress Script should use $arg to arg value.

Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Liming Gao <liming.gao@intel.com>
Reviewed-by: Laszlo Ersek <lersek@redhat.com>

git-svn-id: https://svn.code.sf.net/p/edk2/code/trunk/edk2@17909 6f19259b-4bc3-4df7-8a09-765794883524
2015-07-10 02:51:38 +00:00
Leif Lindholm 28e80befa4 BaseTools: aarch64: add -fno-asynchronous-unwind-tables to gcc cflags
Some toolchains, at least Fedora GCC, generate inline unwind tables in
object files. These confuses GenFw to no end, leading to build failures:
  GenFw: ERROR 3000: Invalid WriteSections64(): ...
         unsupported ELF EM_AARCH64 relocation 0x105.
  GenFw: ERROR 3000: Invalid WriteSections64(): ...
         unsupported ELF EM_AARCH64 relocation 0x0.

I am aware of no current use of these tables, so explicitly disable
their generation for aarch64.

Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Leif Lindholm <leif.lindholm@linaro.org>
Tested-by: Wei Huang <wei@redhat.com>
Reviewed-by: Olivier Martin <olivier.martin@arm.com>



git-svn-id: https://svn.code.sf.net/p/edk2/code/trunk/edk2@17905 6f19259b-4bc3-4df7-8a09-765794883524
2015-07-09 16:29:44 +00:00
Hess Chen fe90f4836a BaseTools/Upt: Add a BOM check for UNI file and fix some help message error
Add a BOM check for UNI file and fix some help message error

Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Hess Chen <hesheng.chen@intel.com>
Reviewed-by: YangX Li <yangx.li@intel.com>

git-svn-id: https://svn.code.sf.net/p/edk2/code/trunk/edk2@17876 6f19259b-4bc3-4df7-8a09-765794883524
2015-07-08 05:43:22 +00:00
Hess Chen 2549514f01 BaseTools/Upt: Update UPT to ignore "!include" statement when parsing UNI file
Update UPT to ignore "!include" statement when parsing UNI file

Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Hess Chen <hesheng.chen@intel.com>
Reviewed-by: YangX Li <yangx.li@intel.com>

git-svn-id: https://svn.code.sf.net/p/edk2/code/trunk/edk2@17872 6f19259b-4bc3-4df7-8a09-765794883524
2015-07-08 03:00:17 +00:00
Bruce Cran 5ddccf34c4 BaseTools: Fix build on FreeBSD and allow use of non-gcc system compiler
On FreeBSD, uuid.h is in /usr/include, not /usr/include/uuid.

Fix some errors when building using clang caused by self-assignment: the
preferred way to 'use' a variable is '(void)x;', not 'x = x;'.

Where the system provides $(CC) etc. by default, don't override it to be gcc.

Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Bruce Cran <bruce@cran.org.uk>
Reviewed-by: Yingke Liu <yingke.d.liu@intel.com>

git-svn-id: https://svn.code.sf.net/p/edk2/code/trunk/edk2@17866 6f19259b-4bc3-4df7-8a09-765794883524
2015-07-08 01:06:25 +00:00
Ard Biesheuvel 64a910f3da BaseTools: AArch64: use explicit linker scripts
Instead of relying on the builtin linker script of GNU ld, which
may vary based on binutils version (which is not tightly coupled to
the GCC version) and linker command line options, introduce a linker
script for AArch64 to be used by all GCC/binutils versions.

The script is laid out such that two ELF sections .text and .data are
created that map onto the PE/COFF with the same names. By aligning
.data to the minimum alignment of .text, and by not adding any
additional padding -which is what LD's builtin linker script does- the
relative offset between .text and .data is retained after the PE/COFF
conversion. This should prevent problems with debuggers and other
tooling that are ELF based.

Also provided is an overlay linker script that increases the alignment
of .text and .data to 64 KB. This is intended for DXE_RUNTIME_DRIVER
modules, to make them compatible with the newly introduced
Properties Table feature.

Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Ard Biesheuvel <ard.biesheuvel@linaro.org>
Reviewed-by: Olivier Martin <Olivier.Martin@arm.com>

git-svn-id: https://svn.code.sf.net/p/edk2/code/trunk/edk2@17824 6f19259b-4bc3-4df7-8a09-765794883524
2015-07-06 15:57:50 +00:00
Bob Feng 0b5203bd84 BaseTools/Build: Fix the range expression evaluation error.
Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: "Bob Feng" <bob.c.feng@intel.com>
Reviewed-by: "Chen, Hesheng" <hesheng.chen@intel.com>
Reviewed-by: "Liu, Yingke D" <yingke.d.liu@intel.com>

git-svn-id: https://svn.code.sf.net/p/edk2/code/trunk/edk2@17822 6f19259b-4bc3-4df7-8a09-765794883524
2015-07-06 00:55:15 +00:00
Jordan Justen 288ed59079 Revert tree to r17801
Revert r17802 "BaseTools: AArch64: use explicit linker scripts"
Revert r17803 "ArmVirtPkg: build runtime drivers with 64 KB section alignment"
Revert r17804 "IntelFrameworkModulePkg: AcpiS3SaveDxe: prepare for End-of-Dxe callback"
Revert r17805 "IntelFrameworkModulePkg: AcpiS3SaveDxe: call S3Ready() at End-of-Dxe"
Revert r17806 "OvmfPkg: AcpiS3SaveDxe: prepare for End-of-Dxe callback"

Requested-by: Ard Biesheuvel <ard.biesheuvel@linaro.org>
Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Jordan Justen <jordan.l.justen@intel.com>

git-svn-id: https://svn.code.sf.net/p/edk2/code/trunk/edk2@17807 6f19259b-4bc3-4df7-8a09-765794883524
2015-07-02 07:23:33 +00:00
Ard Biesheuvel f0dbe9fa0a BaseTools: AArch64: use explicit linker scripts
Instead of relying on the builtin linker script of GNU ld, which
may vary based on binutils version (which is not tightly coupled to
the GCC version) and linker command line options, introduce a linker
script for AArch64 to be used by all GCC/binutils versions.

The script is laid out such that two ELF sections .text and .data are
created that map onto the PE/COFF with the same names. By aligning
.data to the minimum alignment of .text, and by not adding any
additional padding -which is what LD's builtin linker script does- the
relative offset between .text and .data is retained after the PE/COFF
conversion. This should prevent problems with debuggers and other
tooling that are ELF based.

Also provided is an overlay linker script that increases the alignment
of .text and .data to 64 KB. This is intended for DXE_RUNTIME_DRIVER
modules, to make them compatible with the newly introduced
Properties Table feature.

Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Ard Biesheuvel <ard.biesheuvel@linaro.org>

git-svn-id: https://svn.code.sf.net/p/edk2/code/trunk/edk2@17802 6f19259b-4bc3-4df7-8a09-765794883524
2015-07-02 06:36:00 +00:00
Hess Chen d77cc2063d BaseTools/Ecc: Fix a bug when checking copyright format
Fix a bug to only checking the copyright listed in config.ini file.

Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Hess Chen <hesheng.chen@intel.com>
Reviewed-by: YangX Li <yangx.li@intel.com>

git-svn-id: https://svn.code.sf.net/p/edk2/code/trunk/edk2@17801 6f19259b-4bc3-4df7-8a09-765794883524
2015-07-02 06:05:26 +00:00
Hess Chen fa3a21569b BaseTools/Ecc: Fix a bug to get correct member variable
Fix a bug to get correct member variable by ignoring 'OPTIONAL' modifier

Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Hess Chen <hesheng.chen@intel.com>
Reviewed-by: YangX Li <yangx.li@intel.com>

git-svn-id: https://svn.code.sf.net/p/edk2/code/trunk/edk2@17800 6f19259b-4bc3-4df7-8a09-765794883524
2015-07-02 06:02:42 +00:00
Yingke Liu 5015bee226 BaseTools: Fixed BuildOptions bug.
The BuildOptions in an INF should also follow override rule: If '==' is used, all previous options are overridden.

Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Yingke Liu <yingke.d.liu@intel.com>
Reviewed-by: Liming Gao <liming.gao@intel.com>

git-svn-id: https://svn.code.sf.net/p/edk2/code/trunk/edk2@17796 6f19259b-4bc3-4df7-8a09-765794883524
2015-07-02 03:42:34 +00:00
Samer El-Haj-Mahmoud 7b6dad328f BaseTools: Add missing EfiPersistentMemory to EFI_MEMORY_TYPE
To sync with the EFI_MEMROYT_TYPE definition in MdePkg

Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Samer El-Haj-Mahmoud <samer.el-haj-mahmoud@hp.com>
Reviewed-by: Liming Gao <liming.gao@intel.com>

git-svn-id: https://svn.code.sf.net/p/edk2/code/trunk/edk2@17792 6f19259b-4bc3-4df7-8a09-765794883524
2015-07-01 15:21:03 +00:00
Yingke Liu a1fe73a1c7 BaseTools: Checked return value of malloc for EfiCompress.
Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Yingke Liu <yingke.d.liu@intel.com>
Reviewed-by: Liming Gao <liming.gao@intel.com>

git-svn-id: https://svn.code.sf.net/p/edk2/code/trunk/edk2@17775 6f19259b-4bc3-4df7-8a09-765794883524
2015-07-01 05:16:46 +00:00
Yingke Liu b40286bbec BaseTools: Do not create an empty file if Rsa2048Sha256Sign was failed.
Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Yingke Liu <yingke.d.liu@intel.com>
Reviewed-by: Liming Gao <liming.gao@intel.com>

git-svn-id: https://svn.code.sf.net/p/edk2/code/trunk/edk2@17774 6f19259b-4bc3-4df7-8a09-765794883524
2015-07-01 05:14:28 +00:00
Ard Biesheuvel 203beadc12 There needs to be a space between the output section name and the colon, i.e.,
.text : ALIGN(0x1000)
       ^

Fix this for all output sections

Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Ard Biesheuvel <ard.biesheuvel@linaro.org>
Reviewed-by: Liming Gao <liming.gao@intel.com>

git-svn-id: https://svn.code.sf.net/p/edk2/code/trunk/edk2@17748 6f19259b-4bc3-4df7-8a09-765794883524
2015-07-01 01:04:28 +00:00
Yingke Liu 16e3d2e89f BaseTools: Added GCC ld script to support 4K alignment.
Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Yingke Liu <yingke.d.liu@intel.com>
Reviewed-by: Liming Gao <liming.gao@intel.com>

git-svn-id: https://svn.code.sf.net/p/edk2/code/trunk/edk2@17728 6f19259b-4bc3-4df7-8a09-765794883524
2015-06-29 03:20:25 +00:00
Ard Biesheuvel 54b1b57a59 BaseTools: Update GenFw to support 4K alignment.
Get maximum section alignment from each ELF section, and this alignment is used to create PE header.

Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Ard Biesheuvel <ard.biesheuvel@linaro.org>
Reviewed-by: Liming Gao <liming.gao@intel.com>

git-svn-id: https://svn.code.sf.net/p/edk2/code/trunk/edk2@17727 6f19259b-4bc3-4df7-8a09-765794883524
2015-06-29 03:17:34 +00:00
Yingke Liu bbb6369486 BaseTools: Updated tool_def to support 4K alignment.
Replace '/MERGE:.data=.text /MERGE:.rdata=.text' with /MERGE:.rdata=.data

Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Yingke Liu <yingke.d.liu@intel.com>
Reviewed-by: Liming Gao <liming.gao@intel.com>

git-svn-id: https://svn.code.sf.net/p/edk2/code/trunk/edk2@17726 6f19259b-4bc3-4df7-8a09-765794883524
2015-06-29 03:14:33 +00:00
Yingke Liu 061eb5c31d BaseTools: Update IASL download link and remove specific version info.
The version of IASL compiler in the tools_def.template file no longer exists on the acpica.org site.
Update download link and remove the specific version info from the tools_def.template file.

Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Yingke Liu <yingke.d.liu@intel.com>
Reviewed-by: Liming Gao <liming.gao@intel.com>

git-svn-id: https://svn.code.sf.net/p/edk2/code/trunk/edk2@17725 6f19259b-4bc3-4df7-8a09-765794883524
2015-06-29 03:10:25 +00:00
Hess Chen 83461d2ce8 BaseTools/Ecc: Fix a bug of determining boolean variable incorrectly
Fix a bug of determining boolean variable incorrectly in C parser

Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Hess Chen <hesheng.chen@intel.com>
Reviewed-by: YangX Li <yangx.li@intel.com>

git-svn-id: https://svn.code.sf.net/p/edk2/code/trunk/edk2@17711 6f19259b-4bc3-4df7-8a09-765794883524
2015-06-25 08:10:51 +00:00
Hess Chen e84d2b709b BaseTools/Ecc: Fix two bugs for the checkpoint of GUID
a) Fix a bug of displaying wrong format of a GUID
b) Fix a bug of setting wrong exception keyword

Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Hess Chen <hesheng.chen@intel.com>
Reviewed-by: YangX Li <yangx.li@intel.com>

git-svn-id: https://svn.code.sf.net/p/edk2/code/trunk/edk2@17710 6f19259b-4bc3-4df7-8a09-765794883524
2015-06-25 08:08:55 +00:00
Hess Chen ce2f594006 BaseTools/Ecc: Fix a bug in parser
Fix a bug to not break when parsing a macro and not find its value

Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Hess Chen <hesheng.chen@intel.com>
Reviewed-by: YangX Li <yangx.li@intel.com>

git-svn-id: https://svn.code.sf.net/p/edk2/code/trunk/edk2@17709 6f19259b-4bc3-4df7-8a09-765794883524
2015-06-25 08:05:42 +00:00
Hess Chen 14239f6603 BaseTools/Ecc: Add a checkpoint for invalid DEC file.
Add a checkpoint to check whether a header file in 'include' directory is defined in DEC file

Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Hess Chen <hesheng.chen@intel.com>
Reviewed-by: YangX Li <yangx.li@intel.com>

git-svn-id: https://svn.code.sf.net/p/edk2/code/trunk/edk2@17708 6f19259b-4bc3-4df7-8a09-765794883524
2015-06-25 08:01:59 +00:00
Hess Chen b66592d8eb BaseTools/Ecc: Add a checkpoint for invalid PCD info.
Add a checkpoint to check invalid format of @ValidRange, @ValidList and @Expression for a PCD

Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Hess Chen <hesheng.chen@intel.com>
Reviewed-by: YangX Li <yangx.li@intel.com>

git-svn-id: https://svn.code.sf.net/p/edk2/code/trunk/edk2@17707 6f19259b-4bc3-4df7-8a09-765794883524
2015-06-25 07:59:16 +00:00
Hess Chen 1b2467c58f BaseTools/Ecc: Add a checkpoint for invalid UNI file.
Add a checkpoint to check that the UNI file which is associated by INF or DEC file need define the prompt and help information.

Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Hess Chen <hesheng.chen@intel.com>
Reviewed-by: YangX Li <yangx.li@intel.com>

git-svn-id: https://svn.code.sf.net/p/edk2/code/trunk/edk2@17706 6f19259b-4bc3-4df7-8a09-765794883524
2015-06-25 07:50:55 +00:00
Hess Chen 8c3f9b4e3c BaseTools/Ecc: Add a Configuration item
Add a ‘SkipFileList’ in config.ini to exclude the files not be scanned.

Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Hess Chen <hesheng.chen@intel.com>
Reviewed-by: YangX Li <yangx.li@intel.com>

git-svn-id: https://svn.code.sf.net/p/edk2/code/trunk/edk2@17705 6f19259b-4bc3-4df7-8a09-765794883524
2015-06-25 07:43:03 +00:00
Jordan Justen 156d6d65a5 BaseTools/Tests: Verify supported UTF-8 data is allowed
We test a simple case of UTF-8 with and without the UTF-8 BOM.

Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Jordan Justen <jordan.l.justen@intel.com>
Reviewed-by: Laszlo Ersek <lersek@redhat.com>
Reviewed-by: Michael D Kinney <michael.d.kinney@intel.com>
Reviewed-by: Yingke Liu <yingke.d.liu@intel.com>

git-svn-id: https://svn.code.sf.net/p/edk2/code/trunk/edk2@17699 6f19259b-4bc3-4df7-8a09-765794883524
2015-06-23 23:34:43 +00:00
Jordan Justen 8fb5a0cae3 BaseTools/Tests: Verify unsupported UTF-8 data is rejected
Surrogate pair characters can be encoded in UTF-8 files, but they are
not valid UCS-2 characters.

For example, this python interpreter code:
>>> import codecs
>>> codecs.encode(u'\ud801', 'utf-8')
'\xed\xa0\x81'

But, the range of 0xd800 - 0xdfff should be rejected as unicode code
points because they are reserved for the surrogate pair usage in
UTF-16 files.

We test that this case is rejected for UTF-8 with and without the
UTF-8 BOM.

Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Jordan Justen <jordan.l.justen@intel.com>
Reviewed-by: Laszlo Ersek <lersek@redhat.com>
Reviewed-by: Michael D Kinney <michael.d.kinney@intel.com>
Reviewed-by: Yingke Liu <yingke.d.liu@intel.com>

git-svn-id: https://svn.code.sf.net/p/edk2/code/trunk/edk2@17698 6f19259b-4bc3-4df7-8a09-765794883524
2015-06-23 23:34:38 +00:00
Jordan Justen 15c3a04cd0 BaseTools/Tests: Verify 32-bit UTF-8 chars are rejected
Since UTF-8 .uni unicode files might contain strings with unicode code
points larger than 16-bits, and UEFI only supports UCS-2 characters,
we need to make sure that BaseTools rejects these characters in UTF-8
.uni source files.

Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Jordan Justen <jordan.l.justen@intel.com>
Reviewed-by: Michael D Kinney <michael.d.kinney@intel.com>
Reviewed-by: Yingke Liu <yingke.d.liu@intel.com>

git-svn-id: https://svn.code.sf.net/p/edk2/code/trunk/edk2@17697 6f19259b-4bc3-4df7-8a09-765794883524
2015-06-23 23:34:33 +00:00
Jordan Justen be264422c9 BaseTools/UniClassObject: Support UTF-8 string data in .uni files
This allows .uni input files to be encoded with UTF-8. Today, we only
support UTF-16 encoding.

The strings are still converted to UCS-2 data for use in EDK II
modules. (This is the only unicode character format supported by UEFI
and EDK II.)

Although UTF-8 would allow any UCS-4 character to be present in the
source file, we restrict the entire file to the UCS-2 range.
(Including comments.) This allows the files to be converted to UTF-16
if needed.

v2:
 * Drop .utf8 extension. Use .uni file for UTF-8 data (mdkinney)
 * Merge in 'BaseTools/UniClassObject: Verify string data is 16-bit'
   commit

v3:
 * Restrict the entire file's characters (including comments) to the
   UCS-2 range in addition to string data. (mdkinney)

Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Jordan Justen <jordan.l.justen@intel.com>
Reviewed-by: Michael D Kinney <michael.d.kinney@intel.com>
Reviewed-by: Yingke Liu <yingke.d.liu@intel.com>

git-svn-id: https://svn.code.sf.net/p/edk2/code/trunk/edk2@17696 6f19259b-4bc3-4df7-8a09-765794883524
2015-06-23 23:34:28 +00:00
Jordan Justen dadfab5b23 BaseTools/Tests: Verify unsupported UTF-16 are rejected
Supplementary Plane characters can exist in UTF-16 files,
but they are not valid UCS-2 characters.

For example, this python interpreter code:
>>> import codecs
>>> codecs.encode(u'\U00010300', 'utf-16')
'\xff\xfe\x00\xd8\x00\xdf'

Therefore the UCS-4 0x00010300 character is encoded as two
16-bit numbers (0xd800 0xdf00) in a little endian UTF-16
file.

For more information, see:
http://en.wikipedia.org/wiki/UTF-16#U.2B10000_to_U.2B10FFFF

This test checks to make sure that BaseTools will reject these
characters in UTF-16 files.

The range of 0xd800 - 0xdfff should also be rejected as unicode code
points because they are reserved for the surrogate pair usage in
UTF-16 files.

This test was fixed by the previous commit:
"BaseTools/UniClassObject: Verify valid UCS-2 chars in UTF-16 .uni files"

Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Jordan Justen <jordan.l.justen@intel.com>
Reviewed-by: Laszlo Ersek <lersek@redhat.com>
Reviewed-by: Michael D Kinney <michael.d.kinney@intel.com>
Reviewed-by: Yingke Liu <yingke.d.liu@intel.com>

git-svn-id: https://svn.code.sf.net/p/edk2/code/trunk/edk2@17695 6f19259b-4bc3-4df7-8a09-765794883524
2015-06-23 23:34:22 +00:00
Jordan Justen d80e451b18 BaseTools/UniClassObject: Verify valid UCS-2 chars in UTF-16 .uni files
Supplementary Plane characters can exist in UTF-16 files,
but they are not valid UCS-2 characters.

For example, refer to this python interpreter code:
>>> import codecs
>>> codecs.encode(u'\U00010300', 'utf-16')
'\xff\xfe\x00\xd8\x00\xdf'

Therefore the UCS-4 0x00010300 character is encoded as two
16-bit numbers (0xd800 0xdf00) in a little endian UTF-16
file.

For more information, see:
http://en.wikipedia.org/wiki/UTF-16#U.2B10000_to_U.2B10FFFF

This means that our current BaseTools code could be allowing
unsupported UTF-16 characters be used. To fix this, we decode the file
using python's utf-16 decode support. Then we verify that each
character's code point is 0xffff or less.

v3:
 * Based on Mike Kinney's feedback, we now read the whole file and
   verify up-front that it contains valid UCS-2 characters. Thanks
   also to Laszlo Ersek for pointing out the Supplementary Plane
   characters.

v4:
 * Reject code points in 0xd800-0xdfff range since they are reserved
   for UTF-16 surrogate pairs. (lersek)

Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Jordan Justen <jordan.l.justen@intel.com>
Reviewed-by: Laszlo Ersek <lersek@redhat.com>
Reviewed-by: Michael D Kinney <michael.d.kinney@intel.com>
Reviewed-by: Yingke Liu <yingke.d.liu@intel.com>

git-svn-id: https://svn.code.sf.net/p/edk2/code/trunk/edk2@17694 6f19259b-4bc3-4df7-8a09-765794883524
2015-06-23 23:34:19 +00:00
Jordan Justen df91e0f90a BaseTools/Tests: Add unit test for AutoGen.UniClassObject
This verifies that a UTF-16 data (with BOM) .uni file is successfully
read.

Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Jordan Justen <jordan.l.justen@intel.com>
Reviewed-by: Michael D Kinney <michael.d.kinney@intel.com>
Reviewed-by: Yingke Liu <yingke.d.liu@intel.com>

git-svn-id: https://svn.code.sf.net/p/edk2/code/trunk/edk2@17693 6f19259b-4bc3-4df7-8a09-765794883524
2015-06-23 23:34:14 +00:00
Jordan Justen 183ca96455 BaseTools/EdkLogger: Support unit tests with a SILENT log level
This allows the unit tests to run without the errors logging to the
screen.

Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Jordan Justen <jordan.l.justen@intel.com>
Reviewed-by: Michael D Kinney <michael.d.kinney@intel.com>
Reviewed-by: Yingke Liu <yingke.d.liu@intel.com>

git-svn-id: https://svn.code.sf.net/p/edk2/code/trunk/edk2@17692 6f19259b-4bc3-4df7-8a09-765794883524
2015-06-23 23:34:09 +00:00
Jordan Justen 53fc4ba266 BaseTools/Tests: Always add BaseTools source to import path
This allows unit tests to easily include BaseTools python
modules. This is very useful for writing unit tests.

Actually, previously, we would do this when RunTests.py was executed,
so unit tests could easily import BaseTools modules, so long as they
were executed via RunTests.

This change allows running the unit test files individually which can
be faster for developing the new unit test cases.

Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Jordan Justen <jordan.l.justen@intel.com>
Reviewed-by: Michael D Kinney <michael.d.kinney@intel.com>
Reviewed-by: Yingke Liu <yingke.d.liu@intel.com>

git-svn-id: https://svn.code.sf.net/p/edk2/code/trunk/edk2@17691 6f19259b-4bc3-4df7-8a09-765794883524
2015-06-23 23:34:04 +00:00
Liming Gao e878891ea6 BaseTools: Convert ".\\" to "" in FilePath
Convert ".\\" to "", because it doesn't work with WINDOWS_EXTENSION_PATH.
WINDOWS_EXTENSION_PATH can support the file path larger than 260 length.

Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Liming Gao <liming.gao@intel.com>
Reviewed-by: Yingke Liu <yingke.d.liu@intel.com>

git-svn-id: https://svn.code.sf.net/p/edk2/code/trunk/edk2@17686 6f19259b-4bc3-4df7-8a09-765794883524
2015-06-23 10:48:04 +00:00
Bob Feng 901fd82238 BaseTools/Build: Add error report for incorrect syntax in DEC file.
Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: "Bob Feng" <bob.c.feng@intel.com>
Reviewed-by: Laszlo Ersek <lersek@redhat.com>

git-svn-id: https://svn.code.sf.net/p/edk2/code/trunk/edk2@17685 6f19259b-4bc3-4df7-8a09-765794883524
2015-06-23 08:45:06 +00:00
Yingke Liu f827cd07d0 BaseTools: The token values cannot be numeric same with different PCDs.
Current check only compared string format of toke value.

Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Yingke Liu <yingke.d.liu@intel.com>
Reviewed-by: Liming Gao <liming.gao@intel.com>

git-svn-id: https://svn.code.sf.net/p/edk2/code/trunk/edk2@17682 6f19259b-4bc3-4df7-8a09-765794883524
2015-06-23 07:02:03 +00:00
Yingke Liu 37fe82ee80 BaseTools: Fixed a bug that Build Report always uses DEC default value for VPD PCD.
Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Yingke Liu <yingke.d.liu@intel.com>
Reviewed-by: Liming Gao <liming.gao@intel.com>

git-svn-id: https://svn.code.sf.net/p/edk2/code/trunk/edk2@17681 6f19259b-4bc3-4df7-8a09-765794883524
2015-06-23 06:59:45 +00:00
Yingke Liu 45265a8614 BaseTools: Fix a bug that UNI file can't have comment after #include "file.uni"
The 'include' regular expression cannot match spaces before or after this statement.

Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Yingke Liu <yingke.d.liu@intel.com>
Reviewed-by: Liming Gao <liming.gao@intel.com>

git-svn-id: https://svn.code.sf.net/p/edk2/code/trunk/edk2@17680 6f19259b-4bc3-4df7-8a09-765794883524
2015-06-23 06:52:12 +00:00
Yingke Liu 09ae0f1113 BaseTools: Build report should not be generated if build failed.
Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Yingke Liu <yingke.d.liu@intel.com>
Reviewed-by: Liming Gao <liming.gao@intel.com>

git-svn-id: https://svn.code.sf.net/p/edk2/code/trunk/edk2@17679 6f19259b-4bc3-4df7-8a09-765794883524
2015-06-23 06:49:25 +00:00
Yingke Liu a3251d8446 BaseTools: Supported FMP capsule image.
Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Yingke Liu <yingke.d.liu@intel.com>
Reviewed-by: Liming Gao <liming.gao@intel.com>

git-svn-id: https://svn.code.sf.net/p/edk2/code/trunk/edk2@17678 6f19259b-4bc3-4df7-8a09-765794883524
2015-06-23 06:46:01 +00:00
Yingke Liu 1ba5124ed0 BaseTools: Fixed Build Option override bugs.
if '==' is specified, it overrides all options that specified by '='; if no '==' is specified, all options that match current build criteria are combined.

Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Yingke Liu <yingke.d.liu@intel.com>
Reviewed-by: Liming Gao <liming.gao@intel.com>

git-svn-id: https://svn.code.sf.net/p/edk2/code/trunk/edk2@17665 6f19259b-4bc3-4df7-8a09-765794883524
2015-06-19 01:43:45 +00:00
Hess Chen 510f154ea2 BaseTools/Upt: Update help message
Update help message of UPT to remove Intel(R) from the string.

Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Hess Chen <hesheng.chen@intel.com>
Reviewed-by: lhauch <larry.hauch@intel.com>

git-svn-id: https://svn.code.sf.net/p/edk2/code/trunk/edk2@17662 6f19259b-4bc3-4df7-8a09-765794883524
2015-06-19 00:05:25 +00:00
Hess Chen af0c61aefc BaseTools/Upt: Update error message
Update error message of installation failure to avoid confusion.

Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Hess Chen <hesheng.chen@intel.com>
Reviewed-by: lhauch <larry.hauch@intel.com>

git-svn-id: https://svn.code.sf.net/p/edk2/code/trunk/edk2@17661 6f19259b-4bc3-4df7-8a09-765794883524
2015-06-19 00:02:34 +00:00
Yingke Liu b442ad5c07 BaseTools: Fixed a bug to generate correct path of PACKAGE_RELATIVE_PATH
Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Yingke Liu <yingke.d.liu@intel.com>
Reviewed-by: Liming Gao <liming.gao@intel.com>

git-svn-id: https://svn.code.sf.net/p/edk2/code/trunk/edk2@17642 6f19259b-4bc3-4df7-8a09-765794883524
2015-06-16 04:23:00 +00:00
Yingke Liu 0614d73be3 BaseTools: Generate a FV EXT entry for FV UI name.
This patch also removed a warning message.

Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Yingke Liu <yingke.d.liu@intel.com>
Reviewed-by: Liming Gao <liming.gao@intel.com>

git-svn-id: https://svn.code.sf.net/p/edk2/code/trunk/edk2@17627 6f19259b-4bc3-4df7-8a09-765794883524
2015-06-12 00:58:18 +00:00
Yingke Liu e63ec1beac BaseTools: Fixed an error reported during generating report.
Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Yingke Liu <yingke.d.liu@intel.com>
Reviewed-by: Liming Gao <liming.gao@intel.com>

git-svn-id: https://svn.code.sf.net/p/edk2/code/trunk/edk2@17623 6f19259b-4bc3-4df7-8a09-765794883524
2015-06-11 05:21:59 +00:00
Yingke Liu aeaaf754ee BaseTools: Generate a binary file and list it in Binary section of As Built INF.
This binary file contains offset of VFR and UNI data.

Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Yingke Liu <yingke.d.liu@intel.com>
Reviewed-by: Liming Gao <liming.gao@intel.com>

git-svn-id: https://svn.code.sf.net/p/edk2/code/trunk/edk2@17622 6f19259b-4bc3-4df7-8a09-765794883524
2015-06-11 05:20:00 +00:00
Yingke Liu 35f69db91b BaseTools: Support build options for specific module type in DSC.
This patch extended BuildOptions section in DSC to support [BuildOptions.ARCH.CodeBase.MODULE_TYPE]

Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Yingke Liu <yingke.d.liu@intel.com>
Reviewed-by: Liming Gao <liming.gao@intel.com>

git-svn-id: https://svn.code.sf.net/p/edk2/code/trunk/edk2@17621 6f19259b-4bc3-4df7-8a09-765794883524
2015-06-11 05:16:40 +00:00
lhauch ff6096f5e4 Adds new files to the Makefile for testing changed sources
The files were added April 9th, revision 17158, but the Makefile was not updated.
Converted all tabs in this make file to space characters.

[Test]
nmake cleanall
nmake
Successfully built all binaries

Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: lhauch <larry.hauch@intel.com>
Reviewed-by: Joe Peterson <joe.peterson@intel.com>
Reviewed-by: Liming Gao <liming.gao@intel.com>




git-svn-id: https://svn.code.sf.net/p/edk2/code/trunk/edk2@17612 6f19259b-4bc3-4df7-8a09-765794883524
2015-06-10 14:34:40 +00:00
Yingke Liu 867d1cd4cd BaseTools: Append FILE_GUID to BaseName.
This patch makes sure the EFI file in $(BIN_DIR) is unique. If there are modules with same BaseName, the FILE_GUID is appended.

Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Yingke Liu <yingke.d.liu@intel.com>
Reviewed-by: Liming Gao <liming.gao@intel.com>

git-svn-id: https://svn.code.sf.net/p/edk2/code/trunk/edk2@17608 6f19259b-4bc3-4df7-8a09-765794883524
2015-06-10 07:50:59 +00:00
lhauch 4c75d0531b Removing the msvcr71.dll - no longer required, building with VS2013.
Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: lhauch <larry.hauch@intel.com>
Reviewed-by: Joe Peterson <joe.peterson@intel.com>

git-svn-id: https://svn.code.sf.net/p/edk2/code/trunk/edk2@17602 6f19259b-4bc3-4df7-8a09-765794883524
2015-06-09 18:20:51 +00:00
Liming Gao 49b0a79388 BaseTools: Update BuildRule for *.nasmb
*.nasmb is place of *.asm16. To keep the same output file, copy the output
file with .com postfix.

Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Liming Gao <liming.gao@intel.com>
Reviewed-by: Yingke Liu <yingke.d.liu@intel.com>

git-svn-id: https://svn.code.sf.net/p/edk2/code/trunk/edk2@17580 6f19259b-4bc3-4df7-8a09-765794883524
2015-06-08 09:44:57 +00:00
Liming Gao b74d65ed3a BaseTools: Update GenFds to handle file type Ffs Rule
Ffs Rule can specify a file type instead of specific file name. GenFds
should search Binary sections of module INF file and output directory
of the module to find all matched file with the specific file type.
Current GenFds only considers the final output target file. This patch
applies the above rule to match output file with the specific file type.

Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Liming Gao <liming.gao@intel.com>
Reviewed-by: Yingke Liu <yingke.d.liu@intel.com>

git-svn-id: https://svn.code.sf.net/p/edk2/code/trunk/edk2@17579 6f19259b-4bc3-4df7-8a09-765794883524
2015-06-08 09:44:01 +00:00
Yingke Liu 8262037ff8 BaseTools: Added extern declaration for protocols/PPI/GUID in AutoGhen.h
Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Yingke Liu <yingke.d.liu@intel.com>
Reviewed-by: Liming Gao <liming.gao@intel.com>

git-svn-id: https://svn.code.sf.net/p/edk2/code/trunk/edk2@17573 6f19259b-4bc3-4df7-8a09-765794883524
2015-06-08 08:08:58 +00:00
Jordan Justen c85bc0c9d4 BaseTools/Conf: Don't support upper case nasm extensions
For *.asm and *.s, there have been cases of *.Asm and *.S files, but
since the nasm extensions are new, we don't need to support the upper
case extensions.

In other words, remove .Nasm and .NASM.

Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Jordan Justen <jordan.l.justen@intel.com>
Reviewed-by: Liming Gao <liming.gao@intel.com>

git-svn-id: https://svn.code.sf.net/p/edk2/code/trunk/edk2@17544 6f19259b-4bc3-4df7-8a09-765794883524
2015-06-01 23:21:00 +00:00
Eric Dong 366430c715 BaseTools: Add reconnect request flag for question.
Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Eric Dong <eric.dong@intel.com>
Reviewed-by: Liming Gao <liming.gao@intel.com>


git-svn-id: https://svn.code.sf.net/p/edk2/code/trunk/edk2@17514 6f19259b-4bc3-4df7-8a09-765794883524
2015-05-27 02:25:48 +00:00
Yingke Liu ec22bede67 BaseTools: Add default BuildRuleOrder in tools_def.template
*_*_*_*_BUILDRULEORDER = nasm Nasm NASM asm Asm ASM S s
*_XCODE32_*_*_BUILDRULEORDER    = S s nasm Nasm NASM
*_XCLANG_*_*_BUILDRULEORDER     = S s nasm Nasm NASM
*_XCODE5_*_*_BUILDRULEORDER     = S s nasm Nasm NASM

Tool Chain in Mac Os will use S as the first priority. Other tool chains
use nasm as the first priority.

Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Yingke Liu <yingke.d.liu@intel.com>
Reviewed-by: Liming Gao <liming.gao@intel.com>

git-svn-id: https://svn.code.sf.net/p/edk2/code/trunk/edk2@17510 6f19259b-4bc3-4df7-8a09-765794883524
2015-05-26 10:32:47 +00:00
Yingke Liu fe4bf2f923 BaseTools: Implement BUILDRULEORDER for tools_def
This feature allows the toolchain to choose a preference for source file
extensions in tools_def.txt. The first extension is given the highest priority.

Here is an example usage for tools_def.txt:
*_*_*_*_BUILDRULEORDER         = nasm Nasm NASM asm Asm ASM S s
*_XCODE5_*_*_BUILDRULEORDER    = S s nasm Nasm NASM

Now, if a .inf lists these sources: 1.nasm, 1.asm and 1.S
All toolchains, except XCODE5 will use the 1.nasm file. The XCODE5
toolchain will use the 1.S file.

Note that the build_rule.txt file also impacts the decision, because,
for instance there is no build rule for .asm files on GCC toolchains.

Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Yingke Liu <yingke.d.liu@intel.com>
Reviewed-by: Liming Gao <liming.gao@intel.com>

git-svn-id: https://svn.code.sf.net/p/edk2/code/trunk/edk2@17509 6f19259b-4bc3-4df7-8a09-765794883524
2015-05-26 10:32:07 +00:00
Bob Feng c1b9129c3c BaseTools/Build: The PCD value in uninitialized data range should be natural aligned.
Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: "Bob Feng" <bob.c.feng@intel.com>
Reviewed-by: "Liu, Yingke D" <yingke.d.liu@intel.com>
Tested-by: Ard Biesheuvel <ard.biesheuvel@linaro.org>



git-svn-id: https://svn.code.sf.net/p/edk2/code/trunk/edk2@17416 6f19259b-4bc3-4df7-8a09-765794883524
2015-05-12 00:58:20 +00:00
Eric Dong 4e4872bc64 BaseTools: Fix build fail issue.
Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Eric Dong <eric.dong@intel.com>
Reviewed-by: Liming Gao <liming.gao@intel.com>

git-svn-id: https://svn.code.sf.net/p/edk2/code/trunk/edk2@17346 6f19259b-4bc3-4df7-8a09-765794883524
2015-05-06 12:52:16 +00:00
Eric Dong 1afac950f9 BaseTools: Enhance the check for numeric opcode with EFI_IFR_DISPLAY_INT_DEC attribute.
Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Eric Dong <eric.dong@intel.com>
Reviewed-by: Liming Gao <liming.gao@intel.com>
Reviewed-by: Aaron Pop <Aaron.Pop@congatec.com>

git-svn-id: https://svn.code.sf.net/p/edk2/code/trunk/edk2@17344 6f19259b-4bc3-4df7-8a09-765794883524
2015-05-06 12:29:33 +00:00
Eric Dong 5d37761661 BaseTools: Enable Match2 Opcode.
Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Eric Dong <eric.dong@intel.com>
Reviewed-by: Liming Gao <liming.gao@intel.com>
Reviewed-by: Samer El-Haj-Mahmoud <samer.el-haj-mahmoud@hp.com>

git-svn-id: https://svn.code.sf.net/p/edk2/code/trunk/edk2@17338 6f19259b-4bc3-4df7-8a09-765794883524
2015-05-06 10:38:04 +00:00
Eric Dong ddaf640f50 BaseTools: Enable buffer type value for default and oneofoption opcode.
Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Eric Dong <eric.dong@intel.com>
Reviewed-by: Liming Gao <liming.gao@intel.com>

git-svn-id: https://svn.code.sf.net/p/edk2/code/trunk/edk2@17335 6f19259b-4bc3-4df7-8a09-765794883524
2015-05-06 09:35:14 +00:00
Eric Dong e2a5feb9d6 BaseTool: Add refresh form opcode in vfrcompiler.
Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Eric Dong <eric.dong@intel.com>
Reviewed-by: Liming Gao <liming.gao@intel.com>

git-svn-id: https://svn.code.sf.net/p/edk2/code/trunk/edk2@17333 6f19259b-4bc3-4df7-8a09-765794883524
2015-05-06 09:27:07 +00:00
Liming Gao e8b4d9f4aa BaseTools: Ignore BaseTools/Bin/Win32 directory in .gitignore
Configure .gitignore file to ignore Bin/Win32 and Lib directory.
Those two directories are generated when BaseTools are compiled at Windows.

Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Liming Gao <liming.gao@intel.com>
Reviewed-by: Jordan Justen <jordan.l.justen@intel.com>

git-svn-id: https://svn.code.sf.net/p/edk2/code/trunk/edk2@17187 6f19259b-4bc3-4df7-8a09-765794883524
2015-04-17 07:40:44 +00:00
lhauch 14e900dd13 Updated for ECC.exe
Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: lhauch <larry.hauch@intel.com>


git-svn-id: https://svn.code.sf.net/p/edk2/code/trunk/edk2@17163 6f19259b-4bc3-4df7-8a09-765794883524
2015-04-10 16:00:18 +00:00
Bob Feng 1ae469b9ed BaseTools/Build: Add all support skuid to the Pcd DB system skuid table
Update PcdDataBase System SkuIdTable. The system SkuId Table should have all the platform supported skuid.

Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: "Bob Feng" <bob.c.feng@intel.com>
Reviewed-by: "Chen, Hesheng" <hesheng.chen@intel.com>
Reviewed-by: "Liu, Yingke D" <yingke.d.liu@intel.com>


git-svn-id: https://svn.code.sf.net/p/edk2/code/trunk/edk2@17159 6f19259b-4bc3-4df7-8a09-765794883524
2015-04-10 07:06:13 +00:00
Bob Feng 82a6a9605c BaseTools/Build: Add SDL support
1.BaseTool add ATTRIBUTE (+/-RT, RO) support in PCD declaration in DSC file
2.BaseTool collect valid PCD value in DEC file and generate data base for runtime sanity check
3.BaseTool support SetPcd error.

Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: "Bob Feng" <bob.c.feng@intel.com>
Reviewed-by: "Chen, Hesheng" <hesheng.chen@intel.com>
Reviewed-by: "Liu, Yingke D" <yingke.d.liu@intel.com>

git-svn-id: https://svn.code.sf.net/p/edk2/code/trunk/edk2@17158 6f19259b-4bc3-4df7-8a09-765794883524
2015-04-10 06:59:47 +00:00
Chen, Hesheng b7668ccee9 BaseTools/Ecc: Add ECC (EFI Code Checker) Binary into BaseTools bin directory.
Modify the makefile to build Ecc

Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: "Chen, Hesheng" <hesheng.chen@intel.com>
Reviewed-by: "Liu, Yingke D" <yingke.d.liu@intel.com>


git-svn-id: https://svn.code.sf.net/p/edk2/code/trunk/edk2@17157 6f19259b-4bc3-4df7-8a09-765794883524
2015-04-10 06:20:39 +00:00
Cinnamon Shia ca04b83afb NT32Pkg: Fix build errors from building secure boot with NT32 X64
Root cause: The CryptoPkg\Library\IntrinsicLib needs override MSFT build option to remove /Oi and /GL, 
but it doesn’t work because of the build option override in Nt32Pkg.dsc.
Solution: Remove /X in BaseTools/Conf/tools_def.template

Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Cinnamon Shia <cinnamon.shia@hp.com>
Reviewed-by: Liming Gao <liming.gao@intel.com>


git-svn-id: https://svn.code.sf.net/p/edk2/code/trunk/edk2@17069 6f19259b-4bc3-4df7-8a09-765794883524
2015-03-23 05:39:51 +00:00
Erik Bjorge 234f9ff96e BaseTools/GenFw: Set the PE/COFF attribute BaseOfData with the address of the first '.data' section
Before this change the alignment of the first data section was not taken into account.

Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Erik Bjorge <erik.c.bjorge@intel.com>
Reviewed-by: Liming Gao <liming.gao@intel.com>

git-svn-id: https://svn.code.sf.net/p/edk2/code/trunk/edk2@16831 6f19259b-4bc3-4df7-8a09-765794883524
2015-02-11 08:20:17 +00:00
Yingke Liu 22a99b87c4 1. Update UpdateBuildVersion.py;
2. Generate correct HII data offset.
3. Fixed a bug for incorrect PCD value used in conditional statement.

Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Yingke Liu <yingke.d.liu@intel.com>
Reviewed-by: Liming Gao <liming.gao@intel.com>


git-svn-id: https://svn.code.sf.net/p/edk2/code/trunk/edk2@16784 6f19259b-4bc3-4df7-8a09-765794883524
2015-02-06 03:40:27 +00:00
Jordan Justen 3f3c4895da */Contributions.txt: Update example email address
Use the example.com domain as recommended in RFC 2606.

NOTE: This does not modify the wording of the "TianoCore Contribution
      Agreement 1.0" section

Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Jordan Justen <jordan.l.justen@intel.com>
Reviewed-by: Bruce Cran <bruce.cran@gmail.com>

git-svn-id: https://svn.code.sf.net/p/edk2/code/trunk/edk2@16724 6f19259b-4bc3-4df7-8a09-765794883524
2015-02-03 17:29:14 +00:00
Yingke Liu 2f04e52739 Fix SET statement bug which is always evaluated even it is in a False conditional statement.
Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Yingke Liu <yingke.d.liu@intel.com>
Reviewed-by: Liming Gao <liming.gao@intel.com>

git-svn-id: https://svn.code.sf.net/p/edk2/code/trunk/edk2@16620 6f19259b-4bc3-4df7-8a09-765794883524
2015-01-19 05:04:28 +00:00
Yingke Liu b0e23cf32b Fixed build issue with fds target specified.
Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Yingke Liu <yingke.d.liu@intel.com>
Reviewed-by: Liming Gao <liming.gao@intel.com> 
Reviewed-by: Hesheng Chen <hesheng.chen@intel.com>


git-svn-id: https://svn.code.sf.net/p/edk2/code/trunk/edk2@16619 6f19259b-4bc3-4df7-8a09-765794883524
2015-01-19 05:01:39 +00:00
Liming Gao c5f1d437ed BaseTools Fix NASM tool version in comments of tools_def.template
NASM tool version should be 2.07 instead of 2.0.7.

Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Liming Gao <liming.gao@intel.com>
Reviewed-by: Jordan Justen <jordan.l.justen@intel.com>

git-svn-id: https://svn.code.sf.net/p/edk2/code/trunk/edk2@16596 6f19259b-4bc3-4df7-8a09-765794883524
2015-01-09 10:07:02 +00:00
Eric Dong 5c7956a2a3 Fixed VfrCompile crash on efivarstore statement.
Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Eric Dong <eric.dong@intel.com>
Reviewed-by: Aaron Pop <aaronp@ami.com>


git-svn-id: https://svn.code.sf.net/p/edk2/code/trunk/edk2@16591 6f19259b-4bc3-4df7-8a09-765794883524
2015-01-08 08:36:05 +00:00
Eric Dong 871f673315 Rollback change 16544.
Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Eric Dong <eric.dong@intel.com>

git-svn-id: https://svn.code.sf.net/p/edk2/code/trunk/edk2@16561 6f19259b-4bc3-4df7-8a09-765794883524
2014-12-30 03:03:37 +00:00
Cinnamon Shia 997a5d1b04 Fix ‘build run’ doesn’t work for NT32 X64 build.
Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Cinnamon Shia <cinnamon.shia@hp.com>
Reviewed-by: Yingke Liu <yingke.d.liu@intel.com>

git-svn-id: https://svn.code.sf.net/p/edk2/code/trunk/edk2@16550 6f19259b-4bc3-4df7-8a09-765794883524
2014-12-23 05:48:31 +00:00
Aaron Pop f571ef9880 Fixed VfrCompile crash on efivarstore statement.
Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Aaron Pop <aaronp@ami.com>
Reviewed-by: Eric Dong <eric.dong@intel.com>


git-svn-id: https://svn.code.sf.net/p/edk2/code/trunk/edk2@16544 6f19259b-4bc3-4df7-8a09-765794883524
2014-12-22 02:21:53 +00:00
Hess Chen 8d62ae35ca BaseTools/ECC: Fix some issues of ECC tool
Add support for the usage which is defined in the above line for a Protocol/Ppi/Guid
Add support for “!ERROR”
Ignore issue of parsing a macro

Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Hess Chen <hesheng.chen@intel.com>
Reviewed-by: Liming Gao <liming.gao@intel.com>


git-svn-id: https://svn.code.sf.net/p/edk2/code/trunk/edk2@16487 6f19259b-4bc3-4df7-8a09-765794883524
2014-12-09 06:41:58 +00:00
Yingke Liu 8546dfeace Fix a regression bug to uni parser.
Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Yingke Liu <yingke.d.liu@intel.com>
Reviewed-by: Liming Gao <liming.gao@intel.com>

git-svn-id: https://svn.code.sf.net/p/edk2/code/trunk/edk2@16469 6f19259b-4bc3-4df7-8a09-765794883524
2014-12-03 08:30:56 +00:00
Scott Duplichan 62771cee1d Fix ARM build failure with gcc 4.6.
Gcc option -mno-unaligned-access is supported by gcc 4.7 and newer, so it shouldn't be used with gcc 4.6.

Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Scott Duplichan <scott@notabs.org>
Reviewed-by: Yingke Liu <yingke.d.liu@intel.com>
Reviewed-by: Olivier Martin <Olivier.martin@arm.com>

git-svn-id: https://svn.code.sf.net/p/edk2/code/trunk/edk2@16464 6f19259b-4bc3-4df7-8a09-765794883524
2014-12-02 00:44:04 +00:00
Yingke Liu edafa0bbe4 Enhance error handling for external tool.
Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Yingke Liu <yingke.d.liu@intel.com>
Reviewed-by: Liming Gao <liming.gao@intel.com>

git-svn-id: https://svn.code.sf.net/p/edk2/code/trunk/edk2@16458 6f19259b-4bc3-4df7-8a09-765794883524
2014-12-01 08:22:07 +00:00
Cecil Sheng 71f02911b1 Corrected slash and quote handling in the strings of UNI files.
Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Cecil Sheng <cecil.sheng@hp.com>
Reviewed-by: Yingke Liu <yingke.d.liu@intel.com>

git-svn-id: https://svn.code.sf.net/p/edk2/code/trunk/edk2@16456 6f19259b-4bc3-4df7-8a09-765794883524
2014-12-01 01:05:05 +00:00
Hess Chen 1f0a062f8c BaseTools/UPT: Fix an issue of storing wrong PCD into XML file.
Fix an issue of storing wrong PCD into XML file to only store PcdEx for AsBuilt sections

Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Hess Chen <hesheng.chen@intel.com>
Reviewed-by: Yingke Liu <yingke.d.liu@Intel.com>


git-svn-id: https://svn.code.sf.net/p/edk2/code/trunk/edk2@16426 6f19259b-4bc3-4df7-8a09-765794883524
2014-11-25 04:58:17 +00:00
Scott Duplichan 915a379b1c BaseTools: Extend support for Windows hosted gcc to versions 4.4-4.7.
Revision 16400 adds support for Windows hosted gcc versions 4.8 and 4.9.
With this change, all of the GCCXX tool chains can be used from Windows.

Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Scott Duplichan <scott@notabs.org>
Reviewed-by: Liming Gao <liming.gao@intel.com>

git-svn-id: https://svn.code.sf.net/p/edk2/code/trunk/edk2@16418 6f19259b-4bc3-4df7-8a09-765794883524
2014-11-24 02:43:17 +00:00
Scott Duplichan 285a175441 BaseTools: Modify gcc 4.8 and 4.9 tool chain definition to support building from Windows.
Here is a new patch that adds Windows support for both gcc 4.8.x and gcc 4.9.x. 
This time testing is more thorough: boot testing using Duet for all 4 combinations of 
IA32/X64 and gcc 4.8.2 and gcc 4.9.1 passes. A Windows hosted gcc 4.8.2 has been added here:
http://sourceforge.net/projects/edk2developertoolsforwindows/

The environment variable settings for Windows look like:

set UEFI_BUILD_TOOLS=%cd%\tools
set NASM_PREFIX=%UEFI_BUILD_TOOLS%\nasm211\
set GCC48_BIN=%UEFI_BUILD_TOOLS%\gcc482-x86\bin\
set GCC48_DLL=%UEFI_BUILD_TOOLS%\gcc482-x86\dll\;%GCC48_BIN%
set GCC48_ARM_PREFIX=%UEFI_BUILD_TOOLS%\gcc482-arm\bin\
set GCC48_AARCH64_PREFIX=%UEFI_BUILD_TOOLS%\gcc482-aarch64\bin\
set GCC49_BIN=%UEFI_BUILD_TOOLS%\gcc491-x86\bin\
set GCC49_DLL=%UEFI_BUILD_TOOLS%\gcc491-x86\dll\;%GCC49_BIN%
set GCC49_ARM_PREFIX=%UEFI_BUILD_TOOLS%\gcc491-arm\bin\
set GCC49_AARCH64_PREFIX=%UEFI_BUILD_TOOLS%\gcc491-aarch64\bin\

No change is needed for building from Linux. 

Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Scott Duplichan <scott@notabs.org>
Reviewed-by: Liming Gao <liming.gao@intel.com>

git-svn-id: https://svn.code.sf.net/p/edk2/code/trunk/edk2@16400 6f19259b-4bc3-4df7-8a09-765794883524
2014-11-18 02:38:20 +00:00
Liming Gao d808fc659d BaseTools: Correct NASM output file type for UNIXGCC and CYGGCC.
Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Liming Gao <liming.gao@intel.com>
Reviewed-by: Yingke Liu <yingke.d.liu@intel.com>

git-svn-id: https://svn.code.sf.net/p/edk2/code/trunk/edk2@16399 6f19259b-4bc3-4df7-8a09-765794883524
2014-11-18 02:19:47 +00:00
Yingke Liu bcbdc75535 BaseTools: Fix a cleanall issue.
Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Yingke Liu <yingke.d.liu@intel.com>
Reviewed-by: Liming Gao <liming.gao@intel.com>

git-svn-id: https://svn.code.sf.net/p/edk2/code/trunk/edk2@16338 6f19259b-4bc3-4df7-8a09-765794883524
2014-11-12 08:26:03 +00:00
Yingke Liu 8200fcfe54 BaseTool: Support EDKII style GUID definition for VFR function.
Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Yingke Liu <yingke.d.liu@intel.com>
Reviewed-by: Liming Gao <liming.gao@intel.com>

git-svn-id: https://svn.code.sf.net/p/edk2/code/trunk/edk2@16330 6f19259b-4bc3-4df7-8a09-765794883524
2014-11-11 07:33:50 +00:00
Olivier Martin b85f57995e BaseTools/GenFw: Fixed R_AARCH64_CALL26/R_AARCH64_JUMP26 when referring to start of a section
When R_AARCH64_CALL26/R_AARCH64_JUMP26 relocations referred to static
functions, they sometime refer to the start of the '.text' section + addend.
It means the addend is different of '0'.
The non-patched code (before applying the relocation) already contains
the correct offset.

Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Olivier Martin <olivier.martin@arm.com>
Reviewed-by: Yingke Liu <yingke.d.liu@intel.com>



git-svn-id: https://svn.code.sf.net/p/edk2/code/trunk/edk2@16302 6f19259b-4bc3-4df7-8a09-765794883524
2014-11-05 18:56:17 +00:00
Jordan Justen 26830e8579 EDK II Contributions.txt: Update patch format information
Update to show what the patch looks like in email form.

NOTE: This does not modify the wording of the "TianoCore Contribution
      Agreement 1.0" section

Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Jordan Justen <jordan.l.justen@intel.com>
Reviewed-by: Jaben Carsey <jaben.carsey@intel.com>

git-svn-id: https://svn.code.sf.net/p/edk2/code/trunk/edk2@16297 6f19259b-4bc3-4df7-8a09-765794883524
2014-10-31 22:05:50 +00:00
Jordan Justen fe7ad7f6af BaseTools: Add ConvertMasmToNasm.py script
This script is intended to assist with MASM to NASM syntax
conversions.

The output should be manually inspected and adjusted as needed, since
this script does not provide a perfect conversion.

Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Jordan Justen <jordan.l.justen@intel.com>
Acked-by: Yingke D Liu <yingke.d.liu@intel.com>

git-svn-id: https://svn.code.sf.net/p/edk2/code/trunk/edk2@16285 6f19259b-4bc3-4df7-8a09-765794883524
2014-10-31 19:55:15 +00:00
Hess Chen 0414ec24ba BaseTools/UPT: Remove Macro Expend for UserExtension section
Remove Macro Expend for UserExtension section

Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Hess Chen <hesheng.chen@intel.com>
Reviewed-by: Gao, Liming <liming.gao@intel.com>

git-svn-id: https://svn.code.sf.net/p/edk2/code/trunk/edk2@16226 6f19259b-4bc3-4df7-8a09-765794883524
2014-10-22 06:44:45 +00:00
Ryan Harkin 71bcf79963 EDK II: Add .gitignore
While edk2 is still maintained in SVN, Many edk2 developers use git
for their main workflow, using the official mirrors.

Add a .gitignore to the EDK II root, BaseTools and Conf directories to
prevents files generated as part of the build from cluttering up "git
status" output.

Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Ryan Harkin <ryan.harkin@linaro.org>
[removed Linaro-specific bits, rework for upstream]
Signed-off-by: Leif Lindholm <leif.lindholm@linaro.org>
Reviewed-by: Jordan Justen <jordan.l.justen@intel.com>

git-svn-id: https://svn.code.sf.net/p/edk2/code/trunk/edk2@16213 6f19259b-4bc3-4df7-8a09-765794883524
2014-10-14 16:08:15 +00:00
Nikolai Saoukh 0a0ca7877d BaseTools: Use '/' as path separator for objcopy --add-gnu-debuglink
Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Nikolai Saoukh <nms@otdel-1.org>
Reviewed-by: Jordan Justen <jordan.l.justen@intel.com>

git-svn-id: https://svn.code.sf.net/p/edk2/code/trunk/edk2@16172 6f19259b-4bc3-4df7-8a09-765794883524
2014-09-25 02:29:18 +00:00
Leif Lindholm e0ba625fc6 BaseTools: Actually plug in BaseTools build on AArch64
Support for building BaseTools on AArch64 is available in the tree, but
not currently "plugged in". This patch adds the required snippet.

Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Leif Lindholm <leif.lindholm@linaro.org>
Reviewed-by: Olivier Martin <olivier.martin@arm.com>



git-svn-id: https://svn.code.sf.net/p/edk2/code/trunk/edk2@16169 6f19259b-4bc3-4df7-8a09-765794883524
2014-09-24 21:07:53 +00:00
Gao, Liming b4dfada85d BaseTools: Update nmake Makefile to handle the file path with “:\\”.
DOS del command doesn’t handle “:\\” in the file path. This patch converts “:\\” to “:\”.

Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Gao, Liming <liming.gao@intel.com>
Reviewed-by: lhauch <larry.hauch@intel.com>

git-svn-id: https://svn.code.sf.net/p/edk2/code/trunk/edk2@16160 6f19259b-4bc3-4df7-8a09-765794883524
2014-09-23 01:32:56 +00:00
Hess Chen e7ae4a7cb3 BaseTools/ECC: Ignore duplicate check for 'NULL' library
Update a checkpoint to ignore duplicate check for 'NULL' library

Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Hess Chen <hesheng.chen@intel.com>
Reviewed-by: Yingke Liu <yingke.d.liu@Intel.com>

git-svn-id: https://svn.code.sf.net/p/edk2/code/trunk/edk2@16154 6f19259b-4bc3-4df7-8a09-765794883524
2014-09-22 07:37:28 +00:00
Hess Chen 875cc5bb97 BaseTools/Upt: Fix several bugs
1. Fix a bug of generating additional EOL in file header.
2. Fix a bug of format error for Defines section.

Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Hess Chen <hesheng.chen@intel.com>
Reviewed-by: Yingke Liu <yingke.d.liu@Intel.com>

git-svn-id: https://svn.code.sf.net/p/edk2/code/trunk/edk2@16153 6f19259b-4bc3-4df7-8a09-765794883524
2014-09-22 07:06:12 +00:00
Hess Chen 76d475117d BaseTools/Upt: Fix several bugs
1. Fix a bug of packaging a full path file in zip at Linux.
2. Fix a format error of generating Hob/Event/BootMode information.
3. Fix a bug of generating additional “GUID” subtype for “UNDEFINED” guid.

Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Hess Chen <hesheng.chen@intel.com>
Reviewed-by: Yingke Liu <yingke.d.liu@Intel.com>

git-svn-id: https://svn.code.sf.net/p/edk2/code/trunk/edk2@16149 6f19259b-4bc3-4df7-8a09-765794883524
2014-09-19 02:04:08 +00:00
Gao, Liming ec53da7bfa BaseTools: Update the BaseTools/Source/Python/Makefile to check for dependent files
Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Gao, Liming <liming.gao@intel.com>
Reviewed-by: Hauch, Larry <larry.hauch@intel.com>

git-svn-id: https://svn.code.sf.net/p/edk2/code/trunk/edk2@16124 6f19259b-4bc3-4df7-8a09-765794883524
2014-09-17 08:47:01 +00:00
Gao, Liming 4d10d18db9 Update Build Tool version from 0.51 to 0.60
Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Gao, Liming <liming.gao@intel.com>


git-svn-id: https://svn.code.sf.net/p/edk2/code/trunk/edk2@16114 6f19259b-4bc3-4df7-8a09-765794883524
2014-09-16 09:03:00 +00:00
Yingke Liu 9b9500a1c9 Support DSC and FDF file out of WORKSPACE by GenFds.
Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Yingke Liu <yingke.d.liu@intel.com>
Reviewed-by: Liming Gao <liming.gao@intel.com>

git-svn-id: https://svn.code.sf.net/p/edk2/code/trunk/edk2@16113 6f19259b-4bc3-4df7-8a09-765794883524
2014-09-16 08:33:40 +00:00
Andrew Fish 438f3ad68f BaseTools/Source/C: Only used '-Wno-self-assign' when BaseTools are built on DARWIN
Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Andrew Fish <afish@apple.com>
Reviewed-By: Olivier Martin <olivier.martin@arm.com>
Tested-By: Olivier Martin <olivier.martin@arm.com>
Reviewed-by: Gao, Liming <liming.gao@intel.com>



git-svn-id: https://svn.code.sf.net/p/edk2/code/trunk/edk2@16106 6f19259b-4bc3-4df7-8a09-765794883524
2014-09-16 00:38:12 +00:00
lhauch 6c22c0a35d The current Makefile only checks the primary python file, such as build.py and does not check other files in tool’s directory tree.
This modification adds all of the other files within the tool’s directory tree that would be a cause to rebuild the tool.

The format in the Makefile for listing these other files was selected to allow the nightly build script to detect changes in the additional files.

Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: lhauch <larry.hauch@intel.com>
Reviewed-by: Gao, Liming <liming.gao@intel.com>


git-svn-id: https://svn.code.sf.net/p/edk2/code/trunk/edk2@16103 6f19259b-4bc3-4df7-8a09-765794883524
2014-09-12 22:59:04 +00:00
Feng, Bob C 84cc912aee This patch is going to fix the issue of the mis-match between the index of Platform DynamicPcd list and Dynamic Pcd generated token number.
Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Feng, Bob C <bob.c.feng@intel.com>
Reviewed-by: Yingke Liu <yingke.d.liu@intel.com>

git-svn-id: https://svn.code.sf.net/p/edk2/code/trunk/edk2@16101 6f19259b-4bc3-4df7-8a09-765794883524
2014-09-12 08:46:30 +00:00
Yingke Liu 7ae7dcb976 BaseTools: Fix the regression issue after enbaling s_* an d_* macros in FDF.
Add the missing 'MacroDict' field in FfsInfStatement. 

The issue is that BaseTools/Source/Python/GenFds/FfsInfStatement.py", line 448, in __ExtendMacro__
    String = GenFdsGlobalVariable.MacroExtend(String, self.MacroDict)
AttributeError: OptRomInfStatement instance has no attribute 'MacroDict'

Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Yingke Liu <yingke.d.liu@intel.com>
Reviewed-by: Liming Gao <liming.gao@intel.com>


git-svn-id: https://svn.code.sf.net/p/edk2/code/trunk/edk2@16099 6f19259b-4bc3-4df7-8a09-765794883524
2014-09-12 06:57:22 +00:00
Abner Chang 0acb3d2862 Add support for ${s_*} and ${d_*} macros for in FDF file for the INF files, and for each statement in the build rules.
The following keywords are supported:
"src", "s_path", "s_dir", "s_name", "s_base", "s_ext", "dst", "d_path", "d_name", "d_base", "d_ext" 

Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Abner Chang <abner.chang@hp.com>
Reviewed-by: Yingke Liu <yingke.d.liu@intel.com>
Reviewed-by: Larry Hauch <larry.hauch@intel.com>


git-svn-id: https://svn.code.sf.net/p/edk2/code/trunk/edk2@16094 6f19259b-4bc3-4df7-8a09-765794883524
2014-09-11 06:44:17 +00:00
Andrew Fish e5367bfb61 BaseTools: Fix XCODE5 to work properly with NASM
The default object type for NASM is raw binary, and this will not link.

Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Andrew Fish <afish@apple.com>
Reviewed-by: Jordan Justen <jordan.l.justen@intel.com>


git-svn-id: https://svn.code.sf.net/p/edk2/code/trunk/edk2@16085 6f19259b-4bc3-4df7-8a09-765794883524
2014-09-10 16:48:59 +00:00
lhauch 0d5d829c0e This file allows a developer to add a new tool in either the C or Python trees, add the executable (and any supporting files, such as the TestSigningPrivateKey.pem file) to this file and the build server will automatically make sure that the new files are added to the BaseTools\Bin\Win32 directory. The Win32 directory is located in https://svn.code.sf.net/p/edk2-toolbinaries/code/trunk/Win32 repository.
Developer - Tool add process:
1)	Developer adds code for the new tool.
2)	Developer updates the Makefile in the C or Python directory
a)	The entry must make sure that the executable is generated in the BaseTools\Bin\Win32 directory and any supporting files are copied to the same directory as part of the build step.
3)	Developer adds the <Toolname>.exe under the [Bin.Win32] section in the BinaryFiles.txt file.
4)	Developer adds other files required to be present in the [ExtraFiles.Win32] section in the BinaryFiles.txt file.

Build Server:
1)	Build all binaries by calling nmake on the Source\C\Makefile and Source\Python\Makefile
2)	After building the binaries, the build server verify that the files listed in BaseTools\Source\BinFiles.txt are also in the edk2-toolbinaries project,
a.	If a file is not under source control, then the build server will add file as long as it is present.

File format:
[SectionName.TargetDir]
File1
File2
…

Where: 
SectionName is one of Bin, ExtraFiles or CxFreeze
TargeDir is the name of the subdirectory in the BaseTools\Bin directory tree.

Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: lhauch <larry.hauch@intel.com>


git-svn-id: https://svn.code.sf.net/p/edk2/code/trunk/edk2@16063 6f19259b-4bc3-4df7-8a09-765794883524
2014-09-05 14:15:40 +00:00
Hess Chen 49d9b71df2 BaseTools/AutoGen: Remove redundant copy action for binary module
Remove redundant copy action for binary module to copy binary files to output directory only when the binary module is a library

Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Hess Chen <hesheng.chen@intel.com>
Reviewed-by: Yingke Liu <yingke.d.liu@Intel.com>

git-svn-id: https://svn.code.sf.net/p/edk2/code/trunk/edk2@16057 6f19259b-4bc3-4df7-8a09-765794883524
2014-09-04 08:32:44 +00:00
Hess Chen cf2b2bdef3 BaseTools/UPT: Replace os.linesep with '\r\n' when generating UNI files.
Replace os.linesep with '\r\n' when generating UNI files to make sure all files are under DOS format.

Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Hess Chen <hesheng.chen@intel.com>
Reviewed-by: Gao, Liming <liming.gao@intel.com>

git-svn-id: https://svn.code.sf.net/p/edk2/code/trunk/edk2@16041 6f19259b-4bc3-4df7-8a09-765794883524
2014-09-03 08:25:10 +00:00
Hess Chen 51b8553fd2 BaseTools/CommonLib: Add a step to convert ":\\" to ":\"
Convert ":\\\\" to ":\\", because it doesn't work with WINDOWS_EXTENSION_PATH.

Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Hess Chen <hesheng.chen@intel.com>
Reviewed-by: Liming Gao <liming.gao@intel.com> 


git-svn-id: https://svn.code.sf.net/p/edk2/code/trunk/edk2@16039 6f19259b-4bc3-4df7-8a09-765794883524
2014-09-03 02:09:19 +00:00
Jordan Justen b3f9cdaebb BaseTools tools_def: Indicate that NASM 2.07 or later is required
Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Jordan Justen <jordan.l.justen@intel.com>
Reviewed-by: Liming Gao <liming.gao@intel.com>

git-svn-id: https://svn.code.sf.net/p/edk2/code/trunk/edk2@16018 6f19259b-4bc3-4df7-8a09-765794883524
2014-09-01 17:22:58 +00:00
Jordan Justen ff0279814a BaseTools build_rule: Add .nasm => .obj build rule
Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Jordan Justen <jordan.l.justen@intel.com>
Reviewed-by: Liming Gao <liming.gao@intel.com>

git-svn-id: https://svn.code.sf.net/p/edk2/code/trunk/edk2@16017 6f19259b-4bc3-4df7-8a09-765794883524
2014-09-01 17:22:51 +00:00
Jordan Justen 9a5a743582 BaseTools tools_def: Add NASM_FLAGS
Note: Only tested with the GCC49 toolchain so far.

Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Jordan Justen <jordan.l.justen@intel.com>
Reviewed-by: Liming Gao <liming.gao@intel.com>

git-svn-id: https://svn.code.sf.net/p/edk2/code/trunk/edk2@16016 6f19259b-4bc3-4df7-8a09-765794883524
2014-09-01 17:07:19 +00:00
Feng, Bob C 12d37ace00 This patch is going to fix the issue of only Default SkuId is built into the External Pcd DataBase.
Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Feng, Bob C <bob.c.feng@intel.com>
Reviewed-by: Gao, Liming <liming.gao@intel.com>

git-svn-id: https://svn.code.sf.net/p/edk2/code/trunk/edk2@16006 6f19259b-4bc3-4df7-8a09-765794883524
2014-08-30 12:59:03 +00:00
Anderw Fish 9358dc21e7 BaseTools: Cleanup XCODE build rules
Update C-Code-File rule since XCODE never needs the SYMRENAME step.
Add *.S16 to Mash16-Code-File rule to supoprt 16-bit assmebly with XCODE

Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Anderw Fish <afish@apple.com>
Reviewed-by: Gao, Liming <liming.gao@intel.com> 


git-svn-id: https://svn.code.sf.net/p/edk2/code/trunk/edk2@15980 6f19259b-4bc3-4df7-8a09-765794883524
2014-08-29 18:34:04 +00:00
Anderw Fish 4484f397d3 BaseTools: Add the XCODE5 tools target to supoprt Xcode 5
Xcode 5 changed the arguments required to supoprt X64 EFIAPI so it is a new 
target. XCODE5 supports Xcode 5.* and Xcode 6.*, and will probably support
future versions of Xcode as well. 

Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Anderw Fish <afish@apple.com>
Reviewed-by: Gao, Liming <liming.gao@intel.com> 



git-svn-id: https://svn.code.sf.net/p/edk2/code/trunk/edk2@15979 6f19259b-4bc3-4df7-8a09-765794883524
2014-08-29 18:29:46 +00:00
Yingke Liu 97fa0ee9b1 License header updated to match correct format.
Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Yingke Liu <yingke.d.liu@intel.com>
Reviewed-by: Liming Gao <liming.gao@intel.com>

git-svn-id: https://svn.code.sf.net/p/edk2/code/trunk/edk2@15971 6f19259b-4bc3-4df7-8a09-765794883524
2014-08-28 13:53:34 +00:00
Anderw Fish f7523dee90 BaseTools: Fix BaseTools C compiler flags for Xcode 5
-fno-merge-constants is not supported by clang, and it warns it will turn into
  a hard error in the future.
-Wno-deprecated-declarations removes warnings about obsolete libraries that
  are not secure.
-Wno-self-assign removes warnings from LZMA code.
    
Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Anderw Fish <afish@apple.com>
Reviewed-by: Jordan Justen <jordan.l.justen@intel.com>



git-svn-id: https://svn.code.sf.net/p/edk2/code/trunk/edk2@15938 6f19259b-4bc3-4df7-8a09-765794883524
2014-08-28 05:13:37 +00:00
Anderw Fish ed395cfecd BaseTools: Fix clang C++ build error
Move argument default to constructor to remove clang warning.

Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Anderw Fish <afish@apple.com>
Reviewed-by: Gao, Liming <liming.gao@intel.com>



git-svn-id: https://svn.code.sf.net/p/edk2/code/trunk/edk2@15932 6f19259b-4bc3-4df7-8a09-765794883524
2014-08-28 05:04:57 +00:00
Anderw Fish 07355bd5cc [BaseTools] clang warns that since BaseAddress is unsigned it can never be < 0.
Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Anderw Fish <afish@apple.com>
Reviewed-by: Gao, Liming <liming.gao@intel.com>


git-svn-id: https://svn.code.sf.net/p/edk2/code/trunk/edk2@15931 6f19259b-4bc3-4df7-8a09-765794883524
2014-08-28 05:02:35 +00:00
Andrew Fish 057ac410e3 BaseTools: add support Xcode 5 in the EmulatorPkg
The XCODE32 target is used to build the x86_64 Mac OS X application for the 
emulator. The other Xcode targets build the EFIAPI needed for UEFI. This patch
removes an obsolete command line argument.

Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Andrew Fish <afish@apple.com>
Reviewed-by: Jordan Justen <jordan.l.justen@intel.com>



git-svn-id: https://svn.code.sf.net/p/edk2/code/trunk/edk2@15930 6f19259b-4bc3-4df7-8a09-765794883524
2014-08-28 04:57:12 +00:00
lhauch f4260465a8 Updated GenBootSector, GenCrc32 and GenPage to remove duplicate “Build” word in the version output, updated the minor number and copyright as needed.
Updated the VolInfo version output to remove the tool description from the --version output string.

Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: lhauch <larry.hauch@intel.com>
Reviewed-by: Gao, Liming <liming.gao@intel.com>

git-svn-id: https://svn.code.sf.net/p/edk2/code/trunk/edk2@15924 6f19259b-4bc3-4df7-8a09-765794883524
2014-08-27 16:14:42 +00:00
Hess Chen fae62ff21a This patch is going to:
1.       Support a force binary build mode by adding “--ignore-source” to command line options.

Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Hess Chen <hesheng.chen@intel.com>
Reviewed-by: Yingke Liu <yingke.d.liu@intel.com>

git-svn-id: https://svn.code.sf.net/p/edk2/code/trunk/edk2@15897 6f19259b-4bc3-4df7-8a09-765794883524
2014-08-26 07:14:38 +00:00
Hess Chen 421ccda307 This patch is going to:
1.	Add a recovery mode for UPT failure
2.	Add UNI file support
3.	Add binary file header support
4.	Add support for PCD error message
5.	Add support for replace
6.	Format generated INF/DEC files
7.	Update dependency check
8.	Other minor fixes


Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Hess Chen <hesheng.chen@intel.com>
Reviewed-by: Gao, Liming <liming.gao@intel.com>

git-svn-id: https://svn.code.sf.net/p/edk2/code/trunk/edk2@15896 6f19259b-4bc3-4df7-8a09-765794883524
2014-08-26 05:58:02 +00:00
Feng, Bob C a0a2cd1ea6 This patch is going to correct the external PCD database generation rule to support the case that all binary driver are only listed in FDF file.
Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Feng, Bob C <bob.c.feng@intel.com>
Reviewed-by: Yingke Liu <yingke.d.liu@intel.com>

git-svn-id: https://svn.code.sf.net/p/edk2/code/trunk/edk2@15893 6f19259b-4bc3-4df7-8a09-765794883524
2014-08-26 02:52:24 +00:00
Jordan Justen fad213a3db EDK II Contributions.txt: Note acceptable contribution licenses
We strongly prefer that contribtions be offered using the same license
as the project/module. But, we should document other acceptable
licenses for contributions.

This will allow package owners to more easily know if they can accept
a contribution under a different source license.

NOTE: This does not modify the wording of the "TianoCore Contribution
      Agreement 1.0" section

Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Jordan Justen <jordan.l.justen@intel.com>
Reviewed-by: Mark Doran <mark.doran@intel.com>

git-svn-id: https://svn.code.sf.net/p/edk2/code/trunk/edk2@15892 6f19259b-4bc3-4df7-8a09-765794883524
2014-08-25 23:10:18 +00:00
lhauch d90aa46258 BootSectImage.exe, EfiLdrImage.exe and Split.exe tools have incorrect output from the --version option.
This patch fixes the --version option output and corrects the description displayed.

Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: lhauch <larry.hauch@intel.com>
Reviewed-by: Gao, Liming <liming.gao@intel.com>


git-svn-id: https://svn.code.sf.net/p/edk2/code/trunk/edk2@15890 6f19259b-4bc3-4df7-8a09-765794883524
2014-08-25 20:06:55 +00:00
Yingke Liu b69fd59e6f Fix nmake cleanall bugs.
Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Yingke Liu <yingke.d.liu@intel.com>
Reviewed-by: Liming Gao <liming.gao@intel.com>

git-svn-id: https://svn.code.sf.net/p/edk2/code/trunk/edk2@15887 6f19259b-4bc3-4df7-8a09-765794883524
2014-08-25 05:00:34 +00:00
Hess Chen b3d07ff8d2 This patch is going to:
1.       Add a checkpoint to check if an UNI file is a valid UTF-16 file
2.       Add a checkpoint to check if a GUID/PPI/PROTOCOL/PCD is in a valid format.
3.       Some other minor changes.

Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Hess Chen <hesheng.chen@intel.com>
Reviewed-by: Yingke Liu <yingke.d.liu@intel.com>

git-svn-id: https://svn.code.sf.net/p/edk2/code/trunk/edk2@15886 6f19259b-4bc3-4df7-8a09-765794883524
2014-08-25 01:16:34 +00:00
lhauch bf47c6a11b Setting the svn property, svn:executable on the new scripts.
Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: lhauch <larry.hauch@intel.com>
Reviewed-by: Gao, Liming <liming.gao@intel.com>


git-svn-id: https://svn.code.sf.net/p/edk2/code/trunk/edk2@15868 6f19259b-4bc3-4df7-8a09-765794883524
2014-08-21 17:20:55 +00:00
lhauch bd63012c73 Adding files for proposed replacement for edksetup.bat.
This changes includes new scripts that breaks out some of the functionality in edksetup.bat and eliminates calling the toolsetup.bat file in BaseTools directory.

Edk2Setup.bat is to be used for testing. If no bugs are reported by the end of September, 2014, the file will be renamed to edksetup.bat.

Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: lhauch <larry.hauch@intel.com>
Reviewed-by: Gao, Liming <liming.gao@intel.com>



git-svn-id: https://svn.code.sf.net/p/edk2/code/trunk/edk2@15867 6f19259b-4bc3-4df7-8a09-765794883524
2014-08-21 16:41:41 +00:00
Hess Chen 0923aa1c3a This patch is going to:
1.	Skip the content defined in USER EXTENSION section without raising an error.
2.	Wrap os.utime to use two arguments.
3.	Add GenFdsCommand for PlatformAutoGen

Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Hess Chen <hesheng.chen@intel.com>
Reviewed-by: Gao, Liming <liming.gao@intel.com>


git-svn-id: https://svn.code.sf.net/p/edk2/code/trunk/edk2@15865 6f19259b-4bc3-4df7-8a09-765794883524
2014-08-21 07:51:21 +00:00
Yingke Liu 07b8564b11 AutoGen.c can only be generated if the module has intermediate object files generated or links other libraries.
Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Yingke Liu <yingke.d.liu@intel.com>
Reviewed-by: Liming Gao <liming.gao@intel.com>

git-svn-id: https://svn.code.sf.net/p/edk2/code/trunk/edk2@15864 6f19259b-4bc3-4df7-8a09-765794883524
2014-08-21 07:12:33 +00:00
Yingke Liu fcd4fbf30d 1. AutoGen.c should be generated if it is not empty even if there are no C source files.
2. If there are sub directories in current module, the corresponding directory in OUTPUT should be created.

Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Yingke Liu <yingke.d.liu@intel.com>
Reviewed-by: Chen, Hesheng <hesheng.chen@intel.com>
Reviewed-by: Feng, Bob C <bob.c.feng@intel.com>


git-svn-id: https://svn.code.sf.net/p/edk2/code/trunk/edk2@15860 6f19259b-4bc3-4df7-8a09-765794883524
2014-08-21 01:39:18 +00:00
Olivier Martin cb60328323 BaseTools: Added support for GCC stack protector for ARM architecture
Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Olivier Martin <olivier.martin@arm.com>
Reviewed-by: Yingke Liu <yingke.d.liu@intel.com>



git-svn-id: https://svn.code.sf.net/p/edk2/code/trunk/edk2@15854 6f19259b-4bc3-4df7-8a09-765794883524
2014-08-20 18:02:38 +00:00
Hess Chen df0cee8d8c This patch is going to:
1. Fix a bug in GenFds for wrongly handling '"' of command line parameter.
2. Provide different input parameter mode for different OS. For Linux, using a list. For Windows, using a string.
3. Remove 3 un-existing function calling.

Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Hess Chen <hesheng.chen@intel.com>
Reviewed-by: Yingke Liu <yingke.d.liu@intel.com>


git-svn-id: https://svn.code.sf.net/p/edk2/code/trunk/edk2@15847 6f19259b-4bc3-4df7-8a09-765794883524
2014-08-20 07:41:38 +00:00
Yingke Liu 4805b4b5dd Fix an issue of building BaseTools from sources using VS2013.
Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Yingke Liu <yingke.d.liu@intel.com>
Reviewed-by: Hauch, Larry <larry.hauch@intel.com>
Reviewed-by: Gao, Liming <liming.gao@intel.com>

git-svn-id: https://svn.code.sf.net/p/edk2/code/trunk/edk2@15844 6f19259b-4bc3-4df7-8a09-765794883524
2014-08-20 02:26:07 +00:00
Hess Chen 01ce353813 This patch is going to fix a build failure (running of GenFds) in Linux system caused by patch at r15816.
Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Hess Chen <hesheng.chen@intel.com>
Reviewed-by: Gao, Liming <liming.gao@intel.com>


git-svn-id: https://svn.code.sf.net/p/edk2/code/trunk/edk2@15831 6f19259b-4bc3-4df7-8a09-765794883524
2014-08-19 08:22:04 +00:00
Jordan Justen abb158ded4 BaseTools: Add rules to build NASM source file into a binary
v2:
 * Use EDK II tool name of NASMB rather than NASMBIN
 * Use EDK II extension of .nasmb rather than .nasmbin
v3:
 * Create listing file
 * Don't change into source directory
 * Add ENV(NASM_PREFIX) before nasm for NASM_PATH

Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Jordan Justen <jordan.l.justen@intel.com>
Reviewed-by: Laszlo Ersek <lersek@redhat.com>
Reviewed-by: Liming Gao <liming.gao@intel.com>

git-svn-id: https://svn.code.sf.net/p/edk2/code/trunk/edk2@15820 6f19259b-4bc3-4df7-8a09-765794883524
2014-08-18 23:03:17 +00:00
Hess Chen 03af275332 This patch is going to retire the top level makefile on BaseTools for supporting a pure binary build without any complier.
Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Hess Chen <hesheng.chen@intel.com>
Reviewed-by: Yingke Liu <yingke.d.liu@intel.com>

git-svn-id: https://svn.code.sf.net/p/edk2/code/trunk/edk2@15816 6f19259b-4bc3-4df7-8a09-765794883524
2014-08-18 04:59:01 +00:00
Hess Chen 1be2ed90a2 There is a limitation on WINDOWS OS for the length of entire file path can’t be larger than 255. There is an OS API provided by Microsoft to add “\\?\” before the path header to support the long file path. Enable this feature on basetools.
Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Hess Chen <hesheng.chen@intel.com>
Reviewed-by: Yingke Liu <yingke.d.liu@intel.com>

git-svn-id: https://svn.code.sf.net/p/edk2/code/trunk/edk2@15809 6f19259b-4bc3-4df7-8a09-765794883524
2014-08-15 03:06:48 +00:00
Michael Kinney c9df168fa0 Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Michael Kinney  <michael.d.kinney@intel.com>
Reviewed-by: lhauch <larry.hauch@intel.com>

Fix the behavior of the –version flag in the Rsa2048Sha256 tools and update logic for showing program name, version, usage, and copyright information to match other BaseTools.




git-svn-id: https://svn.code.sf.net/p/edk2/code/trunk/edk2@15805 6f19259b-4bc3-4df7-8a09-765794883524
2014-08-14 20:08:17 +00:00
Michael Kinney 65ce860e49 Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Michael Kinney  <michael.d.kinney@intel.com>
Reviewed-by: Yingke Liu <yingke.d.liu@intel.com>

Add support for RSA 2048 SHA 256 signing and verification encoded in a PI FFS GUIDED Encapsulation Section.  The primary use case of this feature is in support of signing and verification of encapsulated FVs for Recovery and Capsule Update, but can potentially be used for signing and verification of any content that can be stored in a PI conformant FFS file.  Signing operations are performed from python scripts that wrap OpenSsl command line utilities.  Verification operations are performed using the OpenSsl libraries in the CryptoPkg.

The guided encapsulation sections uses the UEFI 2.4 Specification defined GUID called EFI_CERT_TYPE_RSA2048_SHA256_GUID.  The data layout for the encapsulation section starts with the UEFI 2.4 Specification defined structure called EFI_CERT_BLOCK_RSA_2048_SHA256 followed immediately by the data.  The signing tool included in these patches performs encode/decode operations using this data layout.  HashType is set to the UEFI 2.4 Specification defined GUID called EFI_HASH_ALGORITHM_SHA256_GUID.

MdePkg/Include/Guid/WinCertificate.h
================================= 
//
// WIN_CERTIFICATE_UEFI_GUID.CertType
// 
#define EFI_CERT_TYPE_RSA2048_SHA256_GUID \
  {0xa7717414, 0xc616, 0x4977, {0x94, 0x20, 0x84, 0x47, 0x12, 0xa7, 0x35, 0xbf } }

///
/// WIN_CERTIFICATE_UEFI_GUID.CertData
/// 
typedef struct {
  EFI_GUID  HashType;
  UINT8     PublicKey[256];
  UINT8     Signature[256];
} EFI_CERT_BLOCK_RSA_2048_SHA256;

MdePkg/Include/Protocol/Hash.h
================================= 
#define EFI_HASH_ALGORITHM_SHA256_GUID \
  { \
    0x51aa59de, 0xfdf2, 0x4ea3, {0xbc, 0x63, 0x87, 0x5f, 0xb7, 0x84, 0x2e, 0xe9 } \
  }

The verification operations require the use of public key(s).  A new PCD called gEfiSecurityPkgTokenSpaceGuid.PcdRsa2048Sha256PublicKeyBuffer is added to the SecurityPkg that supports one or more SHA 256 hashes of the public keys.  A SHA 256 hash is performed to minimize the FLASH overhead of storing the public keys.  When a verification operation is performed, a SHA 256 hash is performed on EFI_CERT_BLOCK_RSA_2048_SHA256.PublicKey and a check is made to see if that hash matches any of the hashes in the new PCD.  It is recommended that this PCD always be configured in the DSC file as storage type of [PcdsDynamixExVpd], so the public keys are stored in a protected read-only region.

While working on this feature, I noticed that the CRC32 signing and verification feature was incomplete.  It only supported CRC32 based verification in the DXE Phase, so the attached patches also provide support for CRC32 based verification in the PEI Phase.

I also noticed that the most common method for incorporating guided section extraction libraries was to directly link them to the DXE Core, which is not very flexible.  The attached patches also add a generic section extraction PEIM and a generic section extraction DXE driver that can each be linked against one or more section extraction libraries.  This provides a platform developer with the option of providing section extraction services with the DXE Core or providing section extraction services with these generic PEIM/DXE Drivers.

Patch Summary
==============
1)	BaseTools - Rsa2049Sha256Sign python script that can perform test signing or custom signing of PI FFS file GUIDed sections
  a.	Wrapper for a set of OpenSsl command line utility operations
  b.	OpenSsl command line tool must be installed in location that is in standard OS path or in path specified by OS environment variable called OPENSSL_PATH
  c.	Provides standard EDK II command line arguments for a tool that encodes/decodes guided encapsulation section 

Rsa2048Sha256Sign - Copyright (c) 2013 - 2014, Intel Corporation. All rights reserved.
usage: Rsa2048Sha256Sign -e|-d [options] <input_file>

positional arguments:
  input_file            specify the input filename

optional arguments:
  -e                    encode file
  -d                    decode file
  -o filename, --output filename
                        specify the output filename
  --private-key PRIVATEKEYFILE
                        specify the private key filename. If not specified, a
                        test signing key is used.
  -v, --verbose         increase output messages
  -q, --quiet           reduce output messages
  --debug [0-9]         set debug level
  --version             display the program version and exit
  -h, --help            display this help text

2)	BaseTools - Rsa2049Sha256GenerateKeys python script that can generate new private/public key and PCD value that is SHA 256 hash of public key using OpenSsl command line utilities.
  a.	Wrapper for a set of OpenSsl command line utility operations
  b.	OpenSsl command line tool must be installed in location that is in standard path or in path specified by OS environment variable called OPENSSL_PATH

Rsa2048Sha256GenerateKeys - Copyright (c) 2013 - 2014, Intel Corporation. All rights reserved.
usage: Rsa2048Sha256GenerateKeys [options]

optional arguments:
  -o [filename [filename ...]], --output [filename [filename ...]]
                        specify the output private key filename in PEM format
  -i [filename [filename ...]], --input [filename [filename ...]]
                        specify the input private key filename in PEM format
  --public-key-hash PUBLICKEYHASHFILE
                        specify the public key hash filename that is SHA 256
                        hash of 2048 bit RSA public key in binary format
  --public-key-hash-c PUBLICKEYHASHCFILE
                        specify the public key hash filename that is SHA 256
                        hash of 2048 bit RSA public key in C structure format
  -v, --verbose         increase output messages
  -q, --quiet           reduce output messages
  --debug [0-9]         set debug level
  --version             display the program version and exit
  -h, --help            display this help text

3)	BaseTools\Conf\tools_def.template
  a.	Define GUID/Tool to perform RSA 2048 SHA 256 test signing and instructions on how to use alternate private/public key
b.	GUID is EFI_CERT_TYPE_RSA2048_SHA256_GUID
  c.	Tool is Rsa2049Sha256Sign
4)	MdeModulePkg\Library\PeiCrc32GuidedSectionExtractionLib
  a.	Add peer for DxeCrc32GuidedSectionExtractionLib so both PEI and DXE phases can perform basic integrity checks of PEI and DXE components
5)	MdeModulePkg\Universal\SectionExtractionPei
  a.	Generic PEIM that can link against one or more NULL section extraction library instances to provided one or more GUIDED Section Extraction PPIs
6)	MdeModulePkg\Universal\SectionExtractionDxe
  a.	Generic DXE Driver that can link against one or more NULL section extraction library instances to provide one or more GUIDED Section Extraction Protocols.
7)	SecurityPkg\Library\PeiRsa2048Sha256GuidedSectionExtractLib
  a.	NULL library instances that performs PEI phase RSA 2048 SHA 256 signature verification using OpenSsl libraries from CryptoPkg.
  b.	Based on algorithms from SecurityPkg Authenticated Variable services
  c.	Uses public key from gEfiSecurityPkgTokenSpaceGuid.PcdRsa2048Sha256PublicKeyBuffer.
8)	SecurityPkg\Library\DxeRsa2048Sha256GuidedSectionExtractLib
  a.	NULL library instances that performs DXE phase RSA 2048 SHA 256 signature verification using OpenSsl libraries from CryptoPkg.
  b.	Based on algorithms from SecurityPkg Authenticated Variable services
  c.	Uses public key from gEfiSecurityPkgTokenSpaceGuid.PcdRsa2048Sha256PublicKeyBuffer.




git-svn-id: https://svn.code.sf.net/p/edk2/code/trunk/edk2@15800 6f19259b-4bc3-4df7-8a09-765794883524
2014-08-14 06:30:10 +00:00
Harry Liebel 87280982b8 BaseTools: Add AArch64 ADR_PREL_LO21 and R_AARCH64_CONDBR19
relocations

- ADR_PREL_LO21: support for loading a PC relative label offset.
- R_AARCH64_CONDBR19: support for conditional branch instruction (ELF64 code: 280).

Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Harry Liebel <Harry.Liebel@arm.com>
Signed-off-by: Olivier Martin <olivier.martin@arm.com>
Reviewed-by: Yingke Liu <yingke.d.liu@intel.com>



git-svn-id: https://svn.code.sf.net/p/edk2/code/trunk/edk2@15745 6f19259b-4bc3-4df7-8a09-765794883524
2014-08-04 08:44:11 +00:00
lhauch d8162fb5aa CodeModule: BaseTools - tools_def.txt VS2010, VS2010x86, VS2012 and VS2012x86 update locations for rc.exe tool
This change will point to the correct location of the rc.exe tool.
RC.exe is used for building UEFI compliant drivers that must have a UEFI_HII_RESOURCE_SECTION generated as part of the .efi image file.

Contributed-under: TianoCore Contribution Agreement 1.0

Signed-off-by: lhauch <larry.hauch@intel.com>
Reviewed-by: Gao, Liming <liming.gao@intel.com>
Reviewed-by: Yingke Liu <yingke.d.liu@intel.com>


git-svn-id: https://svn.code.sf.net/p/edk2/code/trunk/edk2@15735 6f19259b-4bc3-4df7-8a09-765794883524
2014-08-01 18:11:32 +00:00
Eric Dong cebd6ef904 Support --version command line for VfrCompile
Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Eric Dong <eric.dong@intel.com>
Reviewed-by: Liming Gao <liming.gao@intel.com>

git-svn-id: https://svn.code.sf.net/p/edk2/code/trunk/edk2@15733 6f19259b-4bc3-4df7-8a09-765794883524
2014-08-01 04:44:16 +00:00
Eric Dong 3a8e175b33 Update vfr format for orderedlist opcode to consistent with other opcode, also compatible with old format.
Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Eric Dong <eric.dong@intel.com>
Reviewed-by: Liming Gao <liming.gao@intel.com>

git-svn-id: https://svn.code.sf.net/p/edk2/code/trunk/edk2@15723 6f19259b-4bc3-4df7-8a09-765794883524
2014-07-31 08:24:13 +00:00
Wang, Yu 537bc12400 Add VS2013 tool chain in BaseTools\Conf\tools_def.template. Also, two issues came up related to vs2013 build and caused the build to fail.
Vs2013 issue #1:  warning message about uninitialized variables or pointers like this:
s:\incbld\ia32\intelframeworkmodulepkg\bus\isa\isabusdxe\isabus.c(395) : warning C4701: potentially uninitialized local variable 'DevicePathData' used
s:\incbld\ia32\intelframeworkmodulepkg\bus\isa\isabusdxe\isabus.c(395) : warning C4703: potentially uninitialized local pointer variable 'DevicePathData' used
LINK : fatal error LNK1257: code generation failed
The following online messages shows discussions related to this vs2013 issue and how Microsoft engineer responded.  They suggest a work around by adding the initialization for the variables.
https://connect.microsoft.com/VisualStudio/feedback/details/816730/bogus-warning-from-vs-2013

Vs2013 issue #2:
C:\Program Files\Windows Kits\8.1\include\um\winnt.h(5105) : error C2220: warning treated as error - no 'object' file generated
C:\Program Files\Windows Kits\8.1\include\um\winnt.h(5105) : warning C4005: 'InterlockedCompareExchange64' : macro redefinition
This happened for Nt32Pkg.

Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Wang, Yu <yu.wang@intel.com>
Reviewed-by: Gao, Liming <liming.gao@intel.com>


git-svn-id: https://svn.code.sf.net/p/edk2/code/trunk/edk2@15722 6f19259b-4bc3-4df7-8a09-765794883524
2014-07-31 06:14:01 +00:00
Paolo Bonzini 1c023eb357 BuildEnv: remove useless check before setting $WORKSPACE
As long as $EDK_TOOLS_PATH is properly set, the BaseTools/ directory
is not necessary in the workspace.  The BuildEnv file itself suggests
setting the variable if BaseTools/ is not available.

However, this only works if the user also sets $WORKSPACE.  Otherwise,
BuildEnv refuses to set WORKSPACE itself and does not even try to use
the preset $EDK_TOOLS_PATH.  Remove the check that fails, as it does
not have any practical benefit.

Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Reviewed-by: Jordan Justen <jordan.l.justen@intel.com>

git-svn-id: https://svn.code.sf.net/p/edk2/code/trunk/edk2@15702 6f19259b-4bc3-4df7-8a09-765794883524
2014-07-28 17:37:46 +00:00
Jordan Justen dafe0fedc5 BaseTools: Add GCC49 toolchain; align data sections to 0x40
GCC 4.9 may use 64-byte (0x40) alignment for data sections.

Therefore we use a different link script for GCC 4.9. The only
difference from the gcc4.4-ld-script is the alignment for data
sections.

When using the GCC48 toolchain with GCC 4.9, this error would be
encountered by GenFw:
> GenFw: ERROR 3000: Invalid
>   Unsupported section alignment.

Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Jordan Justen <jordan.l.justen@intel.com>
Reviewed-by: Yingke Liu <yingke.d.liu@intel.com>

git-svn-id: https://svn.code.sf.net/p/edk2/code/trunk/edk2@15697 6f19259b-4bc3-4df7-8a09-765794883524
2014-07-28 17:37:10 +00:00
Jordan Justen 324c886410 BaseTools: Clear build versions to sync with buildtools/BaseTools
Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Jordan Justen <jordan.l.justen@intel.com>
Reviewed-by: Michael Kinney <michael.d.kinney@intel.com>

git-svn-id: https://svn.code.sf.net/p/edk2/code/trunk/edk2@15686 6f19259b-4bc3-4df7-8a09-765794883524
2014-07-25 21:10:33 +00:00
Gao, Liming liming.gao 8b7ebdb005 Update GenFv tool to handle the file path with space.
Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Gao, Liming liming.gao@intel.com
Review-by: Kinney, Michael D michael.d.kinney@intel.com

git-svn-id: https://svn.code.sf.net/p/edk2/code/trunk/edk2@15685 6f19259b-4bc3-4df7-8a09-765794883524
2014-07-25 21:10:20 +00:00
Eric Dong 0515478167 Report warning info if vfr file use the flags used for framework code only.
Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Eric Dong <eric.dong@intel.com>
Reviewed-by: Liming Gao <liming.gao@intel.com>

git-svn-id: https://svn.code.sf.net/p/edk2/code/trunk/edk2@15684 6f19259b-4bc3-4df7-8a09-765794883524
2014-07-25 21:10:10 +00:00
Eric Dong 15be099aa7 Clean 1 build error and 1 warning for VfrCompiler.
Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Eric Dong <eric.dong@intel.com>
Reviewed-by: Liming Gao <liming.gao@intel.com>

git-svn-id: https://svn.code.sf.net/p/edk2/code/trunk/edk2@15683 6f19259b-4bc3-4df7-8a09-765794883524
2014-07-25 21:09:59 +00:00
Eric Dong 1d218f83f1 Report warning info if an action opcode has text two statement.
Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Eric Dong <eric.dong@intel.com>
Reviewed-by: Liming Gao <liming.gao@intel.com>

git-svn-id: https://svn.code.sf.net/p/edk2/code/trunk/edk2@15682 6f19259b-4bc3-4df7-8a09-765794883524
2014-07-25 21:09:48 +00:00
lhauch 54032ed969 CodeModule: BaseTools - Adding the svn:external to the https://svn.code.sf.net/p/edk2-toolbinaries/code/trunk/Win32
This change allows users to checkout the edk2 project ignoring the svn:externals.

Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: lhauch <larry.hauch@intel.com>
Reviewed-by: Michael Kinney <michael.d.kinney@intel.com>



git-svn-id: https://svn.code.sf.net/p/edk2/code/trunk/edk2@15679 6f19259b-4bc3-4df7-8a09-765794883524
2014-07-25 14:07:00 +00:00
lhauch d2f4e548e3 CodeModule: BaseTools - Removing Win32 binaries to be replaced with an svn:external to the https://svn.code.sf.net/p/edk2-toolbinaries/code/trunk/Win32
This change allows users to checkout the edk2 project ignoring the svn:externals.

Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: lhauch <larry.hauch@intel.com>
Reviewed-by: Michael Kinney <michael.d.kinney@intel.com>


git-svn-id: https://svn.code.sf.net/p/edk2/code/trunk/edk2@15678 6f19259b-4bc3-4df7-8a09-765794883524
2014-07-25 14:04:48 +00:00
Gao, Liming e4ac870fe9 Sync BaseTool trunk (version r2670) into EDKII BaseTools.
Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Gao, Liming <liming.gao@intel.com>
Reviewed-by: Liu, Yingke D (yingke.d.liu@intel.com)


git-svn-id: https://svn.code.sf.net/p/edk2/code/trunk/edk2@15605 6f19259b-4bc3-4df7-8a09-765794883524
2014-07-01 07:10:10 +00:00
Tian, Hot 5c1e62f35a Fix CRLF format
Signed-off-by: Tian, Hot <hot.tian@intel.com>


git-svn-id: https://svn.code.sf.net/p/edk2/code/trunk/edk2@15189 6f19259b-4bc3-4df7-8a09-765794883524
2014-01-27 05:36:53 +00:00
Gao, Liming f51461c829 Sync BaseTool trunk (version r2649) into EDKII BaseTools.
Signed-off-by: Gao, Liming <liming.gao@intel.com>


git-svn-id: https://svn.code.sf.net/p/edk2/code/trunk/edk2@15188 6f19259b-4bc3-4df7-8a09-765794883524
2014-01-27 05:23:15 +00:00
Gao, Liming 2bc3256ca6 Sync BaseTool trunk (version r2640) into EDKII BaseTools.
Signed-off-by: Gao, Liming <liming.gao@intel.com>
Reviewed-by: Liu, Jiang A <jiang.a.liu@intel.com>


git-svn-id: https://svn.code.sf.net/p/edk2/code/trunk/edk2@15089 6f19259b-4bc3-4df7-8a09-765794883524
2014-01-10 05:25:50 +00:00