summaryrefslogtreecommitdiffstats
path: root/BaseTools/Source/Python/AutoGen/GenVar.py
diff options
context:
space:
mode:
authorLiming Gao <liming.gao@intel.com>2017-12-22 20:04:04 +0800
committerLiming Gao <liming.gao@intel.com>2017-12-25 11:05:47 +0800
commit2b8a6c44e0deb508f79804dd5ff7156bc7e25493 (patch)
tree8f8d979291dabc3c918d821ecbb7c28186ca5e9d /BaseTools/Source/Python/AutoGen/GenVar.py
parent8518bf0b92a78938341a2752a0044f04336668cc (diff)
downloadedk2-2b8a6c44e0deb508f79804dd5ff7156bc7e25493.tar.gz
edk2-2b8a6c44e0deb508f79804dd5ff7156bc7e25493.tar.bz2
edk2-2b8a6c44e0deb508f79804dd5ff7156bc7e25493.zip
BaseTools: PcdDataBase Optimization for multiple SkuIds
https://bugzilla.tianocore.org/show_bug.cgi?id=546 BaseTools will generate the optimized PCD database to save the image size at build time for multiple SKUs. The optimized PCD database layout will be like below, the PCD database will be composed of the full default SKU data (PCD_DATABASE_INIT) and the non-default SKU delta data(PCD_DATABASE_SKU_DELTA). PCD driver will build HOB to store the full default SKU data, and patch HOB data based on non-default SKU delta data for the SKU set by SetSku(), it can save memory resource at boot time. // // PCD database layout: // +---------------------------------+ // | PCD_DATABASE_INIT (DEFAULT SKU) | // +---------------------------------+ // | PCD_DATABASE_SKU_DELTA (SKU A) | // +---------------------------------+ // | PCD_DATABASE_SKU_DELTA (SKU B) | // +---------------------------------+ // | ...... | // +---------------------------------+ // BaseTools, PCD database and driver updates are needed for this proposal. For single SKU (default) case, this proposal is expected to have no impact. For multi-SKU case, PCD database format will be changed. So, PcdDataBase Version is also updated from 6 to 7. Contributed-under: TianoCore Contribution Agreement 1.1 Signed-off-by: Feng Bob C <bob.c.feng@intel.com> Reviewed-by: Liming Gao <liming.gao@intel.com>
Diffstat (limited to 'BaseTools/Source/Python/AutoGen/GenVar.py')
-rw-r--r--BaseTools/Source/Python/AutoGen/GenVar.py27
1 files changed, 22 insertions, 5 deletions
diff --git a/BaseTools/Source/Python/AutoGen/GenVar.py b/BaseTools/Source/Python/AutoGen/GenVar.py
index 98e1a4cdae..7ee39796e3 100644
--- a/BaseTools/Source/Python/AutoGen/GenVar.py
+++ b/BaseTools/Source/Python/AutoGen/GenVar.py
@@ -115,6 +115,9 @@ class VariableMgr(object):
var_data = self.process_variable_data()
+ if not var_data:
+ return []
+
pcds_default_data = var_data.get(("DEFAULT","STANDARD"))
NvStoreDataBuffer = ""
var_data_offset = collections.OrderedDict()
@@ -129,6 +132,11 @@ class VariableMgr(object):
else:
var_attr_value = 0x07
+# print "default var_name_buffer"
+# print self.format_data(var_name_buffer)
+# print "default var_buffer"
+# print self.format_data(default_data)
+
DataBuffer = self.AlignData(var_name_buffer + default_data)
data_size = len(DataBuffer)
@@ -143,6 +151,8 @@ class VariableMgr(object):
nv_default_part = self.AlignData(self.PACK_DEFAULT_DATA(0, 0, self.unpack_data(variable_storage_header_buffer+NvStoreDataBuffer)))
+# print "default whole data \n",self.format_data(nv_default_part)
+
data_delta_structure_buffer = ""
for skuname,defaultstore in var_data:
if (skuname,defaultstore) == ("DEFAULT","STANDARD"):
@@ -156,6 +166,9 @@ class VariableMgr(object):
delta_data_set.extend(delta_data)
data_delta_structure_buffer += self.AlignData(self.PACK_DELTA_DATA(skuname,defaultstore,delta_data_set))
+# print "delta data"
+# print delta_data_set
+# print self.format_data(self.AlignData(self.PACK_DELTA_DATA(skuname,defaultstore,delta_data_set)))
return self.format_data(nv_default_part + data_delta_structure_buffer)
@@ -171,6 +184,8 @@ class VariableMgr(object):
return final_data
def calculate_delta(self, default, theother):
+# print "default data \n", default
+# print "other data \n",theother
if len(default) - len(theother) != 0:
EdkLogger.error("build", FORMAT_INVALID, 'The variable data length is not the same for the same PCD.')
data_delta = []
@@ -182,11 +197,13 @@ class VariableMgr(object):
def dump(self):
default_var_bin = self.new_process_varinfo()
- value_str = "{"
- default_var_bin_strip = [ data.strip("""'""") for data in default_var_bin]
- value_str += ",".join(default_var_bin_strip)
- value_str += "}"
- return value_str
+ if default_var_bin:
+ value_str = "{"
+ default_var_bin_strip = [ data.strip("""'""") for data in default_var_bin]
+ value_str += ",".join(default_var_bin_strip)
+ value_str += "}"
+ return value_str
+ return ""
def PACK_VARIABLE_STORE_HEADER(self,size):
#Signature: gEfiVariableGuid