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
This commit is contained in:
Gao, Liming
2014-07-01 07:10:10 +00:00
committed by lgao4
parent 148af38722
commit e4ac870fe9
53 changed files with 792 additions and 435 deletions

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

View File

@ -1,5 +1,5 @@
# #
# Copyright (c) 2007 - 2011, Intel Corporation. All rights reserved.<BR> # Copyright (c) 2007 - 2014, Intel Corporation. All rights reserved.<BR>
# Portions copyright (c) 2008 - 2010, Apple Inc. All rights reserved.<BR> # Portions copyright (c) 2008 - 2010, Apple Inc. All rights reserved.<BR>
# This program and the accompanying materials # This program and the accompanying materials
# are licensed and made available under the terms and conditions of the BSD License # are licensed and made available under the terms and conditions of the BSD License
@ -240,11 +240,11 @@
"$(DLINK)" /OUT:${dst} $(DLINK_FLAGS) $(DLINK_SPATH) @$(STATIC_LIBRARY_FILES_LIST) "$(DLINK)" /OUT:${dst} $(DLINK_FLAGS) $(DLINK_SPATH) @$(STATIC_LIBRARY_FILES_LIST)
<Command.GCC> <Command.GCC>
"$(DLINK)" -o ${dst} $(DLINK_FLAGS) -\( $(DLINK_SPATH) @$(STATIC_LIBRARY_FILES_LIST) -\) $(DLINK2_FLAGS) "$(DLINK)" -o ${dst} $(DLINK_FLAGS) --start-group $(DLINK_SPATH) @$(STATIC_LIBRARY_FILES_LIST) --end-group $(DLINK2_FLAGS)
"$(OBJCOPY)" $(OBJCOPY_FLAGS) ${dst} "$(OBJCOPY)" $(OBJCOPY_FLAGS) ${dst}
<Command.ARMGCC, Command.ARMLINUXGCC> <Command.ARMGCC, Command.ARMLINUXGCC>
"$(DLINK)" -o ${dst} $(DLINK_FLAGS) -\( $(DLINK_SPATH) $(STATIC_LIBRARY_FILES) -\) $(DLINK2_FLAGS) "$(DLINK)" -o ${dst} $(DLINK_FLAGS) --start-group $(DLINK_SPATH) $(STATIC_LIBRARY_FILES) --end-group $(DLINK2_FLAGS)
<Command.RVCT> <Command.RVCT>
"$(DLINK)" $(DLINK_FLAGS) -o ${dst} $(DLINK_SPATH) --via $(STATIC_LIBRARY_FILES_LIST) $(DLINK2_FLAGS) "$(DLINK)" $(DLINK_FLAGS) -o ${dst} $(DLINK_SPATH) --via $(STATIC_LIBRARY_FILES_LIST) $(DLINK2_FLAGS)
@ -271,10 +271,10 @@
"$(DLINK)" $(DLINK_FLAGS) $(DLINK_SPATH) @$(STATIC_LIBRARY_FILES_LIST) "$(DLINK)" $(DLINK_FLAGS) $(DLINK_SPATH) @$(STATIC_LIBRARY_FILES_LIST)
<Command.GCC> <Command.GCC>
"$(DLINK)" $(DLINK_FLAGS) -\( $(DLINK_SPATH) @$(STATIC_LIBRARY_FILES_LIST) -\) $(DLINK2_FLAGS) "$(DLINK)" $(DLINK_FLAGS) --start-group $(DLINK_SPATH) @$(STATIC_LIBRARY_FILES_LIST) --end-group $(DLINK2_FLAGS)
<Command.ARMGCC, Command.ARMLINUXGCC> <Command.ARMGCC, Command.ARMLINUXGCC>
"$(DLINK)" $(DLINK_FLAGS) -\( $(DLINK_SPATH) $(STATIC_LIBRARY_FILES) -\) $(DLINK2_FLAGS) "$(DLINK)" $(DLINK_FLAGS) --start-group $(DLINK_SPATH) $(STATIC_LIBRARY_FILES) --end-group $(DLINK2_FLAGS)
<Command.RVCT> <Command.RVCT>
"$(DLINK)" $(DLINK_FLAGS) -o ${dst} $(DLINK_SPATH) --via $(STATIC_LIBRARY_FILES_LIST) $(DLINK2_FLAGS) "$(DLINK)" $(DLINK_FLAGS) -o ${dst} $(DLINK_SPATH) --via $(STATIC_LIBRARY_FILES_LIST) $(DLINK2_FLAGS)
@ -359,7 +359,8 @@
<Command.GCC> <Command.GCC>
Trim --asl-file -o $(OUTPUT_DIR)(+)${s_dir}(+)${s_base}.i -i $(INC_LIST) ${src} Trim --asl-file -o $(OUTPUT_DIR)(+)${s_dir}(+)${s_base}.i -i $(INC_LIST) ${src}
"$(ASLPP)" $(ASLPP_FLAGS) $(INC) -I${s_path} $(OUTPUT_DIR)(+)${s_dir}(+)${s_base}.i > $(OUTPUT_DIR)(+)${s_dir}(+)${s_base}.iii "$(ASLPP)" $(ASLPP_FLAGS) $(INC) -I${s_path} $(OUTPUT_DIR)(+)${s_dir}(+)${s_base}.i > $(OUTPUT_DIR)(+)${s_dir}(+)${s_base}.iii
"$(ASL)" $(ASL_FLAGS) $(ASL_OUTFLAGS)${dst} $(OUTPUT_DIR)(+)${s_dir}(+)${s_base}.iii Trim --source-code -l -o $(OUTPUT_DIR)(+)${s_dir}(+)${s_base}.iiii $(OUTPUT_DIR)(+)${s_dir}(+)${s_base}.iii
"$(ASL)" $(ASL_FLAGS) $(ASL_OUTFLAGS)${dst} $(OUTPUT_DIR)(+)${s_dir}(+)${s_base}.iiii
[C-Code-File.AcpiTable] [C-Code-File.AcpiTable]
<InputFile> <InputFile>
@ -429,7 +430,7 @@
"$(PP)" $(PP_FLAGS) $(INC) ${src} > ${d_path}(+)${s_base}.i "$(PP)" $(PP_FLAGS) $(INC) ${src} > ${d_path}(+)${s_base}.i
Trim --source-code -o ${d_path}(+)${s_base}.iii ${d_path}(+)${s_base}.i Trim --source-code -o ${d_path}(+)${s_base}.iii ${d_path}(+)${s_base}.i
"$(ASM)" -o $(OUTPUT_DIR)(+)${s_dir}(+)${s_base}.obj $(ASM_FLAGS) $(INC) ${d_path}(+)${s_base}.iii "$(ASM)" -o $(OUTPUT_DIR)(+)${s_dir}(+)${s_base}.obj $(ASM_FLAGS) $(INC) ${d_path}(+)${s_base}.iii
"$(DLINK)" -o ${dst} $(DLINK_FLAGS) -\( $(DLINK_SPATH) $(LIBS) $(OUTPUT_DIR)(+)${s_dir}(+)${s_base}.obj -\) "$(DLINK)" -o ${dst} $(DLINK_FLAGS) --start-group $(DLINK_SPATH) $(LIBS) $(OUTPUT_DIR)(+)${s_dir}(+)${s_base}.obj --end-group
<Command.XCODE> <Command.XCODE>
"$(PP)" $(PP_FLAGS) $(INC) ${src} > ${d_path}(+)${s_base}.i "$(PP)" $(PP_FLAGS) $(INC) ${src} > ${d_path}(+)${s_base}.i

View File

@ -1,5 +1,5 @@
# #
# Copyright (c) 2006 - 2013, Intel Corporation. All rights reserved.<BR> # Copyright (c) 2006 - 2014, Intel Corporation. All rights reserved.<BR>
# Portions copyright (c) 2008 - 2009, Apple Inc. All rights reserved.<BR> # Portions copyright (c) 2008 - 2009, Apple Inc. All rights reserved.<BR>
# Portions copyright (c) 2011 - 2013, ARM Ltd. All rights reserved.<BR> # Portions copyright (c) 2011 - 2013, ARM Ltd. All rights reserved.<BR>
# #
@ -162,8 +162,7 @@ DEFINE GCC47_X64_PREFIX = /usr/bin/
DEFINE GCC48_IA32_PREFIX = /usr/bin/ DEFINE GCC48_IA32_PREFIX = /usr/bin/
DEFINE GCC48_X64_PREFIX = /usr/bin/ DEFINE GCC48_X64_PREFIX = /usr/bin/
DEFINE UNIX_IASL_BIN = /usr/bin/iasl DEFINE UNIX_IASL_BIN = ENV(IASL_PREFIX)iasl
#DEFINE UNIX_IASL_BIN = $(HOME)/programs/iasl
DEFINE WIN_ASL_BIN_DIR = C:\ASL DEFINE WIN_ASL_BIN_DIR = C:\ASL
DEFINE WIN_IASL_BIN = DEF(WIN_ASL_BIN_DIR)\iasl.exe DEFINE WIN_IASL_BIN = DEF(WIN_ASL_BIN_DIR)\iasl.exe
DEFINE WIN_ASL_BIN = DEF(WIN_ASL_BIN_DIR)\asl.exe DEFINE WIN_ASL_BIN = DEF(WIN_ASL_BIN_DIR)\asl.exe
@ -2875,6 +2874,7 @@ NOOPT_VS2012x86xASL_X64_DLINK_FLAGS = /NOLOGO /NODEFAULTLIB /IGNORE:4001 /OPT
# ASL - Intel ACPI Source Language Compiler (iasl.exe) # ASL - Intel ACPI Source Language Compiler (iasl.exe)
*_DDK3790_*_*_FAMILY = MSFT *_DDK3790_*_*_FAMILY = MSFT
*_DDK3790_*_*_DLL = DEF(WINDDK_BIN32)
*_DDK3790_*_MAKE_PATH = DEF(WINDDK_BIN32)\nmake.exe *_DDK3790_*_MAKE_PATH = DEF(WINDDK_BIN32)\nmake.exe
*_DDK3790_*_MAKE_FLAGS = /nologo *_DDK3790_*_MAKE_FLAGS = /nologo
*_DDK3790_*_RC_PATH = DEF(WINDDK_BIN32)\rc.exe *_DDK3790_*_RC_PATH = DEF(WINDDK_BIN32)\rc.exe
@ -3000,6 +3000,7 @@ NOOPT_DDK3790_IPF_DLINK_FLAGS = /NOLOGO /NODEFAULTLIB /LTCG /DLL /OPT:REF,ICF
# ASL - Microsoft ACPI Source Language Compiler (asl.exe) # ASL - Microsoft ACPI Source Language Compiler (asl.exe)
*_DDK3790xASL_*_*_FAMILY = MSFT *_DDK3790xASL_*_*_FAMILY = MSFT
*_DDK3790xASL_*_*_DLL = DEF(WINDDK_BIN32)
*_DDK3790xASL_*_MAKE_PATH = DEF(WINDDK_BIN32)\nmake.exe *_DDK3790xASL_*_MAKE_PATH = DEF(WINDDK_BIN32)\nmake.exe
*_DDK3790xASL_*_MAKE_FLAGS = /nologo *_DDK3790xASL_*_MAKE_FLAGS = /nologo
*_DDK3790xASL_*_RC_PATH = DEF(WINDDK_BIN32)\rc.exe *_DDK3790xASL_*_RC_PATH = DEF(WINDDK_BIN32)\rc.exe
@ -3127,7 +3128,7 @@ NOOPT_DDK3790xASL_IPF_DLINK_FLAGS = /NOLOGO /NODEFAULTLIB /LTCG /DLL /OPT:REF
DEBUG_*_*_OBJCOPY_ADDDEBUGFLAG = --add-gnu-debuglink=$(DEBUG_DIR)\$(MODULE_NAME).debug DEBUG_*_*_OBJCOPY_ADDDEBUGFLAG = --add-gnu-debuglink=$(DEBUG_DIR)\$(MODULE_NAME).debug
RELEASE_*_*_OBJCOPY_ADDDEBUGFLAG = RELEASE_*_*_OBJCOPY_ADDDEBUGFLAG =
DEFINE GCC_ALL_CC_FLAGS = -g -Os -fshort-wchar -fno-strict-aliasing -Wall -Werror -Wno-missing-braces -Wno-array-bounds -c -include AutoGen.h DEFINE GCC_ALL_CC_FLAGS = -g -Os -fshort-wchar -fno-strict-aliasing -Wall -Werror -Wno-array-bounds -c -include AutoGen.h
DEFINE GCC_IA32_CC_FLAGS = DEF(GCC_ALL_CC_FLAGS) -m32 -malign-double -freorder-blocks -freorder-blocks-and-partition -O2 -mno-stack-arg-probe DEFINE GCC_IA32_CC_FLAGS = DEF(GCC_ALL_CC_FLAGS) -m32 -malign-double -freorder-blocks -freorder-blocks-and-partition -O2 -mno-stack-arg-probe
DEFINE GCC_X64_CC_FLAGS = DEF(GCC_ALL_CC_FLAGS) -mno-red-zone -Wno-address -mno-stack-arg-probe DEFINE GCC_X64_CC_FLAGS = DEF(GCC_ALL_CC_FLAGS) -mno-red-zone -Wno-address -mno-stack-arg-probe
DEFINE GCC_IPF_CC_FLAGS = DEF(GCC_ALL_CC_FLAGS) -minline-int-divide-min-latency DEFINE GCC_IPF_CC_FLAGS = DEF(GCC_ALL_CC_FLAGS) -minline-int-divide-min-latency
@ -3154,7 +3155,7 @@ DEFINE GCC_IPF_RC_FLAGS = -I binary -O elf64-ia64-little -B ia64
DEFINE GCC_ARM_RC_FLAGS = -I binary -O elf32-littlearm -B arm --rename-section .data=.hii DEFINE GCC_ARM_RC_FLAGS = -I binary -O elf32-littlearm -B arm --rename-section .data=.hii
DEFINE GCC_AARCH64_RC_FLAGS = -I binary -O elf64-littleaarch64 -B aarch64 --rename-section .data=.hii DEFINE GCC_AARCH64_RC_FLAGS = -I binary -O elf64-littleaarch64 -B aarch64 --rename-section .data=.hii
DEFINE GCC44_ALL_CC_FLAGS = -g -fshort-wchar -fno-stack-protector -fno-strict-aliasing -Wall -Werror -Wno-missing-braces -Wno-array-bounds -ffunction-sections -fdata-sections -c -include AutoGen.h -DSTRING_ARRAY_NAME=$(BASE_NAME)Strings DEFINE GCC44_ALL_CC_FLAGS = -g -fshort-wchar -fno-stack-protector -fno-strict-aliasing -Wall -Werror -Wno-array-bounds -ffunction-sections -fdata-sections -c -include AutoGen.h -DSTRING_ARRAY_NAME=$(BASE_NAME)Strings
DEFINE GCC44_IA32_CC_FLAGS = DEF(GCC44_ALL_CC_FLAGS) -m32 -malign-double -D EFI32 DEFINE GCC44_IA32_CC_FLAGS = DEF(GCC44_ALL_CC_FLAGS) -m32 -malign-double -D EFI32
DEFINE GCC44_X64_CC_FLAGS = DEF(GCC44_ALL_CC_FLAGS) -m64 "-DEFIAPI=__attribute__((ms_abi))" -DNO_BUILTIN_VA_FUNCS -mno-red-zone -Wno-address -mcmodel=large DEFINE GCC44_X64_CC_FLAGS = DEF(GCC44_ALL_CC_FLAGS) -m64 "-DEFIAPI=__attribute__((ms_abi))" -DNO_BUILTIN_VA_FUNCS -mno-red-zone -Wno-address -mcmodel=large
DEFINE GCC44_IA32_X64_DLINK_COMMON = -nostdlib -n -q --gc-sections --script=$(EDK_TOOLS_PATH)/Scripts/gcc4.4-ld-script DEFINE GCC44_IA32_X64_DLINK_COMMON = -nostdlib -n -q --gc-sections --script=$(EDK_TOOLS_PATH)/Scripts/gcc4.4-ld-script
@ -4036,7 +4037,7 @@ RELEASE_GCC48_AARCH64_CC_FLAGS = DEF(GCC48_AARCH64_CC_FLAGS) -Wno-unused-but-s
*_ELFGCC_X64_VFRPP_PATH = DEF(ELFGCC_BIN)/gcc *_ELFGCC_X64_VFRPP_PATH = DEF(ELFGCC_BIN)/gcc
*_ELFGCC_X64_RC_PATH = DEF(ELFGCC_BIN)/objcopy *_ELFGCC_X64_RC_PATH = DEF(ELFGCC_BIN)/objcopy
*_ELFGCC_X64_CC_FLAGS = -Os -fshort-wchar -fno-strict-aliasing -Wall -Werror -Wno-missing-braces -Wno-address -Wno-array-bounds -c -include AutoGen.h -D_EFI_P64 *_ELFGCC_X64_CC_FLAGS = -Os -fshort-wchar -fno-strict-aliasing -Wall -Werror -Wno-address -Wno-array-bounds -c -include AutoGen.h -D_EFI_P64
*_ELFGCC_X64_DLINK_FLAGS = -nostdlib --shared --entry $(IMAGE_ENTRY_POINT) -u $(IMAGE_ENTRY_POINT) -Map $(DEST_DIR_DEBUG)/$(BASE_NAME).map *_ELFGCC_X64_DLINK_FLAGS = -nostdlib --shared --entry $(IMAGE_ENTRY_POINT) -u $(IMAGE_ENTRY_POINT) -Map $(DEST_DIR_DEBUG)/$(BASE_NAME).map
*_ELFGCC_X64_SLINK_FLAGS = *_ELFGCC_X64_SLINK_FLAGS =
*_ELFGCC_X64_ASM_FLAGS = -c -x assembler -imacros $(DEST_DIR_DEBUG)/AutoGen.h *_ELFGCC_X64_ASM_FLAGS = -c -x assembler -imacros $(DEST_DIR_DEBUG)/AutoGen.h

View File

@ -1,6 +1,6 @@
/** @file /** @file
Copyright (c) 1999 - 2008, Intel Corporation. All rights reserved.<BR> Copyright (c) 1999 - 2014, Intel Corporation. All rights reserved.<BR>
This program and the accompanying materials This program and the accompanying materials
are licensed and made available under the terms and conditions of the BSD License are licensed and made available under the terms and conditions of the BSD License
which accompanies this distribution. The full text of the license may be found at which accompanies this distribution. The full text of the license may be found at
@ -32,6 +32,37 @@ Abstract:
) \ ) \
) )
STATIC
UINT32
FvBufGetSecHdrLen(
IN EFI_COMMON_SECTION_HEADER *SectionHeader
)
{
if (SectionHeader == NULL) {
return 0;
}
if (FvBufExpand3ByteSize(SectionHeader->Size) == 0xffffff) {
return sizeof(EFI_COMMON_SECTION_HEADER2);
}
return sizeof(EFI_COMMON_SECTION_HEADER);
}
STATIC
UINT32
FvBufGetSecFileLen (
IN EFI_COMMON_SECTION_HEADER *SectionHeader
)
{
UINT32 Length;
if (SectionHeader == NULL) {
return 0;
}
Length = FvBufExpand3ByteSize(SectionHeader->Size);
if (Length == 0xffffff) {
Length = ((EFI_COMMON_SECTION_HEADER2 *)SectionHeader)->ExtendedSize;
}
return Length;
}
// //
// Local prototypes // Local prototypes
@ -92,7 +123,7 @@ Returns:
return Status; return Status;
} }
FileToRmLength = FvBufExpand3ByteSize (FileToRm->Size); FileToRmLength = FvBufGetFfsFileSize (FileToRm);
CommonLibBinderSetMem ( CommonLibBinderSetMem (
FileToRm, FileToRm,
@ -218,7 +249,7 @@ Returns:
EFI_FFS_FILE_STATE StateBackup; EFI_FFS_FILE_STATE StateBackup;
UINT32 FileSize; UINT32 FileSize;
FileSize = FvBufExpand3ByteSize (File->Size); FileSize = FvBufGetFfsFileSize (File);
// //
// Fill in checksums and state, they must be 0 for checksumming. // Fill in checksums and state, they must be 0 for checksumming.
@ -231,13 +262,13 @@ Returns:
File->IntegrityCheck.Checksum.Header = File->IntegrityCheck.Checksum.Header =
FvBufCalculateChecksum8 ( FvBufCalculateChecksum8 (
(UINT8 *) File, (UINT8 *) File,
sizeof (EFI_FFS_FILE_HEADER) FvBufGetFfsHeaderSize (File)
); );
if (File->Attributes & FFS_ATTRIB_CHECKSUM) { if (File->Attributes & FFS_ATTRIB_CHECKSUM) {
File->IntegrityCheck.Checksum.File = FvBufCalculateChecksum8 ( File->IntegrityCheck.Checksum.File = FvBufCalculateChecksum8 (
(VOID*)(File + 1), (VOID*)((UINT8 *)File + FvBufGetFfsHeaderSize (File)),
FileSize - sizeof (EFI_FFS_FILE_HEADER) FileSize - FvBufGetFfsHeaderSize (File)
); );
} else { } else {
File->IntegrityCheck.Checksum.File = FFS_FIXED_CHECKSUM; File->IntegrityCheck.Checksum.File = FFS_FIXED_CHECKSUM;
@ -568,7 +599,7 @@ Returns:
} }
FvbAttributes = hdr->Attributes; FvbAttributes = hdr->Attributes;
newSize = FvBufExpand3ByteSize (((EFI_FFS_FILE_HEADER*)File)->Size); newSize = FvBufGetFfsFileSize ((EFI_FFS_FILE_HEADER*)File);
for( for(
offset = (UINTN)ALIGN_POINTER (hdr->HeaderLength, 8); offset = (UINTN)ALIGN_POINTER (hdr->HeaderLength, 8);
@ -587,7 +618,7 @@ Returns:
// BUGBUG: Need to make sure that the new file does not already // BUGBUG: Need to make sure that the new file does not already
// exist. // exist.
fsize = FvBufExpand3ByteSize (fhdr->Size); fsize = FvBufGetFfsFileSize (fhdr);
if (fsize == 0 || (offset + fsize > fvSize)) { if (fsize == 0 || (offset + fsize > fvSize)) {
return EFI_VOLUME_CORRUPTED; return EFI_VOLUME_CORRUPTED;
} }
@ -725,7 +756,7 @@ Returns:
} }
erasedUint8 = (UINT8)((hdr->Attributes & EFI_FVB2_ERASE_POLARITY) ? 0xFF : 0); erasedUint8 = (UINT8)((hdr->Attributes & EFI_FVB2_ERASE_POLARITY) ? 0xFF : 0);
NewFileSize = FvBufExpand3ByteSize (((EFI_FFS_FILE_HEADER*)File)->Size); NewFileSize = FvBufGetFfsFileSize ((EFI_FFS_FILE_HEADER*)File);
if (NewFileSize != (UINTN)ALIGN_POINTER (NewFileSize, 8)) { if (NewFileSize != (UINTN)ALIGN_POINTER (NewFileSize, 8)) {
return EFI_INVALID_PARAMETER; return EFI_INVALID_PARAMETER;
@ -739,7 +770,7 @@ Returns:
LastFileSize = 0; LastFileSize = 0;
do { do {
Status = FvBufFindNextFile (Fv, &Key, (VOID **)&LastFile); Status = FvBufFindNextFile (Fv, &Key, (VOID **)&LastFile);
LastFileSize = FvBufExpand3ByteSize (((EFI_FFS_FILE_HEADER*)File)->Size); LastFileSize = FvBufGetFfsFileSize ((EFI_FFS_FILE_HEADER*)File);
} while (!EFI_ERROR (Status)); } while (!EFI_ERROR (Status));
// //
@ -811,6 +842,64 @@ Returns:
((UINT8*)SizeDest)[2] = (UINT8)(Size >> 16); ((UINT8*)SizeDest)[2] = (UINT8)(Size >> 16);
} }
UINT32
FvBufGetFfsFileSize (
IN EFI_FFS_FILE_HEADER *Ffs
)
/*++
Routine Description:
Get the FFS file size.
Arguments:
Ffs - Pointer to FFS header
Returns:
UINT32
--*/
{
if (Ffs == NULL) {
return 0;
}
if (Ffs->Attributes & FFS_ATTRIB_LARGE_FILE) {
return ((EFI_FFS_FILE_HEADER2 *)Ffs)->ExtendedSize;
}
return FvBufExpand3ByteSize(Ffs->Size);
}
UINT32
FvBufGetFfsHeaderSize (
IN EFI_FFS_FILE_HEADER *Ffs
)
/*++
Routine Description:
Get the FFS header size.
Arguments:
Ffs - Pointer to FFS header
Returns:
UINT32
--*/
{
if (Ffs == NULL) {
return 0;
}
if (Ffs->Attributes & FFS_ATTRIB_LARGE_FILE) {
return sizeof(EFI_FFS_FILE_HEADER2);
}
return sizeof(EFI_FFS_FILE_HEADER);
}
UINT32 UINT32
FvBufExpand3ByteSize ( FvBufExpand3ByteSize (
IN VOID* Size IN VOID* Size
@ -897,7 +986,7 @@ Returns:
) { ) {
fhdr = (EFI_FFS_FILE_HEADER*) ((UINT8*)hdr + *Key); fhdr = (EFI_FFS_FILE_HEADER*) ((UINT8*)hdr + *Key);
fsize = FvBufExpand3ByteSize (fhdr->Size); fsize = FvBufGetFfsFileSize (fhdr);
if (!EFI_TEST_FFS_ATTRIBUTES_BIT( if (!EFI_TEST_FFS_ATTRIBUTES_BIT(
FvbAttributes, FvbAttributes,
@ -1089,8 +1178,8 @@ Returns:
// //
// Raw filetypes don't have sections, so we just return the raw data // Raw filetypes don't have sections, so we just return the raw data
// //
*RawData = (VOID*)(File + 1); *RawData = (VOID*)((UINT8 *)File + FvBufGetFfsHeaderSize (File));
*RawDataSize = FvBufExpand3ByteSize (File->Size) - sizeof (*File); *RawDataSize = FvBufGetFfsFileSize (File) - FvBufGetFfsHeaderSize (File);
return EFI_SUCCESS; return EFI_SUCCESS;
} }
@ -1102,9 +1191,9 @@ Returns:
return Status; return Status;
} }
*RawData = (VOID*)(Section + 1); *RawData = (VOID*)((UINT8 *)Section + FvBufGetSecHdrLen(Section));
*RawDataSize = *RawDataSize =
FvBufExpand3ByteSize (Section->Size) - sizeof (*Section); FvBufGetSecFileLen (Section) - FvBufGetSecHdrLen(Section);
return EFI_SUCCESS; return EFI_SUCCESS;
@ -1144,16 +1233,28 @@ Returns:
UINT32 NewFileSize; UINT32 NewFileSize;
EFI_RAW_SECTION* NewSection; EFI_RAW_SECTION* NewSection;
UINT32 NewSectionSize; UINT32 NewSectionSize;
UINT32 FfsHdrLen;
UINT32 SecHdrLen;
// //
// The section size is the DataSize + the size of the section header // The section size is the DataSize + the size of the section header
// //
NewSectionSize = (UINT32)sizeof (EFI_RAW_SECTION) + (UINT32)RawDataSize; NewSectionSize = (UINT32)sizeof (EFI_RAW_SECTION) + (UINT32)RawDataSize;
SecHdrLen = sizeof (EFI_RAW_SECTION);
if (NewSectionSize >= MAX_SECTION_SIZE) {
NewSectionSize = (UINT32)sizeof (EFI_RAW_SECTION2) + (UINT32)RawDataSize;
SecHdrLen = sizeof (EFI_RAW_SECTION2);
}
// //
// The file size is the size of the file header + the section size // The file size is the size of the file header + the section size
// //
NewFileSize = sizeof (EFI_FFS_FILE_HEADER) + NewSectionSize; NewFileSize = sizeof (EFI_FFS_FILE_HEADER) + NewSectionSize;
FfsHdrLen = sizeof (EFI_FFS_FILE_HEADER);
if (NewFileSize >= MAX_FFS_SIZE) {
NewFileSize = sizeof (EFI_FFS_FILE_HEADER2) + NewSectionSize;
FfsHdrLen = sizeof (EFI_FFS_FILE_HEADER2);
}
// //
// Try to allocate a buffer to build the new FFS file in // Try to allocate a buffer to build the new FFS file in
@ -1167,24 +1268,35 @@ Returns:
// //
// The NewSection follow right after the FFS file header // The NewSection follow right after the FFS file header
// //
NewSection = (EFI_RAW_SECTION*)(NewFile + 1); NewSection = (EFI_RAW_SECTION*)((UINT8*)NewFile + FfsHdrLen);
FvBufCompact3ByteSize (NewSection->Size, NewSectionSize); if (NewSectionSize >= MAX_SECTION_SIZE) {
FvBufCompact3ByteSize (NewSection->Size, 0xffffff);
((EFI_RAW_SECTION2 *)NewSection)->ExtendedSize = NewSectionSize;
} else {
FvBufCompact3ByteSize (NewSection->Size, NewSectionSize);
}
NewSection->Type = EFI_SECTION_RAW; NewSection->Type = EFI_SECTION_RAW;
// //
// Copy the actual file data into the buffer // Copy the actual file data into the buffer
// //
CommonLibBinderCopyMem (NewSection + 1, RawData, RawDataSize); CommonLibBinderCopyMem ((UINT8 *)NewSection + SecHdrLen, RawData, RawDataSize);
// //
// Initialize the FFS file header // Initialize the FFS file header
// //
CommonLibBinderCopyMem (&NewFile->Name, Filename, sizeof (EFI_GUID)); CommonLibBinderCopyMem (&NewFile->Name, Filename, sizeof (EFI_GUID));
FvBufCompact3ByteSize (NewFile->Size, NewFileSize);
NewFile->Type = EFI_FV_FILETYPE_FREEFORM;
NewFile->Attributes = 0; NewFile->Attributes = 0;
if (NewFileSize >= MAX_FFS_SIZE) {
FvBufCompact3ByteSize (NewFile->Size, 0x0);
((EFI_FFS_FILE_HEADER2 *)NewFile)->ExtendedSize = NewFileSize;
NewFile->Attributes |= FFS_ATTRIB_LARGE_FILE;
} else {
FvBufCompact3ByteSize (NewFile->Size, NewFileSize);
}
NewFile->Type = EFI_FV_FILETYPE_FREEFORM;
NewFile->IntegrityCheck.Checksum.Header = NewFile->IntegrityCheck.Checksum.Header =
FvBufCalculateChecksum8 ((UINT8*)NewFile, sizeof (*NewFile)); FvBufCalculateChecksum8 ((UINT8*)NewFile, FfsHdrLen);
NewFile->IntegrityCheck.Checksum.File = FFS_FIXED_CHECKSUM; NewFile->IntegrityCheck.Checksum.File = FFS_FIXED_CHECKSUM;
NewFile->State = (UINT8)~( EFI_FILE_HEADER_CONSTRUCTION | NewFile->State = (UINT8)~( EFI_FILE_HEADER_CONSTRUCTION |
EFI_FILE_HEADER_VALID | EFI_FILE_HEADER_VALID |
@ -1239,7 +1351,7 @@ Returns:
} }
sectionHdr = (EFI_COMMON_SECTION_HEADER*)((UINT8*)SectionsStart + *Key); sectionHdr = (EFI_COMMON_SECTION_HEADER*)((UINT8*)SectionsStart + *Key);
sectionSize = FvBufExpand3ByteSize (sectionHdr->Size); sectionSize = FvBufGetSecFileLen (sectionHdr);
if (sectionSize < sizeof (EFI_COMMON_SECTION_HEADER)) { if (sectionSize < sizeof (EFI_COMMON_SECTION_HEADER)) {
return EFI_NOT_FOUND; return EFI_NOT_FOUND;
@ -1287,10 +1399,10 @@ Returns:
UINTN TotalSectionsSize; UINTN TotalSectionsSize;
EFI_COMMON_SECTION_HEADER* NextSection; EFI_COMMON_SECTION_HEADER* NextSection;
SectionStart = (VOID*)((UINTN)FfsFile + sizeof (EFI_FFS_FILE_HEADER)); SectionStart = (VOID*)((UINTN)FfsFile + FvBufGetFfsHeaderSize(FfsFile));
TotalSectionsSize = TotalSectionsSize =
FvBufExpand3ByteSize (((EFI_FFS_FILE_HEADER*)FfsFile)->Size) - FvBufGetFfsFileSize ((EFI_FFS_FILE_HEADER*)FfsFile) -
sizeof (EFI_FFS_FILE_HEADER); FvBufGetFfsHeaderSize(FfsFile);
Key = 0; Key = 0;
*Count = 0; *Count = 0;
while (TRUE) { while (TRUE) {
@ -1352,10 +1464,10 @@ Returns:
UINTN TotalSectionsSize; UINTN TotalSectionsSize;
EFI_COMMON_SECTION_HEADER* NextSection; EFI_COMMON_SECTION_HEADER* NextSection;
SectionStart = (VOID*)((UINTN)FfsFile + sizeof (EFI_FFS_FILE_HEADER)); SectionStart = (VOID*)((UINTN)FfsFile + FvBufGetFfsHeaderSize(FfsFile));
TotalSectionsSize = TotalSectionsSize =
FvBufExpand3ByteSize (((EFI_FFS_FILE_HEADER*)FfsFile)->Size) - FvBufGetFfsFileSize ((EFI_FFS_FILE_HEADER*)FfsFile) -
sizeof (EFI_FFS_FILE_HEADER); FvBufGetFfsHeaderSize(FfsFile);
Key = 0; Key = 0;
while (TRUE) { while (TRUE) {
Status = FvBufFindNextSection ( Status = FvBufFindNextSection (
@ -1436,7 +1548,7 @@ Returns:
EndOfLastFile = (UINT8*)FvHdr + FvHdr->FvLength; EndOfLastFile = (UINT8*)FvHdr + FvHdr->FvLength;
while (!EFI_ERROR (FvBufFindNextFile (Fv, &Key, (VOID **)&FileIt))) { while (!EFI_ERROR (FvBufFindNextFile (Fv, &Key, (VOID **)&FileIt))) {
EndOfLastFile = EndOfLastFile =
(VOID*)((UINT8*)FileIt + FvBufExpand3ByteSize (FileIt->Size)); (VOID*)((UINT8*)FileIt + FvBufGetFfsFileSize (FileIt));
} }
// //

View File

@ -1,6 +1,6 @@
/** @file /** @file
Copyright (c) 1999 - 2008, Intel Corporation. All rights reserved.<BR> Copyright (c) 1999 - 2014, Intel Corporation. All rights reserved.<BR>
This program and the accompanying materials This program and the accompanying materials
are licensed and made available under the terms and conditions of the BSD License are licensed and made available under the terms and conditions of the BSD License
which accompanies this distribution. The full text of the license may be found at which accompanies this distribution. The full text of the license may be found at
@ -82,6 +82,16 @@ FvBufExpand3ByteSize (
IN VOID* Size IN VOID* Size
); );
UINT32
FvBufGetFfsFileSize (
IN EFI_FFS_FILE_HEADER *Ffs
);
UINT32
FvBufGetFfsHeaderSize (
IN EFI_FFS_FILE_HEADER *Ffs
);
EFI_STATUS EFI_STATUS
FvBufExtend ( FvBufExtend (
IN VOID **Fv, IN VOID **Fv,

View File

@ -19,7 +19,7 @@ ifndef ARCH
# #
uname_m = $(shell uname -m) uname_m = $(shell uname -m)
$(info Attempting to detect ARCH from 'uname -m': $(uname_m)) $(info Attempting to detect ARCH from 'uname -m': $(uname_m))
ifeq ($(uname_m),x86_64) ifneq (,$(strip $(filter $(uname_m), x86_64 amd64)))
ARCH=X64 ARCH=X64
endif endif
ifeq ($(patsubst i%86,IA32,$(uname_m)),IA32) ifeq ($(patsubst i%86,IA32,$(uname_m)),IA32)

View File

@ -14,4 +14,4 @@
**/ **/
#define __BUILD_VERSION "Build 2649" #define __BUILD_VERSION "Build 2670"

View File

@ -53,10 +53,10 @@ VfrLexer.cpp VfrLexer.h: Pccts/dlg/dlg VfrParser.dlg
Pccts/dlg/dlg -C2 -i -CC -cl VfrLexer -o . VfrParser.dlg Pccts/dlg/dlg -C2 -i -CC -cl VfrLexer -o . VfrParser.dlg
Pccts/antlr/antlr: Pccts/antlr/antlr:
BIN_DIR='.' make -C Pccts/antlr BIN_DIR='.' $(MAKE) -C Pccts/antlr
Pccts/dlg/dlg: Pccts/dlg/dlg:
BIN_DIR='.' make -C Pccts/dlg BIN_DIR='.' $(MAKE) -C Pccts/dlg
ATokenBuffer.o: Pccts/h/ATokenBuffer.cpp ATokenBuffer.o: Pccts/h/ATokenBuffer.cpp
$(CXX) -c $(VFR_CPPFLAGS) $(INC) $? -o $@ $(CXX) -c $(VFR_CPPFLAGS) $(INC) $? -o $@
@ -73,7 +73,7 @@ VfrSyntax.o: VfrSyntax.cpp
clean: localClean clean: localClean
localClean: localClean:
BIN_DIR='.' make -C Pccts/antlr clean BIN_DIR='.' $(MAKE) -C Pccts/antlr clean
BIN_DIR='.' make -C Pccts/dlg clean BIN_DIR='.' $(MAKE) -C Pccts/dlg clean
rm -f $(EXTRA_CLEAN_OBJECTS) rm -f $(EXTRA_CLEAN_OBJECTS)

View File

@ -372,6 +372,8 @@ CVfrCompiler::CVfrCompiler (
mPreProcessCmd = (CHAR8 *) PREPROCESSOR_COMMAND; mPreProcessCmd = (CHAR8 *) PREPROCESSOR_COMMAND;
mPreProcessOpt = (CHAR8 *) PREPROCESSOR_OPTIONS; mPreProcessOpt = (CHAR8 *) PREPROCESSOR_OPTIONS;
SET_RUN_STATUS (STATUS_STARTED);
OptionInitialization(Argc, Argv); OptionInitialization(Argc, Argv);
if ((IS_RUN_STATUS(STATUS_FAILED)) || (IS_RUN_STATUS(STATUS_DEAD))) { if ((IS_RUN_STATUS(STATUS_FAILED)) || (IS_RUN_STATUS(STATUS_DEAD))) {

View File

@ -60,7 +60,8 @@ typedef struct {
} OPTIONS; } OPTIONS;
typedef enum { typedef enum {
STATUS_INITIALIZED = 1, STATUS_STARTED = 0,
STATUS_INITIALIZED,
STATUS_PREPROCESSED, STATUS_PREPROCESSED,
STATUS_COMPILEED, STATUS_COMPILEED,
STATUS_GENBINARY, STATUS_GENBINARY,

View File

@ -51,6 +51,7 @@ static SVFR_ERROR_HANDLE VFR_ERROR_HANDLE_TABLE [] = {
static SVFR_WARNING_HANDLE VFR_WARNING_HANDLE_TABLE [] = { static SVFR_WARNING_HANDLE VFR_WARNING_HANDLE_TABLE [] = {
{ VFR_WARNING_DEFAULT_VALUE_REDEFINED, ": default value re-defined with different value"}, { VFR_WARNING_DEFAULT_VALUE_REDEFINED, ": default value re-defined with different value"},
{ VFR_WARNING_STRING_TO_UINT_OVERFLOW, ": String to UINT* Overflow"},
{ VFR_WARNING_CODEUNDEFINED, ": undefined Warning Code" } { VFR_WARNING_CODEUNDEFINED, ": undefined Warning Code" }
}; };

View File

@ -49,6 +49,7 @@ typedef enum {
typedef enum { typedef enum {
VFR_WARNING_DEFAULT_VALUE_REDEFINED = 0, VFR_WARNING_DEFAULT_VALUE_REDEFINED = 0,
VFR_WARNING_STRING_TO_UINT_OVERFLOW,
VFR_WARNING_CODEUNDEFINED VFR_WARNING_CODEUNDEFINED
} EFI_VFR_WARNING_CODE; } EFI_VFR_WARNING_CODE;

View File

@ -2,7 +2,7 @@
The definition of CFormPkg's member function The definition of CFormPkg's member function
Copyright (c) 2004 - 2013, Intel Corporation. All rights reserved.<BR> Copyright (c) 2004 - 2014, Intel Corporation. All rights reserved.<BR>
This program and the accompanying materials This program and the accompanying materials
are licensed and made available under the terms and conditions of the BSD License are licensed and made available under the terms and conditions of the BSD License
which accompanies this distribution. The full text of the license may be found at which accompanies this distribution. The full text of the license may be found at
@ -1343,7 +1343,7 @@ public:
UpdateCIfrMinMaxStepData(&mNumeric->data); UpdateCIfrMinMaxStepData(&mNumeric->data);
} }
EFI_VFR_RETURN_CODE SetFlags (IN UINT8 HFlags, IN UINT8 LFlags) { EFI_VFR_RETURN_CODE SetFlags (IN UINT8 HFlags, IN UINT8 LFlags, BOOLEAN DisplaySettingsSpecified = FALSE) {
EFI_VFR_RETURN_CODE Ret; EFI_VFR_RETURN_CODE Ret;
Ret = CIfrQuestionHeader::SetFlags (HFlags); Ret = CIfrQuestionHeader::SetFlags (HFlags);
@ -1351,10 +1351,10 @@ public:
return Ret; return Ret;
} }
if (LFlags & EFI_IFR_DISPLAY) { if (DisplaySettingsSpecified == FALSE) {
mNumeric->Flags = LFlags;
} else {
mNumeric->Flags = LFlags | EFI_IFR_DISPLAY_UINT_DEC; mNumeric->Flags = LFlags | EFI_IFR_DISPLAY_UINT_DEC;
} else {
mNumeric->Flags = LFlags;
} }
return VFR_RETURN_SUCCESS; return VFR_RETURN_SUCCESS;
} }

File diff suppressed because it is too large Load Diff

View File

@ -1,6 +1,6 @@
/** @file /** @file
Copyright (c) 1999 - 2011, Intel Corporation. All rights reserved.<BR> Copyright (c) 1999 - 2014, Intel Corporation. All rights reserved.<BR>
This program and the accompanying materials This program and the accompanying materials
are licensed and made available under the terms and conditions of the BSD License are licensed and made available under the terms and conditions of the BSD License
which accompanies this distribution. The full text of the license may be found at which accompanies this distribution. The full text of the license may be found at
@ -975,22 +975,24 @@ Returns:
UINT32 FileLength; UINT32 FileLength;
UINT8 FileState; UINT8 FileState;
UINT8 Checksum; UINT8 Checksum;
EFI_FFS_FILE_HEADER BlankHeader; EFI_FFS_FILE_HEADER2 BlankHeader;
EFI_STATUS Status; EFI_STATUS Status;
UINT8 GuidBuffer[PRINTED_GUID_BUFFER_SIZE]; UINT8 GuidBuffer[PRINTED_GUID_BUFFER_SIZE];
UINT32 HeaderSize;
#if (PI_SPECIFICATION_VERSION < 0x00010000) #if (PI_SPECIFICATION_VERSION < 0x00010000)
UINT16 *Tail; UINT16 *Tail;
#endif #endif
// //
// Check if we have free space // Check if we have free space
// //
HeaderSize = FvBufGetFfsHeaderSize(FileHeader);
if (ErasePolarity) { if (ErasePolarity) {
memset (&BlankHeader, -1, sizeof (EFI_FFS_FILE_HEADER)); memset (&BlankHeader, -1, HeaderSize);
} else { } else {
memset (&BlankHeader, 0, sizeof (EFI_FFS_FILE_HEADER)); memset (&BlankHeader, 0, HeaderSize);
} }
if (memcmp (&BlankHeader, FileHeader, sizeof (EFI_FFS_FILE_HEADER)) == 0) { if (memcmp (&BlankHeader, FileHeader, HeaderSize) == 0) {
return EFI_SUCCESS; return EFI_SUCCESS;
} }
// //
@ -1008,7 +1010,7 @@ Returns:
// PrintGuid (&FileHeader->Name); // PrintGuid (&FileHeader->Name);
// printf ("\n"); // printf ("\n");
// //
FileLength = GetLength (FileHeader->Size); FileLength = FvBufGetFfsFileSize (FileHeader);
printf ("File Offset: 0x%08X\n", (unsigned) ((UINTN) FileHeader - (UINTN) FvImage)); printf ("File Offset: 0x%08X\n", (unsigned) ((UINTN) FileHeader - (UINTN) FvImage));
printf ("File Length: 0x%08X\n", (unsigned) FileLength); printf ("File Length: 0x%08X\n", (unsigned) FileLength);
printf ("File Attributes: 0x%02X\n", FileHeader->Attributes); printf ("File Attributes: 0x%02X\n", FileHeader->Attributes);
@ -1031,7 +1033,7 @@ Returns:
case EFI_FILE_HEADER_VALID: case EFI_FILE_HEADER_VALID:
printf (" EFI_FILE_HEADER_VALID\n"); printf (" EFI_FILE_HEADER_VALID\n");
Checksum = CalculateSum8 ((UINT8 *) FileHeader, sizeof (EFI_FFS_FILE_HEADER)); Checksum = CalculateSum8 ((UINT8 *) FileHeader, HeaderSize);
Checksum = (UINT8) (Checksum - FileHeader->IntegrityCheck.Checksum.File); Checksum = (UINT8) (Checksum - FileHeader->IntegrityCheck.Checksum.File);
Checksum = (UINT8) (Checksum - FileHeader->State); Checksum = (UINT8) (Checksum - FileHeader->State);
if (Checksum != 0) { if (Checksum != 0) {
@ -1053,7 +1055,7 @@ Returns:
// //
// Calculate header checksum // Calculate header checksum
// //
Checksum = CalculateSum8 ((UINT8 *) FileHeader, sizeof (EFI_FFS_FILE_HEADER)); Checksum = CalculateSum8 ((UINT8 *) FileHeader, HeaderSize);
Checksum = (UINT8) (Checksum - FileHeader->IntegrityCheck.Checksum.File); Checksum = (UINT8) (Checksum - FileHeader->IntegrityCheck.Checksum.File);
Checksum = (UINT8) (Checksum - FileHeader->State); Checksum = (UINT8) (Checksum - FileHeader->State);
if (Checksum != 0) { if (Checksum != 0) {
@ -1061,13 +1063,13 @@ Returns:
return EFI_ABORTED; return EFI_ABORTED;
} }
FileLength = GetLength (FileHeader->Size); FileLength = FvBufGetFfsFileSize (FileHeader);
if (FileHeader->Attributes & FFS_ATTRIB_CHECKSUM) { if (FileHeader->Attributes & FFS_ATTRIB_CHECKSUM) {
// //
// Calculate file checksum // Calculate file checksum
// //
Checksum = CalculateSum8 ((UINT8 *) (FileHeader + 1), FileLength - sizeof (EFI_FFS_FILE_HEADER)); Checksum = CalculateSum8 ((UINT8 *)FileHeader + HeaderSize, FileLength - HeaderSize);
Checksum = Checksum + FileHeader->IntegrityCheck.Checksum.File; Checksum = Checksum + FileHeader->IntegrityCheck.Checksum.File;
if (Checksum != 0) { if (Checksum != 0) {
Error (NULL, 0, 0003, "error parsing FFS file", "FFS file with Guid %s has invalid file checksum", GuidBuffer); Error (NULL, 0, 0003, "error parsing FFS file", "FFS file with Guid %s has invalid file checksum", GuidBuffer);
@ -1180,8 +1182,8 @@ Returns:
// All other files have sections // All other files have sections
// //
Status = ParseSection ( Status = ParseSection (
(UINT8 *) ((UINTN) FileHeader + sizeof (EFI_FFS_FILE_HEADER)), (UINT8 *) ((UINTN) FileHeader + HeaderSize),
GetLength (FileHeader->Size) - sizeof (EFI_FFS_FILE_HEADER) FvBufGetFfsFileSize (FileHeader) - HeaderSize
); );
if (EFI_ERROR (Status)) { if (EFI_ERROR (Status)) {
// //
@ -1225,6 +1227,7 @@ Returns:
EFI_SECTION_TYPE Type; EFI_SECTION_TYPE Type;
UINT8 *Ptr; UINT8 *Ptr;
UINT32 SectionLength; UINT32 SectionLength;
UINT32 SectionHeaderLen;
CHAR8 *SectionName; CHAR8 *SectionName;
EFI_STATUS Status; EFI_STATUS Status;
UINT32 ParsedLength; UINT32 ParsedLength;
@ -1246,6 +1249,10 @@ Returns:
CHAR8 *ToolOutputFile; CHAR8 *ToolOutputFile;
CHAR8 *SystemCommandFormatString; CHAR8 *SystemCommandFormatString;
CHAR8 *SystemCommand; CHAR8 *SystemCommand;
EFI_GUID *EfiGuid;
UINT16 DataOffset;
UINT16 Attributes;
UINT32 RealHdrLen;
ParsedLength = 0; ParsedLength = 0;
while (ParsedLength < BufferLength) { while (ParsedLength < BufferLength) {
@ -1264,6 +1271,12 @@ Returns:
continue; continue;
} }
//
// Get real section file size
//
SectionLength = GetSectionFileLength ((EFI_COMMON_SECTION_HEADER *) Ptr);
SectionHeaderLen = GetSectionHeaderLength((EFI_COMMON_SECTION_HEADER *)Ptr);
SectionName = SectionNameToStr (Type); SectionName = SectionNameToStr (Type);
printf ("------------------------------------------------------------\n"); printf ("------------------------------------------------------------\n");
printf (" Type: %s\n Size: 0x%08X\n", SectionName, (unsigned) SectionLength); printf (" Type: %s\n Size: 0x%08X\n", SectionName, (unsigned) SectionLength);
@ -1283,7 +1296,7 @@ Returns:
break; break;
case EFI_SECTION_FIRMWARE_VOLUME_IMAGE: case EFI_SECTION_FIRMWARE_VOLUME_IMAGE:
Status = PrintFvInfo (((EFI_FIRMWARE_VOLUME_IMAGE_SECTION*)Ptr) + 1, TRUE); Status = PrintFvInfo (Ptr + SectionHeaderLen, TRUE);
if (EFI_ERROR (Status)) { if (EFI_ERROR (Status)) {
Error (NULL, 0, 0003, "printing of FV section contents failed", NULL); Error (NULL, 0, 0003, "printing of FV section contents failed", NULL);
return EFI_SECTION_ERROR; return EFI_SECTION_ERROR;
@ -1304,15 +1317,22 @@ Returns:
break; break;
case EFI_SECTION_VERSION: case EFI_SECTION_VERSION:
printf (" Build Number: 0x%02X\n", ((EFI_VERSION_SECTION *) Ptr)->BuildNumber); printf (" Build Number: 0x%02X\n", *(UINT16 *)(Ptr + SectionHeaderLen));
printf (" Version Strg: %s\n", (char*) ((EFI_VERSION_SECTION *) Ptr)->VersionString); printf (" Version Strg: %s\n", (char*) (Ptr + SectionHeaderLen + sizeof (UINT16)));
break; break;
case EFI_SECTION_COMPRESSION: case EFI_SECTION_COMPRESSION:
UncompressedBuffer = NULL; UncompressedBuffer = NULL;
CompressedLength = SectionLength - sizeof (EFI_COMPRESSION_SECTION); if (SectionHeaderLen == sizeof (EFI_COMMON_SECTION_HEADER)) {
UncompressedLength = ((EFI_COMPRESSION_SECTION *) Ptr)->UncompressedLength; RealHdrLen = sizeof(EFI_COMPRESSION_SECTION);
CompressionType = ((EFI_COMPRESSION_SECTION *) Ptr)->CompressionType; UncompressedLength = ((EFI_COMPRESSION_SECTION *)Ptr)->UncompressedLength;
CompressionType = ((EFI_COMPRESSION_SECTION *)Ptr)->CompressionType;
} else {
RealHdrLen = sizeof(EFI_COMPRESSION_SECTION2);
UncompressedLength = ((EFI_COMPRESSION_SECTION2 *)Ptr)->UncompressedLength;
CompressionType = ((EFI_COMPRESSION_SECTION2 *)Ptr)->CompressionType;
}
CompressedLength = SectionLength - RealHdrLen;
printf (" Uncompressed Length: 0x%08X\n", (unsigned) UncompressedLength); printf (" Uncompressed Length: 0x%08X\n", (unsigned) UncompressedLength);
if (CompressionType == EFI_NOT_COMPRESSED) { if (CompressionType == EFI_NOT_COMPRESSED) {
@ -1328,13 +1348,13 @@ Returns:
return EFI_SECTION_ERROR; return EFI_SECTION_ERROR;
} }
UncompressedBuffer = Ptr + sizeof (EFI_COMPRESSION_SECTION); UncompressedBuffer = Ptr + RealHdrLen;
} else if (CompressionType == EFI_STANDARD_COMPRESSION) { } else if (CompressionType == EFI_STANDARD_COMPRESSION) {
GetInfoFunction = EfiGetInfo; GetInfoFunction = EfiGetInfo;
DecompressFunction = EfiDecompress; DecompressFunction = EfiDecompress;
printf (" Compression Type: EFI_STANDARD_COMPRESSION\n"); printf (" Compression Type: EFI_STANDARD_COMPRESSION\n");
CompressedBuffer = Ptr + sizeof (EFI_COMPRESSION_SECTION); CompressedBuffer = Ptr + RealHdrLen;
Status = GetInfoFunction (CompressedBuffer, CompressedLength, &DstSize, &ScratchSize); Status = GetInfoFunction (CompressedBuffer, CompressedLength, &DstSize, &ScratchSize);
if (EFI_ERROR (Status)) { if (EFI_ERROR (Status)) {
@ -1387,16 +1407,25 @@ Returns:
break; break;
case EFI_SECTION_GUID_DEFINED: case EFI_SECTION_GUID_DEFINED:
if (SectionHeaderLen == sizeof(EFI_COMMON_SECTION_HEADER)) {
EfiGuid = &((EFI_GUID_DEFINED_SECTION *) Ptr)->SectionDefinitionGuid;
DataOffset = ((EFI_GUID_DEFINED_SECTION *) Ptr)->DataOffset;
Attributes = ((EFI_GUID_DEFINED_SECTION *) Ptr)->Attributes;
} else {
EfiGuid = &((EFI_GUID_DEFINED_SECTION2 *) Ptr)->SectionDefinitionGuid;
DataOffset = ((EFI_GUID_DEFINED_SECTION2 *) Ptr)->DataOffset;
Attributes = ((EFI_GUID_DEFINED_SECTION2 *) Ptr)->Attributes;
}
printf (" SectionDefinitionGuid: "); printf (" SectionDefinitionGuid: ");
PrintGuid (&((EFI_GUID_DEFINED_SECTION *) Ptr)->SectionDefinitionGuid); PrintGuid (EfiGuid);
printf ("\n"); printf ("\n");
printf (" DataOffset: 0x%04X\n", (unsigned) ((EFI_GUID_DEFINED_SECTION *) Ptr)->DataOffset); printf (" DataOffset: 0x%04X\n", (unsigned) DataOffset);
printf (" Attributes: 0x%04X\n", (unsigned) ((EFI_GUID_DEFINED_SECTION *) Ptr)->Attributes); printf (" Attributes: 0x%04X\n", (unsigned) Attributes);
ExtractionTool = ExtractionTool =
LookupGuidedSectionToolPath ( LookupGuidedSectionToolPath (
mParsedGuidedSectionTools, mParsedGuidedSectionTools,
&((EFI_GUID_DEFINED_SECTION *) Ptr)->SectionDefinitionGuid EfiGuid
); );
if (ExtractionTool != NULL) { if (ExtractionTool != NULL) {
@ -1427,8 +1456,8 @@ Returns:
Status = Status =
PutFileImage ( PutFileImage (
ToolInputFile, ToolInputFile,
(CHAR8*) SectionBuffer + ((EFI_GUID_DEFINED_SECTION *) Ptr)->DataOffset, (CHAR8*) SectionBuffer + DataOffset,
BufferLength - ((EFI_GUID_DEFINED_SECTION *) Ptr)->DataOffset BufferLength - DataOffset
); );
system (SystemCommand); system (SystemCommand);
@ -1461,7 +1490,7 @@ Returns:
// Check for CRC32 sections which we can handle internally if needed. // Check for CRC32 sections which we can handle internally if needed.
// //
} else if (!CompareGuid ( } else if (!CompareGuid (
&((EFI_GUID_DEFINED_SECTION *) Ptr)->SectionDefinitionGuid, EfiGuid,
&gEfiCrc32GuidedSectionExtractionProtocolGuid &gEfiCrc32GuidedSectionExtractionProtocolGuid
) )
) { ) {
@ -1469,8 +1498,8 @@ Returns:
// CRC32 guided section // CRC32 guided section
// //
Status = ParseSection ( Status = ParseSection (
SectionBuffer + ((EFI_GUID_DEFINED_SECTION *) Ptr)->DataOffset, SectionBuffer + DataOffset,
BufferLength - ((EFI_GUID_DEFINED_SECTION *) Ptr)->DataOffset BufferLength - DataOffset
); );
if (EFI_ERROR (Status)) { if (EFI_ERROR (Status)) {
Error (NULL, 0, 0003, "parse of CRC32 GUIDED section failed", NULL); Error (NULL, 0, 0003, "parse of CRC32 GUIDED section failed", NULL);
@ -1540,8 +1569,8 @@ Returns:
return EFI_SUCCESS; return EFI_SUCCESS;
} }
Ptr += sizeof (EFI_COMMON_SECTION_HEADER); Ptr += GetSectionHeaderLength((EFI_COMMON_SECTION_HEADER *)Ptr);
SectionLength -= sizeof (EFI_COMMON_SECTION_HEADER); SectionLength -= GetSectionHeaderLength((EFI_COMMON_SECTION_HEADER *)Ptr);
while (SectionLength > 0) { while (SectionLength > 0) {
printf (" "); printf (" ");
switch (*Ptr) { switch (*Ptr) {
@ -1809,7 +1838,7 @@ Returns:
// //
// Copyright declaration // Copyright declaration
// //
fprintf (stdout, "Copyright (c) 2007 - 2010, Intel Corporation. All rights reserved.\n\n"); fprintf (stdout, "Copyright (c) 2007 - 2014, Intel Corporation. All rights reserved.\n\n");
// //
// Details Option // Details Option

View File

@ -13,4 +13,4 @@
# WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. # WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
# #
gBUILD_VERSION = "Build 2649" gBUILD_VERSION = "Build 2670"

View File

@ -1,7 +1,7 @@
## @file ## @file
# This file is used to define common parsing related functions used in parsing INF/DEC/DSC process # This file is used to define common parsing related functions used in parsing INF/DEC/DSC process
# #
# Copyright (c) 2008 - 2010, Intel Corporation. All rights reserved.<BR> # Copyright (c) 2008 - 2014, Intel Corporation. All rights reserved.<BR>
# This program and the accompanying materials # This program and the accompanying materials
# are licensed and made available under the terms and conditions of the BSD License # are licensed and made available under the terms and conditions of the BSD License
# which accompanies this distribution. The full text of the license may be found at # which accompanies this distribution. The full text of the license may be found at
@ -877,3 +877,38 @@ def GenMetaDatSectionItem(Key, Value, List):
List[Key] = [Value] List[Key] = [Value]
else: else:
List[Key].append(Value) List[Key].append(Value)
## IsValidWord
#
# Check whether the word is valid.
# <Word> ::= (a-zA-Z0-9_)(a-zA-Z0-9_-){0,} Alphanumeric characters with
# optional
# dash "-" and/or underscore "_" characters. No whitespace
# characters are permitted.
#
# @param Word: The word string need to be checked.
#
def IsValidWord(Word):
if not Word:
return False
#
# The first char should be alpha, _ or Digit.
#
if not Word[0].isalnum() and \
not Word[0] == '_' and \
not Word[0].isdigit():
return False
LastChar = ''
for Char in Word[1:]:
if (not Char.isalpha()) and \
(not Char.isdigit()) and \
Char != '-' and \
Char != '_' and \
Char != '.':
return False
if Char == '.' and LastChar == '.':
return False
LastChar = Char
return True

View File

@ -1,7 +1,7 @@
## @file ## @file
# This file is used to define class Configuration # This file is used to define class Configuration
# #
# Copyright (c) 2008, Intel Corporation. All rights reserved.<BR> # Copyright (c) 2008 - 2014, Intel Corporation. All rights reserved.<BR>
# This program and the accompanying materials # This program and the accompanying materials
# are licensed and made available under the terms and conditions of the BSD License # are licensed and made available under the terms and conditions of the BSD License
# which accompanies this distribution. The full text of the license may be found at # which accompanies this distribution. The full text of the license may be found at
@ -247,6 +247,9 @@ class Configuration(object):
# A list for binary file ext name # A list for binary file ext name
self.BinaryExtList = [] self.BinaryExtList = []
# A list for only scanned folders
self.ScanOnlyDirList = []
self.ParseConfig() self.ParseConfig()

View File

@ -1,7 +1,7 @@
## @file ## @file
# This file is used to be the main entrance of ECC tool # This file is used to be the main entrance of ECC tool
# #
# Copyright (c) 2009 - 2010, Intel Corporation. All rights reserved.<BR> # Copyright (c) 2009 - 2014, Intel Corporation. All rights reserved.<BR>
# This program and the accompanying materials # This program and the accompanying materials
# are licensed and made available under the terms and conditions of the BSD License # are licensed and made available under the terms and conditions of the BSD License
# which accompanies this distribution. The full text of the license may be found at # which accompanies this distribution. The full text of the license may be found at
@ -59,6 +59,7 @@ class Ecc(object):
self.ScanSourceCode = True self.ScanSourceCode = True
self.ScanMetaData = True self.ScanMetaData = True
self.MetaFile = '' self.MetaFile = ''
self.OnlyScan = None
# Parse the options and args # Parse the options and args
self.ParseOption() self.ParseOption()
@ -113,8 +114,9 @@ class Ecc(object):
GlobalData.gAllFiles = DirCache(GlobalData.gWorkspace) GlobalData.gAllFiles = DirCache(GlobalData.gWorkspace)
# Build ECC database # Build ECC database
self.BuildDatabase() # self.BuildDatabase()
self.DetectOnlyScanDirs()
# Start to check # Start to check
self.Check() self.Check()
@ -133,11 +135,30 @@ class Ecc(object):
return return
self.ConfigFile = 'config.ini' self.ConfigFile = 'config.ini'
## DetectOnlyScan
#
# Detect whether only scanned folders have been enabled
#
def DetectOnlyScanDirs(self):
if self.OnlyScan == True:
OnlyScanDirs = []
# Use regex here if multiple spaces or TAB exists in ScanOnlyDirList in config.ini file
for folder in re.finditer(r'\S+', EccGlobalData.gConfig.ScanOnlyDirList):
OnlyScanDirs.append(folder.group())
if len(OnlyScanDirs) != 0:
self.BuildDatabase(OnlyScanDirs)
else:
EdkLogger.error("ECC", BuildToolError.OPTION_VALUE_INVALID, ExtraData="Use -f option need to fill specific folders in config.ini file")
else:
self.BuildDatabase()
## BuildDatabase ## BuildDatabase
# #
# Build the database for target # Build the database for target
# #
def BuildDatabase(self): def BuildDatabase(self, SpeciDirs = None):
# Clean report table # Clean report table
EccGlobalData.gDb.TblReport.Drop() EccGlobalData.gDb.TblReport.Drop()
EccGlobalData.gDb.TblReport.Create() EccGlobalData.gDb.TblReport.Create()
@ -146,10 +167,14 @@ class Ecc(object):
if self.IsInit: if self.IsInit:
if self.ScanMetaData: if self.ScanMetaData:
EdkLogger.quiet("Building database for Meta Data File ...") EdkLogger.quiet("Building database for Meta Data File ...")
self.BuildMetaDataFileDatabase() self.BuildMetaDataFileDatabase(SpeciDirs)
if self.ScanSourceCode: if self.ScanSourceCode:
EdkLogger.quiet("Building database for Meta Data File Done!") EdkLogger.quiet("Building database for Meta Data File Done!")
c.CollectSourceCodeDataIntoDB(EccGlobalData.gTarget) if SpeciDirs == None:
c.CollectSourceCodeDataIntoDB(EccGlobalData.gTarget)
else:
for specificDir in SpeciDirs:
c.CollectSourceCodeDataIntoDB(os.path.join(EccGlobalData.gTarget, specificDir))
EccGlobalData.gIdentifierTableList = GetTableList((MODEL_FILE_C, MODEL_FILE_H), 'Identifier', EccGlobalData.gDb) EccGlobalData.gIdentifierTableList = GetTableList((MODEL_FILE_C, MODEL_FILE_H), 'Identifier', EccGlobalData.gDb)
EccGlobalData.gCFileList = GetFileList(MODEL_FILE_C, EccGlobalData.gDb) EccGlobalData.gCFileList = GetFileList(MODEL_FILE_C, EccGlobalData.gDb)
@ -159,59 +184,67 @@ class Ecc(object):
# #
# Build the database for meta data files # Build the database for meta data files
# #
def BuildMetaDataFileDatabase(self): def BuildMetaDataFileDatabase(self, SpecificDirs = None):
ScanFolders = []
if SpecificDirs == None:
ScanFolders.append(EccGlobalData.gTarget)
else:
for specificDir in SpecificDirs:
ScanFolders.append(os.path.join(EccGlobalData.gTarget, specificDir))
EdkLogger.quiet("Building database for meta data files ...") EdkLogger.quiet("Building database for meta data files ...")
Op = open(EccGlobalData.gConfig.MetaDataFileCheckPathOfGenerateFileList, 'w+') Op = open(EccGlobalData.gConfig.MetaDataFileCheckPathOfGenerateFileList, 'w+')
#SkipDirs = Read from config file #SkipDirs = Read from config file
SkipDirs = EccGlobalData.gConfig.SkipDirList SkipDirs = EccGlobalData.gConfig.SkipDirList
SkipDirString = string.join(SkipDirs, '|') SkipDirString = string.join(SkipDirs, '|')
p = re.compile(r'.*[\\/](?:%s)[\\/]?.*' % SkipDirString) # p = re.compile(r'.*[\\/](?:%s)[\\/]?.*' % SkipDirString)
for Root, Dirs, Files in os.walk(EccGlobalData.gTarget): p = re.compile(r'.*[\\/](?:%s^\S)[\\/]?.*' % SkipDirString)
if p.match(Root.upper()): for scanFolder in ScanFolders:
continue for Root, Dirs, Files in os.walk(scanFolder):
for Dir in Dirs: if p.match(Root.upper()):
Dirname = os.path.join(Root, Dir)
if os.path.islink(Dirname):
Dirname = os.path.realpath(Dirname)
if os.path.isdir(Dirname):
# symlinks to directories are treated as directories
Dirs.remove(Dir)
Dirs.append(Dirname)
for File in Files:
if len(File) > 4 and File[-4:].upper() == ".DEC":
Filename = os.path.normpath(os.path.join(Root, File))
EdkLogger.quiet("Parsing %s" % Filename)
Op.write("%s\r" % Filename)
#Dec(Filename, True, True, EccGlobalData.gWorkspace, EccGlobalData.gDb)
self.MetaFile = DecParser(Filename, MODEL_FILE_DEC, EccGlobalData.gDb.TblDec)
self.MetaFile.Start()
continue
if len(File) > 4 and File[-4:].upper() == ".DSC":
Filename = os.path.normpath(os.path.join(Root, File))
EdkLogger.quiet("Parsing %s" % Filename)
Op.write("%s\r" % Filename)
#Dsc(Filename, True, True, EccGlobalData.gWorkspace, EccGlobalData.gDb)
self.MetaFile = DscParser(PathClass(Filename, Root), MODEL_FILE_DSC, MetaFileStorage(EccGlobalData.gDb.TblDsc.Cur, Filename, MODEL_FILE_DSC, True))
# alwasy do post-process, in case of macros change
self.MetaFile.DoPostProcess()
self.MetaFile.Start()
self.MetaFile._PostProcess()
continue
if len(File) > 4 and File[-4:].upper() == ".INF":
Filename = os.path.normpath(os.path.join(Root, File))
EdkLogger.quiet("Parsing %s" % Filename)
Op.write("%s\r" % Filename)
#Inf(Filename, True, True, EccGlobalData.gWorkspace, EccGlobalData.gDb)
self.MetaFile = InfParser(Filename, MODEL_FILE_INF, EccGlobalData.gDb.TblInf)
self.MetaFile.Start()
continue
if len(File) > 4 and File[-4:].upper() == ".FDF":
Filename = os.path.normpath(os.path.join(Root, File))
EdkLogger.quiet("Parsing %s" % Filename)
Op.write("%s\r" % Filename)
Fdf(Filename, True, EccGlobalData.gWorkspace, EccGlobalData.gDb)
continue continue
for Dir in Dirs:
Dirname = os.path.join(Root, Dir)
if os.path.islink(Dirname):
Dirname = os.path.realpath(Dirname)
if os.path.isdir(Dirname):
# symlinks to directories are treated as directories
Dirs.remove(Dir)
Dirs.append(Dirname)
for File in Files:
if len(File) > 4 and File[-4:].upper() == ".DEC":
Filename = os.path.normpath(os.path.join(Root, File))
EdkLogger.quiet("Parsing %s" % Filename)
Op.write("%s\r" % Filename)
#Dec(Filename, True, True, EccGlobalData.gWorkspace, EccGlobalData.gDb)
self.MetaFile = DecParser(Filename, MODEL_FILE_DEC, EccGlobalData.gDb.TblDec)
self.MetaFile.Start()
continue
if len(File) > 4 and File[-4:].upper() == ".DSC":
Filename = os.path.normpath(os.path.join(Root, File))
EdkLogger.quiet("Parsing %s" % Filename)
Op.write("%s\r" % Filename)
#Dsc(Filename, True, True, EccGlobalData.gWorkspace, EccGlobalData.gDb)
self.MetaFile = DscParser(PathClass(Filename, Root), MODEL_FILE_DSC, MetaFileStorage(EccGlobalData.gDb.TblDsc.Cur, Filename, MODEL_FILE_DSC, True))
# alwasy do post-process, in case of macros change
self.MetaFile.DoPostProcess()
self.MetaFile.Start()
self.MetaFile._PostProcess()
continue
if len(File) > 4 and File[-4:].upper() == ".INF":
Filename = os.path.normpath(os.path.join(Root, File))
EdkLogger.quiet("Parsing %s" % Filename)
Op.write("%s\r" % Filename)
#Inf(Filename, True, True, EccGlobalData.gWorkspace, EccGlobalData.gDb)
self.MetaFile = InfParser(Filename, MODEL_FILE_INF, EccGlobalData.gDb.TblInf)
self.MetaFile.Start()
continue
if len(File) > 4 and File[-4:].upper() == ".FDF":
Filename = os.path.normpath(os.path.join(Root, File))
EdkLogger.quiet("Parsing %s" % Filename)
Op.write("%s\r" % Filename)
Fdf(Filename, True, EccGlobalData.gWorkspace, EccGlobalData.gDb)
continue
Op.close() Op.close()
# Commit to database # Commit to database
@ -321,6 +354,8 @@ class Ecc(object):
self.ScanSourceCode = False self.ScanSourceCode = False
if Options.sourcecode != None: if Options.sourcecode != None:
self.ScanMetaData = False self.ScanMetaData = False
if Options.folders != None:
self.OnlyScan = True
## SetLogLevel ## SetLogLevel
# #
@ -371,6 +406,7 @@ class Ecc(object):
"and warning messages, etc.") "and warning messages, etc.")
Parser.add_option("-d", "--debug", action="store", type="int", help="Enable debug messages at specified level.") Parser.add_option("-d", "--debug", action="store", type="int", help="Enable debug messages at specified level.")
Parser.add_option("-w", "--workspace", action="store", type="string", dest='Workspace', help="Specify workspace.") Parser.add_option("-w", "--workspace", action="store", type="string", dest='Workspace', help="Specify workspace.")
Parser.add_option("-f", "--folders", action="store_true", type=None, help="Only scanning specified folders which are recorded in config.ini file.")
(Opt, Args)=Parser.parse_args() (Opt, Args)=Parser.parse_args()

View File

@ -1,7 +1,7 @@
## @file ## @file
# This file is used to parse meta files # This file is used to parse meta files
# #
# Copyright (c) 2008 - 2010, Intel Corporation. All rights reserved.<BR> # Copyright (c) 2008 - 2014, Intel Corporation. All rights reserved.<BR>
# This program and the accompanying materials # This program and the accompanying materials
# are licensed and made available under the terms and conditions of the BSD License # are licensed and made available under the terms and conditions of the BSD License
# which accompanies this distribution. The full text of the license may be found at # which accompanies this distribution. The full text of the license may be found at
@ -1054,7 +1054,7 @@ class DscParser(MetaFileParser):
## Override parent's method since we'll do all macro replacements in parser ## Override parent's method since we'll do all macro replacements in parser
def _GetMacros(self): def _GetMacros(self):
Macros = {} Macros = dict( [('ARCH','IA32'), ('FAMILY','MSFT'),('TOOL_CHAIN_TAG','VS2008x86'),('TARGET','DEBUG')])
Macros.update(self._FileLocalMacros) Macros.update(self._FileLocalMacros)
Macros.update(self._GetApplicableSectionMacro()) Macros.update(self._GetApplicableSectionMacro())
Macros.update(GlobalData.gEdkGlobal) Macros.update(GlobalData.gEdkGlobal)

View File

@ -2,7 +2,7 @@
# This file is used to set configuration of ECC tool # This file is used to set configuration of ECC tool
# For the items listed below, 1 means valid, 0 means invalid # For the items listed below, 1 means valid, 0 means invalid
# #
# Copyright (c) 2007 - 2010, Intel Corporation. All rights reserved.<BR> # Copyright (c) 2007 - 2014, Intel Corporation. All rights reserved.<BR>
# This program and the accompanying materials # This program and the accompanying materials
# are licensed and made available under the terms and conditions of the BSD License # are licensed and made available under the terms and conditions of the BSD License
# which accompanies this distribution. The full text of the license may be found at # which accompanies this distribution. The full text of the license may be found at
@ -255,3 +255,5 @@ MetaDataFileCheckModuleFileGuidDuplication = 1
# A list for binary file ext name # A list for binary file ext name
BinaryExtList = EXE, EFI, FV, ROM, DLL, COM, BMP, GIF, PYD, CMP, BIN, JPG, UNI, RAW, COM2, LIB, DEPEX, SYS, DB BinaryExtList = EXE, EFI, FV, ROM, DLL, COM, BMP, GIF, PYD, CMP, BIN, JPG, UNI, RAW, COM2, LIB, DEPEX, SYS, DB
# A list for only scanning dirs, the dirs should be the top folder(s) under workspace
ScanOnlyDirList = ScanFolder1 ScanFolder2

View File

@ -36,6 +36,7 @@ from Common import EdkLogger
from Common.String import * from Common.String import *
from Common.Misc import DirCache,PathClass from Common.Misc import DirCache,PathClass
from Common.Misc import SaveFileOnChange from Common.Misc import SaveFileOnChange
from Common.Misc import GuidStructureStringToGuidString
from Common.BuildVersion import gBUILD_VERSION from Common.BuildVersion import gBUILD_VERSION
## Version and Copyright ## Version and Copyright
@ -511,11 +512,23 @@ class GenFds :
def GenerateGuidXRefFile(BuildDb, ArchList): def GenerateGuidXRefFile(BuildDb, ArchList):
GuidXRefFileName = os.path.join(GenFdsGlobalVariable.FvDir, "Guid.xref") GuidXRefFileName = os.path.join(GenFdsGlobalVariable.FvDir, "Guid.xref")
GuidXRefFile = StringIO.StringIO('') GuidXRefFile = StringIO.StringIO('')
GuidDict = {}
for Arch in ArchList: for Arch in ArchList:
PlatformDataBase = BuildDb.BuildObject[GenFdsGlobalVariable.ActivePlatform, Arch, GenFdsGlobalVariable.TargetName, GenFdsGlobalVariable.ToolChainTag] PlatformDataBase = BuildDb.BuildObject[GenFdsGlobalVariable.ActivePlatform, Arch, GenFdsGlobalVariable.TargetName, GenFdsGlobalVariable.ToolChainTag]
for ModuleFile in PlatformDataBase.Modules: for ModuleFile in PlatformDataBase.Modules:
Module = BuildDb.BuildObject[ModuleFile, Arch, GenFdsGlobalVariable.TargetName, GenFdsGlobalVariable.ToolChainTag] Module = BuildDb.BuildObject[ModuleFile, Arch, GenFdsGlobalVariable.TargetName, GenFdsGlobalVariable.ToolChainTag]
GuidXRefFile.write("%s %s\n" % (Module.Guid, Module.BaseName)) GuidXRefFile.write("%s %s\n" % (Module.Guid, Module.BaseName))
for key, item in Module.Protocols.items():
GuidDict[key] = item
for key, item in Module.Guids.items():
GuidDict[key] = item
for key, item in Module.Ppis.items():
GuidDict[key] = item
# Append GUIDs, Protocols, and PPIs to the Xref file
GuidXRefFile.write("\n")
for key, item in GuidDict.items():
GuidXRefFile.write("%s %s\n" % (GuidStructureStringToGuidString(item).upper(), key))
if GuidXRefFile.getvalue(): if GuidXRefFile.getvalue():
SaveFileOnChange(GuidXRefFileName, GuidXRefFile.getvalue(), False) SaveFileOnChange(GuidXRefFileName, GuidXRefFile.getvalue(), False)
GenFdsGlobalVariable.InfLogger("\nGUID cross reference file can be found at %s" % GuidXRefFileName) GenFdsGlobalVariable.InfLogger("\nGUID cross reference file can be found at %s" % GuidXRefFileName)

View File

@ -53,7 +53,9 @@ def parsePcdInfoFromMapFile(mapfilepath, efifilepath):
return None return None
if len(lines) == 0: return None if len(lines) == 0: return None
if lines[0].strip().find("Archive member included because of file (symbol)") != -1: firstline = lines[0].strip()
if (firstline.startswith("Archive member included ") and
firstline.endswith(" file (symbol)")):
return _parseForGCC(lines, efifilepath) return _parseForGCC(lines, efifilepath)
return _parseGeneral(lines, efifilepath) return _parseGeneral(lines, efifilepath)

View File

@ -17,4 +17,4 @@
Build version information Build version information
''' '''
gBUILD_VERSION = "Build 2649" gBUILD_VERSION = "Build 2670"

View File

@ -2,7 +2,7 @@
# This file is used to define common string related functions used in parsing # This file is used to define common string related functions used in parsing
# process # process
# #
# Copyright (c) 2011 - 2012, Intel Corporation. All rights reserved.<BR> # Copyright (c) 2011 - 2014, Intel Corporation. All rights reserved.<BR>
# #
# This program and the accompanying materials are licensed and made available # This program and the accompanying materials are licensed and made available
# under the terms and conditions of the BSD License which accompanies this # under the terms and conditions of the BSD License which accompanies this
@ -937,3 +937,29 @@ def SplitPcdEntry(String):
return ['', '', ''], False return ['', '', ''], False
return ['', '', ''], False return ['', '', ''], False
## Check if two arches matched?
#
# @param Arch1
# @param Arch2
#
def IsMatchArch(Arch1, Arch2):
if 'COMMON' in Arch1 or 'COMMON' in Arch2:
return True
if isinstance(Arch1, basestring) and isinstance(Arch2, basestring):
if Arch1 == Arch2:
return True
if isinstance(Arch1, basestring) and isinstance(Arch2, list):
return Arch1 in Arch2
if isinstance(Arch2, basestring) and isinstance(Arch1, list):
return Arch2 in Arch1
if isinstance(Arch1, list) and isinstance(Arch2, list):
for Item1 in Arch1:
for Item2 in Arch2:
if Item1 == Item2:
return True
return False

View File

@ -1,7 +1,7 @@
## @file ## @file
# This file is used to parse a Module file of .PKG file # This file is used to parse a Module file of .PKG file
# #
# Copyright (c) 2011, Intel Corporation. All rights reserved.<BR> # Copyright (c) 2011 - 2014, Intel Corporation. All rights reserved.<BR>
# #
# This program and the accompanying materials are licensed and made available # This program and the accompanying materials are licensed and made available
# under the terms and conditions of the BSD License which accompanies this # under the terms and conditions of the BSD License which accompanies this
@ -20,6 +20,7 @@ from xml.dom import minidom
from Library.String import ConvertNEToNOTEQ from Library.String import ConvertNEToNOTEQ
from Library.String import ConvertNOTEQToNE from Library.String import ConvertNOTEQToNE
from Library.String import GetStringOfList from Library.String import GetStringOfList
from Library.String import IsMatchArch
from Library.Xml.XmlRoutines import XmlElement from Library.Xml.XmlRoutines import XmlElement
from Library.Xml.XmlRoutines import XmlAttribute from Library.Xml.XmlRoutines import XmlAttribute
from Library.Xml.XmlRoutines import XmlNode from Library.Xml.XmlRoutines import XmlNode
@ -128,9 +129,11 @@ class BinaryFileXml(object):
pass pass
NodeList = [] NodeList = []
FilenameList = BinaryFile.GetFileNameList() FilenameList = BinaryFile.GetFileNameList()
SupportArch = None
for Filename in FilenameList: for Filename in FilenameList:
Tmp = FilenameXml() Tmp = FilenameXml()
NodeList.append(Tmp.ToXml(Filename, 'Filename')) NodeList.append(Tmp.ToXml(Filename, 'Filename'))
SupportArch = Filename.SupArchList
if GlobalData.gIS_BINARY_INF: if GlobalData.gIS_BINARY_INF:
AsBuildList = BinaryFile.GetAsBuiltList() AsBuildList = BinaryFile.GetAsBuiltList()
@ -142,12 +145,14 @@ class BinaryFileXml(object):
AsBuiltNodeList = [] AsBuiltNodeList = []
for Pcd in PatchPcdValueList: for Pcd in PatchPcdValueList:
Tmp = PcdEntryXml() if IsMatchArch(Pcd.SupArchList, SupportArch):
AsBuiltNodeList.append(Tmp.ToXml4(Pcd, 'PatchPcdValue')) Tmp = PcdEntryXml()
AsBuiltNodeList.append(Tmp.ToXml4(Pcd, 'PatchPcdValue'))
for Pcd in PcdExList: for Pcd in PcdExList:
Tmp = PcdEntryXml() if IsMatchArch(Pcd.SupArchList, SupportArch):
AsBuiltNodeList.append(Tmp.ToXml4(Pcd, 'PcdExValue')) Tmp = PcdEntryXml()
AsBuiltNodeList.append(Tmp.ToXml4(Pcd, 'PcdExValue'))
GuiVerElemList = [] GuiVerElemList = []
for LibGuidVer in LibGuidVerList: for LibGuidVer in LibGuidVerList:

View File

@ -37,6 +37,7 @@ from BuildClassObject import *
from WorkspaceCommon import GetDeclaredPcd from WorkspaceCommon import GetDeclaredPcd
from Common.Misc import AnalyzeDscPcd from Common.Misc import AnalyzeDscPcd
import re import re
from Common.Parsing import IsValidWord
## Platform build information from DSC file ## Platform build information from DSC file
# #
@ -893,13 +894,23 @@ class DscBuildData(PlatformBuildClassObject):
VariableName, VariableGuid, VariableOffset, DefaultValue = self._ValidatePcd(PcdCName, TokenSpaceGuid, Setting, Type, Dummy4) VariableName, VariableGuid, VariableOffset, DefaultValue = self._ValidatePcd(PcdCName, TokenSpaceGuid, Setting, Type, Dummy4)
ExceedMax = False ExceedMax = False
FormatCorrect = True
if VariableOffset.isdigit(): if VariableOffset.isdigit():
if int(VariableOffset,10) > 0xFFFF: if int(VariableOffset,10) > 0xFFFF:
ExceedMax = True ExceedMax = True
elif re.match(r'[\t\s]*0[xX][a-fA-F0-9]+$',VariableOffset): elif re.match(r'[\t\s]*0[xX][a-fA-F0-9]+$',VariableOffset):
if int(VariableOffset,16) > 0xFFFF: if int(VariableOffset,16) > 0xFFFF:
ExceedMax = True ExceedMax = True
# For Offset written in "A.B"
elif VariableOffset.find('.') > -1:
VariableOffsetList = VariableOffset.split(".")
if not (len(VariableOffsetList) == 2
and IsValidWord(VariableOffsetList[0])
and IsValidWord(VariableOffsetList[1])):
FormatCorrect = False
else: else:
FormatCorrect = False
if not FormatCorrect:
EdkLogger.error('Build', FORMAT_INVALID, "Invalid syntax or format of the variable offset value is incorrect for %s." % ".".join((TokenSpaceGuid,PcdCName))) EdkLogger.error('Build', FORMAT_INVALID, "Invalid syntax or format of the variable offset value is incorrect for %s." % ".".join((TokenSpaceGuid,PcdCName)))
if ExceedMax: if ExceedMax:

46
BaseTools/get_vsvars.bat Normal file
View File

@ -0,0 +1,46 @@
@REM @file
@REM Windows batch file to find the Visual Studio set up script
@REM
@REM Copyright (c) 2013-2014, ARM Limited. All rights reserved.
@REM This program and the accompanying materials
@REM are licensed and made available under the terms and conditions of the BSD License
@REM which accompanies this distribution. The full text of the license may be found at
@REM http://opensource.org/licenses/bsd-license.php
@REM
@REM THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
@REM WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
@REM
@echo off
goto :main
:read_vsvars
@rem Do nothing if already found, otherwise call vsvars32.bat if there
if defined VCINSTALLDIR goto :EOF
set GET_VSVARS_BAT_CHECK_DIR=%*
set GET_VSVARS_BAT_CHECK_DIR=%GET_VSVARS_BAT_CHECK_DIR:"=%
if exist "%GET_VSVARS_BAT_CHECK_DIR%\vsvars32.bat" call "%GET_VSVARS_BAT_CHECK_DIR%\vsvars32.bat"
:vsvars_done
goto :EOF
REM NOTE: This file will find the most recent Visual Studio installation
REM apparent from the environment.
REM To use an older version, modify your environment set up.
REM (Or invoke the relevant vsvars32 file beforehand).
:main
if defined VCINSTALLDIR goto :done
if defined VS140COMNTOOLS call :read_vsvars "%VS140COMNTOOLS%"
if defined VS130COMNTOOLS call :read_vsvars "%VS130COMNTOOLS%"
if defined VS120COMNTOOLS call :read_vsvars "%VS120COMNTOOLS%"
if defined VS110COMNTOOLS call :read_vsvars "%VS110COMNTOOLS%"
if defined VS100COMNTOOLS call :read_vsvars "%VS100COMNTOOLS%"
if defined VS90COMNTOOLS call :read_vsvars "%VS90COMNTOOLS%"
if defined VS80COMNTOOLS call :read_vsvars "%VS80COMNTOOLS%"
if defined VS71COMNTOOLS call :read_vsvars "%VS71COMNTOOLS%"
:done
set GET_VSVARS_BAT_CHECK_DIR=

View File

@ -22,32 +22,32 @@ pushd .
@REM # You should not have to modify anything below this line @REM # You should not have to modify anything below this line
@REM # @REM #
@if /I "%1"=="-h" goto Usage if /I "%1"=="-h" goto Usage
@if /I "%1"=="-help" goto Usage if /I "%1"=="-help" goto Usage
@if /I "%1"=="--help" goto Usage if /I "%1"=="--help" goto Usage
@if /I "%1"=="/h" goto Usage if /I "%1"=="/h" goto Usage
@if /I "%1"=="/help" goto Usage if /I "%1"=="/help" goto Usage
@if /I "%1"=="/?" goto Usage if /I "%1"=="/?" goto Usage
:loop :loop
@if "%1"=="" goto setup_workspace if "%1"=="" goto setup_workspace
@if /I "%1"=="--nt32" ( if /I "%1"=="--nt32" (
@REM Ignore --nt32 flag @REM Ignore --nt32 flag
shift shift
goto loop goto loop
) )
@if /I "%1"=="Reconfig" ( if /I "%1"=="Reconfig" (
shift shift
set RECONFIG=TRUE set RECONFIG=TRUE
goto loop goto loop
) )
@if /I "%1"=="Rebuild" ( if /I "%1"=="Rebuild" (
shift shift
set REBUILD=TRUE set REBUILD=TRUE
goto loop goto loop
) )
@if /I "%1"=="ForceRebuild" ( if /I "%1"=="ForceRebuild" (
shift shift
set FORCE_REBUILD=TRUE set FORCE_REBUILD=TRUE
goto loop goto loop
@ -246,7 +246,8 @@ goto end
) )
set PATH=%BASE_TOOLS_PATH%\Bin\Win32;%PATH% set PATH=%BASE_TOOLS_PATH%\Bin\Win32;%PATH%
set PYTHONPATH=%BASE_TOOLS_PATH%\Source\Python set BASETOOLS_PYTHON_SOURCE=%BASE_TOOLS_PATH%\Source\Python
set PYTHONPATH=%BASETOOLS_PYTHON_SOURCE%;%PYTHONPATH%
if not defined PYTHON_HOME ( if not defined PYTHON_HOME (
if defined PYTHONHOME ( if defined PYTHONHOME (
@ -279,8 +280,9 @@ goto end
echo !!! WARNING !!! Will not be able to compile Python programs to .exe echo !!! WARNING !!! Will not be able to compile Python programs to .exe
echo Will setup environment to run Python scripts directly. echo Will setup environment to run Python scripts directly.
echo. echo.
set PYTHONPATH=%BASE_TOOLS_PATH%\Source\Python set PATH=%BASETOOLS_PYTHON_SOURCE%\Trim;%PATH%
set PATH=%PYTHONPATH%\build;%PYTHONPATH%\GenFds;%PYTHONPATH%\Trim;%PATH% set PATH=%BASETOOLS_PYTHON_SOURCE%\GenFds;%PATH%
set PATH=%BASETOOLS_PYTHON_SOURCE%\build;%PATH%
set PATHEXT=%PATHEXT%;.py set PATHEXT=%PATHEXT%;.py
) )
) )
@ -290,31 +292,16 @@ goto end
echo PYTHON_FREEZER_PATH = %PYTHON_FREEZER_PATH% echo PYTHON_FREEZER_PATH = %PYTHON_FREEZER_PATH%
echo. echo.
if defined VCINSTALLDIR goto VisualStudioAvailable call "%EDK_TOOLS_PATH%\get_vsvars.bat"
if defined VS100COMNTOOLS ( if not defined VCINSTALLDIR (
call "%VS100COMNTOOLS%\vsvars32.bat" @echo.
) else ( @echo !!! ERROR !!!! Cannot find Visual Studio, required to build C tools !!!
if defined VS90COMNTOOLS ( @echo.
call "%VS90COMNTOOLS%\vsvars32.bat" goto end
) else (
if defined VS80COMNTOOLS (
call "%VS80COMNTOOLS%\vsvars32.bat"
) else (
if defined VS71COMNTOOLS (
call "%VS71COMNTOOLS%\vsvars32.bat"
) else (
echo.
echo !!! ERROR !!!! Cannot find Visual Studio, required to build C tools !!!
echo.
goto end
)
)
)
) )
:VisualStudioAvailable :VisualStudioAvailable
if defined FORCE_REBUILD goto CleanAndBuild if not defined FORCE_REBUILD goto IncrementalBuild
goto IncrementalBuild
:CleanAndBuild :CleanAndBuild
pushd . pushd .
@ -352,17 +339,17 @@ goto end
goto end goto end
:Usage :Usage
echo. @echo.
echo Usage: "%0 [-h | -help | --help | /h | /help | /?] [ Rebuild | ForceRebuild ] [Reconfig] [base_tools_path [edk_tools_path]]" echo Usage: "%0 [-h | -help | --help | /h | /help | /?] [ Rebuild | ForceRebuild ] [Reconfig] [base_tools_path [edk_tools_path]]"
echo. @echo.
echo base_tools_path BaseTools project path, BASE_TOOLS_PATH will be set to this path. @echo base_tools_path BaseTools project path, BASE_TOOLS_PATH will be set to this path.
echo edk_tools_path EDK_TOOLS_PATH will be set to this path. @echo edk_tools_path EDK_TOOLS_PATH will be set to this path.
echo Rebuild If sources are available perform an Incremental build, only @echo Rebuild If sources are available perform an Incremental build, only
echo build those updated tools. @echo build those updated tools.
echo ForceRebuild If sources are available, rebuild all tools regardless of @echo ForceRebuild If sources are available, rebuild all tools regardless of
echo whether they have been updated or not. @echo whether they have been updated or not.
echo Reconfig Reinstall target.txt, tools_def.txt and build_rule.txt. @echo Reconfig Reinstall target.txt, tools_def.txt and build_rule.txt.
echo. @echo.
:end :end
set REBUILD= set REBUILD=
@ -370,5 +357,3 @@ set FORCE_REBUILD=
set RECONFIG= set RECONFIG=
popd popd
@echo on