BaseTool: Fixed the issue of empty PcdDB.
authorBobCF <bob.c.feng@intel.com>
Fri, 23 Mar 2018 02:24:03 +0000 (10:24 +0800)
committerLiming Gao <liming.gao@intel.com>
Fri, 23 Mar 2018 03:23:50 +0000 (11:23 +0800)
If there is no dynamic pcds, there should be DB header
in the Pcd DataBase.

Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Bob Feng <bob.c.feng@intel.com>
Cc: Liming Gao <liming.gao@intel.com>
Reviewed-by: Liming Gao <liming.gao@intel.com>
BaseTools/Source/Python/AutoGen/GenPcdDb.py

index e2848e7aaf3760faaa0918f45ca57fec2c959982..e4d7f3b759a9e7761a305578f20a3ebff608f539 100644 (file)
@@ -980,8 +980,6 @@ def CreatePcdDatabaseCode (Info, AutoGenC, AutoGenH):
 def CreatePcdDataBase(PcdDBData):\r
     delta = {}\r
     basedata = {}\r
-    if not PcdDBData:\r
-        return ""\r
     for skuname,skuid in PcdDBData:\r
         if len(PcdDBData[(skuname,skuid)][1]) != len(PcdDBData[("DEFAULT","0")][1]):\r
             EdkLogger.ERROR("The size of each sku in one pcd are not same")\r
@@ -1061,9 +1059,12 @@ def NewCreatePcdDatabasePhaseSpecificAutoGen(Platform,Phase):
         AdditionalAutoGenH, AdditionalAutoGenC =  CreateAutoGen(PcdDriverAutoGenData)\r
     else:\r
         AdditionalAutoGenH, AdditionalAutoGenC, PcdDbBuffer,VarCheckTab = CreatePcdDatabasePhaseSpecificAutoGen (Platform,{}, Phase)\r
+        final_data = ()\r
+        for item in PcdDbBuffer:\r
+            final_data += unpack("B",item)\r
+        PcdDBData[("DEFAULT","0")] = (PcdDbBuffer, final_data)\r
 \r
-    PcdDbBuffer = CreatePcdDataBase(PcdDBData)\r
-    return AdditionalAutoGenH, AdditionalAutoGenC, PcdDbBuffer\r
+    return AdditionalAutoGenH, AdditionalAutoGenC, CreatePcdDataBase(PcdDBData)\r
 ## Create PCD database in DXE or PEI phase\r
 #\r
 #   @param      Platform    The platform object\r