1# phosphor-psu-code-mgmt 2 3phosphor-psu-code-mgmt is a service to provide management for PSU code, 4including: 5 6* PSU code version 7* PSU code update 8 9 10## Building 11 12``` 13meson build/ && ninja -C build 14``` 15 16## Unit test 17 18* Run it in OpenBMC CI, refer to [local-ci-build.md][1] 19* Run it in [OE SDK][2], run below commands in a x86-64 SDK env: 20 ``` 21 meson -Doe-sdk=enabled -Dtests=enabled build/ 22 ninja -C build/ test # Meson skips running the case due to it thinks it's cross compiling 23 # Manually run the tests 24 for t in `find build/test/ -maxdepth 1 -name "test_*"`; do ./$t || break ; done 25 ``` 26 27## Vendor-specific tools 28 29This repo contains generic code to handle the PSU versions and 30updates. It depends on vendor-specific tools to provide the below 31functions on the real PSU hardware: 32* Get PSU firmware version 33* Compare the firmware version 34* Update the PSU firmware 35 36It provides configure options for vendor-specific tools for the above functions: 37* `PSU_VERSION_UTIL`: It shall be defined as a command-line tool that 38accepts the PSU inventory path as input, and outputs the PSU version 39string to stdout. 40* `PSU_VERSION_COMPARE_UTIL`: It shall be defined as a command-line 41tool that accepts one or more PSU version strings, and outputs the 42latest version string to stdout. 43* `PSU_UPDATE_SERVICE`: It shall be defined as a systemd service that 44accepts two arguments: 45 * The PSU inventory DBus object; 46 * The path of the PSU image(s). 47 48For example: 49``` 50meson -Dtests=disabled \ 51 '-DPSU_VERSION_UTIL=/usr/bin/psutils --raw --get-version' \ 52 '-DPSU_VERSION_COMPARE_UTIL=/usr/bin/psutils --raw --compare' \ 53 '-DPSU_UPDATE_SERVICE=psu-update@.service' \ 54 build 55``` 56 57The above configures the vendor-specific tools to use `psutils` from 58[phosphor-power][3] to get and compare the PSU versions, and use 59`psu-update@.service` to perform the PSU firmware update, where 60internally it invokes `psutils` as well. 61 62[1]: https://github.com/openbmc/docs/blob/master/testing/local-ci-build.md 63[2]: https://github.com/openbmc/docs/blob/master/cheatsheet.md#building-the-openbmc-sdk 64[3]: https://github.com/openbmc/phosphor-power/tree/master/tools/power-utils 65