public inbox for devel@edk2.groups.io
 help / color / mirror / Atom feed
* [PATCH] BaseTools: Fix COMPRESS alignment incorrect issue
@ 2018-02-06  7:25 Feng, YunhuaX
  2018-02-07  0:32 ` Zhu, Yonghong
  0 siblings, 1 reply; 2+ messages in thread
From: Feng, YunhuaX @ 2018-02-06  7:25 UTC (permalink / raw)
  To: edk2-devel@lists.01.org; +Cc: Zhu, Yonghong, Gao, Liming

Doesn't generate the correct alignment for the leaf section
in the compression section.
Below FFS rule doesn't work as the expectation.

[Rule.Common.PEIM.PE32]
  FILE PEIM = $(NAMED_GUID) {
    PEI_DEPEX PEI_DEPEX Optional $(INF_OUTPUT)/$(MODULE_NAME).depex
    COMPRESS {
      PE32   PE32  Align=Auto    $(INF_OUTPUT)/$(MODULE_NAME).efi
      UI     STRING="$(MODULE_NAME)" Optional
      VERSION  STRING="$(INF_VERSION)" Optional BUILD_NUM=$(BUILD_NUMBER)
    }
  }

Cc: Liming Gao <liming.gao@intel.com>
Cc: Yonghong Zhu <yonghong.zhu@intel.com>
Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Yunhua Feng <yunhuax.feng@intel.com>
---
 BaseTools/Source/Python/GenFds/CompressSection.py | 14 ++++++++++++++
 1 file changed, 14 insertions(+)

diff --git a/BaseTools/Source/Python/GenFds/CompressSection.py b/BaseTools/Source/Python/GenFds/CompressSection.py
index 64ad275d83..98532ed8e6 100644
--- a/BaseTools/Source/Python/GenFds/CompressSection.py
+++ b/BaseTools/Source/Python/GenFds/CompressSection.py
@@ -59,18 +59,32 @@ class CompressSection (CompressSectionClassObject) :
             self.CompType = FfsInf.__ExtendMacro__(self.CompType)
             self.Alignment = FfsInf.__ExtendMacro__(self.Alignment)
 
         SectFiles = tuple()
         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, IsMakefile=IsMakefile)
+            if AlignValue != None:
+                if MaxAlign == None:
+                    MaxAlign = AlignValue
+                if GenFdsGlobalVariable.GetAlignment (AlignValue) > GenFdsGlobalVariable.GetAlignment (MaxAlign):
+                    MaxAlign = AlignValue
             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
 
         OutputFile = OutputPath + \
                      os.sep     + \
                      ModuleName + \
                      'SEC'      + \
-- 
2.12.2.windows.2



^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [PATCH] BaseTools: Fix COMPRESS alignment incorrect issue
  2018-02-06  7:25 [PATCH] BaseTools: Fix COMPRESS alignment incorrect issue Feng, YunhuaX
@ 2018-02-07  0:32 ` Zhu, Yonghong
  0 siblings, 0 replies; 2+ messages in thread
From: Zhu, Yonghong @ 2018-02-07  0:32 UTC (permalink / raw)
  To: Feng, YunhuaX, edk2-devel@lists.01.org; +Cc: Gao, Liming, Zhu, Yonghong

Reviewed-by: Yonghong Zhu <yonghong.zhu@intel.com> 

Best Regards,
Zhu Yonghong


-----Original Message-----
From: Feng, YunhuaX 
Sent: Tuesday, February 06, 2018 3:26 PM
To: edk2-devel@lists.01.org
Cc: Zhu, Yonghong <yonghong.zhu@intel.com>; Gao, Liming <liming.gao@intel.com>
Subject: [PATCH] BaseTools: Fix COMPRESS alignment incorrect issue

Doesn't generate the correct alignment for the leaf section in the compression section.
Below FFS rule doesn't work as the expectation.

[Rule.Common.PEIM.PE32]
  FILE PEIM = $(NAMED_GUID) {
    PEI_DEPEX PEI_DEPEX Optional $(INF_OUTPUT)/$(MODULE_NAME).depex
    COMPRESS {
      PE32   PE32  Align=Auto    $(INF_OUTPUT)/$(MODULE_NAME).efi
      UI     STRING="$(MODULE_NAME)" Optional
      VERSION  STRING="$(INF_VERSION)" Optional BUILD_NUM=$(BUILD_NUMBER)
    }
  }

Cc: Liming Gao <liming.gao@intel.com>
Cc: Yonghong Zhu <yonghong.zhu@intel.com>
Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Yunhua Feng <yunhuax.feng@intel.com>
---
 BaseTools/Source/Python/GenFds/CompressSection.py | 14 ++++++++++++++
 1 file changed, 14 insertions(+)

diff --git a/BaseTools/Source/Python/GenFds/CompressSection.py b/BaseTools/Source/Python/GenFds/CompressSection.py
index 64ad275d83..98532ed8e6 100644
--- a/BaseTools/Source/Python/GenFds/CompressSection.py
+++ b/BaseTools/Source/Python/GenFds/CompressSection.py
@@ -59,18 +59,32 @@ class CompressSection (CompressSectionClassObject) :
             self.CompType = FfsInf.__ExtendMacro__(self.CompType)
             self.Alignment = FfsInf.__ExtendMacro__(self.Alignment)
 
         SectFiles = tuple()
         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, IsMakefile=IsMakefile)
+            if AlignValue != None:
+                if MaxAlign == None:
+                    MaxAlign = AlignValue
+                if GenFdsGlobalVariable.GetAlignment (AlignValue) > GenFdsGlobalVariable.GetAlignment (MaxAlign):
+                    MaxAlign = AlignValue
             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
 
         OutputFile = OutputPath + \
                      os.sep     + \
                      ModuleName + \
                      'SEC'      + \
--
2.12.2.windows.2



^ permalink raw reply related	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2018-02-07  0:26 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2018-02-06  7:25 [PATCH] BaseTools: Fix COMPRESS alignment incorrect issue Feng, YunhuaX
2018-02-07  0:32 ` Zhu, Yonghong

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox