From mboxrd@z Thu Jan 1 00:00:00 1970 Authentication-Results: mx.groups.io; dkim=missing; spf=pass (domain: intel.com, ip: 192.55.52.136, mailfrom: liming.gao@intel.com) Received: from mga12.intel.com (mga12.intel.com [192.55.52.136]) by groups.io with SMTP; Sun, 01 Sep 2019 18:31:08 -0700 X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from orsmga002.jf.intel.com ([10.7.209.21]) by fmsmga106.fm.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 01 Sep 2019 18:31:07 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.64,457,1559545200"; d="scan'208";a="193928880" Received: from lgao4-mobl1.ccr.corp.intel.com ([10.255.29.242]) by orsmga002.jf.intel.com with ESMTP; 01 Sep 2019 18:31:06 -0700 From: "Liming Gao" To: devel@edk2.groups.io Cc: Bob Feng Subject: [Patch] BaseTools: Update GenFw tool to support -e -z option together Date: Mon, 2 Sep 2019 09:31:02 +0800 Message-Id: <20190902013102.20696-1-liming.gao@intel.com> X-Mailer: git-send-email 2.16.2.windows.1 BZ: https://bugzilla.tianocore.org/show_bug.cgi?id=1727 -e -z option is to generate EFI image with zero debug entry. It can be used to check the EFI image in DEBUG build. Signed-off-by: Liming Gao Cc: Bob Feng --- BaseTools/Source/C/GenFw/GenFw.c | 17 +++++++++++++++-- 1 file changed, 15 insertions(+), 2 deletions(-) diff --git a/BaseTools/Source/C/GenFw/GenFw.c b/BaseTools/Source/C/GenFw/GenFw.c index 973bae5fe4..c99782b78e 100644 --- a/BaseTools/Source/C/GenFw/GenFw.c +++ b/BaseTools/Source/C/GenFw/GenFw.c @@ -1111,6 +1111,7 @@ Returns: time_t InputFileTime; time_t OutputFileTime; struct stat Stat_Buf; + BOOLEAN ZeroDebugFlag; SetUtilityName (UTILITY_NAME); @@ -1158,6 +1159,7 @@ Returns: NegativeAddr = FALSE; InputFileTime = 0; OutputFileTime = 0; + ZeroDebugFlag = FALSE; if (argc == 1) { Error (NULL, 0, 1001, "Missing options", "No input options."); @@ -1197,6 +1199,9 @@ Returns: goto Finish; } ModuleType = argv[1]; + if (mOutImageType == FW_ZERO_DEBUG_IMAGE) { + ZeroDebugFlag = TRUE; + } if (mOutImageType != FW_TE_IMAGE) { mOutImageType = FW_EFI_IMAGE; } @@ -1220,6 +1225,9 @@ Returns: } if ((stricmp (argv[0], "-t") == 0) || (stricmp (argv[0], "--terse") == 0)) { + if (mOutImageType == FW_ZERO_DEBUG_IMAGE) { + ZeroDebugFlag = TRUE; + } mOutImageType = FW_TE_IMAGE; argc --; argv ++; @@ -1241,7 +1249,12 @@ Returns: } if ((stricmp (argv[0], "-z") == 0) || (stricmp (argv[0], "--zero") == 0)) { - mOutImageType = FW_ZERO_DEBUG_IMAGE; + if (mOutImageType == FW_DUMMY_IMAGE) { + mOutImageType = FW_ZERO_DEBUG_IMAGE; + } + if (mOutImageType == FW_TE_IMAGE || mOutImageType == FW_EFI_IMAGE) { + ZeroDebugFlag = TRUE; + } argc --; argv ++; continue; @@ -2588,7 +2601,7 @@ Returns: // // Zero Time/Data field // - ZeroDebugData (FileBuffer, FALSE); + ZeroDebugData (FileBuffer, ZeroDebugFlag); if (mOutImageType == FW_TE_IMAGE) { if ((PeHdr->Pe32.FileHeader.NumberOfSections &~0xFF) || (Type &~0xFF)) { -- 2.13.0.windows.1