From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received-SPF: Pass (sender SPF authorized) identity=mailfrom; client-ip=192.55.52.136; helo=mga12.intel.com; envelope-from=bob.c.feng@intel.com; receiver=edk2-devel@lists.01.org Received: from mga12.intel.com (mga12.intel.com [192.55.52.136]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ml01.01.org (Postfix) with ESMTPS id 6A56F2252CBAC for ; Thu, 22 Mar 2018 19:17:36 -0700 (PDT) X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from fmsmga005.fm.intel.com ([10.253.24.32]) by fmsmga106.fm.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 22 Mar 2018 19:24:08 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.48,347,1517904000"; d="scan'208";a="214107376" Received: from shwdeopenpsi105.ccr.corp.intel.com ([10.239.9.129]) by fmsmga005.fm.intel.com with ESMTP; 22 Mar 2018 19:24:07 -0700 From: BobCF To: edk2-devel@lists.01.org Cc: Bob Feng , Liming Gao Date: Fri, 23 Mar 2018 10:24:03 +0800 Message-Id: <20180323022403.30156-1-bob.c.feng@intel.com> X-Mailer: git-send-email 2.14.3.windows.1 Subject: [Patch] BaseTool: Fixed the issue of empty PcdDB. X-BeenThere: edk2-devel@lists.01.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: EDK II Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 23 Mar 2018 02:17:36 -0000 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 Cc: Liming Gao --- BaseTools/Source/Python/AutoGen/GenPcdDb.py | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/BaseTools/Source/Python/AutoGen/GenPcdDb.py b/BaseTools/Source/Python/AutoGen/GenPcdDb.py index e2848e7aaf..e4d7f3b759 100644 --- a/BaseTools/Source/Python/AutoGen/GenPcdDb.py +++ b/BaseTools/Source/Python/AutoGen/GenPcdDb.py @@ -978,12 +978,10 @@ def CreatePcdDatabaseCode (Info, AutoGenC, AutoGenH): DbFile.write(PcdDbBuffer) Changed = SaveFileOnChange(DbFileName, DbFile.getvalue(), True) def CreatePcdDataBase(PcdDBData): delta = {} basedata = {} - if not PcdDBData: - return "" for skuname,skuid in PcdDBData: if len(PcdDBData[(skuname,skuid)][1]) != len(PcdDBData[("DEFAULT","0")][1]): EdkLogger.ERROR("The size of each sku in one pcd are not same") for skuname,skuid in PcdDBData: if skuname == "DEFAULT": @@ -1059,13 +1057,16 @@ def NewCreatePcdDatabasePhaseSpecificAutoGen(Platform,Phase): VarCheckTable = CreateVarCheckBin(VarCheckTableData) VarCheckTable.dump(dest, Phase) AdditionalAutoGenH, AdditionalAutoGenC = CreateAutoGen(PcdDriverAutoGenData) else: AdditionalAutoGenH, AdditionalAutoGenC, PcdDbBuffer,VarCheckTab = CreatePcdDatabasePhaseSpecificAutoGen (Platform,{}, Phase) + final_data = () + for item in PcdDbBuffer: + final_data += unpack("B",item) + PcdDBData[("DEFAULT","0")] = (PcdDbBuffer, final_data) - PcdDbBuffer = CreatePcdDataBase(PcdDBData) - return AdditionalAutoGenH, AdditionalAutoGenC, PcdDbBuffer + return AdditionalAutoGenH, AdditionalAutoGenC, CreatePcdDataBase(PcdDBData) ## Create PCD database in DXE or PEI phase # # @param Platform The platform object # @retval tuple Two TemplateString objects for C code and header file, # respectively -- 2.14.3.windows.1