]> git.proxmox.com Git - mirror_edk2.git/blob - BaseTools/Source/Python/GenFds/GenFds.py
Check In tool source code based on Build tool project revision r1655.
[mirror_edk2.git] / BaseTools / Source / Python / GenFds / GenFds.py
1 ## @file
2 # generate flash image
3 #
4 # Copyright (c) 2007, Intel Corporation
5 #
6 # All rights reserved. This program and the accompanying materials
7 # are licensed and made available under the terms and conditions of the BSD License
8 # which accompanies this distribution. The full text of the license may be found at
9 # http://opensource.org/licenses/bsd-license.php
10 #
11 # THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
12 # WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
13 #
14
15 ##
16 # Import Modules
17 #
18 from optparse import OptionParser
19 import sys
20 import os
21 import linecache
22 import FdfParser
23 from Common.BuildToolError import *
24 from GenFdsGlobalVariable import GenFdsGlobalVariable
25 from Workspace.WorkspaceDatabase import WorkspaceDatabase
26 from Workspace.BuildClassObject import PcdClassObject
27 from Workspace.BuildClassObject import ModuleBuildClassObject
28 import RuleComplexFile
29 from EfiSection import EfiSection
30 import StringIO
31 import Common.TargetTxtClassObject as TargetTxtClassObject
32 import Common.ToolDefClassObject as ToolDefClassObject
33 import Common.DataType
34 import Common.GlobalData as GlobalData
35 from Common import EdkLogger
36 from Common.String import *
37 from Common.Misc import DirCache,PathClass
38
39 ## Version and Copyright
40 versionNumber = "1.0"
41 __version__ = "%prog Version " + versionNumber
42 __copyright__ = "Copyright (c) 2007, Intel Corporation All rights reserved."
43
44 ## Tool entrance method
45 #
46 # This method mainly dispatch specific methods per the command line options.
47 # If no error found, return zero value so the caller of this tool can know
48 # if it's executed successfully or not.
49 #
50 # @retval 0 Tool was successful
51 # @retval 1 Tool failed
52 #
53 def main():
54 global Options
55 Options = myOptionParser()
56
57 global Workspace
58 Workspace = ""
59 ArchList = None
60 ReturnCode = 0
61
62 EdkLogger.Initialize()
63 try:
64 if Options.verbose != None:
65 EdkLogger.SetLevel(EdkLogger.VERBOSE)
66 GenFdsGlobalVariable.VerboseMode = True
67
68 if Options.FixedAddress != None:
69 GenFdsGlobalVariable.FixedLoadAddress = True
70
71 if Options.quiet != None:
72 EdkLogger.SetLevel(EdkLogger.QUIET)
73 if Options.debug != None:
74 EdkLogger.SetLevel(Options.debug + 1)
75 GenFdsGlobalVariable.DebugLevel = Options.debug
76 else:
77 EdkLogger.SetLevel(EdkLogger.INFO)
78
79 if (Options.Workspace == None):
80 EdkLogger.error("GenFds", BuildToolError.OPTION_MISSING, "WORKSPACE not defined",
81 ExtraData="Please use '-w' switch to pass it or set the WORKSPACE environment variable.")
82 elif not os.path.exists(Options.Workspace):
83 EdkLogger.error("GenFds", BuildToolError.PARAMETER_INVALID, "WORKSPACE is invalid",
84 ExtraData="Please use '-w' switch to pass it or set the WORKSPACE environment variable.")
85 else:
86 Workspace = os.path.normcase(Options.Workspace)
87 GenFdsGlobalVariable.WorkSpaceDir = Workspace
88 if 'EDK_SOURCE' in os.environ.keys():
89 GenFdsGlobalVariable.EdkSourceDir = os.path.normcase(os.environ['EDK_SOURCE'])
90 if (Options.debug):
91 GenFdsGlobalVariable.VerboseLogger( "Using Workspace:" + Workspace)
92 os.chdir(GenFdsGlobalVariable.WorkSpaceDir)
93
94 if (Options.filename):
95 FdfFilename = Options.filename
96 FdfFilename = GenFdsGlobalVariable.ReplaceWorkspaceMacro(FdfFilename)
97 else:
98 EdkLogger.error("GenFds", BuildToolError.OPTION_MISSING, "Missing FDF filename")
99
100 if (Options.BuildTarget):
101 GenFdsGlobalVariable.TargetName = Options.BuildTarget
102 else:
103 EdkLogger.error("GenFds", BuildToolError.OPTION_MISSING, "Missing build target")
104
105 if (Options.ToolChain):
106 GenFdsGlobalVariable.ToolChainTag = Options.ToolChain
107 else:
108 EdkLogger.error("GenFds", BuildToolError.OPTION_MISSING, "Missing tool chain tag")
109
110 if FdfFilename[0:2] == '..':
111 FdfFilename = os.path.realpath(FdfFilename)
112 if FdfFilename[1] != ':':
113 FdfFilename = os.path.join(GenFdsGlobalVariable.WorkSpaceDir, FdfFilename)
114
115 if not os.path.exists(FdfFilename):
116 EdkLogger.error("GenFds", BuildToolError.FILE_NOT_FOUND, ExtraData=FdfFilename)
117 GenFdsGlobalVariable.FdfFile = FdfFilename
118 GenFdsGlobalVariable.FdfFileTimeStamp = os.path.getmtime(FdfFilename)
119
120 if (Options.activePlatform):
121 ActivePlatform = Options.activePlatform
122 ActivePlatform = GenFdsGlobalVariable.ReplaceWorkspaceMacro(ActivePlatform)
123
124 if ActivePlatform[0:2] == '..':
125 ActivePlatform = os.path.realpath(ActivePlatform)
126
127 if ActivePlatform[1] != ':':
128 ActivePlatform = os.path.join(GenFdsGlobalVariable.WorkSpaceDir, ActivePlatform)
129
130 if not os.path.exists(ActivePlatform) :
131 EdkLogger.error("GenFds", BuildToolError.FILE_NOT_FOUND, "ActivePlatform doesn't exist!")
132
133 if ActivePlatform.find(Workspace) == -1:
134 EdkLogger.error("GenFds", BuildToolError.FILE_NOT_FOUND, "ActivePlatform doesn't exist in Workspace!")
135
136 ActivePlatform = ActivePlatform.replace(Workspace, '')
137 if len(ActivePlatform) > 0 :
138 if ActivePlatform[0] == '\\' or ActivePlatform[0] == '/':
139 ActivePlatform = ActivePlatform[1:]
140 else:
141 EdkLogger.error("GenFds", BuildToolError.FILE_NOT_FOUND, "ActivePlatform doesn't exist!")
142 else :
143 EdkLogger.error("GenFds", BuildToolError.OPTION_MISSING, "Missing active platform")
144
145 GenFdsGlobalVariable.ActivePlatform = PathClass(NormPath(ActivePlatform), Workspace)
146
147 BuildConfigurationFile = os.path.normpath(os.path.join(GenFdsGlobalVariable.WorkSpaceDir, "Conf/target.txt"))
148 if os.path.isfile(BuildConfigurationFile) == True:
149 TargetTxtClassObject.TargetTxtClassObject(BuildConfigurationFile)
150 else:
151 EdkLogger.error("GenFds", BuildToolError.FILE_NOT_FOUND, ExtraData=BuildConfigurationFile)
152
153 if Options.Macros:
154 for Pair in Options.Macros:
155 Pair.strip('"')
156 List = Pair.split('=')
157 if len(List) == 2:
158 FdfParser.InputMacroDict[List[0].strip()] = List[1].strip()
159 if List[0].strip() == "EFI_SOURCE":
160 GlobalData.gEfiSource = List[1].strip()
161 elif List[0].strip() == "EDK_SOURCE":
162 GlobalData.gEdkSource = List[1].strip()
163 else:
164 GlobalData.gEdkGlobal[List[0].strip()] = List[1].strip()
165 else:
166 FdfParser.InputMacroDict[List[0].strip()] = None
167
168 """call Workspace build create database"""
169 os.environ["WORKSPACE"] = Workspace
170 BuildWorkSpace = WorkspaceDatabase(':memory:', GlobalData.gGlobalDefines)
171 BuildWorkSpace.InitDatabase()
172
173 #
174 # Get files real name in workspace dir
175 #
176 GlobalData.gAllFiles = DirCache(Workspace)
177 GlobalData.gWorkspace = Workspace
178
179 if (Options.archList) :
180 ArchList = Options.archList.split(',')
181 else:
182 # EdkLogger.error("GenFds", BuildToolError.OPTION_MISSING, "Missing build ARCH")
183 ArchList = BuildWorkSpace.BuildObject[GenFdsGlobalVariable.ActivePlatform, 'COMMON'].SupArchList
184
185 TargetArchList = set(BuildWorkSpace.BuildObject[GenFdsGlobalVariable.ActivePlatform, 'COMMON'].SupArchList) & set(ArchList)
186 if len(TargetArchList) == 0:
187 EdkLogger.error("GenFds", GENFDS_ERROR, "Target ARCH %s not in platform supported ARCH %s" % (str(ArchList), str(BuildWorkSpace.BuildObject[GenFdsGlobalVariable.ActivePlatform, 'COMMON'].SupArchList)))
188
189 for Arch in ArchList:
190 GenFdsGlobalVariable.OutputDirFromDscDict[Arch] = NormPath(BuildWorkSpace.BuildObject[GenFdsGlobalVariable.ActivePlatform, Arch].OutputDirectory)
191
192 if (Options.outputDir):
193 OutputDirFromCommandLine = GenFdsGlobalVariable.ReplaceWorkspaceMacro(Options.outputDir)
194 for Arch in ArchList:
195 GenFdsGlobalVariable.OutputDirDict[Arch] = OutputDirFromCommandLine
196 else:
197 for Arch in ArchList:
198 GenFdsGlobalVariable.OutputDirDict[Arch] = os.path.join(GenFdsGlobalVariable.OutputDirFromDscDict[Arch], GenFdsGlobalVariable.TargetName + '_' + GenFdsGlobalVariable.ToolChainTag)
199
200 for Key in GenFdsGlobalVariable.OutputDirDict:
201 OutputDir = GenFdsGlobalVariable.OutputDirDict[Key]
202 if OutputDir[0:2] == '..':
203 OutputDir = os.path.realpath(OutputDir)
204
205 if OutputDir[1] != ':':
206 OutputDir = os.path.join (GenFdsGlobalVariable.WorkSpaceDir, OutputDir)
207
208 if not os.path.exists(OutputDir):
209 EdkLogger.error("GenFds", BuildToolError.FILE_NOT_FOUND, ExtraData=OutputDir)
210 GenFdsGlobalVariable.OutputDirDict[Key] = OutputDir
211
212 """ Parse Fdf file, has to place after build Workspace as FDF may contain macros from DSC file """
213 FdfParserObj = FdfParser.FdfParser(FdfFilename)
214 FdfParserObj.ParseFile()
215
216 if FdfParserObj.CycleReferenceCheck():
217 EdkLogger.error("GenFds", BuildToolError.FORMAT_NOT_SUPPORTED, "Cycle Reference Detected in FDF file")
218
219 if (Options.uiFdName) :
220 if Options.uiFdName.upper() in FdfParserObj.Profile.FdDict.keys():
221 GenFds.OnlyGenerateThisFd = Options.uiFdName
222 else:
223 EdkLogger.error("GenFds", BuildToolError.OPTION_VALUE_INVALID,
224 "No such an FD in FDF file: %s" % Options.uiFdName)
225
226 if (Options.uiFvName) :
227 if Options.uiFvName.upper() in FdfParserObj.Profile.FvDict.keys():
228 GenFds.OnlyGenerateThisFv = Options.uiFvName
229 else:
230 EdkLogger.error("GenFds", BuildToolError.OPTION_VALUE_INVALID,
231 "No such an FV in FDF file: %s" % Options.uiFvName)
232
233 """Modify images from build output if the feature of loading driver at fixed address is on."""
234 if GenFdsGlobalVariable.FixedLoadAddress:
235 GenFds.PreprocessImage(BuildWorkSpace, GenFdsGlobalVariable.ActivePlatform)
236 """Call GenFds"""
237 GenFds.GenFd('', FdfParserObj, BuildWorkSpace, ArchList)
238
239 """Display FV space info."""
240 GenFds.DisplayFvSpaceInfo(FdfParserObj)
241
242 except FdfParser.Warning, X:
243 EdkLogger.error(X.ToolName, BuildToolError.FORMAT_INVALID, File=X.FileName, Line=X.LineNumber, ExtraData=X.Message, RaiseError = False)
244 ReturnCode = BuildToolError.FORMAT_INVALID
245 except FatalError, X:
246 if Options.debug != None:
247 import traceback
248 EdkLogger.quiet(traceback.format_exc())
249 ReturnCode = X.args[0]
250 except:
251 import traceback
252 EdkLogger.error(
253 "\nPython",
254 CODE_ERROR,
255 "Tools code failure",
256 ExtraData="Please submit bug report in www.TianoCore.org, attaching following call stack trace!\n",
257 RaiseError=False
258 )
259 EdkLogger.quiet(traceback.format_exc())
260 ReturnCode = CODE_ERROR
261 return ReturnCode
262
263 gParamCheck = []
264 def SingleCheckCallback(option, opt_str, value, parser):
265 if option not in gParamCheck:
266 setattr(parser.values, option.dest, value)
267 gParamCheck.append(option)
268 else:
269 parser.error("Option %s only allows one instance in command line!" % option)
270
271 ## Parse command line options
272 #
273 # Using standard Python module optparse to parse command line option of this tool.
274 #
275 # @retval Opt A optparse.Values object containing the parsed options
276 # @retval Args Target of build command
277 #
278 def myOptionParser():
279 usage = "%prog [options] -f input_file -a arch_list -b build_target -p active_platform -t tool_chain_tag -D \"MacroName [= MacroValue]\""
280 Parser = OptionParser(usage=usage,description=__copyright__,version="%prog " + str(versionNumber))
281 Parser.add_option("-f", "--file", dest="filename", type="string", help="Name of FDF file to convert", action="callback", callback=SingleCheckCallback)
282 Parser.add_option("-a", "--arch", dest="archList", help="comma separated list containing one or more of: IA32, X64, IPF, ARM or EBC which should be built, overrides target.txt?s TARGET_ARCH")
283 Parser.add_option("-q", "--quiet", action="store_true", type=None, help="Disable all messages except FATAL ERRORS.")
284 Parser.add_option("-v", "--verbose", action="store_true", type=None, help="Turn on verbose output with informational messages printed.")
285 Parser.add_option("-d", "--debug", action="store", type="int", help="Enable debug messages at specified level.")
286 Parser.add_option("-p", "--platform", type="string", dest="activePlatform", help="Set the ACTIVE_PLATFORM, overrides target.txt ACTIVE_PLATFORM setting.",
287 action="callback", callback=SingleCheckCallback)
288 Parser.add_option("-w", "--workspace", type="string", dest="Workspace", default=os.environ.get('WORKSPACE'), help="Set the WORKSPACE",
289 action="callback", callback=SingleCheckCallback)
290 Parser.add_option("-o", "--outputDir", type="string", dest="outputDir", help="Name of Build Output directory",
291 action="callback", callback=SingleCheckCallback)
292 Parser.add_option("-r", "--rom_image", dest="uiFdName", help="Build the image using the [FD] section named by FdUiName.")
293 Parser.add_option("-i", "--FvImage", dest="uiFvName", help="Buld the FV image using the [FV] section named by UiFvName")
294 Parser.add_option("-b", "--buildtarget", type="choice", choices=['DEBUG','RELEASE'], dest="BuildTarget", help="Build TARGET is one of list: DEBUG, RELEASE.",
295 action="callback", callback=SingleCheckCallback)
296 Parser.add_option("-t", "--tagname", type="string", dest="ToolChain", help="Using the tools: TOOL_CHAIN_TAG name to build the platform.",
297 action="callback", callback=SingleCheckCallback)
298 Parser.add_option("-D", "--define", action="append", type="string", dest="Macros", help="Macro: \"Name [= Value]\".")
299 Parser.add_option("-s", "--specifyaddress", dest="FixedAddress", action="store_true", type=None, help="Specify driver load address.")
300 (Options, args) = Parser.parse_args()
301 return Options
302
303 ## The class implementing the EDK2 flash image generation process
304 #
305 # This process includes:
306 # 1. Collect workspace information, includes platform and module information
307 # 2. Call methods of Fd class to generate FD
308 # 3. Call methods of Fv class to generate FV that not belong to FD
309 #
310 class GenFds :
311 FdfParsef = None
312 # FvName in FDF, FvBinFile name
313 FvBinDict = {}
314 OnlyGenerateThisFd = None
315 OnlyGenerateThisFv = None
316
317 ## GenFd()
318 #
319 # @param OutputDir Output directory
320 # @param FdfParser FDF contents parser
321 # @param Workspace The directory of workspace
322 # @param ArchList The Arch list of platform
323 #
324 def GenFd (OutputDir, FdfParser, WorkSpace, ArchList):
325 GenFdsGlobalVariable.SetDir ('', FdfParser, WorkSpace, ArchList)
326
327 GenFdsGlobalVariable.VerboseLogger(" Gen Fd !")
328 if GenFds.OnlyGenerateThisFd != None and GenFds.OnlyGenerateThisFd.upper() in GenFdsGlobalVariable.FdfParser.Profile.FdDict.keys():
329 FdObj = GenFdsGlobalVariable.FdfParser.Profile.FdDict.get(GenFds.OnlyGenerateThisFd.upper())
330 if FdObj != None:
331 FdObj.GenFd(GenFds.FvBinDict)
332 elif GenFds.OnlyGenerateThisFv == None:
333 for FdName in GenFdsGlobalVariable.FdfParser.Profile.FdDict.keys():
334 FdObj = GenFdsGlobalVariable.FdfParser.Profile.FdDict[FdName]
335 FdObj.GenFd(GenFds.FvBinDict)
336
337 GenFdsGlobalVariable.VerboseLogger(" Gen FV ! ")
338 if GenFds.OnlyGenerateThisFv != None and GenFds.OnlyGenerateThisFv.upper() in GenFdsGlobalVariable.FdfParser.Profile.FvDict.keys():
339 FvObj = GenFdsGlobalVariable.FdfParser.Profile.FvDict.get(GenFds.OnlyGenerateThisFv.upper())
340 if FvObj != None:
341 Buffer = StringIO.StringIO()
342 # Get FV base Address
343 FvObj.AddToBuffer(Buffer, None, GenFds.GetFvBlockSize(FvObj))
344 Buffer.close()
345 return
346 elif GenFds.OnlyGenerateThisFd == None:
347 for FvName in GenFdsGlobalVariable.FdfParser.Profile.FvDict.keys():
348 Buffer = StringIO.StringIO('')
349 FvObj = GenFdsGlobalVariable.FdfParser.Profile.FvDict[FvName]
350 # Get FV base Address
351 FvObj.AddToBuffer(Buffer, None, GenFds.GetFvBlockSize(FvObj))
352 Buffer.close()
353
354 if GenFds.OnlyGenerateThisFv == None and GenFds.OnlyGenerateThisFd == None:
355 GenFdsGlobalVariable.VerboseLogger(" Gen Capsule !")
356 for CapsuleObj in GenFdsGlobalVariable.FdfParser.Profile.CapsuleList:
357 CapsuleObj.GenCapsule()
358
359 if GenFdsGlobalVariable.FdfParser.Profile.OptRomDict != {}:
360 GenFdsGlobalVariable.VerboseLogger(" Gen Option ROM !")
361 for DriverName in GenFdsGlobalVariable.FdfParser.Profile.OptRomDict.keys():
362 OptRomObj = GenFdsGlobalVariable.FdfParser.Profile.OptRomDict[DriverName]
363 OptRomObj.AddToBuffer(None)
364
365 ## GetFvBlockSize()
366 #
367 # @param FvObj Whose block size to get
368 # @retval int Block size value
369 #
370 def GetFvBlockSize(FvObj):
371 DefaultBlockSize = 0x10000
372 FdObj = None
373 if GenFds.OnlyGenerateThisFd != None and GenFds.OnlyGenerateThisFd.upper() in GenFdsGlobalVariable.FdfParser.Profile.FdDict.keys():
374 FdObj = GenFdsGlobalVariable.FdfParser.Profile.FdDict[GenFds.OnlyGenerateThisFd.upper()]
375 if FdObj == None:
376 for ElementFd in GenFdsGlobalVariable.FdfParser.Profile.FdDict.values():
377 for ElementRegion in ElementFd.RegionList:
378 if ElementRegion.RegionType == 'FV':
379 for ElementRegionData in ElementRegion.RegionDataList:
380 if ElementRegionData != None and ElementRegionData.upper() == FvObj.UiFvName:
381 if FvObj.BlockSizeList != []:
382 return FvObj.BlockSizeList[0][0]
383 else:
384 return ElementRegion.BlockSizeOfRegion(ElementFd.BlockSizeList)
385 if FvObj.BlockSizeList != []:
386 return FvObj.BlockSizeList[0][0]
387 return DefaultBlockSize
388 else:
389 for ElementRegion in FdObj.RegionList:
390 if ElementRegion.RegionType == 'FV':
391 for ElementRegionData in ElementRegion.RegionDataList:
392 if ElementRegionData != None and ElementRegionData.upper() == FvObj.UiFvName:
393 if FvObj.BlockSizeList != []:
394 return FvObj.BlockSizeList[0][0]
395 else:
396 return ElementRegion.BlockSizeOfRegion(ElementFd.BlockSizeList)
397 return DefaultBlockSize
398
399 ## DisplayFvSpaceInfo()
400 #
401 # @param FvObj Whose block size to get
402 # @retval None
403 #
404 def DisplayFvSpaceInfo(FdfParser):
405
406 FvSpaceInfoList = []
407 MaxFvNameLength = 0
408 for FvName in FdfParser.Profile.FvDict:
409 if len(FvName) > MaxFvNameLength:
410 MaxFvNameLength = len(FvName)
411 FvSpaceInfoFileName = os.path.join(GenFdsGlobalVariable.FvDir, FvName.upper() + '.Fv.map')
412 if os.path.exists(FvSpaceInfoFileName):
413 FileLinesList = linecache.getlines(FvSpaceInfoFileName)
414 TotalFound = False
415 Total = ''
416 UsedFound = False
417 Used = ''
418 FreeFound = False
419 Free = ''
420 for Line in FileLinesList:
421 NameValue = Line.split('=')
422 if len(NameValue) == 2:
423 if NameValue[0].strip() == 'EFI_FV_TOTAL_SIZE':
424 TotalFound = True
425 Total = NameValue[1].strip()
426 if NameValue[0].strip() == 'EFI_FV_TAKEN_SIZE':
427 UsedFound = True
428 Used = NameValue[1].strip()
429 if NameValue[0].strip() == 'EFI_FV_SPACE_SIZE':
430 FreeFound = True
431 Free = NameValue[1].strip()
432
433 if TotalFound and UsedFound and FreeFound:
434 FvSpaceInfoList.append((FvName, Total, Used, Free))
435
436 GenFdsGlobalVariable.InfLogger('\nFV Space Information')
437 for FvSpaceInfo in FvSpaceInfoList:
438 Name = FvSpaceInfo[0]
439 TotalSizeValue = long(FvSpaceInfo[1], 0)
440 UsedSizeValue = long(FvSpaceInfo[2], 0)
441 FreeSizeValue = long(FvSpaceInfo[3], 0)
442 GenFdsGlobalVariable.InfLogger(Name + ' ' + '[' + str((UsedSizeValue+0.0)/TotalSizeValue)[0:4].lstrip('0.') + '%Full] ' + str(TotalSizeValue) + ' total, ' + str(UsedSizeValue) + ' used, ' + str(FreeSizeValue) + ' free')
443
444 ## PreprocessImage()
445 #
446 # @param BuildDb Database from build meta data files
447 # @param DscFile modules from dsc file will be preprocessed
448 # @retval None
449 #
450 def PreprocessImage(BuildDb, DscFile):
451 PcdDict = BuildDb.BuildObject[DscFile, 'COMMON'].Pcds
452 PcdValue = ''
453 for Key in PcdDict:
454 PcdObj = PcdDict[Key]
455 if PcdObj.TokenCName == 'PcdBsBaseAddress':
456 PcdValue = PcdObj.DefaultValue
457 break
458
459 if PcdValue == '':
460 return
461
462 Int64PcdValue = long(PcdValue, 0)
463 if Int64PcdValue == 0 or Int64PcdValue < -1:
464 return
465
466 TopAddress = 0
467 if Int64PcdValue > 0:
468 TopAddress = Int64PcdValue
469
470 ModuleDict = BuildDb.BuildObject[DscFile, 'COMMON'].Modules
471 for Key in ModuleDict:
472 ModuleObj = BuildDb.BuildObject[Key, 'COMMON']
473 print ModuleObj.BaseName + ' ' + ModuleObj.ModuleType
474
475 ##Define GenFd as static function
476 GenFd = staticmethod(GenFd)
477 GetFvBlockSize = staticmethod(GetFvBlockSize)
478 DisplayFvSpaceInfo = staticmethod(DisplayFvSpaceInfo)
479 PreprocessImage = staticmethod(PreprocessImage)
480
481 if __name__ == '__main__':
482 r = main()
483 ## 0-127 is a safe return range, and 1 is a standard default error
484 if r < 0 or r > 127: r = 1
485 sys.exit(r)
486