mirror of
https://github.com/MiyooCFW/buildroot.git
synced 2025-09-27 22:24:19 +03:00
Merge from bittboy/buildroot@db180c0
This commit is contained in:
38
package/openntpd/0001-fix-musl.patch
Normal file
38
package/openntpd/0001-fix-musl.patch
Normal file
@@ -0,0 +1,38 @@
|
||||
From: Baruch Siach <baruch@tkos.co.il>
|
||||
Date: Fri, 29 Sep 2017 10:06:52 +0300
|
||||
Subject: [PATCH] Fix build with musl and older Linux kernel
|
||||
|
||||
The musl libc carries its own copy of Linux system calls. When building
|
||||
with Linux headers older than v3.17, musl provides SYS_getrandom
|
||||
definition, but not GRND_NONBLOCK. This causes build failure for
|
||||
libressl and openntpd:
|
||||
|
||||
getentropy_linux.c: In function 'getentropy_getrandom':
|
||||
getentropy_linux.c:205:42: error: 'GRND_NONBLOCK' undeclared (first use in this function)
|
||||
ret = syscall(SYS_getrandom, buf, len, GRND_NONBLOCK);
|
||||
^~~~~~~~~~~~~
|
||||
|
||||
Define GRND_NONBLOCK locally when its definition is missing to fix the
|
||||
build. There should be no run-time effect. Older kernels return ENOSYS
|
||||
for unsupported syscall().
|
||||
|
||||
[ from upstream pull request with file location changed ]
|
||||
Signed-off-by: Baruch Siach <baruch@tkos.co.il>
|
||||
---
|
||||
Upstream status: https://github.com/libressl-portable/openbsd/pull/82
|
||||
|
||||
diff -Nuar openntpd-6.2p2-orig/compat/getentropy_linux.c openntpd-6.2p2/compat/getentropy_linux.c
|
||||
--- openntpd-6.2p2-orig/compat/getentropy_linux.c 2017-09-07 22:12:02.000000000 +0300
|
||||
+++ openntpd-6.2p2/compat/getentropy_linux.c 2017-09-29 11:54:54.856245770 +0300
|
||||
@@ -194,6 +194,11 @@
|
||||
}
|
||||
|
||||
#ifdef SYS_getrandom
|
||||
+
|
||||
+#ifndef GRND_NONBLOCK
|
||||
+#define GRND_NONBLOCK 0x0001
|
||||
+#endif
|
||||
+
|
||||
static int
|
||||
getentropy_getrandom(void *buf, size_t len)
|
||||
{
|
||||
20
package/openntpd/Config.in
Normal file
20
package/openntpd/Config.in
Normal file
@@ -0,0 +1,20 @@
|
||||
config BR2_PACKAGE_OPENNTPD
|
||||
bool "openntpd"
|
||||
depends on BR2_TOOLCHAIN_HAS_THREADS_NPTL
|
||||
depends on BR2_USE_MMU # fork ()
|
||||
depends on !BR2_PACKAGE_NTP # conflicting binaries
|
||||
help
|
||||
OpenNTPD is an easy to use implementation of the Network Time
|
||||
Protocol. It provides the ability to sync the local clock
|
||||
to remote NTP servers and can act as NTP server itself,
|
||||
redistributing the local clock. It just works.
|
||||
|
||||
Crypto support is available if the LibreSSL library is
|
||||
enabled.
|
||||
|
||||
http://www.openntpd.org/
|
||||
|
||||
comment "openntpd needs a toolchain w/ NPTL"
|
||||
depends on BR2_USE_MMU
|
||||
depends on !BR2_PACKAGE_NTP
|
||||
depends on !BR2_TOOLCHAIN_HAS_THREADS_NPTL
|
||||
24
package/openntpd/S49ntp
Normal file
24
package/openntpd/S49ntp
Normal file
@@ -0,0 +1,24 @@
|
||||
#!/bin/sh
|
||||
|
||||
[ -f /etc/ntpd.conf ] || exit 0
|
||||
|
||||
case "$1" in
|
||||
start)
|
||||
printf "Starting openntpd: "
|
||||
start-stop-daemon -S -x /usr/sbin/ntpd -- -s -p /run/ntpd.pid
|
||||
[ $? = 0 ] && echo "OK" || echo "FAIL"
|
||||
;;
|
||||
stop)
|
||||
printf "Stopping openntpd: "
|
||||
start-stop-daemon -K -q -p /run/ntpd.pid
|
||||
[ $? = 0 ] && echo "OK" || echo "FAIL"
|
||||
;;
|
||||
restart)
|
||||
"$0" stop
|
||||
sleep 1
|
||||
"$0" start
|
||||
;;
|
||||
*)
|
||||
echo "Usage: $0 {start|stop|restart}"
|
||||
;;
|
||||
esac
|
||||
11
package/openntpd/ntpd.service
Normal file
11
package/openntpd/ntpd.service
Normal file
@@ -0,0 +1,11 @@
|
||||
[Unit]
|
||||
Description=OpenNTP Daemon
|
||||
After=network.target
|
||||
Conflicts=systemd-timesyncd.service
|
||||
|
||||
[Service]
|
||||
Type=simple
|
||||
ExecStart=/usr/sbin/ntpd -s -d
|
||||
|
||||
[Install]
|
||||
WantedBy=multi-user.target
|
||||
5
package/openntpd/openntpd.hash
Normal file
5
package/openntpd/openntpd.hash
Normal file
@@ -0,0 +1,5 @@
|
||||
# from http://ftp.openbsd.org/pub/OpenBSD/OpenNTPD/SHA256
|
||||
sha256 7b02691524197e01ba6b1b4b7595b33956e657ba6d5c4cf2fc20ea3f4914c13a openntpd-6.2p3.tar.gz
|
||||
|
||||
# Locally computed
|
||||
sha256 6c1822ee950652c12bb3773849db18794f62c63452a70d018edf23e8cba71839 COPYING
|
||||
41
package/openntpd/openntpd.mk
Normal file
41
package/openntpd/openntpd.mk
Normal file
@@ -0,0 +1,41 @@
|
||||
################################################################################
|
||||
#
|
||||
# openntpd
|
||||
#
|
||||
################################################################################
|
||||
|
||||
OPENNTPD_VERSION = 6.2p3
|
||||
OPENNTPD_SITE = http://ftp.openbsd.org/pub/OpenBSD/OpenNTPD
|
||||
OPENNTPD_LICENSE = MIT-like, BSD-2-Clause, BSD-3-Clause
|
||||
OPENNTPD_LICENSE_FILES = COPYING
|
||||
# Need to autoreconf for our libtool patch to apply properly
|
||||
OPENNTPD_AUTORECONF = YES
|
||||
|
||||
# Openntpd searches for tls_config_set_ca_mem which is only available
|
||||
# in LibreSSL
|
||||
ifeq ($(BR2_PACKAGE_LIBRESSL),y)
|
||||
OPENNTPD_DEPENDENCIES += openssl
|
||||
endif
|
||||
|
||||
# openntpd uses pthread functions for arc4random emulation but forgets
|
||||
# to use -pthread
|
||||
OPENNTPD_CONF_ENV += CFLAGS="$(TARGET_CFLAGS) -pthread"
|
||||
|
||||
define OPENNTPD_INSTALL_INIT_SYSTEMD
|
||||
$(INSTALL) -D -m 0644 package/openntpd/ntpd.service \
|
||||
$(TARGET_DIR)/usr/lib/systemd/system/ntpd.service
|
||||
mkdir -p $(TARGET_DIR)/etc/systemd/system/multi-user.target.wants
|
||||
ln -fs ../../../../usr/lib/systemd/system/ntpd.service \
|
||||
$(TARGET_DIR)/etc/systemd/system/multi-user.target.wants/ntpd.service
|
||||
endef
|
||||
|
||||
define OPENNTPD_INSTALL_INIT_SYSV
|
||||
$(INSTALL) -m 0755 -D package/openntpd/S49ntp \
|
||||
$(TARGET_DIR)/etc/init.d/S49ntp
|
||||
endef
|
||||
|
||||
define OPENNTPD_USERS
|
||||
_ntp -1 _ntp -1 * - - - Network Time Protocol daemon
|
||||
endef
|
||||
|
||||
$(eval $(autotools-package))
|
||||
Reference in New Issue
Block a user