fwupdate-tools: Support for multiple components
At present ComponentIdentifier is used in
ApplicableComponents field to select images that
apply for a firmware device. Which restricts to
have same ComponentIdentifier for multiple
components. This patch will enable to use
ComponentImageInformationArea index in
ApplicableComponents field.
Unit Tests:
1. Modify ApplicableComponents with index and
verify the package with previous package.
There should not be any difference
2. Verify multiple components with same
component identifier
3. Test out of index for ApplicableComponents
Signed-off-by: Chinmay Shripad Hegde <hosmanechinmay@gmail.com>
Change-Id: Ibf5069d568f0a922d52db261219c2557d2d2f715
diff --git a/tools/fw-update/README.md b/tools/fw-update/README.md
index 32e6de1..b59b403 100644
--- a/tools/fw-update/README.md
+++ b/tools/fw-update/README.md
@@ -76,39 +76,46 @@
- 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: Metadata JSON must have a key called
- "Descriptors", which is of type List. Each List entry corresponds to a
- descriptor. The first entry is considered as the initial descriptor and the
- type shall be one of the following 0x0000(PCI Vendor ID), 0x0001(IANA
- Enterprise ID), 0x0002(UUID), 0x0003(PnP Vendor ID), 0x0004(ACPI Vendor ID).
- The additional descriptors support initial descriptor types and additionally
- 0x0100(PCI Device ID), 0x0101(PCI Subsystem Vendor ID), 0x0102(PCI Subsystem
- ID), 0x0103(PCI Revision ID), 0x0104(PnP Product Identifier), 0x0105(ACPI
- Product Identifier), 0xFFFF(Vendor defined). For descriptor types other than
- vendor defined the properties expected are DescriptorType and DescriptorData.
- If the descriptor type is vendor defined, the properties expected are
- DescriptorType, VendorDefinedDescriptorTitleString and
- VendorDefinedDescriptorData. See below for details on properties: -
- DescriptorType: Supported, must be specified in metadata file -
- DescriptorLength: Supported, generated by the script - DescriptorData:
- Supported, must be specified in metadata file as a hex string -
- VendorDefinedDescriptorTitleStringType: Supported - only ASCII at the
- moment. - VendorDefinedDescriptorTitleStringLength: Supported, generated by
- the script - VendorDefinedDescriptorTitleString: Supported, must be specified
- in metadata file - VendorDefinedDescriptorData: Supported, must be specified
- in metadata file as a hex string - FirmwareDevicePackageData: Not supported at
- the moment
+ 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 indexes of "ComponentImageInformationArea" values that apply in
+ the "ApplicableComponents" list
+ - ComponentImageSetVersionString: Supported, must be specified in metadata
+ file
+ - RecordDescriptors: Metadata JSON must have a key called "Descriptors", which
+ is of type List. Each List entry corresponds to a descriptor. The first
+ entry is considered as the initial descriptor and the type shall be one of
+ the following 0x0000(PCI Vendor ID), 0x0001(IANA Enterprise ID),
+ 0x0002(UUID), 0x0003(PnP Vendor ID), 0x0004(ACPI Vendor ID). The additional
+ descriptors support initial descriptor types and additionally 0x0100(PCI
+ Device ID), 0x0101(PCI Subsystem Vendor ID), 0x0102(PCI Subsystem ID),
+ 0x0103(PCI Revision ID), 0x0104(PnP Product Identifier), 0x0105(ACPI Product
+ Identifier), 0xFFFF(Vendor defined). For descriptor types other than vendor
+ defined the properties expected are DescriptorType and DescriptorData. If
+ the descriptor type is vendor defined, the properties expected are
+ DescriptorType, VendorDefinedDescriptorTitleString and
+ VendorDefinedDescriptorData. See below for details on properties:
+ - DescriptorType: Supported, must be specified in metadata file
+ - DescriptorLength: Supported, generated by the script
+ - DescriptorData: Supported, must be specified in metadata file as a hex
+ string
+ - VendorDefinedDescriptorTitleStringType: Supported - only ASCII at the
+ moment.
+ - VendorDefinedDescriptorTitleStringLength: Supported, generated by the
+ script
+ - VendorDefinedDescriptorTitleString: Supported, must be specified in
+ metadata file
+ - VendorDefinedDescriptorData: Supported, must be specified in metadata file
+ as a hex string
+ - FirmwareDevicePackageData: Not supported at the moment
## Downstream Device Identification Area
diff --git a/tools/fw-update/metadata-example.json b/tools/fw-update/metadata-example.json
index 185f985..ac080af 100644
--- a/tools/fw-update/metadata-example.json
+++ b/tools/fw-update/metadata-example.json
@@ -9,7 +9,7 @@
{
"DeviceUpdateOptionFlags": [0],
"ComponentImageSetVersionString": "VersionString2",
- "ApplicableComponents": [100, 200],
+ "ApplicableComponents": [0, 1],
"Descriptors": [
{
"DescriptorType": 2,
@@ -29,7 +29,7 @@
{
"DeviceUpdateOptionFlags": [],
"ComponentImageSetVersionString": "VersionString3",
- "ApplicableComponents": [100, 200, 300],
+ "ApplicableComponents": [0, 1, 2],
"Descriptors": [
{
"DescriptorType": 2,
@@ -40,7 +40,7 @@
{
"DeviceUpdateOptionFlags": [],
"ComponentImageSetVersionString": "VersionString4",
- "ApplicableComponents": [100],
+ "ApplicableComponents": [0],
"Descriptors": [
{
"DescriptorType": 2,
diff --git a/tools/fw-update/pldm_fwup_pkg_creator.py b/tools/fw-update/pldm_fwup_pkg_creator.py
index 4c3d233..42e8a5a 100755
--- a/tools/fw-update/pldm_fwup_pkg_creator.py
+++ b/tools/fw-update/pldm_fwup_pkg_creator.py
@@ -215,9 +215,11 @@
component_bitmap_bit_length, endian="little"
)
applicable_components.setall(0)
- for component in components:
- if component["ComponentIdentifier"] in applicable_components_list:
- applicable_components[components.index(component)] = 1
+ for component_index in applicable_components_list:
+ if 0 <= component_index < len(components):
+ applicable_components[component_index] = 1
+ else:
+ sys.exit("ERROR: Applicable Component index not found.")
return applicable_components