[edk2-devel] [Patch] BaseTools: Sort the Pcd set when generating the VPD binary

Bob Feng posted 1 patch 4 years, 2 months ago
Failed in applying to current master (apply log)
BaseTools/Source/Python/AutoGen/PlatformAutoGen.py | 2 +-
BaseTools/Source/Python/Workspace/DscBuildData.py  | 2 +-
2 files changed, 2 insertions(+), 2 deletions(-)
[edk2-devel] [Patch] BaseTools: Sort the Pcd set when generating the VPD binary
Posted by Bob Feng 4 years, 2 months ago
If VPD PcdNvStoreDefaultValueBuffer is used, all DynamicHii and
DynamicExHii PCD value will be generated into that VPD.

In order to generate the same VPD binary file in every build,
sort the Pcd set when generating VPD.

Signed-off-by: Bob Feng <bob.c.feng@intel.com>
Cc: Liming Gao <gaoliming@byosoft.com.cn>
Cc: Yuwei Chen <yuwei.chen@intel.com>
---
 BaseTools/Source/Python/AutoGen/PlatformAutoGen.py | 2 +-
 BaseTools/Source/Python/Workspace/DscBuildData.py  | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/BaseTools/Source/Python/AutoGen/PlatformAutoGen.py b/BaseTools/Source/Python/AutoGen/PlatformAutoGen.py
index af66c48c7d..26ab8e7f36 100644
--- a/BaseTools/Source/Python/AutoGen/PlatformAutoGen.py
+++ b/BaseTools/Source/Python/AutoGen/PlatformAutoGen.py
@@ -251,11 +251,11 @@ class PlatformAutoGen(AutoGen):
 
         VariableInfo = VariableMgr(self.DscBuildDataObj._GetDefaultStores(), self.DscBuildDataObj.SkuIds)
         VariableInfo.SetVpdRegionMaxSize(VpdRegionSize)
         VariableInfo.SetVpdRegionOffset(VpdRegionBase)
         Index = 0
-        for Pcd in DynamicPcdSet:
+        for Pcd in sorted(DynamicPcdSet):
             pcdname = ".".join((Pcd.TokenSpaceGuidCName, Pcd.TokenCName))
             for SkuName in Pcd.SkuInfoList:
                 Sku = Pcd.SkuInfoList[SkuName]
                 SkuId = Sku.SkuId
                 if SkuId is None or SkuId == '':
diff --git a/BaseTools/Source/Python/Workspace/DscBuildData.py b/BaseTools/Source/Python/Workspace/DscBuildData.py
index 1afbd3eefc..4a128c8a77 100644
--- a/BaseTools/Source/Python/Workspace/DscBuildData.py
+++ b/BaseTools/Source/Python/Workspace/DscBuildData.py
@@ -2582,11 +2582,11 @@ class DscBuildData(PlatformBuildClassObject):
                     IncludeFiles.add(IncludeFile)
                     CApp = CApp + '#include <%s>\n' % (IncludeFile)
         CApp = CApp + '\n'
         for Pcd in StructuredPcds.values():
             CApp = CApp + self.GenerateArrayAssignment(Pcd)
-        for PcdName in StructuredPcds:
+        for PcdName in sorted(StructuredPcds.keys()):
             Pcd = StructuredPcds[PcdName]
             CApp = CApp + self.GenerateSizeFunction(Pcd)
             CApp = CApp + self.GenerateDefaultValueAssignFunction(Pcd)
             CApp = CApp + self.GenerateFdfValue(Pcd)
             CApp = CApp + self.GenerateCommandLineValue(Pcd)
-- 
2.20.1.windows.1


-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.

View/Reply Online (#65056): https://edk2.groups.io/g/devel/message/65056
Mute This Topic: https://groups.io/mt/76630786/1787277
Group Owner: devel+owner@edk2.groups.io
Unsubscribe: https://edk2.groups.io/g/devel/unsub  [importer@patchew.org]
-=-=-=-=-=-=-=-=-=-=-=-

Re: [edk2-devel] [Patch] BaseTools: Sort the Pcd set when generating the VPD binary
Posted by Philippe Mathieu-Daudé 4 years, 2 months ago
On 9/4/20 4:30 PM, Bob Feng wrote:
> If VPD PcdNvStoreDefaultValueBuffer is used, all DynamicHii and
> DynamicExHii PCD value will be generated into that VPD.
> 
> In order to generate the same VPD binary file in every build,
> sort the Pcd set when generating VPD.
> 
> Signed-off-by: Bob Feng <bob.c.feng@intel.com>
> Cc: Liming Gao <gaoliming@byosoft.com.cn>
> Cc: Yuwei Chen <yuwei.chen@intel.com>

Reviewed-by: Philippe Mathieu-Daude <philmd@redhat.com>

> ---
>  BaseTools/Source/Python/AutoGen/PlatformAutoGen.py | 2 +-
>  BaseTools/Source/Python/Workspace/DscBuildData.py  | 2 +-
>  2 files changed, 2 insertions(+), 2 deletions(-)
> 
> diff --git a/BaseTools/Source/Python/AutoGen/PlatformAutoGen.py b/BaseTools/Source/Python/AutoGen/PlatformAutoGen.py
> index af66c48c7d..26ab8e7f36 100644
> --- a/BaseTools/Source/Python/AutoGen/PlatformAutoGen.py
> +++ b/BaseTools/Source/Python/AutoGen/PlatformAutoGen.py
> @@ -251,11 +251,11 @@ class PlatformAutoGen(AutoGen):
>  
>          VariableInfo = VariableMgr(self.DscBuildDataObj._GetDefaultStores(), self.DscBuildDataObj.SkuIds)
>          VariableInfo.SetVpdRegionMaxSize(VpdRegionSize)
>          VariableInfo.SetVpdRegionOffset(VpdRegionBase)
>          Index = 0
> -        for Pcd in DynamicPcdSet:
> +        for Pcd in sorted(DynamicPcdSet):
>              pcdname = ".".join((Pcd.TokenSpaceGuidCName, Pcd.TokenCName))
>              for SkuName in Pcd.SkuInfoList:
>                  Sku = Pcd.SkuInfoList[SkuName]
>                  SkuId = Sku.SkuId
>                  if SkuId is None or SkuId == '':
> diff --git a/BaseTools/Source/Python/Workspace/DscBuildData.py b/BaseTools/Source/Python/Workspace/DscBuildData.py
> index 1afbd3eefc..4a128c8a77 100644
> --- a/BaseTools/Source/Python/Workspace/DscBuildData.py
> +++ b/BaseTools/Source/Python/Workspace/DscBuildData.py
> @@ -2582,11 +2582,11 @@ class DscBuildData(PlatformBuildClassObject):
>                      IncludeFiles.add(IncludeFile)
>                      CApp = CApp + '#include <%s>\n' % (IncludeFile)
>          CApp = CApp + '\n'
>          for Pcd in StructuredPcds.values():
>              CApp = CApp + self.GenerateArrayAssignment(Pcd)
> -        for PcdName in StructuredPcds:
> +        for PcdName in sorted(StructuredPcds.keys()):
>              Pcd = StructuredPcds[PcdName]
>              CApp = CApp + self.GenerateSizeFunction(Pcd)
>              CApp = CApp + self.GenerateDefaultValueAssignFunction(Pcd)
>              CApp = CApp + self.GenerateFdfValue(Pcd)
>              CApp = CApp + self.GenerateCommandLineValue(Pcd)
> 


-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.

View/Reply Online (#65085): https://edk2.groups.io/g/devel/message/65085
Mute This Topic: https://groups.io/mt/76630786/1787277
Group Owner: devel+owner@edk2.groups.io
Unsubscribe: https://edk2.groups.io/g/devel/unsub  [importer@patchew.org]
-=-=-=-=-=-=-=-=-=-=-=-

Re: [edk2-devel] [Patch] BaseTools: Sort the Pcd set when generating the VPD binary
Posted by Bob Feng 4 years, 2 months ago
Patch is pushed at 859e095.


Thanks,
Bob

-----Original Message-----
From: Philippe Mathieu-Daudé <philmd@redhat.com> 
Sent: Monday, September 7, 2020 9:49 PM
To: devel@edk2.groups.io; Feng, Bob C <bob.c.feng@intel.com>
Cc: Liming Gao <gaoliming@byosoft.com.cn>; Chen, Christine <yuwei.chen@intel.com>
Subject: Re: [edk2-devel] [Patch] BaseTools: Sort the Pcd set when generating the VPD binary

On 9/4/20 4:30 PM, Bob Feng wrote:
> If VPD PcdNvStoreDefaultValueBuffer is used, all DynamicHii and 
> DynamicExHii PCD value will be generated into that VPD.
> 
> In order to generate the same VPD binary file in every build, sort the 
> Pcd set when generating VPD.
> 
> Signed-off-by: Bob Feng <bob.c.feng@intel.com>
> Cc: Liming Gao <gaoliming@byosoft.com.cn>
> Cc: Yuwei Chen <yuwei.chen@intel.com>

Reviewed-by: Philippe Mathieu-Daude <philmd@redhat.com>

> ---
>  BaseTools/Source/Python/AutoGen/PlatformAutoGen.py | 2 +-  
> BaseTools/Source/Python/Workspace/DscBuildData.py  | 2 +-
>  2 files changed, 2 insertions(+), 2 deletions(-)
> 
> diff --git a/BaseTools/Source/Python/AutoGen/PlatformAutoGen.py 
> b/BaseTools/Source/Python/AutoGen/PlatformAutoGen.py
> index af66c48c7d..26ab8e7f36 100644
> --- a/BaseTools/Source/Python/AutoGen/PlatformAutoGen.py
> +++ b/BaseTools/Source/Python/AutoGen/PlatformAutoGen.py
> @@ -251,11 +251,11 @@ class PlatformAutoGen(AutoGen):
>  
>          VariableInfo = VariableMgr(self.DscBuildDataObj._GetDefaultStores(), self.DscBuildDataObj.SkuIds)
>          VariableInfo.SetVpdRegionMaxSize(VpdRegionSize)
>          VariableInfo.SetVpdRegionOffset(VpdRegionBase)
>          Index = 0
> -        for Pcd in DynamicPcdSet:
> +        for Pcd in sorted(DynamicPcdSet):
>              pcdname = ".".join((Pcd.TokenSpaceGuidCName, Pcd.TokenCName))
>              for SkuName in Pcd.SkuInfoList:
>                  Sku = Pcd.SkuInfoList[SkuName]
>                  SkuId = Sku.SkuId
>                  if SkuId is None or SkuId == '':
> diff --git a/BaseTools/Source/Python/Workspace/DscBuildData.py 
> b/BaseTools/Source/Python/Workspace/DscBuildData.py
> index 1afbd3eefc..4a128c8a77 100644
> --- a/BaseTools/Source/Python/Workspace/DscBuildData.py
> +++ b/BaseTools/Source/Python/Workspace/DscBuildData.py
> @@ -2582,11 +2582,11 @@ class DscBuildData(PlatformBuildClassObject):
>                      IncludeFiles.add(IncludeFile)
>                      CApp = CApp + '#include <%s>\n' % (IncludeFile)
>          CApp = CApp + '\n'
>          for Pcd in StructuredPcds.values():
>              CApp = CApp + self.GenerateArrayAssignment(Pcd)
> -        for PcdName in StructuredPcds:
> +        for PcdName in sorted(StructuredPcds.keys()):
>              Pcd = StructuredPcds[PcdName]
>              CApp = CApp + self.GenerateSizeFunction(Pcd)
>              CApp = CApp + self.GenerateDefaultValueAssignFunction(Pcd)
>              CApp = CApp + self.GenerateFdfValue(Pcd)
>              CApp = CApp + self.GenerateCommandLineValue(Pcd)
> 


-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.

View/Reply Online (#65131): https://edk2.groups.io/g/devel/message/65131
Mute This Topic: https://groups.io/mt/76630786/1787277
Group Owner: devel+owner@edk2.groups.io
Unsubscribe: https://edk2.groups.io/g/devel/unsub  [importer@patchew.org]
-=-=-=-=-=-=-=-=-=-=-=-

[edk2-devel] 回复: [Patch] BaseTools: Sort the Pcd set when generating the VPD binary
Posted by gaoliming 4 years, 2 months ago
Reviewed-by: Liming Gao <gaoliming@byosoft.com.cn>

> -----邮件原件-----
> 发件人: Bob Feng <bob.c.feng@intel.com>
> 发送时间: 2020年9月4日 22:30
> 收件人: devel@edk2.groups.io
> 抄送: Liming Gao <gaoliming@byosoft.com.cn>; Yuwei Chen
> <yuwei.chen@intel.com>
> 主题: [Patch] BaseTools: Sort the Pcd set when generating the VPD binary
> 
> If VPD PcdNvStoreDefaultValueBuffer is used, all DynamicHii and
> DynamicExHii PCD value will be generated into that VPD.
> 
> In order to generate the same VPD binary file in every build,
> sort the Pcd set when generating VPD.
> 
> Signed-off-by: Bob Feng <bob.c.feng@intel.com>
> Cc: Liming Gao <gaoliming@byosoft.com.cn>
> Cc: Yuwei Chen <yuwei.chen@intel.com>
> ---
>  BaseTools/Source/Python/AutoGen/PlatformAutoGen.py | 2 +-
>  BaseTools/Source/Python/Workspace/DscBuildData.py  | 2 +-
>  2 files changed, 2 insertions(+), 2 deletions(-)
> 
> diff --git a/BaseTools/Source/Python/AutoGen/PlatformAutoGen.py
> b/BaseTools/Source/Python/AutoGen/PlatformAutoGen.py
> index af66c48c7d..26ab8e7f36 100644
> --- a/BaseTools/Source/Python/AutoGen/PlatformAutoGen.py
> +++ b/BaseTools/Source/Python/AutoGen/PlatformAutoGen.py
> @@ -251,11 +251,11 @@ class PlatformAutoGen(AutoGen):
> 
>          VariableInfo =
> VariableMgr(self.DscBuildDataObj._GetDefaultStores(),
> self.DscBuildDataObj.SkuIds)
>          VariableInfo.SetVpdRegionMaxSize(VpdRegionSize)
>          VariableInfo.SetVpdRegionOffset(VpdRegionBase)
>          Index = 0
> -        for Pcd in DynamicPcdSet:
> +        for Pcd in sorted(DynamicPcdSet):
>              pcdname = ".".join((Pcd.TokenSpaceGuidCName,
> Pcd.TokenCName))
>              for SkuName in Pcd.SkuInfoList:
>                  Sku = Pcd.SkuInfoList[SkuName]
>                  SkuId = Sku.SkuId
>                  if SkuId is None or SkuId == '':
> diff --git a/BaseTools/Source/Python/Workspace/DscBuildData.py
> b/BaseTools/Source/Python/Workspace/DscBuildData.py
> index 1afbd3eefc..4a128c8a77 100644
> --- a/BaseTools/Source/Python/Workspace/DscBuildData.py
> +++ b/BaseTools/Source/Python/Workspace/DscBuildData.py
> @@ -2582,11 +2582,11 @@ class DscBuildData(PlatformBuildClassObject):
>                      IncludeFiles.add(IncludeFile)
>                      CApp = CApp + '#include <%s>\n' % (IncludeFile)
>          CApp = CApp + '\n'
>          for Pcd in StructuredPcds.values():
>              CApp = CApp + self.GenerateArrayAssignment(Pcd)
> -        for PcdName in StructuredPcds:
> +        for PcdName in sorted(StructuredPcds.keys()):
>              Pcd = StructuredPcds[PcdName]
>              CApp = CApp + self.GenerateSizeFunction(Pcd)
>              CApp = CApp + self.GenerateDefaultValueAssignFunction(Pcd)
>              CApp = CApp + self.GenerateFdfValue(Pcd)
>              CApp = CApp + self.GenerateCommandLineValue(Pcd)
> --
> 2.20.1.windows.1




-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.

View/Reply Online (#65065): https://edk2.groups.io/g/devel/message/65065
Mute This Topic: https://groups.io/mt/76677816/1787277
Group Owner: devel+owner@edk2.groups.io
Unsubscribe: https://edk2.groups.io/g/devel/unsub  [importer@patchew.org]
-=-=-=-=-=-=-=-=-=-=-=-