blob: b833810f15e88197c111a8dc6290631e42dd80c1 [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 += " \
9 file://50-gbmc-ncsi.rules.in \
10 file://gbmc-ncsi-sslh.socket.in \
11 file://gbmc-ncsi-sslh.service \
William A. Kennington III1ef795b2021-03-10 18:59:12 -080012 file://gbmc-ncsi-nft.sh.in \
William A. Kennington III7f11d1f2021-02-16 14:57:41 -080013 "
William A. Kennington IIIf19a8382021-02-16 14:16:47 -080014
15S = "${WORKDIR}"
16
William A. Kennington III7f11d1f2021-02-16 14:57:41 -080017RDEPENDS_${PN} += " \
William A. Kennington III1ef795b2021-03-10 18:59:12 -080018 gbmc-ip-monitor \
William A. Kennington III7f11d1f2021-02-16 14:57:41 -080019 ncsid \
20 nftables-systemd \
21 sslh \
22 "
William A. Kennington IIIf19a8382021-02-16 14:16:47 -080023
William A. Kennington III1ef795b2021-03-10 18:59:12 -080024FILES_${PN} += " \
25 ${datadir}/gbmc-ip-monitor \
26 ${systemd_unitdir} \
27 "
William A. Kennington IIIf19a8382021-02-16 14:16:47 -080028
William A. Kennington III7f11d1f2021-02-16 14:57:41 -080029SYSTEMD_SERVICE_${PN} += " \
30 gbmc-ncsi-sslh.service \
31 gbmc-ncsi-sslh.socket \
32 "
33
William A. Kennington IIIf19a8382021-02-16 14:16:47 -080034do_install_append() {
35 if_name='${GBMC_NCSI_IF_NAME}'
William A. Kennington IIIf19a8382021-02-16 14:16:47 -080036 if [ -z "$if_name" ]; then
37 echo "Missing if_name" >&2
38 exit 1
39 fi
40
41 install -d -m0755 ${D}${sysconfdir}/sysctl.d
42 echo "net.ipv6.conf.$if_name.accept_dad=0" \
43 >>${D}${sysconfdir}/sysctl.d/25-gbmc-ncsi.conf
44 echo "net.ipv6.conf.$if_name.dad_transmits=0" \
45 >>${D}${sysconfdir}/sysctl.d/25-gbmc-ncsi.conf
46
47 netdir=${D}${systemd_unitdir}/network/00-bmc-$if_name.network.d
48 install -d -m0755 "$netdir"
49 echo '[Network]' >>"$netdir"/gbmc-ncsi.conf
50 echo 'DHCP=false' >>"$netdir"/gbmc-ncsi.conf
51 echo 'IPv6AcceptRA=false' >>"$netdir"/gbmc-ncsi.conf
52 echo 'LLMNR=false' >>"$netdir"/gbmc-ncsi.conf
53 echo 'MulticastDNS=false' >>"$netdir"/gbmc-ncsi.conf
54 echo 'LinkLocalAddressing=ipv6' >>"$netdir"/gbmc-ncsi.conf
55
56 nftdir=${D}${sysconfdir}/nftables
57 install -d -m0755 "$nftdir"
William A. Kennington III1ef795b2021-03-10 18:59:12 -080058 sed "s,@NCSI_IF@,$if_name,g" ${WORKDIR}/50-gbmc-ncsi.rules.in \
William A. Kennington IIIf19a8382021-02-16 14:16:47 -080059 >"$nftdir"/50-gbmc-ncsi.rules
60
61 wantdir=${D}${systemd_system_unitdir}/multi-user.target.wants
62 install -d -m0755 "$wantdir"
63 ln -sv ../ncsid@.service "$wantdir"/ncsid@$if_name.service
William A. Kennington III7f11d1f2021-02-16 14:57:41 -080064
65 install -m 0644 ${WORKDIR}/gbmc-ncsi-sslh.service ${D}${systemd_system_unitdir}
William A. Kennington III1ef795b2021-03-10 18:59:12 -080066 sed "s,@NCSI_IF@,$if_name,g" ${WORKDIR}/gbmc-ncsi-sslh.socket.in \
William A. Kennington III7f11d1f2021-02-16 14:57:41 -080067 >${D}${systemd_system_unitdir}/gbmc-ncsi-sslh.socket
William A. Kennington III1ef795b2021-03-10 18:59:12 -080068
69 mondir=${D}${datadir}/gbmc-ip-monitor/
70 install -d -m0755 $mondir
71 sed "s,@NCSI_IF@,$if_name,g" ${WORKDIR}/gbmc-ncsi-nft.sh.in \
72 >${WORKDIR}/gbmc-ncsi-nft.sh
73 install -m644 ${WORKDIR}/gbmc-ncsi-nft.sh $mondir
William A. Kennington IIIf19a8382021-02-16 14:16:47 -080074}