blob: 6a450c3e88e39a6cffaafaf85251092a595d5608 [file] [log] [blame]
Brad Bishopc342db32019-05-15 21:57:59 -04001SUMMARY = "Versatile implementation of the Network Time Protocol"
2DESCRIPTION = "Chrony can synchronize the system clock with NTP \
3servers, reference clocks (e.g. GPS receiver), and manual input using \
4wristwatch and keyboard. It can also operate as an NTPv4 (RFC 5905) \
5server and peer to provide a time service to other computers in the \
6network. \
7\
8It is designed to perform well in a wide range of conditions, \
9including intermittent network connections, heavily congested \
10networks, changing temperatures (ordinary computer clocks are \
11sensitive to temperature), and systems that do not run continuously, or \
12run on a virtual machine. \
13\
14Typical accuracy between two machines on a LAN is in tens, or a few \
15hundreds, of microseconds; over the Internet, accuracy is typically \
16within a few milliseconds. With a good hardware reference clock \
17sub-microsecond accuracy is possible. \
18\
19Two programs are included in chrony: chronyd is a daemon that can be \
20started at boot time and chronyc is a command-line interface program \
21which can be used to monitor chronyd's performance and to change \
22various operating parameters whilst it is running. \
23\
24This recipe produces two binary packages: 'chrony' which contains chronyd, \
25the configuration file and the init script, and 'chronyc' which contains \
26the client program only."
27
28HOMEPAGE = "https://chrony.tuxfamily.org/"
29SECTION = "net"
30LICENSE = "GPLv2"
31LIC_FILES_CHKSUM = "file://COPYING;md5=751419260aa954499f7abaabaa882bbe"
32
33SRC_URI = "https://download.tuxfamily.org/chrony/chrony-${PV}.tar.gz \
34 file://chrony.conf \
35 file://chronyd \
36 file://arm_eabi.patch \
37"
38
Patrick Williams213cb262021-08-07 19:21:33 -050039SRC_URI:append:libc-musl = " \
Brad Bishopc342db32019-05-15 21:57:59 -040040 file://0001-Fix-compilation-with-musl.patch \
41"
William A. Kennington IIIb95905d2021-06-02 12:40:56 -070042SRC_URI[sha256sum] = "ed76f2d3f9347ac6221a91ad4bd553dd0565ac188cd7490d0801d08f7171164c"
Brad Bishopc342db32019-05-15 21:57:59 -040043
44DEPENDS = "pps-tools"
45
46# Note: Despite being built via './configure; make; make install',
47# chrony does not use GNU Autotools.
48inherit update-rc.d systemd
49
50# Configuration options:
51# - For command line editing support in chronyc, you may specify either
52# 'editline' or 'readline' but not both. editline is smaller, but
53# many systems already have readline for other purposes so you might want
54# to choose that instead. However, beware license incompatibility
55# since chrony is GPLv2 and readline versions after 6.0 are GPLv3+.
56# You can of course choose neither, but if you're that tight on space
57# consider dropping chronyc entirely (you can use it remotely with
58# appropriate chrony.conf options).
59# - Security-related:
60# - 'sechash' is omitted by default because it pulls in nss which is huge.
61# - 'privdrop' allows chronyd to run as non-root; would need changes to
62# chrony.conf and init script.
63# - 'scfilter' enables support for system call filtering, but requires the
64# kernel to have CONFIG_SECCOMP enabled.
65PACKAGECONFIG ??= "editline \
66 ${@bb.utils.filter('DISTRO_FEATURES', 'ipv6', d)} \
67"
68PACKAGECONFIG[readline] = "--without-editline,--without-readline,readline"
69PACKAGECONFIG[editline] = ",--without-editline,libedit"
70PACKAGECONFIG[sechash] = "--without-tomcrypt,--disable-sechash,nss"
71PACKAGECONFIG[privdrop] = ",--disable-privdrop,libcap"
72PACKAGECONFIG[scfilter] = "--enable-scfilter,--without-seccomp,libseccomp"
73PACKAGECONFIG[ipv6] = ",--disable-ipv6,"
74PACKAGECONFIG[nss] = "--with-nss,--without-nss,nss"
75PACKAGECONFIG[libcap] = "--with-libcap,--without-libcap,libcap"
76
77# --disable-static isn't supported by chrony's configure script.
78DISABLE_STATIC = ""
79
80do_configure() {
81 ./configure --sysconfdir=${sysconfdir} --bindir=${bindir} --sbindir=${sbindir} \
82 --localstatedir=${localstatedir} --datarootdir=${datadir} \
Andrew Geissler4b7c1152020-11-30 19:55:29 -060083 --with-ntp-era=$(shell date -d '1970-01-01 00:00:00+00:00' +'%s') \
84 --with-pidfile=/run/chrony/chronyd.pid \
85 --chronyrundir=/run/chrony \
86 --host-system=Linux \
Brad Bishopc342db32019-05-15 21:57:59 -040087 ${PACKAGECONFIG_CONFARGS}
88}
89
90do_install() {
91 # Binaries
92 install -d ${D}${bindir}
93 install -m 0755 ${S}/chronyc ${D}${bindir}
94 install -d ${D}${sbindir}
95 install -m 0755 ${S}/chronyd ${D}${sbindir}
96
97 # Config file
98 install -d ${D}${sysconfdir}
99 install -m 644 ${WORKDIR}/chrony.conf ${D}${sysconfdir}
100
101 # System V init script
102 install -d ${D}${sysconfdir}/init.d
103 install -m 755 ${WORKDIR}/chronyd ${D}${sysconfdir}/init.d
104
105 # systemd unit configuration file
106 install -d ${D}${systemd_unitdir}/system
107 install -m 0644 ${S}/examples/chronyd.service ${D}${systemd_unitdir}/system/
108
109 # Variable data (for drift and/or rtc file)
110 install -d ${D}${localstatedir}/lib/chrony
111
Brad Bishopc342db32019-05-15 21:57:59 -0400112 # Fix hard-coded paths in config files and init scripts
113 sed -i -e 's!/var/!${localstatedir}/!g' -e 's!/etc/!${sysconfdir}/!g' \
114 -e 's!/usr/sbin/!${sbindir}/!g' -e 's!/usr/bin/!${bindir}/!g' \
115 ${D}${sysconfdir}/chrony.conf \
116 ${D}${sysconfdir}/init.d/chronyd \
117 ${D}${systemd_unitdir}/system/chronyd.service
118 sed -i 's!^PATH=.*!PATH=${base_sbindir}:${base_bindir}:${sbindir}:${bindir}!' ${D}${sysconfdir}/init.d/chronyd
119 sed -i 's!^EnvironmentFile=.*!EnvironmentFile=-${sysconfdir}/default/chronyd!' ${D}${systemd_unitdir}/system/chronyd.service
120}
121
Patrick Williams213cb262021-08-07 19:21:33 -0500122FILES:${PN} = "${sbindir}/chronyd ${sysconfdir} ${localstatedir}/lib/chrony ${localstatedir}"
123CONFFILES:${PN} = "${sysconfdir}/chrony.conf"
Brad Bishopc342db32019-05-15 21:57:59 -0400124INITSCRIPT_NAME = "chronyd"
125INITSCRIPT_PARAMS = "defaults"
126SYSTEMD_PACKAGES = "${PN}"
Patrick Williams213cb262021-08-07 19:21:33 -0500127SYSTEMD_SERVICE:${PN} = "chronyd.service"
Brad Bishopc342db32019-05-15 21:57:59 -0400128
129# It's probably a bad idea to run chrony and another time daemon on
130# the same system. systemd includes the SNTP client 'timesyncd', which
131# will be disabled by chronyd.service, however it will remain on the rootfs
Patrick Williams213cb262021-08-07 19:21:33 -0500132# wasting 150 kB unless you put 'PACKAGECONFIG:remove:pn-systemd = "timesyncd"'
Brad Bishopc342db32019-05-15 21:57:59 -0400133# in a conf file or bbappend somewhere.
Patrick Williams213cb262021-08-07 19:21:33 -0500134RCONFLICTS:${PN} = "ntp ntimed"
Brad Bishopc342db32019-05-15 21:57:59 -0400135
136# Separate the client program into its own package
137PACKAGES =+ "chronyc"
Patrick Williams213cb262021-08-07 19:21:33 -0500138FILES:chronyc = "${bindir}/chronyc"