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