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