Skip to content

Fmp capsule header

fmp_capsule_header

Module for encoding and decoding EFI_FIRMWARE_MANAGEMENT_CAPSULE_HEADER with payloads.

FmpCapsuleImageHeaderClass

An object representing an EFI_FIRMWARE_MANAGEMENT_CAPSULE_IMAGE_HEADER.

Can parse or produce an EFI_FIRMWARE_MANAGEMENT_CAPSULE_IMAGE_HEADER structure/byte buffer.

Attributes:

Name Type Description
Version int

EFI_FIRMWARE_MANAGEMENT_CAPSULE_IMAGE_HEADER_INIT_VERSION

UpdateImageTypeId UUID

Used to identify device firmware targeted by this update. This guid is matched by system firmware against ImageTypeId field within a EFI_FIRMWARE_IMAGE_DESCRIPTOR

UpdateImageIndex int

Passed as ImageIndex in call to EFI_FIRMWARE_MANAGEMENT_PROTOCOL.SetImage ()

UpdateImageSize int

Size of the binary update image which immediately follows this structure

UpdateVendorCodeSize int

Size of the VendorCode bytes which optionally immediately follow binary update image in the capsule

UpdateHardwareInstance int

The HardwareInstance to target with this update. If value is zero it means match all HardwareInstances.

Payload str

String representing payload as bytes (i.e. b'\x01\x00\x03')

typedef struct {
    UINT32   Version;
    EFI_GUID UpdateImageTypeId;
    UINT8    UpdateImageIndex;
    UINT8    reserved_bytes[3];
    UINT32   UpdateImageSize;
    UINT32   UpdateVendorCodeSize;
    UINT64   UpdateHardwareInstance;
} EFI_FIRMWARE_MANAGEMENT_CAPSULE_IMAGE_HEADER;

#define EFI_FIRMWARE_MANAGEMENT_CAPSULE_IMAGE_HEADER_INIT_VERSION 0x00000002

__init__

__init__() -> FmpCapsuleImageHeaderClass

Inits an empty object.

Encode

Encode() -> bytes

Serializes the object.

Returns:

Type Description
str

string representing packed data as bytes (i.e. b'\x01\x00\x03')

Decode

Decode(Buffer: IO) -> bytes

Loads data into the object from a filestream.

Parameters:

Name Type Description Default
Buffer IO

Buffer containing data

required

Returns:

Name Type Description
bytes bytes

remaining buffer

Raises:

Type Description
ValueError

Invalid buffer length

ValueError

Invalid Version

DumpInfo

DumpInfo() -> None

Prints object to Console.

FmpCapsuleHeaderClass

An object representing a EFI_FIRMWARE_MANAGEMENT_CAPSULE_HEADER_INIT_VERSION.

Can parse or produce an EFI_FIRMWARE_MANAGEMENT_CAPSULE_HEADER_INIT_VERSION structure/byte buffer.

Attributes:

Name Type Description
Version int

EFI_FIRMWARE_MANAGEMENT_CAPSULE_HEADER_INIT_VERSION

EmbeddedDriverCount int

The number of drivers included in the capsule and the number of corresponding offsets stored in ItemOffsetList array.

PayloadItemCount int

The number of payload items included in the capsule and the number of corresponding offsets stored in the ItemOffsetList array.

typedef struct {
    UINT32 Version;
    UINT16 EmbeddedDriverCount;
    UINT16 PayloadItemCount;
    UINT64 ItemOffsetList[];
} EFI_FIRMWARE_MANAGEMENT_CAPSULE_HEADER;
#define EFI_FIRMWARE_MANAGEMENT_CAPSULE_HEADER_INIT_VERSION       0x00000001

__init__

__init__() -> FmpCapsuleHeaderClass

Inits an empty object.

AddEmbeddedDriver

AddEmbeddedDriver(EmbeddedDriver: bytes) -> None

Adds an embedded driver to the list.

GetEmbeddedDriver

GetEmbeddedDriver(Index: int) -> bytes

Returns the embedded driver at the index.

AddFmpCapsuleImageHeader

AddFmpCapsuleImageHeader(
    FmpCapsuleHeader: FmpCapsuleImageHeaderClass,
) -> None

Adds an Fmp Capsule Image header to the list.

GetFmpCapsuleImageHeader

GetFmpCapsuleImageHeader(
    Index: int,
) -> FmpCapsuleImageHeaderClass

Returns the Fmp Capsule Image header at the index.

Encode

Encode() -> bytes

Serializes the object.

Returns:

Type Description
str

string representing packed data as bytes (i.e. b'\x01\x00\x03')

Decode

Decode(Buffer: IO) -> bytes

Loads data into the object from a Buffer.

Parameters:

Name Type Description Default
Buffer obj

The buffer containing the data.

required

Returns:

Type Description
obj

Reaming buffer

Raises:

Type Description
ValueError

Invalid Buffer

ValueError

Invalid Version

DumpInfo

DumpInfo() -> None

Prints the object to the console.