[Add meta-cmf-filogic sdk cmf for rdkb development]
[Description]
Add meta-cmf-filogic sdk cmf for rdkb development
1. rdkb base on dunfell rdkb-next (> 2022q1)
2. cmf is mostly from meta-turris implementation
3. some 64bit support are port from rp4-64 cmf
4. arm64/arm 32bit bsp both can run on rdkb
[Release-log]
N/A
diff --git a/recipes-ccsp/ccsp/ccsp-adv-security.bbappend b/recipes-ccsp/ccsp/ccsp-adv-security.bbappend
new file mode 100644
index 0000000..1836ce2
--- /dev/null
+++ b/recipes-ccsp/ccsp/ccsp-adv-security.bbappend
@@ -0,0 +1 @@
+require ccsp_common_turris.inc
diff --git a/recipes-ccsp/ccsp/ccsp-cm-agent.bbappend b/recipes-ccsp/ccsp/ccsp-cm-agent.bbappend
new file mode 100644
index 0000000..b6d875c
--- /dev/null
+++ b/recipes-ccsp/ccsp/ccsp-cm-agent.bbappend
@@ -0,0 +1,18 @@
+require ccsp_common_turris.inc
+
+DEPENDS_append_dunfell = " safec"
+LDFLAGS_append_dunfell = " -lsafec-3.5.1"
+
+EXTRA_OECONF_remove = " ${@bb.utils.contains('DISTRO_FEATURES', 'rdkb_wan_manager', '--enable-wanmgr', '', d)}"
+
+do_install_append() {
+ # Config files and scripts
+ install -m 644 ${S}/config-arm/CcspCMDM.cfg ${D}${prefix}/ccsp/cm/CcspCMDM.cfg
+ install -m 644 ${S}/config-arm/CcspCM.cfg ${D}${prefix}/ccsp/cm/CcspCM.cfg
+ install -m 644 ${S}/config-arm/TR181-CM.XML ${D}${prefix}/ccsp/cm/TR181-CM.XML
+
+ # delete files that are installed by some other package
+ rm -f ${D}/usr/include/ccsp/cosa_apis.h
+ rm -f ${D}/usr/include/ccsp/cosa_apis_busutil.h
+ rm -f ${D}/usr/include/ccsp/cosa_dml_api_common.h
+}
diff --git a/recipes-ccsp/ccsp/ccsp-common-library.bbappend b/recipes-ccsp/ccsp/ccsp-common-library.bbappend
new file mode 100644
index 0000000..a937b22
--- /dev/null
+++ b/recipes-ccsp/ccsp/ccsp-common-library.bbappend
@@ -0,0 +1,186 @@
+require ccsp_common_turris.inc
+
+FILESEXTRAPATHS_prepend := "${THISDIR}/${PN}:${THISDIR}/files:"
+
+DEPENDS_append_turris = " breakpad"
+CXXFLAGS_append_turris = " \
+ -I${STAGING_INCDIR}/breakpad \
+ -std=c++11 \
+ "
+
+SRC_URI_append = " \
+ file://ccsp_vendor.h \
+ file://wifiinitialized.service \
+ file://checkturriswifisupport.service \
+ file://wifiinitialized.path \
+ file://turriswifiinitialized.path \
+ file://checkturriswifisupport.path \
+ file://wifi-initialized.target \
+ file://utopia.service \
+"
+
+SRC_URI_remove_dunfell = "file://0001-DBusLoop-SSL_state-TLS_ST_OK.patch"
+SRC_URI_remove_dunfell = "file://0001-SSLeay_add_all_algorithms-remove-in-openssl-1.1.patch"
+
+SRC_URI += "file://0003-add-dependency-to-pandm.patch;apply=no"
+SRC_URI += "file://0004-remove-psm-db-reference.patch;apply=no"
+SRC_URI_append_dunfell = " file://0001-DBusLoop-SSL_state-TLS_ST_OK.patch;apply=no"
+SRC_URI_append_dunfell = " file://0001-SSLeay_add_all_algorithms-remove-in-openssl-1.1.patch;apply=no"
+
+
+# we need to patch to code for Turris
+do_turris_patches() {
+ cd ${S}
+ if [ ! -e patch_applied ]; then
+ patch -p1 < ${WORKDIR}/0003-add-dependency-to-pandm.patch
+ patch -p1 < ${WORKDIR}/0004-remove-psm-db-reference.patch
+ if [ "${@bb.utils.contains('DISTRO_CODENAME', 'dunfell', 'dunfell', '', d)}" = "dunfell" ] ; then
+ patch -p1 < ${WORKDIR}/0001-DBusLoop-SSL_state-TLS_ST_OK.patch
+ patch -p1 < ${WORKDIR}/0001-SSLeay_add_all_algorithms-remove-in-openssl-1.1.patch
+ fi
+ touch patch_applied
+ fi
+}
+addtask turris_patches after do_unpack before do_compile
+
+do_install_append_class-target(){
+ # Config files and scripts
+ install -m 777 ${S}/scripts/cli_start_arm.sh ${D}/usr/ccsp/cli_start.sh
+ install -m 777 ${S}/scripts/cosa_start_arm.sh ${D}/usr/ccsp/cosa_start.sh
+
+ # we need unix socket path
+ echo "unix:path=/var/run/dbus/system_bus_socket" > ${S}/config/ccsp_msg.cfg
+ install -m 644 ${S}/config/ccsp_msg.cfg ${D}/usr/ccsp/ccsp_msg.cfg
+ install -m 644 ${S}/config/ccsp_msg.cfg ${D}/usr/ccsp/cm/ccsp_msg.cfg
+ install -m 644 ${S}/config/ccsp_msg.cfg ${D}/usr/ccsp/mta/ccsp_msg.cfg
+ install -m 644 ${S}/config/ccsp_msg.cfg ${D}/usr/ccsp/pam/ccsp_msg.cfg
+ install -m 644 ${S}/config/ccsp_msg.cfg ${D}/usr/ccsp/tr069pa/ccsp_msg.cfg
+
+ install -m 777 ${S}/systemd_units/scripts/ccspSysConfigEarly.sh ${D}/usr/ccsp/ccspSysConfigEarly.sh
+ install -m 777 ${S}/systemd_units/scripts/ccspSysConfigLate.sh ${D}/usr/ccsp/ccspSysConfigLate.sh
+ install -m 777 ${S}/systemd_units/scripts/utopiaInitCheck.sh ${D}/usr/ccsp/utopiaInitCheck.sh
+ install -m 777 ${S}/systemd_units/scripts/ccspPAMCPCheck.sh ${D}/usr/ccsp/ccspPAMCPCheck.sh
+
+ install -m 777 ${S}/systemd_units/scripts/ProcessResetCheck.sh ${D}/usr/ccsp/ProcessResetCheck.sh
+ sed -i -e "s/source \/rdklogger\/logfiles.sh;syncLogs_nvram2/#source \/rdklogger\/logfiles.sh;syncLogs_nvram2/g" ${D}/usr/ccsp/ProcessResetCheck.sh
+ # install systemd services
+ install -d ${D}${systemd_unitdir}/system
+ install -D -m 0644 ${S}/systemd_units/ccspwifiagent.service ${D}${systemd_unitdir}/system/ccspwifiagent.service
+ install -D -m 0644 ${S}/systemd_units/CcspCrSsp.service ${D}${systemd_unitdir}/system/CcspCrSsp.service
+ install -D -m 0644 ${S}/systemd_units/CcspPandMSsp.service ${D}${systemd_unitdir}/system/CcspPandMSsp.service
+ install -D -m 0644 ${S}/systemd_units/PsmSsp.service ${D}${systemd_unitdir}/system/PsmSsp.service
+ install -D -m 0644 ${S}/systemd_units/rdkbLogMonitor.service ${D}${systemd_unitdir}/system/rdkbLogMonitor.service
+ install -D -m 0644 ${S}/systemd_units/CcspTandDSsp.service ${D}${systemd_unitdir}/system/CcspTandDSsp.service
+ install -D -m 0644 ${S}/systemd_units/CcspLMLite.service ${D}${systemd_unitdir}/system/CcspLMLite.service
+ install -D -m 0644 ${S}/systemd_units/CcspTr069PaSsp.service ${D}${systemd_unitdir}/system/CcspTr069PaSsp.service
+ install -D -m 0644 ${S}/systemd_units/snmpSubAgent.service ${D}${systemd_unitdir}/system/snmpSubAgent.service
+ install -D -m 0644 ${S}/systemd_units/snmpSubAgent.service ${D}${systemd_unitdir}/system/snmpSubAgent.service
+ install -D -m 0644 ${S}/systemd_units/CcspEthAgent.service ${D}${systemd_unitdir}/system/CcspEthAgent.service
+
+ #rfc service file
+ install -D -m 0644 ${S}/systemd_units/rfc.service ${D}${systemd_unitdir}/system/rfc.service
+
+ install -D -m 0644 ${WORKDIR}/wifiinitialized.service ${D}${systemd_unitdir}/system/wifiinitialized.service
+ install -D -m 0644 ${WORKDIR}/checkturriswifisupport.service ${D}${systemd_unitdir}/system/checkturriswifisupport.service
+
+ install -D -m 0644 ${WORKDIR}/wifiinitialized.path ${D}${systemd_unitdir}/system/wifiinitialized.path
+ install -D -m 0644 ${WORKDIR}/turriswifiinitialized.path ${D}${systemd_unitdir}/system/turriswifiinitialized.path
+ install -D -m 0644 ${WORKDIR}/checkturriswifisupport.path ${D}${systemd_unitdir}/system/checkturriswifisupport.path
+
+ install -D -m 0644 ${WORKDIR}/wifi-initialized.target ${D}${systemd_unitdir}/system/wifi-initialized.target
+
+ install -D -m 0644 ${S}/systemd_units/ProcessResetDetect.service ${D}${systemd_unitdir}/system/ProcessResetDetect.service
+ install -D -m 0644 ${S}/systemd_units/ProcessResetDetect.path ${D}${systemd_unitdir}/system/ProcessResetDetect.path
+
+ # Install wrapper for breakpad (disabled to support External Source build)
+ #install -d ${D}${includedir}/ccsp
+ #install -m 644 ${S}/source/breakpad_wrapper/include/breakpad_wrapper.h ${D}${includedir}/ccsp
+
+ # Install "vendor information"
+ install -m 0644 ${WORKDIR}/ccsp_vendor.h ${D}${includedir}/ccsp
+
+ sed -i -- 's/NotifyAccess=.*/#NotifyAccess=main/g' ${D}${systemd_unitdir}/system/CcspCrSsp.service
+ sed -i -- 's/notify.*/forking/g' ${D}${systemd_unitdir}/system/CcspCrSsp.service
+
+ #copy rfc.properties into nvram
+ sed -i '/ExecStartPre/ a\ExecStartPre=-/bin/cp /etc/rfc.properties /nvram/' ${D}${systemd_unitdir}/system/rfc.service
+ #reduce sleep time to 12 sconds
+ sed -i 's/300/12/g' ${D}${systemd_unitdir}/system/rfc.service
+
+ #change for turris omnia
+ sed -i 's/PIDFile/#&/' ${D}${systemd_unitdir}/system/CcspPandMSsp.service
+
+ #WanManager - RdkWanManager.service
+ DISTRO_WAN_ENABLED="${@bb.utils.contains('DISTRO_FEATURES','rdkb_wan_manager','true','false',d)}"
+ if [ $DISTRO_WAN_ENABLED = 'true' ]; then
+ install -D -m 0644 ${S}/systemd_units/RdkWanManager.service ${D}${systemd_unitdir}/system/RdkWanManager.service
+ sed -i "/WorkingDirectory/a ExecStartPre=/bin/sh /lib/rdk/run_rm_key.sh" ${D}${systemd_unitdir}/system/RdkWanManager.service
+ sed -i "s/After=CcspCrSsp.service/After=CcspCrSsp.service utopia.service/g" ${D}${systemd_unitdir}/system/RdkWanManager.service
+ sed -i "s/CcspPandMSsp.service/CcspCrSsp.service CcspPandMSsp.service/g" ${D}${systemd_unitdir}/system/CcspEthAgent.service
+ install -D -m 0644 ${WORKDIR}/utopia.service ${D}${systemd_unitdir}/system/utopia.service
+ install -D -m 0644 ${S}/systemd_units/RdkTelcoVoiceManager.service ${D}${systemd_unitdir}/system/RdkTelcoVoiceManager.service
+ install -D -m 0644 ${S}/systemd_units/RdkVlanManager.service ${D}${systemd_unitdir}/system/RdkVlanManager.service
+ fi
+
+ ##### erouter0 ip issue
+ sed -i '/Factory/a \
+IsErouterRunningStatus=\`ifconfig erouter0 | grep RUNNING | grep -v grep | wc -l\` \
+if [ \"\$IsErouterRunningStatus\" == 0 ]; then \
+ethtool -s erouter0 speed 1000 \
+fi' ${D}/usr/ccsp/ccspPAMCPCheck.sh
+
+}
+
+do_install_append_dunfell_class-target () {
+ #for yocto 3.1, Making psm to run after gwprovethwan
+ sed -i '/CcspCrSsp.service/c After=CcspCrSsp.service gwprovethwan.service' ${D}${systemd_unitdir}/system/PsmSsp.service
+}
+
+SYSTEMD_SERVICE_${PN} += "ccspwifiagent.service"
+SYSTEMD_SERVICE_${PN} += "CcspCrSsp.service"
+SYSTEMD_SERVICE_${PN} += "CcspPandMSsp.service"
+SYSTEMD_SERVICE_${PN} += "PsmSsp.service"
+SYSTEMD_SERVICE_${PN} += "rdkbLogMonitor.service"
+SYSTEMD_SERVICE_${PN} += "CcspTandDSsp.service"
+SYSTEMD_SERVICE_${PN} += "CcspLMLite.service"
+SYSTEMD_SERVICE_${PN} += "CcspTr069PaSsp.service"
+SYSTEMD_SERVICE_${PN} += "snmpSubAgent.service"
+SYSTEMD_SERVICE_${PN} += "CcspEthAgent.service"
+SYSTEMD_SERVICE_${PN} += "wifiinitialized.service"
+SYSTEMD_SERVICE_${PN} += "checkturriswifisupport.service"
+SYSTEMD_SERVICE_${PN} += "wifiinitialized.path"
+SYSTEMD_SERVICE_${PN} += "turriswifiinitialized.path"
+SYSTEMD_SERVICE_${PN} += "checkturriswifisupport.path"
+SYSTEMD_SERVICE_${PN} += "wifi-initialized.target"
+SYSTEMD_SERVICE_${PN} += "ProcessResetDetect.path"
+SYSTEMD_SERVICE_${PN} += "ProcessResetDetect.service"
+SYSTEMD_SERVICE_${PN} += "rfc.service"
+SYSTEMD_SERVICE_${PN} += "${@bb.utils.contains('DISTRO_FEATURES', 'rdkb_wan_manager', 'RdkWanManager.service utopia.service ', '', d)}"
+
+FILES_${PN}_append = " \
+ /usr/ccsp/ccspSysConfigEarly.sh \
+ /usr/ccsp/ccspSysConfigLate.sh \
+ /usr/ccsp/utopiaInitCheck.sh \
+ /usr/ccsp/ccspPAMCPCheck.sh \
+ /usr/ccsp/ProcessResetCheck.sh \
+ ${systemd_unitdir}/system/ccspwifiagent.service \
+ ${systemd_unitdir}/system/CcspCrSsp.service \
+ ${systemd_unitdir}/system/CcspPandMSsp.service \
+ ${systemd_unitdir}/system/PsmSsp.service \
+ ${systemd_unitdir}/system/rdkbLogMonitor.service \
+ ${systemd_unitdir}/system/CcspTandDSsp.service \
+ ${systemd_unitdir}/system/CcspLMLite.service \
+ ${systemd_unitdir}/system/CcspTr069PaSsp.service \
+ ${systemd_unitdir}/system/snmpSubAgent.service \
+ ${systemd_unitdir}/system/CcspEthAgent.service \
+ ${systemd_unitdir}/system/wifiinitialized.service \
+ ${systemd_unitdir}/system/checkturriswifisupport.service \
+ ${systemd_unitdir}/system/wifiinitialized.path \
+ ${systemd_unitdir}/system/turriswifiinitialized.path \
+ ${systemd_unitdir}/system/checkturriswifisupport.path \
+ ${systemd_unitdir}/system/wifi-initialized.target \
+ ${systemd_unitdir}/system/ProcessResetDetect.path \
+ ${systemd_unitdir}/system/ProcessResetDetect.service \
+ ${systemd_unitdir}/system/rfc.service \
+"
+FILES_${PN}_append = "${@bb.utils.contains('DISTRO_FEATURES', 'rdkb_wan_manager', ' ${systemd_unitdir}/system/RdkWanManager.service ${systemd_unitdir}/system/utopia.service ${systemd_unitdir}/system/RdkVlanManager.service ${systemd_unitdir}/system/RdkTelcoVoiceManager.service ', '', d)}"
diff --git a/recipes-ccsp/ccsp/ccsp-common-library/0001-DBusLoop-SSL_state-TLS_ST_OK.patch b/recipes-ccsp/ccsp/ccsp-common-library/0001-DBusLoop-SSL_state-TLS_ST_OK.patch
new file mode 100644
index 0000000..770abff
--- /dev/null
+++ b/recipes-ccsp/ccsp/ccsp-common-library/0001-DBusLoop-SSL_state-TLS_ST_OK.patch
@@ -0,0 +1,52 @@
+From d69f7dc3304bb5dd8803cef63a1a96e7c102e153 Mon Sep 17 00:00:00 2001
+From: Jaga <jagadheesan_duraisamy@comcast.com>
+Date: Mon, 6 Apr 2020 17:29:42 +0000
+Subject: [PATCH] DBusLoop-SSL_state-TLS_ST_OK
+
+Reason for change: typedef DBusLoop struct, changed ssl->state
+to SSL_state(ssl) for openssl > 1.1 and SSL_get_state(ssl) for openssl >
+1.1.1
+
+Source: COMCAST
+License: Apache-2.0
+Upstream-Status: Pending
+Signed-off-by: Jaga <jagadheesan_duraisamy@comcast.com>
+---
+ source/ccsp/include/ccsp_message_bus.h | 2 ++
+ source/util_api/ansc/AnscPlatform/user_openssl.c | 10 +++++++++-
+ 2 files changed, 11 insertions(+), 1 deletion(-)
+
+diff --git a/source/ccsp/include/ccsp_message_bus.h b/source/ccsp/include/ccsp_message_bus.h
+index 9fb9aae9..7c315be0 100644
+--- a/source/ccsp/include/ccsp_message_bus.h
++++ b/source/ccsp/include/ccsp_message_bus.h
+@@ -153,6 +153,8 @@ typedef struct _CCSP_MESSAGE_FILTER
+
+ } CCSP_MESSAGE_FILTER;
+
++typedef struct DBusLoop DBusLoop;
++
+ typedef struct _CCSP_MESSAGE_BUS_CONNECTION
+ {
+ DBusConnection *conn;
+diff --git a/source/util_api/ansc/AnscPlatform/user_openssl.c b/source/util_api/ansc/AnscPlatform/user_openssl.c
+index 7e5c2c7d..6d1f4f51 100644
+--- a/source/util_api/ansc/AnscPlatform/user_openssl.c
++++ b/source/util_api/ansc/AnscPlatform/user_openssl.c
+@@ -392,7 +392,15 @@ SSL * openssl_connect (int fd)
+
+ SSL_set_connect_state (ssl);
+
+- if (SSL_connect (ssl) <= 0 || ssl->state != SSL_ST_OK)
++ if (SSL_connect (ssl) <= 0 ||
++#if (OPENSSL_VERSION_NUMBER >= 0x10101000L)
++ SSL_get_state(ssl) != TLS_ST_OK)
++#elif (OPENSSL_VERSION_NUMBER >= 0x10100000L)
++ SSL_state(ssl) != TLS_ST_OK)
++#else
++ ssl->state != SSL_ST_OK)
++#endif
++
+ {
+ AnscTraceWarning(("openssl_connect - failed in SSL_set_connect_state \n"));
+ goto error;
diff --git a/recipes-ccsp/ccsp/ccsp-common-library/0001-SSLeay_add_all_algorithms-remove-in-openssl-1.1.patch b/recipes-ccsp/ccsp/ccsp-common-library/0001-SSLeay_add_all_algorithms-remove-in-openssl-1.1.patch
new file mode 100644
index 0000000..2cca4be
--- /dev/null
+++ b/recipes-ccsp/ccsp/ccsp-common-library/0001-SSLeay_add_all_algorithms-remove-in-openssl-1.1.patch
@@ -0,0 +1,30 @@
+From d1b13416095d4fe513ee739de179913222539993 Mon Sep 17 00:00:00 2001
+From: Jaga <jagadheesan_duraisamy@comcast.com>
+Date: Mon, 6 Apr 2020 18:35:17 +0000
+Subject: [PATCH] SSLeay_add_all_algorithms remove in openssl 1.1
+
+Reason for change: Remove deprecated API SSLeay_add_all_algorithms for
+openssl 1.1 and above
+
+Source: COMCAST
+License: Apache-2.0
+Upstream-Status: Pending
+Signed-off-by: Jaga <jagadheesan_duraisamy@comcast.com>
+---
+ source/util_api/ansc/AnscPlatform/user_openssl.c | 2 ++
+ 1 file changed, 2 insertions(+)
+
+diff --git a/source/util_api/ansc/AnscPlatform/user_openssl.c b/source/util_api/ansc/AnscPlatform/user_openssl.c
+index 0d74871f..4cac8483 100644
+--- a/source/util_api/ansc/AnscPlatform/user_openssl.c
++++ b/source/util_api/ansc/AnscPlatform/user_openssl.c
+@@ -68,7 +68,9 @@ void initialize_openssl_lib()
+
+ SSL_library_init ();
+ SSL_load_error_strings ();
++#if OPENSSL_VERSION_NUMBER < 0x10100000L
+ SSLeay_add_all_algorithms ();
++#endif
+ SSLeay_add_ssl_algorithms ();
+ }
+
diff --git a/recipes-ccsp/ccsp/ccsp-common-library/0001-breakpad-wrapper.patch b/recipes-ccsp/ccsp/ccsp-common-library/0001-breakpad-wrapper.patch
new file mode 100644
index 0000000..8e3dcd7
--- /dev/null
+++ b/recipes-ccsp/ccsp/ccsp-common-library/0001-breakpad-wrapper.patch
@@ -0,0 +1,81 @@
+--- a/source/breakpad_wrapper/breakpad_wrapper.cpp
++++ b/source/breakpad_wrapper/breakpad_wrapper.cpp
+@@ -0,0 +1,20 @@
++#include <client/linux/handler/exception_handler.h>
++// called by 'google_breakpad::ExceptionHandler' on every crash
++namespace
++{
++bool breakpadCallback(const google_breakpad::MinidumpDescriptor& descriptor, void* context, bool succeeded)
++{
++ (void) descriptor;
++ (void) context;
++ return succeeded;
++}
++// Instantiate only one 'google_breakpad::ExceptionHandler'
++// - "/opt/minidumps" is canonical path that should be in sync with uploadDumps.sh script
++extern "C" void breakpad_ExceptionHandler()
++{
++ static google_breakpad::ExceptionHandler* excHandler = NULL;
++ delete excHandler;
++ excHandler = new google_breakpad::ExceptionHandler(google_breakpad::MinidumpDescriptor("/opt/minidumps"), NULL, breakpadCallback, NULL, true, -1);
++}
++}
++
+--- a/source/breakpad_wrapper/include/breakpad_wrapper.h
++++ b/source/breakpad_wrapper/include/breakpad_wrapper.h
+@@ -0,0 +1,8 @@
++#ifdef __cplusplus
++extern "C"
++{
++#endif
++void breakpad_ExceptionHandler();
++#ifdef __cplusplus
++}
++#endif
+--- a/source/Makefile.am
++++ b/source/Makefile.am
+@@ -16,4 +16,4 @@
+ # See the License for the specific language governing permissions and
+ # limitations under the License.
+ ##########################################################################
+-SUBDIRS = cosa debug_api ccsp util_api
++SUBDIRS = cosa debug_api ccsp util_api breakpad_wrapper
+--- a/source/breakpad_wrapper/Makefile.am
++++ b/source/breakpad_wrapper/Makefile.am
+@@ -0,0 +1,8 @@
++AM_CPPFLAGS = -Wall -Werror
++ACLOCAL_AMFLAGS = -I m4
++hardware_platform = i686-linux-gnu
++
++noinst_LTLIBRARIES = libCcspCommonLibrary_breakpad_wrapper.la
++libCcspCommonLibrary_breakpad_wrapper_la_CPPFLAGS = $(CPPFLAGS)
++libCcspCommonLibrary_breakpad_wrapper_la_SOURCES = breakpad_wrapper.cpp
++libCcspCommonLibrary_breakpad_wrapper_la_LDFLAGS = -lbreakpad_client
+--- a/configure.ac
++++ b/configure.ac
+@@ -34,6 +34,7 @@
+
+ # Checks for programs.
+ AC_PROG_CC
++AC_PROG_CXX
+ AC_PROG_INSTALL
+ AM_PROG_CC_C_O
+ AM_PROG_LIBTOOL(libtool)
+@@ -112,6 +113,7 @@
+ source/cosa/package/Makefile
+ source/cosa/Makefile
+ source/debug_api/Makefile
++ source/breakpad_wrapper/Makefile
+ source/ccsp/components/common/PoamIrepFolder/Makefile
+ source/ccsp/components/common/DataModel/dml/components/DslhVarEntity/Makefile
+ source/ccsp/components/common/DataModel/dml/components/DslhObjController/Makefile
+--- a/Makefile.am
++++ b/Makefile.am
+@@ -65,6 +65,7 @@
+ source/cosa/package/bmc2/components/Bmc2ComTerminal/libCcspCommonLibrary_Bmc2ComTerminal.la \
+ source/cosa/package/bmc2/components/Bmc2ComDomain/libCcspCommonLibrary_Bmc2ComDomain.la \
+ source/debug_api/libCcspCommonLibrary_debug_api.la \
++ source/breakpad_wrapper/libCcspCommonLibrary_breakpad_wrapper.la \
+ source/ccsp/components/common/PoamIrepFolder/libCcspCommonLibrary_PoamIrepFolder.la \
+ source/ccsp/components/common/DataModel/dml/components/DslhVarEntity/libCcspCommonLibrary_DslhVarEntity.la \
+ source/ccsp/components/common/DataModel/dml/components/DslhObjController/libCcspCommonLibrary_DslhObjController.la \
diff --git a/recipes-ccsp/ccsp/ccsp-common-library/0003-add-dependency-to-pandm.patch b/recipes-ccsp/ccsp/ccsp-common-library/0003-add-dependency-to-pandm.patch
new file mode 100644
index 0000000..3ff558b
--- /dev/null
+++ b/recipes-ccsp/ccsp/ccsp-common-library/0003-add-dependency-to-pandm.patch
@@ -0,0 +1,13 @@
+diff --git a/systemd_units/CcspPandMSsp.service b/systemd_units/CcspPandMSsp.service
+index 192724d5..fe49033f 100644
+--- a/systemd_units/CcspPandMSsp.service
++++ b/systemd_units/CcspPandMSsp.service
+@@ -19,7 +19,7 @@
+ [Unit]
+ Description=CcspPandMSsp service
+
+-After=PsmSsp.service
++After=gwprovethwan.service PsmSsp.service
+
+ [Service]
+ Type=forking
diff --git a/recipes-ccsp/ccsp/ccsp-common-library/0004-remove-psm-db-reference.patch b/recipes-ccsp/ccsp/ccsp-common-library/0004-remove-psm-db-reference.patch
new file mode 100644
index 0000000..dd98f1c
--- /dev/null
+++ b/recipes-ccsp/ccsp/ccsp-common-library/0004-remove-psm-db-reference.patch
@@ -0,0 +1,12 @@
+diff --git a/systemd_units/PsmSsp.service b/systemd_units/PsmSsp.service
+index cb4d530d..648a55f9 100644
+--- a/systemd_units/PsmSsp.service
++++ b/systemd_units/PsmSsp.service
+@@ -29,7 +29,6 @@ Environment="Subsys=eRT."
+ Environment="LOG4C_RCPATH=/etc"
+ EnvironmentFile=/etc/device.properties
+ ExecStartPre=/bin/sh -c '(/usr/ccsp/utopiaInitCheck.sh)'
+-ExecStartPre=/bin/sh -c '(/usr/ccsp/log_psm.db.sh)'
+ ExecStart=/usr/bin/PsmSsp -subsys $Subsys
+ ExecStop=/bin/sh -c 'echo "`date`: Stopping/Restarting PsmSsp" >> ${PROCESS_RESTART_LOG}'
+ Restart=always
diff --git a/recipes-ccsp/ccsp/ccsp-common-library/ccsp_vendor.h b/recipes-ccsp/ccsp/ccsp-common-library/ccsp_vendor.h
new file mode 100644
index 0000000..d942c1f
--- /dev/null
+++ b/recipes-ccsp/ccsp/ccsp-common-library/ccsp_vendor.h
@@ -0,0 +1,22 @@
+/*
+If not stated otherwise in this file or this component's LICENSE
+file the following copyright and licenses apply:
+
+Copyright [2019] [RDK Management]
+
+Licensed under the Apache License, Version 2.0 (the "License");
+you may not use this file except in compliance with the License.
+You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+Unless required by applicable law or agreed to in writing, software
+distributed under the License is distributed on an "AS IS" BASIS,
+WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+See the License for the specific language governing permissions and
+limitations under the License.
+*/
+
+#define CONFIG_VENDOR_NAME "Turris CZ"
+#define CONFIG_VENDOR_ID "0xFFFFFFFE"
+#define CONFIG_TI_GW_DESCRIPTION "Turris Omnia Gateway device"
diff --git a/recipes-ccsp/ccsp/ccsp-common-library/checkturriswifisupport.path b/recipes-ccsp/ccsp/ccsp-common-library/checkturriswifisupport.path
new file mode 100644
index 0000000..4f9c8d8
--- /dev/null
+++ b/recipes-ccsp/ccsp/ccsp-common-library/checkturriswifisupport.path
@@ -0,0 +1,9 @@
+[Unit]
+Description=Check Turris Wifi Support Initialized Path
+
+[Path]
+PathExists=/tmp/pam_initialized
+Unit=checkturriswifisupport.service
+
+[Install]
+WantedBy=multi-user.target
diff --git a/recipes-ccsp/ccsp/ccsp-common-library/checkturriswifisupport.service b/recipes-ccsp/ccsp/ccsp-common-library/checkturriswifisupport.service
new file mode 100644
index 0000000..e92810f
--- /dev/null
+++ b/recipes-ccsp/ccsp/ccsp-common-library/checkturriswifisupport.service
@@ -0,0 +1,7 @@
+[Unit]
+Description=Check WIFI support on Turris Omnia device
+After=hostapd.service
+
+[Service]
+Type=forking
+ExecStart=/bin/sh -c '/usr/ccsp/wifi/checkwifi.sh'
diff --git a/recipes-ccsp/ccsp/ccsp-common-library/gwprovapp.conf b/recipes-ccsp/ccsp/ccsp-common-library/gwprovapp.conf
new file mode 100644
index 0000000..dde640b
--- /dev/null
+++ b/recipes-ccsp/ccsp/ccsp-common-library/gwprovapp.conf
@@ -0,0 +1,6 @@
+[Unit]
+After=network.target
+Wants=network.target
+
+[Service]
+ExecStart=/usr/bin/gw_prov_utopia
diff --git a/recipes-ccsp/ccsp/ccsp-common-library/turriswifiinitialized.path b/recipes-ccsp/ccsp/ccsp-common-library/turriswifiinitialized.path
new file mode 100644
index 0000000..5b4da66
--- /dev/null
+++ b/recipes-ccsp/ccsp/ccsp-common-library/turriswifiinitialized.path
@@ -0,0 +1,9 @@
+[Unit]
+Description=TurrisOmnia WIFI Initialized Path
+
+[Path]
+PathExists=/tmp/wifi_driver_initialized
+Unit=ccspwifiagent.service
+
+[Install]
+WantedBy=multi-user.target
diff --git a/recipes-ccsp/ccsp/ccsp-common-library/utopia.service b/recipes-ccsp/ccsp/ccsp-common-library/utopia.service
new file mode 100644
index 0000000..7df68b3
--- /dev/null
+++ b/recipes-ccsp/ccsp/ccsp-common-library/utopia.service
@@ -0,0 +1,34 @@
+##########################################################################
+# If not stated otherwise in this file or this component's Licenses.txt
+# file the following copyright and licenses apply:
+#
+# Copyright 2021 RDK Management
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+##########################################################################
+[Unit]
+Description=Utopia service
+
+After=mount-nonvol.service
+
+[Service]
+Type=forking
+WorkingDirectory=/etc/utopia
+EnvironmentFile=/etc/device.properties
+ExecStart=/bin/sh /etc/utopia/utopia_init.sh
+ExecStop=/bin/sh -c 'echo "Stopping/Restarting utopia_init.sh" >> ${PROCESS_RESTART_LOG}'
+
+StandardOutput=syslog+console
+
+[Install]
+WantedBy=multi-user.target
diff --git a/recipes-ccsp/ccsp/ccsp-common-library/wifi-initialized.target b/recipes-ccsp/ccsp/ccsp-common-library/wifi-initialized.target
new file mode 100644
index 0000000..c6c1057
--- /dev/null
+++ b/recipes-ccsp/ccsp/ccsp-common-library/wifi-initialized.target
@@ -0,0 +1,3 @@
+[Unit]
+Description=WiFi Initialization Complete
+Documentation=man:systemd.special(7)
diff --git a/recipes-ccsp/ccsp/ccsp-common-library/wifiinitialized.path b/recipes-ccsp/ccsp/ccsp-common-library/wifiinitialized.path
new file mode 100644
index 0000000..4cb7b45
--- /dev/null
+++ b/recipes-ccsp/ccsp/ccsp-common-library/wifiinitialized.path
@@ -0,0 +1,9 @@
+[Unit]
+Description= WiFi Initialized Path
+
+[Path]
+PathExists=/tmp/wifi_initialized
+Unit=wifi-initialized.target
+
+[Install]
+WantedBy=multi-user.target
diff --git a/recipes-ccsp/ccsp/ccsp-common-library/wifiinitialized.service b/recipes-ccsp/ccsp/ccsp-common-library/wifiinitialized.service
new file mode 100644
index 0000000..1fd98d6
--- /dev/null
+++ b/recipes-ccsp/ccsp/ccsp-common-library/wifiinitialized.service
@@ -0,0 +1,9 @@
+[Unit]
+Description=WiFi Initialized service
+
+[Service]
+Type=simple
+ExecStart=/bin/echo "Wifi is initialized"
+RemainAfterExit=yes
+
+StandardOutput=syslog
diff --git a/recipes-ccsp/ccsp/ccsp-cr.bbappend b/recipes-ccsp/ccsp/ccsp-cr.bbappend
new file mode 100644
index 0000000..9362db4
--- /dev/null
+++ b/recipes-ccsp/ccsp/ccsp-cr.bbappend
@@ -0,0 +1,14 @@
+require ccsp_common_turris.inc
+FILESEXTRAPATHS_prepend := "${THISDIR}/${PN}:"
+
+SRC_URI_append = " \
+ file://cr-deviceprofile_turris.xml \
+"
+
+do_install_append() {
+ # Config files and scripts
+ install -m 644 ${WORKDIR}/cr-deviceprofile_turris.xml ${D}/usr/ccsp/cr-deviceprofile.xml
+ install -m 644 ${WORKDIR}/cr-deviceprofile_turris.xml ${D}/usr/ccsp/cr-ethwan-deviceprofile.xml
+}
+
+LDFLAGS_append_dunfell = " -lpthread -lbreakpadwrapper"
diff --git a/recipes-ccsp/ccsp/ccsp-cr/cr-deviceprofile_turris.xml b/recipes-ccsp/ccsp/ccsp-cr/cr-deviceprofile_turris.xml
new file mode 100755
index 0000000..ac1d23e
--- /dev/null
+++ b/recipes-ccsp/ccsp/ccsp-cr/cr-deviceprofile_turris.xml
@@ -0,0 +1,56 @@
+<?xml version="1.0" encoding="utf-8" ?>
+
+<deviceProfile>
+ <!-- Different CR must have different names -->
+ <name>com.cisco.spvtg.ccsp.CR</name>
+ <version>1</version>
+ <deviceName>VideoScape EP1.0</deviceName>
+ <components>
+ <component>
+ <name>com.cisco.spvtg.ccsp.CR</name> <version>1</version>
+ </component>
+ <component>
+ <name>com.cisco.spvtg.ccsp.psm</name> <version>1</version>
+ </component>
+<!--
+ <component>
+ <name>com.cisco.spvtg.ccsp.mta</name> <version>1</version>
+ </component>
+ <component>
+ <name>com.cisco.spvtg.ccsp.cm</name> <version>1</version>
+ </component>
+-->
+ <component>
+ <name>com.cisco.spvtg.ccsp.pam</name> <version>1</version>
+ </component>
+<!--
+ <component>
+ <name>com.cisco.spvtg.ccsp.tr069pa</name> <version>1</version>
+ </component>
+-->
+ <component>
+ <name>com.cisco.spvtg.ccsp.tdm</name> <version>1</version>
+ </component>
+<!--
+ <component>
+ <name>com.cisco.spvtg.ccsp.wecb</name> <version>1</version>
+ </component>
+-->
+ <component>
+ <name>com.cisco.spvtg.ccsp.wifi</name> <version>1</version>
+ </component>
+
+ <component>
+ <name>com.cisco.spvtg.ccsp.lmlite</name> <version>1</version>
+ </component>
+<!--
+ <component>
+ <name>com.cisco.spvtg.ccsp.ssd</name> <version>1</version>
+ </component>
+ <component>
+ <name>com.cisco.spvtg.ccsp.fu</name> <version>1</version>
+ </component>
+-->
+
+ </components>
+</deviceProfile>
diff --git a/recipes-ccsp/ccsp/ccsp-dmcli.bbappend b/recipes-ccsp/ccsp/ccsp-dmcli.bbappend
new file mode 100644
index 0000000..a4fc0c0
--- /dev/null
+++ b/recipes-ccsp/ccsp/ccsp-dmcli.bbappend
@@ -0,0 +1,7 @@
+require ccsp_common_turris.inc
+
+LDFLAGS_append_dunfell = " -lsafec-3.5.1"
+
+do_install_append_turris () {
+ ln -sf ${bindir}/dmcli ${D}${bindir}/ccsp_bus_client_tool
+}
diff --git a/recipes-ccsp/ccsp/ccsp-epon-agent.bbappend b/recipes-ccsp/ccsp/ccsp-epon-agent.bbappend
new file mode 100644
index 0000000..41df9ff
--- /dev/null
+++ b/recipes-ccsp/ccsp/ccsp-epon-agent.bbappend
@@ -0,0 +1,3 @@
+require ccsp_common_turris.inc
+
+LDFLAGS_append_dunfell = " -lbreakpadwrapper"
diff --git a/recipes-ccsp/ccsp/ccsp-eth-agent.bbappend b/recipes-ccsp/ccsp/ccsp-eth-agent.bbappend
new file mode 100644
index 0000000..66dd286
--- /dev/null
+++ b/recipes-ccsp/ccsp/ccsp-eth-agent.bbappend
@@ -0,0 +1,11 @@
+require ccsp_common_turris.inc
+
+CFLAGS_aarch64_append = " -Werror=format-truncation=1 "
+
+EXTRA_OECONF_append = " --with-ccsp-arch=arm"
+
+LDFLAGS_append =" \
+ -lsyscfg \
+ -lbreakpadwrapper \
+"
+LDFLAGS_append_dunfell = " -lpthread -lsafec-3.5.1"
diff --git a/recipes-ccsp/ccsp/ccsp-gwprovapp-epon.bbappend b/recipes-ccsp/ccsp/ccsp-gwprovapp-epon.bbappend
new file mode 100644
index 0000000..1836ce2
--- /dev/null
+++ b/recipes-ccsp/ccsp/ccsp-gwprovapp-epon.bbappend
@@ -0,0 +1 @@
+require ccsp_common_turris.inc
diff --git a/recipes-ccsp/ccsp/ccsp-gwprovapp-ethwan.bbappend b/recipes-ccsp/ccsp/ccsp-gwprovapp-ethwan.bbappend
new file mode 100644
index 0000000..767dd86
--- /dev/null
+++ b/recipes-ccsp/ccsp/ccsp-gwprovapp-ethwan.bbappend
@@ -0,0 +1,31 @@
+require ccsp_common_turris.inc
+
+export PLATFORM_TURRIS_ENABLED="yes"
+
+inherit systemd
+
+DEPENDS_remove_dunfell = "hal-gwprovappabs"
+DEPENDS_append_dunfell = " breakpad-wrapper rdk-logger utopia"
+
+LDFLAGS_remove_dunfell = "-lgwprovappabs"
+
+CFLAGS_append = " -Wno-unused-variable -Wno-sizeof-pointer-memaccess -Wno-unused-parameter -Wno-unused-but-set-variable "
+
+do_install_append () {
+ install -d ${D}${systemd_unitdir}/system
+ install -m 0644 ${S}/service/gwprovethwan.service ${D}${systemd_unitdir}/system
+ sed -i "s/After=rg_network.service/After=network.target/g" ${D}${systemd_unitdir}/system/gwprovethwan.service
+ sed -i "/After=network.target/a wants=network.target" ${D}${systemd_unitdir}/system/gwprovethwan.service
+ sed -e '/Type/ s/^#*/#/' -i ${D}${systemd_unitdir}/system/gwprovethwan.service
+ sed -e '/ExecStartPre/ s/^#*/#/' -i ${D}${systemd_unitdir}/system/gwprovethwan.service
+ sed -i "/utopia_init.sh/a ExecStartPre=-/bin/sh -c 'mkdir -p /rdklogs/logs/'" ${D}${systemd_unitdir}/system/gwprovethwan.service
+ sed -e '/ExecStartPost/ s/^#*/#/' -i ${D}${systemd_unitdir}/system/gwprovethwan.service
+ sed -i "/bin\/rm/a Restart=always" ${D}${systemd_unitdir}/system/gwprovethwan.service
+ sed -i "s/StandardOutput=syslog/StandardOutput=syslog+console/g" ${D}${systemd_unitdir}/system/gwprovethwan.service
+ sed -i "s/wants=/Wants=/" ${D}${systemd_unitdir}/system/gwprovethwan.service
+}
+
+SYSTEMD_SERVICE_${PN} = "gwprovethwan.service"
+FILES_${PN} += " \
+ ${systemd_unitdir}/system/gwprovethwan.service \
+"
diff --git a/recipes-ccsp/ccsp/ccsp-gwprovapp.bbappend b/recipes-ccsp/ccsp/ccsp-gwprovapp.bbappend
new file mode 100644
index 0000000..5121b5f
--- /dev/null
+++ b/recipes-ccsp/ccsp/ccsp-gwprovapp.bbappend
@@ -0,0 +1,23 @@
+FILESEXTRAPATHS_prepend := "${THISDIR}/files:"
+
+require ccsp_common_turris.inc
+
+SRC_URI += " file://turris-macro-gwprov.patch;apply=no"
+SRC_URI += " file://set-uplink-for-turris.patch;apply=no"
+
+# we need to patch to code for Turris
+do_turris_patches() {
+ cd ${S}
+ if [ ! -e patch_applied ]; then
+ patch -p1 < ${WORKDIR}/turris-macro-gwprov.patch
+ patch -p1 < ${WORKDIR}/set-uplink-for-turris.patch
+ touch patch_applied
+ fi
+}
+addtask turris_patches after do_unpack before do_compile
+
+export PLATFORM_TURRIS_ENABLED="yes"
+
+FILES_${PN} += " \
+ /usr/bin/gw_prov_utopia \
+"
diff --git a/recipes-ccsp/ccsp/ccsp-home-security.bbappend b/recipes-ccsp/ccsp/ccsp-home-security.bbappend
new file mode 100644
index 0000000..1836ce2
--- /dev/null
+++ b/recipes-ccsp/ccsp/ccsp-home-security.bbappend
@@ -0,0 +1 @@
+require ccsp_common_turris.inc
diff --git a/recipes-ccsp/ccsp/ccsp-hotspot.bbappend b/recipes-ccsp/ccsp/ccsp-hotspot.bbappend
new file mode 100644
index 0000000..6e99747
--- /dev/null
+++ b/recipes-ccsp/ccsp/ccsp-hotspot.bbappend
@@ -0,0 +1,4 @@
+require ccsp_common_turris.inc
+
+LDFLAGS_append_dunfell = " -lsafec-3.5.1"
+EXTRA_OECONF_append = " --with-ccsp-arch=arm"
diff --git a/recipes-ccsp/ccsp/ccsp-lm-lite.bbappend b/recipes-ccsp/ccsp/ccsp-lm-lite.bbappend
new file mode 100644
index 0000000..b7e65ec
--- /dev/null
+++ b/recipes-ccsp/ccsp/ccsp-lm-lite.bbappend
@@ -0,0 +1,6 @@
+require ccsp_common_turris.inc
+
+EXTRA_OECONF_append = " --with-ccsp-arch=arm"
+
+LDFLAGS_append = " -Wl,--no-as-needed"
+
diff --git a/recipes-ccsp/ccsp/ccsp-logagent.bbappend b/recipes-ccsp/ccsp/ccsp-logagent.bbappend
new file mode 100644
index 0000000..8f3aafc
--- /dev/null
+++ b/recipes-ccsp/ccsp/ccsp-logagent.bbappend
@@ -0,0 +1,3 @@
+require ccsp_common_turris.inc
+
+LDFLAGS_append_dunfell = " -lpthread"
diff --git a/recipes-ccsp/ccsp/ccsp-misc.bbappend b/recipes-ccsp/ccsp/ccsp-misc.bbappend
new file mode 100644
index 0000000..925ae9e
--- /dev/null
+++ b/recipes-ccsp/ccsp/ccsp-misc.bbappend
@@ -0,0 +1,9 @@
+require ccsp_common_turris.inc
+
+DEPENDS_append_dunfell = " ccsp-lm-lite"
+
+LDFLAGS_append_dunfell = " -lsafec-3.5.1"
+
+EXTRA_OECONF_append = " --with-ccsp-arch=arm"
+
+CFLAGS += " -DDHCPV4_CLIENT_UDHCPC -DDHCPV6_CLIENT_DIBBLER "
diff --git a/recipes-ccsp/ccsp/ccsp-mta-agent.bbappend b/recipes-ccsp/ccsp/ccsp-mta-agent.bbappend
new file mode 100644
index 0000000..0a03081
--- /dev/null
+++ b/recipes-ccsp/ccsp/ccsp-mta-agent.bbappend
@@ -0,0 +1,11 @@
+require ccsp_common_turris.inc
+
+DEPENDS_append_dunfell = " safec"
+LDFLAGS_append_dunfell = " -lsafec-3.5.1"
+
+do_install_append() {
+ # Config files and scripts
+ install -m 644 ${S}/config/CcspMtaAgent.xml ${D}/usr/ccsp/mta/CcspMtaAgent.xml
+ install -m 644 ${S}/config/CcspMta.cfg ${D}/usr/ccsp/mta/CcspMta.cfg
+ install -m 644 ${S}/config/CcspMtaLib.cfg ${D}/usr/ccsp/mta/CcspMtaLib.cfg
+}
diff --git a/recipes-ccsp/ccsp/ccsp-p-and-m.bbappend b/recipes-ccsp/ccsp/ccsp-p-and-m.bbappend
new file mode 100644
index 0000000..1f592e7
--- /dev/null
+++ b/recipes-ccsp/ccsp/ccsp-p-and-m.bbappend
@@ -0,0 +1,133 @@
+FILESEXTRAPATHS_prepend := "${THISDIR}/files:"
+
+require ccsp_common_turris.inc
+
+DEPENDS_append = " utopia curl "
+
+CFLAGS_append = " \
+ -I=${includedir}/utctx \
+ -I=${includedir}/utapi \
+"
+LDFLAGS_append =" \
+ -lsyscfg \
+ -lbreakpadwrapper \
+"
+
+LDFLAGS_remove = " \
+ -lmoca_mgnt \
+"
+
+CFLAGS_remove = "-Werror"
+
+EXTRA_OECONF_append = " --with-ccsp-arch=arm"
+
+do_configure_prepend () {
+ #for WanManager support
+ #Below lines of code needs to be removed , once (Device.DHCPv4.Client.{i} and Device.DhCPv6,CLient.{i}) the mentioned parameters are permanently removed from TR181-USGv2.XML
+ DISTRO_WAN_ENABLED="${@bb.utils.contains('DISTRO_FEATURES','rdkb_wan_manager','true','false',d)}"
+if [ $DISTRO_WAN_ENABLED = 'true' ]; then
+if [ ! -f ${WORKDIR}/WanManager_XML_UPDATED ]; then
+ GREP_WORD=`cat -n ${S}/config-arm/TR181-USGv2.XML | grep 9536 | cut -d '<' -f2 | cut -d '>' -f2`
+ if [ "$GREP_WORD" = "ClientNumberOfEntries" ]; then
+ #for DHCPv4.Client.{i}.
+ sed -i '9534s/<parameter>/<!-- <parameter>/g' ${S}/config-arm/TR181-USGv2.XML
+ sed -i '9542s/<\/parameter>/<\/parameter>-->/g' ${S}/config-arm/TR181-USGv2.XML
+ sed -i '9642s/<object>/<!-- <object>/g' ${S}/config-arm/TR181-USGv2.XML
+ sed -i '10058s/<\/object>/<\/object>-->/g' ${S}/config-arm/TR181-USGv2.XML
+ #for DHCPv6.Client.{i}.
+ sed -i '10832s/<parameter>/<!-- <parameter>/g' ${S}/config-arm/TR181-USGv2.XML
+ sed -i '10836s/<\/parameter>/<\/parameter>-->/g' ${S}/config-arm/TR181-USGv2.XML
+ sed -i '10839s/<object>/<!-- <object>/g' ${S}/config-arm/TR181-USGv2.XML
+ sed -i '11138s/<\/object>/<\/object>-->/g' ${S}/config-arm/TR181-USGv2.XML
+ fi
+ touch ${WORKDIR}/WanManager_XML_UPDATED
+fi
+fi
+}
+
+do_install_append(){
+ # Config files and scripts
+ install -m 644 ${S}/config-arm/CcspDmLib.cfg ${D}/usr/ccsp/pam/CcspDmLib.cfg
+ install -m 644 ${S}/config-arm/CcspPam.cfg -t ${D}/usr/ccsp/pam
+ install -m 644 ${S}/config-arm/TR181-USGv2.XML -t ${D}/usr/ccsp/pam
+ install -m 755 ${S}/scripts/email_notification_monitor.sh ${D}/usr/ccsp/pam/email_notification_monitor.sh
+ install -m 755 ${S}/arch/intel_usg/boards/arm_shared/scripts/calc_random_time_to_reboot_dev.sh ${D}/usr/ccsp/pam/calc_random_time_to_reboot_dev.sh
+ install -m 755 ${S}/arch/intel_usg/boards/arm_shared/scripts/network_response.sh ${D}/usr/ccsp/pam/network_response.sh
+ install -m 755 ${S}/arch/intel_usg/boards/arm_shared/scripts/network_response.sh ${D}/etc/network_response.sh
+ install -m 755 ${S}/arch/intel_usg/boards/arm_shared/scripts/redirect_url.sh ${D}/usr/ccsp/pam/redirect_url.sh
+ install -m 755 ${S}/arch/intel_usg/boards/arm_shared/scripts/revert_redirect.sh ${D}/usr/ccsp/pam/revert_redirect.sh
+ install -m 755 ${S}/arch/intel_usg/boards/arm_shared/scripts/redirect_url.sh ${D}/etc/redirect_url.sh
+ install -m 755 ${S}/arch/intel_usg/boards/arm_shared/scripts/revert_redirect.sh ${D}/etc/revert_redirect.sh
+ install -m 755 ${S}/arch/intel_usg/boards/arm_shared/scripts/restart_services.sh ${D}/etc/restart_services.sh
+ install -m 755 ${S}/arch/intel_usg/boards/arm_shared/scripts/whitelist.sh ${D}/usr/ccsp/pam/whitelist.sh
+ install -m 755 ${S}/arch/intel_usg/boards/arm_shared/scripts/moca_status.sh ${D}/usr/ccsp/pam/moca_status.sh
+ install -m 777 ${D}/usr/bin/CcspPandMSsp -t ${D}/usr/ccsp/pam/
+
+ install -d ${D}/fss/gw/usr/sbin
+ ln -sf /sbin/ip.iproute2 ${D}/fss/gw/usr/sbin/ip
+
+ #captiveportal redirection
+ DISTRO_ENABLED="${@bb.utils.contains('DISTRO_FEATURES','webui_jst','true','false',d)}"
+ if [ $DISTRO_ENABLED = 'false' ]; then
+ sed -i "/captiveportaldhcp/a fi" ${D}/etc/revert_redirect.sh
+ sed -i "/captiveportaldhcp/a lighttpd -f /var/lighttpd.conf" ${D}/etc/revert_redirect.sh
+ sed -i "/captiveportaldhcp/a sleep 2" ${D}/etc/revert_redirect.sh
+ sed -i "/captiveportaldhcp/a killall lighttpd" ${D}/etc/revert_redirect.sh
+ sed -i "/captiveportaldhcp/a sed -i '\$d' /var/lighttpd.conf" ${D}/etc/revert_redirect.sh
+ sed -i "/captiveportaldhcp/a sed -i '\$d' /var/lighttpd.conf" ${D}/etc/revert_redirect.sh
+ sed -i "/captiveportaldhcp/a sed -e '/url.redirect/ s/^#*/#/' -i /var/lighttpd.conf" ${D}/etc/revert_redirect.sh
+ sed -i "/captiveportaldhcp/a if [ \$CAPTIVEPORTAL == \"$\" ] ; then" ${D}/etc/revert_redirect.sh
+ sed -i "/captiveportaldhcp/a CAPTIVEPORTAL=\`cat /var/lighttpd.conf | grep captiveportal.php | cut -c1\`" ${D}/etc/revert_redirect.sh
+ sed -i "/dibbler-server start/a fi" ${D}/etc/restart_services.sh
+ sed -i "/dibbler-server start/a fi" ${D}/etc/restart_services.sh
+ sed -i "/dibbler-server start/a lighttpd -f \$LIGHTTPD_CONF" ${D}/etc/restart_services.sh
+ sed -i "/dibbler-server start/a sleep 2" ${D}/etc/restart_services.sh
+ sed -i "/dibbler-server start/a killall lighttpd" ${D}/etc/restart_services.sh
+ sed -i "/dibbler-server start/a sed -i '\$d' \$LIGHTTPD_CONF" ${D}/etc/restart_services.sh
+ sed -i "/dibbler-server start/a sed -i '\$d' \$LIGHTTPD_CONF" ${D}/etc/restart_services.sh
+ sed -i "/dibbler-server start/a sed -e '/url.redirect/ s/^#*/#/' -i \$LIGHTTPD_CONF" ${D}/etc/restart_services.sh
+ sed -i "/dibbler-server start/a if [ \$CAPTIVEPORTAL == \"\$\" ] ; then" ${D}/etc/restart_services.sh
+ sed -i "/dibbler-server start/a CAPTIVEPORTAL=\`cat /var/lighttpd.conf | grep captiveportal.php | cut -c1\`" ${D}/etc/restart_services.sh
+ sed -i "/dibbler-server start/a if [ \"\$CaptivePortal_flag\" == 1 ] && [ \"\$1\" == \"false\" ] ; then" ${D}/etc/restart_services.sh
+ sed -i "/dibbler-server start/a fi" ${D}/etc/restart_services.sh
+ sed -i "/dibbler-server start/a lighttpd -f \$LIGHTTPD_CONF" ${D}/etc/restart_services.sh
+ sed -i "/dibbler-server start/a sleep 2" ${D}/etc/restart_services.sh
+ sed -i "/dibbler-server start/a killall lighttpd" ${D}/etc/restart_services.sh
+ sed -i "/dibbler-server start/a fi" ${D}/etc/restart_services.sh
+ sed -i "/dibbler-server start/a echo \"}\" >> \$LIGHTTPD_CONF" ${D}/etc/restart_services.sh
+ sed -i "/dibbler-server start/a echo \"}\" >> \$LIGHTTPD_CONF" ${D}/etc/restart_services.sh
+ sed -i "/dibbler-server start/a echo \"\\\\\$HTTP[\\\\\"host\\\\\"] !~ \\\\\":8080\\\\\" { \\\\\$HTTP[\\\\\"url\\\\\"] !~ \\\\\"captiveportal.php\\\\\" { \\\\\$HTTP[\\\\\"referer\\\\\"] == \\\\\"\\\\\" { url.redirect = ( \\\\\".*\\\\\" => \\\\\"http://10.0.0.1/captiveportal.php\\\\\" ) url.redirect-code = 303 }\" >> \$LIGHTTPD_CONF" ${D}/etc/restart_services.sh
+ sed -i "/dibbler-server start/a else" ${D}/etc/restart_services.sh
+ sed -i "/dibbler-server start/a fi" ${D}/etc/restart_services.sh
+ sed -i "/dibbler-server start/a echo \"}\" >> \$LIGHTTPD_CONF" ${D}/etc/restart_services.sh
+ sed -i "/dibbler-server start/a echo \"}\" >> \$LIGHTTPD_CONF" ${D}/etc/restart_services.sh
+ sed -i "/dibbler-server start/a sed -i \"/captiveportal.php/ s/^#*//g\" \$LIGHTTPD_CONF" ${D}/etc/restart_services.sh
+ sed -i "/dibbler-server start/a else" ${D}/etc/restart_services.sh
+ sed -i "/dibbler-server start/a echo \"Already lighttpd was successfully running with captiveportal changes\"" ${D}/etc/restart_services.sh
+ sed -i "/dibbler-server start/a if [ \"\$lighttpd\" == \"\$\" ] ; then" ${D}/etc/restart_services.sh
+ sed -i "/dibbler-server start/a if [ \"\$lighttpd_flag\" == 1 ] ; then" ${D}/etc/restart_services.sh
+ sed -i "/dibbler-server start/a lighttpd=\`cat /var/lighttpd.conf | grep captiveportal.php | cut -c1\`" ${D}/etc/restart_services.sh
+ sed -i "/dibbler-server start/a lighttpd_flag=\`cat /var/lighttpd.conf | grep captiveportal.php | wc -l\`" ${D}/etc/restart_services.sh
+ sed -i "/dibbler-server start/a if [ \"\$CaptivePortal_flag\" == 1 ] && [ \"\$1\" == \"true\" ] ; then" ${D}/etc/restart_services.sh
+ sed -i "/dibbler-server start/a fi" ${D}/etc/restart_services.sh
+ sed -i "/dibbler-server start/a CaptivePortal_flag=1" ${D}/etc/restart_services.sh
+ sed -i "/dibbler-server start/a else" ${D}/etc/restart_services.sh
+ sed -i "/dibbler-server start/a CaptivePortal_flag=0" ${D}/etc/restart_services.sh
+ sed -i "/dibbler-server start/a if [ -f /nvram/reverted ] ; then" ${D}/etc/restart_services.sh
+ sed -i "/dibbler-server start/a LIGHTTPD_CONF=/var/lighttpd.conf" ${D}/etc/restart_services.sh
+ sed -i "/dibbler-server start/a #captiveportal redirection" ${D}/etc/restart_services.sh
+ fi
+
+########## ETHWAN Support
+ sed -i "s/www.comcast.net/www.google.com/g" ${D}/etc/partners_defaults.json
+ sed -i "s/\"Device.DeviceInfo.X_RDKCENTRAL-COM_Syndication.RDKB_UIBranding.AllowEthernetWAN\"\ :\ \"false\"\ \,/\"Device.DeviceInfo.X_RDKCENTRAL-COM_Syndication.RDKB_UIBranding.AllowEthernetWAN\" : \"true\" ,/g" ${D}/etc/partners_defaults.json
+
+}
+
+
+FILES_${PN}-ccsp += " \
+ ${prefix}/ccsp/pam/CcspPandMSsp \
+ /fss/gw/usr/sbin/ip \
+"
+
+RDEPENDS_${PN}-ccsp_append_dunfell = " bash"
diff --git a/recipes-ccsp/ccsp/ccsp-psm.bbappend b/recipes-ccsp/ccsp/ccsp-psm.bbappend
new file mode 100644
index 0000000..1a16ba4
--- /dev/null
+++ b/recipes-ccsp/ccsp/ccsp-psm.bbappend
@@ -0,0 +1,52 @@
+require ccsp_common_turris.inc
+
+LDFLAGS_append_dunfell = " -lsafec-3.5.1"
+
+do_install_append() {
+ # Config files and scripts
+ install -d ${D}/usr/ccsp/config
+ install -m 644 ${S}/config/bbhm_def_cfg_qemu.xml ${D}/usr/ccsp/config/bbhm_def_cfg.xml
+ install -m 755 ${S}/scripts/bbhm_patch.sh ${D}/usr/ccsp/psm/bbhm_patch.sh
+# sed -i '/NotifyWiFiChanges/a \
+# <Record name="eRT.com.cisco.spvtg.ccsp.Device.WiFi.Radio.SSID.1.SSID" type="astr">TURRIS_RDKB-AP0</Record> \
+# <Record name="eRT.com.cisco.spvtg.ccsp.Device.WiFi.Radio.SSID.2.SSID" type="astr">TURRIS_RDKB-AP1</Record> \
+# <Record name="eRT.com.cisco.spvtg.ccsp.Device.WiFi.Radio.SSID.1.Passphrase" type="astr">rdk@1234</Record> \
+# <Record name="eRT.com.cisco.spvtg.ccsp.Device.WiFi.Radio.SSID.2.Passphrase" type="astr">rdk@1234</Record>' ${D}/usr/ccsp/config/bbhm_def_cfg.xml
+
+#WanManager Feature
+ DISTRO_WAN_ENABLED="${@bb.utils.contains('DISTRO_FEATURES','rdkb_wan_manager','true','false',d)}"
+ if [ $DISTRO_WAN_ENABLED = 'true' ]; then
+ sed -i '/AccessPoint.16.vAPStatsEnable/a \
+ <!-- rdkb-wanmanager related --> \
+ <Record name="dmsb.wanmanager.wanenable" type="astr">1</Record> \
+ <Record name="dmsb.wanmanager.wanifcount" type="astr">1</Record> \
+ <Record name="dmsb.wanmanager.wanpolicy" type="astr">2</Record> \
+ <Record name="dmsb.wanmanager.wanidletimeout" type="astr">0</Record> \
+ <Record name="dmsb.selfheal.rebootstatus" type="astr">0</Record> \
+ <Record name="dmsb.wanmanager.if.1.Name" type="astr">eth2</Record> \
+ <Record name="dmsb.wanmanager.if.1.DisplayName" type="astr">WanOE</Record> \
+ <Record name="dmsb.wanmanager.if.1.Enable" type="astr">TRUE</Record> \
+ <Record name="dmsb.wanmanager.if.1.Type" type="astr">2</Record> \
+ <Record name="dmsb.wanmanager.if.1.Priority" type="astr">0</Record> \
+ <Record name="dmsb.wanmanager.if.1.SelectionTimeout" type="astr">0</Record> \
+ <Record name="dmsb.wanmanager.if.1.DynTriggerEnable" type="astr">FALSE</Record> \
+ <Record name="dmsb.wanmanager.if.1.DynTriggerDelay" type="astr">0</Record> \
+ <Record name="dmsb.wanmanager.if.1.Marking.List" type="astr">DATA</Record> \
+ <Record name="dmsb.wanmanager.if.1.Marking.DATA.Alias" type="astr">DATA</Record> \
+ <Record name="dmsb.wanmanager.if.1.Marking.DATA.SKBPort" type="astr">1</Record> \
+ <Record name="dmsb.wanmanager.if.1.Marking.DATA.SKBMark" type="astr"> </Record> \
+ <Record name="dmsb.wanmanager.if.1.Marking.DATA.EthernetPriorityMark" type="astr"></Record> \
+ <Record name="dmsb.wanmanager.if.1.PPPEnable" type="astr">FALSE</Record> \
+ <Record name="dmsb.wanmanager.if.1.PPPLinkType" type="astr">PPPoE</Record> \
+ <Record name="dmsb.wanmanager.if.1.PPPIPCPEnable" type="astr">TRUE</Record> \
+ <Record name="dmsb.wanmanager.if.1.PPPIPV6CPEnable" type="astr">TRUE</Record> \
+ <Record name="dmsb.wanmanager.if.1.PPPIPCPEnable" type="astr">TRUE</Record> \
+ <Record name="dmsb.wanmanager.if.1.ActiveLink" type="astr">TRUE</Record> \
+ <Record name="dmsb.wanmanager.if.1.EnableMAPT" type="astr">FALSE</Record> \
+ <Record name="dmsb.wanmanager.if.1.EnableDSLite" type="astr">FALSE</Record> \
+ <Record name="dmsb.wanmanager.if.1.EnableIPoEHealthCheck" type="astr">FALSE</Record> \
+ <Record name="dmsb.wanmanager.if.1.RebootOnConfiguration" type="astr">FALSE</Record>' ${D}/usr/ccsp/config/bbhm_def_cfg.xml
+ fi
+}
+
+LDFLAGS_append_dunfell = " -lpthread"
diff --git a/recipes-ccsp/ccsp/ccsp-snmp-pa.bbappend b/recipes-ccsp/ccsp/ccsp-snmp-pa.bbappend
new file mode 100644
index 0000000..1836ce2
--- /dev/null
+++ b/recipes-ccsp/ccsp/ccsp-snmp-pa.bbappend
@@ -0,0 +1 @@
+require ccsp_common_turris.inc
diff --git a/recipes-ccsp/ccsp/ccsp-tr069-pa.bbappend b/recipes-ccsp/ccsp/ccsp-tr069-pa.bbappend
new file mode 100644
index 0000000..fa6eb0c
--- /dev/null
+++ b/recipes-ccsp/ccsp/ccsp-tr069-pa.bbappend
@@ -0,0 +1,40 @@
+FILESEXTRAPATHS_prepend := "${THISDIR}/files:"
+
+require ccsp_common_turris.inc
+LDFLAGS += "-Wl,--no-as-needed -lulog"
+
+EXTRA_OECONF_append = " --with-ccsp-arch=arm"
+
+LDFLAGS_append_dunfell = " -lsafec-3.5.1 -lcrypto"
+
+do_install_append () {
+ # Config files and scripts
+ install -m 644 ${S}/config/ccsp_tr069_pa_certificate_cfg_arm.xml ${D}/usr/ccsp/tr069pa/ccsp_tr069_pa_certificate_cfg.xml
+ install -m 644 ${S}/config/ccsp_tr069_pa_cfg_arm.xml ${D}/usr/ccsp/tr069pa/ccsp_tr069_pa_cfg.xml
+ install -m 644 ${S}/config/ccsp_tr069_pa_mapper_arm.xml ${D}/usr/ccsp/tr069pa/ccsp_tr069_pa_mapper.xml
+ install -m 644 ${S}/config/sdm_arm.xml ${D}/usr/ccsp/tr069pa/sdm.xml
+
+ install -d ${D}/fss/gw/
+ install -d ${D}/fss/gw/usr/ccsp/
+ install -d ${D}/etc
+ install -m 777 ${D}/usr/bin/CcspTr069PaSsp -t ${D}/usr/ccsp/tr069pa
+
+ ln -sf /version.txt ${D}/fss/gw/version.txt
+ ln -sf /usr/ccsp/tr069pa/ ${D}/fss/gw/usr/ccsp/tr069pa
+ ln -sf /usr/ccsp/tr069pa/sdm.xml ${D}/usr/bin/sdm.xml
+ ln -sf /usr/ccsp/tr069pa/url ${D}${sysconfdir}/url
+ echo "5555" > ${D}/usr/ccsp/tr069pa/sharedkey
+}
+
+FILES_${PN}-ccsp += " \
+ ${prefix}/ccsp/tr069pa/CcspTr069PaSsp \
+"
+
+FILES_${PN} += " \
+ /fss/gw/usr/ccsp/ \
+ /fss/gw/version.txt \
+ /etc/url \
+"
+
+do_package_qa(){
+}
diff --git a/recipes-ccsp/ccsp/ccsp-webui-jst.bbappend b/recipes-ccsp/ccsp/ccsp-webui-jst.bbappend
new file mode 100644
index 0000000..e8b448a
--- /dev/null
+++ b/recipes-ccsp/ccsp/ccsp-webui-jst.bbappend
@@ -0,0 +1,44 @@
+require ccsp_common_turris.inc
+
+FILESEXTRAPATHS_prepend := "${THISDIR}/files:"
+
+EXTRA_OECONF += "PHP_RPATH=no"
+
+SRC_URI += "${CMF_GIT_ROOT}/rdkb/devices/raspberrypi/sysint;protocol=${CMF_GIT_PROTOCOL};branch=${CMF_GIT_BRANCH};destsuffix=git/devices;name=webuijst"
+SRCREV_webuijst = "${AUTOREV}"
+
+SRC_URI_append = " \
+ file://CcspWebUI.sh \
+ file://CcspWebUI.service \
+"
+inherit systemd
+do_install_append () {
+ install -d ${D}${sysconfdir}
+ install -d ${D}${base_libdir}/rdk/
+ install -d ${D}${systemd_unitdir}/system/
+
+ # delete wan0 reference for Turris
+ sed -i "/wan0:80/a echo \"This interface is not available in Turris\"" ${D}${sysconfdir}/webgui.sh
+ sed -i "/wan0:443/a echo \"This interface is not available in Turris\"" ${D}${sysconfdir}/webgui.sh
+ sed -i "s/if \[ \"\$BOX_TYPE\" == \"HUB4\" \]/if \[ \"\$BOX_TYPE\" = \"HUB4\" \]/g" ${D}${sysconfdir}/webgui.sh
+ sed -i '/wan0/d' ${D}${sysconfdir}/webgui.sh
+
+ #delete server.pem reference for TurrisOmnia
+ sed -e '/server.pem/ s/^#*/echo "Removed server.pem references for Turris"\n#/' -i ${D}${sysconfdir}/webgui.sh
+
+ install -m 755 ${WORKDIR}/CcspWebUI.sh ${D}${base_libdir}/rdk/
+ install -m 644 ${WORKDIR}/CcspWebUI.service ${D}${systemd_unitdir}/system/
+
+ sed -i '/Security.X_COMCAST-COM_KeyPassphrase/a \
+ \t\t\tsetStr("Device.DeviceInfo.X_RDKCENTRAL-COM_ConfigureWiFi", "false", true);' ${D}/usr/www2/actionHandler/ajaxSet_wireless_network_configuration_redirection.jst
+ sed -i "s/\$clients_RSSI\[strtoupper(\$Host\[\$i\.toString\(\)\]\['PhysAddress'\])\]/\$Host\[\$i\.toString\(\)\]\['X_CISCO_COM_RSSI'\]/g" ${D}/usr/www2/connected_devices_computers.jst
+ sed -i "s/\$wnStatus= (\$wan_enable==\"true\" \&\& \$wan_status==\"Down\") ? \"true\" : \"false\";/\$wnStatus= (\$wan_enable==\"true\" \&\& \$wan_status==\"Up\") ? \"true\" : \"false\";/g" ${D}/usr/www2/wan_network.jst
+ sed -i "s/if((!strcmp(\$url, \$Wan_IPv4) || ((inet_pton(\$url)!=\"\") || (inet_pton(\$Wan_IPv6!==\"\"))) \&\&(inet_pton(\$url) == inet_pton(\$Wan_IPv6)))){/if((!strcmp(\$url, \$Wan_IPv4) || ((inet_pton(\$url)!=\"\") \&\& (inet_pton(\$Wan_IPv6!==\"\"))) \&\&(inet_pton(\$url) == inet_pton(\$Wan_IPv6)))){/g" ${D}/usr/www2/index.jst
+ sed -i "s/\$Wan_IPv4 = getStr(\"Device.X_CISCO_COM_CableModem.IPAddress\");/\$Wan_IPv4 = getStr(\"Device.DeviceInfo.X_COMCAST-COM_CM_IP\");/g" ${D}/usr/www2/captiveportal.jst
+ sed -i "s/if((!strcmp(\$url, \$Wan_IPv4) || ((inet_pton(\$url)!=\"\") || (inet_pton(\$Wan_IPv6!==\"\"))) \&\&(inet_pton(\$url) == inet_pton(\$Wan_IPv6)))){/if((!strcmp(\$url, \$Wan_IPv4) || ((inet_pton(\$url)!=\"\") \&\& (inet_pton(\$Wan_IPv6!==\"\"))) \&\&(inet_pton(\$url) == inet_pton(\$Wan_IPv6)))){/g" ${D}/usr/www2/captiveportal.jst
+ sed -i '/\/\/ setStr("Device.WiFi.Radio."+\$r+".X_CISCO_COM_ApplySetting", "true", true);/ s/\/\///' ${D}/usr/www2/actionHandler/ajaxSet_wireless_network_configuration_edit.jst
+ sed -i "s/\/usr\/www/\/usr\/www2/g" ${D}${systemd_unitdir}/system/CcspWebUI.service
+}
+
+SYSTEMD_SERVICE_${PN} += "CcspWebUI.service"
+FILES_${PN} += "${systemd_unitdir}/system/CcspWebUI.service ${base_libdir}/rdk/*"
diff --git a/recipes-ccsp/ccsp/ccsp-webui-php.bbappend b/recipes-ccsp/ccsp/ccsp-webui-php.bbappend
new file mode 100644
index 0000000..913b9f2
--- /dev/null
+++ b/recipes-ccsp/ccsp/ccsp-webui-php.bbappend
@@ -0,0 +1,55 @@
+require ccsp_common_turris.inc
+
+FILESEXTRAPATHS_prepend := "${THISDIR}/files:"
+
+EXTRA_OECONF += "PHP_RPATH=no"
+
+SRC_URI_append = " \
+ file://CcspWebUI.sh \
+ file://CcspWebUI.service \
+"
+
+do_install_append () {
+ install -d ${D}${sysconfdir}
+ install -m 755 ${S}/../Styles/xb3/config/php.ini ${D}${sysconfdir}
+
+ # delete wan0 reference for TurrisOmnia
+ sed -i "/wan0:80/a echo \"This interface is not available in Turris\"" ${D}${sysconfdir}/webgui.sh
+ sed -i "/wan0:443/a echo \"This interface is not available in Turris\"" ${D}${sysconfdir}/webgui.sh
+ sed -i '/wan0/d' ${D}${sysconfdir}/webgui.sh
+
+ #delete server.pem reference for TurrisOmnia
+ sed -e '/server.pem/ s/^#*/echo "Removed server.pem references for R-pi"\n#/' -i ${D}${sysconfdir}/webgui.sh
+
+ sed -i -e "s/'TCP',\ 'UDP',\ 'TCP\/UDP'/'TCP',\ 'UDP',\ 'BOTH'/g" ${D}/usr/www/actionHandler/ajax_managed_services.php
+ sed -i '/Security.X_COMCAST-COM_KeyPassphrase/a \
+ \t\t\tsetStr("Device.DeviceInfo.X_RDKCENTRAL-COM_ConfigureWiFi", "false", true);' ${D}/usr/www/actionHandler/ajaxSet_wireless_network_configuration_redirection.php
+ sed -i -e "s/https:\/\/webui-xb3-cpe-srvr.xcal.tv/http:\/\/'.\$ip_addr.'/g" ${D}/usr/www/index.php
+ sed -i -e "s/LIGHTTPD_PID=\`pidof lighttpd\`/LIGHTTPD_PID=\`pidof lighttpd php-cgi\`/g" ${D}${sysconfdir}/webgui.sh
+ sed -i -e "s/\/bin\/kill \$LIGHTTPD_PID/\/bin\/kill -9 \$LIGHTTPD_PID/g" ${D}${sysconfdir}/webgui.sh
+ #Remove Mesh-Mode Validation on TurrisOmnia
+ sed -i -e "s/&& (\$Mesh_Mode==\"false\")//g" ${D}/usr/www/actionHandler/ajaxSet_wireless_network_configuration_edit.php
+ sed -i "/setting ConfigureWiFi to true/a echo \"}\" >> \$LIGHTTPD_CONF" ${D}${sysconfdir}/webgui.sh
+ sed -i "/setting ConfigureWiFi to true/a echo \"}\" >> \$LIGHTTPD_CONF" ${D}${sysconfdir}/webgui.sh
+ sed -i "/setting ConfigureWiFi to true/a echo \"\\\\\$HTTP[\\\\\"host\\\\\"] !~ \\\\\":8080\\\\\" { \\\\\$HTTP[\\\\\"url\\\\\"] !~ \\\\\"captiveportal.php\\\\\" { \\\\\$HTTP[\\\\\"referer\\\\\"] == \\\\\"\\\\\" { url.redirect = ( \\\\\".*\\\\\" => \\\\\"http://10.0.0.1/captiveportal.php\\\\\" ) url.redirect-code = 303 }\" >> \$LIGHTTPD_CONF" ${D}${sysconfdir}/webgui.sh
+ sed -i "/setting ConfigureWiFi to true/a sed -i \'\/server.modules = \(\/a \"mod_rewrite\",' \$LIGHTTPD_CONF" ${D}${sysconfdir}/webgui.sh
+ sed -i "/setting ConfigureWiFi to true/a sed -i \'\/server.modules = \(\/a \"mod_redirect\",' \$LIGHTTPD_CONF" ${D}${sysconfdir}/webgui.sh
+ sed -i "s/if((!strcmp(\$url, \$Wan_IPv4) || ((inet_pton(\$url)!=\"\") || (inet_pton(\$Wan_IPv6!==\"\"))) &&(inet_pton(\$url) == inet_pton(\$Wan_IPv6)))){/if(!strcmp(\$url, \$Wan_IPv4) || (inet_pton(\$url) == inet_pton(\$Wan_IPv6))){/g" ${D}/usr/www/index.php
+
+ install -m 755 ${WORKDIR}/CcspWebUI.sh ${D}${base_libdir}/rdk/
+ install -m 644 ${WORKDIR}/CcspWebUI.service ${D}${systemd_unitdir}/system/
+ sed -i "/jProgress/a alert(\'DOCSIS Support is not available in RPI Boards\'); die();" ${D}/usr/www/wan_network.php
+ sed -e '/jProgress/ s/^/\/\//' -i ${D}/usr/www/wan_network.php
+ sed -i "s/\$clients_RSSI\[strtoupper(\$Host\[\"\$i\"\]\['PhysAddress'\])\]/\$Host\[\$i\]\['X_CISCO_COM_RSSI'\]/g" ${D}/usr/www/connected_devices_computers.php
+}
+do_install_append_morty () {
+ #Locate svg file to load
+ echo "<?php \n\$files = glob('/run/log/bootchart-[0-9]*?-[0-9]*?.svg');\necho file_get_contents(\$files[0]);\n?>" > ${D}/usr/www/bootchart.php
+
+ #Include bootchart.php in nav.php
+ sed -i "/password_change.php/a echo '<li class="nav-bootchart"><a role="menuitem" href="bootchart.php">Bootchart</a></li>';" ${D}/usr/www/includes/nav.php
+}
+
+SYSTEMD_SERVICE_${PN} += "CcspWebUI.service"
+FILES_${PN} += "${sysconfdir}/php.ini ${systemd_unitdir}/system/CcspWebUI.service"
+
diff --git a/recipes-ccsp/ccsp/ccsp-wifi-agent.bbappend b/recipes-ccsp/ccsp/ccsp-wifi-agent.bbappend
new file mode 100644
index 0000000..49ab837
--- /dev/null
+++ b/recipes-ccsp/ccsp/ccsp-wifi-agent.bbappend
@@ -0,0 +1,59 @@
+require ccsp_common_turris.inc
+
+FILESEXTRAPATHS_prepend := "${THISDIR}/${PN}:"
+
+LDFLAGS += " \
+ -lutopiautil \
+ "
+#CFLAGS_append = " -Wno-error -DWIFI_HAL_VERSION_3"
+CFLAGS_append = " -Wno-error"
+
+#work around for wifi restart_flag=false, for meshagent synchroniztaion
+do_configure_prepend() {
+sed -i '/wlanRestart == TRUE/!{p;d;};n;a #if defined(ENABLE_FEATURE_MESHWIFI)\n if ((sWiFiDmlSsidStoredCfg[wlanIndex].SSID, sWiFiDmlSsidRunningCfg[wlanIndex].SSID) != 0)\n {\n char arg[256] = {0};\n snprintf(arg, sizeof(arg), "RDK|%d|%s",wlanIndex,sWiFiDmlSsidStoredCfg[wlanIndex].SSID);\n char * const cmd[] = {"/usr/bin/sysevent", "set", "wifi_SSIDName", arg, NULL};\n execvp_wrapper(cmd);\n }\n #endif\n' ${S}/source/TR-181/sbapi/cosa_wifi_apis.c
+}
+
+DEPENDS_append_dunfell = " avro-c"
+
+SRC_URI_append = " \
+ file://wifiTelemetrySetup.sh \
+ file://checkwifi.sh \
+ file://radio_param_def.cfg \
+ file://synclease.sh \
+ file://handle_mesh-rename-opensync.patch;apply=no \
+ file://avoid_gssidcount_error.patch;apply=no \
+"
+
+# we need to patch to code for ccsp-wifi-agent
+do_turris_ccspwifiagent_patches() {
+ cd ${S}
+ if [ ! -e patch_applied ]; then
+ bbnote "Patching handle_mesh-rename-opensync.patch"
+ patch -p1 < ${WORKDIR}/handle_mesh-rename-opensync.patch ${S}/scripts/handle_mesh
+ patch -p1 < ${WORKDIR}/avoid_gssidcount_error.patch || echo "ERROR or Patch already applied"
+ touch patch_applied
+ fi
+}
+addtask turris_ccspwifiagent_patches after do_unpack before do_configure
+
+EXTRA_OECONF_append = " --with-ccsp-arch=arm"
+
+do_install_append(){
+ install -m 777 ${D}/usr/bin/CcspWifiSsp -t ${D}/usr/ccsp/wifi/
+ install -m 755 ${S}/scripts/cosa_start_wifiagent.sh ${D}/usr/ccsp/wifi
+ install -m 777 ${WORKDIR}/wifiTelemetrySetup.sh ${D}/usr/ccsp/wifi/
+ install -m 777 ${WORKDIR}/checkwifi.sh ${D}/usr/ccsp/wifi/
+ install -m 777 ${WORKDIR}/radio_param_def.cfg ${D}/usr/ccsp/wifi/
+ install -m 777 ${WORKDIR}/synclease.sh ${D}/usr/ccsp/wifi/
+}
+
+FILES_${PN} += " \
+ ${prefix}/ccsp/wifi/CcspWifiSsp \
+ ${prefix}/ccsp/wifi/cosa_start_wifiagent.sh \
+ ${prefix}/ccsp/wifi/wifiTelemetrySetup.sh \
+ ${prefix}/ccsp/wifi/checkwifi.sh \
+ ${prefix}/ccsp/wifi/radio_param_def.cfg \
+ ${prefix}/ccsp/wifi/synclease.sh \
+"
+
+LDFLAGS_append_dunfell = " -lpthread"
diff --git a/recipes-ccsp/ccsp/ccsp-wifi-agent/avoid_gssidcount_error.patch b/recipes-ccsp/ccsp/ccsp-wifi-agent/avoid_gssidcount_error.patch
new file mode 100644
index 0000000..28be7ff
--- /dev/null
+++ b/recipes-ccsp/ccsp/ccsp-wifi-agent/avoid_gssidcount_error.patch
@@ -0,0 +1,23 @@
+Signed-off-by: kaviya.kumaresan@ltts.com
+Subject: To avoid gSsidCount undeclared error while compiling Wifi_hal3.0
+
+diff --git a/source/TR-181/sbapi/cosa_wifi_apis.c b/source/TR-181/sbapi/cosa_wifi_apis.c
+index 37019bc..aba7811 100644
+--- a/source/TR-181/sbapi/cosa_wifi_apis.c
++++ b/source/TR-181/sbapi/cosa_wifi_apis.c
+@@ -9552,6 +9552,7 @@ CosaDmlWiFiFactoryReset
+ }
+ }
+ }
++#ifndef WIFI_HAL_VERSION_3
+ #if defined(_PLATFORM_RASPBERRYPI_) || defined(_PLATFORM_TURRIS_)
+ // Reset Band Steering parameters
+ int bsIndex = 0;
+@@ -9560,6 +9561,7 @@ CosaDmlWiFiFactoryReset
+ CosaDmlWiFiGetBSFactoryResetPsmData(bsIndex, bsIndex+1);
+ }
+ #endif
++#endif
+ } else
+ {
+ // Only Apply to FactoryResetSSID list
diff --git a/recipes-ccsp/ccsp/ccsp-wifi-agent/checkwifi.sh b/recipes-ccsp/ccsp/ccsp-wifi-agent/checkwifi.sh
new file mode 100644
index 0000000..5903a74
--- /dev/null
+++ b/recipes-ccsp/ccsp/ccsp-wifi-agent/checkwifi.sh
@@ -0,0 +1,66 @@
+# If not stated otherwise in this file or this component's LICENSE
+# file the following copyright and licenses apply:
+#
+#Copyright [2019] [RDK Management]
+#
+#Licensed under the Apache License, Version 2.0 (the "License");
+#you may not use this file except in compliance with the License.
+#You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+#Unless required by applicable law or agreed to in writing, software
+#distributed under the License is distributed on an "AS IS" BASIS,
+#WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+#See the License for the specific language governing permissions and
+#limitations under the License.
+
+#!/bin/sh
+
+wifi_wifi0=`iwconfig wifi0|grep IEEE\ 802.11 | wc -l`
+wifi_wifi1=`iwconfig wifi1|grep IEEE\ 802.11 | wc -l`
+wifi_wifi2=`iwconfig wifi2|grep IEEE\ 802.11 | wc -l`
+wifi_wifi3=`iwconfig wifi3|grep IEEE\ 802.11 | wc -l`
+
+if [ $wifi_wifi0 == "1" ] ; then
+ flag=wifi0
+ wifi0=$(iwconfig wifi0|grep IEEE\ 802.11)
+elif [ $wifi_wifi1 == "1" ]; then
+ flag=wifi1
+ wifi0=$(iwconfig wifi1|grep IEEE\ 802.11)
+elif [ $wifi_wifi2 == "1" ]; then
+ flag=wifi2
+ wifi0=$(iwconfig wifi2|grep IEEE\ 802.11)
+elif [ $wifi_wifi3 == "1" ]; then
+ flag=wifi3
+ wifi0=$(iwconfig wifi3|grep IEEE\ 802.11)
+fi
+
+wifi_driver_init=${#wifi0}
+check_dual_band=1
+if [ $wifi_driver_init != 0 ]; then
+ echo "Wifi (single band) driver is initialized"
+ while [ $check_dual_band -le 5 ]
+ do
+ echo "checking for dual band support:$check_dual_band"
+ if [ $flag == "wifi0" ]; then
+ wifi_dual_band=1
+ elif [ $flag == "wifi1" ]; then
+ wifi_dual_band=1
+ elif [ $flag == "wifi2" ]; then
+ wifi_dual_band=1
+ elif [ $flag == "wifi3" ]; then
+ wifi_dual_band=1
+ fi
+ echo "$wifi_dual_band"
+ if [ $wifi_dual_band == 1 ]; then
+ break
+ fi
+ check_dual_band=`expr $check_dual_band + 1`
+ sleep 1;
+ done
+ sleep 1;
+ touch /tmp/wifi_driver_initialized
+else
+ echo "Wifi driver is not initialized"
+fi
diff --git a/recipes-ccsp/ccsp/ccsp-wifi-agent/handle_mesh-rename-opensync.patch b/recipes-ccsp/ccsp/ccsp-wifi-agent/handle_mesh-rename-opensync.patch
new file mode 100644
index 0000000..8876f2f
--- /dev/null
+++ b/recipes-ccsp/ccsp/ccsp-wifi-agent/handle_mesh-rename-opensync.patch
@@ -0,0 +1,29 @@
+From 6bb8c296e3921ccc6a994590dcf5d9399952d3fb Mon Sep 17 00:00:00 2001
+From: Simon Chung <simon.c.chung@accenture.com>
+Date: Mon, 21 Mar 2022 12:29:18 +0000
+Subject: [PATCH] handle_mesh-rename-opensync
+
+Change-Id: I1924e9f771206c0997765a70697ae874cfb43b53
+---
+ scripts/handle_mesh | 4 ++--
+ 1 file changed, 2 insertions(+), 2 deletions(-)
+
+diff --git a/scripts/handle_mesh b/scripts/handle_mesh
+index 65242561..b9cec6c1 100644
+--- a/scripts/handle_mesh
++++ b/scripts/handle_mesh
+@@ -71,9 +71,9 @@ else
+ /usr/opensync/scripts/managers.init $1
+ else
+ echo "Opensync will be effective only after reboot"
+- /usr/plume/scripts/managers.init $1
++ /usr/opensync/scripts/managers.init $1
+ fi
+ else
+- /usr/plume/scripts/managers.init $1
++ /usr/opensync/scripts/managers.init $1
+ fi
+ fi
+--
+2.28.0
+
diff --git a/recipes-ccsp/ccsp/ccsp-wifi-agent/radio_param_def.cfg b/recipes-ccsp/ccsp/ccsp-wifi-agent/radio_param_def.cfg
new file mode 100644
index 0000000..6d63af6
--- /dev/null
+++ b/recipes-ccsp/ccsp/ccsp-wifi-agent/radio_param_def.cfg
@@ -0,0 +1,21 @@
+RADIO_ENABLE_0=1
+RADIO_ENABLE_1=1
+RADIO_CHANNEL_0=6
+RADIO_CHANNEL_1=36
+CHANNEL_MODE_0=20
+CHANNEL_MODE_1=20
+SSID_NAME_0=TURRIS_RDKB-AP0
+SSID_NAME_1=TURRIS_RDKB-AP1
+PRESHAREDKEY_0=rdk@1234
+PRESHAREDKEY_1=rdk@1234
+BEACONTYPE_0=11i
+BEACONTYPE_1=11i
+WPAENCRYPTIONMODE_0=TKIPandAESEncryption
+WPAENCRYPTIONMODE_1=TKIPandAESEncryption
+AUTHENTICATIONMODE_0=PSKAuthentication
+AUTHENTICATIONMODE_1=PSKAuthentication
+BASIC_RATES_0=10 20
+BASIC_RATES_1=60 90
+SUPPORTED_RATES_0=10 20 55 110 60 90 120 180 240 360 480 540
+SUPPORTED_RATES_1=60 90 120 180 240 360 480 540
+
diff --git a/recipes-ccsp/ccsp/ccsp-wifi-agent/synclease.sh b/recipes-ccsp/ccsp/ccsp-wifi-agent/synclease.sh
new file mode 100644
index 0000000..2938d6d
--- /dev/null
+++ b/recipes-ccsp/ccsp/ccsp-wifi-agent/synclease.sh
@@ -0,0 +1 @@
+cp /nvram/dnsmasq.leases /tmp/dnsmasq.leases
diff --git a/recipes-ccsp/ccsp/ccsp-wifi-agent/wifiTelemetrySetup.sh b/recipes-ccsp/ccsp/ccsp-wifi-agent/wifiTelemetrySetup.sh
new file mode 100644
index 0000000..c7166fd
--- /dev/null
+++ b/recipes-ccsp/ccsp/ccsp-wifi-agent/wifiTelemetrySetup.sh
@@ -0,0 +1,18 @@
+# If not stated otherwise in this file or this component's LICENSE
+# file the following copyright and licenses apply:
+#
+#Copyright [2019] [RDK Management]
+#
+#Licensed under the Apache License, Version 2.0 (the "License");
+#you may not use this file except in compliance with the License.
+#You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+#Unless required by applicable law or agreed to in writing, software
+#distributed under the License is distributed on an "AS IS" BASIS,
+#WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+#See the License for the specific language governing permissions and
+#limitations under the License.
+
+#This script needs to be implemented once WiFi telemetery setup has been done
diff --git a/recipes-ccsp/ccsp/ccsp-xdns.bbappend b/recipes-ccsp/ccsp/ccsp-xdns.bbappend
new file mode 100644
index 0000000..30ce42d
--- /dev/null
+++ b/recipes-ccsp/ccsp/ccsp-xdns.bbappend
@@ -0,0 +1,5 @@
+require ccsp_common_turris.inc
+
+EXTRA_OECONF_append = " --with-ccsp-arch=arm"
+
+LDFLAGS_append_dunfell = " -lsafec-3.5.1"
diff --git a/recipes-ccsp/ccsp/ccsp_common_turris.inc b/recipes-ccsp/ccsp/ccsp_common_turris.inc
new file mode 100644
index 0000000..be9503d
--- /dev/null
+++ b/recipes-ccsp/ccsp/ccsp_common_turris.inc
@@ -0,0 +1,14 @@
+SUMMARY = "common inc for turris"
+
+CFLAGS_append += " -U_COSA_SIM_ -fno-exceptions -ffunction-sections -fdata-sections -fomit-frame-pointer -fno-strict-aliasing \
+ -D_ANSC_LINUX -D_ANSC_USER -D_ANSC_LITTLE_ENDIAN_ -D_CCSP_CWMP_TCP_CONNREQ_HANDLER \
+ -D_DSLH_STUN_ -D_NO_PKI_KB5_SUPPORT -D_BBHM_SSE_FILE_IO -D_ANSC_USE_OPENSSL_ -DENABLE_SA_KEY \
+ -D_ANSC_AES_USED_ -D_NO_EXECINFO_H_ -DFEATURE_SUPPORT_SYSLOG \
+ -DBUILD_WEB -D_NO_ANSC_ZLIB_ -D_DEBUG -U_ANSC_IPV6_COMPATIBLE_ -DUSE_NOTIFY_COMPONENT \
+ -D_PLATFORM_TURRIS_ -DENABLE_SD_NOTIFY -DCOSA_DML_WIFI_FEATURE_LoadPsmDefaults -UPARODUS_ENABLE -DENABLE_FEATURE_MESHWIFI"
+CFLAGS_append += "${@bb.utils.contains('DISTRO_FEATURES', 'rdkb_wan_manager', ' -DFEATURE_RDKB_WAN_MANAGER ', '', d)}"
+
+CFLAGS_append_aarch64 = " -D_64BIT_ARCH_SUPPORT_ "
+
+DEPENDS += "breakpad-wrapper"
+LDFLAGS += "-lbreakpadwrapper"
diff --git a/recipes-ccsp/ccsp/files/CcspWebUI.service b/recipes-ccsp/ccsp/files/CcspWebUI.service
new file mode 100644
index 0000000..19056b5
--- /dev/null
+++ b/recipes-ccsp/ccsp/files/CcspWebUI.service
@@ -0,0 +1,35 @@
+##########################################################################
+# If not stated otherwise in this file or this component's Licenses.txt
+# file the following copyright and licenses apply:
+#
+# Copyright 2019 RDK Management
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+##########################################################################
+
+[Unit]
+Description=CcspWebUI service
+After=gwprovethwan.service
+Wants=gwprovethwan.service
+
+[Service]
+Type=forking
+WorkingDirectory=/usr/www
+ExecStart=/bin/sh /lib/rdk/CcspWebUI.sh
+Restart=always
+StandardOutput=syslog+console
+
+[Install]
+WantedBy=multi-user.target
+
+
diff --git a/recipes-ccsp/ccsp/files/CcspWebUI.sh b/recipes-ccsp/ccsp/files/CcspWebUI.sh
new file mode 100644
index 0000000..b2d269b
--- /dev/null
+++ b/recipes-ccsp/ccsp/files/CcspWebUI.sh
@@ -0,0 +1,31 @@
+#!/bin/sh
+##########################################################################
+# If not stated otherwise in this file or this component's Licenses.txt
+# file the following copyright and licenses apply:
+#
+# Copyright 2019 RDK Management
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+##########################################################################
+
+
+sleep 10
+
+LIGHTTPD_PROCESS=`ps aux | grep lighttpd | grep -v grep | wc -l`
+
+if [ $LIGHTTPD_PROCESS = 0 ]; then
+ /bin/sh /etc/webgui.sh
+else
+ echo "Lighttpd process was already running"
+ exit 0
+fi
diff --git a/recipes-ccsp/ccsp/files/set-uplink-for-turris.patch b/recipes-ccsp/ccsp/files/set-uplink-for-turris.patch
new file mode 100644
index 0000000..8a838fa
--- /dev/null
+++ b/recipes-ccsp/ccsp/files/set-uplink-for-turris.patch
@@ -0,0 +1,25 @@
+diff --git a/source/gw_prov_sm.c b/source/gw_prov_sm.c
+index 76cf208..983d1fa 100644
+--- a/source/gw_prov_sm.c
++++ b/source/gw_prov_sm.c
+@@ -88,7 +88,7 @@ char log_buff[1024];
+ #define NETUTILS_IPv6_GLOBAL_ADDR_LEN 128
+ #define ER_NETDEVNAME "erouter0"
+ #define IFNAME_WAN_0 "wan0"
+-#define IFNAME_ETH_0 "eth0"
++#define IFNAME_ETH_0 "eth2"
+ #define TLV202_42_FAVOR_DEPTH 1
+ #define TLV202_42_FAVOR_WIDTH 2
+
+@@ -2449,9 +2449,9 @@ static int GWP_act_ProvEntry_callback()
+ return -1;
+ }
+
+- system("ifconfig eth0 down");
++ system("ifconfig eth2 down");
+ memset(command,0,sizeof(command));
+- sprintf(command, "ip link set eth0 name %s", wanPhyName);
++ sprintf(command, "ip link set eth2 name %s", wanPhyName);
+ printf("****************value of command = %s**********************\n", command);
+ system(command);
+
diff --git a/recipes-ccsp/ccsp/files/turris-macro-gwprov.patch b/recipes-ccsp/ccsp/files/turris-macro-gwprov.patch
new file mode 100644
index 0000000..a23f320
--- /dev/null
+++ b/recipes-ccsp/ccsp/files/turris-macro-gwprov.patch
@@ -0,0 +1,350 @@
+diff --git a/configure.ac b/configure.ac
+index c4aeb55..7eded47 100644
+--- a/configure.ac
++++ b/configure.ac
+@@ -53,5 +53,6 @@ AC_CONFIG_FILES(
+ Makefile
+ )
+ AM_CONDITIONAL([PLATFORM_RASPBERRYPI_ENABLED], [test $PLATFORM_RASPBERRYPI_ENABLED = yes])
++AM_CONDITIONAL([PLATFORM_TURRIS_ENABLED], [test $PLATFORM_TURRIS_ENABLED = yes])
+ AC_OUTPUT
+
+diff --git a/source/Makefile.am b/source/Makefile.am
+index d7d99da..4cb1847 100644
+--- a/source/Makefile.am
++++ b/source/Makefile.am
+@@ -23,9 +23,13 @@ AM_CFLAGS += -DCONFIG_PRIMARY_NET_BRIDGE_MODE
+ if PLATFORM_RASPBERRYPI_ENABLED
+ AM_LDFLAGS = -lsysevent
+ else
++if PLATFORM_TURRIS_ENABLED
++AM_LDFLAGS = -lsysevent
++else
+ AM_LDFLAGS = -lgwprovappabs
+ AM_LDFLAGS += -lsysevent
+ endif
++endif
+ AM_LDFLAGS += -lsyscfg
+ AM_LDFLAGS += -lulog
+
+@@ -38,5 +42,11 @@ gw_prov_utopia_SOURCES = gw_prov_sm.c
+ if PLATFORM_RASPBERRYPI_ENABLED
+ gw_prov_utopia_LDFLAGS = -lsysevent -lsyscfg -lulog
+ else
++if PLATFORM_TURRIS_ENABLED
++gw_prov_utopia_LDFLAGS = -lsysevent -lsyscfg -lulog
++else
+ gw_prov_utopia_LDFLAGS = -lgwprovappabs -lsysevent -lsyscfg -lulog
+ endif
++endif
++gw_prov_utopia_LDFLAGS += -pthread
++gw_prov_utopia_LDFLAGS += -pthread
+diff --git a/source/gw_prov_sm.c b/source/gw_prov_sm.c
+index 7117be3..a8c154f 100644
+--- a/source/gw_prov_sm.c
++++ b/source/gw_prov_sm.c
+@@ -55,11 +55,11 @@
+ #include <sys/socket.h>
+ #include <sys/stat.h>
+ #include <fcntl.h>
+-#if !defined(_PLATFORM_RASPBERRYPI_)
++#if !defined(_PLATFORM_RASPBERRYPI_) && !defined(_PLATFORM_TURRIS_)
+ #include <sys/types.h>
+ #endif
+ #include <unistd.h>
+-#if !defined(_PLATFORM_RASPBERRYPI_)
++#if !defined(_PLATFORM_RASPBERRYPI_) && !defined(_PLATFORM_TURRIS_)
+ #include <ruli.h>
+ #endif
+ #include <sysevent/sysevent.h>
+@@ -68,7 +68,7 @@
+ #include "gw_prov_abstraction.h"
+ #include "Tr69_Tlv.h"
+ #include <autoconf.h>
+-#if !defined(_PLATFORM_RASPBERRYPI_)
++#if !defined(_PLATFORM_RASPBERRYPI_) && !defined(_PLATFORM_TURRIS_)
+ #include "docsis_esafe_db.h"
+ #endif
+ #include <time.h>
+@@ -197,7 +197,7 @@ static token_t sysevent_token;
+ static int sysevent_fd_gs;
+ static token_t sysevent_token_gs;
+ static pthread_t sysevent_tid;
+-#if defined(_PLATFORM_RASPBERRYPI_)
++#if defined(_PLATFORM_RASPBERRYPI_) || defined(_PLATFORM_TURRIS_)
+ static pthread_t linkstate_tid;
+ #endif
+ static int phylink_wan_state = 0;
+@@ -264,7 +264,7 @@ static int getSyseventBridgeMode(int erouterMode, int bridgeMode) {
+ }
+
+
+-#if !defined(_PLATFORM_RASPBERRYPI_)
++#if !defined(_PLATFORM_RASPBERRYPI_) && !defined(_PLATFORM_TURRIS_)
+ /**************************************************************************/
+ /*! \fn STATUS GW_TlvParserInit(void)
+ **************************************************************************
+@@ -736,7 +736,7 @@ static int GWP_SysCfgSetInt(const char *name, int int_value)
+ return syscfg_set(NULL, name, value);
+ }
+
+-#if !defined(_PLATFORM_RASPBERRYPI_)
++#if !defined(_PLATFORM_RASPBERRYPI_) && !defined(_PLATFORM_TURRIS_)
+ /**************************************************************************/
+ /*! \fn static STATUS GWP_UpdateEsafeAdminMode()
+ **************************************************************************
+@@ -788,7 +788,7 @@ validate_mode(int* bridge_mode, int* eRouterMode)
+ GWPROV_PRINT(" %s : bridge_mode = %d , eRouterMode = %d \n", __FUNCTION__, *bridge_mode, *eRouterMode);
+ }
+
+-#if !defined(_PLATFORM_RASPBERRYPI_)
++#if !defined(_PLATFORM_RASPBERRYPI_) && !defined(_PLATFORM_TURRIS_)
+ void docsis_gotEnable_callback(Uint8 state)
+ {
+ GWPROV_PRINT(" Entry %s , state = %d \n", __FUNCTION__, state);
+@@ -840,7 +840,7 @@ static void GWP_DocsisInited(void)
+ **************************************************************************/
+ static void GWP_EnableERouter(void)
+ {
+-#if !defined(_PLATFORM_RASPBERRYPI_)
++#if !defined(_PLATFORM_RASPBERRYPI_) && !defined(_PLATFORM_TURRIS_)
+ GWPROV_PRINT(" Entry %s \n", __FUNCTION__);
+ /* Update ESAFE state */
+ GWP_UpdateEsafeAdminMode(eRouterMode);
+@@ -903,7 +903,7 @@ static void GWP_EnterRouterMode(void)
+ **************************************************************************/
+ static void GWP_DisableERouter(void)
+ {
+-#if !defined(_PLATFORM_RASPBERRYPI_)
++#if !defined(_PLATFORM_RASPBERRYPI_) && !defined(_PLATFORM_TURRIS_)
+ GWPROV_PRINT(" Entry %s \n", __FUNCTION__);
+ /* Update ESAFE state */
+ GWP_UpdateEsafeAdminMode(eRouterMode);
+@@ -1049,7 +1049,7 @@ static void GWP_UpdateERouterMode(void)
+ }
+ else // remain enabled, switch mode
+ {
+-#if !defined(_PLATFORM_RASPBERRYPI_)
++#if !defined(_PLATFORM_RASPBERRYPI_) && !defined(_PLATFORM_TURRIS_)
+ /* Update ESAFE state */
+ GWP_UpdateEsafeAdminMode(eRouterMode);
+ #endif
+@@ -1121,7 +1121,7 @@ static void GWP_ProcessUtopiaRestart(void)
+ // }
+ }
+
+-#if !defined(_PLATFORM_RASPBERRYPI_)
++#if !defined(_PLATFORM_RASPBERRYPI_) && !defined(_PLATFORM_TURRIS_)
+ /**************************************************************************/
+ /*! \fn int GWP_ProcessIpv4Down();
+ **************************************************************************
+@@ -1428,13 +1428,13 @@ static void *GWP_sysevent_threadfunc(void *data)
+ {
+ if (strcmp(val, "up")==0)
+ {
+-#if !defined(_PLATFORM_RASPBERRYPI_)
++#if !defined(_PLATFORM_RASPBERRYPI_) && !defined(_PLATFORM_TURRIS_)
+ GWP_ProcessIpv4Up();
+ #endif
+ }
+ else if (strcmp(val, "down")==0)
+ {
+-#if !defined(_PLATFORM_RASPBERRYPI_)
++#if !defined(_PLATFORM_RASPBERRYPI_) && !defined(_PLATFORM_TURRIS_)
+ GWP_ProcessIpv4Down();
+ #endif
+ }
+@@ -1443,13 +1443,13 @@ static void *GWP_sysevent_threadfunc(void *data)
+ {
+ if (strcmp(val, "up")==0)
+ {
+-#if !defined(_PLATFORM_RASPBERRYPI_)
++#if !defined(_PLATFORM_RASPBERRYPI_) && !defined(_PLATFORM_TURRIS_)
+ GWP_ProcessIpv6Up();
+ #endif
+ }
+ else if (strcmp(val, "down")==0)
+ {
+-#if !defined(_PLATFORM_RASPBERRYPI_)
++#if !defined(_PLATFORM_RASPBERRYPI_) && !defined(_PLATFORM_TURRIS_)
+ GWP_ProcessIpv6Down();
+ #endif
+ }
+@@ -1492,7 +1492,7 @@ static void *GWP_sysevent_threadfunc(void *data)
+ {
+ if (strcmp(val, "started") == 0) {
+ if (!webui_started) {
+-#if defined(_PLATFORM_RASPBERRYPI_)
++#if defined(_PLATFORM_RASPBERRYPI_) || defined(_PLATFORM_TURRIS_)
+ if(strcmp(name, "bridge-status") == 0) {
+ GWP_DisableERouter();
+ }
+@@ -1536,7 +1536,7 @@ static void *GWP_sysevent_threadfunc(void *data)
+ Uint8 v6addr[ NETUTILS_IPv6_GLOBAL_ADDR_LEN / sizeof(Uint8) ];
+ Uint8 soladdr[ NETUTILS_IPv6_GLOBAL_ADDR_LEN / sizeof(Uint8) ];
+ inet_pton(AF_INET6, val, v6addr);
+-#if !defined(_PLATFORM_RASPBERRYPI_)
++#if !defined(_PLATFORM_RASPBERRYPI_) && !defined(_PLATFORM_TURRIS_)
+ getMultiCastGroupAddress(v6addr,soladdr);
+ #endif
+ inet_ntop(AF_INET6, soladdr, val, sizeof(val));
+@@ -1621,7 +1621,7 @@ static int GWP_act_DocsisLinkUp_callback()
+ printf("\n**************************\n\n");
+
+
+-#if defined(_PLATFORM_RASPBERRYPI_)
++#if defined(_PLATFORM_RASPBERRYPI_) || defined(_PLATFORM_TURRIS_)
+ char *temp;
+ char command[128];
+ char wanPhyName[20];
+@@ -1678,7 +1678,7 @@ static int GWP_act_DocsisLinkUp_callback()
+ }
+
+
+-#if defined(_PLATFORM_RASPBERRYPI_)
++#if defined(_PLATFORM_RASPBERRYPI_) || defined(_PLATFORM_TURRIS_)
+ /**************************************************************************/
+ /*! \fn void *GWP_linkstate_threadfunc(void *)
+ **************************************************************************
+@@ -1796,7 +1796,7 @@ void GWP_Util_get_shell_output( char * cmd, char *out, int len )
+ }
+
+ /* GWP_UpdateTr069CfgThread() */
+-#if !defined(_PLATFORM_RASPBERRYPI_)
++#if !defined(_PLATFORM_RASPBERRYPI_) && !defined(_PLATFORM_TURRIS_)
+ void GWP_UpdateTr069CfgThread( void *data )
+ {
+ int IsNeedtoProceedFurther = TRUE;
+@@ -1911,7 +1911,7 @@ void GWP_UpdateTr069CfgThread( void *data )
+ GWPROV_PRINT(" Exit %s \n", __FUNCTION__);
+ }
+ #endif
+-#if !defined(_PLATFORM_RASPBERRYPI_)
++#if !defined(_PLATFORM_RASPBERRYPI_) && !defined(_PLATFORM_TURRIS_)
+ /**************************************************************************/
+ /*! \fn int GWP_act_DocsisCfgfile(SME_APP_T *app, SME_EVENT_T *event);
+ **************************************************************************
+@@ -2144,7 +2144,7 @@ static int GWP_act_DocsisInited_callback()
+ {
+ esafeErouterOperModeExtIf_e operMode;
+ //DOCSIS_Esafe_Db_Enable_e eRouterModeTmp;
+-#if !defined(_PLATFORM_RASPBERRYPI_)
++#if !defined(_PLATFORM_RASPBERRYPI_) && !defined(_PLATFORM_TURRIS_)
+ DOCSIS_Esafe_Db_extIf_e eRouterModeTmp;
+ #endif
+ char macstr[20];
+@@ -2154,7 +2154,7 @@ static int GWP_act_DocsisInited_callback()
+ char soladdrStr[64];
+ int sysevent_bridge_mode = 0;
+ GWPROV_PRINT(" Entry %s \n", __FUNCTION__);
+-#if !defined(_PLATFORM_RASPBERRYPI_)
++#if !defined(_PLATFORM_RASPBERRYPI_) && !defined(_PLATFORM_TURRIS_)
+ /* Docsis initialized */
+ printf("Got DOCSIS Initialized\n");
+
+@@ -2198,7 +2198,7 @@ static int GWP_act_DocsisInited_callback()
+ // }
+ #if !defined(INTEL_PUMA7) && !defined(_COSA_BCM_MIPS_) && !defined(_COSA_BCM_ARM_)
+ printf("Not Initializing bridge_mode and eRouterMode for XB3\n");
+-#elif defined(_PLATFORM_RASPBERRYPI_)
++#elif defined(_PLATFORM_RASPBERRYPI_) || defined(_PLATFORM_TURRIS_)
+ printf("Not Initializing bridge_mode and eRouterMode for Raspberry Pi\n");
+ #else
+ bridge_mode = GWP_SysCfgGetInt("bridge_mode");
+@@ -2212,12 +2212,12 @@ static int GWP_act_DocsisInited_callback()
+ system(sysevent_cmd);
+ #endif
+
+-#if !defined(_PLATFORM_RASPBERRYPI_)
++#if !defined(_PLATFORM_RASPBERRYPI_) && !defined(_PLATFORM_TURRIS_)
+ GWP_DocsisInited();
+ #endif
+
+ system("sysevent set docsis-initialized 1");
+-#if !defined(_PLATFORM_RASPBERRYPI_)
++#if !defined(_PLATFORM_RASPBERRYPI_) && !defined(_PLATFORM_TURRIS_)
+
+ /* Must set the ESAFE Enable state before replying to the DocsisInit event */
+ eRouterModeTmp = eRouterMode;
+@@ -2279,7 +2279,7 @@ static int GWP_act_DocsisInited_callback()
+ }
+
+ //calculate cm base solicited node address
+-#if !defined(_PLATFORM_RASPBERRYPI_)
++#if !defined(_PLATFORM_RASPBERRYPI_) && !defined(_PLATFORM_TURRIS_)
+ getInterfaceLinkLocalAddress(IFNAME_WAN_0, lladdr);
+
+
+@@ -2482,7 +2482,7 @@ static int GWP_act_DocsisInited_callback()
+ **************************************************************************/
+ static int GWP_act_ProvEntry_callback()
+ {
+-#if defined(_PLATFORM_RASPBERRYPI_)
++#if defined(_PLATFORM_RASPBERRYPI_) || defined(_PLATFORM_TURRIS_)
+ int uid = 0;
+ uid = getuid();
+ #endif
+@@ -2491,7 +2491,7 @@ static int GWP_act_ProvEntry_callback()
+ #ifdef MULTILAN_FEATURE
+ macaddr_t macAddr;
+ #endif
+-#if !defined(_PLATFORM_RASPBERRYPI_)
++#if !defined(_PLATFORM_RASPBERRYPI_) && !defined(_PLATFORM_TURRIS_)
+ GWPROV_PRINT(" Entry %s \n", __FUNCTION__);
+ //system("sysevent set lan-start");
+
+@@ -2411,14 +2411,14 @@ static int GWP_act_ProvEntry_callback()
+
+ /* Now that we have the ICC que (SME) and we are registered on the docsis INIT */
+ /* event, we can notify PCD to continue */
+-#if !defined(_PLATFORM_RASPBERRYPI_)
++#if !defined(_PLATFORM_RASPBERRYPI_) && !defined(_PLATFORM_TURRIS_)
+ sendProcessReadySignal();
+ #endif
+
+ /* Initialize Switch */
+ // VEN_SWT_InitSwitch();
+
+-#if defined(_PLATFORM_RASPBERRYPI_)
++#if defined(_PLATFORM_RASPBERRYPI_) || defined(_PLATFORM_TURRIS_)
+ printf("Thread to monitor link status \n");
+ pthread_create(&linkstate_tid, NULL, GWP_linkstate_threadfunc, NULL);
+ #endif
+@@ -2426,7 +2426,7 @@ static int GWP_act_ProvEntry_callback()
+ return 0;
+ }
+
+-#if !defined(_PLATFORM_RASPBERRYPI_)
++#if !defined(_PLATFORM_RASPBERRYPI_) && !defined(_PLATFORM_TURRIS_)
+ static int GWP_act_DocsisTftpOk_callback(){
+ GWPROV_PRINT(" Entry %s \n", __FUNCTION__);
+ gDocTftpOk = 1;
+@@ -2735,13 +2735,13 @@ int main(int argc, char *argv[])
+ #ifdef MULTILAN_FEATURE
+ char sysevent_cmd[80];
+ #endif
+-#if defined(_PLATFORM_RASPBERRYPI_)
++#if defined(_PLATFORM_RASPBERRYPI_) || defined(_PLATFORM_TURRIS_)
+ int uid = 0;
+ uid = getuid();
+ #endif
+ printf("Started gw_prov_utopia\n");
+
+-#if !defined(_PLATFORM_RASPBERRYPI_)
++#if !defined(_PLATFORM_RASPBERRYPI_) && !defined(_PLATFORM_TURRIS_)
+
+ #ifdef FEATURE_SUPPORT_RDKLOG
+ setenv("LOG4C_RCPATH","/rdklogger",1);
+diff --git a/source/include/gw_prov_abstraction.h b/source/include/gw_prov_abstraction.h
+index e5a45e0..536191a 100644
+--- a/source/include/gw_prov_abstraction.h
++++ b/source/include/gw_prov_abstraction.h
+@@ -62,7 +62,7 @@
+ #define GW_SUBTLV_TR069_CONNREQ_PASSWORD_EXTIF 6
+ #define GW_SUBTLV_TR069_ACS_OVERRIDE_EXTIF 7
+
+-#if defined(_PLATFORM_RASPBERRYPI_)
++#if defined(_PLATFORM_RASPBERRYPI_) || defined(_PLATFORM_TURRIS_)
+ typedef enum
+ {
+ False = 0,
diff --git a/recipes-ccsp/ccsp/harvester_git.bbappend b/recipes-ccsp/ccsp/harvester_git.bbappend
new file mode 100644
index 0000000..5b22fa5
--- /dev/null
+++ b/recipes-ccsp/ccsp/harvester_git.bbappend
@@ -0,0 +1,2 @@
+CFLAGS_append_aarch64 = " -D_64BIT_ARCH_SUPPORT_ "
+CFLAGS_append = " -DWIFI_HAL_VERSION_3"
diff --git a/recipes-ccsp/ccsp/jst.bbappend b/recipes-ccsp/ccsp/jst.bbappend
new file mode 100644
index 0000000..545cf5d
--- /dev/null
+++ b/recipes-ccsp/ccsp/jst.bbappend
@@ -0,0 +1,9 @@
+LDFLAGS_aarch64 += " -Wl,--no-as-needed"
+
+do_configure_prepend_aarch64 () {
+ sed -i "s/format_s\[loop2-1\]=0\;/\/\/format_s\[loop2-1\]=0\;/g" ${S}/source/jst_cosa.c
+}
+
+do_install_append_aarch64 () {
+ sed -i '/return \$arr.pop()/i \$arr.pop();' ${D}/usr/www2/includes/php.jst
+}
diff --git a/recipes-ccsp/ccsp/notify-comp.bbappend b/recipes-ccsp/ccsp/notify-comp.bbappend
new file mode 100644
index 0000000..476fad2
--- /dev/null
+++ b/recipes-ccsp/ccsp/notify-comp.bbappend
@@ -0,0 +1 @@
+LDFLAGS_append_dunfell = " -lrt"
diff --git a/recipes-ccsp/ccsp/parodus2ccsp.bbappend b/recipes-ccsp/ccsp/parodus2ccsp.bbappend
new file mode 100644
index 0000000..5d1ce0a
--- /dev/null
+++ b/recipes-ccsp/ccsp/parodus2ccsp.bbappend
@@ -0,0 +1,23 @@
+SRC_URI += "${CMF_GIT_ROOT}/rdk/devices/raspberrypi/webpa-client;protocol=${CMF_GIT_PROTOCOL};branch=${CMF_GIT_BRANCH};destsuffix=git/devices;name=rdkbturris"
+
+SRCREV_rdkbturris = "${AUTOREV}"
+do_fetch[vardeps] += "SRCREV_rdkbturris"
+SRCREV_FORMAT .= "_rdkbturris"
+
+inherit systemd
+
+EXTRA_OECMAKE += "-DBUILD_RASPBERRYPI=ON "
+
+do_install_append_broadband () {
+ install -d ${D}${systemd_unitdir}/system
+ install -d ${D}${base_libdir_native}/rdk
+ install -m 0644 ${S}/devices/broadband/parodus2ccsp/systemd/webpabroadband.service ${D}${systemd_unitdir}/system
+ install -m 0755 ${S}/devices/broadband/parodus2ccsp/scripts/webpa_pre_setup.sh ${D}${base_libdir_native}/rdk
+}
+
+SYSTEMD_SERVICE_${PN}_append = " webpabroadband.service"
+
+FILES_${PN}_append = " \
+ ${systemd_unitdir}/system/webpabroadband.service \
+ ${base_libdir_native}/rdk/* \
+ "
diff --git a/recipes-ccsp/ccsp/rdk-wanmanager.bbappend b/recipes-ccsp/ccsp/rdk-wanmanager.bbappend
new file mode 100644
index 0000000..976a8cc
--- /dev/null
+++ b/recipes-ccsp/ccsp/rdk-wanmanager.bbappend
@@ -0,0 +1,3 @@
+do_compile_prepend () {
+ (python ${STAGING_BINDIR_NATIVE}/dm_pack_code_gen.py ${S}/config/RdkWanManager.xml ${S}/source/WanManager/dm_pack_datamodel.c)
+}
diff --git a/recipes-ccsp/ccsp/start-parodus.bbappend b/recipes-ccsp/ccsp/start-parodus.bbappend
new file mode 100644
index 0000000..1836ce2
--- /dev/null
+++ b/recipes-ccsp/ccsp/start-parodus.bbappend
@@ -0,0 +1 @@
+require ccsp_common_turris.inc