mctp-controller-init: add i2c bus config
At the moment, the config for add i2c bug is done in
${machine}-mctp-i2c-bus-config.bb. It would be easier to ensure the i2c
bus be config here and make it fail to build if it's not.
Also, remove some configs don't take any effect.
Tested:
- building mctp-controller-init for my system without overriding:
```
| DEBUG: Executing shell function do_install
| Missing GBMC_MCTP_BUSES
```
- building mctp-controller-init for my system with go/gbmcl/156051:
```
cat tmp/work/*/mctp-controller-init/*/package/usr/share/mctp/i2c-bus-config.sh
bus="1 2 3 4 5 6 7 8 9"
```
Google-Bug-Id: 299414396
Signed-off-by: Tom Tung <tomtung@google.com>
Change-Id: I26f9d848ece69096ce8b1a155c3b3ea2ea36be6e
(cherry picked from commit d6196b85f18c1028f7855a424e54c6368cf979e3)
diff --git a/recipes-connectivity/mctp-controller-init/mctp-controller-init.bb b/recipes-connectivity/mctp-controller-init/mctp-controller-init.bb
index 1920bc5..8f8011a 100644
--- a/recipes-connectivity/mctp-controller-init/mctp-controller-init.bb
+++ b/recipes-connectivity/mctp-controller-init/mctp-controller-init.bb
@@ -8,7 +8,6 @@
inherit systemd
-FILESEXTRAPATHS:append := "${THISDIR}/${PN}:"
SRC_URI = " \
file://mctp-controller-init.sh \
file://mctp-controller-init.service \
@@ -18,9 +17,21 @@
RDEPENDS:${PN} += " \
bash \
mctp \
- "
+"
+FILES:${PN} += "${datadir}/mctp"
+
+# For listing all PE i2c bus number.
+GBMC_MCTP_I2C_BUSES ?= ""
do_install() {
+ if [ -z '${GBMC_MCTP_I2C_BUSES}' ]; then
+ echo 'Missing GBMC_MCTP_I2C_BUSES' >&2
+ exit 1
+ fi
+
+ install -d ${D}${datadir}/mctp
+ echo 'bus="${GBMC_MCTP_I2C_BUSES}"' >${D}${datadir}/mctp/i2c-bus-config.sh
+
install -d ${D}${bindir}
install -m 0755 ${WORKDIR}/mctp-controller-init.sh ${D}${bindir}/