summaryrefslogtreecommitdiffstats
path: root/BaseTools/Source/Python/GenFds/GenFds.py
diff options
context:
space:
mode:
Diffstat (limited to 'BaseTools/Source/Python/GenFds/GenFds.py')
-rw-r--r--BaseTools/Source/Python/GenFds/GenFds.py36
1 files changed, 32 insertions, 4 deletions
diff --git a/BaseTools/Source/Python/GenFds/GenFds.py b/BaseTools/Source/Python/GenFds/GenFds.py
index c5ccda677b..c4e433d425 100644
--- a/BaseTools/Source/Python/GenFds/GenFds.py
+++ b/BaseTools/Source/Python/GenFds/GenFds.py
@@ -36,6 +36,7 @@ from Common import EdkLogger
from Common.String import *
from Common.Misc import DirCache,PathClass
from Common.Misc import SaveFileOnChange
+from Common.Misc import ClearDuplicatedInf
from Common.Misc import GuidStructureStringToGuidString
from Common.BuildVersion import gBUILD_VERSION
@@ -149,15 +150,36 @@ def main():
GenFdsGlobalVariable.ActivePlatform = PathClass(NormPath(ActivePlatform), Workspace)
- BuildConfigurationFile = os.path.normpath(os.path.join(GenFdsGlobalVariable.WorkSpaceDir, "Conf/target.txt"))
+ if (Options.ConfDirectory):
+ # Get alternate Conf location, if it is absolute, then just use the absolute directory name
+ ConfDirectoryPath = os.path.normpath(Options.ConfDirectory)
+ if ConfDirectoryPath.startswith('"'):
+ ConfDirectoryPath = ConfDirectoryPath[1:]
+ if ConfDirectoryPath.endswith('"'):
+ ConfDirectoryPath = ConfDirectoryPath[:-1]
+ if not os.path.isabs(ConfDirectoryPath):
+ # Since alternate directory name is not absolute, the alternate directory is located within the WORKSPACE
+ # This also handles someone specifying the Conf directory in the workspace. Using --conf=Conf
+ 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')
+ GenFdsGlobalVariable.ConfDir = ConfDirectoryPath
+ BuildConfigurationFile = os.path.normpath(os.path.join(ConfDirectoryPath, "target.txt"))
if os.path.isfile(BuildConfigurationFile) == True:
TargetTxtClassObject.TargetTxtClassObject(BuildConfigurationFile)
else:
EdkLogger.error("GenFds", FILE_NOT_FOUND, ExtraData=BuildConfigurationFile)
+ #Set global flag for build mode
+ GlobalData.gIgnoreSource = Options.IgnoreSources
+
if Options.Macros:
for Pair in Options.Macros:
- Pair = Pair.strip('"')
+ if Pair.startswith('"'):
+ Pair = Pair[1:]
+ if Pair.endswith('"'):
+ Pair = Pair[:-1]
List = Pair.split('=')
if len(List) == 2:
if List[0].strip() == "EFI_SOURCE":
@@ -177,7 +199,8 @@ def main():
os.environ["WORKSPACE"] = Workspace
"""call Workspace build create database"""
- BuildWorkSpace = WorkspaceDatabase(None)
+ GlobalData.gDatabasePath = os.path.normpath(os.path.join(ConfDirectoryPath, GlobalData.gDatabasePath))
+ BuildWorkSpace = WorkspaceDatabase(GlobalData.gDatabasePath)
BuildWorkSpace.InitDatabase()
#
@@ -276,11 +299,13 @@ def main():
"\nPython",
CODE_ERROR,
"Tools code failure",
- ExtraData="Please send email to edk2-buildtools-devel@lists.sourceforge.net for help, attaching following call stack trace!\n",
+ ExtraData="Please send email to edk2-devel@lists.sourceforge.net for help, attaching following call stack trace!\n",
RaiseError=False
)
EdkLogger.quiet(traceback.format_exc())
ReturnCode = CODE_ERROR
+ finally:
+ ClearDuplicatedInf()
return ReturnCode
gParamCheck = []
@@ -321,6 +346,9 @@ def myOptionParser():
action="callback", callback=SingleCheckCallback)
Parser.add_option("-D", "--define", action="append", type="string", dest="Macros", help="Macro: \"Name [= Value]\".")
Parser.add_option("-s", "--specifyaddress", dest="FixedAddress", action="store_true", type=None, help="Specify driver load address.")
+ Parser.add_option("--conf", action="store", type="string", dest="ConfDirectory", help="Specify the customized Conf directory.")
+ Parser.add_option("--ignore-sources", action="store_true", dest="IgnoreSources", default=False, help="Focus to a binary build and ignore all source files")
+
(Options, args) = Parser.parse_args()
return Options