Willy Tu | 4dd03ca | 2021-08-06 09:37:35 -0700 | [diff] [blame] | 1 | FILESEXTRAPATHS:prepend:gbmc := "${THISDIR}/${PN}:" |
William A. Kennington III | 97b47e0 | 2021-07-15 16:23:01 -0700 | [diff] [blame] | 2 | |
Tom Tung | 4d433a4 | 2022-03-31 15:16:41 +0800 | [diff] [blame^] | 3 | SRC_URI:append:gbmc = " \ |
| 4 | file://gbmc_bridge_config.json \ |
| 5 | file://gbmc_bridge_access.json \ |
| 6 | " |
William A. Kennington III | 97b47e0 | 2021-07-15 16:23:01 -0700 | [diff] [blame] | 7 | |
Willy Tu | 4dd03ca | 2021-08-06 09:37:35 -0700 | [diff] [blame] | 8 | DEPENDS:append:gbmc = " jq-native" |
William A. Kennington III | 97b47e0 | 2021-07-15 16:23:01 -0700 | [diff] [blame] | 9 | |
| 10 | GBMCBR_IPMI_CHANNEL ?= "11" |
| 11 | |
Willy Tu | 1da8306 | 2022-04-07 23:48:56 -0700 | [diff] [blame] | 12 | ENTITY_MAPPING ?= "default" |
| 13 | |
William A. Kennington III | 97b47e0 | 2021-07-15 16:23:01 -0700 | [diff] [blame] | 14 | # Replace a channel in config.json to add gbmcbr reporting |
Willy Tu | 4dd03ca | 2021-08-06 09:37:35 -0700 | [diff] [blame] | 15 | do_install:append:gbmc() { |
Tom Tung | 4d433a4 | 2022-03-31 15:16:41 +0800 | [diff] [blame^] | 16 | config_json=${D}${datadir}/ipmi-providers/channel_config.json |
| 17 | overlapping="$(jq '."${GBMCBR_IPMI_CHANNEL}" | .is_valid and .name != "gbmcbr"' $config_json)" |
William A. Kennington III | 97b47e0 | 2021-07-15 16:23:01 -0700 | [diff] [blame] | 18 | if [ "$overlapping" != "false" ]; then |
| 19 | echo "gBMC channel config overlaps on ${GBMCBR_IPMI_CHANNEL}" >&2 |
Tom Tung | 4d433a4 | 2022-03-31 15:16:41 +0800 | [diff] [blame^] | 20 | cat $config_json |
William A. Kennington III | 97b47e0 | 2021-07-15 16:23:01 -0700 | [diff] [blame] | 21 | exit 1 |
| 22 | fi |
Tom Tung | 4d433a4 | 2022-03-31 15:16:41 +0800 | [diff] [blame^] | 23 | jq --slurpfile brcfg ${WORKDIR}/gbmc_bridge_config.json \ |
| 24 | '. + {"${GBMCBR_IPMI_CHANNEL}": $brcfg[0]}' $config_json >${WORKDIR}/tmp |
| 25 | mv ${WORKDIR}/tmp $config_json |
| 26 | |
| 27 | access_json=${D}${datadir}/ipmi-providers/channel_access.json |
| 28 | overlapping="$(jq '."${GBMCBR_IPMI_CHANNEL}" | .access_mode and .access_mode != "always_available"' $access_json)" |
| 29 | if [ "$overlapping" != "false" ]; then |
| 30 | echo "gBMC channel access overlaps on ${GBMCBR_IPMI_CHANNEL}" >&2 |
| 31 | cat $access_json |
| 32 | exit 1 |
| 33 | fi |
| 34 | jq --slurpfile brcfg ${WORKDIR}/gbmc_bridge_access.json \ |
| 35 | '. + {"${GBMCBR_IPMI_CHANNEL}": $brcfg[0]}' $access_json >${WORKDIR}/tmp |
| 36 | mv ${WORKDIR}/tmp $access_json |
Willy Tu | c93f10b | 2022-03-28 11:18:53 -0700 | [diff] [blame] | 37 | |
| 38 | # Set entity-map.json to empty json for gBMC by default. |
| 39 | # Each system will override it if needed. |
Willy Tu | 1da8306 | 2022-04-07 23:48:56 -0700 | [diff] [blame] | 40 | if [[ "${ENTITY_MAPPING}" != "default" ]]; then |
| 41 | echo "[]" > ${D}${datadir}/ipmi-providers/entity-map.json |
| 42 | fi |
William A. Kennington III | 97b47e0 | 2021-07-15 16:23:01 -0700 | [diff] [blame] | 43 | } |