blob: 938703395280aeae45ed4810ea23ad477d387eaa [file] [log] [blame]
developer15a43312022-04-12 11:23:23 +08001require ccsp_common_turris.inc
2
3FILESEXTRAPATHS_prepend := "${THISDIR}/${PN}:${THISDIR}/files:"
4
5DEPENDS_append_turris = " breakpad"
6CXXFLAGS_append_turris = " \
7 -I${STAGING_INCDIR}/breakpad \
8 -std=c++11 \
9 "
10
11SRC_URI_append = " \
12 file://ccsp_vendor.h \
13 file://wifiinitialized.service \
14 file://checkturriswifisupport.service \
15 file://wifiinitialized.path \
16 file://turriswifiinitialized.path \
17 file://checkturriswifisupport.path \
18 file://wifi-initialized.target \
19 file://utopia.service \
20"
21
22SRC_URI_remove_dunfell = "file://0001-DBusLoop-SSL_state-TLS_ST_OK.patch"
23SRC_URI_remove_dunfell = "file://0001-SSLeay_add_all_algorithms-remove-in-openssl-1.1.patch"
24
25SRC_URI += "file://0003-add-dependency-to-pandm.patch;apply=no"
26SRC_URI += "file://0004-remove-psm-db-reference.patch;apply=no"
27SRC_URI_append_dunfell = " file://0001-DBusLoop-SSL_state-TLS_ST_OK.patch;apply=no"
28SRC_URI_append_dunfell = " file://0001-SSLeay_add_all_algorithms-remove-in-openssl-1.1.patch;apply=no"
29
30
31# we need to patch to code for Turris
32do_turris_patches() {
33 cd ${S}
34 if [ ! -e patch_applied ]; then
35 patch -p1 < ${WORKDIR}/0003-add-dependency-to-pandm.patch
36 patch -p1 < ${WORKDIR}/0004-remove-psm-db-reference.patch
37 if [ "${@bb.utils.contains('DISTRO_CODENAME', 'dunfell', 'dunfell', '', d)}" = "dunfell" ] ; then
38 patch -p1 < ${WORKDIR}/0001-DBusLoop-SSL_state-TLS_ST_OK.patch
39 patch -p1 < ${WORKDIR}/0001-SSLeay_add_all_algorithms-remove-in-openssl-1.1.patch
40 fi
41 touch patch_applied
42 fi
43}
44addtask turris_patches after do_unpack before do_compile
45
46do_install_append_class-target(){
47 # Config files and scripts
48 install -m 777 ${S}/scripts/cli_start_arm.sh ${D}/usr/ccsp/cli_start.sh
49 install -m 777 ${S}/scripts/cosa_start_arm.sh ${D}/usr/ccsp/cosa_start.sh
50
51 # we need unix socket path
52 echo "unix:path=/var/run/dbus/system_bus_socket" > ${S}/config/ccsp_msg.cfg
53 install -m 644 ${S}/config/ccsp_msg.cfg ${D}/usr/ccsp/ccsp_msg.cfg
54 install -m 644 ${S}/config/ccsp_msg.cfg ${D}/usr/ccsp/cm/ccsp_msg.cfg
55 install -m 644 ${S}/config/ccsp_msg.cfg ${D}/usr/ccsp/mta/ccsp_msg.cfg
56 install -m 644 ${S}/config/ccsp_msg.cfg ${D}/usr/ccsp/pam/ccsp_msg.cfg
57 install -m 644 ${S}/config/ccsp_msg.cfg ${D}/usr/ccsp/tr069pa/ccsp_msg.cfg
58
59 install -m 777 ${S}/systemd_units/scripts/ccspSysConfigEarly.sh ${D}/usr/ccsp/ccspSysConfigEarly.sh
60 install -m 777 ${S}/systemd_units/scripts/ccspSysConfigLate.sh ${D}/usr/ccsp/ccspSysConfigLate.sh
61 install -m 777 ${S}/systemd_units/scripts/utopiaInitCheck.sh ${D}/usr/ccsp/utopiaInitCheck.sh
62 install -m 777 ${S}/systemd_units/scripts/ccspPAMCPCheck.sh ${D}/usr/ccsp/ccspPAMCPCheck.sh
63
64 install -m 777 ${S}/systemd_units/scripts/ProcessResetCheck.sh ${D}/usr/ccsp/ProcessResetCheck.sh
65 sed -i -e "s/source \/rdklogger\/logfiles.sh;syncLogs_nvram2/#source \/rdklogger\/logfiles.sh;syncLogs_nvram2/g" ${D}/usr/ccsp/ProcessResetCheck.sh
66 # install systemd services
67 install -d ${D}${systemd_unitdir}/system
68 install -D -m 0644 ${S}/systemd_units/ccspwifiagent.service ${D}${systemd_unitdir}/system/ccspwifiagent.service
69 install -D -m 0644 ${S}/systemd_units/CcspCrSsp.service ${D}${systemd_unitdir}/system/CcspCrSsp.service
70 install -D -m 0644 ${S}/systemd_units/CcspPandMSsp.service ${D}${systemd_unitdir}/system/CcspPandMSsp.service
71 install -D -m 0644 ${S}/systemd_units/PsmSsp.service ${D}${systemd_unitdir}/system/PsmSsp.service
72 install -D -m 0644 ${S}/systemd_units/rdkbLogMonitor.service ${D}${systemd_unitdir}/system/rdkbLogMonitor.service
73 install -D -m 0644 ${S}/systemd_units/CcspTandDSsp.service ${D}${systemd_unitdir}/system/CcspTandDSsp.service
74 install -D -m 0644 ${S}/systemd_units/CcspLMLite.service ${D}${systemd_unitdir}/system/CcspLMLite.service
75 install -D -m 0644 ${S}/systemd_units/CcspTr069PaSsp.service ${D}${systemd_unitdir}/system/CcspTr069PaSsp.service
76 install -D -m 0644 ${S}/systemd_units/snmpSubAgent.service ${D}${systemd_unitdir}/system/snmpSubAgent.service
77 install -D -m 0644 ${S}/systemd_units/snmpSubAgent.service ${D}${systemd_unitdir}/system/snmpSubAgent.service
78 install -D -m 0644 ${S}/systemd_units/CcspEthAgent.service ${D}${systemd_unitdir}/system/CcspEthAgent.service
79
80 #rfc service file
81 install -D -m 0644 ${S}/systemd_units/rfc.service ${D}${systemd_unitdir}/system/rfc.service
82
83 install -D -m 0644 ${WORKDIR}/wifiinitialized.service ${D}${systemd_unitdir}/system/wifiinitialized.service
84 install -D -m 0644 ${WORKDIR}/checkturriswifisupport.service ${D}${systemd_unitdir}/system/checkturriswifisupport.service
85
86 install -D -m 0644 ${WORKDIR}/wifiinitialized.path ${D}${systemd_unitdir}/system/wifiinitialized.path
87 install -D -m 0644 ${WORKDIR}/turriswifiinitialized.path ${D}${systemd_unitdir}/system/turriswifiinitialized.path
88 install -D -m 0644 ${WORKDIR}/checkturriswifisupport.path ${D}${systemd_unitdir}/system/checkturriswifisupport.path
89
90 install -D -m 0644 ${WORKDIR}/wifi-initialized.target ${D}${systemd_unitdir}/system/wifi-initialized.target
91
92 install -D -m 0644 ${S}/systemd_units/ProcessResetDetect.service ${D}${systemd_unitdir}/system/ProcessResetDetect.service
93 install -D -m 0644 ${S}/systemd_units/ProcessResetDetect.path ${D}${systemd_unitdir}/system/ProcessResetDetect.path
94
95 # Install wrapper for breakpad (disabled to support External Source build)
96 #install -d ${D}${includedir}/ccsp
97 #install -m 644 ${S}/source/breakpad_wrapper/include/breakpad_wrapper.h ${D}${includedir}/ccsp
98
99 # Install "vendor information"
100 install -m 0644 ${WORKDIR}/ccsp_vendor.h ${D}${includedir}/ccsp
101
102 sed -i -- 's/NotifyAccess=.*/#NotifyAccess=main/g' ${D}${systemd_unitdir}/system/CcspCrSsp.service
103 sed -i -- 's/notify.*/forking/g' ${D}${systemd_unitdir}/system/CcspCrSsp.service
104
105 #copy rfc.properties into nvram
106 sed -i '/ExecStartPre/ a\ExecStartPre=-/bin/cp /etc/rfc.properties /nvram/' ${D}${systemd_unitdir}/system/rfc.service
107 #reduce sleep time to 12 sconds
108 sed -i 's/300/12/g' ${D}${systemd_unitdir}/system/rfc.service
109
110 #change for turris omnia
111 sed -i 's/PIDFile/#&/' ${D}${systemd_unitdir}/system/CcspPandMSsp.service
112
113 #WanManager - RdkWanManager.service
114 DISTRO_WAN_ENABLED="${@bb.utils.contains('DISTRO_FEATURES','rdkb_wan_manager','true','false',d)}"
115 if [ $DISTRO_WAN_ENABLED = 'true' ]; then
116 install -D -m 0644 ${S}/systemd_units/RdkWanManager.service ${D}${systemd_unitdir}/system/RdkWanManager.service
117 sed -i "/WorkingDirectory/a ExecStartPre=/bin/sh /lib/rdk/run_rm_key.sh" ${D}${systemd_unitdir}/system/RdkWanManager.service
developer1495e4d2022-04-14 17:58:16 +0800118 sed -i "s/After=CcspCrSsp.service/After=CcspCrSsp.service utopia.service PsmSsp.service CcspEthAgent.service/g" ${D}${systemd_unitdir}/system/RdkWanManager.service
developer15a43312022-04-12 11:23:23 +0800119 sed -i "s/CcspPandMSsp.service/CcspCrSsp.service CcspPandMSsp.service/g" ${D}${systemd_unitdir}/system/CcspEthAgent.service
120 install -D -m 0644 ${WORKDIR}/utopia.service ${D}${systemd_unitdir}/system/utopia.service
121 install -D -m 0644 ${S}/systemd_units/RdkTelcoVoiceManager.service ${D}${systemd_unitdir}/system/RdkTelcoVoiceManager.service
122 install -D -m 0644 ${S}/systemd_units/RdkVlanManager.service ${D}${systemd_unitdir}/system/RdkVlanManager.service
123 fi
124
125 ##### erouter0 ip issue
126 sed -i '/Factory/a \
127IsErouterRunningStatus=\`ifconfig erouter0 | grep RUNNING | grep -v grep | wc -l\` \
128if [ \"\$IsErouterRunningStatus\" == 0 ]; then \
129ethtool -s erouter0 speed 1000 \
130fi' ${D}/usr/ccsp/ccspPAMCPCheck.sh
131
132}
133
134do_install_append_dunfell_class-target () {
135 #for yocto 3.1, Making psm to run after gwprovethwan
136 sed -i '/CcspCrSsp.service/c After=CcspCrSsp.service gwprovethwan.service' ${D}${systemd_unitdir}/system/PsmSsp.service
137}
138
139SYSTEMD_SERVICE_${PN} += "ccspwifiagent.service"
140SYSTEMD_SERVICE_${PN} += "CcspCrSsp.service"
141SYSTEMD_SERVICE_${PN} += "CcspPandMSsp.service"
142SYSTEMD_SERVICE_${PN} += "PsmSsp.service"
143SYSTEMD_SERVICE_${PN} += "rdkbLogMonitor.service"
144SYSTEMD_SERVICE_${PN} += "CcspTandDSsp.service"
145SYSTEMD_SERVICE_${PN} += "CcspLMLite.service"
146SYSTEMD_SERVICE_${PN} += "CcspTr069PaSsp.service"
147SYSTEMD_SERVICE_${PN} += "snmpSubAgent.service"
148SYSTEMD_SERVICE_${PN} += "CcspEthAgent.service"
149SYSTEMD_SERVICE_${PN} += "wifiinitialized.service"
150SYSTEMD_SERVICE_${PN} += "checkturriswifisupport.service"
151SYSTEMD_SERVICE_${PN} += "wifiinitialized.path"
152SYSTEMD_SERVICE_${PN} += "turriswifiinitialized.path"
153SYSTEMD_SERVICE_${PN} += "checkturriswifisupport.path"
154SYSTEMD_SERVICE_${PN} += "wifi-initialized.target"
155SYSTEMD_SERVICE_${PN} += "ProcessResetDetect.path"
156SYSTEMD_SERVICE_${PN} += "ProcessResetDetect.service"
157SYSTEMD_SERVICE_${PN} += "rfc.service"
158SYSTEMD_SERVICE_${PN} += "${@bb.utils.contains('DISTRO_FEATURES', 'rdkb_wan_manager', 'RdkWanManager.service utopia.service ', '', d)}"
159
160FILES_${PN}_append = " \
161 /usr/ccsp/ccspSysConfigEarly.sh \
162 /usr/ccsp/ccspSysConfigLate.sh \
163 /usr/ccsp/utopiaInitCheck.sh \
164 /usr/ccsp/ccspPAMCPCheck.sh \
165 /usr/ccsp/ProcessResetCheck.sh \
166 ${systemd_unitdir}/system/ccspwifiagent.service \
167 ${systemd_unitdir}/system/CcspCrSsp.service \
168 ${systemd_unitdir}/system/CcspPandMSsp.service \
169 ${systemd_unitdir}/system/PsmSsp.service \
170 ${systemd_unitdir}/system/rdkbLogMonitor.service \
171 ${systemd_unitdir}/system/CcspTandDSsp.service \
172 ${systemd_unitdir}/system/CcspLMLite.service \
173 ${systemd_unitdir}/system/CcspTr069PaSsp.service \
174 ${systemd_unitdir}/system/snmpSubAgent.service \
175 ${systemd_unitdir}/system/CcspEthAgent.service \
176 ${systemd_unitdir}/system/wifiinitialized.service \
177 ${systemd_unitdir}/system/checkturriswifisupport.service \
178 ${systemd_unitdir}/system/wifiinitialized.path \
179 ${systemd_unitdir}/system/turriswifiinitialized.path \
180 ${systemd_unitdir}/system/checkturriswifisupport.path \
181 ${systemd_unitdir}/system/wifi-initialized.target \
182 ${systemd_unitdir}/system/ProcessResetDetect.path \
183 ${systemd_unitdir}/system/ProcessResetDetect.service \
184 ${systemd_unitdir}/system/rfc.service \
185"
186FILES_${PN}_append = "${@bb.utils.contains('DISTRO_FEATURES', 'rdkb_wan_manager', ' ${systemd_unitdir}/system/RdkWanManager.service ${systemd_unitdir}/system/utopia.service ${systemd_unitdir}/system/RdkVlanManager.service ${systemd_unitdir}/system/RdkTelcoVoiceManager.service ', '', d)}"