Overview
pldm_fwup_pkg_creator.py is a python script that can package one or more firmware image blobs into a PLDM firmware update package, as per the DSP0267 specification v1.1.0 - Section 7.
Requirements
- Python 3.6+
- Python bitarray module
- For example on Ubuntu: sudo pip3 install bitarray
Usage
pldm_fwup_pkg_creator.py [-h]
pldmfwuppkgname metadatafile images
[images ...]
positional arguments:
pldmfwuppkgname Name of the PLDM FW update package
metadatafile Path of metadata JSON file
images One or more firmware image paths, in the same order as
ComponentImageInformationArea entries
- Provide name for the PLDM FW update package, output will be written to a file with this name
- Providing the metadata JSON file is a must
- The file path of at least one image file must be provided
- In case there are more than one images, they should be specified in the same order as the entries in the "ComponentImageInformationArea" list in the metadata json
Metadata JSON file
Some fields corresponding to the PLDM firmware update package must be specified in an input metadata file (see the section 'Mapping fields to DSP0267') that's in JSON format. Typically it is not necessary to write this file each time the PLDM firmware update package has to be generated - one or more platform specific metadata JSON files can be reused. The key names used in the metadata JSON match with the proprerty names used in DSP0267. There is an example metadata json file included - metadata-example.json, which has example entries for preparing a PLDM firmware update package that targets three devices, and there are a total of three component images.
Mapping fields to DSP0267
This section describes the following:
- which fields of the PLDM firmware update package are supported by the script
- whether those fields need to be specified in the JSON, or are generated by the script
Package Header Information
Metadata JSON must have a key called "PackageHeaderInformation", which is of type Object. See below for details on properties:
- PackageHeaderIdentifier: Supported, must be specified in metadata file
- PackageHeaderFormatRevision: Supported, must be specified in metadata file
- PackageHeaderSize: Supported, generated by the script
- PackageReleaseDateTime: Supported, this is an optional field in the metadata file and the format is dd/MM/yyyy HH:mm:ss. If not specified in the metadata file, current time is taken.
- ComponentBitmapBitLength: Supported, generated by the script
- Only 32 components supported at the moment
- PackageVersionStringType: Supported - only ASCII at the moment. Generated by the script
- PackageVersionStringLength: Supported, generated by the script
- PackageVersionString: Supported, must be specified in metadata file
Firmware Device Identification Area
Metadata JSON must have a key called "FirmwareDeviceIdentificationArea", which is of type List. Each List entry corresponds to an firmware device ID record. See below for details on properties:
- DeviceIDRecordCount: Supported, generated by the script
- FirmwareDeviceIDRecords: which is a list of Individual Firmware Device ID Records. Each such record can have the following properties:
- RecordLength: Supported, generated by the script
- DescriptorCount: Supported, generated by the script
- DeviceUpdateOptionFlags: Supported, must be specified in metadata file
- add each bit that is to be set to 1 to the list "DeviceUpdateOptionFlags"
- ComponentImageSetVersionStringType: Supported - only ASCII at the moment. Generated by the script
- ComponentImageSetVersionStringLength: Supported, generated by the script
- FirmwareDevicePackageDataLength: Not supported. Set to 0 by the script
- ApplicableComponents: Supported, must be specified in metadata file
- specify all "ComponentIdentifier" values that apply in the "ApplicableComponents" list
- ComponentImageSetVersionString: Supported, must be specified in metadata file
- RecordDescriptors:
- Initial Descriptor: Supported, must be specified in metadata file. Metatdata file must have key called "InitialDescriptor", which is of type Object:
- InitialDescriptorType: Supported, must be specified in metadata file. The supported types are 0x0000(PCI Vendor ID), 0x0001(IANA Enterprise ID), 0x0002 (UUID), 0x0003(PnP Vendor ID), 0x0004( ACPI Vendor ID)
- InitialDescriptorLength: Supported, generated by the script
- InitialDescriptorData: Supported, must be specified in metadata file as a hex string
- Optional Additional Descriptors: Not supported at the moment
- FirmwareDevicePackageData: Not supported at the moment
Downstream Device Identification Area
Not supported at the moment
Component Image Information Area
Metadata JSON must have a key called "ComponentImageInformationArea", which is of type List. Each List entry corresponds to an Individual Component Image Information. See below for details on properties:
- ComponentImageCount: Supported, generated by the script
- ComponentImageInformation: which is a list of Individual Component Image Information records. Each such record can have the following properties:
- ComponentClassification: Supported, must be specified in metadata file
- ComponentIdentifier: Supported, must be specified in metadata file
- ComponentComparisonStamp: Not supported. Set to 0xFFFFFFFF by the script
- ComponentOptions: Supported, must be specified in metadata file
- add each bit that is to be set to 1 to the list "ComponentOptions"
- only supported option at the moment is Force Update (0x0)
- RequestedComponentActivationMethod: Supported, must be specified in metadata file
- add each bit that is to be set to 1 to the list "RequestedComponentActivationMethod"
- ComponentLocationOffset: Supported, generated by the script
- ComponentSize: Supported, generated by the script
- ComponentVersionStringType: Supported - only ASCII at the moment. Generated by the script
- ComponentVersionStringLength: Supported, generated by the script
- ComponentVersionString: Supported, must be specified in metadata file
Package Header Checksum
Supported, generated by the script