developer | cc441a0 | 2022-05-09 19:04:26 +0800 | [diff] [blame] | 1 | require recipes-ccsp/ccsp/ccsp_common_filogic.inc |
developer | 15a4331 | 2022-04-12 11:23:23 +0800 | [diff] [blame] | 2 | |
| 3 | DEPENDS_append = " kernel-autoconf utopia-headers libsyswrapper telemetry" |
| 4 | |
| 5 | FILESEXTRAPATHS_prepend := "${THISDIR}/${PN}:" |
| 6 | |
developer | 783a8a6 | 2024-01-17 12:34:31 +0800 | [diff] [blame] | 7 | EXTRA_OECONF_append_dunfell = " --with-ccsp-arch=arm" |
developer | 5d68176 | 2023-05-05 12:39:13 +0800 | [diff] [blame] | 8 | EXTRA_OECONF_remove = "--with-ccsp-platform=bcm" |
developer | 15a4331 | 2022-04-12 11:23:23 +0800 | [diff] [blame] | 9 | |
| 10 | SRC_URI_append = " \ |
developer | cc441a0 | 2022-05-09 19:04:26 +0800 | [diff] [blame] | 11 | file://0001-fix-lan-handler-for-filogic.patch;apply=no \ |
developer | 15a4331 | 2022-04-12 11:23:23 +0800 | [diff] [blame] | 12 | file://0003-remove-autoconf.patch;apply=no \ |
| 13 | file://system_defaults \ |
developer | ee5d399 | 2023-10-11 16:15:56 -0700 | [diff] [blame] | 14 | file://0004-enable-sshd-by-default-at-bootup.patch;apply=no \ |
developer | 6172cdb | 2023-12-02 02:26:13 +0000 | [diff] [blame] | 15 | file://service_bridge_mtk.sh \ |
developer | 15a4331 | 2022-04-12 11:23:23 +0800 | [diff] [blame] | 16 | " |
developer | 783a8a6 | 2024-01-17 12:34:31 +0800 | [diff] [blame] | 17 | SRC_URI_append = "file://0001-Work-around-for-brlan0-issue.patch;apply=no" |
developer | 15a4331 | 2022-04-12 11:23:23 +0800 | [diff] [blame] | 18 | |
| 19 | SRC_URI += "file://posix-gwprovapp.patch;apply=no" |
| 20 | #This patch will add dummy swctl api which is originally given by brcm for XB3. |
| 21 | SRC_URI += "file://0002-fix-swctl-missing-api.patch;apply=no" |
| 22 | SRC_URI += "file://firewall-secure-onboard.patch;apply=no" |
| 23 | SRC_URI += "file://dhcp_script.sh" |
| 24 | |
| 25 | LDFLAGS_append = " \ |
| 26 | -lsecure_wrapper \ |
| 27 | " |
| 28 | |
| 29 | CFLAGS_append = " -Wno-format-extra-args -Wno-error " |
| 30 | CFLAGS_append += "${@bb.utils.contains('DISTRO_FEATURES', 'rdkb_wan_manager', ' -D_WAN_MANAGER_ENABLED_', '', d)}" |
| 31 | |
developer | cc441a0 | 2022-05-09 19:04:26 +0800 | [diff] [blame] | 32 | # we need to patch to code for Filogic |
| 33 | do_filogic_patches() { |
developer | 15a4331 | 2022-04-12 11:23:23 +0800 | [diff] [blame] | 34 | cd ${S} |
developer | cc441a0 | 2022-05-09 19:04:26 +0800 | [diff] [blame] | 35 | 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 |
developer | 15a4331 | 2022-04-12 11:23:23 +0800 | [diff] [blame] | 38 | |
| 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 | |
developer | ee5d399 | 2023-10-11 16:15:56 -0700 | [diff] [blame] | 48 | bbnote "Patching 0004-enable-sshd-by-default-at-bootup.patch" |
| 49 | patch -p1 < ${WORKDIR}/0004-enable-sshd-by-default-at-bootup.patch |
| 50 | |
developer | cc441a0 | 2022-05-09 19:04:26 +0800 | [diff] [blame] | 51 | touch filogic_patch_applied |
developer | 15a4331 | 2022-04-12 11:23:23 +0800 | [diff] [blame] | 52 | fi |
| 53 | } |
| 54 | |
developer | 783a8a6 | 2024-01-17 12:34:31 +0800 | [diff] [blame] | 55 | do_filogic_patches-append() { |
developer | 15a4331 | 2022-04-12 11:23:23 +0800 | [diff] [blame] | 56 | cd ${S} |
developer | cc441a0 | 2022-05-09 19:04:26 +0800 | [diff] [blame] | 57 | if [ ! -e dunfell_filogic_patch_applied ]; then |
developer | 15a4331 | 2022-04-12 11:23:23 +0800 | [diff] [blame] | 58 | patch -p1 < ${WORKDIR}/0001-Work-around-for-brlan0-issue.patch |
| 59 | fi |
developer | cc441a0 | 2022-05-09 19:04:26 +0800 | [diff] [blame] | 60 | touch dunfell_filogic_patch_applied |
developer | 15a4331 | 2022-04-12 11:23:23 +0800 | [diff] [blame] | 61 | } |
| 62 | |
developer | cc441a0 | 2022-05-09 19:04:26 +0800 | [diff] [blame] | 63 | addtask filogic_patches after do_unpack before do_compile |
developer | 15a4331 | 2022-04-12 11:23:23 +0800 | [diff] [blame] | 64 | |
| 65 | do_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 |
developer | cc441a0 | 2022-05-09 19:04:26 +0800 | [diff] [blame] | 116 | #filogic uses default service_bridge.sh for now |
developer | 6172cdb | 2023-12-02 02:26:13 +0000 | [diff] [blame] | 117 | install -m 755 ${WORKDIR}/service_bridge_mtk.sh ${D}${sysconfdir}/utopia/service.d/service_bridge.sh |
developer | 15a4331 | 2022-04-12 11:23:23 +0800 | [diff] [blame] | 118 | |
| 119 | install -m 755 ${WORKDIR}/dhcp_script.sh ${D}${sysconfdir}/ |
developer | fea7f52 | 2023-02-16 17:32:51 +0800 | [diff] [blame] | 120 | |
| 121 | #change default log level to 8 |
| 122 | sed -i 's/level=6/level=8/g' ${D}${sbindir}/log_start.sh |
developer | 15a4331 | 2022-04-12 11:23:23 +0800 | [diff] [blame] | 123 | |
| 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 | |
developer | cc441a0 | 2022-05-09 19:04:26 +0800 | [diff] [blame] | 165 | #MSG_QUEUE files are not present in Filogic |
developer | 15a4331 | 2022-04-12 11:23:23 +0800 | [diff] [blame] | 166 | sed -i '/TOT_MSG_MAX=\$/ s/^/#/g' ${D}${sysconfdir}/utopia/utopia_init.sh |
| 167 | |
developer | cc441a0 | 2022-05-09 19:04:26 +0800 | [diff] [blame] | 168 | echo "###Filogic specific lines###" >> ${D}${sysconfdir}/utopia/utopia_init.sh |
developer | 15a4331 | 2022-04-12 11:23:23 +0800 | [diff] [blame] | 169 | 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 \ |
| 188 | mkdir -p \/tmp\/dibbler ' ${D}${sysconfdir}/utopia/utopia_init.sh |
| 189 | |
| 190 | sed -i '/log_capture_path.sh/a \ |
| 191 | mkdir -p \/nvram \ |
| 192 | rm -f \/nvram\/dnsmasq.leases \ |
| 193 | cp \/usr\/ccsp\/ccsp_msg.cfg \/tmp \ |
| 194 | touch \/tmp\/cp_subsys_ert \ |
| 195 | ln -s \/var\/spool\/cron\/crontabs \/ \ |
| 196 | mkdir -p \/var\/run\/firewall \ |
| 197 | touch \/nvram\/ETHWAN_ENABLE ' ${D}${sysconfdir}/utopia/utopia_init.sh |
| 198 | |
developer | de36400 | 2022-04-21 20:09:41 +0800 | [diff] [blame] | 199 | 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 |
developer | 15a4331 | 2022-04-12 11:23:23 +0800 | [diff] [blame] | 202 | sed -i '/lan-status started/a \ |
| 203 | sysevent 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 | |
developer | 15a4331 | 2022-04-12 11:23:23 +0800 | [diff] [blame] | 210 | |
| 211 | FILES_${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 | |
developer | cc441a0 | 2022-05-09 19:04:26 +0800 | [diff] [blame] | 221 | # 0001-fix-lan-handler-for-filogic.patch contains bash specific syntax which doesn't run with busybox sh |
developer | 15a4331 | 2022-04-12 11:23:23 +0800 | [diff] [blame] | 222 | RDEPENDS_${PN} += "bash" |
| 223 | |