From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mga07.intel.com (mga07.intel.com [134.134.136.100]) (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 8D0881A1E4F for ; Tue, 18 Oct 2016 18:34:52 -0700 (PDT) Received: from fmsmga003.fm.intel.com ([10.253.24.29]) by orsmga105.jf.intel.com with ESMTP; 18 Oct 2016 18:34:52 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.31,364,1473145200"; d="scan'208";a="774333151" Received: from fmsmsx103.amr.corp.intel.com ([10.18.124.201]) by FMSMGA003.fm.intel.com with ESMTP; 18 Oct 2016 18:34:52 -0700 Received: from fmsmsx123.amr.corp.intel.com (10.18.125.38) by FMSMSX103.amr.corp.intel.com (10.18.124.201) with Microsoft SMTP Server (TLS) id 14.3.248.2; Tue, 18 Oct 2016 18:34:52 -0700 Received: from shsmsx151.ccr.corp.intel.com (10.239.6.50) by fmsmsx123.amr.corp.intel.com (10.18.125.38) with Microsoft SMTP Server (TLS) id 14.3.248.2; Tue, 18 Oct 2016 18:34:51 -0700 Received: from shsmsx102.ccr.corp.intel.com ([169.254.2.206]) by SHSMSX151.ccr.corp.intel.com ([169.254.3.96]) with mapi id 14.03.0248.002; Wed, 19 Oct 2016 09:34:48 +0800 From: "Gao, Liming" To: "Zhu, Yonghong" , "edk2-devel@lists.01.org" Thread-Topic: [Patch] BaseTools: Enhance tool to generate EFI_HII_IIBT_DUPLICATE image block Thread-Index: AQHSKFs+wocv0xd1kUu2zln5NxWzf6CvATlQ Date: Wed, 19 Oct 2016 01:34:47 +0000 Message-ID: <4A89E2EF3DFEDB4C8BFDE51014F606A14B49626D@shsmsx102.ccr.corp.intel.com> References: <1476697533-5368-1-git-send-email-yonghong.zhu@intel.com> In-Reply-To: <1476697533-5368-1-git-send-email-yonghong.zhu@intel.com> Accept-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-originating-ip: [10.239.127.40] MIME-Version: 1.0 Subject: Re: [Patch] BaseTools: Enhance tool to generate EFI_HII_IIBT_DUPLICATE image block X-BeenThere: edk2-devel@lists.01.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: EDK II Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 19 Oct 2016 01:34:52 -0000 Content-Language: en-US Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable Reviewed-by: Liming Gao > -----Original Message----- > From: Zhu, Yonghong > Sent: Monday, October 17, 2016 5:46 PM > To: edk2-devel@lists.01.org > Cc: Gao, Liming > Subject: [Patch] BaseTools: Enhance tool to generate > EFI_HII_IIBT_DUPLICATE image block >=20 > When *.IDF file contains multiple definitions of image which point to the > same image, current build tool generates multiple image blocks which > contain the same image content. > This patch enhance tool to generate EFI_HII_IIBT_DUPLICATE image blocks > for non-first images for such case, to save the HII package size. >=20 > Fixes: https://bugzilla.tianocore.org/show_bug.cgi?id=3D145 >=20 > Cc: Liming Gao > Contributed-under: TianoCore Contribution Agreement 1.0 > Signed-off-by: Yonghong Zhu > --- > BaseTools/Source/Python/AutoGen/GenC.py | 14 ++++++++++++++ > 1 file changed, 14 insertions(+) >=20 > diff --git a/BaseTools/Source/Python/AutoGen/GenC.py > b/BaseTools/Source/Python/AutoGen/GenC.py > index 8089e3a..de6eb0e 100644 > --- a/BaseTools/Source/Python/AutoGen/GenC.py > +++ b/BaseTools/Source/Python/AutoGen/GenC.py > @@ -1637,10 +1637,11 @@ def CreateIdfFileCode(Info, AutoGenC, StringH, > IdfGenCFlag, IdfGenBinBuffer): > PaletteInfoOffset =3D 0 > ImageBuffer =3D pack('x') > PaletteBuffer =3D pack('x') > BufferStr =3D '' > PaletteStr =3D '' > + FileDict =3D {} > for Idf in ImageFiles.ImageFilesDict: > if ImageFiles.ImageFilesDict[Idf]: > for FileObj in ImageFiles.ImageFilesDict[Idf]: > for sourcefile in Info.SourceFileList: > if FileObj.FileName =3D=3D sourcefile.File: > @@ -1661,10 +1662,23 @@ def CreateIdfFileCode(Info, AutoGenC, StringH, > IdfGenCFlag, IdfGenBinBuffer): > if (ValueStartPtr - len(DEFINE_STR + ID)) <= =3D 0: > Line =3D DEFINE_STR + ' ' + ID + ' ' + D= ecToHexStr(Index, 4) + > '\n' > else: > Line =3D DEFINE_STR + ' ' + ID + ' ' * (= ValueStartPtr - > len(DEFINE_STR + ID)) + DecToHexStr(Index, 4) + '\n' >=20 > + if File not in FileDict: > + FileDict[File] =3D Index > + else: > + DuplicateBlock =3D pack('B', EFI_HII_IIB= T_DUPLICATE) > + DuplicateBlock +=3D pack('H', FileDict[F= ile]) > + ImageBuffer +=3D DuplicateBlock > + BufferStr =3D WriteLine(BufferStr, '// %= s: %s: %s' % > (DecToHexStr(Index, 4), ID, DecToHexStr(Index, 4))) > + TempBufferList =3D AscToHexList(Duplicat= eBlock) > + BufferStr =3D WriteLine(BufferStr, > CreateArrayItem(TempBufferList, 16) + '\n') > + StringH.Append(Line) > + Index +=3D 1 > + continue > + > TmpFile =3D open(File.Path, 'rb') > Buffer =3D TmpFile.read() > TmpFile.close() > if File.Ext.upper() =3D=3D '.PNG': > TempBuffer =3D pack('B', EFI_HII_IIBT_IM= AGE_PNG) > -- > 2.6.1.windows.1