blob: 70da4c47a560a612b5f21ff88c2f9c40d82b1dd5 [file] [log] [blame]
developercc441a02022-05-09 19:04:26 +08001require recipes-ccsp/ccsp/ccsp_common_filogic.inc
developer15a43312022-04-12 11:23:23 +08002
3DEPENDS_append = " kernel-autoconf utopia-headers libsyswrapper telemetry"
4
5FILESEXTRAPATHS_prepend := "${THISDIR}/${PN}:"
6
developer783a8a62024-01-17 12:34:31 +08007EXTRA_OECONF_append_dunfell = " --with-ccsp-arch=arm"
developer5d681762023-05-05 12:39:13 +08008EXTRA_OECONF_remove = "--with-ccsp-platform=bcm"
developer15a43312022-04-12 11:23:23 +08009
10SRC_URI_append = " \
developercc441a02022-05-09 19:04:26 +080011 file://0001-fix-lan-handler-for-filogic.patch;apply=no \
developer15a43312022-04-12 11:23:23 +080012 file://0003-remove-autoconf.patch;apply=no \
13 file://system_defaults \
developeree5d3992023-10-11 16:15:56 -070014 file://0004-enable-sshd-by-default-at-bootup.patch;apply=no \
developer6172cdb2023-12-02 02:26:13 +000015 file://service_bridge_mtk.sh \
developer15a43312022-04-12 11:23:23 +080016"
developer783a8a62024-01-17 12:34:31 +080017SRC_URI_append = "file://0001-Work-around-for-brlan0-issue.patch;apply=no"
developer15a43312022-04-12 11:23:23 +080018
19SRC_URI += "file://posix-gwprovapp.patch;apply=no"
20#This patch will add dummy swctl api which is originally given by brcm for XB3.
21SRC_URI += "file://0002-fix-swctl-missing-api.patch;apply=no"
22SRC_URI += "file://firewall-secure-onboard.patch;apply=no"
23SRC_URI += "file://dhcp_script.sh"
24
25LDFLAGS_append = " \
26 -lsecure_wrapper \
27"
28
29CFLAGS_append = " -Wno-format-extra-args -Wno-error "
30CFLAGS_append += "${@bb.utils.contains('DISTRO_FEATURES', 'rdkb_wan_manager', ' -D_WAN_MANAGER_ENABLED_', '', d)}"
31
developercc441a02022-05-09 19:04:26 +080032# we need to patch to code for Filogic
33do_filogic_patches() {
developer15a43312022-04-12 11:23:23 +080034 cd ${S}
developercc441a02022-05-09 19:04:26 +080035 if [ ! -e filogic_patch_applied ]; then
36 bbnote "Patching 0001-fix-lan-handler-for-filogic.patch"
37 patch -p1 < ${WORKDIR}/0001-fix-lan-handler-for-filogic.patch
developer15a43312022-04-12 11:23:23 +080038
39 bbnote "Patching posix-gwprovapp.patch"
40 patch -p1 < ${WORKDIR}/posix-gwprovapp.patch
41
42 bbnote "Patching 0002-fix-swctl-missing-api.patch"
43 patch -p1 < ${WORKDIR}/0002-fix-swctl-missing-api.patch
44
45 bbnote "Patching firewall-secure-onboard.patch"
46 patch -p1 < ${WORKDIR}/firewall-secure-onboard.patch || echo "ERROR or Patch already applied"
47
developeree5d3992023-10-11 16:15:56 -070048 bbnote "Patching 0004-enable-sshd-by-default-at-bootup.patch"
49 patch -p1 < ${WORKDIR}/0004-enable-sshd-by-default-at-bootup.patch
50
developercc441a02022-05-09 19:04:26 +080051 touch filogic_patch_applied
developer15a43312022-04-12 11:23:23 +080052 fi
53}
54
developer783a8a62024-01-17 12:34:31 +080055do_filogic_patches-append() {
developer15a43312022-04-12 11:23:23 +080056 cd ${S}
developercc441a02022-05-09 19:04:26 +080057 if [ ! -e dunfell_filogic_patch_applied ]; then
developer15a43312022-04-12 11:23:23 +080058 patch -p1 < ${WORKDIR}/0001-Work-around-for-brlan0-issue.patch
59 fi
developercc441a02022-05-09 19:04:26 +080060 touch dunfell_filogic_patch_applied
developer15a43312022-04-12 11:23:23 +080061}
62
developercc441a02022-05-09 19:04:26 +080063addtask filogic_patches after do_unpack before do_compile
developer15a43312022-04-12 11:23:23 +080064
65do_install_append() {
66
67 # Don't install header files which are provided by utopia-headers
68 rm -f ${D}${includedir}/utctx/autoconf.h
69 rm -f ${D}${includedir}/utctx/utctx.h
70 rm -f ${D}${includedir}/utctx/utctx_api.h
71 rm -f ${D}${includedir}/utctx/utctx_rwlock.h
72
73 # Config files and scripts
74 install -d ${D}/rdklogs
75 install -d ${D}/fss/gw/bin
76 install -d ${D}/fss/gw/usr/bin
77 install -d ${D}/fss/gw/usr/sbin
78 install -d ${D}/fss/gw/etc/utopia/service.d
79 install -d ${D}/var/spool/cron/crontabs
80
81 install -d ${D}${sbindir}/
82 install -d ${D}${sysconfdir}/utopia/service.d
83 install -d ${D}${sysconfdir}/utopia/registration.d
84 install -d ${D}${sysconfdir}/utopia/post.d
85 install -d ${D}${sysconfdir}/IGD
86 install -d ${D}${sysconfdir}/utopia/service.d/service_bridge
87 install -d ${D}${sysconfdir}/utopia/service.d/service_ddns
88 install -d ${D}${sysconfdir}/utopia/service.d/service_dhcp_server
89 install -d ${D}${sysconfdir}/utopia/service.d/service_lan
90 install -d ${D}${sysconfdir}/utopia/service.d/service_multinet
91 install -d ${D}${sysconfdir}/utopia/service.d/service_syslog
92 install -d ${D}${sysconfdir}/utopia/service.d/service_wan
93
94 install -m 755 ${S}/source/scripts/init/system/utopia_init.sh ${D}${sysconfdir}/utopia/
95 install -m 644 ${S}/source/scripts/init/defaults/system_defaults_arm ${D}${sysconfdir}/utopia/system_defaults
96 install -m 755 ${S}/source/scripts/init/service.d/*.sh ${D}${sysconfdir}/utopia/service.d/
97 install -m 755 ${S}/source/scripts/init/service.d/service_bridge/*.sh ${D}${sysconfdir}/utopia/service.d/service_bridge
98 install -m 755 ${S}/source/scripts/init/service.d/service_ddns/*.sh ${D}${sysconfdir}/utopia/service.d/service_ddns
99 install -m 755 ${S}/source/scripts/init/service.d/service_dhcp_server/* ${D}${sysconfdir}/utopia/service.d/service_dhcp_server
100 install -m 755 ${S}/source/scripts/init/service.d/service_lan/*.sh ${D}${sysconfdir}/utopia/service.d/service_lan
101 install -m 755 ${S}/source/scripts/init/service.d/service_multinet/*.sh ${D}${sysconfdir}/utopia/service.d/service_multinet
102 install -m 755 ${S}/source/scripts/init/service.d/service_syslog/*.sh ${D}${sysconfdir}/utopia/service.d/service_syslog
103 install -m 755 ${S}/source/scripts/init/service.d/service_wan/*.sh ${D}${sysconfdir}/utopia/service.d/service_wan
104 install -m 755 ${S}/source/scripts/init/service.d/service_firewall/firewall_log_handle.sh ${D}${sysconfdir}/utopia/service.d/
105 install -m 644 ${S}/source/igd/src/inc/*.xml ${D}${sysconfdir}/IGD
106 install -D -m 644 ${S}/source/scripts/init/syslog_conf/syslog.conf_default ${D}/fss/gw/${sysconfdir}/syslog.conf.${BPN}
107 install -m 755 ${S}/source/scripts/init/syslog_conf/log_start.sh ${D}${sbindir}/
108 install -m 755 ${S}/source/scripts/init/syslog_conf/log_handle.sh ${D}${sbindir}/
109 install -m 755 ${S}/source/scripts/init/syslog_conf/syslog_conf_tool.sh ${D}${sbindir}/
110 install -m 644 ${S}/source/scripts/init/service.d/event_flags ${D}${sysconfdir}/utopia/service.d/
111 install -m 644 ${S}/source/scripts/init/service.d/rt_tables ${D}${sysconfdir}/utopia/service.d/rt_tables
112 install -m 755 ${S}/source/scripts/init/service.d/service_cosa_arm.sh ${D}${sysconfdir}/utopia/service.d/service_cosa.sh
113 install -m 755 ${S}/source/scripts/init/service.d/service_dhcpv6_client_arm.sh ${D}${sysconfdir}/utopia/service.d/service_dhcpv6_client.sh
114 install -m 755 ${S}/source/scripts/init/system/need_wifi_default.sh ${D}${sysconfdir}/utopia/
115 touch ${D}${sysconfdir}/dhcp_static_hosts
developercc441a02022-05-09 19:04:26 +0800116 #filogic uses default service_bridge.sh for now
developer6172cdb2023-12-02 02:26:13 +0000117 install -m 755 ${WORKDIR}/service_bridge_mtk.sh ${D}${sysconfdir}/utopia/service.d/service_bridge.sh
developer15a43312022-04-12 11:23:23 +0800118
119 install -m 755 ${WORKDIR}/dhcp_script.sh ${D}${sysconfdir}/
developerfea7f522023-02-16 17:32:51 +0800120
121 #change default log level to 8
122 sed -i 's/level=6/level=8/g' ${D}${sbindir}/log_start.sh
developer15a43312022-04-12 11:23:23 +0800123
124 # Creating symbolic links to install files in specific directory as in legacy builds
125 ln -sf /usr/bin/10_firewall ${D}${sysconfdir}/utopia/post.d/10_firewall
126 ln -sf /usr/bin/service_multinet_exec ${D}${sysconfdir}/utopia/service.d/service_multinet_exec
127 ln -sf /usr/bin/10_mcastproxy ${D}${sysconfdir}/utopia/post.d/10_mcastproxy
128 ln -sf /usr/bin/10_mldproxy ${D}${sysconfdir}/utopia/post.d/10_mldproxy
129 ln -sf /usr/bin/15_igd ${D}${sysconfdir}/utopia/post.d/15_igd
130 ln -sf /usr/bin/15_misc ${D}${sysconfdir}/utopia/post.d/15_misc
131 ln -sf /usr/bin/02_bridge ${D}${sysconfdir}/utopia/registration.d/02_bridge
132 ln -sf /usr/bin/02_forwarding ${D}${sysconfdir}/utopia/registration.d/02_forwarding
133 ln -sf /usr/bin/02_ipv4 ${D}${sysconfdir}/utopia/registration.d/02_ipv4
134 ln -sf /usr/bin/02_lanHandler ${D}${sysconfdir}/utopia/registration.d/02_lanHandler
135 ln -sf /usr/bin/02_multinet ${D}${sysconfdir}/utopia/registration.d/02_multinet
136 ln -sf /usr/bin/02_wan ${D}${sysconfdir}/utopia/registration.d/02_wan
137 ln -sf /usr/bin/02_lan ${D}${sysconfdir}/utopia/registration.d/02_lan
138 ln -sf /usr/bin/15_ccsphs ${D}${sysconfdir}/utopia/registration.d/15_ccsphs
139 ln -sf /usr/bin/15_ddnsclient ${D}${sysconfdir}/utopia/registration.d/15_ddnsclient
140 ln -sf /usr/bin/15_dhcp_server ${D}${sysconfdir}/utopia/registration.d/15_dhcp_server
141 ln -sf /usr/bin/15_hotspot ${D}${sysconfdir}/utopia/registration.d/15_hotspot
142 ln -sf /usr/bin/15_ssh_server ${D}${sysconfdir}/utopia/registration.d/15_ssh_server
143 ln -sf /usr/bin/15_wecb ${D}${sysconfdir}/utopia/registration.d/15_wecb
144 ln -sf /usr/bin/20_routing ${D}${sysconfdir}/utopia/registration.d/20_routing
145 ln -sf /usr/bin/25_crond ${D}${sysconfdir}/utopia/registration.d/25_crond
146 ln -sf /usr/bin/26_potd ${D}${sysconfdir}/utopia/registration.d/26_potd
147 ln -sf /usr/bin/33_cosa ${D}${sysconfdir}/utopia/registration.d/33_cosa
148 ln -sf /usr/bin/syscfg ${D}${bindir}/syscfg_create
149 ln -sf /usr/bin/syscfg ${D}${bindir}/syscfg_destroy
150 ln -sf /usr/bin/firewall ${D}/fss/gw/usr/bin/firewall
151 ln -sf /usr/bin/GenFWLog ${D}/fss/gw/usr/bin/GenFWLog
152 ln -sf /etc/utopia/service.d/log_capture_path.sh ${D}/fss/gw/etc/utopia/service.d/log_capture_path.sh
153 ln -sf /etc/utopia/service.d/log_env_var.sh ${D}/fss/gw/etc/utopia/service.d/log_env_var.sh
154 ln -sf /usr/bin/syseventd_fork_helper ${D}/fss/gw/usr/bin/syseventd_fork_helper
155 ln -sf /usr/sbin/log_start.sh ${D}/fss/gw/usr/sbin/log_start.sh
156 ln -sf /usr/sbin/log_handle.sh ${D}/fss/gw/usr/sbin/log_handle.sh
157 ln -sf /etc/syslog.conf.utopia ${D}/fss/gw/etc/syslog.conf.utopia
158 ln -sf /etc/utopia/service.d/misc_handler.sh ${D}/fss/gw/etc/utopia/service.d/misc_handler.sh
159
160 install -m 755 ${WORKDIR}/system_defaults ${D}${sysconfdir}/utopia/system_defaults
161 sed -i -e "s/ifconfig wan0/ifconfig erouter0/g" ${D}/etc/utopia/service.d/service_sshd.sh
162 sed -i -e "s/dropbear -E -s -b \/etc\/sshbanner.txt/dropbear -R -E /g" ${D}/etc/utopia/service.d/service_sshd.sh
163 sed -i -e "/dropbear -R -E -a -r/s/$/ -B/" ${D}${sysconfdir}/utopia/service.d/service_sshd.sh
164
developercc441a02022-05-09 19:04:26 +0800165 #MSG_QUEUE files are not present in Filogic
developer15a43312022-04-12 11:23:23 +0800166 sed -i '/TOT_MSG_MAX=\$/ s/^/#/g' ${D}${sysconfdir}/utopia/utopia_init.sh
167
developercc441a02022-05-09 19:04:26 +0800168 echo "###Filogic specific lines###" >> ${D}${sysconfdir}/utopia/utopia_init.sh
developer15a43312022-04-12 11:23:23 +0800169 echo "#TODO: Need to replaced once the sky version 2 code is available" >> ${D}${sysconfdir}/utopia/utopia_init.sh
170 echo "sysevent set lan-start 0" >> ${D}${sysconfdir}/utopia/utopia_init.sh
171 echo "sysevent set bridge-stop 0" >> ${D}${sysconfdir}/utopia/utopia_init.sh
172 echo "sysevent set bridge_mode 0" >> ${D}${sysconfdir}/utopia/utopia_init.sh
173 echo "sysevent set dhcp_server-resync 0" >> ${D}${sysconfdir}/utopia/utopia_init.sh
174 echo "sysevent set ethwan-initialized 1" >> ${D}${sysconfdir}/utopia/utopia_init.sh
175 echo "syscfg set eth_wan_enabled true" >> ${D}${sysconfdir}/utopia/utopia_init.sh
176 echo "syscfg commit" >> ${D}${sysconfdir}/utopia/utopia_init.sh
177 echo "echo 1 > \/proc\/sys\/net\/ipv4\/ip_forward" >> ${D}${sysconfdir}/utopia/utopia_init.sh
178
179 echo "sysevent set bridge_mode \`syscfg get bridge_mode\`" >> ${D}${sysconfdir}/utopia/utopia_init.sh
180 echo "sysevent set lan-status started" >> ${D}${sysconfdir}/utopia/utopia_init.sh
181 echo 'echo_t "[utopia][init] completed creating utopia_inited flag"' >> ${D}${sysconfdir}/utopia/utopia_init.sh
182
183#WanManager Feature
184 DISTRO_WAN_ENABLED="${@bb.utils.contains('DISTRO_FEATURES','rdkb_wan_manager','true','false',d)}"
185 if [ $DISTRO_WAN_ENABLED = 'true' ]; then
186 sed -i '/cron/a \
187\# Creating the dibbler directory for its pid files in \/tmp \
188mkdir -p \/tmp\/dibbler ' ${D}${sysconfdir}/utopia/utopia_init.sh
189
190 sed -i '/log_capture_path.sh/a \
191mkdir -p \/nvram \
192rm -f \/nvram\/dnsmasq.leases \
193cp \/usr\/ccsp\/ccsp_msg.cfg \/tmp \
194touch \/tmp\/cp_subsys_ert \
195ln -s \/var\/spool\/cron\/crontabs \/ \
196mkdir -p \/var\/run\/firewall \
197touch \/nvram\/ETHWAN_ENABLE ' ${D}${sysconfdir}/utopia/utopia_init.sh
198
developerde364002022-04-21 20:09:41 +0800199 echo "firewall" >> ${D}${sysconfdir}/utopia/utopia_init.sh
200 echo "execute_dir /etc/utopia/post.d/" >> ${D}${sysconfdir}/utopia/utopia_init.sh
201 echo "touch /tmp/.postd_started" >> ${D}${sysconfdir}/utopia/utopia_init.sh
developer15a43312022-04-12 11:23:23 +0800202 sed -i '/lan-status started/a \
203sysevent set wan-status started ' ${D}${sysconfdir}/utopia/utopia_init.sh
204 fi
205
206 echo "touch -f /tmp/utopia_inited" >> ${D}${sysconfdir}/utopia/utopia_init.sh
207
208}
209
developer15a43312022-04-12 11:23:23 +0800210
211FILES_${PN} += " \
212 /rdklogs/ \
213 /fss/gw/bin/ \
214 /fss/gw/usr/bin/ \
215 /fss/gw/usr/sbin/ \
216 /var/spool/cron/crontabs \
217 /fss/gw/etc/utopia/* \
218 /etc/utopia/system_defaults \
219"
220
developercc441a02022-05-09 19:04:26 +0800221# 0001-fix-lan-handler-for-filogic.patch contains bash specific syntax which doesn't run with busybox sh
developer15a43312022-04-12 11:23:23 +0800222RDEPENDS_${PN} += "bash"
223