diff options
3 files changed, 40 insertions, 0 deletions
diff --git a/meta-oe/recipes-connectivity/linuxptp/linuxptp/systemd/phc2sys@.service b/meta-oe/recipes-connectivity/linuxptp/linuxptp/systemd/phc2sys@.service new file mode 100644 index 0000000000..dd2512bdca --- /dev/null +++ b/meta-oe/recipes-connectivity/linuxptp/linuxptp/systemd/phc2sys@.service | |||
| @@ -0,0 +1,13 @@ | |||
| 1 | [Unit] | ||
| 2 | Description=Synchronize system clock or PTP hardware clock (PHC) | ||
| 3 | Documentation=man:phc2sys | ||
| 4 | Requires=ptp4l.service | ||
| 5 | After=ptp4l.service | ||
| 6 | Before=time-sync.target | ||
| 7 | |||
| 8 | [Service] | ||
| 9 | Type=simple | ||
| 10 | ExecStart=/usr/sbin/phc2sys -w -s %I | ||
| 11 | |||
| 12 | [Install] | ||
| 13 | WantedBy=multi-user.target | ||
diff --git a/meta-oe/recipes-connectivity/linuxptp/linuxptp/systemd/ptp4l@.service b/meta-oe/recipes-connectivity/linuxptp/linuxptp/systemd/ptp4l@.service new file mode 100644 index 0000000000..1bad2d72df --- /dev/null +++ b/meta-oe/recipes-connectivity/linuxptp/linuxptp/systemd/ptp4l@.service | |||
| @@ -0,0 +1,11 @@ | |||
| 1 | [Unit] | ||
| 2 | Description=Precision Time Protocol (PTP) service for %I | ||
| 3 | Documentation=man:ptp4l | ||
| 4 | After=sys-subsystem-net-devices-%i.device | ||
| 5 | |||
| 6 | [Service] | ||
| 7 | Type=simple | ||
| 8 | ExecStart=/usr/sbin/ptp4l -f /etc/linuxptp/ptp4l.conf -i %I | ||
| 9 | |||
| 10 | [Install] | ||
| 11 | WantedBy=multi-user.target | ||
diff --git a/meta-oe/recipes-connectivity/linuxptp/linuxptp_4.1.bb b/meta-oe/recipes-connectivity/linuxptp/linuxptp_4.1.bb index 3c7efbdeca..95ed76e621 100644 --- a/meta-oe/recipes-connectivity/linuxptp/linuxptp_4.1.bb +++ b/meta-oe/recipes-connectivity/linuxptp/linuxptp_4.1.bb | |||
| @@ -11,11 +11,15 @@ SRC_URI = "${LINUXPTP_SRC_URI}/files/v4.1/linuxptp-${PV}.tgz \ | |||
| 11 | file://build-Allow-CC-and-prefix-to-be-overriden.patch \ | 11 | file://build-Allow-CC-and-prefix-to-be-overriden.patch \ |
| 12 | file://Use-cross-cpp-in-incdefs.patch \ | 12 | file://Use-cross-cpp-in-incdefs.patch \ |
| 13 | file://0001-include-string.h-for-strncpy.patch \ | 13 | file://0001-include-string.h-for-strncpy.patch \ |
| 14 | file://systemd/phc2sys@.service \ | ||
| 15 | file://systemd/ptp4l@.service \ | ||
| 14 | " | 16 | " |
| 15 | 17 | ||
| 16 | SRC_URI[md5sum] = "1db8699fc155965341759be5e5aad938" | 18 | SRC_URI[md5sum] = "1db8699fc155965341759be5e5aad938" |
| 17 | SRC_URI[sha256sum] = "e1743d44f8208897e30895da3579e670ff919b914feb4b5a949f3e421ddde535" | 19 | SRC_URI[sha256sum] = "e1743d44f8208897e30895da3579e670ff919b914feb4b5a949f3e421ddde535" |
| 18 | 20 | ||
| 21 | inherit systemd | ||
| 22 | |||
| 19 | UPSTREAM_CHECK_URI = "${LINUXPTP_SRC_URI}/files/" | 23 | UPSTREAM_CHECK_URI = "${LINUXPTP_SRC_URI}/files/" |
| 20 | UPSTREAM_CHECK_REGEX = "(?P<pver>\d+(\.\d+)+)/" | 24 | UPSTREAM_CHECK_REGEX = "(?P<pver>\d+(\.\d+)+)/" |
| 21 | 25 | ||
| @@ -23,6 +27,8 @@ EXTRA_OEMAKE = "ARCH=${TARGET_ARCH} EXTRA_CFLAGS='${CFLAGS}' mandir=${mandir}" | |||
| 23 | 27 | ||
| 24 | export KBUILD_OUTPUT="${RECIPE_SYSROOT}" | 28 | export KBUILD_OUTPUT="${RECIPE_SYSROOT}" |
| 25 | 29 | ||
| 30 | LINUXPTP_SYSTEMD_SERVICES = "phc2sys@.service ptp4l@.service" | ||
| 31 | |||
| 26 | do_install() { | 32 | do_install() { |
| 27 | oe_runmake install DESTDIR=${D} prefix=${prefix} | 33 | oe_runmake install DESTDIR=${D} prefix=${prefix} |
| 28 | 34 | ||
| @@ -35,8 +41,18 @@ do_install() { | |||
| 35 | install -d ${D}/${sysconfdir}/linuxptp/ | 41 | install -d ${D}/${sysconfdir}/linuxptp/ |
| 36 | install -m 644 ${S}/configs/default.cfg \ | 42 | install -m 644 ${S}/configs/default.cfg \ |
| 37 | ${D}${sysconfdir}/linuxptp/ptp4l.conf | 43 | ${D}${sysconfdir}/linuxptp/ptp4l.conf |
| 44 | |||
| 45 | # Install systemd services | ||
| 46 | install -d ${D}/${systemd_unitdir}/system/ | ||
| 47 | for service in ${LINUXPTP_SYSTEMD_SERVICES}; do | ||
| 48 | install -m 644 ${WORKDIR}/systemd/$service \ | ||
| 49 | ${D}/${systemd_unitdir}/system/$service | ||
| 50 | done | ||
| 38 | } | 51 | } |
| 39 | 52 | ||
| 53 | SYSTEMD_SERVICE:${PN} = "${LINUXPTP_SYSTEMD_SERVICES}" | ||
| 54 | SYSTEMD_AUTO_ENABLE:${PN} = "disable" | ||
| 55 | |||
| 40 | PACKAGES =+ "${PN}-configs" | 56 | PACKAGES =+ "${PN}-configs" |
| 41 | 57 | ||
| 42 | FILES:${PN}-configs += "${docdir}" | 58 | FILES:${PN}-configs += "${docdir}" |
