audk/ArmPlatformPkg/Documentation/patches/BaseTools-Pending-Patches.p...

398 lines
17 KiB
Diff
Executable File

Index: BaseTools/Conf/build_rule.template
===================================================================
--- BaseTools/Conf/build_rule.template (revision 12691)
+++ BaseTools/Conf/build_rule.template (working copy)
@@ -129,7 +129,7 @@
"$(CC)" $(CC_FLAGS) -o ${dst} $(INC) ${src}
"$(SYMRENAME)" $(SYMRENAME_FLAGS) ${dst}
- <Command.ARMGCC>
+ <Command.ARMGCC, Command.ARMLINUXGCC>
"$(CC)" $(CC_FLAGS) -o ${dst} $(INC) ${src}
@@ -217,7 +217,7 @@
<Command.RVCT>
"$(SLINK)" $(SLINK_FLAGS) ${dst} --via $(OBJECT_FILES_LIST)
- <Command.RVCTCYGWIN, Command.ARMGCC>
+ <Command.RVCTCYGWIN, Command.ARMGCC, Command.ARMLINUXGCC>
# $(OBJECT_FILES_LIST) has wrong paths for cygwin
"$(SLINK)" $(SLINK_FLAGS) ${dst} $(OBJECT_FILES)
@@ -241,7 +241,7 @@
"$(DLINK)" -o ${dst} $(DLINK_FLAGS) -\( $(DLINK_SPATH) @$(STATIC_LIBRARY_FILES_LIST) -\) $(DLINK2_FLAGS)
"$(OBJCOPY)" $(OBJCOPY_FLAGS) ${dst}
- <Command.ARMGCC>
+ <Command.ARMGCC, Command.ARMLINUXGCC>
"$(DLINK)" -o ${dst} $(DLINK_FLAGS) -\( $(DLINK_SPATH) $(STATIC_LIBRARY_FILES) -\) $(DLINK2_FLAGS)
<Command.RVCT>
@@ -271,7 +271,7 @@
<Command.GCC>
"$(DLINK)" $(DLINK_FLAGS) -\( $(DLINK_SPATH) @$(STATIC_LIBRARY_FILES_LIST) -\) $(DLINK2_FLAGS)
- <Command.ARMGCC>
+ <Command.ARMGCC, Command.ARMLINUXGCC>
"$(DLINK)" $(DLINK_FLAGS) -\( $(DLINK_SPATH) $(STATIC_LIBRARY_FILES) -\) $(DLINK2_FLAGS)
<Command.RVCT>
@@ -292,7 +292,7 @@
<OutputFile>
$(DEBUG_DIR)(+)$(MODULE_NAME).efi
- <Command.MSFT, Command.INTEL, Command.RVCT, Command.ARMGCC>
+ <Command.MSFT, Command.INTEL, Command.RVCT, Command.ARMGCC, Command.ARMLINUXGCC>
"$(GENFW)" -e $(MODULE_TYPE) -o ${dst} ${src} $(GENFW_FLAGS)
$(CP) ${dst} $(OUTPUT_DIR)
$(CP) ${dst} $(BIN_DIR)
@@ -536,7 +536,7 @@
"$(GENFW)" -o $(OUTPUT_DIR)(+)$(MODULE_NAME)hii.rc -g $(MODULE_GUID) --hiibinpackage $(HII_BINARY_PACKAGES) $(GENFW_FLAGS)
"$(RC)" $(RC_FLAGS) $(OUTPUT_DIR)(+)$(MODULE_NAME)hii.rc ${dst}
- <Command.XCODE, Command.RVCT, Command.ARMGCC>
+ <Command.XCODE, Command.RVCT, Command.ARMGCC, Command.ARMLINUXGCC>
GenFw -o $(OUTPUT_DIR)(+)$(MODULE_NAME)hii.rc -g $(MODULE_GUID) --hiibinpackage $(HII_BINARY_PACKAGES)
Index: BaseTools/Conf/tools_def.template
===================================================================
--- BaseTools/Conf/tools_def.template (revision 12691)
+++ BaseTools/Conf/tools_def.template (working copy)
@@ -467,6 +467,7 @@
# MSFT - Microsoft
# GCC - GNU GCC
# INTEL - INTEL
+# RVCT - ARM RealView Toolchain
####################################################################################
####################################################################################
#
@@ -4173,11 +4174,69 @@
*_ARMGCC_ARM_VFRPP_FLAGS = $(ARCHCC_FLAGS) $(PLATFORM_FLAGS) -x c -E -P -DVFRCOMPILE --include $(DEST_DIR_DEBUG)/$(MODULE_NAME)StrDefs.h
*_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
+*_ARMGCC_ARM_DLINK_FLAGS = $(ARCHDLINK_FLAGS) -Ttext=0x0 --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) DEF(GCC_ARMGCC_CC_FLAGS) -combine -O0
RELEASE_ARMGCC_ARM_CC_FLAGS = $(ARCHCC_FLAGS) $(PLATFORM_FLAGS) DEF(GCC_ARMGCC_CC_FLAGS) -combine -Wno-unused
+####################################################################################
+#
+# ARM GNU/Linux GCC
+#
+####################################################################################
+# ARMLINUXGCC - ARM version of the GCC cross compiler
+
+*_ARMLINUXGCC_*_*_FAMILY = GCC
+*_ARMLINUXGCC_*_*_BUILDRULEFAMILY = ARMLINUXGCC
+
+*_ARMLINUXGCC_*_MAKE_PATH = make
+*_ARMLINUXGCC_*_MAKE_FLAGS = --no-print-directory
+
+##################
+# ASL definitions
+##################
+*_ARMLINUXGCC_*_ASL_PATH = DEF(UNIX_IASL_BIN)
+*_ARMLINUXGCC_*_ASL_FLAGS = DEF(IASL_FLAGS)
+*_ARMLINUXGCC_*_ASL_OUTFLAGS = DEF(IASL_OUTFLAGS)
+*_ARMLINUXGCC_*_ASLPP_FLAGS = -x c -E -P
+*_ARMLINUXGCC_*_ASLCC_FLAGS = -x c
+*_ARMLINUXGCC_*_ASLDLINK_FLAGS = DEF(GCC_DLINK_FLAGS_COMMON) --entry _ReferenceAcpiTable
+
+##################
+# ARM definitions
+##################
+
+*_ARMLINUXGCC_ARM_ASLCC_PATH = ENV(ARMLINUXGCC_TOOLS_PATH)arm-linux-gnueabi-gcc
+*_ARMLINUXGCC_ARM_ASLDLINK_PATH = ENV(ARMLINUXGCC_TOOLS_PATH)arm-linux-gnueabi-ld
+*_ARMLINUXGCC_ARM_ASLPP_PATH = ENV(ARMLINUXGCC_TOOLS_PATH)arm-linux-gnueabi-gcc
+
+*_ARMLINUXGCC_ARM_CC_PATH = ENV(ARMLINUXGCC_TOOLS_PATH)arm-linux-gnueabi-gcc
+*_ARMLINUXGCC_ARM_SLINK_PATH = ENV(ARMLINUXGCC_TOOLS_PATH)arm-linux-gnueabi-ar
+*_ARMLINUXGCC_ARM_DLINK_PATH = ENV(ARMLINUXGCC_TOOLS_PATH)arm-linux-gnueabi-ld
+*_ARMLINUXGCC_ARM_ASM_PATH = ENV(ARMLINUXGCC_TOOLS_PATH)arm-linux-gnueabi-as
+*_ARMLINUXGCC_ARM_PP_PATH = ENV(ARMLINUXGCC_TOOLS_PATH)arm-linux-gnueabi-gcc
+*_ARMLINUXGCC_ARM_VFRPP_PATH = ENV(ARMLINUXGCC_TOOLS_PATH)arm-linux-gnueabi-gcc
+
+#
+# Use default values, or override in DSC file
+#
+*_ARMLINUXGCC_ARM_ARCHCC_FLAGS = -mthumb
+*_ARMLINUXGCC_ARM_ARCHASM_FLAGS =
+*_ARMLINUXGCC_ARM_ARCHDLINK_FLAGS =
+*_ARMLINUXGCC_ARM_PLATFORM_FLAGS = -march=armv7-a
+
+ DEBUG_ARMLINUXGCC_ARM_ASM_FLAGS = $(ARCHASM_FLAGS) $(PLATFORM_FLAGS) -mlittle-endian -g
+RELEASE_ARMLINUXGCC_ARM_ASM_FLAGS = $(ARCHASM_FLAGS) $(PLATFORM_FLAGS) -mlittle-endian
+
+*_ARMLINUXGCC_ARM_PP_FLAGS = $(ARCHCC_FLAGS) $(PLATFORM_FLAGS) -E -x assembler-with-cpp -include $(DEST_DIR_DEBUG)/AutoGen.h
+*_ARMLINUXGCC_ARM_VFRPP_FLAGS = $(ARCHCC_FLAGS) $(PLATFORM_FLAGS) -x c -E -P -DVFRCOMPILE --include $(DEST_DIR_DEBUG)/$(MODULE_NAME)StrDefs.h
+
+*_ARMLINUXGCC_ARM_SLINK_FLAGS = -rc
+*_ARMLINUXGCC_ARM_DLINK_FLAGS = $(ARCHDLINK_FLAGS) -Ttext=0x0 --oformat=elf32-littlearm --emit-relocs -nostdlib -u $(IMAGE_ENTRY_POINT) -e $(IMAGE_ENTRY_POINT) -Map $(DEST_DIR_DEBUG)/$(BASE_NAME).map
+
+ DEBUG_ARMLINUXGCC_ARM_CC_FLAGS = $(ARCHCC_FLAGS) $(PLATFORM_FLAGS) DEF(GCC_ARMGCC_CC_FLAGS) -Wno-address -O0
+RELEASE_ARMLINUXGCC_ARM_CC_FLAGS = $(ARCHCC_FLAGS) $(PLATFORM_FLAGS) DEF(GCC_ARMGCC_CC_FLAGS) -Wno-address -Wno-unused-but-set-variable
+
#################
# ASM 16 linker defintions
#################
Index: BaseTools/Source/Python/Workspace/MetaFileParser.py
===================================================================
--- BaseTools/Source/Python/Workspace/MetaFileParser.py (revision 12691)
+++ BaseTools/Source/Python/Workspace/MetaFileParser.py (working copy)
@@ -1280,6 +1280,9 @@
Records = IncludedFileTable.GetAll()
if Records:
self._Content[self._ContentIndex:self._ContentIndex] = Records
+ self._Content.pop(self._ContentIndex-1)
+ self._ValueList = None
+ self._ContentIndex -= 1
def __ProcessSkuId(self):
self._ValueList = [ReplaceMacro(Value, self._Macros, RaiseError=True)
Index: BaseTools/Source/Python/Workspace/WorkspaceDatabase.py
===================================================================
--- BaseTools/Source/Python/Workspace/WorkspaceDatabase.py (revision 12691)
+++ BaseTools/Source/Python/Workspace/WorkspaceDatabase.py (working copy)
@@ -2319,7 +2319,7 @@
# @param GlobalMacros Global macros used for replacement during file parsing
# @prarm RenewDb=False Create new database file if it's already there
#
- def __init__(self, DbPath, RenewDb=False):
+ def __init__(self, DbPath, RenewDb=False, DbSignature={}):
self._DbClosedFlag = False
if not DbPath:
DbPath = os.path.normpath(os.path.join(GlobalData.gWorkspace, self._DB_PATH_))
@@ -2331,7 +2331,7 @@
os.makedirs(DbDir)
# remove db file in case inconsistency between db and file in file system
- if self._CheckWhetherDbNeedRenew(RenewDb, DbPath):
+ if self._CheckWhetherDbNeedRenew(RenewDb, DbPath, DbSignature):
os.remove(DbPath)
# create db with optimized parameters
@@ -2367,7 +2367,38 @@
#
# @return Bool value for whether need renew workspace databse
#
- def _CheckWhetherDbNeedRenew (self, force, DbPath):
+ def _CheckWhetherDbNeedRenew (self, force, DbPath, DbSignature):
+ DbDir = os.path.split(DbPath)[0]
+ MacroFilePath = os.path.normpath(os.path.join(DbDir, "build.mac"))
+ MacroMatch = False
+ if os.path.exists(MacroFilePath) and os.path.isfile(MacroFilePath):
+ LastMacros = None
+ try:
+ f = open(MacroFilePath,'r')
+ LastMacros = pickle.load(f)
+ f.close()
+ except IOError:
+ pass
+ except:
+ f.close()
+
+ if LastMacros != None and type(LastMacros) is DictType:
+ if LastMacros == DbSignature:
+ MacroMatch = True
+
+ if not MacroMatch:
+ # save command line macros to file
+ try:
+ f = open(MacroFilePath,'w')
+ pickle.dump(DbSignature, f, 2)
+ f.close()
+ except IOError:
+ pass
+ except:
+ f.close()
+
+ force = True
+
# if database does not exist, we need do nothing
if not os.path.exists(DbPath): return False
Index: BaseTools/Source/Python/build/build.py
===================================================================
--- BaseTools/Source/Python/build/build.py (revision 12691)
+++ BaseTools/Source/Python/build/build.py (working copy)
@@ -704,6 +704,8 @@
#
def __init__(self, Target, WorkspaceDir, BuildOptions):
self.WorkspaceDir = WorkspaceDir
+ DbSignature = {'Target': Target, 'BuildOptions': BuildOptions }
+
self.Target = Target
self.PlatformFile = BuildOptions.PlatformFile
self.ModuleFile = BuildOptions.ModuleFile
@@ -726,7 +728,7 @@
if BuildOptions.DisableCache:
self.Db = WorkspaceDatabase(":memory:")
else:
- self.Db = WorkspaceDatabase(None, self.Reparse)
+ self.Db = WorkspaceDatabase(None, self.Reparse, DbSignature)
self.BuildDatabase = self.Db.BuildObject
self.Platform = None
self.LoadFixAddress = 0
Index: BaseTools/Source/Python/Trim/Trim.py
===================================================================
--- BaseTools/Source/Python/Trim/Trim.py (revision 12691)
+++ BaseTools/Source/Python/Trim/Trim.py (working copy)
@@ -37,7 +37,9 @@
## Regular expression for matching "#pragma pack"
gPragmaPattern = re.compile("^\s*#pragma\s+pack", re.MULTILINE)
## Regular expression for matching HEX number
-gHexNumberPattern = re.compile("0[xX]([0-9a-fA-F]+)")
+gHexNumberPattern = re.compile("(0[xX])([0-9a-fA-F]+)U?")
+## Regular expression for matching decimal number
+gDecNumberPattern = re.compile("([0-9]+)U?")
## Regular expression for matching "Include ()" in asl file
gAslIncludePattern = re.compile("^(\s*)[iI]nclude\s*\(\"?([^\"\(\)]+)\"\)", re.MULTILINE)
## Regular expression for matching C style #include "XXX.asl" in asl file
@@ -169,10 +171,15 @@
# convert HEX number format if indicated
if ConvertHex:
- Line = gHexNumberPattern.sub(r"0\1h", Line)
+ Line = gHexNumberPattern.sub(r"0\2h", Line)
+ else:
+ Line = gHexNumberPattern.sub(r"\1\2", Line)
if TrimLong:
Line = gLongNumberPattern.sub(r"\1", Line)
+ # convert Decimal number format
+ Line = gDecNumberPattern.sub(r"\1", Line)
+
if LineNumber != None:
EdkLogger.verbose("Got line directive: line=%d" % LineNumber)
# in case preprocessor removed some lines, like blank or comment lines
Index: BaseTools/Source/C/GenFv/GenFv.c
===================================================================
--- BaseTools/Source/C/GenFv/GenFv.c (revision 12691)
+++ BaseTools/Source/C/GenFv/GenFv.c (working copy)
@@ -623,12 +623,7 @@
);
} else {
VerboseMsg ("Create Fv image and its map file");
- //
- // Will take rebase action at below situation:
- // 1. ForceRebase Flag specified to TRUE;
- // 2. ForceRebase Flag not specified, BaseAddress greater than zero.
- //
- if (((mFvDataInfo.BaseAddress > 0) && (mFvDataInfo.ForceRebase == -1)) || (mFvDataInfo.ForceRebase == 1)) {
+ if (mFvDataInfo.BaseAddressSet) {
VerboseMsg ("FvImage Rebase Address is 0x%llX", (unsigned long long) mFvDataInfo.BaseAddress);
}
//
Index: BaseTools/Source/C/GenFv/GenFvInternalLib.c
===================================================================
--- BaseTools/Source/C/GenFv/GenFvInternalLib.c (revision 12691)
+++ BaseTools/Source/C/GenFv/GenFvInternalLib.c (working copy)
@@ -506,6 +506,7 @@
EFI_STATUS
AddPadFile (
+ IN FV_INFO *FvInfo,
IN OUT MEMORY_FILE *FvImage,
IN UINT32 DataAlignment,
IN VOID *FvEnd,
@@ -537,6 +538,8 @@
{
EFI_FFS_FILE_HEADER *PadFile;
UINTN PadFileSize;
+ UINTN PadFileOffset;
+ UINTN ExtHeaderSize;
//
// Verify input parameters.
@@ -559,32 +562,29 @@
// 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) {
@@ -1115,7 +1115,7 @@
//
// 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);
@@ -2304,7 +2304,7 @@
//
// 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
@@ -2825,20 +2825,12 @@
PeFileBuffer = NULL;
//
- // Don't need to relocate image when BaseAddress is zero and no ForceRebase Flag specified.
+ // Don't need to relocate image when BaseAddress is not set.
//
- if ((FvInfo->BaseAddress == 0) && (FvInfo->ForceRebase == -1)) {
+ if (FvInfo->BaseAddressSet == FALSE) {
return EFI_SUCCESS;
}
-
- //
- // If ForceRebase Flag specified to FALSE, will always not take rebase action.
- //
- if (FvInfo->ForceRebase == 0) {
- return EFI_SUCCESS;
- }
-
XipBase = FvInfo->BaseAddress + XipOffset;
//