blob: 7a3781d1fe0f6e487e06c3ee354ccb72e882ea42 [file] [log] [blame]
William A. Kennington III3b3c40f2021-03-04 22:56:26 -08001SUMMARY = "Configures MAC addresses on a gBMC system"
2PR = "r1"
3LICENSE = "Apache-2.0"
4LIC_FILES_CHKSUM = "file://${COREBASE}/meta/files/common-licenses/Apache-2.0;md5=89aea4e17d99a7cacdbeed46a0096b10"
5
6inherit systemd
7
8SRC_URI += " \
9 file://gbmc-mac-config.service \
10 file://gbmc-mac-config.sh.in \
11 "
12
13S = "${WORKDIR}"
14
Willy Tu4dd03ca2021-08-06 09:37:35 -070015RDEPENDS:${PN} += " \
William A. Kennington III3b3c40f2021-03-04 22:56:26 -080016 bash \
17 ipmi-fru-sh \
18 "
19
Willy Tu4dd03ca2021-08-06 09:37:35 -070020FILES:${PN} += "${systemd_unitdir}"
William A. Kennington III3b3c40f2021-03-04 22:56:26 -080021
Willy Tu4dd03ca2021-08-06 09:37:35 -070022SYSTEMD_SERVICE:${PN} += "gbmc-mac-config.service"
William A. Kennington III3b3c40f2021-03-04 22:56:26 -080023
24GBMC_MAC_EEPROM_OF_NAME ?= ""
25
26# Maps the MAC address offset from the base address to an interface name
27# in bash associative array syntax.
28# Ex. "[0]=eth0 [2]=eth2"
29GBMC_MAC_IF_MAP ?= ""
30
Willy Tu4dd03ca2021-08-06 09:37:35 -070031do_install:append() {
William A. Kennington III3b3c40f2021-03-04 22:56:26 -080032 if [ -z '${GBMC_MAC_EEPROM_OF_NAME}' ]; then
33 echo 'Missing GBMC_MAC_EEPROM_OF_NAME' >&2
34 exit 1
35 fi
36
37 # Build time dictionary sanity check
38 bash -c 'declare -A dict=(${GBMC_MAC_IF_MAP})'
39
40 sed gbmc-mac-config.sh.in \
41 -e 's#@EEPROM@#${GBMC_MAC_EEPROM_OF_NAME}#' \
42 -e 's#@NUM_TO_IF@#${GBMC_MAC_IF_MAP}#' \
43 >gbmc-mac-config.sh
44
45 install -d -m0755 ${D}${libexecdir}
46 install -m0755 gbmc-mac-config.sh ${D}${libexecdir}/
47
48 install -d -m0755 ${D}${systemd_system_unitdir}
49 install -m0644 gbmc-mac-config.service ${D}${systemd_system_unitdir}/
50}