Skip to contentSkip to conversation

Update linuxptp version to 4.1

PATCH In review Luca Fancellu 2 participants 9 messages Oct 11, 2023 – Oct 12, 2023

lore
Share & tools
lore
#0 lore raw

cover Update linuxptp version to 4.1

Hi all,

this serie provides an update for the linuxptp recipe to use the latest version for the package (4.1).

It also install the default configuration file for ptp4l under /etc/linuxptp and provides useful systemd services that are taken from the Ubuntu/Debian .deb package (unfortunately linuxptp doesn't provide them yet), files are from here:

https://salsa.debian.org/multimedia-team/linuxptp/-/tree/master/debian

Luca Fancellu (3):
linuxptp: update linuxptp recipe to 4.1
linuxptp: install default configuration file in sysconfdir
linuxptp: add systemd services

 .../0001-include-string.h-for-strncpy.patch   |  8 +--
 ...ditional-assignment-for-KBUILD_OUTPU.patch | 42 --------------
 .../linuxptp/Use-cross-cpp-in-incdefs.patch   |  8 ++-
 ...-Allow-CC-and-prefix-to-be-overriden.patch | 12 ++--
 .../linuxptp/systemd/[email protected]         | 13 +++++
 .../linuxptp/linuxptp/systemd/[email protected]  | 11 ++++
 .../linuxptp/linuxptp_3.1.1.bb                | 33 -----------
 .../linuxptp/linuxptp_4.1.bb                  | 58 +++++++++++++++++++
 8 files changed, 95 insertions(+), 90 deletions(-)
 delete mode 100644 meta-oe/recipes-connectivity/linuxptp/linuxptp/0001-makefile-use-conditional-assignment-for-KBUILD_OUTPU.patch
 create mode 100644 meta-oe/recipes-connectivity/linuxptp/linuxptp/systemd/[email protected]
 create mode 100644 meta-oe/recipes-connectivity/linuxptp/linuxptp/systemd/[email protected]
 delete mode 100644 meta-oe/recipes-connectivity/linuxptp/linuxptp_3.1.1.bb
 create mode 100644 meta-oe/recipes-connectivity/linuxptp/linuxptp_4.1.bb
Signature · 1 line
2.34.1
#1 lore raw

PATCH 1/3 linuxptp: update linuxptp recipe to 4.1

Update linuxptp recipe to the new version, from 3.1.1 to 4.1.

Remove one downstream patch that is already applied and update the remaining to remove merge issues.

---
 .../0001-include-string.h-for-strncpy.patch   |  8 ++--
 ...ditional-assignment-for-KBUILD_OUTPU.patch | 42 -------------------
 .../linuxptp/Use-cross-cpp-in-incdefs.patch   |  8 ++--
 ...-Allow-CC-and-prefix-to-be-overriden.patch | 12 +++---
 .../{linuxptp_3.1.1.bb => linuxptp_4.1.bb}    | 22 ++++++----
 5 files changed, 26 insertions(+), 66 deletions(-)
 delete mode 100644 meta-oe/recipes-connectivity/linuxptp/linuxptp/0001-makefile-use-conditional-assignment-for-KBUILD_OUTPU.patch
 rename meta-oe/recipes-connectivity/linuxptp/{linuxptp_3.1.1.bb => linuxptp_4.1.bb} (59%)
meta-oe/recipes-connectivity/linuxptp/linuxptp/0001-include-string.h-for-strncpy.patch +3 -5
index 60f2079d37ae..ae544699272f 100644
@@ -1,4 +1,4 @@
-From d49b4fb8063ecd89617587e5ea566cc9da9393ef Mon Sep 17 00:00:00 2001
+From ecfc8e287eb6811e42c4e2800a913822f554d7c8 Mon Sep 17 00:00:00 2001
 From: Khem Raj <[email protected]>
 Date: Wed, 31 Aug 2022 19:09:18 -0700
 Subject: [PATCH] include string.h for strncpy()
@@ -6,12 +6,13 @@ Subject: [PATCH] include string.h for strncpy()
 Upstream-Status: Pending
 
 Signed-off-by: Khem Raj <[email protected]>
+
 ---
  interface.c | 1 +
  1 file changed, 1 insertion(+)
 
 diff --git a/interface.c b/interface.c
-index 65bdff0..5228db9 100644
+index 29229ad..9a83c36 100644
 --- a/interface.c
 +++ b/interface.c
 @@ -5,6 +5,7 @@
@@ -22,6 +23,3 @@ index 65bdff0..5228db9 100644
  #include "interface.h"
  
  struct interface {
--- 
-2.37.3
-
meta-oe/recipes-connectivity/linuxptp/linuxptp/0001-makefile-use-conditional-assignment-for-KBUILD_OUTPU.patch deleted +0 -42

42 lines not on this page · raw message

meta-oe/recipes-connectivity/linuxptp/linuxptp/Use-cross-cpp-in-incdefs.patch +5 -3
index 876088649e3d..9c87851e48ef 100644
@@ -1,4 +1,4 @@
-From 8a4cad5e2f2cbb6a34bdc6e877fe499502b8c4c8 Mon Sep 17 00:00:00 2001
+From be8808005772da48c052cf34a343a6d140541f6a Mon Sep 17 00:00:00 2001
 From: Marcel Ziswiler <[email protected]>
 Date: Fri, 23 Dec 2016 18:12:29 +0100
 Subject: [PATCH] linuxptp: Use cross cpp in incdefs
@@ -8,11 +8,13 @@ we need to ensure we use correct setttings from toolchain
 
 Upstream-Status: Inappropriate [OE-Specific]
 Signed-off-by: Khem Raj <[email protected]>
----
 
- makefile | 2 +-
+---
+ incdefs.sh | 2 +-
  1 file changed, 1 insertion(+), 1 deletion(-)
 
+diff --git a/incdefs.sh b/incdefs.sh
+index a9e94f7..dd1692f 100755
 --- a/incdefs.sh
 +++ b/incdefs.sh
 @@ -27,7 +27,7 @@ user_flags()
meta-oe/recipes-connectivity/linuxptp/linuxptp/build-Allow-CC-and-prefix-to-be-overriden.patch +5 -7
index 55ce4c9a9015..d4d6fac0ee5c 100644
@@ -1,4 +1,4 @@
-From af485c638c61fa883212ea424e676fbf90bee594 Mon Sep 17 00:00:00 2001
+From 886bca11ff8fcc55386b6e4397b13e64950f93fb Mon Sep 17 00:00:00 2001
 From: Otavio Salvador <[email protected]>
 Date: Tue, 1 Jul 2014 17:37:31 -0300
 Subject: [PATCH] build: Allow CC and prefix to be overriden
@@ -6,16 +6,17 @@ Subject: [PATCH] build: Allow CC and prefix to be overriden
 Upstream-Status: Pending
 
 Signed-off-by: Otavio Salvador <[email protected]>
+
 ---
- makefile |    4 ++--
+ makefile | 4 ++--
  1 file changed, 2 insertions(+), 2 deletions(-)
 
 diff --git a/makefile b/makefile
-index 22e7d0d..809cc8f 100644
+index 3e3b8b3..5c1a1f9 100644
 --- a/makefile
 +++ b/makefile
 @@ -18,7 +18,7 @@
- KBUILD_OUTPUT =
+ KBUILD_OUTPUT ?=
  
  DEBUG	=
 -CC	= $(CROSS_COMPILE)gcc
@@ -32,6 +33,3 @@ index 22e7d0d..809cc8f 100644
  sbindir	= $(prefix)/sbin
  mandir	= $(prefix)/man
  man8dir	= $(mandir)/man8
--- 
-1.7.10.4
-
meta-oe/recipes-connectivity/linuxptp/linuxptp_4.1.bb renamed from meta-oe/recipes-connectivity/linuxptp/linuxptp_3.1.1.bb +13 -9
similarity index 59%
rename from meta-oe/recipes-connectivity/linuxptp/linuxptp_3.1.1.bb
rename to meta-oe/recipes-connectivity/linuxptp/linuxptp_4.1.bb
index 5903cb38ca4e..0b559df8c3c1 100644
@@ -1,19 +1,23 @@
-DESCRIPTION = "Precision Time Protocol (PTP) according to IEEE standard 1588 for Linux"
+SUMMARY = "linuxptp package for linux"
+DESCRIPTION = "Precision Time Protocol (PTP) according to IEEE standard 1588 \
+for Linux"
 HOMEPAGE = "http://linuxptp.sourceforge.net/"
 LICENSE = "GPL-2.0-only"
 LIC_FILES_CHKSUM = "file://COPYING;md5=b234ee4d69f5fce4486a80fdaf4a4263"
 
-SRC_URI = "http://sourceforge.net/projects/linuxptp/files/v3.1/linuxptp-${PV}.tgz \
+LINUXPTP_SRC_URI = "http://sourceforge.net/projects/linuxptp"
+
+SRC_URI = "${LINUXPTP_SRC_URI}/files/v4.1/linuxptp-${PV}.tgz \
            file://build-Allow-CC-and-prefix-to-be-overriden.patch \
            file://Use-cross-cpp-in-incdefs.patch \
            file://0001-include-string.h-for-strncpy.patch \
-           file://0001-makefile-use-conditional-assignment-for-KBUILD_OUTPU.patch \
            "
 
-UPSTREAM_CHECK_URI = "https://sourceforge.net/projects/linuxptp/files/"
-UPSTREAM_CHECK_REGEX = "(?P<pver>\d+(\.\d+)+)/"
+SRC_URI[md5sum] = "1db8699fc155965341759be5e5aad938"
+SRC_URI[sha256sum] = "e1743d44f8208897e30895da3579e670ff919b914feb4b5a949f3e421ddde535"
 
-SRC_URI[sha256sum] = "94d6855f9b7f2d8e9b0ca6d384e3fae6226ce6fc012dbad02608bdef3be1c0d9"
+UPSTREAM_CHECK_URI = "${LINUXPTP_SRC_URI}/files/"
+UPSTREAM_CHECK_REGEX = "(?P<pver>\d+(\.\d+)+)/"
 
 EXTRA_OEMAKE = "ARCH=${TARGET_ARCH} EXTRA_CFLAGS='${CFLAGS}' mandir=${mandir}"
 
@@ -24,10 +28,10 @@ do_install() {
 
     # Install example configs from source tree
     install -d ${D}${docdir}/${PN}
-    cp -R --no-dereference --preserve=mode,links ${S}/configs ${D}${docdir}/${PN}
+    cp -R --no-dereference --preserve=mode,links ${S}/configs \
+        ${D}${docdir}/${PN}
 }
 
 PACKAGES =+ "${PN}-configs"
 
-FILES:${PN}-configs = "${docdir}"
-FILES:${PN}-doc = "${mandir}"
+FILES:${PN}-configs += "${docdir}"
Signature · 1 line
2.34.1
#2 lore raw

PATCH 2/3 linuxptp: install default configuration file in sysconfdir

In reply to Luca Fancellu

Install a default configuration files to be used in ${sysconfdir}/linuxptp, the default.cfg file from linuxptp is used.

---
 meta-oe/recipes-connectivity/linuxptp/linuxptp_4.1.bb | 5 +++++
 1 file changed, 5 insertions(+)
meta-oe/recipes-connectivity/linuxptp/linuxptp_4.1.bb +5 -0
index 0b559df8c3c1..3c7efbdeca72 100644
@@ -30,6 +30,11 @@ do_install() {
     install -d ${D}${docdir}/${PN}
     cp -R --no-dereference --preserve=mode,links ${S}/configs \
         ${D}${docdir}/${PN}
+
+    # Install default configuration files
+    install -d ${D}/${sysconfdir}/linuxptp/
+    install -m 644 ${S}/configs/default.cfg \
+        ${D}${sysconfdir}/linuxptp/ptp4l.conf
 }
 
 PACKAGES =+ "${PN}-configs"
Signature · 1 line
2.34.1
#3 lore raw

PATCH 3/3 linuxptp: add systemd services

In reply to Luca Fancellu

Add systemd services [email protected] and [email protected], these services are taken from the Ubuntu/Debian linuxptp package.

Update the recipe to install them when needed using the systemd bbclass, the services are disabled by default.

---
 .../linuxptp/linuxptp/systemd/[email protected]   | 13 +++++++++++++
 .../linuxptp/linuxptp/systemd/[email protected]     | 11 +++++++++++
 .../linuxptp/linuxptp_4.1.bb                     | 16 ++++++++++++++++
 3 files changed, 40 insertions(+)
 create mode 100644 meta-oe/recipes-connectivity/linuxptp/linuxptp/systemd/[email protected]
 create mode 100644 meta-oe/recipes-connectivity/linuxptp/linuxptp/systemd/[email protected]
meta-oe/recipes-connectivity/linuxptp/linuxptp/systemd/[email protected] new file +13 -0
new file mode 100644
index 000000000000..dd2512bdca11
@@ -0,0 +1,13 @@
+[Unit]
+Description=Synchronize system clock or PTP hardware clock (PHC)
+Documentation=man:phc2sys
+Requires=ptp4l.service
+After=ptp4l.service
+Before=time-sync.target
+
+[Service]
+Type=simple
+ExecStart=/usr/sbin/phc2sys -w -s %I
+
+[Install]
+WantedBy=multi-user.target
meta-oe/recipes-connectivity/linuxptp/linuxptp/systemd/[email protected] new file +11 -0
new file mode 100644
index 000000000000..1bad2d72df6b
@@ -0,0 +1,11 @@
+[Unit]
+Description=Precision Time Protocol (PTP) service for %I
+Documentation=man:ptp4l
+After=sys-subsystem-net-devices-%i.device
+
+[Service]
+Type=simple
+ExecStart=/usr/sbin/ptp4l -f /etc/linuxptp/ptp4l.conf -i %I
+
+[Install]
+WantedBy=multi-user.target
meta-oe/recipes-connectivity/linuxptp/linuxptp_4.1.bb +16 -0
index 3c7efbdeca72..95ed76e621e6 100644
@@ -11,11 +11,15 @@ SRC_URI = "${LINUXPTP_SRC_URI}/files/v4.1/linuxptp-${PV}.tgz \
            file://build-Allow-CC-and-prefix-to-be-overriden.patch \
            file://Use-cross-cpp-in-incdefs.patch \
            file://0001-include-string.h-for-strncpy.patch \
+           file://systemd/[email protected] \
+           file://systemd/[email protected] \
            "
 
 SRC_URI[md5sum] = "1db8699fc155965341759be5e5aad938"
 SRC_URI[sha256sum] = "e1743d44f8208897e30895da3579e670ff919b914feb4b5a949f3e421ddde535"
 
+inherit systemd
+
 UPSTREAM_CHECK_URI = "${LINUXPTP_SRC_URI}/files/"
 UPSTREAM_CHECK_REGEX = "(?P<pver>\d+(\.\d+)+)/"
 
@@ -23,6 +27,8 @@ EXTRA_OEMAKE = "ARCH=${TARGET_ARCH} EXTRA_CFLAGS='${CFLAGS}' mandir=${mandir}"
 
 export KBUILD_OUTPUT="${RECIPE_SYSROOT}"
 
+LINUXPTP_SYSTEMD_SERVICES = "[email protected] [email protected]"
+
 do_install() {
     oe_runmake install DESTDIR=${D} prefix=${prefix}
 
@@ -35,8 +41,18 @@ do_install() {
     install -d ${D}/${sysconfdir}/linuxptp/
     install -m 644 ${S}/configs/default.cfg \
         ${D}${sysconfdir}/linuxptp/ptp4l.conf
+
+    # Install systemd services
+    install -d ${D}/${systemd_unitdir}/system/
+    for service in ${LINUXPTP_SYSTEMD_SERVICES}; do
+        install -m 644 ${WORKDIR}/systemd/$service \
+            ${D}/${systemd_unitdir}/system/$service
+    done
 }
 
+SYSTEMD_SERVICE:${PN} = "${LINUXPTP_SYSTEMD_SERVICES}"
+SYSTEMD_AUTO_ENABLE:${PN} = "disable"
+
 PACKAGES =+ "${PN}-configs"
 
 FILES:${PN}-configs += "${docdir}"
Signature · 1 line
2.34.1
#4 lore raw

Re: [oe] [meta-oe][PATCH 3/3] linuxptp: add systemd services

Quoted 23 lines · luca fancellu

Add systemd services [email protected] and [email protected], these services are taken from the Ubuntu/Debian linuxptp package.

Update the recipe to install them when needed using the systemd bbclass, the services are disabled by default.

---
 .../linuxptp/linuxptp/systemd/[email protected]   | 13 +++++++++++++
 .../linuxptp/linuxptp/systemd/[email protected]     | 11 +++++++++++
 .../linuxptp/linuxptp_4.1.bb                     | 16 ++++++++++++++++
 3 files changed, 40 insertions(+)
 create mode 100644 meta-oe/recipes-connectivity/linuxptp/linuxptp/systemd/[email protected]
 create mode 100644 meta-oe/recipes-connectivity/linuxptp/linuxptp/systemd/[email protected]
meta-oe/recipes-connectivity/linuxptp/linuxptp/systemd/[email protected] new file +0 -0
new file mode 100644
index 000000000000..dd2512bdca11

meta-oe/recipes-connectivity/linuxptp/linuxptp/systemd/[email protected] line 10

Quoted 10 lines
meta-oe/recipes-connectivity/linuxptp/linuxptp/systemd/[email protected] new file +10 -0
@@ -0,0 +1,13 @@
+[Unit]
+Description=Synchronize system clock or PTP hardware clock (PHC)
+Documentation=man:phc2sys
+Requires=ptp4l.service
+After=ptp4l.service
+Before=time-sync.target
+
+[Service]
+Type=simple
+ExecStart=/usr/sbin/phc2sys -w -s %I

Can these paths be derived from ${sbindir} during do_install.

Quoted 9 lines
meta-oe/recipes-connectivity/linuxptp/linuxptp/systemd/[email protected] new file +3 -0
+
+[Install]
+WantedBy=multi-user.target
meta-oe/recipes-connectivity/linuxptp/linuxptp/systemd/[email protected] new file +0 -0
new file mode 100644
index 000000000000..1bad2d72df6b

meta-oe/recipes-connectivity/linuxptp/linuxptp/systemd/[email protected] line 8

Quoted 8 lines
meta-oe/recipes-connectivity/linuxptp/linuxptp/systemd/[email protected] new file +8 -0
@@ -0,0 +1,11 @@
+[Unit]
+Description=Precision Time Protocol (PTP) service for %I
+Documentation=man:ptp4l
+After=sys-subsystem-net-devices-%i.device
+
+[Service]
+Type=simple
+ExecStart=/usr/sbin/ptp4l -f /etc/linuxptp/ptp4l.conf -i %I

Can these paths be derived from ${sbindir} and ${sysconfdir} bitbake variables during do_install ? This should make them more portable

Quoted 63 lines
meta-oe/recipes-connectivity/linuxptp/linuxptp/systemd/[email protected] new file +3 -0
+
+[Install]
+WantedBy=multi-user.target
meta-oe/recipes-connectivity/linuxptp/linuxptp_4.1.bb +16 -1
index 3c7efbdeca72..95ed76e621e6 100644
@@ -11,11 +11,15 @@ SRC_URI = "${LINUXPTP_SRC_URI}/files/v4.1/linuxptp-${PV}.tgz \
            file://build-Allow-CC-and-prefix-to-be-overriden.patch \
            file://Use-cross-cpp-in-incdefs.patch \
            file://0001-include-string.h-for-strncpy.patch \
+           file://systemd/[email protected] \
+           file://systemd/[email protected] \
            "
 
 SRC_URI[md5sum] = "1db8699fc155965341759be5e5aad938"
 SRC_URI[sha256sum] = "e1743d44f8208897e30895da3579e670ff919b914feb4b5a949f3e421ddde535"
 
+inherit systemd
+
 UPSTREAM_CHECK_URI = "${LINUXPTP_SRC_URI}/files/"
 UPSTREAM_CHECK_REGEX = "(?P<pver>\d+(\.\d+)+)/"
 
@@ -23,6 +27,8 @@ EXTRA_OEMAKE = "ARCH=${TARGET_ARCH} EXTRA_CFLAGS='${CFLAGS}' mandir=${mandir}"
 
 export KBUILD_OUTPUT="${RECIPE_SYSROOT}"
 
+LINUXPTP_SYSTEMD_SERVICES = "[email protected] [email protected]"
+
 do_install() {
     oe_runmake install DESTDIR=${D} prefix=${prefix}
 
@@ -35,8 +41,18 @@ do_install() {
     install -d ${D}/${sysconfdir}/linuxptp/
     install -m 644 ${S}/configs/default.cfg \
         ${D}${sysconfdir}/linuxptp/ptp4l.conf
+
+    # Install systemd services
+    install -d ${D}/${systemd_unitdir}/system/
+    for service in ${LINUXPTP_SYSTEMD_SERVICES}; do
+        install -m 644 ${WORKDIR}/systemd/$service \
+            ${D}/${systemd_unitdir}/system/$service
+    done
 }
 
+SYSTEMD_SERVICE:${PN} = "${LINUXPTP_SYSTEMD_SERVICES}"
+SYSTEMD_AUTO_ENABLE:${PN} = "disable"
+
 PACKAGES =+ "${PN}-configs"
 
 FILES:${PN}-configs += "${docdir}"
--

2.34.1

-=-=-=-=-=-=-=-=-=-=-=-
Links: You receive all messages sent to this group.
View/Reply Online (#105429): https://lists.openembedded.org/g/openembedded-devel/message/105429
Mute This Topic: https://lists.openembedded.org/mt/101900484/1997914
Group Owner: [email protected]
Unsubscribe: https://lists.openembedded.org/g/openembedded-devel/unsub [[email protected]]
-=-=-=-=-=-=-=-=-=-=-=-

#5 lore raw

Re: [oe] [meta-oe][PATCH 3/3] linuxptp: add systemd services

Hi Khem,

Quoted 33 lines
Quoted 7 lines
meta-oe/recipes-connectivity/linuxptp/linuxptp/systemd/[email protected] new file +0 -0
new file mode 100644
index 000000000000..dd2512bdca11

meta-oe/recipes-connectivity/linuxptp/linuxptp/systemd/[email protected] line 10

Quoted 10 lines
meta-oe/recipes-connectivity/linuxptp/linuxptp/systemd/[email protected] new file +10 -0
@@ -0,0 +1,13 @@
+[Unit]
+Description=Synchronize system clock or PTP hardware clock (PHC)
+Documentation=man:phc2sys
+Requires=ptp4l.service
+After=ptp4l.service
+Before=time-sync.target
+
+[Service]
+Type=simple
+ExecStart=/usr/sbin/phc2sys -w -s %I

Can these paths be derived from ${sbindir} during do_install.

Quoted 12 lines
meta-oe/recipes-connectivity/linuxptp/linuxptp/systemd/[email protected] new file +3 -0
+
+[Install]
+WantedBy=multi-user.target
meta-oe/recipes-connectivity/linuxptp/linuxptp/systemd/[email protected] new file +3 -0
new file mode 100644
index 000000000000..1bad2d72df6b
@@ -0,0 +1,11 @@
+[Unit]
+Description=Precision Time Protocol (PTP) service for %I
+Documentation=man:ptp4l
Quoted 8 lines

meta-oe/recipes-connectivity/linuxptp/linuxptp/systemd/[email protected] line 8

Quoted 5 lines
meta-oe/recipes-connectivity/linuxptp/linuxptp/systemd/[email protected] new file +5 -0
+After=sys-subsystem-net-devices-%i.device
+
+[Service]
+Type=simple
+ExecStart=/usr/sbin/ptp4l -f /etc/linuxptp/ptp4l.conf -i %I

Can these paths be derived from ${sbindir} and ${sysconfdir} bitbake variables during do_install ? This should make them more portable

Yes I can do that, for both ${sbindir} and ${sysconfdir}, I see the makefile sets sbindir = $(prefix)/sbin, we already pass ${prefix} in the make command line, do you think we should pass also sbindir= to ensure consistency?

#6 lore raw

Re: [oe] [meta-oe][PATCH 3/3] linuxptp: add systemd services

Quoted 48 lines · Luca Fancellu

Hi Khem,

Quoted 2 lines
Quoted 2 lines

diff --git

a/meta-oe/recipes-connectivity/linuxptp/linuxptp/systemd/[email protected] b/meta-oe/recipes-connectivity/linuxptp/linuxptp/systemd/[email protected]

Quoted 4 lines

meta-oe/recipes-connectivity/linuxptp/linuxptp/systemd/phc2sys@

Quoted 4 lines

new file mode 100644
index 000000000000..dd2512bdca11

meta-oe/recipes-connectivity/linuxptp/linuxptp/systemd/phc2sys@ new file +0 -0

.service

Quoted 15 lines

meta-oe/recipes-connectivity/linuxptp/linuxptp/systemd/phc2sys@ line 10

Quoted 11 lines
meta-oe/recipes-connectivity/linuxptp/linuxptp/systemd/phc2sys@ new file +10 -0
@@ -0,0 +1,13 @@
+[Unit]
+Description=Synchronize system clock or PTP hardware clock (PHC)
+Documentation=man:phc2sys
+Requires=ptp4l.service
+After=ptp4l.service
+Before=time-sync.target
+
+[Service]
+Type=simple
+ExecStart=/usr/sbin/phc2sys -w -s %I

Can these paths be derived from ${sbindir} during do_install.

Quoted 4 lines
Quoted 4 lines
meta-oe/recipes-connectivity/linuxptp/linuxptp/systemd/phc2sys@ new file +3 -0
+
+[Install]
+WantedBy=multi-user.target

diff --git

a/meta-oe/recipes-connectivity/linuxptp/linuxptp/systemd/[email protected] b/meta-oe/recipes-connectivity/linuxptp/linuxptp/systemd/[email protected]

Quoted 4 lines

meta-oe/recipes-connectivity/linuxptp/linuxptp/systemd/ptp4l@

Quoted 4 lines

new file mode 100644
index 000000000000..1bad2d72df6b

meta-oe/recipes-connectivity/linuxptp/linuxptp/systemd/ptp4l@ new file +0 -0

.service

Quoted 11 lines

meta-oe/recipes-connectivity/linuxptp/linuxptp/systemd/ptp4l@ line 8

Quoted 9 lines
meta-oe/recipes-connectivity/linuxptp/linuxptp/systemd/ptp4l@ new file +8 -0
@@ -0,0 +1,11 @@
+[Unit]
+Description=Precision Time Protocol (PTP) service for %I
+Documentation=man:ptp4l
+After=sys-subsystem-net-devices-%i.device
+
+[Service]
+Type=simple
+ExecStart=/usr/sbin/ptp4l -f /etc/linuxptp/ptp4l.conf -i %I

Can these paths be derived from ${sbindir} and ${sysconfdir} bitbake

Quoted 8 lines

variables

Quoted 1 line

during do_install ? This should make them more portable

Yes I can do that, for both ${sbindir} and ${sysconfdir}, I see the makefile sets
sbindir = $(prefix)/sbin, we already pass ${prefix} in the make command line,
do you think we should pass also sbindir= to ensure consistency?

I think it is that we store the origin service file as a template like service.in and then when installing it during do_install substitute the paths with original value of these variables there are many examples of this in metadata

Quoted 3 lines
#7 lore raw

Re: [oe] [meta-oe][PATCH 3/3] linuxptp: add systemd services

Quoted 51 lines · Khem Raj

On Thu, Oct 12, 2023 at 2:56 AM Luca Fancellu <[email protected]> wrote:
Hi Khem,

Quoted 33 lines
Quoted 7 lines
meta-oe/recipes-connectivity/linuxptp/linuxptp/systemd/[email protected] new file +0 -0
new file mode 100644
index 000000000000..dd2512bdca11

meta-oe/recipes-connectivity/linuxptp/linuxptp/systemd/[email protected] line 10

Quoted 10 lines
meta-oe/recipes-connectivity/linuxptp/linuxptp/systemd/[email protected] new file +10 -0
@@ -0,0 +1,13 @@
+[Unit]
+Description=Synchronize system clock or PTP hardware clock (PHC)
+Documentation=man:phc2sys
+Requires=ptp4l.service
+After=ptp4l.service
+Before=time-sync.target
+
+[Service]
+Type=simple
+ExecStart=/usr/sbin/phc2sys -w -s %I

Can these paths be derived from ${sbindir} during do_install.

Quoted 12 lines
meta-oe/recipes-connectivity/linuxptp/linuxptp/systemd/[email protected] new file +3 -0
+
+[Install]
+WantedBy=multi-user.target
meta-oe/recipes-connectivity/linuxptp/linuxptp/systemd/[email protected] new file +3 -0
new file mode 100644
index 000000000000..1bad2d72df6b
@@ -0,0 +1,11 @@
+[Unit]
+Description=Precision Time Protocol (PTP) service for %I
+Documentation=man:ptp4l
Quoted 8 lines

meta-oe/recipes-connectivity/linuxptp/linuxptp/systemd/[email protected] line 8

Quoted 5 lines
meta-oe/recipes-connectivity/linuxptp/linuxptp/systemd/[email protected] new file +5 -0
+After=sys-subsystem-net-devices-%i.device
+
+[Service]
+Type=simple
+ExecStart=/usr/sbin/ptp4l -f /etc/linuxptp/ptp4l.conf -i %I

Can these paths be derived from ${sbindir} and ${sysconfdir} bitbake variables during do_install ? This should make them more portable

Quoted 7 lines

Yes I can do that, for both ${sbindir} and ${sysconfdir}, I see the makefile sets sbindir = $(prefix)/sbin, we already pass ${prefix} in the make command line, do you think we should pass also sbindir= to ensure consistency?

I think it is that we store the origin service file as a template like service.in and then when installing it during do_install substitute the paths with original value of these variables there are many examples of this in metadata

Yes of course, that part is very clear, what I’m asking is:

Since the Makefile hardcode sbindir, is it enough if I replace ${prefix} and ${sysconfdir} in the service?

For example here:

Quoted 10 lines
Quoted 10 lines

meta-oe/recipes-connectivity/linuxptp/linuxptp/systemd/[email protected] line 8

Quoted 10 lines
meta-oe/recipes-connectivity/linuxptp/linuxptp/systemd/[email protected] new file +9 -0
+++ b/meta-oe/recipes-connectivity/linuxptp/linuxptp/systemd/[email protected]
@@ -0,0 +1,11 @@
+[Unit]
+Description=Precision Time Protocol (PTP) service for %I
+Documentation=man:ptp4l
+After=sys-subsystem-net-devices-%i.device
+
+[Service]
+Type=simple
+ExecStart=/usr/sbin/ptp4l -f /etc/linuxptp/ptp4l.conf -i %I

It will be: ExecStart=@PREFIX@/sbin/ptp4l -f @SYSCONFDIR@/linuxptp/ptp4l.conf -i %I

So that in do_install I can do the sed substitution using ${prefix} and ${sysconfdir}

#8 lore raw

Re: [oe] [meta-oe][PATCH 3/3] linuxptp: add systemd services

Quoted 65 lines · Luca Fancellu
Quoted 52 lines · Khem Raj

On Thu, Oct 12, 2023 at 2:56 AM Luca Fancellu <[email protected]> wrote:
Hi Khem,

Quoted 33 lines
Quoted 7 lines
meta-oe/recipes-connectivity/linuxptp/linuxptp/systemd/[email protected] new file +0 -0
new file mode 100644
index 000000000000..dd2512bdca11

meta-oe/recipes-connectivity/linuxptp/linuxptp/systemd/[email protected] line 10

Quoted 10 lines
meta-oe/recipes-connectivity/linuxptp/linuxptp/systemd/[email protected] new file +10 -0
@@ -0,0 +1,13 @@
+[Unit]
+Description=Synchronize system clock or PTP hardware clock (PHC)
+Documentation=man:phc2sys
+Requires=ptp4l.service
+After=ptp4l.service
+Before=time-sync.target
+
+[Service]
+Type=simple
+ExecStart=/usr/sbin/phc2sys -w -s %I

Can these paths be derived from ${sbindir} during do_install.

Quoted 12 lines
meta-oe/recipes-connectivity/linuxptp/linuxptp/systemd/[email protected] new file +3 -0
+
+[Install]
+WantedBy=multi-user.target
meta-oe/recipes-connectivity/linuxptp/linuxptp/systemd/[email protected] new file +3 -0
new file mode 100644
index 000000000000..1bad2d72df6b
@@ -0,0 +1,11 @@
+[Unit]
+Description=Precision Time Protocol (PTP) service for %I
+Documentation=man:ptp4l
Quoted 8 lines

meta-oe/recipes-connectivity/linuxptp/linuxptp/systemd/[email protected] line 8

Quoted 5 lines
meta-oe/recipes-connectivity/linuxptp/linuxptp/systemd/[email protected] new file +5 -0
+After=sys-subsystem-net-devices-%i.device
+
+[Service]
+Type=simple
+ExecStart=/usr/sbin/ptp4l -f /etc/linuxptp/ptp4l.conf -i %I

Can these paths be derived from ${sbindir} and ${sysconfdir} bitbake variables during do_install ? This should make them more portable

Quoted 7 lines

Yes I can do that, for both ${sbindir} and ${sysconfdir}, I see the makefile sets sbindir = $(prefix)/sbin, we already pass ${prefix} in the make command line, do you think we should pass also sbindir= to ensure consistency?

I think it is that we store the origin service file as a template like service.in and then when installing it during do_install substitute the paths with original value of these variables there are many examples of this in metadata

Yes of course, that part is very clear, what I’m asking is:

Since the Makefile hardcode sbindir, is it enough if I replace ${prefix} and ${sysconfdir} in the service?

For example here:

Quoted 12 lines
Quoted 10 lines
Quoted 10 lines

meta-oe/recipes-connectivity/linuxptp/linuxptp/systemd/[email protected] line 8

Quoted 10 lines
meta-oe/recipes-connectivity/linuxptp/linuxptp/systemd/[email protected] new file +9 -0
+++ b/meta-oe/recipes-connectivity/linuxptp/linuxptp/systemd/[email protected]
@@ -0,0 +1,11 @@
+[Unit]
+Description=Precision Time Protocol (PTP) service for %I
+Documentation=man:ptp4l
+After=sys-subsystem-net-devices-%i.device
+
+[Service]
+Type=simple
+ExecStart=/usr/sbin/ptp4l -f /etc/linuxptp/ptp4l.conf -i %I

It will be: ExecStart=@PREFIX@/sbin/ptp4l -f @SYSCONFDIR@/linuxptp/ptp4l.conf -i %I

just ensure it keeps working for usrmerge DISTRO_FEATURE as well.

Quoted 4 lines

So that in do_install I can do the sed substitution using ${prefix} and ${sysconfdir}