blob: 4ae9d1994eee9b82e21a1b2223045ad4b50bba9d [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 III7f11d1f2021-02-16 14:57:41 -080017 file://gbmc-ncsi-sslh.socket.in \
18 file://gbmc-ncsi-sslh.service \
William A. Kennington III1ef795b2021-03-10 18:59:12 -080019 file://gbmc-ncsi-nft.sh.in \
William A. Kennington IIIe99168a2021-03-10 23:40:47 -080020 file://gbmc-ncsi-br-pub-addr.sh.in \
Vivekanand Veeracholane3f33702021-06-16 15:29:15 -070021 file://gbmc-ncsi-set-nicenabled.service.in \
William A. Kennington III7f11d1f2021-02-16 14:57:41 -080022 "
William A. Kennington IIIf19a8382021-02-16 14:16:47 -080023
24S = "${WORKDIR}"
25
Willy Tu4dd03ca2021-08-06 09:37:35 -070026RDEPENDS:${PN} += " \
William A. Kennington IIIb03ef8c2021-10-01 01:16:24 -070027 bash \
William A. Kennington III96745092021-08-06 00:06:42 -070028 dhcp-relay \
William A. Kennington III1ef795b2021-03-10 18:59:12 -080029 gbmc-ip-monitor \
William A. Kennington III7f11d1f2021-02-16 14:57:41 -080030 ncsid \
31 nftables-systemd \
32 sslh \
33 "
William A. Kennington IIIf19a8382021-02-16 14:16:47 -080034
Willy Tu4dd03ca2021-08-06 09:37:35 -070035FILES:${PN} += " \
William A. Kennington III1ef795b2021-03-10 18:59:12 -080036 ${datadir}/gbmc-ip-monitor \
37 ${systemd_unitdir} \
38 "
William A. Kennington IIIf19a8382021-02-16 14:16:47 -080039
Willy Tu4dd03ca2021-08-06 09:37:35 -070040SYSTEMD_SERVICE:${PN} += " \
William A. Kennington III96745092021-08-06 00:06:42 -070041 gbmc-ncsi-dhcrelay.service \
William A. Kennington III7f11d1f2021-02-16 14:57:41 -080042 gbmc-ncsi-sslh.service \
43 gbmc-ncsi-sslh.socket \
Vivekanand Veeracholane3f33702021-06-16 15:29:15 -070044 gbmc-ncsi-set-nicenabled.service \
William A. Kennington IIIc7454fb2021-09-14 16:01:37 -070045 gbmc-ncsi-ip-from-ra.service \
William A. Kennington III7f11d1f2021-02-16 14:57:41 -080046 "
47
Willy Tu4dd03ca2021-08-06 09:37:35 -070048do_install:append() {
William A. Kennington IIIf19a8382021-02-16 14:16:47 -080049 if_name='${GBMC_NCSI_IF_NAME}'
William A. Kennington IIIf19a8382021-02-16 14:16:47 -080050 if [ -z "$if_name" ]; then
51 echo "Missing if_name" >&2
52 exit 1
53 fi
54
55 install -d -m0755 ${D}${sysconfdir}/sysctl.d
56 echo "net.ipv6.conf.$if_name.accept_dad=0" \
57 >>${D}${sysconfdir}/sysctl.d/25-gbmc-ncsi.conf
58 echo "net.ipv6.conf.$if_name.dad_transmits=0" \
59 >>${D}${sysconfdir}/sysctl.d/25-gbmc-ncsi.conf
60
William A. Kennington III96745092021-08-06 00:06:42 -070061 install -d -m0755 ${D}${systemd_unitdir}/network
62 install -m0644 ${WORKDIR}/-bmc-gbmcbrncsidhcp.netdev \
63 ${D}${systemd_unitdir}/network/
64 install -m0644 ${WORKDIR}/-bmc-gbmcbrncsidhcp.network \
65 ${D}${systemd_unitdir}/network/
66 install -m0644 ${WORKDIR}/-bmc-gbmcncsidhcp.netdev \
67 ${D}${systemd_unitdir}/network/
68 install -m0644 ${WORKDIR}/-bmc-gbmcncsidhcp.network \
69 ${D}${systemd_unitdir}/network/
70
William A. Kennington IIIf19a8382021-02-16 14:16:47 -080071 netdir=${D}${systemd_unitdir}/network/00-bmc-$if_name.network.d
72 install -d -m0755 "$netdir"
73 echo '[Network]' >>"$netdir"/gbmc-ncsi.conf
74 echo 'DHCP=false' >>"$netdir"/gbmc-ncsi.conf
75 echo 'IPv6AcceptRA=false' >>"$netdir"/gbmc-ncsi.conf
76 echo 'LLMNR=false' >>"$netdir"/gbmc-ncsi.conf
77 echo 'MulticastDNS=false' >>"$netdir"/gbmc-ncsi.conf
78 echo 'LinkLocalAddressing=ipv6' >>"$netdir"/gbmc-ncsi.conf
79
80 nftdir=${D}${sysconfdir}/nftables
81 install -d -m0755 "$nftdir"
William A. Kennington III1ef795b2021-03-10 18:59:12 -080082 sed "s,@NCSI_IF@,$if_name,g" ${WORKDIR}/50-gbmc-ncsi.rules.in \
William A. Kennington IIIf19a8382021-02-16 14:16:47 -080083 >"$nftdir"/50-gbmc-ncsi.rules
84
85 wantdir=${D}${systemd_system_unitdir}/multi-user.target.wants
86 install -d -m0755 "$wantdir"
87 ln -sv ../ncsid@.service "$wantdir"/ncsid@$if_name.service
William A. Kennington III7f11d1f2021-02-16 14:57:41 -080088
89 install -m 0644 ${WORKDIR}/gbmc-ncsi-sslh.service ${D}${systemd_system_unitdir}
William A. Kennington III1ef795b2021-03-10 18:59:12 -080090 sed "s,@NCSI_IF@,$if_name,g" ${WORKDIR}/gbmc-ncsi-sslh.socket.in \
William A. Kennington III7f11d1f2021-02-16 14:57:41 -080091 >${D}${systemd_system_unitdir}/gbmc-ncsi-sslh.socket
William A. Kennington III1ef795b2021-03-10 18:59:12 -080092
93 mondir=${D}${datadir}/gbmc-ip-monitor/
94 install -d -m0755 $mondir
95 sed "s,@NCSI_IF@,$if_name,g" ${WORKDIR}/gbmc-ncsi-nft.sh.in \
96 >${WORKDIR}/gbmc-ncsi-nft.sh
97 install -m644 ${WORKDIR}/gbmc-ncsi-nft.sh $mondir
William A. Kennington IIIe99168a2021-03-10 23:40:47 -080098 sed "s,@NCSI_IF@,$if_name,g" ${WORKDIR}/gbmc-ncsi-br-pub-addr.sh.in \
99 >${WORKDIR}/gbmc-ncsi-br-pub-addr.sh
100 install -m644 ${WORKDIR}/gbmc-ncsi-br-pub-addr.sh $mondir
Vivekanand Veeracholane3f33702021-06-16 15:29:15 -0700101
102 sed "s,@NCSI_IF@,$if_name,g" ${WORKDIR}/gbmc-ncsi-set-nicenabled.service.in \
103 >${D}${systemd_system_unitdir}/gbmc-ncsi-set-nicenabled.service
William A. Kennington III96745092021-08-06 00:06:42 -0700104
105 sed "s,@NCSI_IF@,$if_name,g" ${WORKDIR}/gbmc-ncsi-dhcrelay.service.in \
106 >${D}${systemd_system_unitdir}/gbmc-ncsi-dhcrelay.service
William A. Kennington IIIc7454fb2021-09-14 16:01:37 -0700107
108 sed "s,@NCSI_IF@,$if_name,g" ${WORKDIR}/gbmc-ncsi-ip-from-ra.service.in \
109 >${WORKDIR}/gbmc-ncsi-ip-from-ra.service
110 install -m0644 ${WORKDIR}/gbmc-ncsi-ip-from-ra.service ${D}${systemd_system_unitdir}
111 sed "s,@NCSI_IF@,$if_name,g" ${WORKDIR}/gbmc-ncsi-ip-from-ra.sh.in \
112 >${WORKDIR}/gbmc-ncsi-ip-from-ra.sh
113 install -d -m0755 ${D}${libexecdir}
114 install -m0755 ${WORKDIR}/gbmc-ncsi-ip-from-ra.sh ${D}${libexecdir}/
William A. Kennington III96745092021-08-06 00:06:42 -0700115}
116
117do_rm_work:prepend() {
118 # HACK: Work around broken do_rm_work not properly calling rm with `--`
119 # It doesn't like filenames that start with `-`
120 rm -rf -- ${WORKDIR}/-*
William A. Kennington IIIf19a8382021-02-16 14:16:47 -0800121}