blob: 3ae1c72980cd3f99e747a9bc0e2db92fcef605b1 [file] [log] [blame]
William A. Kennington IIIf19a8382021-02-16 14:16:47 -08001SUMMARY = "Configures ncsi for 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
William A. Kennington III7f11d1f2021-02-16 14:57:41 -08008SRC_URI += " \
William A. Kennington III96745092021-08-06 00:06:42 -07009 file://-bmc-gbmcbrncsidhcp.netdev \
10 file://-bmc-gbmcbrncsidhcp.network \
11 file://-bmc-gbmcncsidhcp.netdev \
12 file://-bmc-gbmcncsidhcp.network \
William A. Kennington III7f11d1f2021-02-16 14:57:41 -080013 file://50-gbmc-ncsi.rules.in \
William A. Kennington III96745092021-08-06 00:06:42 -070014 file://gbmc-ncsi-dhcrelay.service.in \
William A. Kennington IIIc7454fb2021-09-14 16:01:37 -070015 file://gbmc-ncsi-ip-from-ra.service.in \
16 file://gbmc-ncsi-ip-from-ra.sh.in \
William A. Kennington III71fc1892021-12-13 14:32:20 -080017 file://gbmc-ncsi-smartnic-wa.sh.in \
William A. Kennington III7f11d1f2021-02-16 14:57:41 -080018 file://gbmc-ncsi-sslh.socket.in \
19 file://gbmc-ncsi-sslh.service \
William A. Kennington III1ef795b2021-03-10 18:59:12 -080020 file://gbmc-ncsi-nft.sh.in \
William A. Kennington IIIe99168a2021-03-10 23:40:47 -080021 file://gbmc-ncsi-br-pub-addr.sh.in \
William A. Kennington III21e7e452021-11-05 01:31:59 -070022 file://gbmc-ncsi-br-deprecated-ips.sh.in \
Vivekanand Veeracholane3f33702021-06-16 15:29:15 -070023 file://gbmc-ncsi-set-nicenabled.service.in \
William A. Kennington III9f57cee2022-11-03 14:17:35 -070024 file://gbmc-ncsi-alias.service.in \
William A. Kennington III37e6f392022-05-16 16:19:11 -070025 file://50-gbmc-ncsi-clear-ip.sh.in \
William A. Kennington III7f11d1f2021-02-16 14:57:41 -080026 "
William A. Kennington IIIf19a8382021-02-16 14:16:47 -080027
28S = "${WORKDIR}"
29
Willy Tu4dd03ca2021-08-06 09:37:35 -070030RDEPENDS:${PN} += " \
William A. Kennington IIIb03ef8c2021-10-01 01:16:24 -070031 bash \
William A. Kennington III96745092021-08-06 00:06:42 -070032 dhcp-relay \
William A. Kennington III1ef795b2021-03-10 18:59:12 -080033 gbmc-ip-monitor \
William A. Kennington III7f11d1f2021-02-16 14:57:41 -080034 ncsid \
William A. Kennington III5aa84b52021-11-15 15:20:13 -080035 network-sh \
William A. Kennington III7f11d1f2021-02-16 14:57:41 -080036 nftables-systemd \
37 sslh \
William A. Kennington III5aa84b52021-11-15 15:20:13 -080038 ndisc6-rdisc6 \
William A. Kennington III7f11d1f2021-02-16 14:57:41 -080039 "
William A. Kennington IIIf19a8382021-02-16 14:16:47 -080040
Willy Tu4dd03ca2021-08-06 09:37:35 -070041FILES:${PN} += " \
William A. Kennington III37e6f392022-05-16 16:19:11 -070042 ${datadir}/gbmc-br-lib \
William A. Kennington III1ef795b2021-03-10 18:59:12 -080043 ${datadir}/gbmc-ip-monitor \
44 ${systemd_unitdir} \
45 "
William A. Kennington IIIf19a8382021-02-16 14:16:47 -080046
Willy Tu4dd03ca2021-08-06 09:37:35 -070047SYSTEMD_SERVICE:${PN} += " \
William A. Kennington III96745092021-08-06 00:06:42 -070048 gbmc-ncsi-dhcrelay.service \
William A. Kennington III7f11d1f2021-02-16 14:57:41 -080049 gbmc-ncsi-sslh.service \
50 gbmc-ncsi-sslh.socket \
Vivekanand Veeracholane3f33702021-06-16 15:29:15 -070051 gbmc-ncsi-set-nicenabled.service \
William A. Kennington IIIc7454fb2021-09-14 16:01:37 -070052 gbmc-ncsi-ip-from-ra.service \
William A. Kennington III7f11d1f2021-02-16 14:57:41 -080053 "
54
Willy Tu4dd03ca2021-08-06 09:37:35 -070055do_install:append() {
William A. Kennington IIIf19a8382021-02-16 14:16:47 -080056 if_name='${GBMC_NCSI_IF_NAME}'
William A. Kennington IIIf19a8382021-02-16 14:16:47 -080057 if [ -z "$if_name" ]; then
58 echo "Missing if_name" >&2
59 exit 1
60 fi
61
62 install -d -m0755 ${D}${sysconfdir}/sysctl.d
63 echo "net.ipv6.conf.$if_name.accept_dad=0" \
64 >>${D}${sysconfdir}/sysctl.d/25-gbmc-ncsi.conf
65 echo "net.ipv6.conf.$if_name.dad_transmits=0" \
66 >>${D}${sysconfdir}/sysctl.d/25-gbmc-ncsi.conf
67
William A. Kennington III96745092021-08-06 00:06:42 -070068 install -d -m0755 ${D}${systemd_unitdir}/network
69 install -m0644 ${WORKDIR}/-bmc-gbmcbrncsidhcp.netdev \
70 ${D}${systemd_unitdir}/network/
71 install -m0644 ${WORKDIR}/-bmc-gbmcbrncsidhcp.network \
72 ${D}${systemd_unitdir}/network/
73 install -m0644 ${WORKDIR}/-bmc-gbmcncsidhcp.netdev \
74 ${D}${systemd_unitdir}/network/
75 install -m0644 ${WORKDIR}/-bmc-gbmcncsidhcp.network \
76 ${D}${systemd_unitdir}/network/
77
William A. Kennington IIIf19a8382021-02-16 14:16:47 -080078 netdir=${D}${systemd_unitdir}/network/00-bmc-$if_name.network.d
79 install -d -m0755 "$netdir"
80 echo '[Network]' >>"$netdir"/gbmc-ncsi.conf
81 echo 'DHCP=false' >>"$netdir"/gbmc-ncsi.conf
82 echo 'IPv6AcceptRA=false' >>"$netdir"/gbmc-ncsi.conf
83 echo 'LLMNR=false' >>"$netdir"/gbmc-ncsi.conf
84 echo 'MulticastDNS=false' >>"$netdir"/gbmc-ncsi.conf
85 echo 'LinkLocalAddressing=ipv6' >>"$netdir"/gbmc-ncsi.conf
86
87 nftdir=${D}${sysconfdir}/nftables
88 install -d -m0755 "$nftdir"
William A. Kennington III1ef795b2021-03-10 18:59:12 -080089 sed "s,@NCSI_IF@,$if_name,g" ${WORKDIR}/50-gbmc-ncsi.rules.in \
William A. Kennington IIIf19a8382021-02-16 14:16:47 -080090 >"$nftdir"/50-gbmc-ncsi.rules
91
92 wantdir=${D}${systemd_system_unitdir}/multi-user.target.wants
93 install -d -m0755 "$wantdir"
94 ln -sv ../ncsid@.service "$wantdir"/ncsid@$if_name.service
William A. Kennington III7f11d1f2021-02-16 14:57:41 -080095
William A. Kennington III9f57cee2022-11-03 14:17:35 -070096 sed "s,@NCSI_IF@,$if_name,g" ${WORKDIR}/gbmc-ncsi-alias.service.in \
97 >${D}${systemd_system_unitdir}/gbmc-ncsi-alias.service
98 install -d -m0755 "${D}${systemd_system_unitdir}/nic-hostless@$if_name.target.wants"
99 ln -sv ../gbmc-ncsi-alias.service "${D}${systemd_system_unitdir}/nic-hostless@$if_name.target.wants"/
100 install -d -m0755 "${D}${systemd_system_unitdir}/nic-hostful@$if_name.target.wants"
101 ln -sv ../gbmc-ncsi-alias.service "${D}${systemd_system_unitdir}/nic-hostful@$if_name.target.wants"/
102
William A. Kennington III7f11d1f2021-02-16 14:57:41 -0800103 install -m 0644 ${WORKDIR}/gbmc-ncsi-sslh.service ${D}${systemd_system_unitdir}
William A. Kennington III1ef795b2021-03-10 18:59:12 -0800104 sed "s,@NCSI_IF@,$if_name,g" ${WORKDIR}/gbmc-ncsi-sslh.socket.in \
William A. Kennington III7f11d1f2021-02-16 14:57:41 -0800105 >${D}${systemd_system_unitdir}/gbmc-ncsi-sslh.socket
William A. Kennington III1ef795b2021-03-10 18:59:12 -0800106
107 mondir=${D}${datadir}/gbmc-ip-monitor/
108 install -d -m0755 $mondir
109 sed "s,@NCSI_IF@,$if_name,g" ${WORKDIR}/gbmc-ncsi-nft.sh.in \
110 >${WORKDIR}/gbmc-ncsi-nft.sh
111 install -m644 ${WORKDIR}/gbmc-ncsi-nft.sh $mondir
William A. Kennington IIIe99168a2021-03-10 23:40:47 -0800112 sed "s,@NCSI_IF@,$if_name,g" ${WORKDIR}/gbmc-ncsi-br-pub-addr.sh.in \
113 >${WORKDIR}/gbmc-ncsi-br-pub-addr.sh
114 install -m644 ${WORKDIR}/gbmc-ncsi-br-pub-addr.sh $mondir
William A. Kennington III21e7e452021-11-05 01:31:59 -0700115 sed "s,@NCSI_IF@,$if_name,g" ${WORKDIR}/gbmc-ncsi-br-deprecated-ips.sh.in \
116 >${WORKDIR}/gbmc-ncsi-br-deprecated-ips.sh
117 install -m644 ${WORKDIR}/gbmc-ncsi-br-deprecated-ips.sh $mondir
Vivekanand Veeracholane3f33702021-06-16 15:29:15 -0700118
William A. Kennington III37e6f392022-05-16 16:19:11 -0700119 brlibdir=${D}${datadir}/gbmc-br-lib/
120 install -d -m0755 $brlibdir
121 sed "s,@NCSI_IF@,$if_name,g" ${WORKDIR}/50-gbmc-ncsi-clear-ip.sh.in \
122 >${WORKDIR}/50-gbmc-ncsi-clear-ip.sh
123 install -m644 ${WORKDIR}/50-gbmc-ncsi-clear-ip.sh $brlibdir
William A. Kennington IIIb174c182021-11-03 14:54:51 -0700124
Vivekanand Veeracholane3f33702021-06-16 15:29:15 -0700125 sed "s,@NCSI_IF@,$if_name,g" ${WORKDIR}/gbmc-ncsi-set-nicenabled.service.in \
126 >${D}${systemd_system_unitdir}/gbmc-ncsi-set-nicenabled.service
William A. Kennington III96745092021-08-06 00:06:42 -0700127
128 sed "s,@NCSI_IF@,$if_name,g" ${WORKDIR}/gbmc-ncsi-dhcrelay.service.in \
129 >${D}${systemd_system_unitdir}/gbmc-ncsi-dhcrelay.service
William A. Kennington IIIc7454fb2021-09-14 16:01:37 -0700130
131 sed "s,@NCSI_IF@,$if_name,g" ${WORKDIR}/gbmc-ncsi-ip-from-ra.service.in \
132 >${WORKDIR}/gbmc-ncsi-ip-from-ra.service
133 install -m0644 ${WORKDIR}/gbmc-ncsi-ip-from-ra.service ${D}${systemd_system_unitdir}
134 sed "s,@NCSI_IF@,$if_name,g" ${WORKDIR}/gbmc-ncsi-ip-from-ra.sh.in \
135 >${WORKDIR}/gbmc-ncsi-ip-from-ra.sh
136 install -d -m0755 ${D}${libexecdir}
137 install -m0755 ${WORKDIR}/gbmc-ncsi-ip-from-ra.sh ${D}${libexecdir}/
William A. Kennington III71fc1892021-12-13 14:32:20 -0800138
139 sed "s,@NCSI_IF@,$if_name,g" ${WORKDIR}/gbmc-ncsi-smartnic-wa.sh.in \
140 >${WORKDIR}/gbmc-ncsi-smartnic-wa.sh
141 install -d -m0755 ${D}${bindir}
142 install -m0755 ${WORKDIR}/gbmc-ncsi-smartnic-wa.sh ${D}${bindir}/
William A. Kennington III96745092021-08-06 00:06:42 -0700143}
144
145do_rm_work:prepend() {
146 # HACK: Work around broken do_rm_work not properly calling rm with `--`
147 # It doesn't like filenames that start with `-`
148 rm -rf -- ${WORKDIR}/-*
William A. Kennington IIIf19a8382021-02-16 14:16:47 -0800149}