diff mbox

[OpenWrt-Devel,packages] linuxptp: Add package

Message ID 1452671270-5984-1-git-send-email-Wojciech.Dubowik@neratec.com
State Superseded
Headers show

Commit Message

Wojciech Dubowik Jan. 13, 2016, 7:47 a.m. UTC
Linuxptp is a user space software implementation of IEEE 1588
Precision Time Protocol standard.

Signed-off-by: Wojciech Dubowik <Wojciech.Dubowik@neratec.com>
---
 net/linuxptp/Makefile                             | 51 +++++++++++++++++++++++
 net/linuxptp/patches/001-uclibc-compile-fix.patch | 16 +++++++
 net/linuxptp/patches/002-clock-adj-fix.patch      | 20 +++++++++
 net/linuxptp/patches/003-musl-fix.patch           | 14 +++++++
 4 files changed, 101 insertions(+)
 create mode 100644 net/linuxptp/Makefile
 create mode 100644 net/linuxptp/patches/001-uclibc-compile-fix.patch
 create mode 100644 net/linuxptp/patches/002-clock-adj-fix.patch
 create mode 100644 net/linuxptp/patches/003-musl-fix.patch

Comments

John Crispin Jan. 13, 2016, 7:50 a.m. UTC | #1
On 13/01/2016 08:47, Wojciech Dubowik wrote:
> ++#if defined(__UCLIBC__)
> ++/* This syscall is not defined in uClibc 0.93.2 */
> ++#include <sys/syscall.h>
> ++static int clock_adjtime(clockid_t id, struct timex *tx)
> ++{
> ++	return syscall(__NR_clock_adjtime, id, tx);
> ++}
> ++#endif
> ++

on ppc we are already on musl. i dont think we need to add patches for
a libc that we do not support anymore. could you resend the patch with
the uclibc patches removed please ?

	John
Felix Fietkau Jan. 13, 2016, 11:03 a.m. UTC | #2
On 2016-01-13 08:50, John Crispin wrote:
> 
> 
> On 13/01/2016 08:47, Wojciech Dubowik wrote:
>> ++#if defined(__UCLIBC__)
>> ++/* This syscall is not defined in uClibc 0.93.2 */
>> ++#include <sys/syscall.h>
>> ++static int clock_adjtime(clockid_t id, struct timex *tx)
>> ++{
>> ++	return syscall(__NR_clock_adjtime, id, tx);
>> ++}
>> ++#endif
>> ++
> 
> on ppc we are already on musl. i dont think we need to add patches for
> a libc that we do not support anymore. could you resend the patch with
> the uclibc patches removed please ?
Actually... We do have one target that still relies on uClibc - and this
package is not ppc specific.

- Felix
John Crispin Jan. 13, 2016, 11:05 a.m. UTC | #3
On 13/01/2016 12:03, Felix Fietkau wrote:
> On 2016-01-13 08:50, John Crispin wrote:
>>
>>
>> On 13/01/2016 08:47, Wojciech Dubowik wrote:
>>> ++#if defined(__UCLIBC__)
>>> ++/* This syscall is not defined in uClibc 0.93.2 */
>>> ++#include <sys/syscall.h>
>>> ++static int clock_adjtime(clockid_t id, struct timex *tx)
>>> ++{
>>> ++	return syscall(__NR_clock_adjtime, id, tx);
>>> ++}
>>> ++#endif
>>> ++
>>
>> on ppc we are already on musl. i dont think we need to add patches for
>> a libc that we do not support anymore. could you resend the patch with
>> the uclibc patches removed please ?
> Actually... We do have one target that still relies on uClibc - and this
> package is not ppc specific.
> 
> - Felix

which target and does it have a ptp HW ?

> _______________________________________________
> openwrt-devel mailing list
> openwrt-devel@lists.openwrt.org
> https://lists.openwrt.org/cgi-bin/mailman/listinfo/openwrt-devel
>
Felix Fietkau Jan. 13, 2016, 11:25 a.m. UTC | #4
On 2016-01-13 12:05, John Crispin wrote:
> 
> 
> On 13/01/2016 12:03, Felix Fietkau wrote:
>> On 2016-01-13 08:50, John Crispin wrote:
>>>
>>>
>>> On 13/01/2016 08:47, Wojciech Dubowik wrote:
>>>> ++#if defined(__UCLIBC__)
>>>> ++/* This syscall is not defined in uClibc 0.93.2 */
>>>> ++#include <sys/syscall.h>
>>>> ++static int clock_adjtime(clockid_t id, struct timex *tx)
>>>> ++{
>>>> ++	return syscall(__NR_clock_adjtime, id, tx);
>>>> ++}
>>>> ++#endif
>>>> ++
>>>
>>> on ppc we are already on musl. i dont think we need to add patches for
>>> a libc that we do not support anymore. could you resend the patch with
>>> the uclibc patches removed please ?
>> Actually... We do have one target that still relies on uClibc - and this
>> package is not ppc specific.
>> 
>> - Felix
> 
> which target and does it have a ptp HW ?
ARC770. At the moment it's virtual, not sure if we will see HW with PTP
support. Since uClibc fixes are already there, we might as well keep
them (assuming they work with uClibc-ng). If not, we should at least
have a dependency on !USE_UCLIBC.

- Felix
John Crispin Jan. 13, 2016, 11:27 a.m. UTC | #5
On 13/01/2016 12:25, Felix Fietkau wrote:
> On 2016-01-13 12:05, John Crispin wrote:
>>
>>
>> On 13/01/2016 12:03, Felix Fietkau wrote:
>>> On 2016-01-13 08:50, John Crispin wrote:
>>>>
>>>>
>>>> On 13/01/2016 08:47, Wojciech Dubowik wrote:
>>>>> ++#if defined(__UCLIBC__)
>>>>> ++/* This syscall is not defined in uClibc 0.93.2 */
>>>>> ++#include <sys/syscall.h>
>>>>> ++static int clock_adjtime(clockid_t id, struct timex *tx)
>>>>> ++{
>>>>> ++	return syscall(__NR_clock_adjtime, id, tx);
>>>>> ++}
>>>>> ++#endif
>>>>> ++
>>>>
>>>> on ppc we are already on musl. i dont think we need to add patches for
>>>> a libc that we do not support anymore. could you resend the patch with
>>>> the uclibc patches removed please ?
>>> Actually... We do have one target that still relies on uClibc - and this
>>> package is not ppc specific.
>>>
>>> - Felix
>>
>> which target and does it have a ptp HW ?
> ARC770. At the moment it's virtual, not sure if we will see HW with PTP
> support. Since uClibc fixes are already there, we might as well keep
> them (assuming they work with uClibc-ng). If not, we should at least
> have a dependency on !USE_UCLIBC.
> 
> - Felix
> 

i can live with a !USE_UCLIBC dependency

@Wojciech: could you send the patch a 4th time with the dependency added
? sorry for the hassle ...


	John
diff mbox

Patch

diff --git a/net/linuxptp/Makefile b/net/linuxptp/Makefile
new file mode 100644
index 0000000..f0c9c9d
--- /dev/null
+++ b/net/linuxptp/Makefile
@@ -0,0 +1,51 @@ 
+#
+# Copyright (C) 2015 OpenWrt.org
+#
+# This is free software, licensed under the GNU General Public License v2.
+# See /LICENSE for more information.
+#
+
+include $(TOPDIR)/rules.mk
+
+PKG_NAME:=linuxptp
+PKG_VERSION:=20151118
+PKG_RELEASE:=1
+PKG_REV:=999c86f4a9da4bf4508b3a69289f58166ed18a55
+
+#PKG_BUILD_DIR:=$(KERNEL_BUILD_DIR)/$(PKG_NAME)-$(BUILD_VARIANT)/$(PKG_NAME)-$(PKG_VERSION)
+PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.bz2
+PKG_SOURCE_URL:=git://git.code.sf.net/p/linuxptp/code
+PKG_SOURCE_SUBDIR:=$(PKG_NAME)-$(PKG_VERSION)
+PKG_SOURCE_VERSION:=$(PKG_REV)
+PKG_SOURCE_PROTO:=git
+PKG_MD5SUM:=
+
+include $(INCLUDE_DIR)/package.mk
+
+define Package/linuxptp
+  SECTION:=net
+  CATEGORY:=Network
+  SUBMENU:=Time Synchronization
+  TITLE:=Linux Precision Time Protocol (PTP) daemon
+  URL:=http://linuxptp.sourceforge.net/
+  DEPENDS:=+librt
+endef
+
+define Package/linuxptp/description
+ The PTP daemon (PTPd) implements version 2 of the Precision Time Protocol (PTP)
+ as defined by the IEEE 1588-2008 standard.
+ PTP was developed to provide very precise time coordination of LAN connected
+ computers.
+endef
+
+define Package/linuxptp/install
+	$(INSTALL_DIR) $(1)/usr/sbin
+	$(INSTALL_BIN) $(PKG_BUILD_DIR)/hwstamp_ctl $(1)/usr/sbin/
+	$(INSTALL_BIN) $(PKG_BUILD_DIR)/phc2sys $(1)/usr/sbin/
+	$(INSTALL_BIN) $(PKG_BUILD_DIR)/phc_ctl $(1)/usr/sbin/
+	$(INSTALL_BIN) $(PKG_BUILD_DIR)/pmc $(1)/usr/sbin/
+	$(INSTALL_BIN) $(PKG_BUILD_DIR)/ptp4l $(1)/usr/sbin/
+	$(INSTALL_BIN) $(PKG_BUILD_DIR)/timemaster $(1)/usr/sbin/
+endef
+
+$(eval $(call BuildPackage,linuxptp))
diff --git a/net/linuxptp/patches/001-uclibc-compile-fix.patch b/net/linuxptp/patches/001-uclibc-compile-fix.patch
new file mode 100644
index 0000000..53fccd5
--- /dev/null
+++ b/net/linuxptp/patches/001-uclibc-compile-fix.patch
@@ -0,0 +1,16 @@ 
+Index: linuxptp-20150309/timemaster.c
+===================================================================
+--- linuxptp-20150309.orig/timemaster.c	2015-03-10 17:18:07.000000000 +0100
++++ linuxptp-20150309/timemaster.c	2015-03-11 14:44:36.992811174 +0100
+@@ -24,7 +24,11 @@
+ #include <limits.h>
+ #include <linux/net_tstamp.h>
+ #include <signal.h>
++#if defined(__UCLIBC__)
++#undef HAVE_POSIX_SPAWN
++#else
+ #include <spawn.h>
++#endif
+ #include <stdarg.h>
+ #include <stdio.h>
+ #include <stdlib.h>
diff --git a/net/linuxptp/patches/002-clock-adj-fix.patch b/net/linuxptp/patches/002-clock-adj-fix.patch
new file mode 100644
index 0000000..eb9ada9
--- /dev/null
+++ b/net/linuxptp/patches/002-clock-adj-fix.patch
@@ -0,0 +1,20 @@ 
+Index: linuxptp-20150608/clockadj.c
+===================================================================
+--- linuxptp-20150608.orig/clockadj.c	2015-07-07 15:02:17.000000000 +0200
++++ linuxptp-20150608/clockadj.c	2015-07-09 08:52:59.406122765 +0200
+@@ -31,6 +31,15 @@
+ static long realtime_hz;
+ static long realtime_nominal_tick;
+ 
++#if defined(__UCLIBC__)
++/* This syscall is not defined in uClibc 0.93.2 */
++#include <sys/syscall.h>
++static int clock_adjtime(clockid_t id, struct timex *tx)
++{
++	return syscall(__NR_clock_adjtime, id, tx);
++}
++#endif
++
+ void clockadj_init(clockid_t clkid)
+ {
+ #ifdef _SC_CLK_TCK
diff --git a/net/linuxptp/patches/003-musl-fix.patch b/net/linuxptp/patches/003-musl-fix.patch
new file mode 100644
index 0000000..618a958
--- /dev/null
+++ b/net/linuxptp/patches/003-musl-fix.patch
@@ -0,0 +1,14 @@ 
+Index: linuxptp-20150608/raw.c
+===================================================================
+--- linuxptp-20150608.orig/raw.c	2015-07-07 15:02:17.000000000 +0200
++++ linuxptp-20150608/raw.c	2015-07-09 08:54:30.222883143 +0200
+@@ -20,7 +20,9 @@
+ #include <fcntl.h>
+ #include <linux/filter.h>
+ #include <linux/if_ether.h>
++#if defined(__UCLIBC__)
+ #include <net/ethernet.h>
++#endif
+ #include <net/if.h>
+ #include <netinet/in.h>
+ #include <netpacket/packet.h>