1# Overview 2pldm_fwup_pkg_creator.py is a python script that can package one or more 3firmware image blobs into a PLDM firmware update package, as per the DSP0267 4specification v1.1.0 - Section 7. 5 6# Requirements 7- Python 3.6+ 8- Python bitarray module 9 - For example on Ubuntu: sudo pip3 install bitarray 10 11# Usage 12 13 pldm_fwup_pkg_creator.py [-h] 14 pldmfwuppkgname metadatafile images 15 [images ...] 16 17 positional arguments: 18 pldmfwuppkgname Name of the PLDM FW update package 19 metadatafile Path of metadata JSON file 20 images One or more firmware image paths, in the same order as 21 ComponentImageInformationArea entries 22 23- Provide name for the PLDM FW update package, output will be written to a file 24with this name 25- Providing the metadata JSON file is a must 26- The file path of at least one image file must be provided 27- In case there are more than one images, they should be specified in the 28*same order* as the entries in the "ComponentImageInformationArea" list in the 29metadata json 30 31# Metadata JSON file 32Some fields corresponding to the PLDM firmware update package must be 33specified in an input metadata file (see the section 'Mapping fields to 34DSP0267') that's in JSON format. Typically it is not necessary to write this 35file each time the PLDM firmware update package has to be generated - one or 36more platform specific metadata JSON files can be reused. The key names used in 37the metadata JSON *match with the proprerty names* used in DSP0267. 38There is an example metadata json file included - metadata-example.json, which 39has example entries for preparing a PLDM firmware update package that targets 40three devices, and there are a total of three component images. 41 42# Mapping fields to DSP0267 43This section describes the following: 44- which fields of the PLDM firmware update package are supported by the script 45- whether those fields need to be specified in the JSON, or are generated by the 46script 47 48## Package Header Information 49Metadata JSON must have a key called "PackageHeaderInformation", which is of 50type Object. See below for details on properties: 51- PackageHeaderIdentifier: Supported, must be specified in metadata file 52- PackageHeaderFormatRevision: Supported, must be specified in metadata file 53- PackageHeaderSize: Supported, generated by the script 54- PackageReleaseDateTime: Supported, this is an optional field in the metadata 55file and the format is dd/MM/yyyy HH:mm:ss. If not specified in the metadata 56file, current time is taken. 57- ComponentBitmapBitLength: Supported, generated by the script 58 - Only 32 components supported at the moment 59- PackageVersionStringType: Supported - only ASCII at the moment. Generated by 60the script 61- PackageVersionStringLength: Supported, generated by the script 62- PackageVersionString: Supported, must be specified in metadata file 63 64## Firmware Device Identification Area 65Metadata JSON must have a key called "FirmwareDeviceIdentificationArea", which 66is of type List. Each List entry corresponds to an firmware device ID record. 67See below for details on properties: 68- DeviceIDRecordCount: Supported, generated by the script 69- FirmwareDeviceIDRecords: which is a list of Individual Firmware Device ID 70Records. Each such record can have the following properties: 71 - RecordLength: Supported, generated by the script 72 - DescriptorCount: Supported, generated by the script 73 - DeviceUpdateOptionFlags: Supported, must be specified in metadata file 74 - add each bit that is to be set to 1 to the list 75 "DeviceUpdateOptionFlags" 76 - ComponentImageSetVersionStringType: Supported - only ASCII at the moment. 77 Generated by the script 78 - ComponentImageSetVersionStringLength: Supported, generated by the script 79 - FirmwareDevicePackageDataLength: Not supported. Set to 0 by the script 80 - ApplicableComponents: Supported, must be specified in metadata file 81 - specify all "ComponentIdentifier" values that apply in the 82 "ApplicableComponents" list 83 - ComponentImageSetVersionString: Supported, must be specified in metadata 84 file 85 - RecordDescriptors: 86 - Initial Descriptor: Supported, must be specified in metadata file. 87 Metatdata file must have key called "InitialDescriptor", which is of 88 type Object: 89 - InitialDescriptorType: Supported, must be specified in metadata 90 file. The supported types are 0x0000(PCI Vendor ID), 0x0001(IANA 91 Enterprise ID), 0x0002 (UUID), 0x0003(PnP Vendor ID), 0x0004( ACPI 92 Vendor ID) 93 - InitialDescriptorLength: Supported, generated by the script 94 - InitialDescriptorData: Supported, must be specified in metadata 95 file as a hex string 96 - Optional Additional Descriptors: Not supported at the moment 97 - FirmwareDevicePackageData: Not supported at the moment 98 99## Downstream Device Identification Area 100Not supported at the moment 101 102## Component Image Information Area 103Metadata JSON must have a key called "ComponentImageInformationArea", which 104is of type List. Each List entry corresponds to an Individual Component Image 105Information. See below for details on properties: 106- ComponentImageCount: Supported, generated by the script 107- ComponentImageInformation: which is a list of Individual Component Image 108Information records. Each such record can have the following properties: 109 - ComponentClassification: Supported, must be specified in metadata file 110 - ComponentIdentifier: Supported, must be specified in metadata file 111 - ComponentComparisonStamp: Not supported. Set to 0xFFFFFFFF by the script 112 - ComponentOptions: Supported, must be specified in metadata file 113 - add each bit that is to be set to 1 to the list "ComponentOptions" 114 - only supported option at the moment is Force Update (0x0) 115 - RequestedComponentActivationMethod: Supported, must be specified in 116 metadata file 117 - add each bit that is to be set to 1 to the list 118 "RequestedComponentActivationMethod" 119 - ComponentLocationOffset: Supported, generated by the script 120 - ComponentSize: Supported, generated by the script 121 - ComponentVersionStringType: Supported - only ASCII at the moment. 122 Generated by the script 123 - ComponentVersionStringLength: Supported, generated by the script 124 - ComponentVersionString: Supported, must be specified in metadata file 125 126## Package Header Checksum 127Supported, generated by the script 128