Re: [edk2] [PATCH] BaseTool: correct the generate compress section process

2018-02-09 Thread Gao, Liming
Reviewed-by: Liming Gao 

>-Original Message-
>From: Feng, YunhuaX
>Sent: Friday, February 09, 2018 4:06 PM
>To: edk2-devel@lists.01.org
>Cc: Zhu, Yonghong ; Gao, Liming
>
>Subject: [PATCH] BaseTool: correct the generate compress section process
>
>First generate a dummy file with section alignment,
>then compress the dummy file to generate the compress file
>
>Cc: Liming Gao 
>Cc: Yonghong Zhu 
>Contributed-under: TianoCore Contribution Agreement 1.1
>Signed-off-by: Yunhua Feng 
>---
> BaseTools/Source/Python/GenFds/CompressSection.py | 13 +
> 1 file changed, 5 insertions(+), 8 deletions(-)
>
>diff --git a/BaseTools/Source/Python/GenFds/CompressSection.py
>b/BaseTools/Source/Python/GenFds/CompressSection.py
>index 98532ed8e6..56e71a3545 100644
>--- a/BaseTools/Source/Python/GenFds/CompressSection.py
>+++ b/BaseTools/Source/Python/GenFds/CompressSection.py
>@@ -58,10 +58,11 @@ class CompressSection (CompressSectionClassObject) :
> if FfsInf != 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)
>@@ -74,27 +75,23 @@ class CompressSection (CompressSectionClassObject) :
> if ReturnSectList != []:
> if AlignValue == None:
> AlignValue = "1"
> for FileData in ReturnSectList:
> SectFiles += (FileData,)
>-
>-if MaxAlign != None:
>-if self.Alignment == None:
>-self.Alignment = MaxAlign
>-else:
>-if GenFdsGlobalVariable.GetAlignment (MaxAlign) >
>GenFdsGlobalVariable.GetAlignment (self.Alignment):
>-self.Alignment = MaxAlign
>+SectAlign.append(AlignValue)
>
> OutputFile = OutputPath + \
>  os.sep + \
>  ModuleName + \
>  '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'],
>+GenFdsGlobalVariable.GenerateSection(OutputFile, [DummyFile],
>Section.Section.SectionType['COMPRESS'],
>  
> CompressionType=self.CompTypeDict[self.CompType],
>IsMakefile=IsMakefile)
> OutputFileList = []
> OutputFileList.append(OutputFile)
> return OutputFileList, self.Alignment
>
>--
>2.12.2.windows.2

___
edk2-devel mailing list
edk2-devel@lists.01.org
https://lists.01.org/mailman/listinfo/edk2-devel


[edk2] [PATCH] BaseTool: correct the generate compress section process

2018-02-09 Thread Feng, YunhuaX
First generate a dummy file with section alignment,
then compress the dummy file to generate the compress file

Cc: Liming Gao 
Cc: Yonghong Zhu 
Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Yunhua Feng 
---
 BaseTools/Source/Python/GenFds/CompressSection.py | 13 +
 1 file changed, 5 insertions(+), 8 deletions(-)

diff --git a/BaseTools/Source/Python/GenFds/CompressSection.py 
b/BaseTools/Source/Python/GenFds/CompressSection.py
index 98532ed8e6..56e71a3545 100644
--- a/BaseTools/Source/Python/GenFds/CompressSection.py
+++ b/BaseTools/Source/Python/GenFds/CompressSection.py
@@ -58,10 +58,11 @@ class CompressSection (CompressSectionClassObject) :
 if FfsInf != 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)
@@ -74,27 +75,23 @@ class CompressSection (CompressSectionClassObject) :
 if ReturnSectList != []:
 if AlignValue == None:
 AlignValue = "1"
 for FileData in ReturnSectList:
 SectFiles += (FileData,)
-
-if MaxAlign != None:
-if self.Alignment == None:
-self.Alignment = MaxAlign
-else:
-if GenFdsGlobalVariable.GetAlignment (MaxAlign) > 
GenFdsGlobalVariable.GetAlignment (self.Alignment):
-self.Alignment = MaxAlign
+SectAlign.append(AlignValue)
 
 OutputFile = OutputPath + \
  os.sep + \
  ModuleName + \
  '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'],
+GenFdsGlobalVariable.GenerateSection(OutputFile, [DummyFile], 
Section.Section.SectionType['COMPRESS'],
  
CompressionType=self.CompTypeDict[self.CompType], IsMakefile=IsMakefile)
 OutputFileList = []
 OutputFileList.append(OutputFile)
 return OutputFileList, self.Alignment
 
-- 
2.12.2.windows.2

___
edk2-devel mailing list
edk2-devel@lists.01.org
https://lists.01.org/mailman/listinfo/edk2-devel