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