blob: 6ca4c798b32eb79640ca5e7b0393518393227f65 [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
15RDEPENDS_${PN} += " \
16 bash \
17 ipmi-fru-sh \
18 "
19
20FILES_${PN} += "${systemd_unitdir}"
21
22SYSTEMD_SERVICE_${PN} += "gbmc-mac-config.service"
23
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
31do_install_append() {
32 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}