2 # process compress section generation
4 # Copyright (c) 2007 - 2014, Intel Corporation. All rights reserved.<BR>
6 # 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 import Common
.LongFilePathOs
as os
22 from GenFdsGlobalVariable
import GenFdsGlobalVariable
23 from CommonDataClass
.FdfClass
import CompressSectionClassObject
25 ## generate compress section
28 class CompressSection (CompressSectionClassObject
) :
30 ## compress types: PI standard and non PI standard
38 # @param self The object pointer
41 CompressSectionClassObject
.__init
__(self
)
43 ## GenSection() method
45 # Generate compressed section
47 # @param self The object pointer
48 # @param OutputPath Where to place output file
49 # @param ModuleName Which module this section belongs to
50 # @param SecNum Index of section
51 # @param KeyStringList Filter for inputs of section generation
52 # @param FfsInf FfsInfStatement object that contains this section data
53 # @param Dict dictionary contains macro and its value
54 # @retval tuple (Generated file name, section alignment)
56 def GenSection(self
, OutputPath
, ModuleName
, SecNum
, KeyStringList
, FfsInf
= None, Dict
= {}):
59 self
.CompType
= FfsInf
.__ExtendMacro
__(self
.CompType
)
60 self
.Alignment
= FfsInf
.__ExtendMacro
__(self
.Alignment
)
64 for Sect
in self
.SectionList
:
66 SecIndex
= '%s.%d' %(SecNum
, Index
)
67 ReturnSectList
, AlignValue
= Sect
.GenSection(OutputPath
, ModuleName
, SecIndex
, KeyStringList
, FfsInf
, Dict
)
68 if ReturnSectList
!= []:
69 for FileData
in ReturnSectList
:
70 SectFiles
+= (FileData
,)
73 OutputFile
= OutputPath
+ \
78 Ffs
.SectionSuffix
['COMPRESS']
79 OutputFile
= os
.path
.normpath(OutputFile
)
81 GenFdsGlobalVariable
.GenerateSection(OutputFile
, SectFiles
, Section
.Section
.SectionType
['COMPRESS'],
82 CompressionType
=self
.CompTypeDict
[self
.CompType
])
84 OutputFileList
.append(OutputFile
)
85 return OutputFileList
, self
.Alignment