X-Git-Url: https://git.proxmox.com/?p=mirror_edk2.git;a=blobdiff_plain;f=BaseTools%2FSource%2FPython%2FGenFds%2FCompressSection.py;h=08ab48669f4546ee0a9c07eaf5ba1936f42eddbd;hp=7e126678a2d5950cc4a645a933da59c9d2e4cd83;hb=1563349a967d7e02c43492ba853babb9c660a083;hpb=52302d4dee589a5df43a464420c9fe68ba83937d diff --git a/BaseTools/Source/Python/GenFds/CompressSection.py b/BaseTools/Source/Python/GenFds/CompressSection.py index 7e126678a2..08ab48669f 100644 --- a/BaseTools/Source/Python/GenFds/CompressSection.py +++ b/BaseTools/Source/Python/GenFds/CompressSection.py @@ -1,9 +1,9 @@ ## @file # process compress section generation # -# Copyright (c) 2007, Intel Corporation +# Copyright (c) 2007 - 2017, Intel Corporation. All rights reserved.
# -# All rights reserved. This program and the accompanying materials +# This program and the accompanying materials # are licensed and made available under the terms and conditions of the BSD License # which accompanies this distribution. The full text of the license may be found at # http://opensource.org/licenses/bsd-license.php @@ -18,7 +18,7 @@ from Ffs import Ffs import Section import subprocess -import os +import Common.LongFilePathOs as os from GenFdsGlobalVariable import GenFdsGlobalVariable from CommonDataClass.FdfClass import CompressSectionClassObject @@ -53,22 +53,31 @@ 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 + \ @@ -77,9 +86,11 @@ class CompressSection (CompressSectionClassObject) : 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