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