From patchwork Wed Oct 11 16:33:46 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Luca Fancellu X-Patchwork-Id: 31997 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from aws-us-west-2-korg-lkml-1.web.codeaurora.org (localhost.localdomain [127.0.0.1]) by smtp.lore.kernel.org (Postfix) with ESMTP id 99BF2CDB46B for ; Wed, 11 Oct 2023 16:34:02 +0000 (UTC) Received: from foss.arm.com (foss.arm.com [217.140.110.172]) by mx.groups.io with SMTP id smtpd.web10.21328.1697042038437941511 for ; Wed, 11 Oct 2023 09:33:58 -0700 Authentication-Results: mx.groups.io; dkim=none (message not signed); spf=pass (domain: arm.com, ip: 217.140.110.172, mailfrom: luca.fancellu@arm.com) Received: from usa-sjc-imap-foss1.foss.arm.com (unknown [10.121.207.14]) by usa-sjc-mx-foss1.foss.arm.com (Postfix) with ESMTP id C5B611516; Wed, 11 Oct 2023 09:34:38 -0700 (PDT) Received: from e125770.cambridge.arm.com (e125770.arm.com [10.1.199.1]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id 810773F7A6; Wed, 11 Oct 2023 09:33:57 -0700 (PDT) From: Luca Fancellu To: openembedded-devel@lists.openembedded.org Cc: Diego.Sueiro@arm.com, Rahul.Singh@arm.com Subject: [meta-oe][PATCH 3/3] linuxptp: add systemd services Date: Wed, 11 Oct 2023 17:33:46 +0100 Message-Id: <20231011163346.1856498-4-luca.fancellu@arm.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20231011163346.1856498-1-luca.fancellu@arm.com> References: <20231011163346.1856498-1-luca.fancellu@arm.com> MIME-Version: 1.0 List-Id: X-Webhook-Received: from li982-79.members.linode.com [45.33.32.79] by aws-us-west-2-korg-lkml-1.web.codeaurora.org with HTTPS for ; Wed, 11 Oct 2023 16:34:02 -0000 X-Groupsio-URL: https://lists.openembedded.org/g/openembedded-devel/message/105429 Add systemd services phc2sys@.service and ptp4l@.service, 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. Signed-off-by: Luca Fancellu --- .../linuxptp/linuxptp/systemd/phc2sys@.service | 13 +++++++++++++ .../linuxptp/linuxptp/systemd/ptp4l@.service | 11 +++++++++++ .../linuxptp/linuxptp_4.1.bb | 16 ++++++++++++++++ 3 files changed, 40 insertions(+) create mode 100644 meta-oe/recipes-connectivity/linuxptp/linuxptp/systemd/phc2sys@.service create mode 100644 meta-oe/recipes-connectivity/linuxptp/linuxptp/systemd/ptp4l@.service 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 000000000000..dd2512bdca11 --- /dev/null +++ b/meta-oe/recipes-connectivity/linuxptp/linuxptp/systemd/phc2sys@.service @@ -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 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 000000000000..1bad2d72df6b --- /dev/null +++ b/meta-oe/recipes-connectivity/linuxptp/linuxptp/systemd/ptp4l@.service @@ -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 diff --git a/meta-oe/recipes-connectivity/linuxptp/linuxptp_4.1.bb b/meta-oe/recipes-connectivity/linuxptp/linuxptp_4.1.bb index 3c7efbdeca72..95ed76e621e6 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 \ 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/phc2sys@.service \ + file://systemd/ptp4l@.service \ " SRC_URI[md5sum] = "1db8699fc155965341759be5e5aad938" SRC_URI[sha256sum] = "e1743d44f8208897e30895da3579e670ff919b914feb4b5a949f3e421ddde535" +inherit systemd + UPSTREAM_CHECK_URI = "${LINUXPTP_SRC_URI}/files/" UPSTREAM_CHECK_REGEX = "(?P\d+(\.\d+)+)/" @@ -23,6 +27,8 @@ EXTRA_OEMAKE = "ARCH=${TARGET_ARCH} EXTRA_CFLAGS='${CFLAGS}' mandir=${mandir}" export KBUILD_OUTPUT="${RECIPE_SYSROOT}" +LINUXPTP_SYSTEMD_SERVICES = "phc2sys@.service ptp4l@.service" + 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}"