Recover host devtree file if corrupted

This commit addresses the issue where device tree file corruption could
lead to the failure of the BMC to boot up. Corruption of the file may
occur during a kernel panic. In such instances, recovery of the previous
uncorrupted version of the file from the available read-only version is
now implemented.

A PEL is generated indicating the same and the BMC dump is generated.

Tested and working as expected.

```
peltool -i 0x50001C86
{
"Private Header": {
    "Section Version":          "1",
    "Sub-section type":         "0",
    "Created by":               "bmc code management",
    "Created at":               "04/22/2024 08:37:41",
    "Committed at":             "04/22/2024 08:37:41",
    "Creator Subsystem":        "BMC",
    "CSSVER":                   "",
    "Platform Log Id":          "0x50001C86",
    "Entry Id":                 "0x50001C86",
    "BMC Event Log Id":         "127"
},
"User Header": {
    "Section Version":          "1",
    "Sub-section type":         "0",
    "Log Committed by":         "bmc error logging",
    "Subsystem":                "BMC Firmware",
    "Event Scope":              "Entire Platform",
    "Event Severity":           "Unrecoverable Error",
    "Event Type":               "Not Applicable",
    "Action Flags": [
                                "Service Action Required",
                                "Report Externally",
                                "HMC Call Home"
    ],
    "Host Transmission":        "Not Sent",
    "HMC Transmission":         "Acked"
},
"Primary SRC": {
    "Section Version":          "1",
    "Sub-section type":         "1",
    "Created by":               "bmc code management",
    "SRC Version":              "0x02",
    "SRC Format":               "0x55",
    "Virtual Progress SRC":     "False",
    "I5/OS Service Event Bit":  "False",
    "Hypervisor Dump Initiated":"False",
    "Backplane CCIN":           "2E2D",
    "Terminate FW Error":       "False",
    "Deconfigured":             "False",
    "Guarded":                  "False",
    "Error Details": {
        "Message":              "Partition was not preserved
        on reboot",
        "CURRENT_FILE_SIZE": [
                                "0x100000",
                                "Size of the current running
                                partition"
        ],
        "EXPECTED_FILE_SIZE": [
                                "0x65000",
                                "Size of the read only partition"
        ]
    },
    "Valid Word Count":         "0x09",
    "Reference Code":           "BD8D360A",
    "Hex Word 2":               "00080055",
    "Hex Word 3":               "2E2D0010",
    "Hex Word 4":               "00000000",
    "Hex Word 5":               "00000000",
    "Hex Word 6":               "00100000",
    "Hex Word 7":               "00065000",
    "Hex Word 8":               "00000000",
    "Hex Word 9":               "00000000",
    "Callout Section": {
        "Callout Count":        "1",
        "Callouts": [{
            "FRU Type":         "Maintenance Procedure Required",
            "Priority":         "Mandatory, replace all with this
            type as a unit",
            "Procedure":        "BMC0001"
        }]
    }
},
"Extended User Header": {
    "Section Version":          "1",
    "Sub-section type":         "0",
    "Created by":               "bmc error logging",
    "Reporting Machine Type":   "9105-22B",
    "Reporting Serial Number":  "139F210",
    "FW Released Ver":          "",
    "FW SubSys Version":        "fw1060.00-7",
    "Common Ref Time":          "00/00/0000 00:00:00",
    "Symptom Id Len":           "20",
    "Symptom Id":               "BD8D360A_2E2D0010"
},
"Failing MTMS": {
    "Section Version":          "1",
    "Sub-section type":         "0",
    "Created by":               "bmc error logging",
    "Machine Type Model":       "9105-22B",
    "Serial Number":            "139F210"
},
"User Data 0": {
    "Section Version": "1",
    "Sub-section type": "1",
    "Created by": "bmc error logging",
    "BMCLoad": "1.35 1.02 0.76",
    "BMCState": "Ready",
    "BMCUptime": "0y 2d 13h 38m 12s",
    "BootState": "Unspecified",
    "ChassisState": "Off",
    "FW Version ID": "fw1060.00-7-2-g4d0fcde41f",
    "HostState": "Off",
    "System IM": "50001001"
},
"User Data 1": {
    "Section Version": "1",
    "Sub-section type": "1",
    "Created by": "bmc error logging",
    "CURRENT_FILE_SIZE": "1048576",
    "EXPECTED_FILE_SIZE": "413696",
    "FILE_NAME": "81e00672.lid"
}
}
```

Change-Id: I2ce9c7a471f6e1ba43ac5b061a62e27cfd61da23
Signed-off-by: deepakala-k <deepakala.karthikeyan@ibm.com>
3 files changed
tree: 8d1e91b3d47a9eaa90254d16a38a0f2fcdc35b68
  1. dbus/
  2. mmc/
  3. static/
  4. test/
  5. ubi/
  6. vpnor/
  7. .clang-format
  8. .gitignore
  9. .shellcheck
  10. activation.cpp
  11. activation.hpp
  12. functions.cpp
  13. functions.hpp
  14. generate-tar
  15. generate-ubi
  16. image_verify.cpp
  17. image_verify.hpp
  18. item_updater.cpp
  19. item_updater.hpp
  20. item_updater_main.cpp
  21. LICENSE
  22. meson.build
  23. meson.options
  24. msl_verify.cpp
  25. msl_verify.hpp
  26. msl_verify_main.cpp
  27. op-pnor-msl.service
  28. openpower-pnor-update@.service
  29. org.open_power.Software.Host.Updater.service
  30. OWNERS
  31. README.md
  32. utils.cpp
  33. utils.hpp
  34. version.cpp
  35. version.hpp
README.md

openpower-pnor-code-mgmt

OpenPower PNOR (Processor NOR) Code Management provides a set of host software management applications for OpenPower systems. The host firmware is stored on the PNOR chip. More information can be found at Software Architecture or Host Code Update

To Build

To build this package, do the following steps:

  1. meson build
  2. ninja -C build

To clean the repository run rm -r build.