xref: /openbmc/libcper/README.md (revision d34f2b11)
1# CPER JSON Representation & Conversion Library
2This repository specifies a structure for representing UEFI CPER records (as described in UEFI Specification Appendix N) in a human-readable JSON format, in addition to a library which can readily convert back and forth between the standard CPER binary format and the specified structured JSON.
3
4## Building
5This project uses CMake (>=3.10). To build, simply run:
6```
7cmake .
8make
9```
10A static library file for the parsing library will be written to `lib/`, and test executables will be written to `bin/`.
11
12## Usage
13This project comes with several binaries to help you deal with CPER binary and CPER-JSON. The first of these is `cper-convert`, which is a command line tool that can be found in `bin/`. With this, you can convert to and from CPER and CPER-JSON through the command line. An example usage scenario is below:
14```
15cper-convert to-cper samples/cper-json-test-arm.json --out cper.dump
16cper-convert to-json cper.generated.dump
17```
18Another tool bundled with this repository is `cper-generate`, which is another command line tool found in `bin/`. This allows you to generate psuedo-random valid CPER records with sections of specified types for testing purposes. An example use of the program is below:
19```
20cper-generate --out cper.generated.dump --sections generic ia32x64
21```
22Help for both of these tools can be accessed through using the `--help` flag in isolation.
23
24Finally, a static library containing symbols for converting CPER and CPER-JSON between an intermediate JSON format can be found generated in `lib/`. This contains the following useful library symbols:
25```
26json_object* cper_to_ir(FILE* cper_file);
27void ir_to_cper(json_object* ir, FILE* out);
28```
29
30## Specification
31The specification for this project can be found in `specification/`.
32Specification for the CPER binary format can be found in [UEFI Specification Appendix N](https://uefi.org/sites/default/files/resources/UEFI_Spec_2_9_2021_03_18.pdf) (2021/03/18).
33
34### Remaining Task List
35- Add readable versions of the IA32/x64 processor info type GUIDs, updating specification & both conversions.
36- Add remaining `cper-generate` sections for testing purposes.
37- Add a top-level "specification" object which indicates which version/revision of the specification the JSON is using.