Re: [edk2-devel] [PATCH v2] BaseTools: Add support for version 3 of FMP Image Header structure
I created the PR https://github.com/tianocore/edk2/pull/1637 for merge. Thanks, Bob From: Kinney, Michael D Sent: Tuesday, May 11, 2021 11:09 PM To: Sughosh Ganu ; Feng, Bob C ; Liming Gao ; Chen, Christine ; Kinney, Michael D Cc: devel@edk2.groups.io Subject: RE: [edk2-devel] [PATCH v2] BaseTools: Add support for version 3 of FMP Image Header structure Hi Sughosh, Thanks for the reminder. We need to wait for one of the BaseTools maintainers to provide an Rb for the V2 version of this patch, then we will be able to merge. Thanks, Mike From: Sughosh Ganu mailto:sughosh.g...@linaro.org>> Sent: Tuesday, May 11, 2021 3:21 AM To: Kinney, Michael D mailto:michael.d.kin...@intel.com>>; Feng, Bob C mailto:bob.c.f...@intel.com>>; Liming Gao mailto:gaolim...@byosoft.com.cn>>; Chen, Christine mailto:yuwei.c...@intel.com>> Cc: devel@edk2.groups.io<mailto:devel@edk2.groups.io> Subject: Re: [edk2-devel] [PATCH v2] BaseTools: Add support for version 3 of FMP Image Header structure hi, Can this patch be merged. Thanks. -sughosh On Mon, 26 Apr 2021 at 21:27, Kinney, Michael D mailto:michael.d.kin...@intel.com>> wrote: Reviewed-by: Michael D Kinney mailto:michael.d.kin...@intel.com>> Mike > -Original Message- > From: devel@edk2.groups.io<mailto:devel@edk2.groups.io> > mailto:devel@edk2.groups.io>> On Behalf Of Sughosh Ganu > Sent: Friday, April 23, 2021 4:29 AM > To: devel@edk2.groups.io<mailto:devel@edk2.groups.io> > Cc: Michal Simek mailto:michal.si...@xilinx.com>>; > Sughosh Ganu mailto:sughosh.g...@linaro.org>> > Subject: [edk2-devel] [PATCH v2] BaseTools: Add support for version 3 of FMP > Image Header structure > > Add support for the ImageCapsuleSupport field, introduced in version 3 > of the EFI_FIRMWARE_MANAGEMENT_CAPSULE_IMAGE_HEADER structure. This > structure member is used to indicate if the corresponding payload has > support for authentication and dependency. > > Signed-off-by: Sughosh Ganu > mailto:sughosh.g...@linaro.org>> > --- > > Changes since v1: > - Reword the patch header to get rid of the PatchCheck warning > - Make passing of ImageCapsuleSupport parameter to the AddPayload > function as an optional parameter to maintain backward compatibility > - Declare the values of CAPSULE_SUPPORT_DEPENDENCY and > CAPSULE_SUPPORT_AUTHENTICATION in the FmpCapsuleHeaderClass and use > those in the GenerateCapsule script > > .../Source/Python/Capsule/GenerateCapsule.py | 5 +++- > .../Common/Uefi/Capsule/FmpCapsuleHeader.py | 28 +-- > 2 files changed, 24 insertions(+), 9 deletions(-) > > diff --git a/BaseTools/Source/Python/Capsule/GenerateCapsule.py > b/BaseTools/Source/Python/Capsule/GenerateCapsule.py > index a8de988253..b8039db878 100644 > --- a/BaseTools/Source/Python/Capsule/GenerateCapsule.py > +++ b/BaseTools/Source/Python/Capsule/GenerateCapsule.py > @@ -561,6 +561,7 @@ if __name__ == '__main__': > print ('GenerateCapsule: error:' + str(Msg)) > sys.exit (1) > for SinglePayloadDescriptor in PayloadDescriptorList: > +ImageCapsuleSupport = 0x > Result = SinglePayloadDescriptor.Payload > try: > FmpPayloadHeader.FwVersion = > SinglePayloadDescriptor.FwVersion > @@ -575,6 +576,7 @@ if __name__ == '__main__': > if SinglePayloadDescriptor.UseDependency: > CapsuleDependency.Payload = Result > CapsuleDependency.DepexExp = SinglePayloadDescriptor.DepexExp > +ImageCapsuleSupport|= > FmpCapsuleHeader.CAPSULE_SUPPORT_DEPENDENCY > Result = CapsuleDependency.Encode () > if args.Verbose: > CapsuleDependency.DumpInfo () > @@ -607,13 +609,14 @@ if __name__ == '__main__': > FmpAuthHeader.MonotonicCount = > SinglePayloadDescriptor.MonotonicCount > FmpAuthHeader.CertData = CertData > FmpAuthHeader.Payload= Result > +ImageCapsuleSupport |= > FmpCapsuleHeader.CAPSULE_SUPPORT_AUTHENTICATION > Result = FmpAuthHeader.Encode () > if args.Verbose: > FmpAuthHeader.DumpInfo () > except: > print ('GenerateCapsule: error: can not encode FMP Auth > Header') > sys.exit (1) > -FmpCapsuleHeader.AddPayload (SinglePayloadDescriptor.Guid, > Result, HardwareInstance = > SinglePayloadDescriptor.HardwareInstance, UpdateImageIndex = > SinglePayloadDescriptor.UpdateImageIndex) &
Re: [edk2-devel] [PATCH v2] BaseTools: Add support for version 3 of FMP Image Header structure
This patch is good to me. Reviewed-by: Bob Feng Thanks, Bob -Original Message- From: devel@edk2.groups.io On Behalf Of Sughosh Ganu Sent: Thursday, April 22, 2021 3:51 PM To: devel@edk2.groups.io Cc: Kinney, Michael D ; Feng, Bob C ; Liming Gao ; Chen, Christine ; Sughosh Ganu Subject: [edk2-devel] [PATCH v2] BaseTools: Add support for version 3 of FMP Image Header structure Add support for the ImageCapsuleSupport field, introduced in version 3 of the EFI_FIRMWARE_MANAGEMENT_CAPSULE_IMAGE_HEADER structure. This structure member is used to indicate if the corresponding payload has support for authentication and dependency. Signed-off-by: Sughosh Ganu --- Changes since v1: - Reword the patch header to get rid of the PatchCheck warning - Make passing of ImageCapsuleSupport parameter to the AddPayload function as an optional parameter to maintain backward compatibility - Declare the values of CAPSULE_SUPPORT_DEPENDENCY and CAPSULE_SUPPORT_AUTHENTICATION in the FmpCapsuleHeaderClass and use those in the GenerateCapsule script .../Source/Python/Capsule/GenerateCapsule.py | 5 +++- .../Common/Uefi/Capsule/FmpCapsuleHeader.py | 28 +-- 2 files changed, 24 insertions(+), 9 deletions(-) diff --git a/BaseTools/Source/Python/Capsule/GenerateCapsule.py b/BaseTools/Source/Python/Capsule/GenerateCapsule.py index a8de988253..b8039db878 100644 --- a/BaseTools/Source/Python/Capsule/GenerateCapsule.py +++ b/BaseTools/Source/Python/Capsule/GenerateCapsule.py @@ -561,6 +561,7 @@ if __name__ == '__main__': print ('GenerateCapsule: error:' + str(Msg)) sys.exit (1) for SinglePayloadDescriptor in PayloadDescriptorList: +ImageCapsuleSupport = 0x Result = SinglePayloadDescriptor.Payload try: FmpPayloadHeader.FwVersion = SinglePayloadDescriptor.FwVersion @@ -575,6 +576,7 @@ if __name__ == '__main__': if SinglePayloadDescriptor.UseDependency: CapsuleDependency.Payload = Result CapsuleDependency.DepexExp = SinglePayloadDescriptor.DepexExp +ImageCapsuleSupport|= FmpCapsuleHeader.CAPSULE_SUPPORT_DEPENDENCY Result = CapsuleDependency.Encode () if args.Verbose: CapsuleDependency.DumpInfo () @@ -607,13 +609,14 @@ if __name__ == '__main__': FmpAuthHeader.MonotonicCount = SinglePayloadDescriptor.MonotonicCount FmpAuthHeader.CertData = CertData FmpAuthHeader.Payload= Result +ImageCapsuleSupport |= FmpCapsuleHeader.CAPSULE_SUPPORT_AUTHENTICATION Result = FmpAuthHeader.Encode () if args.Verbose: FmpAuthHeader.DumpInfo () except: print ('GenerateCapsule: error: can not encode FMP Auth Header') sys.exit (1) -FmpCapsuleHeader.AddPayload (SinglePayloadDescriptor.Guid, Result, HardwareInstance = SinglePayloadDescriptor.HardwareInstance, UpdateImageIndex = SinglePayloadDescriptor.UpdateImageIndex) +FmpCapsuleHeader.AddPayload (SinglePayloadDescriptor.Guid, + Result, HardwareInstance = SinglePayloadDescriptor.HardwareInstance, + UpdateImageIndex = SinglePayloadDescriptor.UpdateImageIndex, + CapsuleSupport = ImageCapsuleSupport) try: for EmbeddedDriver in EmbeddedDriverDescriptorList: FmpCapsuleHeader.AddEmbeddedDriver(EmbeddedDriver) diff --git a/BaseTools/Source/Python/Common/Uefi/Capsule/FmpCapsuleHeader.py b/BaseTools/Source/Python/Common/Uefi/Capsule/FmpCapsuleHeader.py index 91d24919c4..8abb449c6f 100644 --- a/BaseTools/Source/Python/Common/Uefi/Capsule/FmpCapsuleHeader.py +++ b/BaseTools/Source/Python/Common/Uefi/Capsule/FmpCapsuleHeader.py @@ -47,14 +47,19 @@ class FmpCapsuleImageHeaderClass (object): # /// therefore can be modified without changing the Auth data. # /// # UINT64 UpdateHardwareInstance; +# +# /// +# /// Bits which indicate authentication and depex information for the image that follows this structure +# /// +# UINT64 ImageCapsuleSupport # } EFI_FIRMWARE_MANAGEMENT_CAPSULE_IMAGE_HEADER; # -# #define EFI_FIRMWARE_MANAGEMENT_CAPSULE_IMAGE_HEADER_INIT_VERSION 0x0002 +# #define + EFI_FIRMWARE_MANAGEMENT_CAPSULE_IMAGE_HEADER_INIT_VERSION 0x0003 -_StructFormat = '= len (self._FmpCapsuleImageHeaderList): @@ -198,13 +209,14 @@ class FmpCapsuleHeaderClass (object): self._ItemOffsetList.append (Offset) Offset = Offset + len (EmbeddedDriver) Index = 1 -for (UpdateImageTypeId, Payload, VendorCodeBytes, HardwareInstance, UpdateImageIndex) in self._PayloadList: +for (UpdateImageTypeId, Payload
Re: [edk2-devel] [PATCH v2] BaseTools: Add support for version 3 of FMP Image Header structure
Hi Sughosh, Thanks for the reminder. We need to wait for one of the BaseTools maintainers to provide an Rb for the V2 version of this patch, then we will be able to merge. Thanks, Mike From: Sughosh Ganu Sent: Tuesday, May 11, 2021 3:21 AM To: Kinney, Michael D ; Feng, Bob C ; Liming Gao ; Chen, Christine Cc: devel@edk2.groups.io Subject: Re: [edk2-devel] [PATCH v2] BaseTools: Add support for version 3 of FMP Image Header structure hi, Can this patch be merged. Thanks. -sughosh On Mon, 26 Apr 2021 at 21:27, Kinney, Michael D mailto:michael.d.kin...@intel.com>> wrote: Reviewed-by: Michael D Kinney mailto:michael.d.kin...@intel.com>> Mike > -Original Message- > From: devel@edk2.groups.io<mailto:devel@edk2.groups.io> > mailto:devel@edk2.groups.io>> On Behalf Of Sughosh Ganu > Sent: Friday, April 23, 2021 4:29 AM > To: devel@edk2.groups.io<mailto:devel@edk2.groups.io> > Cc: Michal Simek mailto:michal.si...@xilinx.com>>; > Sughosh Ganu mailto:sughosh.g...@linaro.org>> > Subject: [edk2-devel] [PATCH v2] BaseTools: Add support for version 3 of FMP > Image Header structure > > Add support for the ImageCapsuleSupport field, introduced in version 3 > of the EFI_FIRMWARE_MANAGEMENT_CAPSULE_IMAGE_HEADER structure. This > structure member is used to indicate if the corresponding payload has > support for authentication and dependency. > > Signed-off-by: Sughosh Ganu > mailto:sughosh.g...@linaro.org>> > --- > > Changes since v1: > - Reword the patch header to get rid of the PatchCheck warning > - Make passing of ImageCapsuleSupport parameter to the AddPayload > function as an optional parameter to maintain backward compatibility > - Declare the values of CAPSULE_SUPPORT_DEPENDENCY and > CAPSULE_SUPPORT_AUTHENTICATION in the FmpCapsuleHeaderClass and use > those in the GenerateCapsule script > > .../Source/Python/Capsule/GenerateCapsule.py | 5 +++- > .../Common/Uefi/Capsule/FmpCapsuleHeader.py | 28 +-- > 2 files changed, 24 insertions(+), 9 deletions(-) > > diff --git a/BaseTools/Source/Python/Capsule/GenerateCapsule.py > b/BaseTools/Source/Python/Capsule/GenerateCapsule.py > index a8de988253..b8039db878 100644 > --- a/BaseTools/Source/Python/Capsule/GenerateCapsule.py > +++ b/BaseTools/Source/Python/Capsule/GenerateCapsule.py > @@ -561,6 +561,7 @@ if __name__ == '__main__': > print ('GenerateCapsule: error:' + str(Msg)) > sys.exit (1) > for SinglePayloadDescriptor in PayloadDescriptorList: > +ImageCapsuleSupport = 0x > Result = SinglePayloadDescriptor.Payload > try: > FmpPayloadHeader.FwVersion = > SinglePayloadDescriptor.FwVersion > @@ -575,6 +576,7 @@ if __name__ == '__main__': > if SinglePayloadDescriptor.UseDependency: > CapsuleDependency.Payload = Result > CapsuleDependency.DepexExp = SinglePayloadDescriptor.DepexExp > +ImageCapsuleSupport|= > FmpCapsuleHeader.CAPSULE_SUPPORT_DEPENDENCY > Result = CapsuleDependency.Encode () > if args.Verbose: > CapsuleDependency.DumpInfo () > @@ -607,13 +609,14 @@ if __name__ == '__main__': > FmpAuthHeader.MonotonicCount = > SinglePayloadDescriptor.MonotonicCount > FmpAuthHeader.CertData = CertData > FmpAuthHeader.Payload= Result > +ImageCapsuleSupport |= > FmpCapsuleHeader.CAPSULE_SUPPORT_AUTHENTICATION > Result = FmpAuthHeader.Encode () > if args.Verbose: > FmpAuthHeader.DumpInfo () > except: > print ('GenerateCapsule: error: can not encode FMP Auth > Header') > sys.exit (1) > -FmpCapsuleHeader.AddPayload (SinglePayloadDescriptor.Guid, > Result, HardwareInstance = > SinglePayloadDescriptor.HardwareInstance, UpdateImageIndex = > SinglePayloadDescriptor.UpdateImageIndex) > +FmpCapsuleHeader.AddPayload (SinglePayloadDescriptor.Guid, > Result, HardwareInstance = > SinglePayloadDescriptor.HardwareInstance, UpdateImageIndex = > SinglePayloadDescriptor.UpdateImageIndex, CapsuleSupport = > ImageCapsuleSupport) > try: > for EmbeddedDriver in EmbeddedDriverDescriptorList: > FmpCapsuleHeader.AddEmbeddedDriver(EmbeddedDriver) > diff --git a/BaseTools/Source/Python/Common/Uefi/Capsule/FmpCapsuleHeader.py > b/BaseTools/Source/Python/Common/Uefi/Capsule/FmpCapsuleHeader.py > index 91d24919c4..8
Re: [edk2-devel] [PATCH v2] BaseTools: Add support for version 3 of FMP Image Header structure
hi, Can this patch be merged. Thanks. -sughosh On Mon, 26 Apr 2021 at 21:27, Kinney, Michael D wrote: > Reviewed-by: Michael D Kinney > > Mike > > > -Original Message- > > From: devel@edk2.groups.io On Behalf Of Sughosh > Ganu > > Sent: Friday, April 23, 2021 4:29 AM > > To: devel@edk2.groups.io > > Cc: Michal Simek ; Sughosh Ganu < > sughosh.g...@linaro.org> > > Subject: [edk2-devel] [PATCH v2] BaseTools: Add support for version 3 of > FMP Image Header structure > > > > Add support for the ImageCapsuleSupport field, introduced in version 3 > > of the EFI_FIRMWARE_MANAGEMENT_CAPSULE_IMAGE_HEADER structure. This > > structure member is used to indicate if the corresponding payload has > > support for authentication and dependency. > > > > Signed-off-by: Sughosh Ganu > > --- > > > > Changes since v1: > > - Reword the patch header to get rid of the PatchCheck warning > > - Make passing of ImageCapsuleSupport parameter to the AddPayload > > function as an optional parameter to maintain backward compatibility > > - Declare the values of CAPSULE_SUPPORT_DEPENDENCY and > > CAPSULE_SUPPORT_AUTHENTICATION in the FmpCapsuleHeaderClass and use > > those in the GenerateCapsule script > > > > .../Source/Python/Capsule/GenerateCapsule.py | 5 +++- > > .../Common/Uefi/Capsule/FmpCapsuleHeader.py | 28 +-- > > 2 files changed, 24 insertions(+), 9 deletions(-) > > > > diff --git a/BaseTools/Source/Python/Capsule/GenerateCapsule.py > b/BaseTools/Source/Python/Capsule/GenerateCapsule.py > > index a8de988253..b8039db878 100644 > > --- a/BaseTools/Source/Python/Capsule/GenerateCapsule.py > > +++ b/BaseTools/Source/Python/Capsule/GenerateCapsule.py > > @@ -561,6 +561,7 @@ if __name__ == '__main__': > > print ('GenerateCapsule: error:' + str(Msg)) > > sys.exit (1) > > for SinglePayloadDescriptor in PayloadDescriptorList: > > +ImageCapsuleSupport = 0x > > Result = SinglePayloadDescriptor.Payload > > try: > > FmpPayloadHeader.FwVersion = > SinglePayloadDescriptor.FwVersion > > @@ -575,6 +576,7 @@ if __name__ == '__main__': > > if SinglePayloadDescriptor.UseDependency: > > CapsuleDependency.Payload = Result > > CapsuleDependency.DepexExp = > SinglePayloadDescriptor.DepexExp > > +ImageCapsuleSupport|= > FmpCapsuleHeader.CAPSULE_SUPPORT_DEPENDENCY > > Result = CapsuleDependency.Encode () > > if args.Verbose: > > CapsuleDependency.DumpInfo () > > @@ -607,13 +609,14 @@ if __name__ == '__main__': > > FmpAuthHeader.MonotonicCount = > SinglePayloadDescriptor.MonotonicCount > > FmpAuthHeader.CertData = CertData > > FmpAuthHeader.Payload= Result > > +ImageCapsuleSupport |= > FmpCapsuleHeader.CAPSULE_SUPPORT_AUTHENTICATION > > Result = FmpAuthHeader.Encode () > > if args.Verbose: > > FmpAuthHeader.DumpInfo () > > except: > > print ('GenerateCapsule: error: can not encode FMP > Auth Header') > > sys.exit (1) > > -FmpCapsuleHeader.AddPayload (SinglePayloadDescriptor.Guid, > Result, HardwareInstance = > > SinglePayloadDescriptor.HardwareInstance, UpdateImageIndex = > SinglePayloadDescriptor.UpdateImageIndex) > > +FmpCapsuleHeader.AddPayload (SinglePayloadDescriptor.Guid, > Result, HardwareInstance = > > SinglePayloadDescriptor.HardwareInstance, UpdateImageIndex = > SinglePayloadDescriptor.UpdateImageIndex, CapsuleSupport = > > ImageCapsuleSupport) > > try: > > for EmbeddedDriver in EmbeddedDriverDescriptorList: > > FmpCapsuleHeader.AddEmbeddedDriver(EmbeddedDriver) > > diff --git > a/BaseTools/Source/Python/Common/Uefi/Capsule/FmpCapsuleHeader.py > > b/BaseTools/Source/Python/Common/Uefi/Capsule/FmpCapsuleHeader.py > > index 91d24919c4..8abb449c6f 100644 > > --- a/BaseTools/Source/Python/Common/Uefi/Capsule/FmpCapsuleHeader.py > > +++ b/BaseTools/Source/Python/Common/Uefi/Capsule/FmpCapsuleHeader.py > > @@ -47,14 +47,19 @@ class FmpCapsuleImageHeaderClass (object): > > # /// therefore can be modified without changing the Auth data. > > #
Re: [edk2-devel] [PATCH v2] BaseTools: Add support for version 3 of FMP Image Header structure
Reviewed-by: Michael D Kinney Mike > -Original Message- > From: devel@edk2.groups.io On Behalf Of Sughosh Ganu > Sent: Friday, April 23, 2021 4:29 AM > To: devel@edk2.groups.io > Cc: Michal Simek ; Sughosh Ganu > > Subject: [edk2-devel] [PATCH v2] BaseTools: Add support for version 3 of FMP > Image Header structure > > Add support for the ImageCapsuleSupport field, introduced in version 3 > of the EFI_FIRMWARE_MANAGEMENT_CAPSULE_IMAGE_HEADER structure. This > structure member is used to indicate if the corresponding payload has > support for authentication and dependency. > > Signed-off-by: Sughosh Ganu > --- > > Changes since v1: > - Reword the patch header to get rid of the PatchCheck warning > - Make passing of ImageCapsuleSupport parameter to the AddPayload > function as an optional parameter to maintain backward compatibility > - Declare the values of CAPSULE_SUPPORT_DEPENDENCY and > CAPSULE_SUPPORT_AUTHENTICATION in the FmpCapsuleHeaderClass and use > those in the GenerateCapsule script > > .../Source/Python/Capsule/GenerateCapsule.py | 5 +++- > .../Common/Uefi/Capsule/FmpCapsuleHeader.py | 28 +-- > 2 files changed, 24 insertions(+), 9 deletions(-) > > diff --git a/BaseTools/Source/Python/Capsule/GenerateCapsule.py > b/BaseTools/Source/Python/Capsule/GenerateCapsule.py > index a8de988253..b8039db878 100644 > --- a/BaseTools/Source/Python/Capsule/GenerateCapsule.py > +++ b/BaseTools/Source/Python/Capsule/GenerateCapsule.py > @@ -561,6 +561,7 @@ if __name__ == '__main__': > print ('GenerateCapsule: error:' + str(Msg)) > sys.exit (1) > for SinglePayloadDescriptor in PayloadDescriptorList: > +ImageCapsuleSupport = 0x > Result = SinglePayloadDescriptor.Payload > try: > FmpPayloadHeader.FwVersion = > SinglePayloadDescriptor.FwVersion > @@ -575,6 +576,7 @@ if __name__ == '__main__': > if SinglePayloadDescriptor.UseDependency: > CapsuleDependency.Payload = Result > CapsuleDependency.DepexExp = SinglePayloadDescriptor.DepexExp > +ImageCapsuleSupport|= > FmpCapsuleHeader.CAPSULE_SUPPORT_DEPENDENCY > Result = CapsuleDependency.Encode () > if args.Verbose: > CapsuleDependency.DumpInfo () > @@ -607,13 +609,14 @@ if __name__ == '__main__': > FmpAuthHeader.MonotonicCount = > SinglePayloadDescriptor.MonotonicCount > FmpAuthHeader.CertData = CertData > FmpAuthHeader.Payload= Result > +ImageCapsuleSupport |= > FmpCapsuleHeader.CAPSULE_SUPPORT_AUTHENTICATION > Result = FmpAuthHeader.Encode () > if args.Verbose: > FmpAuthHeader.DumpInfo () > except: > print ('GenerateCapsule: error: can not encode FMP Auth > Header') > sys.exit (1) > -FmpCapsuleHeader.AddPayload (SinglePayloadDescriptor.Guid, > Result, HardwareInstance = > SinglePayloadDescriptor.HardwareInstance, UpdateImageIndex = > SinglePayloadDescriptor.UpdateImageIndex) > +FmpCapsuleHeader.AddPayload (SinglePayloadDescriptor.Guid, > Result, HardwareInstance = > SinglePayloadDescriptor.HardwareInstance, UpdateImageIndex = > SinglePayloadDescriptor.UpdateImageIndex, CapsuleSupport = > ImageCapsuleSupport) > try: > for EmbeddedDriver in EmbeddedDriverDescriptorList: > FmpCapsuleHeader.AddEmbeddedDriver(EmbeddedDriver) > diff --git a/BaseTools/Source/Python/Common/Uefi/Capsule/FmpCapsuleHeader.py > b/BaseTools/Source/Python/Common/Uefi/Capsule/FmpCapsuleHeader.py > index 91d24919c4..8abb449c6f 100644 > --- a/BaseTools/Source/Python/Common/Uefi/Capsule/FmpCapsuleHeader.py > +++ b/BaseTools/Source/Python/Common/Uefi/Capsule/FmpCapsuleHeader.py > @@ -47,14 +47,19 @@ class FmpCapsuleImageHeaderClass (object): > # /// therefore can be modified without changing the Auth data. > # /// > # UINT64 UpdateHardwareInstance; > +# > +# /// > +# /// Bits which indicate authentication and depex information for the > image that follows this structure > +# /// > +# UINT64 ImageCapsuleSupport > # } EFI_FIRMWARE_MANAGEMENT_CAPSULE_IMAGE_HEADER; > # > -# #define EFI_FIRMWARE_MANAGEMENT_CAPSULE_IMAGE_HEADER_INIT_VERSION > 0x0002 > +# #define EFI_FIRMWARE_MANAGEMENT_CAPSULE_IMAGE_HEADER_INIT_VERSION > 0x000
[edk2-devel] [PATCH v2] BaseTools: Add support for version 3 of FMP Image Header structure
Add support for the ImageCapsuleSupport field, introduced in version 3 of the EFI_FIRMWARE_MANAGEMENT_CAPSULE_IMAGE_HEADER structure. This structure member is used to indicate if the corresponding payload has support for authentication and dependency. Signed-off-by: Sughosh Ganu --- Changes since v1: - Reword the patch header to get rid of the PatchCheck warning - Make passing of ImageCapsuleSupport parameter to the AddPayload function as an optional parameter to maintain backward compatibility - Declare the values of CAPSULE_SUPPORT_DEPENDENCY and CAPSULE_SUPPORT_AUTHENTICATION in the FmpCapsuleHeaderClass and use those in the GenerateCapsule script .../Source/Python/Capsule/GenerateCapsule.py | 5 +++- .../Common/Uefi/Capsule/FmpCapsuleHeader.py | 28 +-- 2 files changed, 24 insertions(+), 9 deletions(-) diff --git a/BaseTools/Source/Python/Capsule/GenerateCapsule.py b/BaseTools/Source/Python/Capsule/GenerateCapsule.py index a8de988253..b8039db878 100644 --- a/BaseTools/Source/Python/Capsule/GenerateCapsule.py +++ b/BaseTools/Source/Python/Capsule/GenerateCapsule.py @@ -561,6 +561,7 @@ if __name__ == '__main__': print ('GenerateCapsule: error:' + str(Msg)) sys.exit (1) for SinglePayloadDescriptor in PayloadDescriptorList: +ImageCapsuleSupport = 0x Result = SinglePayloadDescriptor.Payload try: FmpPayloadHeader.FwVersion = SinglePayloadDescriptor.FwVersion @@ -575,6 +576,7 @@ if __name__ == '__main__': if SinglePayloadDescriptor.UseDependency: CapsuleDependency.Payload = Result CapsuleDependency.DepexExp = SinglePayloadDescriptor.DepexExp +ImageCapsuleSupport|= FmpCapsuleHeader.CAPSULE_SUPPORT_DEPENDENCY Result = CapsuleDependency.Encode () if args.Verbose: CapsuleDependency.DumpInfo () @@ -607,13 +609,14 @@ if __name__ == '__main__': FmpAuthHeader.MonotonicCount = SinglePayloadDescriptor.MonotonicCount FmpAuthHeader.CertData = CertData FmpAuthHeader.Payload= Result +ImageCapsuleSupport |= FmpCapsuleHeader.CAPSULE_SUPPORT_AUTHENTICATION Result = FmpAuthHeader.Encode () if args.Verbose: FmpAuthHeader.DumpInfo () except: print ('GenerateCapsule: error: can not encode FMP Auth Header') sys.exit (1) -FmpCapsuleHeader.AddPayload (SinglePayloadDescriptor.Guid, Result, HardwareInstance = SinglePayloadDescriptor.HardwareInstance, UpdateImageIndex = SinglePayloadDescriptor.UpdateImageIndex) +FmpCapsuleHeader.AddPayload (SinglePayloadDescriptor.Guid, Result, HardwareInstance = SinglePayloadDescriptor.HardwareInstance, UpdateImageIndex = SinglePayloadDescriptor.UpdateImageIndex, CapsuleSupport = ImageCapsuleSupport) try: for EmbeddedDriver in EmbeddedDriverDescriptorList: FmpCapsuleHeader.AddEmbeddedDriver(EmbeddedDriver) diff --git a/BaseTools/Source/Python/Common/Uefi/Capsule/FmpCapsuleHeader.py b/BaseTools/Source/Python/Common/Uefi/Capsule/FmpCapsuleHeader.py index 91d24919c4..8abb449c6f 100644 --- a/BaseTools/Source/Python/Common/Uefi/Capsule/FmpCapsuleHeader.py +++ b/BaseTools/Source/Python/Common/Uefi/Capsule/FmpCapsuleHeader.py @@ -47,14 +47,19 @@ class FmpCapsuleImageHeaderClass (object): # /// therefore can be modified without changing the Auth data. # /// # UINT64 UpdateHardwareInstance; +# +# /// +# /// Bits which indicate authentication and depex information for the image that follows this structure +# /// +# UINT64 ImageCapsuleSupport # } EFI_FIRMWARE_MANAGEMENT_CAPSULE_IMAGE_HEADER; # -# #define EFI_FIRMWARE_MANAGEMENT_CAPSULE_IMAGE_HEADER_INIT_VERSION 0x0002 +# #define EFI_FIRMWARE_MANAGEMENT_CAPSULE_IMAGE_HEADER_INIT_VERSION 0x0003 -_StructFormat = '= len (self._FmpCapsuleImageHeaderList): @@ -198,13 +209,14 @@ class FmpCapsuleHeaderClass (object): self._ItemOffsetList.append (Offset) Offset = Offset + len (EmbeddedDriver) Index = 1 -for (UpdateImageTypeId, Payload, VendorCodeBytes, HardwareInstance, UpdateImageIndex) in self._PayloadList: +for (UpdateImageTypeId, Payload, VendorCodeBytes, HardwareInstance, UpdateImageIndex, CapsuleSupport) in self._PayloadList: FmpCapsuleImageHeader = FmpCapsuleImageHeaderClass () FmpCapsuleImageHeader.UpdateImageTypeId = UpdateImageTypeId FmpCapsuleImageHeader.UpdateImageIndex = UpdateImageIndex FmpCapsuleImageHeader.Payload= Payload
[edk2-devel] [PATCH v2] BaseTools: Add support for version 3 of FMP Image Header structure
Add support for the ImageCapsuleSupport field, introduced in version 3 of the EFI_FIRMWARE_MANAGEMENT_CAPSULE_IMAGE_HEADER structure. This structure member is used to indicate if the corresponding payload has support for authentication and dependency. Signed-off-by: Sughosh Ganu --- Changes since v1: - Reword the patch header to get rid of the PatchCheck warning - Make passing of ImageCapsuleSupport parameter to the AddPayload function as an optional parameter to maintain backward compatibility - Declare the values of CAPSULE_SUPPORT_DEPENDENCY and CAPSULE_SUPPORT_AUTHENTICATION in the FmpCapsuleHeaderClass and use those in the GenerateCapsule script .../Source/Python/Capsule/GenerateCapsule.py | 5 +++- .../Common/Uefi/Capsule/FmpCapsuleHeader.py | 28 +-- 2 files changed, 24 insertions(+), 9 deletions(-) diff --git a/BaseTools/Source/Python/Capsule/GenerateCapsule.py b/BaseTools/Source/Python/Capsule/GenerateCapsule.py index a8de988253..b8039db878 100644 --- a/BaseTools/Source/Python/Capsule/GenerateCapsule.py +++ b/BaseTools/Source/Python/Capsule/GenerateCapsule.py @@ -561,6 +561,7 @@ if __name__ == '__main__': print ('GenerateCapsule: error:' + str(Msg)) sys.exit (1) for SinglePayloadDescriptor in PayloadDescriptorList: +ImageCapsuleSupport = 0x Result = SinglePayloadDescriptor.Payload try: FmpPayloadHeader.FwVersion = SinglePayloadDescriptor.FwVersion @@ -575,6 +576,7 @@ if __name__ == '__main__': if SinglePayloadDescriptor.UseDependency: CapsuleDependency.Payload = Result CapsuleDependency.DepexExp = SinglePayloadDescriptor.DepexExp +ImageCapsuleSupport|= FmpCapsuleHeader.CAPSULE_SUPPORT_DEPENDENCY Result = CapsuleDependency.Encode () if args.Verbose: CapsuleDependency.DumpInfo () @@ -607,13 +609,14 @@ if __name__ == '__main__': FmpAuthHeader.MonotonicCount = SinglePayloadDescriptor.MonotonicCount FmpAuthHeader.CertData = CertData FmpAuthHeader.Payload= Result +ImageCapsuleSupport |= FmpCapsuleHeader.CAPSULE_SUPPORT_AUTHENTICATION Result = FmpAuthHeader.Encode () if args.Verbose: FmpAuthHeader.DumpInfo () except: print ('GenerateCapsule: error: can not encode FMP Auth Header') sys.exit (1) -FmpCapsuleHeader.AddPayload (SinglePayloadDescriptor.Guid, Result, HardwareInstance = SinglePayloadDescriptor.HardwareInstance, UpdateImageIndex = SinglePayloadDescriptor.UpdateImageIndex) +FmpCapsuleHeader.AddPayload (SinglePayloadDescriptor.Guid, Result, HardwareInstance = SinglePayloadDescriptor.HardwareInstance, UpdateImageIndex = SinglePayloadDescriptor.UpdateImageIndex, CapsuleSupport = ImageCapsuleSupport) try: for EmbeddedDriver in EmbeddedDriverDescriptorList: FmpCapsuleHeader.AddEmbeddedDriver(EmbeddedDriver) diff --git a/BaseTools/Source/Python/Common/Uefi/Capsule/FmpCapsuleHeader.py b/BaseTools/Source/Python/Common/Uefi/Capsule/FmpCapsuleHeader.py index 91d24919c4..8abb449c6f 100644 --- a/BaseTools/Source/Python/Common/Uefi/Capsule/FmpCapsuleHeader.py +++ b/BaseTools/Source/Python/Common/Uefi/Capsule/FmpCapsuleHeader.py @@ -47,14 +47,19 @@ class FmpCapsuleImageHeaderClass (object): # /// therefore can be modified without changing the Auth data. # /// # UINT64 UpdateHardwareInstance; +# +# /// +# /// Bits which indicate authentication and depex information for the image that follows this structure +# /// +# UINT64 ImageCapsuleSupport # } EFI_FIRMWARE_MANAGEMENT_CAPSULE_IMAGE_HEADER; # -# #define EFI_FIRMWARE_MANAGEMENT_CAPSULE_IMAGE_HEADER_INIT_VERSION 0x0002 +# #define EFI_FIRMWARE_MANAGEMENT_CAPSULE_IMAGE_HEADER_INIT_VERSION 0x0003 -_StructFormat = '= len (self._FmpCapsuleImageHeaderList): @@ -198,13 +209,14 @@ class FmpCapsuleHeaderClass (object): self._ItemOffsetList.append (Offset) Offset = Offset + len (EmbeddedDriver) Index = 1 -for (UpdateImageTypeId, Payload, VendorCodeBytes, HardwareInstance, UpdateImageIndex) in self._PayloadList: +for (UpdateImageTypeId, Payload, VendorCodeBytes, HardwareInstance, UpdateImageIndex, CapsuleSupport) in self._PayloadList: FmpCapsuleImageHeader = FmpCapsuleImageHeaderClass () FmpCapsuleImageHeader.UpdateImageTypeId = UpdateImageTypeId FmpCapsuleImageHeader.UpdateImageIndex = UpdateImageIndex FmpCapsuleImageHeader.Payload= Payload