summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--BaseTools/Bin/externals.txt2
-rwxr-xr-xBaseTools/BuildEnv66
-rw-r--r--BaseTools/Conf/tools_def.template22
-rwxr-xr-xBaseTools/Scripts/SetVisualStudio.bat2
-rwxr-xr-xBaseTools/Scripts/ShowEnvironment.bat2
-rw-r--r--BaseTools/Source/C/Common/PeCoffLoaderEx.c2
-rw-r--r--BaseTools/Source/C/GenFw/Elf32Convert.c42
-rw-r--r--BaseTools/Source/C/GenFw/Elf64Convert.c42
-rw-r--r--BaseTools/Source/C/GenFw/GenFw.c82
-rw-r--r--BaseTools/Source/C/Split/Split.c25
-rw-r--r--BaseTools/Source/C/VfrCompile/VfrSyntax.g12
-rw-r--r--BaseTools/Source/Python/AutoGen/AutoGen.py16
-rw-r--r--BaseTools/Source/Python/AutoGen/GenC.py27
-rw-r--r--BaseTools/Source/Python/AutoGen/GenMake.py4
-rw-r--r--BaseTools/Source/Python/Common/EdkIIWorkspace.py3
-rw-r--r--BaseTools/Source/Python/Common/FdfParserLite.py6
-rw-r--r--BaseTools/Source/Python/Common/LongFilePathOsPath.py2
-rw-r--r--BaseTools/Source/Python/Common/Misc.py7
-rw-r--r--BaseTools/Source/Python/Common/String.py8
-rw-r--r--BaseTools/Source/Python/Ecc/Check.py18
-rw-r--r--BaseTools/Source/Python/Ecc/Ecc.py8
-rw-r--r--BaseTools/Source/Python/Ecc/MetaDataParser.py5
-rw-r--r--BaseTools/Source/Python/Ecc/c.py16
-rw-r--r--BaseTools/Source/Python/GenFds/FfsInfStatement.py7
-rw-r--r--BaseTools/Source/Python/GenFds/GenFds.py13
-rw-r--r--BaseTools/Source/Python/GenFds/GenFdsGlobalVariable.py4
-rw-r--r--BaseTools/Source/Python/GenFds/Region.py3
-rw-r--r--BaseTools/Source/Python/Makefile1
-rw-r--r--BaseTools/Source/Python/UPT/Core/DistributionPackageClass.py26
-rw-r--r--BaseTools/Source/Python/UPT/Core/PackageFile.py8
-rw-r--r--BaseTools/Source/Python/UPT/Library/GlobalData.py3
-rw-r--r--BaseTools/Source/Python/UPT/Library/Misc.py7
-rw-r--r--BaseTools/Source/Python/UPT/Library/ParserValidate.py3
-rw-r--r--BaseTools/Source/Python/UPT/Library/Parsing.py32
-rw-r--r--BaseTools/Source/Python/UPT/MkPkg.py7
-rw-r--r--BaseTools/Source/Python/UPT/PomAdapter/InfPomAlignment.py5
-rw-r--r--BaseTools/Source/Python/UPT/UPT.py3
-rw-r--r--BaseTools/Source/Python/Workspace/MetaFileParser.py11
-rw-r--r--BaseTools/Source/Python/Workspace/WorkspaceDatabase.py31
-rwxr-xr-xBaseTools/toolsetup.bat150
40 files changed, 453 insertions, 280 deletions
diff --git a/BaseTools/Bin/externals.txt b/BaseTools/Bin/externals.txt
index f477749364..c2c4ab7297 100644
--- a/BaseTools/Bin/externals.txt
+++ b/BaseTools/Bin/externals.txt
@@ -1 +1 @@
-Win32 -r92 https://svn.code.sf.net/p/edk2-toolbinaries/code/trunk/Win32
+Win32 https://svn.code.sf.net/p/edk2-toolbinaries/code/trunk/Win32
diff --git a/BaseTools/BuildEnv b/BaseTools/BuildEnv
index 6a1281b96b..7c77454bf8 100755
--- a/BaseTools/BuildEnv
+++ b/BaseTools/BuildEnv
@@ -2,7 +2,7 @@
# Setup the environment for unix-like systems running a bash-like shell.
# This file must be "sourced" not merely executed. For example: ". edksetup.sh"
#
-# Copyright (c) 2006 - 2014, Intel Corporation. All rights reserved.<BR>
+# Copyright (c) 2006 - 2015, Intel Corporation. All rights reserved.<BR>
# This program and the accompanying materials
# 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
@@ -35,11 +35,28 @@ RestorePreviousConfiguration() {
#
# Restore previous configuration
#
- PREVIOUS_CONF_FILE=Conf/BuildEnv.sh
+ if [ -z "$CONF_PATH" ]
+ then
+ export CONF_PATH=$WORKSPACE/Conf
+ if [ ! -d $WORKSPACE/Conf ] && [ -n "$PACKAGES_PATH" ]
+ then
+ PACKAGES_PATH=${PACKAGES_PATH//:/ }
+ for DIR in $PACKAGES_PATH
+ do
+ if [ -d $DIR/Conf ]
+ then
+ export CONF_PATH=$DIR/Conf
+ break
+ fi
+ done
+ fi
+ fi
+
+ PREVIOUS_CONF_FILE=$CONF_PATH/BuildEnv.sh
if [ -e $PREVIOUS_CONF_FILE ]
then
- echo Loading previous configuration from \$WORKSPACE/$PREVIOUS_CONF_FILE
- . $WORKSPACE/$PREVIOUS_CONF_FILE
+ echo Loading previous configuration from $PREVIOUS_CONF_FILE
+ . $PREVIOUS_CONF_FILE
fi
}
@@ -70,9 +87,8 @@ StoreCurrentConfiguration() {
# Write configuration to a shell script to allow for configuration to be
# easily reloaded.
#
- OUTPUT_FILE=Conf/BuildEnv.sh
- #echo Storing current configuration into \$WORKSPACE/$OUTPUT_FILE
- OUTPUT_FILE=$WORKSPACE/$OUTPUT_FILE
+ OUTPUT_FILE=$CONF_PATH/BuildEnv.sh
+ #echo Storing current configuration into $OUTPUT_FILE
echo "# Auto-generated by ${BASH_SOURCE[0]}" > $OUTPUT_FILE
GenerateShellCodeToSetVariable WORKSPACE $OUTPUT_FILE
GenerateShellCodeToSetVariable EDK_TOOLS_PATH $OUTPUT_FILE
@@ -90,20 +106,20 @@ SetEdkToolsPath() {
fi
#
- # Try $WORKSPACE/Conf/EdkTools
+ # Try $CONF_PATH/EdkTools
#
- if [ -e $WORKSPACE/Conf/EdkTools ]
+ if [ -e $CONF_PATH/EdkTools ]
then
- export EDK_TOOLS_PATH=$WORKSPACE/Conf/EdkTools
+ export EDK_TOOLS_PATH=$CONF_PATH/EdkTools
return 0
fi
#
- # Try $WORKSPACE/Conf/BaseToolsSource
+ # Try $CONF_PATH/BaseToolsSource
#
- if [ -e $WORKSPACE/Conf/BaseToolsSource ]
+ if [ -e $CONF_PATH/BaseToolsSource ]
then
- export EDK_TOOLS_PATH=$WORKSPACE/Conf/BaseToolsSource
+ export EDK_TOOLS_PATH=$CONF_PATH/BaseToolsSource
return 0
fi
@@ -116,6 +132,22 @@ SetEdkToolsPath() {
return 0
fi
+ #
+ # Try $PACKAGES_PATH
+ #
+ if [ -n "$PACKAGES_PATH"]
+ then
+ PACKAGES_PATH=${PACKAGES_PATH//:/ }
+ for DIR in $PACKAGES_PATH
+ do
+ if [ -d $DIR/BaseTools ]
+ then
+ export EDK_TOOLS_PATH=$DIR/BaseTools
+ return 0
+ fi
+ done
+ fi
+
echo "Unable to determine EDK_TOOLS_PATH"
echo
echo "You may need to download the 'BaseTools' from buildtools.tianocore.org."
@@ -179,17 +211,16 @@ AddEdkToolsToPath() {
CopySingleTemplateFile() {
SRC_FILENAME=Conf/$1.template
- DST_FILENAME=Conf/$1.txt
+ DST_FILENAME=$CONF_PATH/$1.txt
- if [ -e $WORKSPACE/$DST_FILENAME ]
+ if [ -e $DST_FILENAME ]
then
return
fi
echo "Copying \$EDK_TOOLS_PATH/$SRC_FILENAME"
- echo " to \$WORKSPACE/$DST_FILENAME"
+ echo " to $DST_FILENAME"
SRC_FILENAME=$EDK_TOOLS_PATH/$SRC_FILENAME
- DST_FILENAME=$WORKSPACE/$DST_FILENAME
cp $SRC_FILENAME $DST_FILENAME
}
@@ -230,6 +261,7 @@ ScriptMain() {
echo WORKSPACE: $WORKSPACE
echo EDK_TOOLS_PATH: $EDK_TOOLS_PATH
+ echo CONF_PATH: $CONF_PATH
CopyTemplateFiles
diff --git a/BaseTools/Conf/tools_def.template b/BaseTools/Conf/tools_def.template
index aa2b6b1488..db08e252d2 100644
--- a/BaseTools/Conf/tools_def.template
+++ b/BaseTools/Conf/tools_def.template
@@ -3812,12 +3812,12 @@ DEFINE GCC_IA32_CC_FLAGS = DEF(GCC_ALL_CC_FLAGS) -m32 -malign-double -
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_ARM_CC_FLAGS = DEF(GCC_ALL_CC_FLAGS) -mword-relocations -mlittle-endian -mabi=aapcs -mapcs -fno-short-enums -save-temps -fsigned-char -ffunction-sections -fdata-sections -fomit-frame-pointer -Wno-address -mthumb -mfloat-abi=soft
-DEFINE GCC_AARCH64_CC_FLAGS = DEF(GCC_ALL_CC_FLAGS) -mcmodel=tiny -mlittle-endian -fno-short-enums -save-temps -fverbose-asm -fsigned-char -ffunction-sections -fdata-sections -fomit-frame-pointer -fno-builtin -Wno-address -fno-asynchronous-unwind-tables
+DEFINE GCC_AARCH64_CC_FLAGS = DEF(GCC_ALL_CC_FLAGS) -mlittle-endian -fno-short-enums -save-temps -fverbose-asm -fsigned-char -ffunction-sections -fdata-sections -fomit-frame-pointer -fno-builtin -Wno-address -fno-asynchronous-unwind-tables
DEFINE GCC_DLINK_FLAGS_COMMON = -nostdlib --pie
DEFINE GCC_DLINK2_FLAGS_COMMON = --script=$(EDK_TOOLS_PATH)/Scripts/GccBase.lds
DEFINE GCC_IA32_X64_DLINK_COMMON = DEF(GCC_DLINK_FLAGS_COMMON) --gc-sections
DEFINE GCC_ARM_AARCH64_DLINK_COMMON= --emit-relocs -nostdlib --gc-sections -u $(IMAGE_ENTRY_POINT) -e $(IMAGE_ENTRY_POINT) -Map $(DEST_DIR_DEBUG)/$(BASE_NAME).map
-DEFINE GCC_ARM_DLINK_FLAGS = DEF(GCC_ARM_AARCH64_DLINK_COMMON) -Ttext=0x0
+DEFINE GCC_ARM_DLINK_FLAGS = DEF(GCC_ARM_AARCH64_DLINK_COMMON) -z common-page-size=0x20
DEFINE GCC_AARCH64_DLINK_FLAGS = DEF(GCC_ARM_AARCH64_DLINK_COMMON) -z common-page-size=0x20
DEFINE GCC_IA32_X64_ASLDLINK_FLAGS = DEF(GCC_IA32_X64_DLINK_COMMON) --entry _ReferenceAcpiTable -u $(IMAGE_ENTRY_POINT)
DEFINE GCC_ARM_ASLDLINK_FLAGS = DEF(GCC_ARM_DLINK_FLAGS) --entry ReferenceAcpiTable -u $(IMAGE_ENTRY_POINT)
@@ -3844,9 +3844,9 @@ DEFINE GCC44_X64_CC_FLAGS = DEF(GCC44_ALL_CC_FLAGS) -m64 -fno-stack-p
DEFINE GCC44_IA32_X64_DLINK_COMMON = -nostdlib -n -q --gc-sections -z common-page-size=0x20
DEFINE GCC44_IA32_X64_ASLDLINK_FLAGS = DEF(GCC44_IA32_X64_DLINK_COMMON) --entry ReferenceAcpiTable -u ReferenceAcpiTable
DEFINE GCC44_IA32_X64_DLINK_FLAGS = DEF(GCC44_IA32_X64_DLINK_COMMON) --entry $(IMAGE_ENTRY_POINT) -u $(IMAGE_ENTRY_POINT) -Map $(DEST_DIR_DEBUG)/$(BASE_NAME).map
-DEFINE GCC44_IA32_DLINK2_FLAGS = DEF(GCC_DLINK2_FLAGS_COMMON) --defsym=PECOFF_HEADER_SIZE=0x220
+DEFINE GCC44_IA32_DLINK2_FLAGS = --defsym=PECOFF_HEADER_SIZE=0x220 DEF(GCC_DLINK2_FLAGS_COMMON)
DEFINE GCC44_X64_DLINK_FLAGS = DEF(GCC44_IA32_X64_DLINK_FLAGS) -melf_x86_64 --oformat=elf64-x86-64
-DEFINE GCC44_X64_DLINK2_FLAGS = DEF(GCC_DLINK2_FLAGS_COMMON) --defsym=PECOFF_HEADER_SIZE=0x228
+DEFINE GCC44_X64_DLINK2_FLAGS = --defsym=PECOFF_HEADER_SIZE=0x228 DEF(GCC_DLINK2_FLAGS_COMMON)
DEFINE GCC44_ASM_FLAGS = DEF(GCC_ASM_FLAGS)
DEFINE GCC45_IA32_CC_FLAGS = DEF(GCC44_IA32_CC_FLAGS)
@@ -3871,6 +3871,7 @@ DEFINE GCC46_ASM_FLAGS = DEF(GCC45_ASM_FLAGS)
DEFINE GCC46_ARM_ASM_FLAGS = $(ARCHASM_FLAGS) $(PLATFORM_FLAGS) DEF(GCC_ASM_FLAGS) -mlittle-endian
DEFINE GCC46_ARM_CC_FLAGS = $(ARCHCC_FLAGS) $(PLATFORM_FLAGS) DEF(GCC44_ALL_CC_FLAGS) DEF(GCC_ARM_CC_FLAGS) -fstack-protector
DEFINE GCC46_ARM_DLINK_FLAGS = DEF(GCC_ARM_DLINK_FLAGS) --oformat=elf32-littlearm
+DEFINE GCC46_ARM_DLINK2_FLAGS = DEF(GCC_DLINK2_FLAGS_COMMON) --defsym=PECOFF_HEADER_SIZE=0x220
DEFINE GCC46_ARM_ASLDLINK_FLAGS = DEF(GCC_ARM_ASLDLINK_FLAGS) --oformat=elf32-littlearm
DEFINE GCC47_IA32_CC_FLAGS = DEF(GCC46_IA32_CC_FLAGS)
@@ -3885,8 +3886,9 @@ DEFINE GCC47_ASM_FLAGS = DEF(GCC46_ASM_FLAGS)
DEFINE GCC47_ARM_ASM_FLAGS = DEF(GCC46_ARM_ASM_FLAGS)
DEFINE GCC47_AARCH64_ASM_FLAGS = $(ARCHASM_FLAGS) $(PLATFORM_FLAGS) DEF(GCC_ASM_FLAGS) -mlittle-endian
DEFINE GCC47_ARM_CC_FLAGS = DEF(GCC46_ARM_CC_FLAGS) -mno-unaligned-access
-DEFINE GCC47_AARCH64_CC_FLAGS = $(ARCHCC_FLAGS) $(PLATFORM_FLAGS) DEF(GCC44_ALL_CC_FLAGS) DEF(GCC_AARCH64_CC_FLAGS)
+DEFINE GCC47_AARCH64_CC_FLAGS = $(ARCHCC_FLAGS) $(PLATFORM_FLAGS) DEF(GCC44_ALL_CC_FLAGS) -mcmodel=large DEF(GCC_AARCH64_CC_FLAGS)
DEFINE GCC47_ARM_DLINK_FLAGS = DEF(GCC46_ARM_DLINK_FLAGS)
+DEFINE GCC47_ARM_DLINK2_FLAGS = DEF(GCC46_ARM_DLINK2_FLAGS)
DEFINE GCC47_AARCH64_DLINK_FLAGS = DEF(GCC_AARCH64_DLINK_FLAGS)
DEFINE GCC47_AARCH64_DLINK2_FLAGS = DEF(GCC_DLINK2_FLAGS_COMMON) --defsym=PECOFF_HEADER_SIZE=0x228
DEFINE GCC47_ARM_ASLDLINK_FLAGS = DEF(GCC46_ARM_ASLDLINK_FLAGS)
@@ -3906,6 +3908,7 @@ DEFINE GCC48_AARCH64_ASM_FLAGS = DEF(GCC47_AARCH64_ASM_FLAGS)
DEFINE GCC48_ARM_CC_FLAGS = DEF(GCC47_ARM_CC_FLAGS)
DEFINE GCC48_AARCH64_CC_FLAGS = DEF(GCC47_AARCH64_CC_FLAGS)
DEFINE GCC48_ARM_DLINK_FLAGS = DEF(GCC47_ARM_DLINK_FLAGS)
+DEFINE GCC48_ARM_DLINK2_FLAGS = DEF(GCC47_ARM_DLINK2_FLAGS)
DEFINE GCC48_AARCH64_DLINK_FLAGS = DEF(GCC47_AARCH64_DLINK_FLAGS)
DEFINE GCC48_AARCH64_DLINK2_FLAGS = DEF(GCC47_AARCH64_DLINK2_FLAGS)
DEFINE GCC48_ARM_ASLDLINK_FLAGS = DEF(GCC47_ARM_ASLDLINK_FLAGS)
@@ -3923,8 +3926,9 @@ DEFINE GCC49_ASM_FLAGS = DEF(GCC48_ASM_FLAGS)
DEFINE GCC49_ARM_ASM_FLAGS = DEF(GCC48_ARM_ASM_FLAGS)
DEFINE GCC49_AARCH64_ASM_FLAGS = DEF(GCC48_AARCH64_ASM_FLAGS)
DEFINE GCC49_ARM_CC_FLAGS = DEF(GCC48_ARM_CC_FLAGS)
-DEFINE GCC49_AARCH64_CC_FLAGS = DEF(GCC48_AARCH64_CC_FLAGS)
+DEFINE GCC49_AARCH64_CC_FLAGS = $(ARCHCC_FLAGS) $(PLATFORM_FLAGS) DEF(GCC44_ALL_CC_FLAGS) -mcmodel=tiny DEF(GCC_AARCH64_CC_FLAGS)
DEFINE GCC49_ARM_DLINK_FLAGS = DEF(GCC48_ARM_DLINK_FLAGS)
+DEFINE GCC49_ARM_DLINK2_FLAGS = DEF(GCC48_ARM_DLINK2_FLAGS)
DEFINE GCC49_AARCH64_DLINK_FLAGS = DEF(GCC48_AARCH64_DLINK_FLAGS)
DEFINE GCC49_AARCH64_DLINK2_FLAGS = DEF(GCC48_AARCH64_DLINK2_FLAGS)
DEFINE GCC49_ARM_ASLDLINK_FLAGS = DEF(GCC48_ARM_ASLDLINK_FLAGS)
@@ -4250,6 +4254,7 @@ DEFINE GCC49_AARCH64_ASLDLINK_FLAGS = DEF(GCC48_AARCH64_ASLDLINK_FLAGS)
*_GCC46_ARM_ASLDLINK_FLAGS = DEF(GCC46_ARM_ASLDLINK_FLAGS)
*_GCC46_ARM_ASM_FLAGS = DEF(GCC46_ARM_ASM_FLAGS)
*_GCC46_ARM_DLINK_FLAGS = DEF(GCC46_ARM_DLINK_FLAGS)
+*_GCC46_ARM_DLINK2_FLAGS = DEF(GCC46_ARM_DLINK2_FLAGS)
*_GCC46_ARM_PLATFORM_FLAGS = -march=armv7-a
*_GCC46_ARM_PP_FLAGS = $(ARCHCC_FLAGS) $(PLATFORM_FLAGS) DEF(GCC_PP_FLAGS)
*_GCC46_ARM_RC_FLAGS = DEF(GCC_ARM_RC_FLAGS)
@@ -4349,6 +4354,7 @@ RELEASE_GCC46_ARM_CC_FLAGS = DEF(GCC46_ARM_CC_FLAGS) -D__ARM_FEATURE_UNALI
*_GCC47_ARM_ASLDLINK_FLAGS = DEF(GCC47_ARM_ASLDLINK_FLAGS)
*_GCC47_ARM_ASM_FLAGS = DEF(GCC47_ARM_ASM_FLAGS)
*_GCC47_ARM_DLINK_FLAGS = DEF(GCC47_ARM_DLINK_FLAGS)
+*_GCC47_ARM_DLINK2_FLAGS = DEF(GCC47_ARM_DLINK2_FLAGS)
*_GCC47_ARM_PLATFORM_FLAGS = -march=armv7-a
*_GCC47_ARM_PP_FLAGS = $(ARCHCC_FLAGS) $(PLATFORM_FLAGS) DEF(GCC_PP_FLAGS)
*_GCC47_ARM_RC_FLAGS = DEF(GCC_ARM_RC_FLAGS)
@@ -4475,6 +4481,7 @@ RELEASE_GCC47_AARCH64_CC_FLAGS = DEF(GCC47_AARCH64_CC_FLAGS) -Wno-unused-but-s
*_GCC48_ARM_ASLDLINK_FLAGS = DEF(GCC48_ARM_ASLDLINK_FLAGS)
*_GCC48_ARM_ASM_FLAGS = DEF(GCC48_ARM_ASM_FLAGS)
*_GCC48_ARM_DLINK_FLAGS = DEF(GCC48_ARM_DLINK_FLAGS)
+*_GCC48_ARM_DLINK2_FLAGS = DEF(GCC48_ARM_DLINK2_FLAGS)
*_GCC48_ARM_PLATFORM_FLAGS = -march=armv7-a
*_GCC48_ARM_PP_FLAGS = $(ARCHCC_FLAGS) $(PLATFORM_FLAGS) DEF(GCC_PP_FLAGS)
*_GCC48_ARM_RC_FLAGS = DEF(GCC_ARM_RC_FLAGS)
@@ -4601,6 +4608,7 @@ RELEASE_GCC48_AARCH64_CC_FLAGS = DEF(GCC48_AARCH64_CC_FLAGS) -Wno-unused-but-s
*_GCC49_ARM_ASLDLINK_FLAGS = DEF(GCC49_ARM_ASLDLINK_FLAGS)
*_GCC49_ARM_ASM_FLAGS = DEF(GCC49_ARM_ASM_FLAGS)
*_GCC49_ARM_DLINK_FLAGS = DEF(GCC49_ARM_DLINK_FLAGS)
+*_GCC49_ARM_DLINK2_FLAGS = DEF(GCC49_ARM_DLINK2_FLAGS)
*_GCC49_ARM_PLATFORM_FLAGS = -march=armv7-a
*_GCC49_ARM_PP_FLAGS = $(ARCHCC_FLAGS) $(PLATFORM_FLAGS) DEF(GCC_PP_FLAGS)
*_GCC49_ARM_RC_FLAGS = DEF(GCC_ARM_RC_FLAGS)
@@ -6609,7 +6617,7 @@ RELEASE_XCODE5_X64_CC_FLAGS = -target x86_64-pc-win32-macho -c -Os -W
DEFINE RVCT_ALL_ASM_FLAGS = --diag_suppress=1786 --diag_error=warning --apcs /interwork
DEFINE RVCT_ALL_CC_FLAGS = --c90 -c --no_autoinline --asm --gnu --apcs /interwork --signed_chars --no_unaligned_access --split_sections --enum_is_int --preinclude AutoGen.h --diag_suppress=186 --diag_warning 167 --diag_error=warning --diag_style=ide --protect_stack
-DEFINE RVCT_ALL_DLINK_FLAGS = --ro-base 0 --no_scanlib --reloc --no_exceptions --datacompressor off --strict --symbols --diag_style=ide
+DEFINE RVCT_ALL_DLINK_FLAGS = --ro-base 0 --no_scanlib --reloc --no_exceptions --datacompressor off --strict --symbols --diag_style=ide --no_legacyalign
####################################################################################
#
diff --git a/BaseTools/Scripts/SetVisualStudio.bat b/BaseTools/Scripts/SetVisualStudio.bat
index a302a83596..d379cd73df 100755
--- a/BaseTools/Scripts/SetVisualStudio.bat
+++ b/BaseTools/Scripts/SetVisualStudio.bat
@@ -68,7 +68,7 @@ if not exist "%COMMONTOOLSx64%\vcvarsx86_amd64.bat" (
@goto End
:RebuildTools
-@call python "%WORKSPACE%\BaseTools\Scripts\UpdateBuildVersions.py"
+@call python "%BASE_TOOLS_PATH%\Scripts\UpdateBuildVersions.py"
@set "BIN_DIR=%EDK_TOOLS_PATH%\Bin\Win32"
if not exist "%BIN_DIR%" @mkdir "%BIN_DIR%"
@echo Removing temporary and binary files
diff --git a/BaseTools/Scripts/ShowEnvironment.bat b/BaseTools/Scripts/ShowEnvironment.bat
index c4613e1170..2b320fbc21 100755
--- a/BaseTools/Scripts/ShowEnvironment.bat
+++ b/BaseTools/Scripts/ShowEnvironment.bat
@@ -47,9 +47,11 @@ if defined SRC_CONF @goto SetEnv
@echo #############################################################################
@if defined WORKSPACE @echo WORKSPACE = %WORKSPACE%
@if not defined WORKSPACE @echo WORKSPACE = Not Set
+@if defined PACKAGES_PATH @echo PACKAGES_PATH = %PACKAGES_PATH%
@if defined EDK_TOOLS_PATH @echo EDK_TOOLS_PATH = %EDK_TOOLS_PATH%
@if not defined EDK_TOOLS_PATH @echo EDK_TOOLS_PATH = Not Set
@if defined BASE_TOOLS_PATH @echo BASE_TOOLS_PATH = %BASE_TOOLS_PATH%
+@if defined EDK_TOOLS_BIN @echo EDK_TOOLS_BIN = %EDK_TOOLS_BIN%
@if defined PYTHON_FREEZER_PATH @echo PYTHON_FREEZER_PATH = %PYTHON_FREEZER_PATH%
@if "%NT32PKG%"=="TRUE" (
@echo.
diff --git a/BaseTools/Source/C/Common/PeCoffLoaderEx.c b/BaseTools/Source/C/Common/PeCoffLoaderEx.c
index 382138a893..d04fa7d5ba 100644
--- a/BaseTools/Source/C/Common/PeCoffLoaderEx.c
+++ b/BaseTools/Source/C/Common/PeCoffLoaderEx.c
@@ -402,8 +402,8 @@ PeCoffLoaderRelocateArmImage (
if (*FixupData != NULL) {
*FixupData = ALIGN_POINTER(*FixupData, sizeof(UINT64));
- *(UINT64 *)(*FixupData) = *Fixup16;
CopyMem (*FixupData, Fixup16, sizeof (UINT64));
+ *FixupData = *FixupData + sizeof(UINT64);
}
break;
diff --git a/BaseTools/Source/C/GenFw/Elf32Convert.c b/BaseTools/Source/C/GenFw/Elf32Convert.c
index e1b92ebd71..a7b077873b 100644
--- a/BaseTools/Source/C/GenFw/Elf32Convert.c
+++ b/BaseTools/Source/C/GenFw/Elf32Convert.c
@@ -218,6 +218,15 @@ CoffAlign (
return (Offset + mCoffAlignment - 1) & ~(mCoffAlignment - 1);
}
+STATIC
+UINT32
+DebugRvaAlign (
+ UINT32 Offset
+ )
+{
+ return (Offset + 3) & ~3;
+}
+
//
// filter functions
//
@@ -331,12 +340,8 @@ ScanSections32 (
if ((shdr->sh_addr & (shdr->sh_addralign - 1)) == 0) {
// if the section address is aligned we must align PE/COFF
mCoffOffset = (mCoffOffset + shdr->sh_addralign - 1) & ~(shdr->sh_addralign - 1);
- } else if ((shdr->sh_addr % shdr->sh_addralign) != (mCoffOffset % shdr->sh_addralign)) {
- // ARM RVCT tools have behavior outside of the ELF specification to try
- // and make images smaller. If sh_addr is not aligned to sh_addralign
- // then the section needs to preserve sh_addr MOD sh_addralign.
- // Normally doing nothing here works great.
- Error (NULL, 0, 3000, "Invalid", "Unsupported section alignment.");
+ } else {
+ Error (NULL, 0, 3000, "Invalid", "Section address not aligned to its own alignment.");
}
}
@@ -365,11 +370,8 @@ ScanSections32 (
assert (FALSE);
}
- mDebugOffset = mCoffOffset;
-
- if (mEhdr->e_machine != EM_ARM) {
- mCoffOffset = CoffAlign(mCoffOffset);
- }
+ mDebugOffset = DebugRvaAlign(mCoffOffset);
+ mCoffOffset = CoffAlign(mCoffOffset);
if (SectionCount > 1 && mOutImageType == FW_EFI_IMAGE) {
Warning (NULL, 0, 0, NULL, "Mulitple sections in %s are merged into 1 text section. Source level debug might not work correctly.", mInImageName);
@@ -389,12 +391,8 @@ ScanSections32 (
if ((shdr->sh_addr & (shdr->sh_addralign - 1)) == 0) {
// if the section address is aligned we must align PE/COFF
mCoffOffset = (mCoffOffset + shdr->sh_addralign - 1) & ~(shdr->sh_addralign - 1);
- } else if ((shdr->sh_addr % shdr->sh_addralign) != (mCoffOffset % shdr->sh_addralign)) {
- // ARM RVCT tools have behavior outside of the ELF specification to try
- // and make images smaller. If sh_addr is not aligned to sh_addralign
- // then the section needs to preserve sh_addr MOD sh_addralign.
- // Normally doing nothing here works great.
- Error (NULL, 0, 3000, "Invalid", "Unsupported section alignment.");
+ } else {
+ Error (NULL, 0, 3000, "Invalid", "Section address not aligned to its own alignment.");
}
}
@@ -423,7 +421,7 @@ ScanSections32 (
// section alignment.
//
if (SectionCount > 0) {
- mDebugOffset = mCoffOffset;
+ mDebugOffset = DebugRvaAlign(mCoffOffset);
}
mCoffOffset = mDebugOffset + sizeof(EFI_IMAGE_DEBUG_DIRECTORY_ENTRY) +
sizeof(EFI_IMAGE_DEBUG_CODEVIEW_NB10_ENTRY) +
@@ -446,12 +444,8 @@ ScanSections32 (
if ((shdr->sh_addr & (shdr->sh_addralign - 1)) == 0) {
// if the section address is aligned we must align PE/COFF
mCoffOffset = (mCoffOffset + shdr->sh_addralign - 1) & ~(shdr->sh_addralign - 1);
- } else if ((shdr->sh_addr % shdr->sh_addralign) != (mCoffOffset % shdr->sh_addralign)) {
- // ARM RVCT tools have behavior outside of the ELF specification to try
- // and make images smaller. If sh_addr is not aligned to sh_addralign
- // then the section needs to preserve sh_addr MOD sh_addralign.
- // Normally doing nothing here works great.
- Error (NULL, 0, 3000, "Invalid", "Unsupported section alignment.");
+ } else {
+ Error (NULL, 0, 3000, "Invalid", "Section address not aligned to its own alignment.");
}
}
if (shdr->sh_size != 0) {
diff --git a/BaseTools/Source/C/GenFw/Elf64Convert.c b/BaseTools/Source/C/GenFw/Elf64Convert.c
index c758ed9d64..90d80a22da 100644
--- a/BaseTools/Source/C/GenFw/Elf64Convert.c
+++ b/BaseTools/Source/C/GenFw/Elf64Convert.c
@@ -211,6 +211,15 @@ CoffAlign (
return (Offset + mCoffAlignment - 1) & ~(mCoffAlignment - 1);
}
+STATIC
+UINT32
+DebugRvaAlign (
+ UINT32 Offset
+ )
+{
+ return (Offset + 3) & ~3;
+}
+
//
// filter functions
//
@@ -325,12 +334,8 @@ ScanSections64 (
if ((shdr->sh_addr & (shdr->sh_addralign - 1)) == 0) {
// if the section address is aligned we must align PE/COFF
mCoffOffset = (UINT32) ((mCoffOffset + shdr->sh_addralign - 1) & ~(shdr->sh_addralign - 1));
- } else if ((shdr->sh_addr % shdr->sh_addralign) != (mCoffOffset % shdr->sh_addralign)) {
- // ARM RVCT tools have behavior outside of the ELF specification to try
- // and make images smaller. If sh_addr is not aligned to sh_addralign
- // then the section needs to preserve sh_addr MOD sh_addralign.
- // Normally doing nothing here works great.
- Error (NULL, 0, 3000, "Invalid", "Unsupported section alignment.");
+ } else {
+ Error (NULL, 0, 3000, "Invalid", "Section address not aligned to its own alignment.");
}
}
@@ -359,11 +364,8 @@ ScanSections64 (
assert (FALSE);
}
- mDebugOffset = mCoffOffset;
-
- if (mEhdr->e_machine != EM_ARM) {
- mCoffOffset = CoffAlign(mCoffOffset);
- }
+ mDebugOffset = DebugRvaAlign(mCoffOffset);
+ mCoffOffset = CoffAlign(mCoffOffset);
if (SectionCount > 1 && mOutImageType == FW_EFI_IMAGE) {
Warning (NULL, 0, 0, NULL, "Mulitple sections in %s are merged into 1 text section. Source level debug might not work correctly.", mInImageName);
@@ -383,12 +385,8 @@ ScanSections64 (
if ((shdr->sh_addr & (shdr->sh_addralign - 1)) == 0) {
// if the section address is aligned we must align PE/COFF
mCoffOffset = (UINT32) ((mCoffOffset + shdr->sh_addralign - 1) & ~(shdr->sh_addralign - 1));
- } else if ((shdr->sh_addr % shdr->sh_addralign) != (mCoffOffset % shdr->sh_addralign)) {
- // ARM RVCT tools have behavior outside of the ELF specification to try
- // and make images smaller. If sh_addr is not aligned to sh_addralign
- // then the section needs to preserve sh_addr MOD sh_addralign.
- // Normally doing nothing here works great.
- Error (NULL, 0, 3000, "Invalid", "Unsupported section alignment.");
+ } else {
+ Error (NULL, 0, 3000, "Invalid", "Section address not aligned to its own alignment.");
}
}
@@ -412,7 +410,7 @@ ScanSections64 (
// section alignment.
//
if (SectionCount > 0) {
- mDebugOffset = mCoffOffset;
+ mDebugOffset = DebugRvaAlign(mCoffOffset);
}
mCoffOffset = mDebugOffset + sizeof(EFI_IMAGE_DEBUG_DIRECTORY_ENTRY) +
sizeof(EFI_IMAGE_DEBUG_CODEVIEW_NB10_ENTRY) +
@@ -439,12 +437,8 @@ ScanSections64 (
if ((shdr->sh_addr & (shdr->sh_addralign - 1)) == 0) {
// if the section address is aligned we must align PE/COFF
mCoffOffset = (UINT32) ((mCoffOffset + shdr->sh_addralign - 1) & ~(shdr->sh_addralign - 1));
- } else if ((shdr->sh_addr % shdr->sh_addralign) != (mCoffOffset % shdr->sh_addralign)) {
- // ARM RVCT tools have behavior outside of the ELF specification to try
- // and make images smaller. If sh_addr is not aligned to sh_addralign
- // then the section needs to preserve sh_addr MOD sh_addralign.
- // Normally doing nothing here works great.
- Error (NULL, 0, 3000, "Invalid", "Unsupported section alignment.");
+ } else {
+ Error (NULL, 0, 3000, "Invalid", "Section address not aligned to its own alignment.");
}
}
if (shdr->sh_size != 0) {
diff --git a/BaseTools/Source/C/GenFw/GenFw.c b/BaseTools/Source/C/GenFw/GenFw.c
index 4756c52762..9ddd18e294 100644
--- a/BaseTools/Source/C/GenFw/GenFw.c
+++ b/BaseTools/Source/C/GenFw/GenFw.c
@@ -1,7 +1,7 @@
/** @file
Converts a pe32+ image to an FW, Te image type, or other specific image.
-Copyright (c) 2004 - 2014, Intel Corporation. All rights reserved.<BR>
+Copyright (c) 2004 - 2015, Intel Corporation. All rights reserved.<BR>
This program and the accompanying materials
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
@@ -168,7 +168,7 @@ Returns:
//
// Copyright declaration
//
- fprintf (stdout, "Copyright (c) 2007 - 2014, Intel Corporation. All rights reserved.\n\n");
+ fprintf (stdout, "Copyright (c) 2007 - 2015, Intel Corporation. All rights reserved.\n\n");
//
// Details Option
@@ -184,9 +184,9 @@ Returns:
PIC_PEIM, RELOCATABLE_PEIM, BS_DRIVER, RT_DRIVER,\n\
APPLICATION, SAL_RT_DRIVER to support all module types\n\
It can only be used together with --keepexceptiontable,\n\
- --keepzeropending, -r, -o option.It is a action option.\n\
- If it is combined with other action options, the later\n\
- input action option will override the previous one.\n");
+ --keepzeropending, --keepoptionalheader, -r, -o option.\n\
+ It is a action option. If it is combined with other action options,\n\
+ the later input action option will override the previous one.\n");
fprintf (stdout, " -c, --acpi Create Acpi table.\n\
It can't be combined with other action options\n\
except for -o, -r option. It is a action option.\n\
@@ -194,9 +194,9 @@ Returns:
input action option will override the previous one.\n");
fprintf (stdout, " -t, --terse Create Te Image.\n\
It can only be used together with --keepexceptiontable,\n\
- --keepzeropending, -r, -o option.It is a action option.\n\
- If it is combined with other action options, the later\n\
- input action option will override the previous one.\n");
+ --keepzeropending, --keepoptionalheader, -r, -o option.\n\
+ It is a action option. If it is combined with other action options,\n\
+ the later input action option will override the previous one.\n");
fprintf (stdout, " -u, --dump Dump TeImage Header.\n\
It can't be combined with other action options\n\
except for -o, -r option. It is a action option.\n\
@@ -246,6 +246,9 @@ Returns:
fprintf (stdout, " --keepexceptiontable Don't clear exception table.\n\
This option can be used together with -e or -t.\n\
It doesn't work for other options.\n");
+ fprintf (stdout, " --keepoptionalheader Don't zero PE/COFF optional header fields.\n\
+ This option can be used together with -e or -t.\n\
+ It doesn't work for other options.\n");
fprintf (stdout, " --keepzeropending Don't strip zero pending of .reloc.\n\
This option can be used together with -e or -t.\n\
It doesn't work for other options.\n");
@@ -1079,6 +1082,7 @@ Returns:
STATUS Status;
BOOLEAN ReplaceFlag;
BOOLEAN KeepExceptionTableFlag;
+ BOOLEAN KeepOptionalHeaderFlag;
BOOLEAN KeepZeroPendingFlag;
UINT64 LogLevel;
EFI_TE_IMAGE_HEADER TEImageHeader;
@@ -1141,6 +1145,7 @@ Returns:
Optional32 = NULL;
Optional64 = NULL;
KeepExceptionTableFlag = FALSE;
+ KeepOptionalHeaderFlag = FALSE;
KeepZeroPendingFlag = FALSE;
NumberOfFormPacakge = 0;
HiiPackageListBuffer = NULL;
@@ -1269,6 +1274,13 @@ Returns:
continue;
}
+ if (stricmp(argv[0], "--keepoptionalheader") == 0) {
+ KeepOptionalHeaderFlag = TRUE;
+ argc--;
+ argv++;
+ continue;
+ }
+
if (stricmp (argv[0], "--keepzeropending") == 0) {
KeepZeroPendingFlag = TRUE;
argc --;
@@ -2303,19 +2315,20 @@ Returns:
if (PeHdr->Pe32.OptionalHeader.Magic == EFI_IMAGE_NT_OPTIONAL_HDR32_MAGIC) {
Optional32 = (EFI_IMAGE_OPTIONAL_HEADER32 *)&PeHdr->Pe32.OptionalHeader;
- Optional32->MajorOperatingSystemVersion = 0;
- Optional32->MinorOperatingSystemVersion = 0;
- Optional32->MajorImageVersion = 0;
- Optional32->MinorImageVersion = 0;
- Optional32->MajorSubsystemVersion = 0;
- Optional32->MinorSubsystemVersion = 0;
- Optional32->Win32VersionValue = 0;
- Optional32->CheckSum = 0;
- Optional32->SizeOfStackReserve = 0;
- Optional32->SizeOfStackCommit = 0;
- Optional32->SizeOfHeapReserve = 0;
- Optional32->SizeOfHeapCommit = 0;
-
+ if (!KeepOptionalHeaderFlag) {
+ Optional32->MajorOperatingSystemVersion = 0;
+ Optional32->MinorOperatingSystemVersion = 0;
+ Optional32->MajorImageVersion = 0;
+ Optional32->MinorImageVersion = 0;
+ Optional32->MajorSubsystemVersion = 0;
+ Optional32->MinorSubsystemVersion = 0;
+ Optional32->Win32VersionValue = 0;
+ Optional32->CheckSum = 0;
+ Optional32->SizeOfStackReserve = 0;
+ Optional32->SizeOfStackCommit = 0;
+ Optional32->SizeOfHeapReserve = 0;
+ Optional32->SizeOfHeapCommit = 0;
+ }
TEImageHeader.AddressOfEntryPoint = Optional32->AddressOfEntryPoint;
TEImageHeader.BaseOfCode = Optional32->BaseOfCode;
TEImageHeader.ImageBase = (UINT64) (Optional32->ImageBase);
@@ -2395,19 +2408,20 @@ Returns:
}
} else if (PeHdr->Pe32.OptionalHeader.Magic == EFI_IMAGE_NT_OPTIONAL_HDR64_MAGIC) {
Optional64 = (EFI_IMAGE_OPTIONAL_HEADER64 *)&PeHdr->Pe32.OptionalHeader;
- Optional64->MajorOperatingSystemVersion = 0;
- Optional64->MinorOperatingSystemVersion = 0;
- Optional64->MajorImageVersion = 0;
- Optional64->MinorImageVersion = 0;
- Optional64->MajorSubsystemVersion = 0;
- Optional64->MinorSubsystemVersion = 0;
- Optional64->Win32VersionValue = 0;
- Optional64->CheckSum = 0;
- Optional64->SizeOfStackReserve = 0;
- Optional64->SizeOfStackCommit = 0;
- Optional64->SizeOfHeapReserve = 0;
- Optional64->SizeOfHeapCommit = 0;
-
+ if (!KeepOptionalHeaderFlag) {
+ Optional64->MajorOperatingSystemVersion = 0;
+ Optional64->MinorOperatingSystemVersion = 0;
+ Optional64->MajorImageVersion = 0;
+ Optional64->MinorImageVersion = 0;
+ Optional64->MajorSubsystemVersion = 0;
+ Optional64->MinorSubsystemVersion = 0;
+ Optional64->Win32VersionValue = 0;
+ Optional64->CheckSum = 0;
+ Optional64->SizeOfStackReserve = 0;
+ Optional64->SizeOfStackCommit = 0;
+ Optional64->SizeOfHeapReserve = 0;
+ Optional64->SizeOfHeapCommit = 0;
+ }
TEImageHeader.AddressOfEntryPoint = Optional64->AddressOfEntryPoint;
TEImageHeader.BaseOfCode = Optional64->BaseOfCode;
TEImageHeader.ImageBase = (UINT64) (Optional64->ImageBase);
diff --git a/BaseTools/Source/C/Split/Split.c b/BaseTools/Source/C/Split/Split.c
index b63aef78f9..44a09681d3 100644
--- a/BaseTools/Source/C/Split/Split.c
+++ b/BaseTools/Source/C/Split/Split.c
@@ -2,7 +2,7 @@
Split a file into two pieces at the request offset.
-Copyright (c) 1999 - 2014, Intel Corporation. All rights reserved.<BR>
+Copyright (c) 1999 - 2015, Intel Corporation. All rights reserved.<BR>
This program and the accompanying materials 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
@@ -58,7 +58,7 @@ Returns:
--*/
{
printf ("%s Version %d.%d %s\n", UTILITY_NAME, UTILITY_MAJOR_VERSION, UTILITY_MINOR_VERSION, __BUILD_VERSION);
- printf ("Copyright (c) 1999-2014 Intel Corporation. All rights reserved.\n");
+ printf ("Copyright (c) 1999-2015 Intel Corporation. All rights reserved.\n");
printf ("\n SplitFile creates two Binary files either in the same directory as the current working\n");
printf (" directory or in the specified directory.\n");
}
@@ -176,20 +176,25 @@ CreateDir (
{
CHAR8* temp = *FullFileName;
CHAR8* start = temp;
+ CHAR8 tempchar;
UINT64 index = 0;
for (;index < strlen(temp); ++index) {
if (temp[index] == '\\' || temp[index] == '/') {
- temp[index] = 0;
- if (chdir(start)) {
- if (mkdir(start, S_IRWXU | S_IRWXG | S_IRWXO) != 0) {
- return EFI_ABORTED;
+ if (temp[index + 1] != '\0') {
+ tempchar = temp[index + 1];
+ temp[index + 1] = 0;
+ if (chdir(start)) {
+ if (mkdir(start, S_IRWXU | S_IRWXG | S_IRWXO) != 0) {
+ return EFI_ABORTED;
+ }
+ chdir(start);
}
- chdir(start);
+ start = temp + index + 1;
+ temp[index] = '/';
+ temp[index + 1] = tempchar;
+ }
}
- start = temp + index + 1;
- temp[index] = '/';
- }
}
return EFI_SUCCESS;
diff --git a/BaseTools/Source/C/VfrCompile/VfrSyntax.g b/BaseTools/Source/C/VfrCompile/VfrSyntax.g
index ad839b2ab6..d74fec8815 100644
--- a/BaseTools/Source/C/VfrCompile/VfrSyntax.g
+++ b/BaseTools/Source/C/VfrCompile/VfrSyntax.g
@@ -3258,7 +3258,7 @@ vfrStatementInconsistentIf :
Prompt "=" "STRING_TOKEN" "\(" S:Number "\)" "," << IIObj.SetError (_STOSID(S->getText(), S->getLine())); >>
{ FLAGS "=" flagsField ( "\|" flagsField )* "," }
vfrStatementExpression[0]
- E:EndIf << CRT_END_OP (E); >>
+ E:EndIf {";"} << CRT_END_OP (E); >>
;
vfrStatementNoSubmitIf :
@@ -3267,7 +3267,7 @@ vfrStatementNoSubmitIf :
Prompt "=" "STRING_TOKEN" "\(" S:Number "\)" "," << NSIObj.SetError (_STOSID(S->getText(), S->getLine())); >>
{ FLAGS "=" flagsField ( "\|" flagsField )* "," }
vfrStatementExpression[0]
- E:EndIf << CRT_END_OP (E); >>
+ E:EndIf {";"} << CRT_END_OP (E); >>
;
vfrStatementWarningIf :
@@ -3276,7 +3276,7 @@ vfrStatementWarningIf :
Prompt "=" "STRING_TOKEN" "\(" S:Number "\)" "," << WIObj.SetWarning (_STOSID(S->getText(), S->getLine())); >>
{Timeout "=" T:Number "," << WIObj.SetTimeOut (_STOU8(T->getText(), T->getLine())); >>}
vfrStatementExpression[0]
- E:EndIf << CRT_END_OP (E); >>
+ E:EndIf {";"} << CRT_END_OP (E); >>
;
vfrStatementDisableIfQuest :
@@ -3286,7 +3286,7 @@ vfrStatementDisableIfQuest :
L:DisableIf << DIObj.SetLineNo(L->getLine()); >>
vfrStatementExpression[0] ";"
vfrStatementQuestionOptionList
- E:EndIf << CRT_END_OP (E); >>
+ E:EndIf {";"} << CRT_END_OP (E); >>
;
vfrStatementRefresh :
@@ -3316,7 +3316,7 @@ vfrStatementSuppressIfQuest :
{ FLAGS "=" flagsField ( "\|" flagsField )* "," }
vfrStatementExpression[0] ";"
vfrStatementQuestionOptionList
- E:EndIf << CRT_END_OP (E); >>
+ E:EndIf {";"} << CRT_END_OP (E); >>
;
vfrStatementGrayOutIfQuest :
@@ -3325,7 +3325,7 @@ vfrStatementGrayOutIfQuest :
{ FLAGS "=" flagsField ( "\|" flagsField )* "," }
vfrStatementExpression[0] ";"
vfrStatementQuestionOptionList
- E:EndIf << CRT_END_OP (E); >>
+ E:EndIf {";"} << CRT_END_OP (E); >>
;
vfrStatementOptions :
diff --git a/BaseTools/Source/Python/AutoGen/AutoGen.py b/BaseTools/Source/Python/AutoGen/AutoGen.py
index 259abc519b..fe56574357 100644
--- a/BaseTools/Source/Python/AutoGen/AutoGen.py
+++ b/BaseTools/Source/Python/AutoGen/AutoGen.py
@@ -40,7 +40,7 @@ from GenPatchPcdTable.GenPatchPcdTable import parsePcdInfoFromMapFile
import Common.VpdInfoFile as VpdInfoFile
from GenPcdDb import CreatePcdDatabaseCode
from Workspace.MetaFileCommentParser import UsageList
-
+from Common.MultipleWorkspace import MultipleWorkspace as mws
import InfSectionParser
## Regular expression for splitting Dependency Expression string into tokens
@@ -953,7 +953,7 @@ class PlatformAutoGen(AutoGen):
self._GuidValue = {}
FdfModuleList = []
for InfName in self._AsBuildInfList:
- InfName = os.path.join(self.WorkspaceDir, InfName)
+ InfName = mws.join(self.WorkspaceDir, InfName)
FdfModuleList.append(os.path.normpath(InfName))
for F in self.Platform.Modules.keys():
M = ModuleAutoGen(self.Workspace, F, self.BuildTarget, self.ToolChain, self.Arch, self.MetaFile)
@@ -1288,7 +1288,7 @@ class PlatformAutoGen(AutoGen):
def _GetFdfFile(self):
if self._FdfFile == None:
if self.Workspace.FdfFile != "":
- self._FdfFile= path.join(self.WorkspaceDir, self.Workspace.FdfFile)
+ self._FdfFile= mws.join(self.WorkspaceDir, self.Workspace.FdfFile)
else:
self._FdfFile = ''
return self._FdfFile
@@ -2115,8 +2115,11 @@ class PlatformAutoGen(AutoGen):
BuildOptions[Tool][Attr] = ""
# check if override is indicated
if Value.startswith('='):
- BuildOptions[Tool][Attr] = Value[1:]
+ ToolPath = Value[1:]
+ ToolPath = mws.handleWsMacro(ToolPath)
+ BuildOptions[Tool][Attr] = ToolPath
else:
+ Value = mws.handleWsMacro(Value)
BuildOptions[Tool][Attr] += " " + Value
if Module.AutoGenVersion < 0x00010005 and self.Workspace.UniFlag != None:
#
@@ -2193,8 +2196,7 @@ class ModuleAutoGen(AutoGen):
return False
self.SourceDir = self.MetaFile.SubDir
- if self.SourceDir.upper().find(self.WorkspaceDir.upper()) == 0:
- self.SourceDir = self.SourceDir[len(self.WorkspaceDir) + 1:]
+ self.SourceDir = mws.relpath(self.SourceDir, self.WorkspaceDir)
self.SourceOverrideDir = None
# use overrided path defined in DSC file
@@ -3042,7 +3044,7 @@ class ModuleAutoGen(AutoGen):
self._IncludePathList.append(self.DebugDir)
for Package in self.Module.Packages:
- PackageDir = path.join(self.WorkspaceDir, Package.MetaFile.Dir)
+ PackageDir = mws.join(self.WorkspaceDir, Package.MetaFile.Dir)
if PackageDir not in self._IncludePathList:
self._IncludePathList.append(PackageDir)
for Inc in Package.Includes:
diff --git a/BaseTools/Source/Python/AutoGen/GenC.py b/BaseTools/Source/Python/AutoGen/GenC.py
index 77de1657f0..45fb9899f2 100644
--- a/BaseTools/Source/Python/AutoGen/GenC.py
+++ b/BaseTools/Source/Python/AutoGen/GenC.py
@@ -1384,22 +1384,21 @@ def CreateModuleUnloadImageCode(Info, AutoGenC, AutoGenH):
# @param AutoGenH The TemplateString object for header file
#
def CreateGuidDefinitionCode(Info, AutoGenC, AutoGenH):
- if Info.IsLibrary:
- return
-
if Info.ModuleType in ["USER_DEFINED", "BASE"]:
GuidType = "GUID"
else:
GuidType = "EFI_GUID"
if Info.GuidList:
- AutoGenC.Append("\n// Guids\n")
+ if not Info.IsLibrary:
+ AutoGenC.Append("\n// Guids\n")
AutoGenH.Append("\n// Guids\n")
#
# GUIDs
#
for Key in Info.GuidList:
- AutoGenC.Append('GLOBAL_REMOVE_IF_UNREFERENCED %s %s = %s;\n' % (GuidType, Key, Info.GuidList[Key]))
+ if not Info.IsLibrary:
+ AutoGenC.Append('GLOBAL_REMOVE_IF_UNREFERENCED %s %s = %s;\n' % (GuidType, Key, Info.GuidList[Key]))
AutoGenH.Append('extern %s %s;\n' % (GuidType, Key))
## Create code for protocol
@@ -1409,22 +1408,21 @@ def CreateGuidDefinitionCode(Info, AutoGenC, AutoGenH):
# @param AutoGenH The TemplateString object for header file
#
def CreateProtocolDefinitionCode(Info, AutoGenC, AutoGenH):
- if Info.IsLibrary:
- return
-
if Info.ModuleType in ["USER_DEFINED", "BASE"]:
GuidType = "GUID"
else:
GuidType = "EFI_GUID"
if Info.ProtocolList:
- AutoGenC.Append("\n// Protocols\n")
+ if not Info.IsLibrary:
+ AutoGenC.Append("\n// Protocols\n")
AutoGenH.Append("\n// Protocols\n")
#
# Protocol GUIDs
#
for Key in Info.ProtocolList:
- AutoGenC.Append('GLOBAL_REMOVE_IF_UNREFERENCED %s %s = %s;\n' % (GuidType, Key, Info.ProtocolList[Key]))
+ if not Info.IsLibrary:
+ AutoGenC.Append('GLOBAL_REMOVE_IF_UNREFERENCED %s %s = %s;\n' % (GuidType, Key, Info.ProtocolList[Key]))
AutoGenH.Append('extern %s %s;\n' % (GuidType, Key))
## Create code for PPI
@@ -1434,22 +1432,21 @@ def CreateProtocolDefinitionCode(Info, AutoGenC, AutoGenH):
# @param AutoGenH The TemplateString object for header file
#
def CreatePpiDefinitionCode(Info, AutoGenC, AutoGenH):
- if Info.IsLibrary:
- return
-
if Info.ModuleType in ["USER_DEFINED", "BASE"]:
GuidType = "GUID"
else:
GuidType = "EFI_GUID"
if Info.PpiList:
- AutoGenC.Append("\n// PPIs\n")
+ if not Info.IsLibrary:
+ AutoGenC.Append("\n// PPIs\n")
AutoGenH.Append("\n// PPIs\n")
#
# PPI GUIDs
#
for Key in Info.PpiList:
- AutoGenC.Append('GLOBAL_REMOVE_IF_UNREFERENCED %s %s = %s;\n' % (GuidType, Key, Info.PpiList[Key]))
+ if not Info.IsLibrary:
+ AutoGenC.Append('GLOBAL_REMOVE_IF_UNREFERENCED %s %s = %s;\n' % (GuidType, Key, Info.PpiList[Key]))
AutoGenH.Append('extern %s %s;\n' % (GuidType, Key))
## Create code for PCD
diff --git a/BaseTools/Source/Python/AutoGen/GenMake.py b/BaseTools/Source/Python/AutoGen/GenMake.py
index 0342709a3a..d9b219e1c7 100644
--- a/BaseTools/Source/Python/AutoGen/GenMake.py
+++ b/BaseTools/Source/Python/AutoGen/GenMake.py
@@ -19,7 +19,7 @@ import string
import re
import os.path as path
from Common.LongFilePathSupport import OpenLongFilePath as open
-
+from Common.MultipleWorkspace import MultipleWorkspace as mws
from Common.BuildToolError import *
from Common.Misc import *
from Common.String import *
@@ -559,7 +559,7 @@ cleanlib:
found = False
while not found and os.sep in package_rel_dir:
index = package_rel_dir.index(os.sep)
- current_dir = os.path.join(current_dir, package_rel_dir[:index])
+ current_dir = mws.join(current_dir, package_rel_dir[:index])
for fl in os.listdir(current_dir):
if fl.endswith('.dec'):
found = True
diff --git a/BaseTools/Source/Python/Common/EdkIIWorkspace.py b/BaseTools/Source/Python/Common/EdkIIWorkspace.py
index 84d89b6c2e..401efeef3c 100644
--- a/BaseTools/Source/Python/Common/EdkIIWorkspace.py
+++ b/BaseTools/Source/Python/Common/EdkIIWorkspace.py
@@ -17,6 +17,7 @@
import Common.LongFilePathOs as os, sys, time
from DataType import *
from Common.LongFilePathSupport import OpenLongFilePath as open
+from Common.MultipleWorkspace import MultipleWorkspace as mws
## EdkIIWorkspace
#
@@ -112,7 +113,7 @@ class EdkIIWorkspace:
# @retval string The full path filename
#
def WorkspaceFile(self, FileName):
- return os.path.realpath(os.path.join(self.WorkspaceDir,FileName))
+ return os.path.realpath(mws.join(self.WorkspaceDir,FileName))
## Convert to a real path filename
#
diff --git a/BaseTools/Source/Python/Common/FdfParserLite.py b/BaseTools/Source/Python/Common/FdfParserLite.py
index 54a60a7e8f..a0ee249748 100644
--- a/BaseTools/Source/Python/Common/FdfParserLite.py
+++ b/BaseTools/Source/Python/Common/FdfParserLite.py
@@ -20,6 +20,7 @@ import Common.LongFilePathOs as os
import CommonDataClass.FdfClass
from Common.LongFilePathSupport import OpenLongFilePath as open
+from Common.MultipleWorkspace import MultipleWorkspace as mws
##define T_CHAR_SPACE ' '
##define T_CHAR_NULL '\0'
@@ -485,7 +486,8 @@ class FdfParser(object):
IncFileName = self.__Token
if not os.path.isabs(IncFileName):
if IncFileName.startswith('$(WORKSPACE)'):
- Str = IncFileName.replace('$(WORKSPACE)', os.environ.get('WORKSPACE'))
+ Str = mws.handleWsMacro(IncFileName)
+ Str = Str.replace('$(WORKSPACE)', os.environ.get('WORKSPACE'))
if os.path.exists(Str):
if not os.path.isabs(Str):
Str = os.path.abspath(Str)
@@ -494,7 +496,7 @@ class FdfParser(object):
# file is in the same dir with FDF file
FullFdf = self.FileName
if not os.path.isabs(self.FileName):
- FullFdf = os.path.join(os.environ.get('WORKSPACE'), self.FileName)
+ FullFdf = mws.join(os.environ.get('WORKSPACE'), self.FileName)
IncFileName = os.path.join(os.path.dirname(FullFdf), IncFileName)
diff --git a/BaseTools/Source/Python/Common/LongFilePathOsPath.py b/BaseTools/Source/Python/Common/LongFilePathOsPath.py
index cb89b1b813..0bba446419 100644
--- a/BaseTools/Source/Python/Common/LongFilePathOsPath.py
+++ b/BaseTools/Source/Python/Common/LongFilePathOsPath.py
@@ -49,3 +49,5 @@ dirname = os.path.dirname
islink = os.path.islink
isabs = os.path.isabs
realpath = os.path.realpath
+relpath = os.path.relpath
+pardir = os.path.pardir
diff --git a/BaseTools/Source/Python/Common/Misc.py b/BaseTools/Source/Python/Common/Misc.py
index 8ba5819cc1..0eedddc861 100644
--- a/BaseTools/Source/Python/Common/Misc.py
+++ b/BaseTools/Source/Python/Common/Misc.py
@@ -35,6 +35,7 @@ from BuildToolError import *
from CommonDataClass.DataClass import *
from Parsing import GetSplitValueList
from Common.LongFilePathSupport import OpenLongFilePath as open
+from Common.MultipleWorkspace import MultipleWorkspace as mws
## Regular expression used to find out place holders in string template
gPlaceholderPattern = re.compile("\$\{([^$()\s]+)\}", re.MULTILINE|re.UNICODE)
@@ -1728,6 +1729,7 @@ class PathClass(object):
# Remove any '.' and '..' in path
if self.Root:
+ self.Root = mws.getWs(self.Root, self.File)
self.Path = os.path.normpath(os.path.join(self.Root, self.File))
self.Root = os.path.normpath(CommonPath([self.Root, self.Path]))
# eliminate the side-effect of 'C:'
@@ -1838,7 +1840,10 @@ class PathClass(object):
RealFile = os.path.join(self.AlterRoot, self.File)
elif self.Root:
RealFile = os.path.join(self.Root, self.File)
- return FILE_NOT_FOUND, os.path.join(self.AlterRoot, RealFile)
+ if len (mws.getPkgPath()) == 0:
+ return FILE_NOT_FOUND, os.path.join(self.AlterRoot, RealFile)
+ else:
+ return FILE_NOT_FOUND, "%s is not found in packages path:\n\t%s" % (self.File, '\n\t'.join(mws.getPkgPath()))
ErrorCode = 0
ErrorInfo = ''
diff --git a/BaseTools/Source/Python/Common/String.py b/BaseTools/Source/Python/Common/String.py
index 6c9671d514..5c8d1e0ded 100644
--- a/BaseTools/Source/Python/Common/String.py
+++ b/BaseTools/Source/Python/Common/String.py
@@ -24,6 +24,7 @@ import GlobalData
from BuildToolError import *
from CommonDataClass.Exceptions import *
from Common.LongFilePathSupport import OpenLongFilePath as open
+from Common.MultipleWorkspace import MultipleWorkspace as mws
gHexVerPatt = re.compile('0x[a-f0-9]{4}[a-f0-9]{4}$', re.IGNORECASE)
gHumanReadableVerPatt = re.compile(r'([1-9][0-9]*|0)\.[0-9]{1,2}$')
@@ -305,6 +306,11 @@ def NormPath(Path, Defines={}):
# To local path format
#
Path = os.path.normpath(Path)
+ if Path.startswith(GlobalData.gWorkspace) and not os.path.exists(Path):
+ Path = Path[len (GlobalData.gWorkspace):]
+ if Path[0] == os.path.sep:
+ Path = Path[1:]
+ Path = mws.join(GlobalData.gWorkspace, Path)
if IsRelativePath and Path[0] != '.':
Path = os.path.join('.', Path)
@@ -702,7 +708,7 @@ def RaiseParserError(Line, Section, File, Format='', LineNo= -1):
# @retval string A full path
#
def WorkspaceFile(WorkspaceDir, Filename):
- return os.path.join(NormPath(WorkspaceDir), NormPath(Filename))
+ return mws.join(NormPath(WorkspaceDir), NormPath(Filename))
## Split string
#
diff --git a/BaseTools/Source/Python/Ecc/Check.py b/BaseTools/Source/Python/Ecc/Check.py
index 7932fb3394..5e5c8e72e4 100644
--- a/BaseTools/Source/Python/Ecc/Check.py
+++ b/BaseTools/Source/Python/Ecc/Check.py
@@ -19,6 +19,7 @@ from MetaDataParser import ParseHeaderCommentSection
import EccGlobalData
import c
from Common.LongFilePathSupport import OpenLongFilePath as open
+from Common.MultipleWorkspace import MultipleWorkspace as mws
## Check
#
@@ -380,9 +381,7 @@ class Check(object):
for Key in RecordDict:
if len(RecordDict[Key]) > 1:
for Item in RecordDict[Key]:
- Path = Item[1].replace(EccGlobalData.gWorkspace, '')
- if Path.startswith('\\') or Path.startswith('/'):
- Path = Path[1:]
+ Path = mws.relpath(Item[1], EccGlobalData.gWorkspace)
if not EccGlobalData.gException.IsException(ERROR_INCLUDE_FILE_CHECK_NAME, Path):
EccGlobalData.gDb.TblReport.Insert(ERROR_INCLUDE_FILE_CHECK_NAME, OtherMsg="The file name for [%s] is duplicate" % Path, BelongsToTable='File', BelongsToItem=Item[0])
@@ -653,7 +652,7 @@ class Check(object):
if LibraryClass[1].upper() == 'NULL' or LibraryClass[1].startswith('!ifdef') or LibraryClass[1].startswith('!ifndef') or LibraryClass[1].endswith('!endif'):
continue
else:
- LibraryIns = os.path.normpath(os.path.join(EccGlobalData.gWorkspace, LibraryClass[2]))
+ LibraryIns = os.path.normpath(mws.join(EccGlobalData.gWorkspace, LibraryClass[2]))
SqlCommand = """select Value3 from Inf where BelongsToFile =
(select ID from File where lower(FullPath) = lower('%s'))
and Value2 = '%s'""" % (LibraryIns, 'LIBRARY_CLASS')
@@ -729,7 +728,7 @@ class Check(object):
for Record in RecordSet:
FdfID = Record[0]
FilePath = Record[1]
- FilePath = os.path.normpath(os.path.join(EccGlobalData.gWorkspace, FilePath))
+ FilePath = os.path.normpath(mws.join(EccGlobalData.gWorkspace, FilePath))
SqlCommand = """select ID from Inf where Model = %s and BelongsToFile = (select ID from File where FullPath like '%s')
""" % (MODEL_EFI_SOURCE_FILE, FilePath)
NewRecordSet = EccGlobalData.gDb.TblFile.Exec(SqlCommand)
@@ -913,9 +912,7 @@ class Check(object):
RecordSet = Table.Exec(SqlCommand)
Path = ""
for Record in RecordSet:
- Path = Record[0].replace(EccGlobalData.gWorkspace, '')
- if Path.startswith('\\') or Path.startswith('/'):
- Path = Path[1:]
+ Path = mws.relpath(Record[0], EccGlobalData.gWorkspace)
return Path
# Check whether two module INFs under one workspace has the same FILE_GUID value
@@ -1223,7 +1220,10 @@ class Check(object):
SqlCommand = """select ID, Name from %s where Model = %s""" % (FileTable, MODEL_IDENTIFIER_VARIABLE)
RecordSet = EccGlobalData.gDb.TblFile.Exec(SqlCommand)
for Record in RecordSet:
- if not Pattern.match(Record[1]):
+ Var = Record[1]
+ if Var.startswith('CONST'):
+ Var = Var[5:].lstrip()
+ if not Pattern.match(Var):
if not EccGlobalData.gException.IsException(ERROR_NAMING_CONVENTION_CHECK_VARIABLE_NAME, Record[1]):
EccGlobalData.gDb.TblReport.Insert(ERROR_NAMING_CONVENTION_CHECK_VARIABLE_NAME, OtherMsg="The variable name [%s] does not follow the rules" % (Record[1]), BelongsToTable=FileTable, BelongsToItem=Record[0])
diff --git a/BaseTools/Source/Python/Ecc/Ecc.py b/BaseTools/Source/Python/Ecc/Ecc.py
index ec8f6c22cf..c2ad4faff4 100644
--- a/BaseTools/Source/Python/Ecc/Ecc.py
+++ b/BaseTools/Source/Python/Ecc/Ecc.py
@@ -38,6 +38,7 @@ import c
import re, string
from Exception import *
from Common.LongFilePathSupport import OpenLongFilePath as open
+from Common.MultipleWorkspace import MultipleWorkspace as mws
## Ecc
#
@@ -70,8 +71,13 @@ class Ecc(object):
#
WorkspaceDir = os.path.normcase(os.path.normpath(os.environ["WORKSPACE"]))
os.environ["WORKSPACE"] = WorkspaceDir
+
+ # set multiple workspace
+ PackagesPath = os.getenv("PACKAGES_PATH")
+ mws.setWs(WorkspaceDir, PackagesPath)
+
if "ECP_SOURCE" not in os.environ:
- os.environ["ECP_SOURCE"] = os.path.join(WorkspaceDir, GlobalData.gEdkCompatibilityPkg)
+ os.environ["ECP_SOURCE"] = mws.join(WorkspaceDir, GlobalData.gEdkCompatibilityPkg)
if "EFI_SOURCE" not in os.environ:
os.environ["EFI_SOURCE"] = os.environ["ECP_SOURCE"]
if "EDK_SOURCE" not in os.environ:
diff --git a/BaseTools/Source/Python/Ecc/MetaDataParser.py b/BaseTools/Source/Python/Ecc/MetaDataParser.py
index d80a5cff5d..82ede3eb33 100644
--- a/BaseTools/Source/Python/Ecc/MetaDataParser.py
+++ b/BaseTools/Source/Python/Ecc/MetaDataParser.py
@@ -14,6 +14,7 @@
import Common.LongFilePathOs as os
from CommonDataClass.DataClass import *
from EccToolError import *
+from Common.MultipleWorkspace import MultipleWorkspace as mws
import EccGlobalData
import re
## Get the inlcude path list for a source file
@@ -33,8 +34,8 @@ def GetIncludeListOfFile(WorkSpace, Filepath, Db):
% (MODEL_META_DATA_PACKAGE, MODEL_EFI_SOURCE_FILE, '\\', Filepath)
RecordSet = Db.TblFile.Exec(SqlCommand)
for Record in RecordSet:
- DecFullPath = os.path.normpath(os.path.join(WorkSpace, Record[0]))
- InfFullPath = os.path.normpath(os.path.join(WorkSpace, Record[1]))
+ DecFullPath = os.path.normpath(mws.join(WorkSpace, Record[0]))
+ InfFullPath = os.path.normpath(mws.join(WorkSpace, Record[1]))
(DecPath, DecName) = os.path.split(DecFullPath)
(InfPath, InfName) = os.path.split(InfFullPath)
SqlCommand = """select Value1 from Dec where BelongsToFile =
diff --git a/BaseTools/Source/Python/Ecc/c.py b/BaseTools/Source/Python/Ecc/c.py
index dcb37e5632..256b9e021c 100644
--- a/BaseTools/Source/Python/Ecc/c.py
+++ b/BaseTools/Source/Python/Ecc/c.py
@@ -1271,7 +1271,10 @@ def CheckFuncLayoutReturnType(FullFileName):
FuncName = Result[5]
if EccGlobalData.gException.IsException(ERROR_C_FUNCTION_LAYOUT_CHECK_RETURN_TYPE, FuncName):
continue
- Index = Result[0].find(TypeStart)
+ Result0 = Result[0]
+ if Result0.upper().startswith('STATIC'):
+ Result0 = Result0[6:].strip()
+ Index = Result0.find(TypeStart)
if Index != 0 or Result[3] != 0:
PrintErrorMsg(ERROR_C_FUNCTION_LAYOUT_CHECK_RETURN_TYPE, '[%s] Return Type should appear at the start of line' % FuncName, FileTable, Result[1])
@@ -1313,9 +1316,10 @@ def CheckFuncLayoutModifier(FullFileName):
for Result in ResultSet:
ReturnType = GetDataTypeFromModifier(Result[0])
TypeStart = ReturnType.split()[0]
-# if len(ReturnType) == 0:
-# continue
- Index = Result[0].find(TypeStart)
+ Result0 = Result[0]
+ if Result0.upper().startswith('STATIC'):
+ Result0 = Result0[6:].strip()
+ Index = Result0.find(TypeStart)
if Index != 0:
PrintErrorMsg(ERROR_C_FUNCTION_LAYOUT_CHECK_OPTIONAL_FUNCTIONAL_MODIFIER, '', FileTable, Result[1])
@@ -1327,8 +1331,6 @@ def CheckFuncLayoutModifier(FullFileName):
for Result in ResultSet:
ReturnType = GetDataTypeFromModifier(Result[0])
TypeStart = ReturnType.split()[0]
-# if len(ReturnType) == 0:
-# continue
Result0 = Result[0]
if Result0.upper().startswith('STATIC'):
Result0 = Result0[6:].strip()
@@ -1631,6 +1633,8 @@ def CheckMemberVariableFormat(Name, Value, FileTable, TdId, ModelId):
Field = Field.strip()
if Field == '':
continue
+ if Field.startswith("#"):
+ continue
# Enum could directly assign value to variable
Field = Field.split('=')[0].strip()
TokenList = Field.split()
diff --git a/BaseTools/Source/Python/GenFds/FfsInfStatement.py b/BaseTools/Source/Python/GenFds/FfsInfStatement.py
index 29dc75f433..ed767d3fa6 100644
--- a/BaseTools/Source/Python/GenFds/FfsInfStatement.py
+++ b/BaseTools/Source/Python/GenFds/FfsInfStatement.py
@@ -28,6 +28,7 @@ import Section
import RuleSimpleFile
import RuleComplexFile
from CommonDataClass.FdfClass import FfsInfStatementClassObject
+from Common.MultipleWorkspace import MultipleWorkspace as mws
from Common.String import *
from Common.Misc import PathClass
from Common.Misc import GuidStructureByteArrayToGuidString
@@ -365,7 +366,7 @@ class FfsInfStatement(FfsInfStatementClassObject):
#
self.__InfParse__(Dict)
- SrcFile = os.path.join( GenFdsGlobalVariable.WorkSpaceDir , self.InfFileName);
+ SrcFile = mws.join( GenFdsGlobalVariable.WorkSpaceDir , self.InfFileName);
DestFile = os.path.join( self.OutputPath, self.ModuleGuid + '.ffs')
SrcFileDir = "."
@@ -511,7 +512,7 @@ class FfsInfStatement(FfsInfStatementClassObject):
#
def __GetPlatformArchList__(self):
- InfFileKey = os.path.normpath(os.path.join(GenFdsGlobalVariable.WorkSpaceDir, self.InfFileName))
+ InfFileKey = os.path.normpath(mws.join(GenFdsGlobalVariable.WorkSpaceDir, self.InfFileName))
DscArchList = []
PlatformDataBase = GenFdsGlobalVariable.WorkSpace.BuildObject[GenFdsGlobalVariable.ActivePlatform, 'IA32', GenFdsGlobalVariable.TargetName, GenFdsGlobalVariable.ToolChainTag]
if PlatformDataBase != None:
@@ -878,7 +879,7 @@ class FfsInfStatement(FfsInfStatementClassObject):
if not HasGneratedFlag:
UniVfrOffsetFileSection = ""
- ModuleFileName = os.path.join(GenFdsGlobalVariable.WorkSpaceDir, self.InfFileName)
+ ModuleFileName = mws.join(GenFdsGlobalVariable.WorkSpaceDir, self.InfFileName)
InfData = GenFdsGlobalVariable.WorkSpace.BuildObject[PathClass(ModuleFileName), self.CurrentArch]
#
# Search the source list in InfData to find if there are .vfr file exist.
diff --git a/BaseTools/Source/Python/GenFds/GenFds.py b/BaseTools/Source/Python/GenFds/GenFds.py
index c2ad4e0e2a..a0beff0391 100644
--- a/BaseTools/Source/Python/GenFds/GenFds.py
+++ b/BaseTools/Source/Python/GenFds/GenFds.py
@@ -39,6 +39,7 @@ from Common.Misc import SaveFileOnChange
from Common.Misc import ClearDuplicatedInf
from Common.Misc import GuidStructureStringToGuidString
from Common.BuildVersion import gBUILD_VERSION
+from Common.MultipleWorkspace import MultipleWorkspace as mws
## Version and Copyright
versionNumber = "1.0" + ' ' + gBUILD_VERSION
@@ -94,6 +95,10 @@ def main():
if (Options.debug):
GenFdsGlobalVariable.VerboseLogger( "Using Workspace:" + Workspace)
os.chdir(GenFdsGlobalVariable.WorkSpaceDir)
+
+ # set multiple workspace
+ PackagesPath = os.getenv("PACKAGES_PATH")
+ mws.setWs(GenFdsGlobalVariable.WorkSpaceDir, PackagesPath)
if (Options.filename):
FdfFilename = Options.filename
@@ -102,7 +107,7 @@ def main():
if FdfFilename[0:2] == '..':
FdfFilename = os.path.realpath(FdfFilename)
if not os.path.isabs (FdfFilename):
- FdfFilename = os.path.join(GenFdsGlobalVariable.WorkSpaceDir, FdfFilename)
+ FdfFilename = mws.join(GenFdsGlobalVariable.WorkSpaceDir, FdfFilename)
if not os.path.exists(FdfFilename):
EdkLogger.error("GenFds", FILE_NOT_FOUND, ExtraData=FdfFilename)
@@ -129,13 +134,13 @@ def main():
ActivePlatform = os.path.realpath(ActivePlatform)
if not os.path.isabs (ActivePlatform):
- ActivePlatform = os.path.join(GenFdsGlobalVariable.WorkSpaceDir, ActivePlatform)
+ ActivePlatform = mws.join(GenFdsGlobalVariable.WorkSpaceDir, ActivePlatform)
if not os.path.exists(ActivePlatform) :
EdkLogger.error("GenFds", FILE_NOT_FOUND, "ActivePlatform doesn't exist!")
if os.path.normcase (ActivePlatform).find(Workspace) == 0:
- ActivePlatform = ActivePlatform[len(Workspace):]
+ ActivePlatform = mws.relpath(ActivePlatform, Workspace)
if len(ActivePlatform) > 0 :
if ActivePlatform[0] == '\\' or ActivePlatform[0] == '/':
ActivePlatform = ActivePlatform[1:]
@@ -159,7 +164,7 @@ def main():
ConfDirectoryPath = os.path.join(GenFdsGlobalVariable.WorkSpaceDir, ConfDirectoryPath)
else:
# Get standard WORKSPACE/Conf, use the absolute path to the WORKSPACE/Conf
- ConfDirectoryPath = os.path.join(GenFdsGlobalVariable.WorkSpaceDir, 'Conf')
+ ConfDirectoryPath = mws.join(GenFdsGlobalVariable.WorkSpaceDir, 'Conf')
GenFdsGlobalVariable.ConfDir = ConfDirectoryPath
BuildConfigurationFile = os.path.normpath(os.path.join(ConfDirectoryPath, "target.txt"))
if os.path.isfile(BuildConfigurationFile) == True:
diff --git a/BaseTools/Source/Python/GenFds/GenFdsGlobalVariable.py b/BaseTools/Source/Python/GenFds/GenFdsGlobalVariable.py
index 04bbc300ce..5bdc1b8288 100644
--- a/BaseTools/Source/Python/GenFds/GenFdsGlobalVariable.py
+++ b/BaseTools/Source/Python/GenFds/GenFdsGlobalVariable.py
@@ -31,6 +31,7 @@ from AutoGen.BuildEngine import BuildRule
import Common.DataType as DataType
from Common.Misc import PathClass
from Common.LongFilePathSupport import OpenLongFilePath as open
+from Common.MultipleWorkspace import MultipleWorkspace as mws
## Global variables
#
@@ -322,12 +323,13 @@ class GenFdsGlobalVariable:
# @param String String that may contain macro
#
def ReplaceWorkspaceMacro(String):
+ String = mws.handleWsMacro(String)
Str = String.replace('$(WORKSPACE)', GenFdsGlobalVariable.WorkSpaceDir)
if os.path.exists(Str):
if not os.path.isabs(Str):
Str = os.path.abspath(Str)
else:
- Str = os.path.join(GenFdsGlobalVariable.WorkSpaceDir, String)
+ Str = mws.join(GenFdsGlobalVariable.WorkSpaceDir, String)
return os.path.normpath(Str)
## Check if the input files are newer than output files
diff --git a/BaseTools/Source/Python/GenFds/Region.py b/BaseTools/Source/Python/GenFds/Region.py
index 15b2ecba90..feb56cb60f 100644
--- a/BaseTools/Source/Python/GenFds/Region.py
+++ b/BaseTools/Source/Python/GenFds/Region.py
@@ -24,6 +24,7 @@ from stat import *
from Common import EdkLogger
from Common.BuildToolError import *
from Common.LongFilePathSupport import OpenLongFilePath as open
+from Common.MultipleWorkspace import MultipleWorkspace as mws
## generate Region
#
@@ -205,7 +206,7 @@ class Region(RegionClassObject):
for RegionData in self.RegionDataList:
RegionData = GenFdsGlobalVariable.MacroExtend(RegionData, MacroDict)
if RegionData[1] != ':' :
- RegionData = os.path.join (GenFdsGlobalVariable.WorkSpaceDir, RegionData)
+ RegionData = mws.join (GenFdsGlobalVariable.WorkSpaceDir, RegionData)
if not os.path.exists(RegionData):
EdkLogger.error("GenFds", FILE_NOT_FOUND, ExtraData=RegionData)
#
diff --git a/BaseTools/Source/Python/Makefile b/BaseTools/Source/Python/Makefile
index 4044fcefeb..d3f1baa831 100644
--- a/BaseTools/Source/Python/Makefile
+++ b/BaseTools/Source/Python/Makefile
@@ -59,6 +59,7 @@ COMMON_PYTHON=$(BASE_TOOLS_PATH)\Source\Python\Common\BuildToolError.py \
$(BASE_TOOLS_PATH)\Source\Python\Common\ToolDefClassObject.py \
$(BASE_TOOLS_PATH)\Source\Python\Common\VpdInfoFile.py \
$(BASE_TOOLS_PATH)\Source\Python\Common\BuildVersion.py \
+ $(BASE_TOOLS_PATH)\Source\Python\Common\MultipleWorkspace.py \
$(BASE_TOOLS_PATH)\Source\Python\CommonDataClass\CommonClass.py \
$(BASE_TOOLS_PATH)\Source\Python\CommonDataClass\DataClass.py \
$(BASE_TOOLS_PATH)\Source\Python\CommonDataClass\Exceptions.py \
diff --git a/BaseTools/Source/Python/UPT/Core/DistributionPackageClass.py b/BaseTools/Source/Python/UPT/Core/DistributionPackageClass.py
index bfe6dcc70f..9c55e0ea88 100644
--- a/BaseTools/Source/Python/UPT/Core/DistributionPackageClass.py
+++ b/BaseTools/Source/Python/UPT/Core/DistributionPackageClass.py
@@ -32,6 +32,7 @@ from Logger.ToolError import EDK1_INF_ERROR
from Object.POM.CommonObject import IdentificationObject
from Object.POM.CommonObject import CommonHeaderObject
from Object.POM.CommonObject import MiscFileObject
+from Common.MultipleWorkspace import MultipleWorkspace as mws
## DistributionPackageHeaderClass
#
@@ -110,14 +111,17 @@ class DistributionPackageClass(object):
# @param ModuleList: A list of all modules
#
def GetDistributionPackage(self, WorkspaceDir, PackageList, ModuleList):
+ # Backup WorkspaceDir
+ Root = WorkspaceDir
+
#
# Get Packages
#
if PackageList:
for PackageFile in PackageList:
- PackageFileFullPath = \
- os.path.normpath(os.path.join(WorkspaceDir, PackageFile))
- DecObj = DecPomAlignment(PackageFileFullPath, WorkspaceDir, CheckMulDec = True)
+ PackageFileFullPath = mws.join(Root, PackageFile)
+ WorkspaceDir = mws.getWs(Root, PackageFile)
+ DecObj = DecPomAlignment(PackageFileFullPath, WorkspaceDir, CheckMulDec=True)
PackageObj = DecObj
#
# Parser inf file one bye one
@@ -140,8 +144,7 @@ class DistributionPackageClass(object):
# Inf class in InfPomAlignment.
#
try:
- ModuleObj = InfPomAlignment(Filename, WorkspaceDir, \
- PackageObj.GetPackagePath())
+ ModuleObj = InfPomAlignment(Filename, WorkspaceDir, PackageObj.GetPackagePath())
#
# Add module to package
@@ -168,11 +171,11 @@ class DistributionPackageClass(object):
#
if ModuleList:
for ModuleFile in ModuleList:
- ModuleFileFullPath = \
- os.path.normpath(os.path.join(WorkspaceDir, ModuleFile))
+ ModuleFileFullPath = mws.join(Root, ModuleFile)
+ WorkspaceDir = mws.getWs(Root, ModuleFile)
+
try:
- ModuleObj = InfPomAlignment(ModuleFileFullPath,
- WorkspaceDir)
+ ModuleObj = InfPomAlignment(ModuleFileFullPath, WorkspaceDir)
ModuleKey = (ModuleObj.GetGuid(),
ModuleObj.GetVersion(),
ModuleObj.GetName(),
@@ -185,7 +188,10 @@ class DistributionPackageClass(object):
ST.WRN_EDK1_INF_FOUND%ModuleFileFullPath,
ExtraData=ST.ERR_NOT_SUPPORTED_SA_MODULE)
else:
- raise
+ raise
+
+ # Recover WorkspaceDir
+ WorkspaceDir = Root
## Get all files included for a distribution package, except tool/misc of
# distribution level
diff --git a/BaseTools/Source/Python/UPT/Core/PackageFile.py b/BaseTools/Source/Python/UPT/Core/PackageFile.py
index 47ea0bc0a9..5fafd85bff 100644
--- a/BaseTools/Source/Python/UPT/Core/PackageFile.py
+++ b/BaseTools/Source/Python/UPT/Core/PackageFile.py
@@ -37,6 +37,7 @@ from Logger import StringTable as ST
from Library.Misc import CreateDirectory
from Library.Misc import RemoveDirectory
from Core.FileHook import __FileHookOpen__
+from Common.MultipleWorkspace import MultipleWorkspace as mws
class PackageFile:
@@ -203,8 +204,11 @@ class PackageFile:
# @param Files: the files to pack
#
def PackFiles(self, Files):
- for File1 in Files:
- self.PackFile(File1)
+ for File in Files:
+ Cwd = os.getcwd()
+ os.chdir(mws.getWs(mws.WORKSPACE, File))
+ self.PackFile(File)
+ os.chdir(Cwd)
## Pack the file
#
diff --git a/BaseTools/Source/Python/UPT/Library/GlobalData.py b/BaseTools/Source/Python/UPT/Library/GlobalData.py
index d478983c23..8f446d4888 100644
--- a/BaseTools/Source/Python/UPT/Library/GlobalData.py
+++ b/BaseTools/Source/Python/UPT/Library/GlobalData.py
@@ -19,6 +19,7 @@ GlobalData
# The workspace directory
#
gWORKSPACE = '.'
+gPACKAGE_PATH = None
#
# INF module directory
@@ -107,4 +108,4 @@ gPackageDict = {}
# Used by Library instance parser
# {FilePath: FileObj}
#
-gLIBINSTANCEDICT = {} \ No newline at end of file
+gLIBINSTANCEDICT = {}
diff --git a/BaseTools/Source/Python/UPT/Library/Misc.py b/BaseTools/Source/Python/UPT/Library/Misc.py
index bc9e0e172b..0d92cb3767 100644
--- a/BaseTools/Source/Python/UPT/Library/Misc.py
+++ b/BaseTools/Source/Python/UPT/Library/Misc.py
@@ -50,6 +50,7 @@ from Library.ParserValidate import IsValidHexVersion
from Library.ParserValidate import IsValidPath
from Object.POM.CommonObject import TextObject
from Core.FileHook import __FileHookOpen__
+from Common.MultipleWorkspace import MultipleWorkspace as mws
## Convert GUID string in xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx style to C
# structure style
@@ -592,7 +593,11 @@ def GetWorkspace():
if WorkspaceDir[-1] == ':':
WorkspaceDir += os.sep
- return WorkspaceDir
+
+ PackagesPath = os.environ.get("PACKAGES_PATH")
+ mws.setWs(WorkspaceDir, PackagesPath)
+
+ return WorkspaceDir, mws.PACKAGES_PATH
## Get relative path
#
diff --git a/BaseTools/Source/Python/UPT/Library/ParserValidate.py b/BaseTools/Source/Python/UPT/Library/ParserValidate.py
index e973227898..028cf9a54f 100644
--- a/BaseTools/Source/Python/UPT/Library/ParserValidate.py
+++ b/BaseTools/Source/Python/UPT/Library/ParserValidate.py
@@ -27,6 +27,7 @@ from Library.DataType import TAB_SPACE_SPLIT
from Library.String import GetSplitValueList
from Library.ExpressionValidate import IsValidBareCString
from Library.ExpressionValidate import IsValidFeatureFlagExp
+from Common.MultipleWorkspace import MultipleWorkspace as mws
## __HexDigit() method
#
@@ -236,7 +237,7 @@ def IsValidPath(Path, Root):
Path = os.path.normpath(Path).replace('\\', '/')
Root = os.path.normpath(Root).replace('\\', '/')
- FullPath = os.path.normpath(os.path.join(Root, Path)).replace('\\', '/')
+ FullPath = mws.join(Root, Path)
if not os.path.exists(FullPath):
return False
diff --git a/BaseTools/Source/Python/UPT/Library/Parsing.py b/BaseTools/Source/Python/UPT/Library/Parsing.py
index ace3e0d118..c34e775144 100644
--- a/BaseTools/Source/Python/UPT/Library/Parsing.py
+++ b/BaseTools/Source/Python/UPT/Library/Parsing.py
@@ -827,21 +827,23 @@ def GetPkgInfoFromDec(Path):
def GetWorkspacePackage():
DecFileList = []
WorkspaceDir = GlobalData.gWORKSPACE
- for Root, Dirs, Files in os.walk(WorkspaceDir):
- if 'CVS' in Dirs:
- Dirs.remove('CVS')
- if '.svn' in Dirs:
- Dirs.remove('.svn')
- for Dir in Dirs:
- if Dir.startswith('.'):
- Dirs.remove(Dir)
- for FileSp in Files:
- if FileSp.startswith('.'):
- continue
- Ext = os.path.splitext(FileSp)[1]
- if Ext.lower() in ['.dec']:
- DecFileList.append\
- (os.path.normpath(os.path.join(Root, FileSp)))
+ PackageDir = GlobalData.gPACKAGE_PATH
+ for PkgRoot in [WorkspaceDir] + PackageDir:
+ for Root, Dirs, Files in os.walk(PkgRoot):
+ if 'CVS' in Dirs:
+ Dirs.remove('CVS')
+ if '.svn' in Dirs:
+ Dirs.remove('.svn')
+ for Dir in Dirs:
+ if Dir.startswith('.'):
+ Dirs.remove(Dir)
+ for FileSp in Files:
+ if FileSp.startswith('.'):
+ continue
+ Ext = os.path.splitext(FileSp)[1]
+ if Ext.lower() in ['.dec']:
+ DecFileList.append\
+ (os.path.normpath(os.path.join(Root, FileSp)))
#
# abstract package guid, version info from DecFile List
#
diff --git a/BaseTools/Source/Python/UPT/MkPkg.py b/BaseTools/Source/Python/UPT/MkPkg.py
index 2eb84588bd..87c84f0cc2 100644
--- a/BaseTools/Source/Python/UPT/MkPkg.py
+++ b/BaseTools/Source/Python/UPT/MkPkg.py
@@ -50,6 +50,7 @@ from Library.ParserValidate import IsValidPath
from Core.DistributionPackageClass import DistributionPackageClass
from Core.PackageFile import PackageFile
+from Common.MultipleWorkspace import MultipleWorkspace as mws
## CheckForExistingDp
#
@@ -136,7 +137,7 @@ def Main(Options = None):
# write().
#
FromFile = os.path.normpath(FileObject.GetURI()).encode('utf_8')
- FileFullPath = os.path.normpath(os.path.join(WorkspaceDir, FromFile))
+ FileFullPath = mws.join(WorkspaceDir, FromFile)
if FileFullPath in RePkgDict:
(DpGuid, DpVersion, DpName, Repackage) = RePkgDict[FileFullPath]
if not Repackage:
@@ -183,7 +184,7 @@ def Main(Options = None):
DistPkg.Header.RePackage = True
Cwd = getcwd()
- chdir(WorkspaceDir)
+ chdir(WorkspaceDir)
ContentFile.PackFiles(FileList)
chdir(Cwd)
@@ -264,7 +265,7 @@ def CheckFileList(QualifiedExt, FileList, ErrorStringExt, ErrorStringFullPath):
ErrorStringExt % Item)
Item = os.path.normpath(Item)
- Path = os.path.normpath(os.path.join(WorkspaceDir, Item))
+ Path = mws.join(WorkspaceDir, Item)
if not os.path.exists(Path):
Logger.Error("\nMkPkg", FILE_NOT_FOUND, ST.ERR_NOT_FOUND % Item)
elif Item == Path:
diff --git a/BaseTools/Source/Python/UPT/PomAdapter/InfPomAlignment.py b/BaseTools/Source/Python/UPT/PomAdapter/InfPomAlignment.py
index 22e9ef5fc0..a151732853 100644
--- a/BaseTools/Source/Python/UPT/PomAdapter/InfPomAlignment.py
+++ b/BaseTools/Source/Python/UPT/PomAdapter/InfPomAlignment.py
@@ -51,7 +51,7 @@ from PomAdapter.InfPomAlignmentMisc import GenModuleHeaderUserExt
from PomAdapter.InfPomAlignmentMisc import GenBinaryData
from Parser import InfParser
from PomAdapter.DecPomAlignment import DecPomAlignment
-
+from Common.MultipleWorkspace import MultipleWorkspace as mws
## InfPomAlignment
#
@@ -534,8 +534,7 @@ class InfPomAlignment(ModuleObject):
PackageDependency.SetSupArchList(ConvertArchList(PackageItemObj.GetSupArchList()))
PackageDependency.SetFeatureFlag(PackageItemObj.GetFeatureFlagExp())
- PkgInfo = GetPkgInfoFromDec(os.path.normpath(os.path.join(self.WorkSpace,
- NormPath(PackageItemObj.GetPackageName()))))
+ PkgInfo = GetPkgInfoFromDec(mws.join(self.WorkSpace, NormPath(PackageItemObj.GetPackageName())))
if PkgInfo[1] and PkgInfo[2]:
PackageDependency.SetGuid(PkgInfo[1])
PackageDependency.SetVersion(PkgInfo[2])
diff --git a/BaseTools/Source/Python/UPT/UPT.py b/BaseTools/Source/Python/UPT/UPT.py
index e7b0a8f264..17decda5c3 100644
--- a/BaseTools/Source/Python/UPT/UPT.py
+++ b/BaseTools/Source/Python/UPT/UPT.py
@@ -39,6 +39,7 @@ from Logger.ToolError import FILE_TYPE_MISMATCH
from Logger.ToolError import OPTION_CONFLICT
from Logger.ToolError import FatalError
from Logger.ToolError import UPT_ALREADY_INSTALLED_ERROR
+from Common.MultipleWorkspace import MultipleWorkspace as mws
import MkPkg
import InstallPkg
@@ -164,7 +165,7 @@ def Main():
setattr(Opt, Var[0], Var[1])
try:
- GlobalData.gWORKSPACE = GetWorkspace()
+ GlobalData.gWORKSPACE, GlobalData.gPACKAGE_PATH = GetWorkspace()
except FatalError, XExcept:
if Logger.GetLevel() <= Logger.DEBUG_9:
Logger.Quiet(ST.MSG_PYTHON_ON % (python_version(), platform) + format_exc())
diff --git a/BaseTools/Source/Python/Workspace/MetaFileParser.py b/BaseTools/Source/Python/Workspace/MetaFileParser.py
index fe1f7fd6f6..e7d6df6595 100644
--- a/BaseTools/Source/Python/Workspace/MetaFileParser.py
+++ b/BaseTools/Source/Python/Workspace/MetaFileParser.py
@@ -343,9 +343,14 @@ class MetaFileParser(object):
Name, Value = self._ValueList[1], self._ValueList[2]
# Sometimes, we need to make differences between EDK and EDK2 modules
if Name == 'INF_VERSION':
- try:
- self._Version = int(Value, 0)
- except:
+ if re.match(r'0[xX][\da-f-A-F]{5,8}', Value):
+ self._Version = int(Value, 0)
+ elif re.match(r'\d+\.\d+', Value):
+ ValueList = Value.split('.')
+ Major = '%04o' % int(ValueList[0], 0)
+ Minor = '%04o' % int(ValueList[1], 0)
+ self._Version = int('0x' + Major + Minor, 0)
+ else:
EdkLogger.error('Parser', FORMAT_INVALID, "Invalid version number",
ExtraData=self._CurrentLine, File=self.MetaFile, Line=self._LineIndex + 1)
diff --git a/BaseTools/Source/Python/Workspace/WorkspaceDatabase.py b/BaseTools/Source/Python/Workspace/WorkspaceDatabase.py
index fd10c5dfb9..46eb5d3a8c 100644
--- a/BaseTools/Source/Python/Workspace/WorkspaceDatabase.py
+++ b/BaseTools/Source/Python/Workspace/WorkspaceDatabase.py
@@ -21,6 +21,7 @@ import uuid
import Common.EdkLogger as EdkLogger
import Common.GlobalData as GlobalData
+from Common.MultipleWorkspace import MultipleWorkspace as mws
from Common.String import *
from Common.DataType import *
@@ -166,7 +167,7 @@ class DscBuildData(PlatformBuildClassObject):
ModuleFile = PathClass(NormPath(Record[0]), GlobalData.gWorkspace, Arch=self._Arch)
RecordList = self._RawData[MODEL_META_DATA_COMPONENT_SOURCE_OVERRIDE_PATH, self._Arch, None, ModuleId]
if RecordList != []:
- SourceOverridePath = os.path.join(GlobalData.gWorkspace, NormPath(RecordList[0][0]))
+ SourceOverridePath = mws.join(GlobalData.gWorkspace, NormPath(RecordList[0][0]))
# Check if the source override path exists
if not os.path.isdir(SourceOverridePath):
@@ -1954,7 +1955,13 @@ class InfBuildData(ModuleBuildClassObject):
RecordList = self._RawData[MODEL_META_DATA_HEADER, self._Arch, self._Platform]
for Record in RecordList:
if Record[1] == TAB_INF_DEFINES_INF_VERSION:
- self._AutoGenVersion = int(Record[2], 0)
+ if '.' in Record[2]:
+ ValueList = Record[2].split('.')
+ Major = '%04o' % int(ValueList[0], 0)
+ Minor = '%04o' % int(ValueList[1], 0)
+ self._AutoGenVersion = int('0x' + Major + Minor, 0)
+ else:
+ self._AutoGenVersion = int(Record[2], 0)
break
if self._AutoGenVersion == None:
self._AutoGenVersion = 0x00010000
@@ -2179,8 +2186,11 @@ class InfBuildData(ModuleBuildClassObject):
if self.AutoGenVersion < 0x00010005:
Macros["EDK_SOURCE"] = GlobalData.gEcpSource
Macros['PROCESSOR'] = self._Arch
+ SourceFile = NormPath(Record[0], Macros)
+ if SourceFile[0] == os.path.sep:
+ SourceFile = mws.join(GlobalData.gWorkspace, SourceFile[1:])
# old module source files (Edk)
- File = PathClass(NormPath(Record[0], Macros), self._ModuleDir, self._SourceOverridePath,
+ File = PathClass(SourceFile, self._ModuleDir, self._SourceOverridePath,
'', False, self._Arch, ToolChainFamily, '', TagName, ToolCode)
# check the file validation
ErrorCode, ErrorInfo = File.Validate(CaseSensitive=False)
@@ -2343,10 +2353,21 @@ class InfBuildData(ModuleBuildClassObject):
if File[0] == '.':
File = os.path.join(self._ModuleDir, File)
else:
- File = os.path.join(GlobalData.gWorkspace, File)
+ File = mws.join(GlobalData.gWorkspace, File)
File = RealPath(os.path.normpath(File))
if File:
self._Includes.append(File)
+ if not File and Record[0].find('EFI_SOURCE') > -1:
+ # tricky to regard WorkSpace as EFI_SOURCE
+ Macros['EFI_SOURCE'] = GlobalData.gWorkspace
+ File = NormPath(Record[0], Macros)
+ if File[0] == '.':
+ File = os.path.join(self._ModuleDir, File)
+ else:
+ File = os.path.join(GlobalData.gWorkspace, File)
+ File = RealPath(os.path.normpath(File))
+ if File:
+ self._Includes.append(File)
return self._Includes
## Retrieve packages this module depends on
@@ -2797,7 +2818,7 @@ class WorkspaceDatabase(object):
def __init__(self, DbPath, RenewDb=False):
self._DbClosedFlag = False
if not DbPath:
- DbPath = os.path.normpath(os.path.join(GlobalData.gWorkspace, 'Conf', GlobalData.gDatabasePath))
+ DbPath = os.path.normpath(mws.join(GlobalData.gWorkspace, 'Conf', GlobalData.gDatabasePath))
# don't create necessary path for db in memory
if DbPath != ':memory:':
diff --git a/BaseTools/toolsetup.bat b/BaseTools/toolsetup.bat
index 2afa8103ec..59874c5839 100755
--- a/BaseTools/toolsetup.bat
+++ b/BaseTools/toolsetup.bat
@@ -113,30 +113,43 @@ if /I "%1"=="/?" goto Usage
:set_PATH
if defined WORKSPACE_TOOLS_PATH goto check_PATH
- set PATH=%EDK_TOOLS_PATH%\Bin;%EDK_TOOLS_PATH%\Bin\Win32;%PATH%
+ if not defined EDK_TOOLS_BIN (
+ if exist %EDK_TOOLS_PATH%\Bin\Win32 (
+ set EDK_TOOLS_BIN=%EDK_TOOLS_PATH%\Bin\Win32
+ ) else (
+ echo.
+ echo !!! ERROR !!! Cannot find BaseTools Bin Win32!!!
+ echo Please check the directory %EDK_TOOLS_PATH%\Bin\Win32
+ echo Or configure EDK_TOOLS_BIN env to point Win32 directory.
+ echo.
+ goto end
+ )
+ )
+ set PATH=%EDK_TOOLS_BIN%;%PATH%
set WORKSPACE_TOOLS_PATH=%EDK_TOOLS_PATH%
goto PATH_ok
:check_PATH
if "%EDK_TOOLS_PATH%"=="%WORKSPACE_TOOLS_PATH%" goto PATH_ok
- set PATH=%EDK_TOOLS_PATH%\Bin;%EDK_TOOLS_PATH%\Bin\Win32;%PATH%
+ if not defined EDK_TOOLS_BIN (
+ if exist %EDK_TOOLS_PATH%\Bin\Win32 (
+ set EDK_TOOLS_BIN=%EDK_TOOLS_PATH%\Bin\Win32
+ ) else (
+ echo.
+ echo !!! ERROR !!! Cannot find BaseTools Bin Win32!!!
+ echo Please check the directory %EDK_TOOLS_PATH%\Bin\Win32
+ echo Or configure EDK_TOOLS_BIN env to point Win32 directory.
+ echo.
+ goto end
+ )
+ )
+ set PATH=%EDK_TOOLS_BIN%;%PATH%
set WORKSPACE_TOOLS_PATH=%EDK_TOOLS_PATH%
echo Resetting the PATH variable to include the EDK_TOOLS_PATH for this session.
:PATH_ok
- echo PATH = %PATH%
- echo.
- if defined WORKSPACE (
- echo WORKSPACE = %WORKSPACE%
- )
- echo EDK_TOOLS_PATH = %EDK_TOOLS_PATH%
- if defined BASE_TOOLS_PATH (
- echo BASE_TOOLS_PATH = %BASE_TOOLS_PATH%
- )
- echo.
-
REM
-REM copy *.template to %WORKSPACE%\Conf
+REM copy *.template to %CONF_PATH%
REM
if not defined WORKSPACE (
if defined RECONFIG (
@@ -147,49 +160,80 @@ if not defined WORKSPACE (
goto skip_reconfig
)
-if NOT exist %WORKSPACE%\Conf (
- mkdir %WORKSPACE%\Conf
+set CONF_PATH=%WORKSPACE%\Conf
+if NOT exist %CONF_PATH% (
+ if defined PACKAGES_PATH (
+ for %%i IN (%PACKAGES_PATH%) DO (
+ if exist %%~fi\Conf (
+ set CONF_PATH=%%i\Conf
+ goto CopyConf
+ )
+ )
+ )
+)
+
+:CopyConf
+if NOT exist %CONF_PATH% (
+ mkdir %CONF_PATH%
) else (
if defined RECONFIG (
echo.
- echo Over-writing the files in the WORKSPACE\Conf directory
+ echo Over-writing the files in the CONF_PATH directory
echo using the default template files
echo.
)
)
-if NOT exist %WORKSPACE%\Conf\target.txt (
- echo copying ... target.template to %WORKSPACE%\Conf\target.txt
+if NOT exist %CONF_PATH%\target.txt (
+ echo copying ... target.template to %CONF_PATH%\target.txt
if NOT exist %EDK_TOOLS_PATH%\Conf\target.template (
echo Error: target.template is missing at folder %EDK_TOOLS_PATH%\Conf\
)
- copy %EDK_TOOLS_PATH%\Conf\target.template %WORKSPACE%\Conf\target.txt > nul
+ copy %EDK_TOOLS_PATH%\Conf\target.template %CONF_PATH%\target.txt > nul
) else (
- if defined RECONFIG echo over-write ... target.template to %WORKSPACE%\Conf\target.txt
- if defined RECONFIG copy /Y %EDK_TOOLS_PATH%\Conf\target.template %WORKSPACE%\Conf\target.txt > nul
+ if defined RECONFIG echo over-write ... target.template to %CONF_PATH%\target.txt
+ if defined RECONFIG copy /Y %EDK_TOOLS_PATH%\Conf\target.template %CONF_PATH%\target.txt > nul
)
-if NOT exist %WORKSPACE%\Conf\tools_def.txt (
- echo copying ... tools_def.template to %WORKSPACE%\Conf\tools_def.txt
+if NOT exist %CONF_PATH%\tools_def.txt (
+ echo copying ... tools_def.template to %CONF_PATH%\tools_def.txt
if NOT exist %EDK_TOOLS_PATH%\Conf\tools_def.template (
echo Error: tools_def.template is missing at folder %EDK_TOOLS_PATH%\Conf\
)
- copy %EDK_TOOLS_PATH%\Conf\tools_def.template %WORKSPACE%\Conf\tools_def.txt > nul
+ copy %EDK_TOOLS_PATH%\Conf\tools_def.template %CONF_PATH%\tools_def.txt > nul
) else (
- if defined RECONFIG echo over-write ... tools_def.template to %WORKSPACE%\Conf\tools_def.txt
- if defined RECONFIG copy /Y %EDK_TOOLS_PATH%\Conf\tools_def.template %WORKSPACE%\Conf\tools_def.txt > nul
+ if defined RECONFIG echo over-write ... tools_def.template to %CONF_PATH%\tools_def.txt
+ if defined RECONFIG copy /Y %EDK_TOOLS_PATH%\Conf\tools_def.template %CONF_PATH%\tools_def.txt > nul
)
-if NOT exist %WORKSPACE%\Conf\build_rule.txt (
- echo copying ... build_rule.template to %WORKSPACE%\Conf\build_rule.txt
+if NOT exist %CONF_PATH%\build_rule.txt (
+ echo copying ... build_rule.template to %CONF_PATH%\build_rule.txt
if NOT exist %EDK_TOOLS_PATH%\Conf\build_rule.template (
echo Error: build_rule.template is missing at folder %EDK_TOOLS_PATH%\Conf\
)
- copy %EDK_TOOLS_PATH%\Conf\build_rule.template %WORKSPACE%\Conf\build_rule.txt > nul
+ copy %EDK_TOOLS_PATH%\Conf\build_rule.template %CONF_PATH%\build_rule.txt > nul
) else (
- if defined RECONFIG echo over-write ... build_rule.template to %WORKSPACE%\Conf\build_rule.txt
- if defined RECONFIG copy /Y %EDK_TOOLS_PATH%\Conf\build_rule.template %WORKSPACE%\Conf\build_rule.txt > nul
+ if defined RECONFIG echo over-write ... build_rule.template to %CONF_PATH%\build_rule.txt
+ if defined RECONFIG copy /Y %EDK_TOOLS_PATH%\Conf\build_rule.template %CONF_PATH%\build_rule.txt > nul
+)
+
+echo PATH = %PATH%
+echo.
+if defined WORKSPACE (
+ echo WORKSPACE = %WORKSPACE%
+)
+if defined PACKAGES_PATH (
+ echo PACKAGES_PATH = %PACKAGES_PATH%
+)
+echo EDK_TOOLS_PATH = %EDK_TOOLS_PATH%
+if defined BASE_TOOLS_PATH (
+ echo BASE_TOOLS_PATH = %BASE_TOOLS_PATH%
+)
+if defined EDK_TOOLS_BIN (
+ echo EDK_TOOLS_BIN = %EDK_TOOLS_BIN%
)
+echo CONF_PATH = %CONF_PATH%
+echo.
:skip_reconfig
@@ -198,28 +242,26 @@ if NOT exist %WORKSPACE%\Conf\build_rule.txt (
@REM
if defined FORCE_REBUILD goto check_build_environment
if defined REBUILD goto check_build_environment
-if not exist "%EDK_TOOLS_PATH%\Bin" goto check_build_environment
-
-IF NOT EXIST "%EDK_TOOLS_PATH%\Bin\Win32\BootSectImage.exe" goto check_build_environment
-IF NOT EXIST "%EDK_TOOLS_PATH%\Bin\Win32\build.exe" goto check_build_environment
-IF NOT EXIST "%EDK_TOOLS_PATH%\Bin\Win32\EfiLdrImage.exe" goto check_build_environment
-IF NOT EXIST "%EDK_TOOLS_PATH%\Bin\Win32\EfiRom.exe" goto check_build_environment
-IF NOT EXIST "%EDK_TOOLS_PATH%\Bin\Win32\GenBootSector.exe" goto check_build_environment
-IF NOT EXIST "%EDK_TOOLS_PATH%\Bin\Win32\GenFds.exe" goto check_build_environment
-IF NOT EXIST "%EDK_TOOLS_PATH%\Bin\Win32\GenFfs.exe" goto check_build_environment
-IF NOT EXIST "%EDK_TOOLS_PATH%\Bin\Win32\GenFv.exe" goto check_build_environment
-IF NOT EXIST "%EDK_TOOLS_PATH%\Bin\Win32\GenFw.exe" goto check_build_environment
-IF NOT EXIST "%EDK_TOOLS_PATH%\Bin\Win32\GenPage.exe" goto check_build_environment
-IF NOT EXIST "%EDK_TOOLS_PATH%\Bin\Win32\GenSec.exe" goto check_build_environment
-IF NOT EXIST "%EDK_TOOLS_PATH%\Bin\Win32\GenVtf.exe" goto check_build_environment
-IF NOT EXIST "%EDK_TOOLS_PATH%\Bin\Win32\MigrationMsa2Inf.exe" goto check_build_environment
-IF NOT EXIST "%EDK_TOOLS_PATH%\Bin\Win32\Split.exe" goto check_build_environment
-IF NOT EXIST "%EDK_TOOLS_PATH%\Bin\Win32\TargetTool.exe" goto check_build_environment
-IF NOT EXIST "%EDK_TOOLS_PATH%\Bin\Win32\TianoCompress.exe" goto check_build_environment
-IF NOT EXIST "%EDK_TOOLS_PATH%\Bin\Win32\Trim.exe" goto check_build_environment
-IF NOT EXIST "%EDK_TOOLS_PATH%\Bin\Win32\VfrCompile.exe" goto check_build_environment
-IF NOT EXIST "%EDK_TOOLS_PATH%\Bin\Win32\Fpd2Dsc.exe" goto check_build_environment
-IF NOT EXIST "%EDK_TOOLS_PATH%\Bin\Win32\VolInfo.exe" goto check_build_environment
+if not exist "%EDK_TOOLS_PATH%" goto check_build_environment
+
+IF NOT EXIST "%EDK_TOOLS_BIN%\BootSectImage.exe" goto check_build_environment
+IF NOT EXIST "%EDK_TOOLS_BIN%\build.exe" goto check_build_environment
+IF NOT EXIST "%EDK_TOOLS_BIN%\EfiLdrImage.exe" goto check_build_environment
+IF NOT EXIST "%EDK_TOOLS_BIN%\EfiRom.exe" goto check_build_environment
+IF NOT EXIST "%EDK_TOOLS_BIN%\GenBootSector.exe" goto check_build_environment
+IF NOT EXIST "%EDK_TOOLS_BIN%\GenFds.exe" goto check_build_environment
+IF NOT EXIST "%EDK_TOOLS_BIN%\GenFfs.exe" goto check_build_environment
+IF NOT EXIST "%EDK_TOOLS_BIN%\GenFv.exe" goto check_build_environment
+IF NOT EXIST "%EDK_TOOLS_BIN%\GenFw.exe" goto check_build_environment
+IF NOT EXIST "%EDK_TOOLS_BIN%\GenPage.exe" goto check_build_environment
+IF NOT EXIST "%EDK_TOOLS_BIN%\GenSec.exe" goto check_build_environment
+IF NOT EXIST "%EDK_TOOLS_BIN%\GenVtf.exe" goto check_build_environment
+IF NOT EXIST "%EDK_TOOLS_BIN%\Split.exe" goto check_build_environment
+IF NOT EXIST "%EDK_TOOLS_BIN%\TargetTool.exe" goto check_build_environment
+IF NOT EXIST "%EDK_TOOLS_BIN%\TianoCompress.exe" goto check_build_environment
+IF NOT EXIST "%EDK_TOOLS_BIN%\Trim.exe" goto check_build_environment
+IF NOT EXIST "%EDK_TOOLS_BIN%\VfrCompile.exe" goto check_build_environment
+IF NOT EXIST "%EDK_TOOLS_BIN%\VolInfo.exe" goto check_build_environment
goto end