1Notice: This repository contains a proof of concept library. 2It is intended to serve as a demonstrator. 3Arm is not actively using the library in this repository or integrating the library into reference code. 4Arm is willing to collaborate to integrate the code in another upstream project. 5 6# CPER JSON Representation & Conversion Library 7 8This repository specifies a structure for representing UEFI CPER records (as 9described in UEFI Specification Appendix N) in a human-readable JSON format, in 10addition to a library which can readily convert back and forth between the 11standard CPER binary format and the specified structured JSON. 12 13## Prerequisites 14 15Before building this library and its associated tools, you must have meson 16(>=1.1.1) 17 18## Building 19 20This project uses Meson (>=1.1.1). To build for native architecture, simply run: 21 22``` 23meson setup build 24ninji -C build 25``` 26 27## Usage 28 29This project comes with several binaries to help you deal with CPER binary and 30CPER-JSON. The first of these is `cper-convert`, which is a command line tool 31that can be found in `build/`. With this, you can convert to and from CPER and 32CPER-JSON through the command line. An example usage scenario is below: 33 34``` 35cper-convert to-cper samples/cper-json-test-arm.json --out cper.dump 36cper-convert to-json cper.generated.dump 37``` 38 39Another tool bundled with this repository is `cper-generate`, found in `build/`. 40This allows you to generate pseudo-random valid CPER records with sections of 41specified types for testing purposes. An example use of the program is below: 42 43``` 44cper-generate --out cper.generated.dump --sections generic ia32x64 45``` 46 47Help for both of these tools can be accessed through using the `--help` flag in 48isolation. 49 50Finally, a static library containing symbols for converting CPER and CPER-JSON 51between an intermediate JSON format can be found generated at 52`lib/libcper-parse.a`. This contains the following useful library symbols: 53 54``` 55json_object* cper_to_ir(FILE* cper_file); 56void ir_to_cper(json_object* ir, FILE* out); 57``` 58 59## Specification 60 61The specification for this project's CPER-JSON format can be found in 62`specification/`, defined in both JSON Schema format and also as a LaTeX 63document. Specification for the CPER binary format can be found in 64[UEFI Specification Appendix N](https://uefi.org/sites/default/files/resources/UEFI_Spec_2_9_2021_03_18.pdf) 65(2021/03/18). 66 67## Usage Examples 68 69This library is utilised in a proof of concept displaying CPER communication 70between a SatMC and OpenBMC board, including a conversion into CPER JSON for 71logging that utilises this library. You can find information on how to reproduce 72the prototype at the 73[scripts repository](https://gitlab.arm.com/server_management/cper-poc-scripts), 74and example usage of the library itself at the 75[pldm](https://gitlab.arm.com/server_management/pldm) repository. 76