linuxptp: new package
PATCH v3 1/1 linuxptp: new package
Add the Linux PTP Project package.
http://linuxptp.sourceforge.net/
The sysV and systemd init scripts start the daemon in automatic mode on eth0.
--
Changes v2 -> v3:
- add patches to fix build issues and enable compilation on all targets
Changes v1 -> v2:
- rename package from ptp4l to linuxptp
- add EXTRA_LDFLAGS to the build cmd (suggested by Danomi Manchego)
- sysV startup script: add restart/reload code, use PID file
- clean-up empty lines and formatting issues
- license uses SPDX license code
- update DEVELOPERS file
--- DEVELOPERS | 3 + package/Config.in | 1 + package/linuxptp/0001-adjtime-fix.patch | 12 ++++ package/linuxptp/0002-ethhdr-fix.patch | 10 ++++ package/linuxptp/0003-time_t-fix.patch | 10 ++++ package/linuxptp/0004-clock_nanosleep-fix.patch | 74 +++++++++++++++++++++++++ package/linuxptp/Config.in | 13 +++++ package/linuxptp/S65ptp4l | 36 ++++++++++++ package/linuxptp/linuxptp.hash | 2 + package/linuxptp/linuxptp.mk | 38 +++++++++++++ package/linuxptp/ptp4l.service | 10 ++++ 11 files changed, 209 insertions(+) create mode 100644 package/linuxptp/0001-adjtime-fix.patch create mode 100644 package/linuxptp/0002-ethhdr-fix.patch create mode 100644 package/linuxptp/0003-time_t-fix.patch create mode 100644 package/linuxptp/0004-clock_nanosleep-fix.patch create mode 100644 package/linuxptp/Config.in create mode 100755 package/linuxptp/S65ptp4l create mode 100644 package/linuxptp/linuxptp.hash create mode 100644 package/linuxptp/linuxptp.mk create mode 100644 package/linuxptp/ptp4l.service
DEVELOPERS +3 -0
@@ -1267,6 +1267,9 @@ F: package/sdl2_gfx/ F: package/sdl2_image/ F: package/sdl2_ttf/ +N: Petr Kulhavy <[email protected]> +F: package/linuxptp/ + N: Petr Vorel <[email protected]> F: package/linux-backports/ F: package/ltp-testsuite/
package/Config.in +1 -0
@@ -1597,6 +1597,7 @@ menu "Networking applications" source "package/links/Config.in" source "package/linphone/Config.in" source "package/linux-zigbee/Config.in" + source "package/linuxptp/Config.in" source "package/lldpd/Config.in" source "package/lrzsz/Config.in" source "package/macchanger/Config.in"
package/linuxptp/0001-adjtime-fix.patch new file +12 -0
@@ -0,0 +1,12 @@ +diff -u linuxptp-1.8.old/incdefs.sh linuxptp-1.8/incdefs.sh +--- linuxptp-1.8.old/incdefs.sh 2017-05-14 22:19:25.526966749 +0200 ++++ linuxptp-1.8/incdefs.sh 2017-05-14 22:22:19.185971919 +0200 +@@ -31,7 +31,7 @@ + + # Look for clock_adjtime(). + for d in $dirs; do +- files=$(find $d -type f -name time.h) ++ files=$(find $d -type f -name time.h -o -name timex.h) + for f in $files; do + if grep -q clock_adjtime $f; then + printf " -DHAVE_CLOCK_ADJTIME"
package/linuxptp/0002-ethhdr-fix.patch new file +10 -0
@@ -0,0 +1,10 @@ +--- linuxptp-1.8/raw.c.old 2016-11-04 19:38:56.000000000 +0100 ++++ linuxptp-1.8/raw.c 2017-05-14 17:55:20.653736273 +0200 +@@ -20,7 +20,6 @@ + #include <fcntl.h> + #include <linux/filter.h> + #include <linux/if_ether.h> +-#include <net/ethernet.h> + #include <net/if.h> + #include <netinet/in.h> + #include <netpacket/packet.h>
package/linuxptp/0003-time_t-fix.patch new file +10 -0
@@ -0,0 +1,10 @@ +--- linuxptp-1.8/util.h.old 2017-05-14 17:22:52.228898091 +0200 ++++ linuxptp-1.8/util.h 2017-05-14 17:23:15.988761979 +0200 +@@ -22,6 +22,7 @@ + + #include "ddt.h" + #include "ether.h" ++#include <time.h> + + /** + * Table of human readable strings, one for each port state.
package/linuxptp/0004-clock_nanosleep-fix.patch new file +74 -0
74 lines not on this page · raw message
package/linuxptp/Config.in new file +13 -0
@@ -0,0 +1,13 @@ +config BR2_PACKAGE_LINUXPTP + bool "Linux PTP" + help + The Linux PTP Project is the Precision Time Protocol + implementation according to IEEE standard 1588 for Linux. + + The dual design goals are to provide a robust implementation + of the standard and to use the most relevant and modern + Application Programming Interfaces (API) offered by the Linux + kernel. Supporting legacy APIs and other platforms is not a + goal. + + http://linuxptp.sourceforge.net/
package/linuxptp/S65ptp4l new file +36 -0
@@ -0,0 +1,36 @@ +#!/bin/sh +# +# Start ptp4l +# + +start() { + printf "Starting ptp4l: " + start-stop-daemon -S -b -q -p /var/run/ptp4l.pid \ + -x /usr/sbin/ptp4l -- -A -i eth0 + [ $? = 0 ] && echo "OK" || echo "FAIL" +} + +stop() { + printf "Stopping ptp4l: " + start-stop-daemon -K -q -p /var/run/ptp4l.pid \ + -x /usr/sbin/ptp4l + echo "OK" +} + +case "$1" in + start) + start + ;; + stop) + stop + ;; + restart|reload) + stop + start + ;; + *) + echo "Usage: $0 {start|stop|restart}" + exit 1 +esac + +exit $?
package/linuxptp/linuxptp.hash new file +2 -0
@@ -0,0 +1,2 @@ +# Locally computed: +sha256 fa8e00f6ec73cefa7bb313dce7f60dfe5eb9e2bde3353594e9ac18edc93e5165 linuxptp-1.8.tgz
package/linuxptp/linuxptp.mk new file +38 -0
@@ -0,0 +1,38 @@ +################################################################################ +# +# Linux PTP +# +################################################################################ + +LINUXPTP_VERSION = 1.8 +LINUXPTP_SOURCE = linuxptp-$(LINUXPTP_VERSION).tgz +LINUXPTP_SITE = http://sourceforge.net/projects/linuxptp/files/v$(LINUXPTP_VERSION) +LINUXPTP_LICENSE = GPL-2.0+ +LINUXPTP_LICENSE_FILES = COPYING + +define LINUXPTP_BUILD_CMDS + $(TARGET_MAKE_ENV) $(MAKE) KBUILD_OUTPUT=$(TARGET_DIR) \ + EXTRA_CFLAGS="$(TARGET_CFLAGS)" EXTRA_LDFLAGS="$(TARGET_LDFLAGS)" \ + CC="$(TARGET_CC)" \ + -C $(@D) all +endef + +define LINUXPTP_INSTALL_TARGET_CMDS + $(TARGET_MAKE_ENV) $(MAKE) prefix=/usr DESTDIR=$(TARGET_DIR) \ + $(TARGET_CONFIGURE_OPTS) -C $(@D) install +endef + +define LINUXPTP_INSTALL_INIT_SYSV + $(INSTALL) -m 755 -D $(@D)/package/linuxptp/S65ptp4l \ + $(TARGET_DIR)/etc/init.d/S65ptp4l +endef + +define LINUXPTP_INSTALL_INIT_SYSTEMD + $(INSTALL) -D -m 644 $(LINUXPTP_PKGDIR)/ptp4l.service \ + $(TARGET_DIR)/usr/lib/systemd/system/ptp4l.service + mkdir -p $(TARGET_DIR)/etc/systemd/system/multi-user.target.wants + ln -sf ../../../../usr/lib/systemd/system/ptp4l.service \ + $(TARGET_DIR)/etc/systemd/system/multi-user.target.wants/ptp4l.service +endef + +$(eval $(generic-package))
package/linuxptp/ptp4l.service new file +10 -0
@@ -0,0 +1,10 @@ +[Unit] +Description=Precision Time Protocol daemon +After=syslog.target network.target + +[Service] +ExecStart=/usr/sbin/ptp4l -A -i eth0 +Restart=always + +[Install] +WantedBy=multi-user.target
Signature · 1 line
2.7.4
PATCH v3 1/1 linuxptp: new package
Hello,
Quoted 6 lines · Petr Kulhavy
Add the Linux PTP Project package.
http://linuxptp.sourceforge.net/The sysV and systemd init scripts start the daemon in automatic mode on eth0.
Signed-off-by Petr Kulhavy <[email protected]>
Thanks for this new iteration! A few comments below.
Quoted 6 lines
package/linuxptp/0001-adjtime-fix.patch | 12 ++++ package/linuxptp/0002-ethhdr-fix.patch | 10 ++++ package/linuxptp/0003-time_t-fix.patch | 10 ++++ package/linuxptp/0004-clock_nanosleep-fix.patch | 74 +++++++++++++++++++++++++ package/linuxptp/Config.in | 13 +++++ package/linuxptp/S65ptp4l | 36 ++++++++++++
Everything should be named linuxptp.
Quoted 3 lines
package/linuxptp/linuxptp.hash | 2 + package/linuxptp/linuxptp.mk | 38 +++++++++++++ package/linuxptp/ptp4l.service | 10 ++++
Ditto. Please search globally for every occurrence of ptp4l in your patch, and fix the different instances to be linuxptp, i.e the name of the package.
package/linuxptp/0001-adjtime-fix.patch
Quoted 5 lines
package/linuxptp/0001-adjtime-fix.patch new file +0
-0
All patches should have a description + Signed-off-by. Since the upstream Linux PTP project uses Git, please create Git formatted patches (git format-patch -N).
Quoted 8 lines
+--- linuxptp-1.8/makefile.old 2017-05-15 00:41:33.370113834 +0200
++++ linuxptp-1.8/makefile 2017-05-15 00:41:03.710283744 +0200
+@@ -20,7 +20,7 @@
+ DEBUG =
+ CC = $(CROSS_COMPILE)gcc
+ VER = -DVER=$(version)
+-CFLAGS = -Wall $(VER) $(incdefs) $(DEBUG) $(EXTRA_CFLAGS)
++CFLAGS += -Wall $(VER) $(incdefs) $(DEBUG) $(EXTRA_CFLAGS)
How is this related to the clock_nanosleep() issue ?
package/linuxptp/Config.in line 2
Quoted 8 lines
package/linuxptp/Config.in new file +2
-0@@ -0,0 +1,13 @@ +config BR2_PACKAGE_LINUXPTP + bool "Linux PTP"
Please use just the name of the package, all lowercase:
bool "linuxptp"
package/linuxptp/S65ptp4l line 3
Quoted 9 lines
package/linuxptp/S65ptp4l new file +3
-0@@ -0,0 +1,36 @@ +#!/bin/sh +# +# Start ptp4l
ptp4l -> linuxptp (everywhere).
Thanks!
Thomas
Signature · 3 lines
Thomas Petazzoni, CTO, Free Electrons Embedded Linux and Kernel engineering http://free-electrons.com
PATCH v3 1/1 linuxptp: new package
Thanks, Thomas. I have corrected the issues and sent a new version.
Petr
Quoted 72 lines · Thomas Petazzoni
Hello,
Quoted 6 lines · Petr Kulhavy
Add the Linux PTP Project package.
http://linuxptp.sourceforge.net/The sysV and systemd init scripts start the daemon in automatic mode on eth0.
Signed-off-by Petr Kulhavy <[email protected]>Thanks for this new iteration! A few comments below.
Quoted 6 lines
package/linuxptp/0001-adjtime-fix.patch | 12 ++++ package/linuxptp/0002-ethhdr-fix.patch | 10 ++++ package/linuxptp/0003-time_t-fix.patch | 10 ++++ package/linuxptp/0004-clock_nanosleep-fix.patch | 74 +++++++++++++++++++++++++ package/linuxptp/Config.in | 13 +++++ package/linuxptp/S65ptp4l | 36 ++++++++++++Everything should be named linuxptp.
Quoted 3 lines
package/linuxptp/linuxptp.hash | 2 + package/linuxptp/linuxptp.mk | 38 +++++++++++++ package/linuxptp/ptp4l.service | 10 ++++Ditto. Please search globally for every occurrence of ptp4l in your patch, and fix the different instances to be linuxptp, i.e the name of the package.
package/linuxptp/0001-adjtime-fix.patch
Quoted 5 lines
package/linuxptp/0001-adjtime-fix.patch new file +0
-0All patches should have a description + Signed-off-by. Since the upstream Linux PTP project uses Git, please create Git formatted patches (git format-patch -N).
Quoted 8 lines
+--- linuxptp-1.8/makefile.old 2017-05-15 00:41:33.370113834 +0200
++++ linuxptp-1.8/makefile 2017-05-15 00:41:03.710283744 +0200
+@@ -20,7 +20,7 @@
+ DEBUG =
+ CC = $(CROSS_COMPILE)gcc
+ VER = -DVER=$(version)
+-CFLAGS = -Wall $(VER) $(incdefs) $(DEBUG) $(EXTRA_CFLAGS)
++CFLAGS += -Wall $(VER) $(incdefs) $(DEBUG) $(EXTRA_CFLAGS)How is this related to the
clock_nanosleep()issue ?package/linuxptp/Config.in line 2
Quoted 8 lines
package/linuxptp/Config.in new file +2
-0@@ -0,0 +1,13 @@ +config BR2_PACKAGE_LINUXPTP + bool "Linux PTP"Please use just the name of the package, all lowercase:
bool "linuxptp"
package/linuxptp/S65ptp4l line 3
Quoted 9 lines
package/linuxptp/S65ptp4l new file +3
-0@@ -0,0 +1,36 @@ +#!/bin/sh +# +# Start ptp4lptp4l -> linuxptp (everywhere).
Thanks!
Thomas