2 # process FFS generation from INF statement
4 # Copyright (c) 2007, Intel Corporation
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
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.
21 from GenFdsGlobalVariable
import GenFdsGlobalVariable
27 import RuleComplexFile
28 from CommonDataClass
.FdfClass
import FfsInfStatementClassObject
29 from Common
.String
import *
30 from Common
.Misc
import PathClass
31 from Common
.Misc
import GuidStructureByteArrayToGuidString
32 from Common
import EdkLogger
33 from Common
.BuildToolError
import *
35 ## generate FFS from INF
38 class FfsInfStatement(FfsInfStatementClassObject
):
41 # @param self The object pointer
44 FfsInfStatementClassObject
.__init
__(self
)
45 self
.TargetOverrideList
= []
46 self
.ShadowFromInfFile
= None
47 self
.KeepRelocFromRule
= None
50 self
.PiSpecVersion
= 0
52 ## __InfParse() method
54 # Parse inf file to get module information
56 # @param self The object pointer
57 # @param Dict dictionary contains macro and value pair
59 def __InfParse__(self
, Dict
= {}):
61 GenFdsGlobalVariable
.VerboseLogger( " Begine parsing INf file : %s" %self
.InfFileName
)
63 self
.InfFileName
= self
.InfFileName
.replace('$(WORKSPACE)', '')
64 if self
.InfFileName
[0] == '\\' or self
.InfFileName
[0] == '/' :
65 self
.InfFileName
= self
.InfFileName
[1:]
67 if self
.InfFileName
.find('$') == -1:
68 InfPath
= NormPath(self
.InfFileName
)
69 if not os
.path
.exists(InfPath
):
70 InfPath
= GenFdsGlobalVariable
.ReplaceWorkspaceMacro(InfPath
)
71 if not os
.path
.exists(InfPath
):
72 EdkLogger
.error("GenFds", GENFDS_ERROR
, "Non-existant Module %s !" % (self
.InfFileName
))
74 self
.CurrentArch
= self
.GetCurrentArch()
76 # Get the InfClass object
79 PathClassObj
= PathClass(self
.InfFileName
, GenFdsGlobalVariable
.WorkSpaceDir
)
80 ErrorCode
, ErrorInfo
= PathClassObj
.Validate()
82 EdkLogger
.error("GenFds", ErrorCode
, ExtraData
=ErrorInfo
)
84 if self
.CurrentArch
!= None:
86 Inf
= GenFdsGlobalVariable
.WorkSpace
.BuildObject
[PathClassObj
, self
.CurrentArch
]
88 # Set Ffs BaseName, MdouleGuid, ModuleType, Version, OutputPath
90 self
.BaseName
= Inf
.BaseName
91 self
.ModuleGuid
= Inf
.Guid
92 self
.ModuleType
= Inf
.ModuleType
93 if Inf
.Specification
!= None and 'PI_SPECIFICATION_VERSION' in Inf
.Specification
:
94 self
.PiSpecVersion
= Inf
.Specification
['PI_SPECIFICATION_VERSION']
95 if Inf
.AutoGenVersion
< 0x00010005:
96 self
.ModuleType
= Inf
.ComponentType
97 self
.VersionString
= Inf
.Version
98 self
.BinFileList
= Inf
.Binaries
99 self
.SourceFileList
= Inf
.Sources
100 if self
.KeepReloc
== None and Inf
.Shadow
:
101 self
.ShadowFromInfFile
= Inf
.Shadow
104 Inf
= GenFdsGlobalVariable
.WorkSpace
.BuildObject
[PathClassObj
, 'COMMON']
105 self
.BaseName
= Inf
.BaseName
106 self
.ModuleGuid
= Inf
.Guid
107 self
.ModuleType
= Inf
.ModuleType
108 if Inf
.Specification
!= None and 'PI_SPECIFICATION_VERSION' in Inf
.Specification
:
109 self
.PiSpecVersion
= Inf
.Specification
['PI_SPECIFICATION_VERSION']
110 self
.VersionString
= Inf
.Version
111 self
.BinFileList
= Inf
.Binaries
112 self
.SourceFileList
= Inf
.Sources
113 if self
.BinFileList
== []:
114 EdkLogger
.error("GenFds", GENFDS_ERROR
,
115 "INF %s specified in FDF could not be found in build ARCH %s!" \
116 % (self
.InfFileName
, GenFdsGlobalVariable
.ArchList
))
118 if len(self
.SourceFileList
) != 0 and not self
.InDsc
:
119 EdkLogger
.warn("GenFds", GENFDS_ERROR
, "Module %s NOT found in DSC file; Is it really a binary module?" % (self
.InfFileName
))
121 if self
.ModuleType
== 'SMM_CORE' and self
.PiSpecVersion
< 0x0001000A:
122 EdkLogger
.error("GenFds", FORMAT_NOT_SUPPORTED
, "SMM_CORE module type can't be used in the module with PI_SPECIFICATION_VERSION less than 0x0001000A", File
=self
.InfFileName
)
124 if Inf
._Defs
!= None and len(Inf
._Defs
) > 0:
125 self
.OptRomDefs
.update(Inf
._Defs
)
127 GenFdsGlobalVariable
.VerboseLogger( "BaseName : %s" %self
.BaseName
)
128 GenFdsGlobalVariable
.VerboseLogger("ModuleGuid : %s" %self
.ModuleGuid
)
129 GenFdsGlobalVariable
.VerboseLogger("ModuleType : %s" %self
.ModuleType
)
130 GenFdsGlobalVariable
.VerboseLogger("VersionString : %s" %self
.VersionString
)
131 GenFdsGlobalVariable
.VerboseLogger("InfFileName :%s" %self
.InfFileName
)
134 # Set OutputPath = ${WorkSpace}\Build\Fv\Ffs\${ModuleGuid}+ ${MdouleName}\
137 self
.OutputPath
= os
.path
.join(GenFdsGlobalVariable
.FfsDir
, \
138 self
.ModuleGuid
+ self
.BaseName
)
139 if not os
.path
.exists(self
.OutputPath
) :
140 os
.makedirs(self
.OutputPath
)
142 self
.EfiOutputPath
= self
.__GetEFIOutPutPath
__()
143 GenFdsGlobalVariable
.VerboseLogger( "ModuelEFIPath: " + self
.EfiOutputPath
)
149 # @param self The object pointer
150 # @param Dict dictionary contains macro and value pair
151 # @retval string Generated FFS file name
153 def GenFfs(self
, Dict
= {}):
155 # Parse Inf file get Module related information
158 self
.__InfParse
__(Dict
)
160 # Get the rule of how to generate Ffs file
162 Rule
= self
.__GetRule
__()
163 GenFdsGlobalVariable
.VerboseLogger( "Packing binaries from inf file : %s" %self
.InfFileName
)
165 # Convert Fv File Type for PI1.1 SMM driver.
167 if self
.ModuleType
== 'DXE_SMM_DRIVER' and self
.PiSpecVersion
>= 0x0001000A:
168 if Rule
.FvFileType
== 'DRIVER':
169 Rule
.FvFileType
= 'SMM'
171 # Framework SMM Driver has no SMM FV file type
173 if self
.ModuleType
== 'DXE_SMM_DRIVER' and self
.PiSpecVersion
< 0x0001000A:
174 if Rule
.FvFileType
== 'SMM' or Rule
.FvFileType
== 'SMM_CORE':
175 EdkLogger
.error("GenFds", FORMAT_NOT_SUPPORTED
, "Framework SMM module doesn't support SMM or SMM_CORE FV file type", File
=self
.InfFileName
)
177 # For the rule only has simpleFile
179 if isinstance (Rule
, RuleSimpleFile
.RuleSimpleFile
) :
180 SectionOutputList
= self
.__GenSimpleFileSection
__(Rule
)
181 FfsOutput
= self
.__GenSimpleFileFfs
__(Rule
, SectionOutputList
)
184 # For Rule has ComplexFile
186 elif isinstance(Rule
, RuleComplexFile
.RuleComplexFile
):
187 InputSectList
, InputSectAlignments
= self
.__GenComplexFileSection
__(Rule
)
188 FfsOutput
= self
.__GenComplexFileFfs
__(Rule
, InputSectList
, InputSectAlignments
)
192 ## __ExtendMacro__() method
194 # Replace macro with its value
196 # @param self The object pointer
197 # @param String The string to be replaced
198 # @retval string Macro replaced string
200 def __ExtendMacro__ (self
, String
):
202 '$(INF_OUTPUT)' : self
.EfiOutputPath
,
203 '$(MODULE_NAME)' : self
.BaseName
,
204 '$(BUILD_NUMBER)': self
.BuildNum
,
205 '$(INF_VERSION)' : self
.VersionString
,
206 '$(NAMED_GUID)' : self
.ModuleGuid
208 String
= GenFdsGlobalVariable
.MacroExtend(String
, MacroDict
)
211 ## __GetRule__() method
213 # Get correct rule for generating FFS for this INF
215 # @param self The object pointer
216 # @retval Rule Rule object
218 def __GetRule__ (self
) :
220 if self
.CurrentArch
== None:
221 CurrentArchList
= ['common']
223 CurrentArchList
.append(self
.CurrentArch
)
225 for CurrentArch
in CurrentArchList
:
226 RuleName
= 'RULE' + \
228 CurrentArch
.upper() + \
230 self
.ModuleType
.upper()
231 if self
.Rule
!= None:
232 RuleName
= RuleName
+ \
236 Rule
= GenFdsGlobalVariable
.FdfParser
.Profile
.RuleDict
.get(RuleName
)
238 GenFdsGlobalVariable
.VerboseLogger ("Want To Find Rule Name is : " + RuleName
)
241 RuleName
= 'RULE' + \
245 self
.ModuleType
.upper()
247 if self
.Rule
!= None:
248 RuleName
= RuleName
+ \
252 GenFdsGlobalVariable
.VerboseLogger ('Trying to apply common rule %s for INF %s' % (RuleName
, self
.InfFileName
))
254 Rule
= GenFdsGlobalVariable
.FdfParser
.Profile
.RuleDict
.get(RuleName
)
256 GenFdsGlobalVariable
.VerboseLogger ("Want To Find Rule Name is : " + RuleName
)
260 EdkLogger
.error("GenFds", GENFDS_ERROR
, 'Don\'t Find common rule %s for INF %s' \
261 % (RuleName
, self
.InfFileName
))
263 ## __GetPlatformArchList__() method
265 # Get Arch list this INF built under
267 # @param self The object pointer
268 # @retval list Arch list
270 def __GetPlatformArchList__(self
):
272 InfFileKey
= os
.path
.normpath(os
.path
.join(GenFdsGlobalVariable
.WorkSpaceDir
, self
.InfFileName
))
274 PlatformDataBase
= GenFdsGlobalVariable
.WorkSpace
.BuildObject
[GenFdsGlobalVariable
.ActivePlatform
, 'IA32']
275 if PlatformDataBase
!= None:
276 if InfFileKey
in PlatformDataBase
.Modules
:
277 DscArchList
.append ('IA32')
279 PlatformDataBase
= GenFdsGlobalVariable
.WorkSpace
.BuildObject
[GenFdsGlobalVariable
.ActivePlatform
, 'X64']
280 if PlatformDataBase
!= None:
281 if InfFileKey
in PlatformDataBase
.Modules
:
282 DscArchList
.append ('X64')
284 PlatformDataBase
= GenFdsGlobalVariable
.WorkSpace
.BuildObject
[GenFdsGlobalVariable
.ActivePlatform
, 'IPF']
285 if PlatformDataBase
!= None:
286 if InfFileKey
in (PlatformDataBase
.Modules
):
287 DscArchList
.append ('IPF')
289 PlatformDataBase
= GenFdsGlobalVariable
.WorkSpace
.BuildObject
[GenFdsGlobalVariable
.ActivePlatform
, 'ARM']
290 if PlatformDataBase
!= None:
291 if InfFileKey
in (PlatformDataBase
.Modules
):
292 DscArchList
.append ('ARM')
294 PlatformDataBase
= GenFdsGlobalVariable
.WorkSpace
.BuildObject
[GenFdsGlobalVariable
.ActivePlatform
, 'EBC']
295 if PlatformDataBase
!= None:
296 if InfFileKey
in (PlatformDataBase
.Modules
):
297 DscArchList
.append ('EBC')
301 ## GetCurrentArch() method
303 # Get Arch list of the module from this INF is to be placed into flash
305 # @param self The object pointer
306 # @retval list Arch list
308 def GetCurrentArch(self
) :
310 TargetArchList
= GenFdsGlobalVariable
.ArchList
312 PlatformArchList
= self
.__GetPlatformArchList
__()
314 CurArchList
= TargetArchList
315 if PlatformArchList
!= []:
316 CurArchList
= list(set (TargetArchList
) & set (PlatformArchList
))
317 GenFdsGlobalVariable
.VerboseLogger ("Valid target architecture(s) is : " + " ".join(CurArchList
))
320 if self
.KeyStringList
!= []:
321 for Key
in self
.KeyStringList
:
322 Key
= GenFdsGlobalVariable
.MacroExtend(Key
)
323 Target
, Tag
, Arch
= Key
.split('_')
324 if Arch
in CurArchList
:
325 ArchList
.append(Arch
)
326 if Target
not in self
.TargetOverrideList
:
327 self
.TargetOverrideList
.append(Target
)
329 ArchList
= CurArchList
331 UseArchList
= TargetArchList
332 if self
.UseArch
!= None:
334 UseArchList
.append(self
.UseArch
)
335 ArchList
= list(set (UseArchList
) & set (ArchList
))
337 self
.InfFileName
= NormPath(self
.InfFileName
)
338 if len(PlatformArchList
) == 0:
340 PathClassObj
= PathClass(self
.InfFileName
, GenFdsGlobalVariable
.WorkSpaceDir
)
341 ErrorCode
, ErrorInfo
= PathClassObj
.Validate()
343 EdkLogger
.error("GenFds", ErrorCode
, ExtraData
=ErrorInfo
)
344 if len(ArchList
) == 1:
347 elif len(ArchList
) > 1:
348 if len(PlatformArchList
) == 0:
349 EdkLogger
.error("GenFds", GENFDS_ERROR
, "GenFds command line option has multiple ARCHs %s. Not able to determine which ARCH is valid for Module %s !" % (str(ArchList
), self
.InfFileName
))
351 EdkLogger
.error("GenFds", GENFDS_ERROR
, "Module built under multiple ARCHs %s. Not able to determine which output to put into flash for Module %s !" % (str(ArchList
), self
.InfFileName
))
353 EdkLogger
.error("GenFds", GENFDS_ERROR
, "Module %s appears under ARCH %s in platform %s, but current deduced ARCH is %s, so NO build output could be put into flash." \
354 % (self
.InfFileName
, str(PlatformArchList
), GenFdsGlobalVariable
.ActivePlatform
, str(set (UseArchList
) & set (TargetArchList
))))
356 ## __GetEFIOutPutPath__() method
358 # Get the output path for generated files
360 # @param self The object pointer
361 # @retval string Path that output files from this INF go to
363 def __GetEFIOutPutPath__(self
):
366 (ModulePath
, FileName
) = os
.path
.split(self
.InfFileName
)
367 Index
= FileName
.find('.')
368 FileName
= FileName
[0:Index
]
370 if self
.CurrentArch
!= None:
371 Arch
= self
.CurrentArch
373 OutputPath
= os
.path
.join(GenFdsGlobalVariable
.OutputDirDict
[Arch
],
379 OutputPath
= os
.path
.realpath(OutputPath
)
382 ## __GenSimpleFileSection__() method
384 # Generate section by specified file name or a list of files with file extension
386 # @param self The object pointer
387 # @param Rule The rule object used to generate section
388 # @retval string File name of the generated section file
390 def __GenSimpleFileSection__(self
, Rule
):
392 # Prepare the parameter of GenSection
396 if Rule
.FileName
!= None:
397 GenSecInputFile
= self
.__ExtendMacro
__(Rule
.FileName
)
399 FileList
, IsSect
= Section
.Section
.GetFileList(self
, '', Rule
.FileExtension
)
402 SectionType
= Rule
.SectionType
404 # Convert Fv Section Type for PI1.1 SMM driver.
406 if self
.ModuleType
== 'DXE_SMM_DRIVER' and self
.PiSpecVersion
>= 0x0001000A:
407 if SectionType
== 'DXE_DEPEX':
408 SectionType
= 'SMM_DEPEX'
410 # Framework SMM Driver has no SMM_DEPEX section type
412 if self
.ModuleType
== 'DXE_SMM_DRIVER' and self
.PiSpecVersion
< 0x0001000A:
413 if SectionType
== 'SMM_DEPEX':
414 EdkLogger
.error("GenFds", FORMAT_NOT_SUPPORTED
, "Framework SMM module doesn't support SMM_DEPEX section type", File
=self
.InfFileName
)
416 if self
.ModuleType
in ('SEC', 'PEI_CORE', 'PEIM'):
417 if self
.KeepReloc
!= None:
418 NoStrip
= self
.KeepReloc
419 elif Rule
.KeepReloc
!= None:
420 NoStrip
= Rule
.KeepReloc
421 elif self
.ShadowFromInfFile
!= None:
422 NoStrip
= self
.ShadowFromInfFile
425 for File
in FileList
:
428 GenSecOutputFile
= self
.__ExtendMacro
__(Rule
.NameGuid
) + \
429 Ffs
.Ffs
.SectionSuffix
[SectionType
] + 'SEC' + SecNum
431 OutputFile
= os
.path
.join(self
.OutputPath
, GenSecOutputFile
)
434 FileBeforeStrip
= os
.path
.join(self
.OutputPath
, ModuleName
+ '.reloc')
435 if not os
.path
.exists(FileBeforeStrip
) or \
436 (os
.path
.getmtime(File
) > os
.path
.getmtime(FileBeforeStrip
)):
437 shutil
.copyfile(File
, FileBeforeStrip
)
438 StrippedFile
= os
.path
.join(self
.OutputPath
, ModuleName
+ '.stipped')
439 GenFdsGlobalVariable
.GenerateFirmwareImage(
441 [GenFdsGlobalVariable
.MacroExtend(File
, Dict
, self
.CurrentArch
)],
446 if SectionType
== 'TE':
447 TeFile
= os
.path
.join( self
.OutputPath
, self
.ModuleGuid
+ 'Te.raw')
448 GenFdsGlobalVariable
.GenerateFirmwareImage(
450 [GenFdsGlobalVariable
.MacroExtend(File
, Dict
, self
.CurrentArch
)],
455 GenFdsGlobalVariable
.GenerateSection(OutputFile
, [File
], Section
.Section
.SectionType
[SectionType
])
456 OutputFileList
.append(OutputFile
)
459 GenSecOutputFile
= self
.__ExtendMacro
__(Rule
.NameGuid
) + \
460 Ffs
.Ffs
.SectionSuffix
[SectionType
] + 'SEC' + SecNum
461 OutputFile
= os
.path
.join(self
.OutputPath
, GenSecOutputFile
)
464 FileBeforeStrip
= os
.path
.join(self
.OutputPath
, ModuleName
+ '.reloc')
465 if not os
.path
.exists(FileBeforeStrip
) or \
466 (os
.path
.getmtime(GenSecInputFile
) > os
.path
.getmtime(FileBeforeStrip
)):
467 shutil
.copyfile(GenSecInputFile
, FileBeforeStrip
)
468 StrippedFile
= os
.path
.join(self
.OutputPath
, ModuleName
+ '.stipped')
469 GenFdsGlobalVariable
.GenerateFirmwareImage(
471 [GenFdsGlobalVariable
.MacroExtend(GenSecInputFile
, Dict
, self
.CurrentArch
)],
474 GenSecInputFile
= StrippedFile
476 if SectionType
== 'TE':
477 TeFile
= os
.path
.join( self
.OutputPath
, self
.ModuleGuid
+ 'Te.raw')
478 GenFdsGlobalVariable
.GenerateFirmwareImage(
480 [GenFdsGlobalVariable
.MacroExtend(File
, Dict
, self
.CurrentArch
)],
483 GenSecInputFile
= TeFile
485 GenFdsGlobalVariable
.GenerateSection(OutputFile
, [GenSecInputFile
], Section
.Section
.SectionType
[SectionType
])
486 OutputFileList
.append(OutputFile
)
488 return OutputFileList
490 ## __GenSimpleFileFfs__() method
494 # @param self The object pointer
495 # @param Rule The rule object used to generate section
496 # @param InputFileList The output file list from GenSection
497 # @retval string Generated FFS file name
499 def __GenSimpleFileFfs__(self
, Rule
, InputFileList
):
500 FfsOutput
= self
.OutputPath
+ \
502 self
.__ExtendMacro
__(Rule
.NameGuid
) + \
505 GenFdsGlobalVariable
.VerboseLogger(self
.__ExtendMacro
__(Rule
.NameGuid
))
507 SectionAlignments
= []
508 for InputFile
in InputFileList
:
509 InputSection
.append(InputFile
)
510 SectionAlignments
.append(Rule
.Alignment
)
512 if Rule
.NameGuid
!= None and Rule
.NameGuid
.startswith('PCD('):
513 PcdValue
= GenFdsGlobalVariable
.GetPcdValue(Rule
.NameGuid
)
514 if len(PcdValue
) == 0:
515 EdkLogger
.error("GenFds", GENFDS_ERROR
, '%s NOT defined.' \
517 if PcdValue
.startswith('{'):
518 PcdValue
= GuidStructureByteArrayToGuidString(PcdValue
)
519 RegistryGuidStr
= PcdValue
520 if len(RegistryGuidStr
) == 0:
521 EdkLogger
.error("GenFds", GENFDS_ERROR
, 'GUID value for %s in wrong format.' \
523 self
.ModuleGuid
= RegistryGuidStr
525 GenFdsGlobalVariable
.GenerateFfs(FfsOutput
, InputSection
,
526 Ffs
.Ffs
.FdfFvFileTypeToFileType
[Rule
.FvFileType
],
527 self
.ModuleGuid
, Fixed
=Rule
.Fixed
,
528 CheckSum
=Rule
.CheckSum
, Align
=Rule
.Alignment
,
529 SectionAlign
=SectionAlignments
533 ## __GenComplexFileSection__() method
535 # Generate section by sections in Rule
537 # @param self The object pointer
538 # @param Rule The rule object used to generate section
539 # @retval string File name of the generated section file
541 def __GenComplexFileSection__(self
, Rule
):
542 if self
.ModuleType
in ('SEC', 'PEI_CORE', 'PEIM'):
543 if Rule
.KeepReloc
!= None:
544 self
.KeepRelocFromRule
= Rule
.KeepReloc
548 for Sect
in Rule
.SectionList
:
549 SecIndex
= '%d' %Index
552 # Convert Fv Section Type for PI1.1 SMM driver.
554 if self
.ModuleType
== 'DXE_SMM_DRIVER' and self
.PiSpecVersion
>= 0x0001000A:
555 if Sect
.SectionType
== 'DXE_DEPEX':
556 Sect
.SectionType
= 'SMM_DEPEX'
558 # Framework SMM Driver has no SMM_DEPEX section type
560 if self
.ModuleType
== 'DXE_SMM_DRIVER' and self
.PiSpecVersion
< 0x0001000A:
561 if Sect
.SectionType
== 'SMM_DEPEX':
562 EdkLogger
.error("GenFds", FORMAT_NOT_SUPPORTED
, "Framework SMM module doesn't support SMM_DEPEX section type", File
=self
.InfFileName
)
563 if Rule
.KeyStringList
!= []:
564 SectList
, Align
= Sect
.GenSection(self
.OutputPath
, self
.ModuleGuid
, SecIndex
, Rule
.KeyStringList
, self
)
566 SectList
, Align
= Sect
.GenSection(self
.OutputPath
, self
.ModuleGuid
, SecIndex
, self
.KeyStringList
, self
)
567 for SecName
in SectList
:
568 SectFiles
.append(SecName
)
569 SectAlignments
.append(Align
)
571 return SectFiles
, SectAlignments
573 ## __GenComplexFileFfs__() method
577 # @param self The object pointer
578 # @param Rule The rule object used to generate section
579 # @param InputFileList The output file list from GenSection
580 # @retval string Generated FFS file name
582 def __GenComplexFileFfs__(self
, Rule
, InputFile
, Alignments
):
584 if Rule
.NameGuid
!= None and Rule
.NameGuid
.startswith('PCD('):
585 PcdValue
= GenFdsGlobalVariable
.GetPcdValue(Rule
.NameGuid
)
586 if len(PcdValue
) == 0:
587 EdkLogger
.error("GenFds", GENFDS_ERROR
, '%s NOT defined.' \
589 if PcdValue
.startswith('{'):
590 PcdValue
= GuidStructureByteArrayToGuidString(PcdValue
)
591 RegistryGuidStr
= PcdValue
592 if len(RegistryGuidStr
) == 0:
593 EdkLogger
.error("GenFds", GENFDS_ERROR
, 'GUID value for %s in wrong format.' \
595 self
.ModuleGuid
= RegistryGuidStr
597 FfsOutput
= os
.path
.join( self
.OutputPath
, self
.ModuleGuid
+ '.ffs')
598 GenFdsGlobalVariable
.GenerateFfs(FfsOutput
, InputFile
,
599 Ffs
.Ffs
.FdfFvFileTypeToFileType
[Rule
.FvFileType
],
600 self
.ModuleGuid
, Fixed
=Rule
.Fixed
,
601 CheckSum
=Rule
.CheckSum
, Align
=Rule
.Alignment
,
602 SectionAlign
=Alignments
606 ## __GetGenFfsCmdParameter__() method
608 # Create parameter string for GenFfs
610 # @param self The object pointer
611 # @param Rule The rule object used to generate section
612 # @retval tuple (FileType, Fixed, CheckSum, Alignment)
614 def __GetGenFfsCmdParameter__(self
, Rule
):
616 result
+= ('-t', Ffs
.Ffs
.FdfFvFileTypeToFileType
[Rule
.FvFileType
])
617 if Rule
.Fixed
!= False:
619 if Rule
.CheckSum
!= False:
622 if Rule
.Alignment
!= None and Rule
.Alignment
!= '':
623 result
+= ('-a', Rule
.Alignment
)