]> git.proxmox.com Git - mirror_edk2.git/blame - BaseTools/Source/Python/GenFds/CompressSection.py
License header updated to match correct format.
[mirror_edk2.git] / BaseTools / Source / Python / GenFds / CompressSection.py
CommitLineData
30fdf114
LG
1## @file\r
2# process compress section generation\r
3#\r
1be2ed90 4# Copyright (c) 2007 - 2014, Intel Corporation. All rights reserved.<BR>\r
30fdf114 5#\r
40d841f6 6# This program and the accompanying materials\r
30fdf114
LG
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
18from Ffs import Ffs\r
19import Section\r
20import subprocess\r
97fa0ee9 21import Common.LongFilePathOs as os\r
30fdf114
LG
22from GenFdsGlobalVariable import GenFdsGlobalVariable\r
23from CommonDataClass.FdfClass import CompressSectionClassObject\r
24\r
25## generate compress section\r
26#\r
27#\r
28class CompressSection (CompressSectionClassObject) :\r
29\r
30 ## compress types: PI standard and non PI standard\r
31 CompTypeDict = {\r
52302d4d
LG
32 'PI_STD' : 'PI_STD',\r
33 'PI_NONE' : 'PI_NONE'\r
30fdf114
LG
34 }\r
35\r
36 ## The constructor\r
37 #\r
38 # @param self The object pointer\r
39 #\r
40 def __init__(self):\r
41 CompressSectionClassObject.__init__(self)\r
42\r
43 ## GenSection() method\r
44 #\r
45 # Generate compressed section\r
46 #\r
47 # @param self The object pointer\r
48 # @param OutputPath Where to place output file\r
49 # @param ModuleName Which module this section belongs to\r
50 # @param SecNum Index of section\r
51 # @param KeyStringList Filter for inputs of section generation\r
52 # @param FfsInf FfsInfStatement object that contains this section data\r
53 # @param Dict dictionary contains macro and its value\r
54 # @retval tuple (Generated file name, section alignment)\r
55 #\r
56 def GenSection(self, OutputPath, ModuleName, SecNum, KeyStringList, FfsInf = None, Dict = {}):\r
57\r
58 if FfsInf != None:\r
59 self.CompType = FfsInf.__ExtendMacro__(self.CompType)\r
60 self.Alignment = FfsInf.__ExtendMacro__(self.Alignment)\r
61\r
62 SectFiles = tuple()\r
63 Index = 0\r
64 for Sect in self.SectionList:\r
65 Index = Index + 1\r
66 SecIndex = '%s.%d' %(SecNum, Index)\r
67 ReturnSectList, AlignValue = Sect.GenSection(OutputPath, ModuleName, SecIndex, KeyStringList, FfsInf, Dict)\r
68 if ReturnSectList != []:\r
69 for FileData in ReturnSectList:\r
70 SectFiles += (FileData,)\r
71\r
72\r
73 OutputFile = OutputPath + \\r
74 os.sep + \\r
75 ModuleName + \\r
76 'SEC' + \\r
77 SecNum + \\r
78 Ffs.SectionSuffix['COMPRESS']\r
79 OutputFile = os.path.normpath(OutputFile)\r
80\r
81 GenFdsGlobalVariable.GenerateSection(OutputFile, SectFiles, Section.Section.SectionType['COMPRESS'],\r
82 CompressionType=self.CompTypeDict[self.CompType])\r
83 OutputFileList = []\r
84 OutputFileList.append(OutputFile)\r
85 return OutputFileList, self.Alignment\r
86\r
87\r