William A. Kennington III | f19a838 | 2021-02-16 14:16:47 -0800 | [diff] [blame] | 1 | SUMMARY = "Configures ncsi for a gBMC system" |
| 2 | PR = "r1" |
| 3 | LICENSE = "Apache-2.0" |
| 4 | LIC_FILES_CHKSUM = "file://${COREBASE}/meta/files/common-licenses/Apache-2.0;md5=89aea4e17d99a7cacdbeed46a0096b10" |
| 5 | |
| 6 | inherit systemd |
| 7 | |
William A. Kennington III | 7f11d1f | 2021-02-16 14:57:41 -0800 | [diff] [blame] | 8 | SRC_URI += " \ |
William A. Kennington III | 9674509 | 2021-08-06 00:06:42 -0700 | [diff] [blame] | 9 | file://-bmc-gbmcbrncsidhcp.netdev \ |
| 10 | file://-bmc-gbmcbrncsidhcp.network \ |
| 11 | file://-bmc-gbmcncsidhcp.netdev \ |
| 12 | file://-bmc-gbmcncsidhcp.network \ |
William A. Kennington III | 7f11d1f | 2021-02-16 14:57:41 -0800 | [diff] [blame] | 13 | file://50-gbmc-ncsi.rules.in \ |
William A. Kennington III | 9674509 | 2021-08-06 00:06:42 -0700 | [diff] [blame] | 14 | file://gbmc-ncsi-dhcrelay.service.in \ |
William A. Kennington III | c7454fb | 2021-09-14 16:01:37 -0700 | [diff] [blame] | 15 | file://gbmc-ncsi-ip-from-ra.service.in \ |
| 16 | file://gbmc-ncsi-ip-from-ra.sh.in \ |
William A. Kennington III | 71fc189 | 2021-12-13 14:32:20 -0800 | [diff] [blame] | 17 | file://gbmc-ncsi-smartnic-wa.sh.in \ |
William A. Kennington III | 7f11d1f | 2021-02-16 14:57:41 -0800 | [diff] [blame] | 18 | file://gbmc-ncsi-sslh.socket.in \ |
| 19 | file://gbmc-ncsi-sslh.service \ |
William A. Kennington III | 1ef795b | 2021-03-10 18:59:12 -0800 | [diff] [blame] | 20 | file://gbmc-ncsi-nft.sh.in \ |
William A. Kennington III | e99168a | 2021-03-10 23:40:47 -0800 | [diff] [blame] | 21 | file://gbmc-ncsi-br-pub-addr.sh.in \ |
William A. Kennington III | 21e7e45 | 2021-11-05 01:31:59 -0700 | [diff] [blame] | 22 | file://gbmc-ncsi-br-deprecated-ips.sh.in \ |
Vivekanand Veeracholan | e3f3370 | 2021-06-16 15:29:15 -0700 | [diff] [blame] | 23 | file://gbmc-ncsi-set-nicenabled.service.in \ |
William A. Kennington III | e2e6674 | 2021-11-23 12:00:36 -0800 | [diff] [blame] | 24 | file://25-gbmc-ncsi-clear-ip.sh.in \ |
William A. Kennington III | 7f11d1f | 2021-02-16 14:57:41 -0800 | [diff] [blame] | 25 | " |
William A. Kennington III | f19a838 | 2021-02-16 14:16:47 -0800 | [diff] [blame] | 26 | |
| 27 | S = "${WORKDIR}" |
| 28 | |
Willy Tu | 4dd03ca | 2021-08-06 09:37:35 -0700 | [diff] [blame] | 29 | RDEPENDS:${PN} += " \ |
William A. Kennington III | b03ef8c | 2021-10-01 01:16:24 -0700 | [diff] [blame] | 30 | bash \ |
William A. Kennington III | 9674509 | 2021-08-06 00:06:42 -0700 | [diff] [blame] | 31 | dhcp-relay \ |
William A. Kennington III | 1ef795b | 2021-03-10 18:59:12 -0800 | [diff] [blame] | 32 | gbmc-ip-monitor \ |
William A. Kennington III | 7f11d1f | 2021-02-16 14:57:41 -0800 | [diff] [blame] | 33 | ncsid \ |
William A. Kennington III | 5aa84b5 | 2021-11-15 15:20:13 -0800 | [diff] [blame] | 34 | network-sh \ |
William A. Kennington III | 7f11d1f | 2021-02-16 14:57:41 -0800 | [diff] [blame] | 35 | nftables-systemd \ |
| 36 | sslh \ |
William A. Kennington III | 5aa84b5 | 2021-11-15 15:20:13 -0800 | [diff] [blame] | 37 | ndisc6-rdisc6 \ |
William A. Kennington III | 7f11d1f | 2021-02-16 14:57:41 -0800 | [diff] [blame] | 38 | " |
William A. Kennington III | f19a838 | 2021-02-16 14:16:47 -0800 | [diff] [blame] | 39 | |
Willy Tu | 4dd03ca | 2021-08-06 09:37:35 -0700 | [diff] [blame] | 40 | FILES:${PN} += " \ |
William A. Kennington III | b174c18 | 2021-11-03 14:54:51 -0700 | [diff] [blame] | 41 | ${datadir}/gbmc-br-dhcp \ |
William A. Kennington III | 1ef795b | 2021-03-10 18:59:12 -0800 | [diff] [blame] | 42 | ${datadir}/gbmc-ip-monitor \ |
| 43 | ${systemd_unitdir} \ |
| 44 | " |
William A. Kennington III | f19a838 | 2021-02-16 14:16:47 -0800 | [diff] [blame] | 45 | |
Willy Tu | 4dd03ca | 2021-08-06 09:37:35 -0700 | [diff] [blame] | 46 | SYSTEMD_SERVICE:${PN} += " \ |
William A. Kennington III | 9674509 | 2021-08-06 00:06:42 -0700 | [diff] [blame] | 47 | gbmc-ncsi-dhcrelay.service \ |
William A. Kennington III | 7f11d1f | 2021-02-16 14:57:41 -0800 | [diff] [blame] | 48 | gbmc-ncsi-sslh.service \ |
| 49 | gbmc-ncsi-sslh.socket \ |
Vivekanand Veeracholan | e3f3370 | 2021-06-16 15:29:15 -0700 | [diff] [blame] | 50 | gbmc-ncsi-set-nicenabled.service \ |
William A. Kennington III | c7454fb | 2021-09-14 16:01:37 -0700 | [diff] [blame] | 51 | gbmc-ncsi-ip-from-ra.service \ |
William A. Kennington III | 7f11d1f | 2021-02-16 14:57:41 -0800 | [diff] [blame] | 52 | " |
| 53 | |
Willy Tu | 4dd03ca | 2021-08-06 09:37:35 -0700 | [diff] [blame] | 54 | do_install:append() { |
William A. Kennington III | f19a838 | 2021-02-16 14:16:47 -0800 | [diff] [blame] | 55 | if_name='${GBMC_NCSI_IF_NAME}' |
William A. Kennington III | f19a838 | 2021-02-16 14:16:47 -0800 | [diff] [blame] | 56 | if [ -z "$if_name" ]; then |
| 57 | echo "Missing if_name" >&2 |
| 58 | exit 1 |
| 59 | fi |
| 60 | |
| 61 | install -d -m0755 ${D}${sysconfdir}/sysctl.d |
| 62 | echo "net.ipv6.conf.$if_name.accept_dad=0" \ |
| 63 | >>${D}${sysconfdir}/sysctl.d/25-gbmc-ncsi.conf |
| 64 | echo "net.ipv6.conf.$if_name.dad_transmits=0" \ |
| 65 | >>${D}${sysconfdir}/sysctl.d/25-gbmc-ncsi.conf |
| 66 | |
William A. Kennington III | 9674509 | 2021-08-06 00:06:42 -0700 | [diff] [blame] | 67 | install -d -m0755 ${D}${systemd_unitdir}/network |
| 68 | install -m0644 ${WORKDIR}/-bmc-gbmcbrncsidhcp.netdev \ |
| 69 | ${D}${systemd_unitdir}/network/ |
| 70 | install -m0644 ${WORKDIR}/-bmc-gbmcbrncsidhcp.network \ |
| 71 | ${D}${systemd_unitdir}/network/ |
| 72 | install -m0644 ${WORKDIR}/-bmc-gbmcncsidhcp.netdev \ |
| 73 | ${D}${systemd_unitdir}/network/ |
| 74 | install -m0644 ${WORKDIR}/-bmc-gbmcncsidhcp.network \ |
| 75 | ${D}${systemd_unitdir}/network/ |
| 76 | |
William A. Kennington III | f19a838 | 2021-02-16 14:16:47 -0800 | [diff] [blame] | 77 | netdir=${D}${systemd_unitdir}/network/00-bmc-$if_name.network.d |
| 78 | install -d -m0755 "$netdir" |
| 79 | echo '[Network]' >>"$netdir"/gbmc-ncsi.conf |
| 80 | echo 'DHCP=false' >>"$netdir"/gbmc-ncsi.conf |
| 81 | echo 'IPv6AcceptRA=false' >>"$netdir"/gbmc-ncsi.conf |
| 82 | echo 'LLMNR=false' >>"$netdir"/gbmc-ncsi.conf |
| 83 | echo 'MulticastDNS=false' >>"$netdir"/gbmc-ncsi.conf |
| 84 | echo 'LinkLocalAddressing=ipv6' >>"$netdir"/gbmc-ncsi.conf |
| 85 | |
| 86 | nftdir=${D}${sysconfdir}/nftables |
| 87 | install -d -m0755 "$nftdir" |
William A. Kennington III | 1ef795b | 2021-03-10 18:59:12 -0800 | [diff] [blame] | 88 | sed "s,@NCSI_IF@,$if_name,g" ${WORKDIR}/50-gbmc-ncsi.rules.in \ |
William A. Kennington III | f19a838 | 2021-02-16 14:16:47 -0800 | [diff] [blame] | 89 | >"$nftdir"/50-gbmc-ncsi.rules |
| 90 | |
| 91 | wantdir=${D}${systemd_system_unitdir}/multi-user.target.wants |
| 92 | install -d -m0755 "$wantdir" |
| 93 | ln -sv ../ncsid@.service "$wantdir"/ncsid@$if_name.service |
William A. Kennington III | 7f11d1f | 2021-02-16 14:57:41 -0800 | [diff] [blame] | 94 | |
| 95 | install -m 0644 ${WORKDIR}/gbmc-ncsi-sslh.service ${D}${systemd_system_unitdir} |
William A. Kennington III | 1ef795b | 2021-03-10 18:59:12 -0800 | [diff] [blame] | 96 | sed "s,@NCSI_IF@,$if_name,g" ${WORKDIR}/gbmc-ncsi-sslh.socket.in \ |
William A. Kennington III | 7f11d1f | 2021-02-16 14:57:41 -0800 | [diff] [blame] | 97 | >${D}${systemd_system_unitdir}/gbmc-ncsi-sslh.socket |
William A. Kennington III | 1ef795b | 2021-03-10 18:59:12 -0800 | [diff] [blame] | 98 | |
| 99 | mondir=${D}${datadir}/gbmc-ip-monitor/ |
| 100 | install -d -m0755 $mondir |
| 101 | sed "s,@NCSI_IF@,$if_name,g" ${WORKDIR}/gbmc-ncsi-nft.sh.in \ |
| 102 | >${WORKDIR}/gbmc-ncsi-nft.sh |
| 103 | install -m644 ${WORKDIR}/gbmc-ncsi-nft.sh $mondir |
William A. Kennington III | e99168a | 2021-03-10 23:40:47 -0800 | [diff] [blame] | 104 | sed "s,@NCSI_IF@,$if_name,g" ${WORKDIR}/gbmc-ncsi-br-pub-addr.sh.in \ |
| 105 | >${WORKDIR}/gbmc-ncsi-br-pub-addr.sh |
| 106 | install -m644 ${WORKDIR}/gbmc-ncsi-br-pub-addr.sh $mondir |
William A. Kennington III | 21e7e45 | 2021-11-05 01:31:59 -0700 | [diff] [blame] | 107 | sed "s,@NCSI_IF@,$if_name,g" ${WORKDIR}/gbmc-ncsi-br-deprecated-ips.sh.in \ |
| 108 | >${WORKDIR}/gbmc-ncsi-br-deprecated-ips.sh |
| 109 | install -m644 ${WORKDIR}/gbmc-ncsi-br-deprecated-ips.sh $mondir |
Vivekanand Veeracholan | e3f3370 | 2021-06-16 15:29:15 -0700 | [diff] [blame] | 110 | |
William A. Kennington III | b174c18 | 2021-11-03 14:54:51 -0700 | [diff] [blame] | 111 | dhcpdir=${D}${datadir}/gbmc-br-dhcp/ |
| 112 | install -d -m0755 $dhcpdir |
William A. Kennington III | e2e6674 | 2021-11-23 12:00:36 -0800 | [diff] [blame] | 113 | sed "s,@NCSI_IF@,$if_name,g" ${WORKDIR}/25-gbmc-ncsi-clear-ip.sh.in \ |
| 114 | >${WORKDIR}/25-gbmc-ncsi-clear-ip.sh |
| 115 | install -m644 ${WORKDIR}/25-gbmc-ncsi-clear-ip.sh $dhcpdir |
William A. Kennington III | b174c18 | 2021-11-03 14:54:51 -0700 | [diff] [blame] | 116 | |
Vivekanand Veeracholan | e3f3370 | 2021-06-16 15:29:15 -0700 | [diff] [blame] | 117 | sed "s,@NCSI_IF@,$if_name,g" ${WORKDIR}/gbmc-ncsi-set-nicenabled.service.in \ |
| 118 | >${D}${systemd_system_unitdir}/gbmc-ncsi-set-nicenabled.service |
William A. Kennington III | 9674509 | 2021-08-06 00:06:42 -0700 | [diff] [blame] | 119 | |
| 120 | sed "s,@NCSI_IF@,$if_name,g" ${WORKDIR}/gbmc-ncsi-dhcrelay.service.in \ |
| 121 | >${D}${systemd_system_unitdir}/gbmc-ncsi-dhcrelay.service |
William A. Kennington III | c7454fb | 2021-09-14 16:01:37 -0700 | [diff] [blame] | 122 | |
| 123 | sed "s,@NCSI_IF@,$if_name,g" ${WORKDIR}/gbmc-ncsi-ip-from-ra.service.in \ |
| 124 | >${WORKDIR}/gbmc-ncsi-ip-from-ra.service |
| 125 | install -m0644 ${WORKDIR}/gbmc-ncsi-ip-from-ra.service ${D}${systemd_system_unitdir} |
| 126 | sed "s,@NCSI_IF@,$if_name,g" ${WORKDIR}/gbmc-ncsi-ip-from-ra.sh.in \ |
| 127 | >${WORKDIR}/gbmc-ncsi-ip-from-ra.sh |
| 128 | install -d -m0755 ${D}${libexecdir} |
| 129 | install -m0755 ${WORKDIR}/gbmc-ncsi-ip-from-ra.sh ${D}${libexecdir}/ |
William A. Kennington III | 71fc189 | 2021-12-13 14:32:20 -0800 | [diff] [blame] | 130 | |
| 131 | sed "s,@NCSI_IF@,$if_name,g" ${WORKDIR}/gbmc-ncsi-smartnic-wa.sh.in \ |
| 132 | >${WORKDIR}/gbmc-ncsi-smartnic-wa.sh |
| 133 | install -d -m0755 ${D}${bindir} |
| 134 | install -m0755 ${WORKDIR}/gbmc-ncsi-smartnic-wa.sh ${D}${bindir}/ |
William A. Kennington III | 9674509 | 2021-08-06 00:06:42 -0700 | [diff] [blame] | 135 | } |
| 136 | |
| 137 | do_rm_work:prepend() { |
| 138 | # HACK: Work around broken do_rm_work not properly calling rm with `--` |
| 139 | # It doesn't like filenames that start with `-` |
| 140 | rm -rf -- ${WORKDIR}/-* |
William A. Kennington III | f19a838 | 2021-02-16 14:16:47 -0800 | [diff] [blame] | 141 | } |