diff --git a/.gitignore b/.gitignore index 6317cd7..6cfb211 100644 --- a/.gitignore +++ b/.gitignore @@ -1,3 +1,3 @@ -/linuxptp-1.4.tgz -/clknetsim-19a8df.tar.gz -/testsuite-a1040d.tar.gz +/linuxptp-1.5.tgz +/linuxptp-testsuite-7c523f.tar.gz +/clknetsim-592d17.tar.gz diff --git a/linuxptp.spec b/linuxptp.spec index 352b66b..622409e 100644 --- a/linuxptp.spec +++ b/linuxptp.spec @@ -1,7 +1,9 @@ %global _hardened_build 1 +%global testsuite_ver 7c523f +%global clknetsim_ver 592d17 Name: linuxptp -Version: 1.4 +Version: 1.5 Release: 3%{?dist} Summary: PTP implementation for Linux @@ -12,10 +14,12 @@ URL: http://linuxptp.sourceforge.net/ Source0: http://downloads.sourceforge.net/%{name}/%{name}-%{version}.tgz Source1: phc2sys.service Source2: ptp4l.service -# test suite from https://github.com/mlichvar/linuxptp-testsuite.git -Source3: testsuite-a1040d.tar.gz -# simulator for test suite from https://github.com/mlichvar/clknetsim.git -Source4: clknetsim-19a8df.tar.gz +Source3: timemaster.service +Source4: timemaster.conf +# external test suite +Source10: https://github.com/mlichvar/linuxptp-testsuite/archive/%{testsuite_ver}/linuxptp-testsuite-%{testsuite_ver}.tar.gz +# simulator for test suite +Source11: https://github.com/mlichvar/clknetsim/archive/%{clknetsim_ver}/clknetsim-%{clknetsim_ver}.tar.gz BuildRequires: systemd-units @@ -31,8 +35,9 @@ Application Programming Interfaces (API) offered by the Linux kernel. Supporting legacy APIs and other platforms is not a goal. %prep -%setup -q -a 3 -a 4 -mv clknetsim testsuite +%setup -q -a 10 -a 11 +mv linuxptp-testsuite-%{testsuite_ver}* testsuite +mv clknetsim-%{clknetsim_ver}* testsuite/clknetsim %build make %{?_smp_mflags} \ @@ -44,13 +49,15 @@ make %{?_smp_mflags} \ mkdir -p $RPM_BUILD_ROOT{%{_sysconfdir}/sysconfig,%{_unitdir},%{_mandir}/man5} install -m 644 -p default.cfg $RPM_BUILD_ROOT%{_sysconfdir}/ptp4l.conf -install -m 644 -p %{SOURCE1} %{SOURCE2} $RPM_BUILD_ROOT%{_unitdir} +install -m 644 -p %{SOURCE1} %{SOURCE2} %{SOURCE3} $RPM_BUILD_ROOT%{_unitdir} +install -m 644 -p %{SOURCE4} $RPM_BUILD_ROOT%{_sysconfdir} echo 'OPTIONS="-f /etc/ptp4l.conf -i eth0"' > \ $RPM_BUILD_ROOT%{_sysconfdir}/sysconfig/ptp4l -echo 'OPTIONS="-w -s eth0"' > $RPM_BUILD_ROOT%{_sysconfdir}/sysconfig/phc2sys +echo 'OPTIONS="-a -r"' > $RPM_BUILD_ROOT%{_sysconfdir}/sysconfig/phc2sys echo '.so man8/ptp4l.8' > $RPM_BUILD_ROOT%{_mandir}/man5/ptp4l.conf.5 +echo '.so man8/timemaster.8' > $RPM_BUILD_ROOT%{_mandir}/man5/timemaster.conf.5 %check cd testsuite @@ -58,25 +65,29 @@ make %{?_smp_mflags} -C clknetsim PATH=..:$PATH ./run %post -%systemd_post ptp4l.service phc2sys.service +%systemd_post phc2sys.service ptp4l.service timemaster.service %preun -%systemd_preun phc2sys.service ptp4l.service +%systemd_preun phc2sys.service ptp4l.service timemaster.service %postun -%systemd_postun_with_restart ptp4l.service phc2sys.service +%systemd_postun_with_restart phc2sys.service ptp4l.service timemaster.service %files %doc COPYING README.org default.cfg gPTP.cfg %config(noreplace) %{_sysconfdir}/ptp4l.conf %config(noreplace) %{_sysconfdir}/sysconfig/phc2sys %config(noreplace) %{_sysconfdir}/sysconfig/ptp4l +%config(noreplace) %{_sysconfdir}/timemaster.conf %{_unitdir}/phc2sys.service %{_unitdir}/ptp4l.service +%{_unitdir}/timemaster.service %{_sbindir}/hwstamp_ctl %{_sbindir}/phc2sys +%{_sbindir}/phc_ctl %{_sbindir}/pmc %{_sbindir}/ptp4l +%{_sbindir}/timemaster %{_mandir}/man5/*.5* %{_mandir}/man8/*.8* diff --git a/sources b/sources index a72bd88..55408ba 100644 --- a/sources +++ b/sources @@ -1,3 +1,3 @@ -a37ad2b2ef7d1ebc4d64a66d3fe55cdf linuxptp-1.4.tgz -8719dab29f5dfbcb123576d5ceb3a4c3 clknetsim-19a8df.tar.gz -0e45824432e9289e07550ea47ccaac87 testsuite-a1040d.tar.gz +f7f24174b7ce52eccaed1748409057b0 linuxptp-1.5.tgz +b58eddcdd58c97299d7f64e476c84494 linuxptp-testsuite-7c523f.tar.gz +b55244357cd4d54f48e6db58c2bf75ae clknetsim-592d17.tar.gz diff --git a/timemaster.conf b/timemaster.conf new file mode 100644 index 0000000..a9d3663 --- /dev/null +++ b/timemaster.conf @@ -0,0 +1,32 @@ +# Configuration file for timemaster + +#[ntp_server ntp-server.local] +#minpoll 4 +#maxpoll 4 + +#[ptp_domain 0] +#interfaces eth0 + +[timemaster] +ntp_program chronyd + +[chrony.conf] +include /etc/chrony.conf + +[ntp.conf] +includefile /etc/ntp.conf + +[ptp4l.conf] + +[chronyd] +path /usr/sbin/chronyd + +[ntpd] +path /usr/sbin/ntpd +options -u ntp:ntp -g + +[phc2sys] +path /usr/sbin/phc2sys + +[ptp4l] +path /usr/sbin/ptp4l diff --git a/timemaster.service b/timemaster.service new file mode 100644 index 0000000..7505387 --- /dev/null +++ b/timemaster.service @@ -0,0 +1,11 @@ +[Unit] +Description=Synchronize system clock to NTP and PTP time sources +After=chronyd.service ntpd.service ntpdate.service sntp.service +Conflicts=chronyd.service ntpd.service phc2sys.service ptp4l.service + +[Service] +Type=simple +ExecStart=/usr/sbin/timemaster -f /etc/timemaster.conf + +[Install] +WantedBy=multi-user.target