From: "Gao, Liming" <liming.gao@intel.com>
To: "Zhu, Yonghong" <yonghong.zhu@intel.com>,
"edk2-devel@lists.01.org" <edk2-devel@lists.01.org>
Subject: Re: [Patch] BaseTools: add capsule image header for auth FMP capsule file
Date: Mon, 22 Aug 2016 08:47:56 +0000 [thread overview]
Message-ID: <4A89E2EF3DFEDB4C8BFDE51014F606A1155ED831@shsmsx102.ccr.corp.intel.com> (raw)
In-Reply-To: <1471850613-93368-1-git-send-email-yonghong.zhu@intel.com>
Reviewed-by: Liming Gao <liming.gao@intel.com>
> -----Original Message-----
> From: Zhu, Yonghong
> Sent: Monday, August 22, 2016 3:24 PM
> To: edk2-devel@lists.01.org
> Cc: Gao, Liming <liming.gao@intel.com>
> Subject: [Patch] BaseTools: add capsule image header for auth FMP capsule
> file
>
> in last commit 91ae29, it missed to add the
> EFI_FIRMWARE_MANAGEMENT_CAPSULE_IMAGE_HEADER for the auth
> FMP capsule.
>
> Cc: Liming Gao <liming.gao@intel.com>
> Contributed-under: TianoCore Contribution Agreement 1.0
> Signed-off-by: Yonghong Zhu <yonghong.zhu@intel.com>
> ---
> BaseTools/Source/Python/GenFds/Capsule.py | 15 +++++++++++----
> BaseTools/Source/Python/GenFds/CapsuleData.py | 10 ----------
> 2 files changed, 11 insertions(+), 14 deletions(-)
>
> diff --git a/BaseTools/Source/Python/GenFds/Capsule.py
> b/BaseTools/Source/Python/GenFds/Capsule.py
> index f8af12a..93ecee1 100644
> --- a/BaseTools/Source/Python/GenFds/Capsule.py
> +++ b/BaseTools/Source/Python/GenFds/Capsule.py
> @@ -139,10 +139,11 @@ class Capsule (CapsuleClassObject) :
> PreSize += os.path.getsize(FileName)
> File = open(FileName, 'rb')
> Content.write(File.read())
> File.close()
> for fmp in self.FmpPayloadList:
> + Buffer = fmp.GenCapsuleSubItem()
> if fmp.Certificate_Guid:
> ExternalTool, ExternalOption = FindExtendTool([],
> GenFdsGlobalVariable.ArchList, fmp.Certificate_Guid)
> CmdOption = ''
> CapInputFile = fmp.ImageFile
> if not os.path.isabs(fmp.ImageFile):
> @@ -159,11 +160,11 @@ class Capsule (CapsuleClassObject) :
> GenFdsGlobalVariable.CallExternalTool(CmdList, "Failed to generate
> FMP auth capsule")
> if uuid.UUID(fmp.Certificate_Guid) == EFI_CERT_TYPE_PKCS7_GUID:
> dwLength = 4 + 2 + 2 + 16 + os.path.getsize(CapOutputTmp) -
> os.path.getsize(CapInputFile)
> else:
> dwLength = 4 + 2 + 2 + 16 + 16 + 256 + 256
> - Buffer = pack('Q', fmp.MonotonicCount)
> + Buffer += pack('Q', fmp.MonotonicCount)
> Buffer += pack('I', dwLength)
> Buffer += pack('H', WIN_CERT_REVISION)
> Buffer += pack('H', WIN_CERT_TYPE_EFI_GUID)
> Buffer += uuid.UUID(fmp.Certificate_Guid).get_bytes_le()
> if os.path.exists(CapOutputTmp):
> @@ -176,14 +177,20 @@ class Capsule (CapsuleClassObject) :
> VendorFile.close()
> FwMgrHdr.write(pack('=Q', PreSize))
> PreSize += len(Buffer)
> Content.write(Buffer)
> else:
> - payload = fmp.GenCapsuleSubItem()
> + ImageFile = open(fmp.ImageFile, 'rb')
> + Buffer += ImageFile.read()
> + ImageFile.close()
> + if fmp.VendorCodeFile:
> + VendorFile = open(fmp.VendorCodeFile, 'rb')
> + Buffer += VendorFile.read()
> + VendorFile.close()
> FwMgrHdr.write(pack('=Q', PreSize))
> - PreSize += len(payload)
> - Content.write(payload)
> + PreSize += len(Buffer)
> + Content.write(Buffer)
> BodySize = len(FwMgrHdr.getvalue()) + len(Content.getvalue())
> Header.write(pack('=I', HdrSize + BodySize))
> #
> # The real capsule header structure is 28 bytes
> #
> diff --git a/BaseTools/Source/Python/GenFds/CapsuleData.py
> b/BaseTools/Source/Python/GenFds/CapsuleData.py
> index 2a5c454..5d5a1e4 100644
> --- a/BaseTools/Source/Python/GenFds/CapsuleData.py
> +++ b/BaseTools/Source/Python/GenFds/CapsuleData.py
> @@ -214,16 +214,6 @@ class CapsulePayload(CapsuleData):
> 0,
> ImageFileSize,
> VendorFileSize,
> int(self.HardwareInstance, 16)
> )
> - #
> - # Append file content to the structure
> - #
> - ImageFile = open(self.ImageFile, 'rb')
> - Buffer += ImageFile.read()
> - ImageFile.close()
> - if self.VendorCodeFile:
> - VendorFile = open(self.VendorCodeFile, 'rb')
> - Buffer += VendorFile.read()
> - VendorFile.close()
> return Buffer
> --
> 2.6.1.windows.1
prev parent reply other threads:[~2016-08-22 8:47 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-08-22 7:23 [Patch] BaseTools: add capsule image header for auth FMP capsule file Yonghong Zhu
2016-08-22 8:47 ` Gao, Liming [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-list from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=4A89E2EF3DFEDB4C8BFDE51014F606A1155ED831@shsmsx102.ccr.corp.intel.com \
--to=devel@edk2.groups.io \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox