GenFds Use R8 component type when finding rule in FDF.
[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.FdfClassObject 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)\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.OutputDir,\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                     shutil.copyfile(File, FileBeforeStrip)\r
360                     StrippedFile = os.path.join(self.OutputPath, ModuleName + '.stipped')\r
361                     StripCmd = (\r
362                         'GenFw',\r
363                         '-l',\r
364                         '-o', StrippedFile,\r
365                         GenFdsGlobalVariable.MacroExtend(File, Dict),\r
366                         )\r
367                     GenFdsGlobalVariable.CallExternalTool(StripCmd, "Strip Failed !")\r
368                     File = StrippedFile\r
369                     \r
370                 if SectionType == 'TE':\r
371                     TeFile = os.path.join( self.OutputPath, self.ModuleGuid + 'Te.raw')\r
372                     GenTeCmd = (\r
373                         'GenFw',\r
374                         '-t',\r
375                         '-o', TeFile,\r
376                         GenFdsGlobalVariable.MacroExtend(File, Dict),\r
377                         )\r
378                     GenFdsGlobalVariable.CallExternalTool(GenTeCmd, "GenFw Failed !")\r
379                     File = TeFile\r
380                 \r
381                 GenSectionCmd = (\r
382                     'GenSec',\r
383                     '-o', OutputFile,\r
384                     '-s', Section.Section.SectionType[SectionType],\r
385                     File,\r
386                     )\r
387                 #\r
388                 # Call GenSection\r
389                 #\r
390                 GenFdsGlobalVariable.CallExternalTool(GenSectionCmd, "Gen section Failed!")\r
391                 OutputFileList.append(OutputFile)\r
392         else:\r
393             SecNum = '%d' %Index\r
394             GenSecOutputFile= self.__ExtendMacro__(Rule.NameGuid) + \\r
395                               Ffs.Ffs.SectionSuffix[SectionType] + 'SEC' + SecNum\r
396             OutputFile = os.path.join(self.OutputPath, GenSecOutputFile)\r
397             \r
398             if not NoStrip:\r
399                 FileBeforeStrip = os.path.join(self.OutputPath, ModuleName + '.reloc')\r
400                 shutil.copyfile(File, FileBeforeStrip)\r
401                 StrippedFile = os.path.join(self.OutputPath, ModuleName + '.stipped')\r
402                 StripCmd = (\r
403                     'GenFw',\r
404                     '-l',\r
405                     '-o', StrippedFile,\r
406                     GenFdsGlobalVariable.MacroExtend(File, Dict),\r
407                     )\r
408                 GenFdsGlobalVariable.CallExternalTool(StripCmd, "Strip Failed !")\r
409                 File = StrippedFile\r
410             \r
411             if SectionType == 'TE':\r
412                 TeFile = os.path.join( self.OutputPath, self.ModuleGuid + 'Te.raw')\r
413                 GenTeCmd = (\r
414                     'GenFw',\r
415                     '-t',\r
416                     '-o', TeFile,\r
417                     GenFdsGlobalVariable.MacroExtend(File, Dict),\r
418                     )\r
419                 GenFdsGlobalVariable.CallExternalTool(GenTeCmd, "GenFw Failed !")\r
420                 GenSecInputFile = TeFile\r
421             \r
422             GenSectionCmd = (\r
423                 'GenSec',\r
424                 '-o', OutputFile,\r
425                 '-s', Section.Section.SectionType[SectionType],\r
426                 GenSecInputFile,\r
427                 )\r
428             #\r
429             # Call GenSection\r
430             #\r
431             GenFdsGlobalVariable.CallExternalTool(GenSectionCmd, "Gen section Failed!")\r
432             OutputFileList.append(OutputFile)\r
433 \r
434         return OutputFileList\r
435     \r
436     ## __GenSimpleFileFfs__() method\r
437     #\r
438     #   Generate FFS\r
439     #\r
440     #   @param  self        The object pointer\r
441     #   @param  Rule        The rule object used to generate section\r
442     #   @param  InputFileList        The output file list from GenSection\r
443     #   @retval string      Generated FFS file name\r
444     #\r
445     def __GenSimpleFileFfs__(self, Rule, InputFileList):\r
446         #\r
447         # Prepare the parameter of GenFfs\r
448         #\r
449         CmdParams = self.__GetGenFfsCmdParameter__(Rule)\r
450 \r
451         FfsOutput = self.OutputPath                     + \\r
452                     os.sep                              + \\r
453                     self.__ExtendMacro__(Rule.NameGuid) + \\r
454                     '.ffs'\r
455 \r
456         GenFdsGlobalVariable.VerboseLogger(self.__ExtendMacro__(Rule.NameGuid))\r
457         InputSection = tuple()\r
458         for InputFile in InputFileList:\r
459             InputSection += ('-i', InputFile)\r
460             for i in range(len(CmdParams) - 1):\r
461                 if CmdParams[i] == '-a':\r
462                     InputSection += ('-n', CmdParams[i+1])\r
463                     break\r
464 \r
465         GenFfsCmd = (\r
466             'GenFfs',\r
467              '-g', self.NameGuid,\r
468              '-o', FfsOutput,\r
469             ) + CmdParams + InputSection\r
470         #\r
471         # Call GenSection\r
472         #\r
473         GenFdsGlobalVariable.CallExternalTool(GenFfsCmd, "GenFfs Failed!")\r
474         return FfsOutput\r
475     \r
476     ## __GenComplexFileSection__() method\r
477     #\r
478     #   Generate section by sections in Rule\r
479     #\r
480     #   @param  self        The object pointer\r
481     #   @param  Rule        The rule object used to generate section\r
482     #   @retval string      File name of the generated section file\r
483     #  \r
484     def __GenComplexFileSection__(self, Rule):\r
485         \r
486         if self.ModuleType in ('SEC', 'PEI_CORE', 'PEIM'):\r
487             if Rule.KeepReloc != None:\r
488                 self.KeepRelocFromRule = Rule.KeepReloc\r
489         \r
490         SectFiles = tuple()\r
491         Index = 1\r
492         for Sect in Rule.SectionList:\r
493            SecIndex = '%d' %Index\r
494            SectList  = []\r
495            if Rule.KeyStringList != []:\r
496                SectList, Align = Sect.GenSection(self.OutputPath , self.ModuleGuid, SecIndex, Rule.KeyStringList, self)\r
497            else :\r
498                SectList, Align = Sect.GenSection(self.OutputPath , self.ModuleGuid, SecIndex, self.KeyStringList, self)\r
499            for SecName in  SectList :\r
500                SectFiles += ('-i', SecName)\r
501                if Align != None:\r
502                    SectFiles += ('-n', Align)\r
503            Index = Index + 1\r
504         return SectFiles\r
505 \r
506     ## __GenComplexFileFfs__() method\r
507     #\r
508     #   Generate FFS\r
509     #\r
510     #   @param  self        The object pointer\r
511     #   @param  Rule        The rule object used to generate section\r
512     #   @param  InputFileList        The output file list from GenSection\r
513     #   @retval string      Generated FFS file name\r
514     #\r
515     def __GenComplexFileFfs__(self, Rule, InputFile):\r
516         \r
517         CmdParams = self.__GetGenFfsCmdParameter__(Rule)\r
518         \r
519         FfsOutput = os.path.join( self.OutputPath, self.ModuleGuid + '.ffs')\r
520         GenFfsCmd = (\r
521             'GenFfs',\r
522             ) + CmdParams + (\r
523              '-g', self.ModuleGuid,\r
524              '-o', FfsOutput,\r
525             ) + InputFile\r
526 \r
527         GenFdsGlobalVariable.CallExternalTool(GenFfsCmd, "GenFfs Failed !")\r
528         return FfsOutput\r
529 \r
530     ## __GetGenFfsCmdParameter__() method\r
531     #\r
532     #   Create parameter string for GenFfs\r
533     #\r
534     #   @param  self        The object pointer\r
535     #   @param  Rule        The rule object used to generate section\r
536     #   @retval tuple       (FileType, Fixed, CheckSum, Alignment)\r
537     #\r
538     def __GetGenFfsCmdParameter__(self, Rule):\r
539         result = tuple()\r
540         result += ('-t', Ffs.Ffs.FdfFvFileTypeToFileType[Rule.FvFileType])\r
541         #FileType = ' -t ' + \\r
542         #           Ffs.Ffs.FdfFvFileTypeToFileType[Rule.FvFileType]\r
543         if Rule.Fixed != False:\r
544             result += ('-x',)\r
545         if Rule.CheckSum != False:\r
546             result += ('-s',)\r
547             \r
548         if Rule.Alignment != None and Rule.Alignment != '':\r
549             result += ('-a', Rule.Alignment)\r
550             \r
551         return result\r