From 2f21435d2e226c25ef7dc7b0b5e254a1e516cd9f Mon Sep 17 00:00:00 2001 From: Olivier Martin Date: Tue, 20 Sep 2011 16:56:44 +0100 Subject: [PATCH] PendingPatch --- BaseTools/Conf/tools_def.template | 136 ++++++++++++++++++++++++++- BaseTools/Source/C/GenFv/GenFv.c | 2 +- BaseTools/Source/C/GenFv/GenFvInternalLib.c | 39 ++++---- 3 files changed, 153 insertions(+), 24 deletions(-) mode change 100644 => 100755 BaseTools/Source/C/GenFv/GenFv.c mode change 100644 => 100755 BaseTools/Source/C/GenFv/GenFvInternalLib.c diff --git a/BaseTools/Conf/tools_def.template b/BaseTools/Conf/tools_def.template index fe7900e..4c79fcb 100644 --- a/BaseTools/Conf/tools_def.template +++ b/BaseTools/Conf/tools_def.template @@ -3533,6 +3533,45 @@ NOOPT_ICC11x86_IPF_DLINK_FLAGS = /NOLOGO /NODEFAULTLIB /LTCG /DLL *_ICC11x86_EBC_SLINK_FLAGS = /lib /NOLOGO /MACHINE:EBC *_ICC11x86_EBC_DLINK_FLAGS = "C:\Program Files (x86)\Intel\EBC\Lib\EbcLib.lib" /NOLOGO /NODEFAULTLIB /MACHINE:EBC /OPT:REF /ENTRY:$(IMAGE_ENTRY_POINT) /SUBSYSTEM:EFI_BOOT_SERVICE_DRIVER /MAP +#################################################################################### +# +# ARM RealView 4.0 Tools & Linux +# +#################################################################################### +# ARMCYGWIN - Tools from ARM in a Cygwin environment + +*_RVCTLINUX_*_*_FAMILY = RVCT +*_RVCTLINUX_*_*_BUILDRULEFAMILY = RVCTLINUX + +# +# Use default values, or override in DSC file +# +*_RVCTLINUX_ARM_ARCHCC_FLAGS = --thumb --cpu ARM1176JZF-S +*_RVCTLINUX_ARM_ARCHASM_FLAGS = --cpu ARM1176JZF-S +*_RVCTLINUX_ARM_ARCHDLINK_FLAGS = +*_RVCTLINUX_ARM_PLATFORM_FLAGS = + +DEBUG_RVCTLINUX_ARM_DLINK_FLAGS = $(DLINKPATH_FLAG) $(ARCHDLINK_FLAGS) --entry $(IMAGE_ENTRY_POINT) --ro-base 0 --no_scanlib --reloc --no_exceptions --datacompressor off --strict --symbols --map --list $(DEST_DIR_DEBUG)/$(BASE_NAME).map +RELEASE_RVCTLINUX_ARM_DLINK_FLAGS = $(DLINKPATH_FLAG) $(ARCHDLINK_FLAGS) --entry $(IMAGE_ENTRY_POINT) --ro-base 0 --no_scanlib --reloc --no_exceptions --datacompressor off --strict --symbols --map --list $(DEST_DIR_DEBUG)/$(BASE_NAME).map + +*_RVCTLINUX_ARM_ASM_FLAGS = $(ASMPATH_FLAG) $(ARCHASM_FLAGS) --apcs /interwork +*_RVCTLINUX_ARM_PP_FLAGS = $(CCPATH_FLAG) $(ARCHCC_FLAGS) $(PLATFORM_FLAGS) -E +*_RVCTLINUX_ARM_VFRPP_FLAGS = $(CCPATH_FLAG) $(ARCHCC_FLAGS) $(PLATFORM_FLAGS) -E -DVFRCOMPILE --preinclude $(DEST_DIR_DEBUG)/$(MODULE_NAME)StrDefs.h +*_RVCTLINUX_ARM_MAKE_PATH = make +*_RVCTLINUX_ARM_SLINK_FLAGS = $(SLINKPATH_FLAG) --partial -o + DEBUG_RVCTLINUX_ARM_CC_FLAGS = $(CCPATH_FLAG) $(ARCHCC_FLAGS) $(PLATFORM_FLAGS) --c90 -c -g -O2 --no_autoinline --asm --gnu --apcs /interwork --signed_chars --no_unaligned_access --split_sections --preinclude AutoGen.h --diag_warning 167 +RELEASE_RVCTLINUX_ARM_CC_FLAGS = $(CCPATH_FLAG) $(ARCHCC_FLAGS) $(PLATFORM_FLAGS) --c90 -c --no_autoinline --asm --gnu --apcs /interwork --signed_chars --no_unaligned_access --split_sections --preinclude AutoGen.h --diag_warning 167 + +################## +# ARM definitions +################## +*_RVCTLINUX_ARM_CC_PATH = ENV(RVCT_TOOLS_PATH)armcc +*_RVCTLINUX_ARM_SLINK_PATH = ENV(RVCT_TOOLS_PATH)armlink +*_RVCTLINUX_ARM_DLINK_PATH = ENV(RVCT_TOOLS_PATH)armlink +*_RVCTLINUX_ARM_ASM_PATH = ENV(RVCT_TOOLS_PATH)armasm +*_RVCTLINUX_ARM_PP_PATH = ENV(RVCT_TOOLS_PATH)armcc +*_RVCTLINUX_ARM_VFRPP_PATH = ENV(RVCT_TOOLS_PATH)armcc +*_RVCTLINUX_ARM_FROMELF_PATH = ENV(RVCT_TOOLS_PATH)fromelf #################################################################################### # @@ -3986,7 +4025,7 @@ RELEASE_XCLANG_X64_CC_FLAGS = -ccc-host-triple x86_64-pc-win32-macho -c -Os #################################################################################### # -# ARM Tools +# ARM RealView 3.1 Tools # #################################################################################### # RVCT31 - Tools from ARM @@ -4026,7 +4065,7 @@ RELEASE_RVCT31_ARM_CC_FLAGS = $(ARCHCC_FLAGS) $(PLATFORM_FLAGS) --c90 -Ospac #################################################################################### # -# ARM Tools & Cygwin +# ARM RealView 3.1 Tools & Cygwin # #################################################################################### # ARMCYGWIN - Tools from ARM in a Cygwin environment @@ -4075,6 +4114,95 @@ RELEASE_RVCT31CYGWIN_ARM_CC_FLAGS = "$(CCPATH_FLAG)" $(ARCHCC_FLAGS) $(PLATFORM #################################################################################### # +# ARM RealView 4.0 Tools +# +#################################################################################### +# RVCT - Tools from ARM + +*_RVCT_*_*_FAMILY = RVCT + +# +# Use default values, or override in DSC file +# +*_RVCT_ARM_ARCHCC_FLAGS = --thumb --cpu ARM1176JZF-S +*_RVCT_ARM_ARCHASM_FLAGS = --cpu ARM1176JZF-S +*_RVCT_ARM_ARCHDLINK_FLAGS = +*_RVCT_ARM_PLATFORM_FLAGS = + + DEBUG_RVCT_ARM_DLINK_FLAGS = $(ARCHDLINK_FLAGS) --entry $(IMAGE_ENTRY_POINT) --ro-base 0 --no_scanlib --reloc --no_exceptions --datacompressor off --strict --symbols --map --list $(DEST_DIR_DEBUG)/$(BASE_NAME).map +RELEASE_RVCT_ARM_DLINK_FLAGS = $(ARCHDLINK_FLAGS) --entry $(IMAGE_ENTRY_POINT) --ro-base 0 --no_scanlib --reloc --no_exceptions --datacompressor off --strict --symbols --map --list $(DEST_DIR_DEBUG)/$(BASE_NAME).map + + +*_RVCT_ARM_ASM_FLAGS = $(ARCHASM_FLAGS) --apcs /interwork +*_RVCT_ARM_PP_FLAGS = $(ARCHCC_FLAGS) $(PLATFORM_FLAGS) -E +*_RVCT_ARM_VFRPP_FLAGS = $(ARCHCC_FLAGS) $(PLATFORM_FLAGS) -E -DVFRCOMPILE --preinclude $(DEST_DIR_DEBUG)/$(MODULE_NAME)StrDefs.h +*_RVCT_ARM_MAKE_PATH = nmake /NOLOGO +*_RVCT_ARM_SLINK_FLAGS = --partial -o + DEBUG_RVCT_ARM_CC_FLAGS = $(ARCHCC_FLAGS) $(PLATFORM_FLAGS) --c90 -c -g -O2 --no_autoinline --asm --gnu --apcs /interwork --signed_chars --no_unaligned_access --split_sections --enum_is_int --preinclude AutoGen.h --diag_warning 167 +RELEASE_RVCT_ARM_CC_FLAGS = $(ARCHCC_FLAGS) $(PLATFORM_FLAGS) --c90 -c --no_autoinline --asm --gnu --apcs /interwork --signed_chars --no_unaligned_access --split_sections --enum_is_int --preinclude AutoGen.h --diag_warning 167 + +################## +# ARM definitions +################## +*_RVCT_ARM_CC_PATH = ENV(RVCT_TOOLS_PATH)armcc +*_RVCT_ARM_SLINK_PATH = ENV(RVCT_TOOLS_PATH)armlink +*_RVCT_ARM_DLINK_PATH = ENV(RVCT_TOOLS_PATH)armlink +*_RVCT_ARM_ASM_PATH = ENV(RVCT_TOOLS_PATH)armasm +*_RVCT_ARM_PP_PATH = ENV(RVCT_TOOLS_PATH)armcc +*_RVCT_ARM_VFRPP_PATH = ENV(RVCT_TOOLS_PATH)armcc +*_RVCT_ARM_FROMELF_PATH = ENV(RVCT_TOOLS_PATH)fromelf + +#################################################################################### +# +# ARM RealView 4.0 Tools & Cygwin +# +#################################################################################### +# ARMCYGWIN - Tools from ARM in a Cygwin environment + +*_RVCTCYGWIN_*_*_FAMILY = RVCT +*_RVCTCYGWIN_*_*_BUILDRULEFAMILY = RVCTCYGWIN + +*_RVCTCYGWIN_ARM_CCPATH_FLAG = ENV(RVCT_TOOLS_PATH)armcc +*_RVCTCYGWIN_ARM_SLINKPATH_FLAG = ENV(RVCT_TOOLS_PATH)armlink +*_RVCTCYGWIN_ARM_DLINKPATH_FLAG = ENV(RVCT_TOOLS_PATH)armlink +*_RVCTCYGWIN_ARM_ASMPATH_FLAG = ENV(RVCT_TOOLS_PATH)armasm +*_RVCTCYGWIN_ARM_PPPATH_FLAG = ENV(RVCT_TOOLS_PATH)armcc +*_RVCTCYGWIN_ARM_VFRPPPATH_FLAG = ENV(RVCT_TOOLS_PATH)armcc +*_RVCTCYGWIN_ARM_FROMELFPATH_FLAG = ENV(RVCT_TOOLS_PATH)fromelf + + +# +# Use default values, or override in DSC file +# +*_RVCTCYGWIN_ARM_ARCHCC_FLAGS = --thumb --cpu ARM1176JZF-S +*_RVCTCYGWIN_ARM_ARCHASM_FLAGS = --cpu ARM1176JZF-S +*_RVCTCYGWIN_ARM_ARCHDLINK_FLAGS = +*_RVCTCYGWIN_ARM_PLATFORM_FLAGS = + + DEBUG_RVCTCYGWIN_ARM_DLINK_FLAGS = "$(DLINKPATH_FLAG)" $(ARCHDLINK_FLAGS) --entry $(IMAGE_ENTRY_POINT) --ro-base 0 --no_scanlib --reloc --no_exceptions --datacompressor off --strict --symbols --map --list `cygpath -m $(DEST_DIR_DEBUG)/$(BASE_NAME).map` +RELEASE_RVCTCYGWIN_ARM_DLINK_FLAGS = "$(DLINKPATH_FLAG)" $(ARCHDLINK_FLAGS) --entry $(IMAGE_ENTRY_POINT) --ro-base 0 --no_scanlib --reloc --no_exceptions --datacompressor off --strict --symbols --map --list `cygpath -m $(DEST_DIR_DEBUG)/$(BASE_NAME).map` + +*_RVCTCYGWIN_ARM_ASM_FLAGS = "$(ASMPATH_FLAG)" $(ARCHASM_FLAGS) --apcs /interwork +*_RVCTCYGWIN_ARM_PP_FLAGS = "$(CCPATH_FLAG)" $(ARCHCC_FLAGS) $(PLATFORM_FLAGS) -E +*_RVCTCYGWIN_ARM_VFRPP_FLAGS = "$(CCPATH_FLAG)" $(ARCHCC_FLAGS) $(PLATFORM_FLAGS) -E -DVFRCOMPILE --preinclude `cygpath -m $(DEST_DIR_DEBUG)/$(MODULE_NAME)StrDefs.h` +*_RVCTCYGWIN_ARM_MAKE_PATH = make +*_RVCTCYGWIN_ARM_SLINK_FLAGS = "$(SLINKPATH_FLAG)" --partial -o + DEBUG_RVCTCYGWIN_ARM_CC_FLAGS = "$(CCPATH_FLAG)" $(ARCHCC_FLAGS) $(PLATFORM_FLAGS) --c90 -c -g -O2 --no_autoinline --asm --gnu --apcs /interwork --signed_chars --no_unaligned_access --split_sections --preinclude AutoGen.h --diag_warning 167 +RELEASE_RVCTCYGWIN_ARM_CC_FLAGS = "$(CCPATH_FLAG)" $(ARCHCC_FLAGS) $(PLATFORM_FLAGS) --c90 -c --no_autoinline --asm --gnu --apcs /interwork --signed_chars --no_unaligned_access --split_sections --preinclude AutoGen.h --diag_warning 167 + +################## +# ARM definitions +################## +*_RVCTCYGWIN_ARM_CC_PATH = ENV(WORKSPACE)/BaseTools/Bin/CYGWIN_NT-5.1-i686/armcc_wrapper.py +*_RVCTCYGWIN_ARM_SLINK_PATH = ENV(WORKSPACE)/BaseTools/Bin/CYGWIN_NT-5.1-i686/armcc_wrapper.py +*_RVCTCYGWIN_ARM_DLINK_PATH = ENV(WORKSPACE)/BaseTools/Bin/CYGWIN_NT-5.1-i686/armcc_wrapper.py +*_RVCTCYGWIN_ARM_ASM_PATH = ENV(WORKSPACE)/BaseTools/Bin/CYGWIN_NT-5.1-i686/armcc_wrapper.py +*_RVCTCYGWIN_ARM_PP_PATH = ENV(WORKSPACE)/BaseTools/Bin/CYGWIN_NT-5.1-i686/armcc_wrapper.py +*_RVCTCYGWIN_ARM_VFRPP_PATH = ENV(WORKSPACE)/BaseTools/Bin/CYGWIN_NT-5.1-i686/armcc_wrapper.py +*_RVCTCYGWIN_ARM_FROMELF_PATH = ENV(WORKSPACE)/BaseTools/Bin/CYGWIN_NT-5.1-i686/armcc_wrapper.py + +#################################################################################### +# # ARM GCC (www.codesourcery.com) # #################################################################################### @@ -4128,8 +4256,8 @@ RELEASE_ARMGCC_ARM_ASM_FLAGS = $(ARCHASM_FLAGS) -mlittle-endian *_ARMGCC_ARM_SLINK_FLAGS = -rc *_ARMGCC_ARM_DLINK_FLAGS = $(ARCHDLINK_FLAGS) --oformat=elf32-littlearm --emit-relocs -nostdlib -u $(IMAGE_ENTRY_POINT) -e $(IMAGE_ENTRY_POINT) -Map $(DEST_DIR_DEBUG)/$(BASE_NAME).map - DEBUG_ARMGCC_ARM_CC_FLAGS = $(ARCHCC_FLAGS) $(PLATFORM_FLAGS) -mlittle-endian -g -O0 -mabi=aapcs -mapcs -fno-short-enums -save-temps -combine -fsigned-char -fshort-wchar -fno-strict-aliasing -ffunction-sections -fdata-sections -Wall -Werror -Wno-missing-braces -fomit-frame-pointer -c -include AutoGen.h -RELEASE_ARMGCC_ARM_CC_FLAGS = $(ARCHCC_FLAGS) $(PLATFORM_FLAGS) -mlittle-endian -Os -mabi=aapcs -mapcs -fno-short-enums -save-temps -combine -fsigned-char -fshort-wchar -fno-strict-aliasing -ffunction-sections -fdata-sections -Wall -Werror -Wno-missing-braces -fomit-frame-pointer -c -include AutoGen.h + DEBUG_ARMGCC_ARM_CC_FLAGS = $(ARCHCC_FLAGS) $(PLATFORM_FLAGS) -mword-relocations -mlittle-endian -g -O0 -mabi=aapcs -mapcs -fno-short-enums -save-temps -combine -fsigned-char -fshort-wchar -fno-strict-aliasing -ffunction-sections -fdata-sections -Wall -Werror -Wno-missing-braces -fomit-frame-pointer -c -include AutoGen.h +RELEASE_ARMGCC_ARM_CC_FLAGS = $(ARCHCC_FLAGS) $(PLATFORM_FLAGS) -mword-relocations -mlittle-endian -Os -mabi=aapcs -mapcs -fno-short-enums -save-temps -combine -fsigned-char -fshort-wchar -fno-strict-aliasing -ffunction-sections -fdata-sections -Wall -Werror -Wno-missing-braces -fomit-frame-pointer -c -include AutoGen.h ################# # ASM 16 linker defintions diff --git a/BaseTools/Source/C/GenFv/GenFv.c b/BaseTools/Source/C/GenFv/GenFv.c old mode 100644 new mode 100755 index 8f452c7..a095220 --- a/BaseTools/Source/C/GenFv/GenFv.c +++ b/BaseTools/Source/C/GenFv/GenFv.c @@ -597,7 +597,7 @@ Returns: ); } else { VerboseMsg ("Create Fv image and its map file"); - if (mFvDataInfo.BaseAddress != 0) { + if (mFvDataInfo.BaseAddressSet) { VerboseMsg ("FvImage Rebase Address is 0x%llX", (unsigned long long) mFvDataInfo.BaseAddress); } // diff --git a/BaseTools/Source/C/GenFv/GenFvInternalLib.c b/BaseTools/Source/C/GenFv/GenFvInternalLib.c old mode 100644 new mode 100755 index d86909b..5aa1a08 --- a/BaseTools/Source/C/GenFv/GenFvInternalLib.c +++ b/BaseTools/Source/C/GenFv/GenFvInternalLib.c @@ -209,6 +209,7 @@ Returns: DebugMsg (NULL, 0, 9, "rebase address", "%s = %s", EFI_FV_BASE_ADDRESS_STRING, Value); FvInfo->BaseAddress = Value64; + FvInfo->BaseAddressSet = TRUE; } } @@ -505,6 +506,7 @@ Returns: EFI_STATUS AddPadFile ( + IN FV_INFO *FvInfo, IN OUT MEMORY_FILE *FvImage, IN UINT32 DataAlignment, IN VOID *FvEnd, @@ -536,6 +538,8 @@ Returns: { EFI_FFS_FILE_HEADER *PadFile; UINTN PadFileSize; + UINTN PadFileOffset; + UINTN ExtHeaderSize; // // Verify input parameters. @@ -558,32 +562,29 @@ Returns: // This is the earliest possible valid offset (current plus pad file header // plus the next file header) // - PadFileSize = (UINTN) FvImage->CurrentFilePointer - (UINTN) FvImage->FileImage + (sizeof (EFI_FFS_FILE_HEADER) * 2); + // The padding is added into its own FFS file (which requires a header) added before the aligned file: + // | ... FV data before AlignedFile ... | Pad File FFS Header | Padding | AlignedFile FFS Header (+ ExtHeader) | AlignedData // - // Add whatever it takes to get to the next aligned address + // Calculate the Offset of the Pad File from the beginning of the FV file // - while ((PadFileSize % DataAlignment) != 0) { - PadFileSize++; - } - // - // Subtract the next file header size - // - PadFileSize -= sizeof (EFI_FFS_FILE_HEADER); - - // - // Subtract the starting offset to get size - // - PadFileSize -= (UINTN) FvImage->CurrentFilePointer - (UINTN) FvImage->FileImage; + PadFileOffset = (UINTN) FvImage->CurrentFilePointer - (UINTN) FvImage->FileImage; // - // Append extension header size + // Get the size of the extension header if exists // if (ExtHeader != NULL) { - PadFileSize = PadFileSize + ExtHeader->ExtHeaderSize; + ExtHeaderSize = ExtHeader->ExtHeaderSize; + } else { + ExtHeaderSize = 0; } // + // Calculate the Size of the Padding to ensure the alignment of the data of the Next file + // + PadFileSize = DataAlignment - ((FvInfo->BaseAddress + PadFileOffset + sizeof (EFI_FFS_FILE_HEADER) + ExtHeaderSize) & (DataAlignment - 1)); + + // // Verify that we have enough space for the file header // if (((UINTN) FvImage->CurrentFilePointer + PadFileSize) > (UINTN) FvEnd) { @@ -1114,7 +1115,7 @@ Returns: // // Add pad file if necessary // - Status = AddPadFile (FvImage, 1 << CurrentFileAlignment, *VtfFileImage, NULL); + Status = AddPadFile (FvInfo, FvImage, 1 << CurrentFileAlignment, *VtfFileImage, NULL); if (EFI_ERROR (Status)) { Error (NULL, 0, 4002, "Resource", "FV space is full, could not add pad file for data alignment property."); free (FileBuffer); @@ -2303,7 +2304,7 @@ Returns: // // Add FV Extended Header contents to the FV as a PAD file // - AddPadFile (&FvImageMemoryFile, 4, VtfFileImage, FvExtHeader); + AddPadFile (&mFvDataInfo, &FvImageMemoryFile, 4, VtfFileImage, FvExtHeader); // // Fv Extension header change update Fv Header Check sum @@ -2828,7 +2829,7 @@ Returns: // // Don't need to relocate image when BaseAddress is not set. // - if (FvInfo->BaseAddress == 0) { + if (FvInfo->BaseAddressSet == FALSE) { return EFI_SUCCESS; } XipBase = FvInfo->BaseAddress + XipOffset; -- 1.7.5.1