From nobody Wed Apr 24 12:40:41 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of groups.io designates 66.175.222.12 as permitted sender) client-ip=66.175.222.12; envelope-from=bounce+27952+54288+1787277+3901457@groups.io; helo=web01.groups.io; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of groups.io designates 66.175.222.12 as permitted sender) smtp.mailfrom=bounce+27952+54288+1787277+3901457@groups.io; dmarc=fail(p=none dis=none) header.from=intel.com Received: from web01.groups.io (web01.groups.io [66.175.222.12]) by mx.zohomail.com with SMTPS id 1581510766186326.49023178094933; Wed, 12 Feb 2020 04:32:46 -0800 (PST) Return-Path: X-Received: by 127.0.0.2 with SMTP id eLyeYY1788612xOTeNQd2YZp; Wed, 12 Feb 2020 04:32:43 -0800 X-Received: from mga11.intel.com (mga11.intel.com [192.55.52.93]) by mx.groups.io with SMTP id smtpd.web10.822.1581488621491342143 for ; Tue, 11 Feb 2020 22:23:41 -0800 X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False X-Received: from orsmga004.jf.intel.com ([10.7.209.38]) by fmsmga102.fm.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 11 Feb 2020 22:23:40 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.70,428,1574150400"; d="scan'208";a="380672424" X-Received: from fmsmsx106.amr.corp.intel.com ([10.18.124.204]) by orsmga004.jf.intel.com with ESMTP; 11 Feb 2020 22:23:40 -0800 X-Received: from shsmsx606.ccr.corp.intel.com (10.109.6.216) by FMSMSX106.amr.corp.intel.com (10.18.124.204) with Microsoft SMTP Server (TLS) id 14.3.439.0; Tue, 11 Feb 2020 22:23:40 -0800 X-Received: from shsmsx605.ccr.corp.intel.com (10.109.6.215) by SHSMSX606.ccr.corp.intel.com (10.109.6.216) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.1713.5; Wed, 12 Feb 2020 14:23:38 +0800 X-Received: from shsmsx605.ccr.corp.intel.com ([10.109.6.215]) by SHSMSX605.ccr.corp.intel.com ([10.109.6.215]) with mapi id 15.01.1713.004; Wed, 12 Feb 2020 14:23:38 +0800 From: "Feng, YunhuaX" To: "devel@edk2.groups.io" CC: "Gao, Liming" , "Feng, Bob C" Subject: [edk2-devel] [PATCH] [edk2-staging/FceFmmt]BaseTools: Support no UI section FFS Thread-Topic: [PATCH] [edk2-staging/FceFmmt]BaseTools: Support no UI section FFS Thread-Index: AdXhbPXXPt0kAHFuQoujAM2mrLZ8Qg== Date: Wed, 12 Feb 2020 06:23:38 +0000 Message-ID: <76e7103d62124617807608ab3643ca53@intel.com> Accept-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-originating-ip: [10.239.127.36] MIME-Version: 1.0 Precedence: Bulk List-Unsubscribe: Sender: devel@edk2.groups.io List-Id: Mailing-List: list devel@edk2.groups.io; contact devel+owner@edk2.groups.io Reply-To: devel@edk2.groups.io,yunhuax.feng@intel.com X-Gm-Message-State: 0VMj8qZBNOirtV6U8l8AuByZx1787277AA= Content-Language: en-US Content-Transfer-Encoding: quoted-printable DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=groups.io; q=dns/txt; s=20140610; t=1581510763; bh=KCkjuwsXhjp6USbMyujZU5IHyMBuEagdunx3SpcdzX0=; h=CC:Content-Type:Date:From:Reply-To:Subject:To; b=hyiOIWYgZZK34IQDOVvPGzFWgRl9dBwQW6rmo+Q401tscNE5xHeR4oNRXj1MKOaArIb ctacOxpDD7rn5XTpGeOD6nDRI1JtsDWMP2n4LwLtiuJxWN3FfsmaS/o0NaHc+HhtI2JmE U3Z3lIrUn/PTSKv4gPMIQLUfIpOkUoTEIHk= X-ZohoMail-DKIM: pass (identity @groups.io) Content-Type: text/plain; charset="utf-8" REF: https://bugzilla.tianocore.org/show_bug.cgi?id=3D2521 1. If FFS file has no UI section, its FILE_GUID will be used as its name. FMMT tool -d/-a/-r option can be updated to support such FFS file. 2. -v option will print FILE_GUID if no UI section Cc: Bob Feng Cc: Liming Gao Signed-off-by: Yunhua Feng Reviewed-by: Liming Gao --- BaseTools/Source/C/FMMT/FirmwareModuleManagement.c | 22 +++++++-- BaseTools/Source/C/FMMT/FmmtLib.c | 56 ++++++++++++++++++= ++++ 2 files changed, 73 insertions(+), 5 deletions(-) diff --git a/BaseTools/Source/C/FMMT/FirmwareModuleManagement.c b/BaseTools= /Source/C/FMMT/FirmwareModuleManagement.c index e4fbb5461f..a786113899 100644 --- a/BaseTools/Source/C/FMMT/FirmwareModuleManagement.c +++ b/BaseTools/Source/C/FMMT/FirmwareModuleManagement.c @@ -79,11 +79,11 @@ Usage ( Delete the entire FV in an FD binary\n"); =20 // // Command Line for Delete file from FV // - fprintf (stdout, " -d [ = ...] \n\ + fprintf (stdout, " -d = [ ...] \n\ Delete a file (or files) from the firmware volume in an FD bin= ary\n"); =20 // // Command Line for Add // @@ -91,11 +91,11 @@ Usage ( Add a file (or files) to the firmware volume in an FD binary\n= "); =20 // // Command Line for Replace // - fprintf (stdout, " -r [ ...] \n\ + fprintf (stdout, " -r = [ ...] \n\ The replace command combines the functionality of remove and a= dd into a single operation.\n"); =20 fprintf (stdout, "\nNote:\n"); fprintf (stdout, " is the sequence of the firmware volume inclu= ded in the FD image, it both support the sequentially format like FV0, FV1 = and the FV's file guid value format.\n"); return; @@ -583,10 +583,11 @@ NeedNewPath(FV_INFORMATION *FvInFd, CHAR8 *FvId, UINT= 32 FileIndex, BOOLEAN IsAdd static UINT32 FindFile(FV_INFORMATION *FvInFd, UINT8 FvLevel, CHAR8 *File,= UINT32 *MatchIndex) { UINT32 Index =3D 0; CHAR16 *UIName; CHAR16 *FfsUIName; UINT32 FileNumber =3D 0; + EFI_GUID Guid; =20 UIName =3D (CHAR16 *)malloc(_MAX_PATH); if (NULL =3D=3D UIName) { return 0; } @@ -612,11 +613,22 @@ static UINT32 FindFile(FV_INFORMATION *FvInFd, UINT8 = FvLevel, CHAR8 *File, UINT3 } =20 } free(UIName); free(FfsUIName); - + if (FileNumber =3D=3D 0) { + StringToGuid(File, &Guid); + for (Index =3D 0; Index <=3D FvInFd->FfsNumbers; Index++) { + if (CompareGuid (&Guid, &FvInFd->FfsAttuibutes[Index].GuidName) =3D= =3D 0) { + FileNumber +=3D 1; + *MatchIndex =3D Index; + if (FileNumber > 1) { + break; + } + } + } + } return FileNumber; } =20 /** Search the config file from the path list. @@ -1089,11 +1101,11 @@ FmmtImageAdd( goto FAILED; } HasUISection =3D FALSE; HasUISection =3D ParseSection(InputFfs); if (!HasUISection) { - printf ("WARNING: The newly add file must have a user interfac= e (UI) section, otherwise it cannot be deleted or replaced. \n"); + printf ("WARNING: The newly add file not have a user interface= (UI) section. \n"); } if (NeedNewPath(FvInFd, FvId, 0, TRUE)) { do { NewFile =3D NewFileNode->FileName; // @@ -1845,11 +1857,11 @@ FmmtImageReplace ( return EFI_ABORTED; } HasUISection =3D FALSE; HasUISection =3D ParseSection(InputFfs); if (!HasUISection) { - printf ("WARNING: The newly replace file must have a user inte= rface (UI) section, otherwise it cannot be deleted or replaced. \n"); + printf ("WARNING: The newly replace file not have a user inter= face (UI) section. \n"); } if (FfsFoundFlag && NeedNewPath(FvInFd, FvId, Index, FALSE)) { do { OldFile =3D OldFileNode -> FileName; NewFile =3D NewFileNode -> FileName; diff --git a/BaseTools/Source/C/FMMT/FmmtLib.c b/BaseTools/Source/C/FMMT/Fm= mtLib.c index 78b6f3a21d..685ef634f2 100644 --- a/BaseTools/Source/C/FMMT/FmmtLib.c +++ b/BaseTools/Source/C/FMMT/FmmtLib.c @@ -824,10 +824,11 @@ LibParseSection ( UINT16 GuidAttr; UINT16 DataOffset; CHAR8 *UIFileName; CHAR8 *ToolInputFileName; CHAR8 *ToolOutputFileName; + BOOLEAN HasUiSection; =20 DataOffset =3D 0; GuidAttr =3D 0; ParsedLength =3D 0; ToolOutputLength =3D 0; @@ -858,10 +859,11 @@ LibParseSection ( ToolInputFileName =3D NULL; ToolOutputFileFullName =3D NULL; HasDepexSection =3D FALSE; EncapDataNeedUpdata =3D TRUE; LargeHeaderOffset =3D 0; + HasUiSection =3D FALSE; =20 =20 while (ParsedLength < BufferLength) { Ptr =3D SectionBuffer + ParsedLength; =20 @@ -888,10 +890,11 @@ LibParseSection ( switch (Type) { =20 case EFI_SECTION_FIRMWARE_VOLUME_IMAGE: =20 EncapDataNeedUpdata =3D TRUE; + HasUiSection =3D TRUE; =20 Level ++; NumberOfSections ++; =20 CurrentFv->FfsAttuibutes[*FfsCount].IsLeaf =3D FALSE; @@ -988,10 +991,11 @@ LibParseSection ( case EFI_SECTION_COMPRESSION: Level ++; NumberOfSections ++; =20 EncapDataNeedUpdata =3D TRUE; + HasUiSection =3D TRUE; // // Put in encapsulate data information. // LocalEncapData =3D *CurrentFvEncapData; if (LocalEncapData->NextNode !=3D NULL) { @@ -1166,10 +1170,11 @@ LibParseSection ( // a GUID defined FV section. // Level ++; NumberOfSections++; EncapDataNeedUpdata =3D TRUE; + HasUiSection =3D TRUE; // // Put in encapsulate data information. // LocalEncapData =3D *CurrentFvEncapData; if (LocalEncapData->NextNode !=3D NULL) { @@ -1593,10 +1598,11 @@ LibParseSection ( memcpy(CurrentFv->FfsAttuibutes[*FfsCount].Depex, Ptr, SectionLength= ); CurrentFv->FfsAttuibutes[*FfsCount].DepexLen =3D SectionLength; break; =20 case EFI_SECTION_USER_INTERFACE: + HasUiSection =3D TRUE; NumberOfSections ++; CurrentFv->FfsAttuibutes[*FfsCount].Level =3D Level; =20 UiSectionLength =3D GetLength (((EFI_USER_INTERFACE_SECTION *) Ptr)-= >CommonHeader.Size); if (UiSectionLength =3D=3D 0xffffff) { @@ -1669,10 +1675,34 @@ LibParseSection ( if (ParsedLength < BufferLength) { Error ("FMMT", 0, 0003, "sections do not completely fill the sectioned= buffer being parsed", NULL); return EFI_SECTION_ERROR; } =20 + if (ViewFlag && !HasUiSection) { + // =20 + //print FILE FFS GUID name + // + BlankChar =3D LibConstructBlankChar( CurrentFv->FvLevel * 2); + if (BlankChar =3D=3D NULL) { + return EFI_OUT_OF_RESOURCES; + } + =20 + fprintf(stdout, "%sFile \"%08x-%04x-%04x-%02x%02x-%02x%02x%02x%02x%02x= %02x\"\n", BlankChar,=20 + CurrentFile->Name.Data1, + CurrentFile->Name.Data2, + CurrentFile->Name.Data3, + CurrentFile->Name.Data4[0], + CurrentFile->Name.Data4[1], + CurrentFile->Name.Data4[2], + CurrentFile->Name.Data4[3], + CurrentFile->Name.Data4[4], + CurrentFile->Name.Data4[5], + CurrentFile->Name.Data4[6], + CurrentFile->Name.Data4[7] + ); + free(BlankChar); + } =20 return EFI_SUCCESS; } =20 /** @@ -1819,16 +1849,18 @@ LibGetFileInfo ( UINT8 GuidBuffer[PRINTED_GUID_BUFFER_SIZE]; ENCAP_INFO_DATA *LocalEncapData; BOOLEAN EncapDataNeedUpdateFlag; BOOLEAN IsGeneratedFfs; UINT32 FfsFileHeaderSize; + CHAR8 *BlankChar; =20 Status =3D EFI_SUCCESS; =20 LocalEncapData =3D NULL; EncapDataNeedUpdateFlag =3D TRUE; IsGeneratedFfs =3D FALSE; + BlankChar =3D NULL; =20 FfsFileHeaderSize =3D GetFfsHeaderLength ((EFI_FFS_FILE_HEADER *) Curre= ntFile); FileLength =3D GetFfsFileLength ((EFI_FFS_FILE_HEADER *) CurrentF= ile); =20 // @@ -1999,10 +2031,34 @@ LibGetFileInfo ( =20 if ( CurrentFile->Type =3D=3D EFI_FV_FILETYPE_RAW){ CurrentFv->FfsAttuibutes[*FfsCount].Level =3D Level; if (!ViewFlag){ LibGenFfsFile(CurrentFile, CurrentFv, FvName, Level, FfsCount, Era= sePolarity); + } else { + // + // print EFI_FV_FILETYPE_RAW GUID=20 + // + BlankChar =3D LibConstructBlankChar( CurrentFv->FvLevel * 2); + if (BlankChar =3D=3D NULL) { + return EFI_OUT_OF_RESOURCES; + } + =20 + fprintf(stdout, "%sFile \"%08x-%04x-%04x-%02x%02x-%02x%02x%02x%02x= %02x%02x\"\n", BlankChar,=20 + CurrentFile->Name.Data1, + CurrentFile->Name.Data2, + CurrentFile->Name.Data3, + CurrentFile->Name.Data4[0], + CurrentFile->Name.Data4[1], + CurrentFile->Name.Data4[2], + CurrentFile->Name.Data4[3], + CurrentFile->Name.Data4[4], + CurrentFile->Name.Data4[5], + CurrentFile->Name.Data4[6], + CurrentFile->Name.Data4[7] + ); + free(BlankChar); + } } else if( CurrentFile->Type =3D=3D EFI_FV_FILETYPE_FFS_PAD){ //EFI_FV_FILETYPE_FFS_PAD } else { // --=20 2.12.2.windows.2 -=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D- Groups.io Links: You receive all messages sent to this group. View/Reply Online (#54288): https://edk2.groups.io/g/devel/message/54288 Mute This Topic: https://groups.io/mt/71210722/1787277 Group Owner: devel+owner@edk2.groups.io Unsubscribe: https://edk2.groups.io/g/devel/unsub [importer@patchew.org] -=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-