From mboxrd@z Thu Jan 1 00:00:00 1970 Authentication-Results: mx.groups.io; dkim=missing; spf=pass (domain: intel.com, ip: 134.134.136.24, mailfrom: bob.c.feng@intel.com) Received: from mga09.intel.com (mga09.intel.com [134.134.136.24]) by groups.io with SMTP; Tue, 03 Sep 2019 18:03:03 -0700 X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from orsmga006.jf.intel.com ([10.7.209.51]) by orsmga102.jf.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 03 Sep 2019 18:03:02 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.64,465,1559545200"; d="scan'208";a="187453656" Received: from fmsmsx108.amr.corp.intel.com ([10.18.124.206]) by orsmga006.jf.intel.com with ESMTP; 03 Sep 2019 18:03:02 -0700 Received: from fmsmsx117.amr.corp.intel.com (10.18.116.17) by FMSMSX108.amr.corp.intel.com (10.18.124.206) with Microsoft SMTP Server (TLS) id 14.3.439.0; Tue, 3 Sep 2019 18:03:02 -0700 Received: from shsmsx101.ccr.corp.intel.com (10.239.4.153) by fmsmsx117.amr.corp.intel.com (10.18.116.17) with Microsoft SMTP Server (TLS) id 14.3.439.0; Tue, 3 Sep 2019 18:03:01 -0700 Received: from shsmsx104.ccr.corp.intel.com ([169.254.5.32]) by SHSMSX101.ccr.corp.intel.com ([169.254.1.92]) with mapi id 14.03.0439.000; Wed, 4 Sep 2019 09:03:00 +0800 From: "Bob Feng" To: "devel@edk2.groups.io" , "Gao, Liming" Subject: Re: [edk2-devel] [Patch] BaseTools: Update GenFw tool to support -e -z option together Thread-Topic: [edk2-devel] [Patch] BaseTools: Update GenFw tool to support -e -z option together Thread-Index: AQHVYS4bDwFIp1tLwkyshuv6UfH+k6cateVA Date: Wed, 4 Sep 2019 01:02:59 +0000 Message-ID: <08650203BA1BD64D8AD9B6D5D74A85D16152FCF0@SHSMSX104.ccr.corp.intel.com> References: <20190902013102.20696-1-liming.gao@intel.com> In-Reply-To: <20190902013102.20696-1-liming.gao@intel.com> Accept-Language: zh-CN, en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-originating-ip: [10.239.127.40] MIME-Version: 1.0 Return-Path: bob.c.feng@intel.com Content-Language: en-US Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable Liming, The patch looks good to me. A minor comment that the code looks fix the bug of the combinations of -e = -z and -t -z, so would you please update the commit message to add "-t -z" Thanks, Bob -----Original Message----- From: devel@edk2.groups.io [mailto:devel@edk2.groups.io] On Behalf Of Limi= ng Gao Sent: Monday, September 2, 2019 9:31 AM To: devel@edk2.groups.io Cc: Feng, Bob C Subject: [edk2-devel] [Patch] BaseTools: Update GenFw tool to support -e -= z option together BZ: https://bugzilla.tianocore.org/show_bug.cgi?id=3D1727 -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/G= enFw.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; =20 SetUtilityName (UTILITY_NAME); =20 @@ -1158,6 +1159,7 @@ Returns: NegativeAddr =3D FALSE; InputFileTime =3D 0; OutputFileTime =3D 0; + ZeroDebugFlag =3D FALSE; =20 if (argc =3D=3D 1) { Error (NULL, 0, 1001, "Missing options", "No input options."); @@ -11= 97,6 +1199,9 @@ Returns: goto Finish; } ModuleType =3D argv[1]; + if (mOutImageType =3D=3D FW_ZERO_DEBUG_IMAGE) { + ZeroDebugFlag =3D TRUE; + } if (mOutImageType !=3D FW_TE_IMAGE) { mOutImageType =3D FW_EFI_IMAGE; } @@ -1220,6 +1225,9 @@ Returns: } =20 if ((stricmp (argv[0], "-t") =3D=3D 0) || (stricmp (argv[0], "--terse= ") =3D=3D 0)) { + if (mOutImageType =3D=3D FW_ZERO_DEBUG_IMAGE) { + ZeroDebugFlag =3D TRUE; + } mOutImageType =3D FW_TE_IMAGE; argc --; argv ++; @@ -1241,7 +1249,12 @@ Returns: } =20 if ((stricmp (argv[0], "-z") =3D=3D 0) || (stricmp (argv[0], "--zero"= ) =3D=3D 0)) { - mOutImageType =3D FW_ZERO_DEBUG_IMAGE; + if (mOutImageType =3D=3D FW_DUMMY_IMAGE) { + mOutImageType =3D FW_ZERO_DEBUG_IMAGE; + } + if (mOutImageType =3D=3D FW_TE_IMAGE || mOutImageType =3D=3D FW_EFI= _IMAGE) { + ZeroDebugFlag =3D TRUE; + } argc --; argv ++; continue; @@ -2588,7 +2601,7 @@ Returns: // // Zero Time/Data field // - ZeroDebugData (FileBuffer, FALSE); + ZeroDebugData (FileBuffer, ZeroDebugFlag); =20 if (mOutImageType =3D=3D FW_TE_IMAGE) { if ((PeHdr->Pe32.FileHeader.NumberOfSections &~0xFF) || (Type &~0xFF)= ) { -- 2.13.0.windows.1