14f460266de1de354edfcdeccf67616e5f4cea1a
[people/mcb30/basetools.git] / Source / Python / GenFds / FfsInfStatement.py
1 ## @file\r
2 # process FFS generation from INF statement\r
3 #\r
4 #  Copyright (c) 2007, Intel Corporation\r
5 #\r
6 #  All rights reserved. This program and the accompanying materials\r
7 #  are licensed and made available under the terms and conditions of the BSD License\r
8 #  which accompanies this distribution.  The full text of the license may be found at\r
9 #  http://opensource.org/licenses/bsd-license.php\r
10 #\r
11 #  THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,\r
12 #  WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.\r
13 #\r
14 \r
15 ##\r
16 # Import Modules\r
17 #\r
18 import Rule\r
19 import os\r
20 import shutil\r
21 from GenFdsGlobalVariable import GenFdsGlobalVariable\r
22 import Ffs\r
23 import subprocess\r
24 import sys\r
25 import Section\r
26 import RuleSimpleFile\r
27 import RuleComplexFile\r
28 from CommonDataClass.FdfClass import FfsInfStatementClassObject\r
29 from Common.String import *\r
30 \r
31 ## generate FFS from INF\r
32 #\r
33 #\r
34 class FfsInfStatement(FfsInfStatementClassObject):\r
35     ## The constructor\r
36     #\r
37     #   @param  self        The object pointer\r
38     #\r
39     def __init__(self):\r
40         FfsInfStatementClassObject.__init__(self)\r
41         self.TargetOverrideList = []\r
42         self.ShadowFromInfFile = None\r
43         self.KeepRelocFromRule = None\r
44 \r
45     ## __InfParse() method\r
46     #\r
47     #   Parse inf file to get module information\r
48     #\r
49     #   @param  self        The object pointer\r
50     #   @param  Dict        dictionary contains macro and value pair\r
51     #    \r
52     def __InfParse__(self, Dict = {}):\r
53         self.CurrentArch = self.GetCurrentArch()\r
54         #\r
55         # Get the InfClass object\r
56         #\r
57 \r
58         self.InfFileName = NormPath(self.InfFileName)\r
59         self.InfFileName = GenFdsGlobalVariable.MacroExtend(self.InfFileName, Dict, self.CurrentArch)\r
60         (self.SourceDir, InfName) = os.path.split(self.InfFileName)\r
61         if self.CurrentArch != None and self.InfFileName in GenFdsGlobalVariable.WorkSpace.Build[self.CurrentArch].ModuleDatabase.keys():\r
62             \r
63             Inf = GenFdsGlobalVariable.WorkSpace.Build[self.CurrentArch].ModuleDatabase[self.InfFileName]\r
64             #\r
65             # Set Ffs BaseName, MdouleGuid, ModuleType, Version, OutputPath\r
66             #\r
67             self.BaseName = Inf.BaseName\r
68             self.ModuleGuid = Inf.Guid\r
69             self.ModuleType = Inf.ModuleType\r
70             if Inf.AutoGenVersion < 0x00010005:\r
71                 self.ModuleType = GenFdsGlobalVariable.WorkSpace.InfDatabase[self.InfFileName].Module.Header[self.CurrentArch].ComponentType\r
72             self.VersionString = Inf.Version\r
73             self.BinFileList = Inf.Binaries\r
74             if self.KeepReloc == None and Inf.Shadow != '':\r
75                 if Inf.Shadow.upper() == "TRUE":\r
76                     self.ShadowFromInfFile = True\r
77                 else:\r
78                     self.ShadowFromInfFile = False \r
79         \r
80         elif self.InfFileName in GenFdsGlobalVariable.WorkSpace.InfDatabase.keys():\r
81             Inf = GenFdsGlobalVariable.WorkSpace.InfDatabase[self.InfFileName]\r
82             self.BaseName = Inf.Module.Header[self.CurrentArch].Name\r
83             self.ModuleGuid = Inf.Module.Header[self.CurrentArch].Guid\r
84             self.ModuleType = Inf.Module.Header[self.CurrentArch].ModuleType\r
85             self.VersionString = Inf.Module.Header[self.CurrentArch].Version\r
86             self.BinFileList = Inf.Module.Binaries\r
87             if self.BinFileList == []:\r
88                 raise Exception ("INF %s specified in FDF could not be found in build ARCH %s!" % (self.InfFileName, GenFdsGlobalVariable.ArchList))\r
89                 sys.exit(1)\r
90         \r
91         else:\r
92             raise Exception ("INF %s specified in FDF could not be found in database!" % self.InfFileName)\r
93             sys.exit(1)\r
94         \r
95         GenFdsGlobalVariable.VerboseLogger( "BaseName : %s" %self.BaseName)\r
96         GenFdsGlobalVariable.VerboseLogger("ModuleGuid : %s" %self.ModuleGuid)\r
97         GenFdsGlobalVariable.VerboseLogger("ModuleType : %s" %self.ModuleType)\r
98         GenFdsGlobalVariable.VerboseLogger("VersionString : %s" %self.VersionString)\r
99         GenFdsGlobalVariable.VerboseLogger("InfFileName :%s"  %self.InfFileName)\r
100         \r
101         #\r
102         # Set OutputPath = ${WorkSpace}\Build\Fv\Ffs\${ModuleGuid}+ ${MdouleName}\\r
103         #\r
104 \r
105         self.OutputPath = os.path.join(GenFdsGlobalVariable.FfsDir, \\r
106                                        self.ModuleGuid + self.BaseName)\r
107         if not os.path.exists(self.OutputPath) :\r
108             os.makedirs(self.OutputPath)\r
109             \r
110         self.EfiOutputPath = self.__GetEFIOutPutPath__()\r
111         GenFdsGlobalVariable.VerboseLogger( "ModuelEFIPath: " + self.EfiOutputPath)\r
112     \r
113     ## GenFfs() method\r
114     #\r
115     #   Generate FFS\r
116     #\r
117     #   @param  self        The object pointer\r
118     #   @param  Dict        dictionary contains macro and value pair\r
119     #   @retval string      Generated FFS file name\r
120     #                          \r
121     def GenFfs(self, Dict = {}):\r
122         #\r
123         # Parse Inf file get Module related information\r
124         #\r
125         GenFdsGlobalVariable.VerboseLogger( " Begine parsing INf file : %s" %self.InfFileName)\r
126         \r
127         self.InfFileName = self.InfFileName.replace('$(WORKSPACE)', '')\r
128         if self.InfFileName[0] == '\\' or self.InfFileName[0] == '/' :\r
129             self.InfFileName = self.InfFileName[1:]\r
130         \r
131  \r
132         self.__InfParse__(Dict)\r
133         #\r
134         # Get the rule of how to generate Ffs file\r
135         #\r
136         Rule = self.__GetRule__()\r
137         GenFdsGlobalVariable.VerboseLogger( "Packing binaries from inf file : %s" %self.InfFileName)\r
138         #FileType = Ffs.Ffs.ModuleTypeToFileType[Rule.ModuleType]\r
139         #\r
140         # For the rule only has simpleFile\r
141         #\r
142         if isinstance (Rule, RuleSimpleFile.RuleSimpleFile) :\r
143             SectionOutputList = self.__GenSimpleFileSection__(Rule)\r
144             FfsOutput = self.__GenSimpleFileFfs__(Rule, SectionOutputList)\r
145             return FfsOutput\r
146         #\r
147         # For Rule has ComplexFile\r
148         #\r
149         elif isinstance(Rule, RuleComplexFile.RuleComplexFile):\r
150            \r
151             InputSectList = self.__GenComplexFileSection__(Rule)\r
152             FfsOutput = self.__GenComplexFileFfs__(Rule, InputSectList)\r
153             \r
154             return FfsOutput\r
155                 \r
156     ## __ExtendMacro__() method\r
157     #\r
158     #   Replace macro with its value\r
159     #\r
160     #   @param  self        The object pointer\r
161     #   @param  String      The string to be replaced\r
162     #   @retval string      Macro replaced string\r
163     # \r
164     def __ExtendMacro__ (self, String):\r
165         MacroDict = {\r
166             '$(INF_OUTPUT)'  : self.EfiOutputPath,\r
167             '$(MODULE_NAME)' : self.BaseName,\r
168             '$(BUILD_NUMBER)': self.BuildNum,\r
169             '$(INF_VERSION)' : self.VersionString,\r
170             '$(NAMED_GUID)'  : self.ModuleGuid        \r
171         }\r
172         String = GenFdsGlobalVariable.MacroExtend(String, MacroDict)\r
173         return String\r
174 \r
175     ## __GetRule__() method\r
176     #\r
177     #   Get correct rule for generating FFS for this INF\r
178     #\r
179     #   @param  self        The object pointer\r
180     #   @retval Rule        Rule object\r
181     # \r
182     def __GetRule__ (self) :\r
183         CurrentArchList = []\r
184         if self.CurrentArch == None:\r
185             CurrentArchList = ['common']\r
186         else:\r
187             CurrentArchList.append(self.CurrentArch)\r
188         \r
189         for CurrentArch in CurrentArchList:\r
190             RuleName = 'RULE'              + \\r
191                        '.'                 + \\r
192                        CurrentArch.upper() + \\r
193                        '.'                 + \\r
194                        self.ModuleType.upper()\r
195             if self.Rule != None:\r
196                 RuleName = RuleName + \\r
197                            '.'      + \\r
198                            self.Rule.upper()\r
199                            \r
200             Rule = GenFdsGlobalVariable.FdfParser.Profile.RuleDict.get(RuleName)\r
201             if Rule != None:\r
202                 GenFdsGlobalVariable.VerboseLogger ("Want To Find Rule Name is : " + RuleName)\r
203                 return Rule\r
204             \r
205         RuleName = 'RULE'      + \\r
206                    '.'         + \\r
207                    'COMMON'    + \\r
208                    '.'         + \\r
209                    self.ModuleType.upper()\r
210         \r
211         if self.Rule != None:\r
212             RuleName = RuleName + \\r
213                        '.'      + \\r
214                        self.Rule.upper()\r
215                        \r
216         GenFdsGlobalVariable.VerboseLogger ('Trying to apply common rule %s for INF %s' % (RuleName, self.InfFileName))               \r
217         \r
218         Rule = GenFdsGlobalVariable.FdfParser.Profile.RuleDict.get(RuleName)\r
219         if Rule != None:\r
220             GenFdsGlobalVariable.VerboseLogger ("Want To Find Rule Name is : " + RuleName)\r
221             return Rule\r
222 \r
223         if Rule == None :\r
224             raise Exception ('Don\'t Find common rule %s for INF %s' % (RuleName, self.InfFileName))\r
225 \r
226     ## __GetPlatformArchList__() method\r
227     #\r
228     #   Get Arch list this INF built under\r
229     #\r
230     #   @param  self        The object pointer\r
231     #   @retval list        Arch list\r
232     # \r
233     def __GetPlatformArchList__(self):\r
234         TargetArchList = GenFdsGlobalVariable.ArchList\r
235         if len(TargetArchList) == 0:\r
236             TargetArchList = GenFdsGlobalVariable.WorkSpace.SupArchList\r
237         else:\r
238             TargetArchList = set(GenFdsGlobalVariable.WorkSpace.SupArchList) & set(TargetArchList)\r
239             \r
240         InfFileKey = os.path.normpath(self.InfFileName)\r
241         DscArchList = []\r
242         PlatformDataBase = GenFdsGlobalVariable.WorkSpace.Build.get('IA32').PlatformDatabase.get(GenFdsGlobalVariable.ActivePlatform)\r
243         if  PlatformDataBase != None:\r
244             if InfFileKey in PlatformDataBase.Modules:\r
245                 DscArchList.append ('IA32')\r
246                 \r
247         PlatformDataBase = GenFdsGlobalVariable.WorkSpace.Build.get('X64').PlatformDatabase.get(GenFdsGlobalVariable.ActivePlatform)\r
248         if  PlatformDataBase != None:\r
249             if InfFileKey in PlatformDataBase.Modules:\r
250                 DscArchList.append ('X64')\r
251                 \r
252         PlatformDataBase = GenFdsGlobalVariable.WorkSpace.Build.get('IPF').PlatformDatabase.get(GenFdsGlobalVariable.ActivePlatform)\r
253         if PlatformDataBase != None:\r
254             if InfFileKey in (PlatformDataBase.Modules):\r
255                 DscArchList.append ('IPF')\r
256 \r
257         CurArchList = TargetArchList\r
258         if DscArchList != []:\r
259             CurArchList = set (TargetArchList) & set (DscArchList)\r
260         GenFdsGlobalVariable.VerboseLogger ("Valid target architecture(s) is : " + " ".join(CurArchList))\r
261         return list(CurArchList)\r
262     \r
263     ## GetCurrentArch() method\r
264     #\r
265     #   Get Arch list of the module from this INF is to be placed into flash\r
266     #\r
267     #   @param  self        The object pointer\r
268     #   @retval list        Arch list\r
269     # \r
270     def GetCurrentArch(self) :\r
271         CurArchList = self.__GetPlatformArchList__()\r
272         ArchList = []\r
273         if self.KeyStringList != []:\r
274             for Key in self.KeyStringList:\r
275                 Key = GenFdsGlobalVariable.MacroExtend(Key)\r
276                 Target, Tag, Arch = Key.split('_')\r
277                 if Arch in CurArchList:\r
278                     ArchList.append(Arch)\r
279                 if Target not in self.TargetOverrideList:\r
280                     self.TargetOverrideList.append(Target)\r
281         else:\r
282             ArchList = CurArchList\r
283                 \r
284         if len(ArchList) == 1:\r
285             Arch = ArchList[0]\r
286             return Arch\r
287         elif len(ArchList) > 1:\r
288             raise Exception("Not able to determine ARCH for Module %s !" %self.InfFileName) \r
289         else:\r
290             raise Exception("Don't find legal ARCH in Module %s !" %self.InfFileName)\r
291     \r
292     ## __GetEFIOutPutPath__() method\r
293     #\r
294     #   Get the output path for generated files\r
295     #\r
296     #   @param  self        The object pointer\r
297     #   @retval string      Path that output files from this INF go to\r
298     # \r
299     def __GetEFIOutPutPath__(self):\r
300         Arch = ''\r
301         OutputPath = ''\r
302         (ModulePath, FileName) = os.path.split(self.InfFileName)\r
303         Index = FileName.find('.')\r
304         FileName = FileName[0:Index]\r
305         Arch = "NoneArch"\r
306         if self.CurrentArch != None:\r
307             Arch = self.CurrentArch\r
308         \r
309         OutputPath = os.path.join(GenFdsGlobalVariable.OutputDirDict[Arch],\r
310                                   Arch ,\r
311                                   ModulePath,\r
312                                   FileName,\r
313                                   'OUTPUT'\r
314                                   )\r
315         OutputPath = os.path.realpath(OutputPath)\r
316         return OutputPath\r
317     \r
318     ## __GenSimpleFileSection__() method\r
319     #\r
320     #   Generate section by specified file name or a list of files with file extension\r
321     #\r
322     #   @param  self        The object pointer\r
323     #   @param  Rule        The rule object used to generate section\r
324     #   @retval string      File name of the generated section file\r
325     #     \r
326     def __GenSimpleFileSection__(self, Rule):\r
327         #\r
328         # Prepare the parameter of GenSection\r
329         #\r
330         FileList = []\r
331         OutputFileList = []\r
332         if Rule.FileName != None:\r
333             GenSecInputFile = self.__ExtendMacro__(Rule.FileName)\r
334         else:\r
335             FileList, IsSect = Section.Section.GetFileList(self, '', Rule.FileExtension)\r
336 \r
337         Index = 1\r
338         SectionType     = Rule.SectionType\r
339         NoStrip = True\r
340         if self.ModuleType in ('SEC', 'PEI_CORE', 'PEIM'):\r
341             if self.KeepReloc != None:\r
342                 NoStrip = self.KeepReloc\r
343             elif Rule.KeepReloc != None:\r
344                 NoStrip = Rule.KeepReloc\r
345             elif self.ShadowFromInfFile != None:\r
346                 NoStrip = self.ShadowFromInfFile\r
347                 \r
348         if FileList != [] :\r
349             for File in FileList:\r
350                 \r
351                 SecNum = '%d' %Index\r
352                 GenSecOutputFile= self.__ExtendMacro__(Rule.NameGuid) + \\r
353                               Ffs.Ffs.SectionSuffix[SectionType] + 'SEC' + SecNum   \r
354                 Index = Index + 1             \r
355                 OutputFile = os.path.join(self.OutputPath, GenSecOutputFile)\r
356                 \r
357                 if not NoStrip:\r
358                     FileBeforeStrip = os.path.join(self.OutputPath, ModuleName + '.reloc')\r
359                     if os.path.exists(FileBeforeStrip):\r
360                         os.remove(FileBeforeStrip)\r
361                     shutil.copyfile(File, FileBeforeStrip)\r
362                     StrippedFile = os.path.join(self.OutputPath, ModuleName + '.stipped')\r
363                     StripCmd = (\r
364                         'GenFw',\r
365                         '-l',\r
366                         '-o', StrippedFile,\r
367                         GenFdsGlobalVariable.MacroExtend(File, Dict, self.CurrentArch),\r
368                         )\r
369                     GenFdsGlobalVariable.CallExternalTool(StripCmd, "Strip Failed !")\r
370                     File = StrippedFile\r
371                     \r
372                 if SectionType == 'TE':\r
373                     TeFile = os.path.join( self.OutputPath, self.ModuleGuid + 'Te.raw')\r
374                     GenTeCmd = (\r
375                         'GenFw',\r
376                         '-t',\r
377                         '-o', TeFile,\r
378                         GenFdsGlobalVariable.MacroExtend(File, Dict, self.CurrentArch),\r
379                         )\r
380                     GenFdsGlobalVariable.CallExternalTool(GenTeCmd, "GenFw Failed !")\r
381                     File = TeFile\r
382                 \r
383                 GenSectionCmd = (\r
384                     'GenSec',\r
385                     '-o', OutputFile,\r
386                     '-s', Section.Section.SectionType[SectionType],\r
387                     File,\r
388                     )\r
389                 #\r
390                 # Call GenSection\r
391                 #\r
392                 GenFdsGlobalVariable.CallExternalTool(GenSectionCmd, "Gen section Failed!")\r
393                 OutputFileList.append(OutputFile)\r
394         else:\r
395             SecNum = '%d' %Index\r
396             GenSecOutputFile= self.__ExtendMacro__(Rule.NameGuid) + \\r
397                               Ffs.Ffs.SectionSuffix[SectionType] + 'SEC' + SecNum\r
398             OutputFile = os.path.join(self.OutputPath, GenSecOutputFile)\r
399             \r
400             if not NoStrip:\r
401                 FileBeforeStrip = os.path.join(self.OutputPath, ModuleName + '.reloc')\r
402                 shutil.copyfile(File, FileBeforeStrip)\r
403                 StrippedFile = os.path.join(self.OutputPath, ModuleName + '.stipped')\r
404                 StripCmd = (\r
405                     'GenFw',\r
406                     '-l',\r
407                     '-o', StrippedFile,\r
408                     GenFdsGlobalVariable.MacroExtend(File, Dict, self.CurrentArch),\r
409                     )\r
410                 GenFdsGlobalVariable.CallExternalTool(StripCmd, "Strip Failed !")\r
411                 File = StrippedFile\r
412             \r
413             if SectionType == 'TE':\r
414                 TeFile = os.path.join( self.OutputPath, self.ModuleGuid + 'Te.raw')\r
415                 GenTeCmd = (\r
416                     'GenFw',\r
417                     '-t',\r
418                     '-o', TeFile,\r
419                     GenFdsGlobalVariable.MacroExtend(File, Dict, self.CurrentArch),\r
420                     )\r
421                 GenFdsGlobalVariable.CallExternalTool(GenTeCmd, "GenFw Failed !")\r
422                 GenSecInputFile = TeFile\r
423             \r
424             GenSectionCmd = (\r
425                 'GenSec',\r
426                 '-o', OutputFile,\r
427                 '-s', Section.Section.SectionType[SectionType],\r
428                 GenSecInputFile,\r
429                 )\r
430             #\r
431             # Call GenSection\r
432             #\r
433             GenFdsGlobalVariable.CallExternalTool(GenSectionCmd, "Gen section Failed!")\r
434             OutputFileList.append(OutputFile)\r
435 \r
436         return OutputFileList\r
437     \r
438     ## __GenSimpleFileFfs__() method\r
439     #\r
440     #   Generate FFS\r
441     #\r
442     #   @param  self        The object pointer\r
443     #   @param  Rule        The rule object used to generate section\r
444     #   @param  InputFileList        The output file list from GenSection\r
445     #   @retval string      Generated FFS file name\r
446     #\r
447     def __GenSimpleFileFfs__(self, Rule, InputFileList):\r
448         #\r
449         # Prepare the parameter of GenFfs\r
450         #\r
451         CmdParams = self.__GetGenFfsCmdParameter__(Rule)\r
452 \r
453         FfsOutput = self.OutputPath                     + \\r
454                     os.sep                              + \\r
455                     self.__ExtendMacro__(Rule.NameGuid) + \\r
456                     '.ffs'\r
457 \r
458         GenFdsGlobalVariable.VerboseLogger(self.__ExtendMacro__(Rule.NameGuid))\r
459         InputSection = tuple()\r
460         for InputFile in InputFileList:\r
461             InputSection += ('-i', InputFile)\r
462             for i in range(len(CmdParams) - 1):\r
463                 if CmdParams[i] == '-a':\r
464                     InputSection += ('-n', CmdParams[i+1])\r
465                     break\r
466 \r
467         GenFfsCmd = (\r
468             'GenFfs',\r
469              '-g', self.NameGuid,\r
470              '-o', FfsOutput,\r
471             ) + CmdParams + InputSection\r
472         #\r
473         # Call GenSection\r
474         #\r
475         GenFdsGlobalVariable.CallExternalTool(GenFfsCmd, "GenFfs Failed!")\r
476         return FfsOutput\r
477     \r
478     ## __GenComplexFileSection__() method\r
479     #\r
480     #   Generate section by sections in Rule\r
481     #\r
482     #   @param  self        The object pointer\r
483     #   @param  Rule        The rule object used to generate section\r
484     #   @retval string      File name of the generated section file\r
485     #  \r
486     def __GenComplexFileSection__(self, Rule):\r
487         \r
488         if self.ModuleType in ('SEC', 'PEI_CORE', 'PEIM'):\r
489             if Rule.KeepReloc != None:\r
490                 self.KeepRelocFromRule = Rule.KeepReloc\r
491         \r
492         SectFiles = tuple()\r
493         Index = 1\r
494         for Sect in Rule.SectionList:\r
495            SecIndex = '%d' %Index\r
496            SectList  = []\r
497            if Rule.KeyStringList != []:\r
498                SectList, Align = Sect.GenSection(self.OutputPath , self.ModuleGuid, SecIndex, Rule.KeyStringList, self)\r
499            else :\r
500                SectList, Align = Sect.GenSection(self.OutputPath , self.ModuleGuid, SecIndex, self.KeyStringList, self)\r
501            for SecName in  SectList :\r
502                SectFiles += ('-i', SecName)\r
503                if Align != None:\r
504                    SectFiles += ('-n', Align)\r
505            Index = Index + 1\r
506         return SectFiles\r
507 \r
508     ## __GenComplexFileFfs__() method\r
509     #\r
510     #   Generate FFS\r
511     #\r
512     #   @param  self        The object pointer\r
513     #   @param  Rule        The rule object used to generate section\r
514     #   @param  InputFileList        The output file list from GenSection\r
515     #   @retval string      Generated FFS file name\r
516     #\r
517     def __GenComplexFileFfs__(self, Rule, InputFile):\r
518         \r
519         CmdParams = self.__GetGenFfsCmdParameter__(Rule)\r
520         \r
521         FfsOutput = os.path.join( self.OutputPath, self.ModuleGuid + '.ffs')\r
522         GenFfsCmd = (\r
523             'GenFfs',\r
524             ) + CmdParams + (\r
525              '-g', self.ModuleGuid,\r
526              '-o', FfsOutput,\r
527             ) + InputFile\r
528 \r
529         GenFdsGlobalVariable.CallExternalTool(GenFfsCmd, "GenFfs Failed !")\r
530         return FfsOutput\r
531 \r
532     ## __GetGenFfsCmdParameter__() method\r
533     #\r
534     #   Create parameter string for GenFfs\r
535     #\r
536     #   @param  self        The object pointer\r
537     #   @param  Rule        The rule object used to generate section\r
538     #   @retval tuple       (FileType, Fixed, CheckSum, Alignment)\r
539     #\r
540     def __GetGenFfsCmdParameter__(self, Rule):\r
541         result = tuple()\r
542         result += ('-t', Ffs.Ffs.FdfFvFileTypeToFileType[Rule.FvFileType])\r
543         #FileType = ' -t ' + \\r
544         #           Ffs.Ffs.FdfFvFileTypeToFileType[Rule.FvFileType]\r
545         if Rule.Fixed != False:\r
546             result += ('-x',)\r
547         if Rule.CheckSum != False:\r
548             result += ('-s',)\r
549             \r
550         if Rule.Alignment != None and Rule.Alignment != '':\r
551             result += ('-a', Rule.Alignment)\r
552             \r
553         return result\r