X-Git-Url: https://git.proxmox.com/?a=blobdiff_plain;f=BaseTools%2FSource%2FPython%2FGenFds%2FCompressSection.py;h=4ae14f27b3e132581349015e70bdf02dd183c7b2;hb=0d1f5b2b5dc3c1cf381be0a1ec8f960dc6029a93;hp=9d9c9cfdf7ea0b1a9a596c30f6d70a19bdcbe1b6;hpb=1be2ed90a20618d71ddf34b8a07d038da0b36854;p=mirror_edk2.git
diff --git a/BaseTools/Source/Python/GenFds/CompressSection.py b/BaseTools/Source/Python/GenFds/CompressSection.py
index 9d9c9cfdf7..4ae14f27b3 100644
--- a/BaseTools/Source/Python/GenFds/CompressSection.py
+++ b/BaseTools/Source/Python/GenFds/CompressSection.py
@@ -1,7 +1,7 @@
## @file
# process compress section generation
#
-# Copyright (c) 2007 - 2014, Intel Corporation. All rights reserved.
+# Copyright (c) 2007 - 2017, Intel Corporation. All rights reserved.
#
# This program and the accompanying materials
# are licensed and made available under the terms and conditions of the BSD License
@@ -18,9 +18,10 @@
from Ffs import Ffs
import Section
import subprocess
-import os
+import Common.LongFilePathOs as os
from GenFdsGlobalVariable import GenFdsGlobalVariable
from CommonDataClass.FdfClass import CompressSectionClassObject
+from Common.DataType import *
## generate compress section
#
@@ -53,33 +54,44 @@ class CompressSection (CompressSectionClassObject) :
# @param Dict dictionary contains macro and its value
# @retval tuple (Generated file name, section alignment)
#
- def GenSection(self, OutputPath, ModuleName, SecNum, KeyStringList, FfsInf = None, Dict = {}):
+ def GenSection(self, OutputPath, ModuleName, SecNum, KeyStringList, FfsInf = None, Dict = {}, IsMakefile = False):
- if FfsInf != None:
+ if FfsInf is not None:
self.CompType = FfsInf.__ExtendMacro__(self.CompType)
self.Alignment = FfsInf.__ExtendMacro__(self.Alignment)
SectFiles = tuple()
+ SectAlign = []
Index = 0
+ MaxAlign = None
for Sect in self.SectionList:
Index = Index + 1
SecIndex = '%s.%d' %(SecNum, Index)
- ReturnSectList, AlignValue = Sect.GenSection(OutputPath, ModuleName, SecIndex, KeyStringList, FfsInf, Dict)
+ ReturnSectList, AlignValue = Sect.GenSection(OutputPath, ModuleName, SecIndex, KeyStringList, FfsInf, Dict, IsMakefile=IsMakefile)
+ if AlignValue is not None:
+ if MaxAlign is None:
+ MaxAlign = AlignValue
+ if GenFdsGlobalVariable.GetAlignment (AlignValue) > GenFdsGlobalVariable.GetAlignment (MaxAlign):
+ MaxAlign = AlignValue
if ReturnSectList != []:
+ if AlignValue is None:
+ AlignValue = "1"
for FileData in ReturnSectList:
- SectFiles += (FileData,)
-
+ SectFiles += (FileData,)
+ SectAlign.append(AlignValue)
OutputFile = OutputPath + \
os.sep + \
ModuleName + \
- 'SEC' + \
+ SUP_MODULE_SEC + \
SecNum + \
Ffs.SectionSuffix['COMPRESS']
OutputFile = os.path.normpath(OutputFile)
+ DummyFile = OutputFile + '.dummy'
+ GenFdsGlobalVariable.GenerateSection(DummyFile, SectFiles, InputAlign=SectAlign, IsMakefile=IsMakefile)
- GenFdsGlobalVariable.GenerateSection(OutputFile, SectFiles, Section.Section.SectionType['COMPRESS'],
- CompressionType=self.CompTypeDict[self.CompType])
+ GenFdsGlobalVariable.GenerateSection(OutputFile, [DummyFile], Section.Section.SectionType['COMPRESS'],
+ CompressionType=self.CompTypeDict[self.CompType], IsMakefile=IsMakefile)
OutputFileList = []
OutputFileList.append(OutputFile)
return OutputFileList, self.Alignment