mirror of https://github.com/acidanthera/audk.git
BaseTools/Capsule: Supports multiple payloads and drivers in capsule
REF: https://bugzilla.tianocore.org/show_bug.cgi?id=1834 1)Add arguments "--embedded-driver" to support embedded driver in command line. 2)Add arguments "--update-image-index" to identify ImageIndex within the device in command line. 3)Add arguments "-j JSONFILE" to support multiple payloads and embedded drivers with JSON file. The update is in a backwards compatible manner, so all command line options to support single payload are still supported. But all the options associated with multiple payloads should be provided in a JSON file. Cc: Bob Feng <bob.c.feng@intel.com> Signed-off-by: Eric Jin <eric.jin@intel.com> Reviewed-by: Bob Feng <bob.c.feng@intel.com>
This commit is contained in:
parent
c54c856218
commit
104a1aa19b
File diff suppressed because it is too large
Load Diff
|
@ -2,7 +2,7 @@
|
|||
# Module that encodes and decodes a EFI_FIRMWARE_IMAGE_AUTHENTICATION with
|
||||
# certificate data and payload data.
|
||||
#
|
||||
# Copyright (c) 2018, Intel Corporation. All rights reserved.<BR>
|
||||
# Copyright (c) 2018 - 2019, Intel Corporation. All rights reserved.<BR>
|
||||
# SPDX-License-Identifier: BSD-2-Clause-Patent
|
||||
#
|
||||
|
||||
|
@ -166,6 +166,18 @@ class FmpAuthHeaderClass (object):
|
|||
self._Valid = True
|
||||
return self.Payload
|
||||
|
||||
def IsSigned (self, Buffer):
|
||||
if len (Buffer) < self._StructSize:
|
||||
return False
|
||||
(MonotonicCount, dwLength, wRevision, wCertificateType, CertType) = \
|
||||
struct.unpack (
|
||||
self._StructFormat,
|
||||
Buffer[0:self._StructSize]
|
||||
)
|
||||
if CertType != self._EFI_CERT_TYPE_PKCS7_GUID.bytes_le:
|
||||
return False
|
||||
return True
|
||||
|
||||
def DumpInfo (self):
|
||||
if not self._Valid:
|
||||
raise ValueError
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
# Module that encodes and decodes a EFI_FIRMWARE_MANAGEMENT_CAPSULE_HEADER with
|
||||
# a payload.
|
||||
#
|
||||
# Copyright (c) 2018, Intel Corporation. All rights reserved.<BR>
|
||||
# Copyright (c) 2018 - 2019, Intel Corporation. All rights reserved.<BR>
|
||||
# SPDX-License-Identifier: BSD-2-Clause-Patent
|
||||
#
|
||||
|
||||
|
@ -172,8 +172,8 @@ class FmpCapsuleHeaderClass (object):
|
|||
raise ValueError
|
||||
return self._EmbeddedDriverList[Index]
|
||||
|
||||
def AddPayload (self, UpdateImageTypeId, Payload = b'', VendorCodeBytes = b'', HardwareInstance = 0):
|
||||
self._PayloadList.append ((UpdateImageTypeId, Payload, VendorCodeBytes, HardwareInstance))
|
||||
def AddPayload (self, UpdateImageTypeId, Payload = b'', VendorCodeBytes = b'', HardwareInstance = 0, UpdateImageIndex = 1):
|
||||
self._PayloadList.append ((UpdateImageTypeId, Payload, VendorCodeBytes, HardwareInstance, UpdateImageIndex))
|
||||
|
||||
def GetFmpCapsuleImageHeader (self, Index):
|
||||
if Index >= len (self._FmpCapsuleImageHeaderList):
|
||||
|
@ -198,10 +198,10 @@ class FmpCapsuleHeaderClass (object):
|
|||
self._ItemOffsetList.append (Offset)
|
||||
Offset = Offset + len (EmbeddedDriver)
|
||||
Index = 1
|
||||
for (UpdateImageTypeId, Payload, VendorCodeBytes, HardwareInstance) in self._PayloadList:
|
||||
for (UpdateImageTypeId, Payload, VendorCodeBytes, HardwareInstance, UpdateImageIndex) in self._PayloadList:
|
||||
FmpCapsuleImageHeader = FmpCapsuleImageHeaderClass ()
|
||||
FmpCapsuleImageHeader.UpdateImageTypeId = UpdateImageTypeId
|
||||
FmpCapsuleImageHeader.UpdateImageIndex = Index
|
||||
FmpCapsuleImageHeader.UpdateImageIndex = UpdateImageIndex
|
||||
FmpCapsuleImageHeader.Payload = Payload
|
||||
FmpCapsuleImageHeader.VendorCodeBytes = VendorCodeBytes
|
||||
FmpCapsuleImageHeader.UpdateHardwareInstance = HardwareInstance
|
||||
|
@ -288,6 +288,8 @@ class FmpCapsuleHeaderClass (object):
|
|||
raise ValueError
|
||||
print ('EFI_FIRMWARE_MANAGEMENT_CAPSULE_HEADER.Version = {Version:08X}'.format (Version = self.Version))
|
||||
print ('EFI_FIRMWARE_MANAGEMENT_CAPSULE_HEADER.EmbeddedDriverCount = {EmbeddedDriverCount:08X}'.format (EmbeddedDriverCount = self.EmbeddedDriverCount))
|
||||
for EmbeddedDriver in self._EmbeddedDriverList:
|
||||
print (' sizeof (EmbeddedDriver) = {Size:08X}'.format (Size = len (EmbeddedDriver)))
|
||||
print ('EFI_FIRMWARE_MANAGEMENT_CAPSULE_HEADER.PayloadItemCount = {PayloadItemCount:08X}'.format (PayloadItemCount = self.PayloadItemCount))
|
||||
print ('EFI_FIRMWARE_MANAGEMENT_CAPSULE_HEADER.ItemOffsetList = ')
|
||||
for Offset in self._ItemOffsetList:
|
||||
|
|
Loading…
Reference in New Issue