added my Recipes

This commit is contained in:
2024-07-11 14:16:35 +02:00
parent 38bc4f53ac
commit 09b621d929
7118 changed files with 525762 additions and 3 deletions

View File

@@ -0,0 +1,40 @@
From 3886219c5c1fdca114dd480b46ce211762e30742 Mon Sep 17 00:00:00 2001
From: Li Zhou <li.zhou@windriver.com>
Date: Tue, 30 Jun 2020 13:50:11 +0800
Subject: [PATCH] ptpd: Solve memory leak for function NTPDCrequest
Solve the memory leak in function NTPDCrequest detected by valgrind tool.
Memory leak log example:
==619== 21 bytes in 1 blocks are still reachable in loss record 1 of 3
==619== at 0x4A09DB0: calloc (in /usr/lib64/valgrind/vgpreload_memcheck-amd64-linux.so)
==619== by 0x43512E: NTPDCrequest (ntpdcontrol.c:255)
==619== by 0x43512E: NTPDCquery.isra.1 (ntpdcontrol.c:683)
==619== by 0x4359EE: ntpdInControl (ntpdcontrol.c:807)
==619== by 0x4364F5: ntpServiceUpdate (timingdomain.c:622)
==619== by 0x436935: timingDomainUpdate (timingdomain.c:756)
==619== by 0x4334A7: protocol (protocol.c:263)
==619== by 0x402BAE: main (ptpd.c:131)
Upstream-Status: Pending
Signed-off-by: Li Zhou <li.zhou@windriver.com>
---
src/dep/ntpengine/ntpdcontrol.c | 1 +
1 file changed, 1 insertion(+)
diff --git a/src/dep/ntpengine/ntpdcontrol.c b/src/dep/ntpengine/ntpdcontrol.c
index bfe0b5e..b1973cb 100644
--- a/src/dep/ntpengine/ntpdcontrol.c
+++ b/src/dep/ntpengine/ntpdcontrol.c
@@ -271,6 +271,7 @@ NTPDCrequest(
if (!auth) {
qpkt.auth_seq = AUTH_SEQ(0, 0);
+ free(key);
return ntpSend(control, (Octet *)&qpkt, req_pkt_size);
}
--
1.9.1

View File

@@ -0,0 +1,67 @@
From e00d3f52ccc6496a60992ac5a9d771b1d067eceb Mon Sep 17 00:00:00 2001
From: Haiqing Bai <Haiqing.Bai@windriver.com>
Date: Thu, 22 Nov 2018 08:42:48 +0000
Subject: [PATCH] Fixed 100% CPU using issue by adding minimum POSIX timer
interval
Added minimum POSIX timer interval to prevent from timers firing
to quickly for the process to handle, resulting in 100% CPU and
endless signal queue.
Upstream-Status: Backport [From commit 1f0baae98a7b23e85f2bfd8f5de64795421c270e:
- critical: added minimum POSIX timer interval to prevent from
timers firing to quickly for the process to handle,
resulting in 100% CPU and endless signal queue]
Signed-off-by: Haiqing Bai <Haiqing.Bai@windriver.com>
---
src/dep/eventtimer.h | 3 ++-
src/dep/eventtimer_itimer.c | 2 +-
src/dep/eventtimer_posix.c | 4 ++++
3 files changed, 7 insertions(+), 2 deletions(-)
diff --git a/src/dep/eventtimer.h b/src/dep/eventtimer.h
index 64e483a..0a21318 100644
--- a/src/dep/eventtimer.h
+++ b/src/dep/eventtimer.h
@@ -30,7 +30,8 @@
* IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
-#define EVENTTIMER_MAX_DESC 20
+#define EVENTTIMER_MAX_DESC 20
+#define EVENTTIMER_MIN_INTERVAL_US 250 /* 4000/sec */
typedef struct EventTimer EventTimer;
diff --git a/src/dep/eventtimer_itimer.c b/src/dep/eventtimer_itimer.c
index cf3c6db..3bb7ec6 100644
--- a/src/dep/eventtimer_itimer.c
+++ b/src/dep/eventtimer_itimer.c
@@ -53,7 +53,7 @@
#include "../ptpd.h"
-#define US_TIMER_INTERVAL (62500)
+#define US_TIMER_INTERVAL (31250)
static volatile unsigned int elapsed;
diff --git a/src/dep/eventtimer_posix.c b/src/dep/eventtimer_posix.c
index 637eef3..f4a702d 100644
--- a/src/dep/eventtimer_posix.c
+++ b/src/dep/eventtimer_posix.c
@@ -100,6 +100,10 @@ eventTimerStart_posix(EventTimer *timer, double interval)
ts.tv_sec = interval;
ts.tv_nsec = (interval - ts.tv_sec) * 1E9;
+ if(!ts.tv_sec && ts.tv_nsec < EVENTTIMER_MIN_INTERVAL_US * 1000) {
+ ts.tv_nsec = EVENTTIMER_MIN_INTERVAL_US * 1000;
+ }
+
DBGV("Timer %s start requested at %d.%4d sec interval\n", timer->id, ts.tv_sec, ts.tv_nsec);
its.it_interval = ts;
--
2.11.0

View File

@@ -0,0 +1,35 @@
From 4c850b92a1cf8cfa19677c66bcde2edfab1a4490 Mon Sep 17 00:00:00 2001
From: Joe MacDonald <joe_macdonald@mentor.com>
Date: Tue, 24 Feb 2015 23:02:14 -0500
Subject: [PATCH] ptpd: use pkgconfig
Yocto uses pkg-config for libpcap, rather than pcap-config, so use that
instead as the source for libs and cflags.
Upstream-Status: Inappropriate [ embedded specific ]
Signed-off-by: Joe MacDonald <joe_macdonald@mentor.com>
---
configure.ac | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/configure.ac b/configure.ac
index dc9541f..288f547 100644
--- a/configure.ac
+++ b/configure.ac
@@ -112,10 +112,10 @@ case "$try_pcap" in
yes)
case "$PATH_PCAP_CONFIG" in
/*)
- PCAP_LIBS=`$PATH_PCAP_CONFIG --libs`
+ PCAP_LIBS=`$PATH_PCAP_CONFIG --libs libpcap`
AC_SUBST([PCAP_LIBS])
# Separate CPPFLAGS and CFLAGS
- foo=`$PATH_PCAP_CONFIG --cflags`
+ foo=`$PATH_PCAP_CONFIG --cflags libpcap`
PCAP_CPPFLAGS=
PCAP_CFLAGS=
for i in $foo; do
--
1.9.1

View File

@@ -0,0 +1,7 @@
#
# PTPD Configuration
#
# See man ptpd2 for arguments.
#
# Example arguments
PTPDARGS="-d 1 -i eth0"

View File

@@ -0,0 +1,10 @@
[Unit]
Description=ptpd time precision daemon
[Service]
Type=forking
EnvironmentFile=-@SYSCONFDIR@/default/ptpd
ExecStart=@BINDIR@/ptpd2 $PTPDARGS
[Install]
WantedBy=multi-user.target

View File

@@ -0,0 +1,62 @@
SUMMARY = "The PTP daemon (PTPd)"
DESCRIPTION = "The PTP daemon (PTPd) implements the Precision Time protocol (PTP) as \
defined by the relevant IEEE 1588 standard. PTP Version 1 implements IEEE-1588-2002, \
and PTP Version 2 implements IEEE-1588-2008. PTP was developed to provide very precise \
time coordination of LAN connected computers."
HOMEPAGE = "http://sourceforge.net/projects/ptpd"
SECTION = "net"
LICENSE = "BSD-2-Clause"
LIC_FILES_CHKSUM = "file://README;md5=0733e1b3788ab2ebbc63bf33a020da1d"
DEPENDS = "libpcap"
inherit autotools pkgconfig systemd
# return something like '1.2.3' or '1.2.3/rc1'
#
def get_sub(d):
parts = d.getVar('PV').split('-')
try:
return parts[0] + '/' + parts[1]
except:
return parts[0]
SRC_URI = "http://downloads.sourceforge.net/project/ptpd/ptpd/${@get_sub(d)}/ptpd-${PV}.tar.gz \
file://ptpd-use-pkgconfig.patch \
file://Fixed-100-CPU-using-issue-by-adding-minimum-POSIX-ti.patch \
file://0001-ptpd-Solve-memory-leak-for-function-NTPDCrequest.patch \
file://ptpd.service \
file://ptpd.conf \
"
SRC_URI[md5sum] = "253bab7ab51d969616ea811be1f132f3"
SRC_URI[sha256sum] = "0dbf54dd2c178bd9fe62481d2c37513ee36636d8bf137cfdad96891490cdbf93"
UPSTREAM_CHECK_URI = "http://sourceforge.net/projects/ptpd/files/releases"
S = "${WORKDIR}/ptpd-${PV}"
EXTRA_OEMAKE = ""
EXTRA_OECONF += "--disable-snmp --with-pcap-config=pkg-config"
do_install() {
install -d ${D}${bindir} ${D}${mandir}/man8
install -m 0755 ${B}/src/ptpd2 ${D}${bindir}
install -m 0644 ${B}/src/ptpd2.8 ${D}${mandir}/man8
if ${@bb.utils.contains('DISTRO_FEATURES', 'systemd', 'true', 'false', d)}; then
install -d ${D}${systemd_unitdir}/system
install -m 0644 ${WORKDIR}/ptpd.service ${D}${systemd_unitdir}/system
sed -i -e 's#@SYSCONFDIR@#${sysconfdir}#g' ${D}${systemd_unitdir}/system/ptpd.service
sed -i -e 's#@BINDIR@#${bindir}#g' ${D}${systemd_unitdir}/system/ptpd.service
install -d ${D}${sysconfdir}/default/
install -m 0644 ${WORKDIR}/ptpd.conf ${D}${sysconfdir}/default/ptpd
fi
}
SYSTEMD_PACKAGES = "${PN}"
SYSTEMD_SERVICE:${PN} = "ptpd.service"
SYSTEMD_AUTO_ENABLE = "disable"