diff mbox series

[1/1] package/ntpsec: enable refclock support

Message ID 20220806070446.14508-1-guillaume.bressaix@gmail.com
State Accepted
Headers show
Series [1/1] package/ntpsec: enable refclock support | expand

Commit Message

Guillaume Bres Aug. 6, 2022, 7:04 a.m. UTC
Enable --refclocks=all configure flag,
to be able to use several synchronization sources (hardware).
Pps tools is needed for PPS input (include/timepps.h)

Signed-off-by: Guillaume W. Bres <guillaume.bressaix@gmail.com>
---
Refer to the official refclock documentation right here
https://docs.ntpsec.org/latest/refclock.html

Build script is very powerful. For instance, we could have --all
without proper pps-tools support and the configuration gets dropped out.

Resulting configuration:

Enabling Refclock Undisciplined Local Clock (local):            : Yes
Enabling Refclock Spectracom GPS Receivers (spectracom):        : Yes
Enabling Refclock TrueTime GPS/GOES/OMEGA Receivers (truetime): : Yes
Enabling Refclock Generic Reference Driver (Parse) (generic):   : Yes
Enabling Refclock Arbiter 1088A/B GPS Receiver (arbiter):       : Yes
Enabling Refclock NIST/USNO/PTB Modem Time Services (modem):    : Yes
Enabling Refclock Generic NMEA GPS Receiver (nmea):             : Yes
Enabling Refclock PPS Clock Discipline (pps):                   : Yes
Enabling Refclock Hewlett Packard 58503A GPS Receiver (hpgps):  : Yes
Enabling Refclock Shared Memory Driver (shm):                   : Yes
Enabling Refclock Trimble Navigation GPSes (trimble):           : Yes
Enabling Refclock Motorola UT Oncore GPS (oncore):              : Yes
Enabling Refclock JJY Receivers (jjy):                          : Yes
Enabling Refclock Zyfer GPStarplus Receiver (zyfer):            : Yes
Enabling Refclock GPSD NG client protocol (gpsd):               : Yes

To have more granularity, --refclock="a, b, c" is how to describe
the configuration. I don't know how to format such a string in our interface,
I did not find similar thing is supported packages.
Commas have to be properly placed and it must not be terminated by a comma
---
 package/ntpsec/Config.in | 10 ++++++++++
 package/ntpsec/ntpsec.mk |  6 ++++++
 2 files changed, 16 insertions(+)

Comments

Yann E. MORIN Aug. 6, 2022, 7:56 a.m. UTC | #1
Guillame, All,

On 2022-08-06 09:04 +0200, Guillaume W. Bres spake thusly:
> Enable --refclocks=all configure flag,
> to be able to use several synchronization sources (hardware).
> Pps tools is needed for PPS input (include/timepps.h)

I've extended the commit log with a little blurb about why we choose to
not have a fine-grained selection.

> Signed-off-by: Guillaume W. Bres <guillaume.bressaix@gmail.com>
> ---
> Refer to the official refclock documentation right here
> https://docs.ntpsec.org/latest/refclock.html

Thanks!

[--SNIP--]
> To have more granularity, --refclock="a, b, c" is how to describe
> the configuration. I don't know how to format such a string in our interface,
> I did not find similar thing is supported packages.
> Commas have to be properly placed and it must not be terminated by a comma

It's rather simple, and we use similar constructs quite a lot:

    NTPSEC_REFCLOCK_LIST = $(subst $(space),$(comma)$(space),$(call qstrip,$(BR2_PACAGE_NTPSEC_REFCLOCK_LIST)))
    NTPSEC_CONF_OPTS += --reflock="$(NTPSEC_REFCLOCK_LIST)"

But I don't think a fine-grained selection is needed: except for PPS
which needs pps-tools, no other refclock has an external dependency,
so the coarse-grained all(or(nothing is good-enough.

> diff --git a/package/ntpsec/Config.in b/package/ntpsec/Config.in
> index c81673481e..d31806c886 100644
> --- a/package/ntpsec/Config.in
> +++ b/package/ntpsec/Config.in
> @@ -29,6 +29,16 @@ config BR2_PACKAGE_NTPSEC_NTS
>  	help
>  	  Enable Network Time Security (NTS) support.
>  
> +menu "Refclocks"

No need for a sub-menu; I dropped it.

Applied to master with the above changes, thanks.

Regards,
Yann E. MORIN.

> +config BR2_PACKAGE_NTPSEC_REFCLOCK_ALL
> +	bool "refclock-all"
> +	select BR2_PACKAGE_PPS_TOOLS
> +	help
> +	  Enable all refclocks (hardware, sync source and discplined
> +	  clocks)
> +
> +endmenu
>  endif
>  
>  comment "ntpsec needs a toolchain w/ wchar, threads, dynamic library"
> diff --git a/package/ntpsec/ntpsec.mk b/package/ntpsec/ntpsec.mk
> index a0d0662947..3822b40dbb 100644
> --- a/package/ntpsec/ntpsec.mk
> +++ b/package/ntpsec/ntpsec.mk
> @@ -53,6 +53,12 @@ ifeq ($(BR2_PACKAGE_NTPSEC_NTS),)
>  NTPSEC_CONF_OPTS += --disable-nts
>  endif
>  
> +# support all refclocks
> +ifeq ($(BR2_PACKAGE_NTPSEC_REFCLOCK_ALL),y)
> +NTPSEC_CONF_OPTS += --refclock=all
> +NTPSEC_DEPENDENCIES += pps-tools
> +endif
> +
>  define NTPSEC_INSTALL_NTPSEC_CONF
>  	$(INSTALL) -m 644 package/ntpsec/ntpd.etc.conf $(TARGET_DIR)/etc/ntp.conf
>  endef
> -- 
> 2.20.1
> 
> _______________________________________________
> buildroot mailing list
> buildroot@buildroot.org
> https://lists.buildroot.org/mailman/listinfo/buildroot
diff mbox series

Patch

diff --git a/package/ntpsec/Config.in b/package/ntpsec/Config.in
index c81673481e..d31806c886 100644
--- a/package/ntpsec/Config.in
+++ b/package/ntpsec/Config.in
@@ -29,6 +29,16 @@  config BR2_PACKAGE_NTPSEC_NTS
 	help
 	  Enable Network Time Security (NTS) support.
 
+menu "Refclocks"
+
+config BR2_PACKAGE_NTPSEC_REFCLOCK_ALL
+	bool "refclock-all"
+	select BR2_PACKAGE_PPS_TOOLS
+	help
+	  Enable all refclocks (hardware, sync source and discplined
+	  clocks)
+
+endmenu
 endif
 
 comment "ntpsec needs a toolchain w/ wchar, threads, dynamic library"
diff --git a/package/ntpsec/ntpsec.mk b/package/ntpsec/ntpsec.mk
index a0d0662947..3822b40dbb 100644
--- a/package/ntpsec/ntpsec.mk
+++ b/package/ntpsec/ntpsec.mk
@@ -53,6 +53,12 @@  ifeq ($(BR2_PACKAGE_NTPSEC_NTS),)
 NTPSEC_CONF_OPTS += --disable-nts
 endif
 
+# support all refclocks
+ifeq ($(BR2_PACKAGE_NTPSEC_REFCLOCK_ALL),y)
+NTPSEC_CONF_OPTS += --refclock=all
+NTPSEC_DEPENDENCIES += pps-tools
+endif
+
 define NTPSEC_INSTALL_NTPSEC_CONF
 	$(INSTALL) -m 644 package/ntpsec/ntpd.etc.conf $(TARGET_DIR)/etc/ntp.conf
 endef