This project offers the capability to parse and generate the PLDM firmware update header. Primarily, it decodes the PLDM.json file to produce a binary firmware update header file named pldm_update_header.bin. This binary file is an encapsulated firmware update header. Subsequently, the system calculates the CRC32 for the entire PLDM firmware update header and appends this CRC32 to the end of the header section within the package. Finally, the content from the image_payload.bin file is appended to the created pldm_update_header.bin, forming a complete PLDM firmware update package
Starting with a source file named PLDM.json, this generator will:
- Parse the JSON content to understand the structure and data it contains.
- Generate an intermediary binary file, PLDM_FW_PKG_Header.bin, representing the firmware package header from the parsed data.
- If an image_payload.bin file is present, its contents will be appended to pldm_update_header.bin 4 Finally, the utility generates Pldm Firmware Update Package file "pldm_update_pkg.bin ".
The program anticipates a standardized JSON format in PLDM.json, enabling users to easily modify or expand their firmware data.
It skillfully crafts a binary representation of the package header, optimized for firmware applications.
To ensure the integrity of the data, a checksum is calculated for the entire package header and subsequently appended to the pldm_update_header.bin file.
Upon detecting an image_payload.bin, the utility effortlessly incorporates its content to the resulting binary header.
- Place your PLDM.json and optionally, image_payload.bin, in the project's directory.
- Run the utility.
- Once completed, retrieve the PLDM_FW_PKG_Header.bin with the appended checksum. This streamlined process ensures quick turnaround times, allowing firmware developers to focus on their core functionalities while trusting the integrity and accuracy of their package headers.
Ensure the following are set up on your system before proceeding:
(1) C compiler: For instance, GCC.
(2) json-c: A JSON library for C.
(3) Files:
(i) PLDM.json: This should be present in the same directory as the program, serving as the input.
(ii) image_payload.bin: This file's content will be appended to the generated firmware package header.
Ensure PLDM.json and image_payload.bin are located in the same directory. Install all necessary dependencies before running the program.
The program expects a file named PLDM.json in the same directory to serve as input. Additionally, there should be a image_payload.bin file, the content of which will be appended to the generated firmware package header.
Upon successful execution, the utility generates: -> pldm_update_header.bin: This is the binary representation of the firmware header, inclusive of the appended checksum. -> pldm_update_pkg.bin: This is the binary representation of the entire firmware package, inclusive of the appended image_payload.bin.
For the json-c library:
sudo apt install libjson-c-dev
To generate the PLDM_FW_PKG_Header.bin:
make all
make encode
To decode the generated file:
make decode
To clean the generated file:
make clean
You can view the object files within the libpldm.a static library using:
$ ar -t libpldm.a
- compo.o
- pkg_info.o
- FD_ID.o
- data_trans_fxn.o
- parse_PLDM_json.o
For more information on the PLDM firmware update specification, refer to the document: PLDM for Firmware Update Specification DSP0267_1.0.0.pdf:
https://www.dmtf.org/sites/default/files/standards/documents/DSP0267_1.0.0.pdf