[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-support/dnsmasq/dnsmasq_%.bbappend b/recipes-support/dnsmasq/dnsmasq_%.bbappend
new file mode 100644
index 0000000..e73e748
--- /dev/null
+++ b/recipes-support/dnsmasq/dnsmasq_%.bbappend
@@ -0,0 +1,3 @@
+FILESEXTRAPATHS_prepend := "${THISDIR}/files:"
+
+SRC_URI += "file://dnsmasq.conf"
diff --git a/recipes-support/dnsmasq/dnsmasq_2.78.bbappend b/recipes-support/dnsmasq/dnsmasq_2.78.bbappend
new file mode 100644
index 0000000..336fad1
--- /dev/null
+++ b/recipes-support/dnsmasq/dnsmasq_2.78.bbappend
@@ -0,0 +1,3 @@
+FILESEXTRAPATHS_prepend := "${THISDIR}/files:"
+
+SRC_URI += "${@bb.utils.contains('DISTRO_FEATURES', 'extender', 'file://300-vendor-class-dhcp-lease-file.patch', '', d)}"
diff --git a/recipes-support/dnsmasq/files/300-vendor-class-dhcp-lease-file.patch b/recipes-support/dnsmasq/files/300-vendor-class-dhcp-lease-file.patch
new file mode 100644
index 0000000..efa8a87
--- /dev/null
+++ b/recipes-support/dnsmasq/files/300-vendor-class-dhcp-lease-file.patch
@@ -0,0 +1,121 @@
+Index: dnsmasq-2.78/src/dnsmasq.h
+===================================================================
+--- dnsmasq-2.78.orig/src/dnsmasq.h 2020-09-09 12:04:48.512772429 +0000
++++ dnsmasq-2.78/src/dnsmasq.h 2020-09-09 12:08:18.441392007 +0000
+@@ -670,6 +670,7 @@
+ char *hostname, *fqdn; /* name from client-hostname option or config */
+ char *old_hostname; /* hostname before it moved to another lease */
+ char *fingerprint; /* DHCP fingerprint */
++ char *vendor_class; /* DHCP vendor class */
+ int flags;
+ time_t expires; /* lease expiry */
+ #ifdef HAVE_BROKEN_RTC
+@@ -1349,6 +1350,7 @@
+ unsigned int len, int delim);
+ #endif
+ void lease_add_fingerprint(struct dhcp_lease *lease, unsigned char *req_options);
++void lease_add_vendor_class(struct dhcp_lease *lease, unsigned char *data, unsigned int len);
+ #endif
+
+ /* rfc2131.c */
+Index: dnsmasq-2.78/src/lease.c
+===================================================================
+--- dnsmasq-2.78.orig/src/lease.c 2020-09-09 12:04:48.512772429 +0000
++++ dnsmasq-2.78/src/lease.c 2020-09-09 12:14:20.482344455 +0000
+@@ -35,6 +35,7 @@
+ int items;
+ char *domain = NULL;
+ char *dhcp_fingerprint = NULL;
++ char vendor_buf[256];
+
+ *daemon->dhcp_buff3 = *daemon->dhcp_buff2 = '\0';
+
+@@ -76,8 +77,8 @@
+ }
+ #endif
+
+- if (fscanf(leasestream, " %64s %255s %255s %764s",
+- daemon->namebuff, daemon->dhcp_buff, dhcp_fingerprint, daemon->packet) != 4)
++ if (fscanf(leasestream, " %64s %255s %255s \"%255[^\"]\" %764s",
++ daemon->namebuff, daemon->dhcp_buff, dhcp_fingerprint, vendor_buf, daemon->packet) != 5)
+ {
+ if (NULL != dhcp_fingerprint)
+ free(dhcp_fingerprint);
+@@ -135,6 +136,9 @@
+ if (strcmp(dhcp_fingerprint, "*") != 0)
+ lease->fingerprint = strdup(dhcp_fingerprint);
+
++ if (strcmp(vendor_buf, "*") != 0)
++ lease->vendor_class = strdup(vendor_buf);
++
+ ei = atol(daemon->dhcp_buff3);
+
+ #ifdef HAVE_BROKEN_RTC
+@@ -313,6 +317,8 @@
+ ourprintf(&err, "%s ", lease->hostname ? lease->hostname : "*");
+
+ ourprintf(&err, "%s ", lease->fingerprint ? lease->fingerprint : "*");
++ // Here we use double quotes since vendor-class can contain spaces
++ ourprintf(&err, "\"%s\" ", lease->vendor_class ? lease->vendor_class : "*");
+
+ if (lease->clid && lease->clid_len != 0)
+ {
+@@ -594,6 +600,12 @@
+ free(lease->fingerprint);
+ lease->fingerprint = NULL;
+ }
++
++ if (lease->vendor_class)
++ {
++ free(lease->vendor_class);
++ lease->vendor_class = NULL;
++ }
+
+ *up = lease->next; /* unlink */
+
+@@ -1291,4 +1303,27 @@
+ }
+ }
+
++void lease_add_vendor_class(struct dhcp_lease *lease, unsigned char *data, unsigned int len)
++{
++ unsigned int i;
++ if (lease->vendor_class != NULL)
++ {
++ free(lease->vendor_class);
++ }
++
++ if (len > 0)
++ {
++ lease->vendor_class = whine_malloc(len);
++ memcpy(lease->vendor_class, data, len);
++ lease->vendor_class[len] = '\0';
++
++ // Escape quotes (") and 0 in vendor-class by replacing them with space just to be safe
++ for (i = 0; i < len; i++)
++ {
++ if (lease->vendor_class[i] == '\"' || lease->vendor_class[i] == '\0')
++ lease->vendor_class[i] = ' ';
++ }
++ }
++}
++
+ #endif
+Index: dnsmasq-2.78/src/rfc2131.c
+===================================================================
+--- dnsmasq-2.78.orig/src/rfc2131.c 2020-09-09 12:04:48.512772429 +0000
++++ dnsmasq-2.78/src/rfc2131.c 2020-09-09 12:15:34.021860806 +0000
+@@ -1253,6 +1253,13 @@
+ }
+ }
+ }
++
++ /* get vendor-class information */
++ if (lease && (opt = option_find(mess, sz, OPTION_VENDOR_ID, 1)))
++ {
++ lease_add_vendor_class(lease, option_ptr(opt, 0), option_len(opt));
++ }
++
+ /* get options information */
+ if (lease)
+ {
diff --git a/recipes-support/dnsmasq/files/dnsmasq.conf b/recipes-support/dnsmasq/files/dnsmasq.conf
new file mode 100644
index 0000000..cd7020f
--- /dev/null
+++ b/recipes-support/dnsmasq/files/dnsmasq.conf
@@ -0,0 +1,12 @@
+domain-needed
+bogus-priv
+resolv-file=/var/default/resolv.conf
+expand-hosts
+domain=utopia.net
+dhcp-leasefile=/nvram/dnsmasq.leases
+dhcp-lease-max=252
+dhcp-hostsfile=/etc/dhcp_static_hosts
+interface=brlan0
+dhcp-range=10.0.0.2,10.0.0.253,255.255.255.0,7d
+address=/#/10.0.0.1
+dhcp-option=252,"\n"
diff --git a/recipes-support/fftw/fftw_3.3.4.bbappend b/recipes-support/fftw/fftw_3.3.4.bbappend
new file mode 100644
index 0000000..afe3e9c
--- /dev/null
+++ b/recipes-support/fftw/fftw_3.3.4.bbappend
@@ -0,0 +1 @@
+ALLOW_EMPTY_${PN} = "1"
diff --git a/recipes-support/fftw/fftw_3.3.8.bbappend b/recipes-support/fftw/fftw_3.3.8.bbappend
new file mode 100644
index 0000000..afe3e9c
--- /dev/null
+++ b/recipes-support/fftw/fftw_3.3.8.bbappend
@@ -0,0 +1 @@
+ALLOW_EMPTY_${PN} = "1"
diff --git a/recipes-support/memstress/files/0001-replace-pthread_yield-with-sched_yield.patch b/recipes-support/memstress/files/0001-replace-pthread_yield-with-sched_yield.patch
new file mode 100644
index 0000000..6b0d2e1
--- /dev/null
+++ b/recipes-support/memstress/files/0001-replace-pthread_yield-with-sched_yield.patch
@@ -0,0 +1,35 @@
+From 37204b457827d00b4211ce60dfab0c34c3537bb6 Mon Sep 17 00:00:00 2001
+From: rnarayanan <Rajkumar.Narayanan@lnttechservices.com>
+Date: Thu, 11 Apr 2019 09:52:47 +0000
+Subject: [PATCH] replace pthread_yield with sched_yield
+
+Change-Id: I155f0f7faa460f399d41cc15ec6fc732bbb6409c
+Signed-off-by: rnarayanan <Rajkumar.Narayanan@lnttechservices.com>
+---
+ memstress/src/mem_stress.cpp | 3 ++-
+ 1 file changed, 2 insertions(+), 1 deletion(-)
+
+diff --git a/memstress/src/mem_stress.cpp b/memstress/src/mem_stress.cpp
+index 2057d9d..2a5fd12 100644
+--- a/memstress/src/mem_stress.cpp
++++ b/memstress/src/mem_stress.cpp
+@@ -20,6 +20,7 @@
+ #include <stdio.h>
+ #include <string.h>
+ #include <pthread.h>
++#include <sched.h>
+ #include <stdlib.h>
+ #include <unistd.h>
+ #include <time.h>
+@@ -158,7 +159,7 @@ void* worker_thread(void *arg)
+ if (config.sleep_bw_ops)
+ usleep(config.sleep_bw_ops);
+ else
+- pthread_yield();
++ sched_yield();
+ }
+
+
+--
+2.19.0
+
diff --git a/recipes-support/memstress/memstress_0.1.bbappend b/recipes-support/memstress/memstress_0.1.bbappend
new file mode 100644
index 0000000..110cc28
--- /dev/null
+++ b/recipes-support/memstress/memstress_0.1.bbappend
@@ -0,0 +1,3 @@
+FILESEXTRAPATHS_prepend := "${THISDIR}/files:"
+
+SRC_URI += "file://0001-replace-pthread_yield-with-sched_yield.patch"
diff --git a/recipes-support/network-hotplug/files/turris-network-hotplug.patch b/recipes-support/network-hotplug/files/turris-network-hotplug.patch
new file mode 100644
index 0000000..ab4644d
--- /dev/null
+++ b/recipes-support/network-hotplug/files/turris-network-hotplug.patch
@@ -0,0 +1,11 @@
+diff -Naur 1.0-r0-orig/network@.service 1.0-r0/network@.service
+--- 1.0-r0-orig/network@.service 2019-07-22 08:52:29.887900569 +0000
++++ 1.0-r0/network@.service 2019-07-22 08:52:42.039688137 +0000
+@@ -4,7 +4,6 @@
+ Type=oneshot
+ RemainAfterExit=yes
+ EnvironmentFile=/etc/device.properties
+-ExecStartPre=/bin/sh -c "/lib/rdk/disableIpv6Autoconf.sh $MOCA_INTERFACE"
+ ExecStartPre=/bin/sh -c 'if [ "$BUILD_TYPE" == "prod" ] && [ -f /proc/sys/kernel/sysrq ];then sysctl -w "kernel.sysrq=0"; fi'
+ ExecStart=/sbin/ip link set dev %i up
+ ExecStartPost=-/lib/rdk/disableUnusedInterfaces.sh %i
diff --git a/recipes-support/network-hotplug/network-hotplug_%.bbappend b/recipes-support/network-hotplug/network-hotplug_%.bbappend
new file mode 100644
index 0000000..46955fb
--- /dev/null
+++ b/recipes-support/network-hotplug/network-hotplug_%.bbappend
@@ -0,0 +1,4 @@
+FILESEXTRAPATHS_prepend := "${THISDIR}/files:"
+
+SRC_URI += "file://turris-network-hotplug.patch;patchdir=${WORKDIR}/ \
+ "
diff --git a/recipes-support/parodus/files/parodus.service b/recipes-support/parodus/files/parodus.service
new file mode 100644
index 0000000..38ba500
--- /dev/null
+++ b/recipes-support/parodus/files/parodus.service
@@ -0,0 +1,29 @@
+##########################################################################
+# If not stated otherwise in this file or this component's Licenses.txt
+# file the following copyright and licenses apply:
+#
+# Copyright 2020 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=Parodus
+After=PsmSsp.service CcspPandMSsp.service ccspwifiagent.service
+
+[Service]
+ExecStart=/bin/sh -c '/lib/rdk/parodus_start.sh;'
+Type=forking
+Restart=always
+
+[Install]
+WantedBy=multi-user.target
diff --git a/recipes-support/parodus/files/parodus_start.sh b/recipes-support/parodus/files/parodus_start.sh
new file mode 100644
index 0000000..1d7a2c1
--- /dev/null
+++ b/recipes-support/parodus/files/parodus_start.sh
@@ -0,0 +1,76 @@
+#!/bin/sh
+##########################################################################
+# If not stated otherwise in this file or this component's Licenses.txt
+# file the following copyright and licenses apply:
+#
+# Copyright 2020 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.
+##########################################################################
+
+BINPATH="/usr/bin"
+GET="dmcli eRT getv"
+SET=""
+
+echo "Check parodusCmd.cmd in /tmp"
+
+if [ -e /tmp/parodusCmd.cmd ]; then
+ parodusCmd=`cat /tmp/parodusCmd.cmd`
+ $parodusCmd &
+else
+ echo "parodusCmd.cmd does not exist in tmp"
+ echo "Fetching PAM Health status "
+
+ while [ 1 ]
+ do
+ pamState=`$GET com.cisco.spvtg.ccsp.pam.Health | grep value| tr -s ' ' |cut -f5 -d" "`
+ if [ "$pamState" = "Green" ]; then
+ break
+ else
+ echo "Waiting for PAM to come up"
+ fi
+ sleep 10
+ done
+
+ echo "Fetching CMAgent Health status "
+
+
+ echo "Fetching values to form parodus command line arguments"
+
+ ModelName=`$GET Device.DeviceInfo.ModelName | grep value| tr -s ' ' |cut -f5 -d" "`
+ SerialNumber=`$GET Device.DeviceInfo.SerialNumber | grep value| tr -s ' ' |cut -f5 -d" "`
+ Manufacturer=`$GET Device.DeviceInfo.Manufacturer | grep value| tr -s ' ' |cut -f5 -d" "`
+ HW_MAC=`$GET Device.X_CISCO_COM_CableModem.MACAddress | grep value| tr -s ' ' |cut -f5 -d" "`
+ HW_MAC=`ifconfig erouter0 | grep HWaddr | tr -s ' ' | cut -d ' ' -f5`
+ LastRebootReason=`$GET Device.DeviceInfo.X_RDKCENTRAL-COM_LastRebootReason | grep value| tr -s ' ' |cut -f5 -d" "`
+ FirmwareName=`$GET Device.DeviceInfo.X_CISCO_COM_FirmwareName | grep value| tr -s ' ' |cut -f5 -d" "`
+ BootTime=`$GET Device.DeviceInfo.X_RDKCENTRAL-COM_BootTime | grep value| tr -s ' ' |cut -f5 -d" "`
+ MaxPingWaitTimeInSec=180;
+ DeviceNetworkInterface="erouter0";
+ ServerURL=http://54.166.121.187:8080;
+ BackOffMax=9;
+ PARODUS_URL=tcp://127.0.0.1:6666;
+ SSL_CERT_PATH=/etc/ssl/certs/ca-certificates.crt
+
+ echo "Framing command for parodus"
+
+# command="/usr/bin/parodus --hw-model=$ModelName --hw-serial-number=$SerialNumber --hw-manufacturer=$Manufacturer --hw-mac=$HW_MAC --hw-last-reboot-reason=$LastRebootReason --fw-name=$FirmwareName --boot-time=$BootTime --webpa-ping-time=$MaxPingWaitTimeInSec --webpa-inteface-used=$DeviceNetworkInterface --webpa-url=$ServerURL --webpa-backoff-max=$BackOffMax"
+ command="/usr/bin/parodus --hw-model=$ModelName --hw-serial-number=$SerialNumber --hw-manufacturer=$Manufacturer --hw-last-reboot-reason=$LastRebootReason --fw-name=$FirmwareName --boot-time=$BootTime --hw-mac=$HW_MAC --webpa-ping-time=180 --webpa-interface-used=erouter0 --webpa-url=$ServerURL --webpa-backoff-max=$BackOffMax --parodus-local-url=$PARODUS_URL --partner-id=comcast --ssl-cert-path=$SSL_CERT_PATH --force-ipv4 "
+
+ echo $command >/tmp/parodusCmd.cmd
+
+ echo "Starting parodus with the following arguments"
+ echo "ModelName=$ModelName SerialNumber=$SerialNumber Manufacturer=$Manufacturer HW_MAC=$HW_MAC LastRebootReason=$LastRebootReason FirmwareName=$FirmwareName BootTime=$BootTime MaxPingWaitTimeInSec=$MaxPingWaitTimeInSec DeviceNetworkInterface=$DeviceNetworkInterface ServerURL=$ServerURL BackOffMax=$BackOffMax"
+
+ $command &
+fi
diff --git a/recipes-support/parodus/parodus_1.0.bbappend b/recipes-support/parodus/parodus_1.0.bbappend
new file mode 100644
index 0000000..0350742
--- /dev/null
+++ b/recipes-support/parodus/parodus_1.0.bbappend
@@ -0,0 +1,29 @@
+DEPENDS_remove = "ucresolv"
+LDFLAGS_remove = "-lucresolv"
+
+CFLAGS_remove = "-I${STAGING_INCDIR}/ucresolv"
+CFLAGS_remove = "-DFEATURE_DNS_QUERY"
+
+EXTRA_OECMAKE_remove = "-DFEATURE_DNS_QUERY=true"
+
+inherit systemd coverity
+
+
+FILESEXTRAPATHS_prepend := "${THISDIR}/files:"
+
+SRC_URI += "file://parodus.service"
+SRC_URI += "file://parodus_start.sh"
+
+do_install_append_broadband () {
+ install -d ${D}${systemd_unitdir}/system
+ install -d ${D}${base_libdir_native}/rdk
+ install -m 0644 ${WORKDIR}/parodus.service ${D}${systemd_unitdir}/system
+ install -m 0755 ${WORKDIR}/parodus_start.sh ${D}${base_libdir_native}/rdk
+}
+
+SYSTEMD_SERVICE_${PN}_append_broadband = " parodus.service"
+
+FILES_${PN}_append_broadband = " \
+ ${systemd_unitdir}/system/parodus.service \
+ ${base_libdir_native}/rdk/* \
+"