From 972dcfcdbfe75dcfeb777150c136576cf1a71e99 Mon Sep 17 00:00:00 2001 From: Tudor Florea Date: Fri, 9 Oct 2015 22:59:03 +0200 Subject: initial commit for Enea Linux 5.0 arm Signed-off-by: Tudor Florea --- .../ntp/files/ntp-4.2.4_p6-nano.patch | 17 ++++ meta/recipes-support/ntp/files/ntp.conf | 14 ++++ meta/recipes-support/ntp/files/ntpd | 62 +++++++++++++++ meta/recipes-support/ntp/files/ntpdate | 54 +++++++++++++ meta/recipes-support/ntp/files/ntpdate.default | 7 ++ meta/recipes-support/ntp/files/openssl-check.patch | 59 ++++++++++++++ meta/recipes-support/ntp/files/tickadj.c.patch | 32 ++++++++ meta/recipes-support/ntp/ntp.inc | 93 ++++++++++++++++++++++ meta/recipes-support/ntp/ntp_4.2.6p5.bb | 7 ++ 9 files changed, 345 insertions(+) create mode 100644 meta/recipes-support/ntp/files/ntp-4.2.4_p6-nano.patch create mode 100644 meta/recipes-support/ntp/files/ntp.conf create mode 100755 meta/recipes-support/ntp/files/ntpd create mode 100755 meta/recipes-support/ntp/files/ntpdate create mode 100644 meta/recipes-support/ntp/files/ntpdate.default create mode 100644 meta/recipes-support/ntp/files/openssl-check.patch create mode 100644 meta/recipes-support/ntp/files/tickadj.c.patch create mode 100644 meta/recipes-support/ntp/ntp.inc create mode 100644 meta/recipes-support/ntp/ntp_4.2.6p5.bb (limited to 'meta/recipes-support/ntp') diff --git a/meta/recipes-support/ntp/files/ntp-4.2.4_p6-nano.patch b/meta/recipes-support/ntp/files/ntp-4.2.4_p6-nano.patch new file mode 100644 index 0000000000..cb1e2f7341 --- /dev/null +++ b/meta/recipes-support/ntp/files/ntp-4.2.4_p6-nano.patch @@ -0,0 +1,17 @@ +--- a/include/ntp_syscall.h.orig 2009-05-19 16:44:55.048156467 -0400 ++++ b/include/ntp_syscall.h 2009-05-19 16:46:19.293323686 -0400 +@@ -14,6 +14,14 @@ + # include + #endif + ++#if defined(ADJ_NANO) && !defined(MOD_NANO) ++#define MOD_NANO ADJ_NANO ++#endif ++ ++#if defined(ADJ_TAI) && !defined(MOD_TAI) ++#define MOD_TAI ADJ_TAI ++#endif ++ + #ifndef NTP_SYSCALLS_LIBC + #ifdef NTP_SYSCALLS_STD + # define ntp_adjtime(t) syscall(SYS_ntp_adjtime, (t)) diff --git a/meta/recipes-support/ntp/files/ntp.conf b/meta/recipes-support/ntp/files/ntp.conf new file mode 100644 index 0000000000..a9cc838450 --- /dev/null +++ b/meta/recipes-support/ntp/files/ntp.conf @@ -0,0 +1,14 @@ +# This is the most basic ntp configuration file +# The driftfile must remain in a place specific to this +# machine - it records the machine specific clock error +driftfile /etc/ntp.drift +# This obtains a random server which will be close +# (in IP terms) to the machine. Add other servers +# as required, or change this. +server time.server.example.com +# Using local hardware clock as fallback +# Disable this when using ntpd -q -g -x as ntpdate or it will sync to itself +server 127.127.1.0 +fudge 127.127.1.0 stratum 14 +# Defining a default security setting +restrict default diff --git a/meta/recipes-support/ntp/files/ntpd b/meta/recipes-support/ntp/files/ntpd new file mode 100755 index 0000000000..ae50f135d0 --- /dev/null +++ b/meta/recipes-support/ntp/files/ntpd @@ -0,0 +1,62 @@ +#! /bin/sh +# +# ntpd init.d script for ntpdc from ntp.isc.org +test -x /usr/bin/ntpd -a -r /etc/ntp.conf || exit 0 +# rcS contains TICKADJ +test -r /etc/default/rcS && . /etc/default/rcS + +# Functions to do individual actions +settick(){ + # If TICKADJ is set we *must* adjust it before we start, because the + # driftfile relies on the correct setting + test -n "$TICKADJ" -a -x /usr/bin/tickadj && { + echo -n "Setting tick to $TICKADJ: " + /usr/bin/tickadj "$TICKADJ" + echo "done" + } +} +startdaemon(){ + # The -g option allows ntpd to step the time to correct it just + # once. The daemon will exit if the clock drifts too much after + # this. If ntpd seems to disappear after a while assume TICKADJ + # above is set to a totally incorrect value. + echo -n "Starting ntpd: " + start-stop-daemon --start -x /usr/bin/ntpd -- -p /var/run/ntp.pid "$@" + echo "done" +} +stopdaemon(){ + echo -n "Stopping ntpd: " + start-stop-daemon --stop -p /var/run/ntp.pid + echo "done" +} + +case "$1" in + start) + settick + startdaemon -g + ;; + stop) + stopdaemon + ;; + force-reload) + stopdaemon + settick + startdaemon -g + ;; + restart) + # Don't reset the tick here + stopdaemon + startdaemon -g + ;; + reload) + # Must do this by hand, but don't do -g + stopdaemon + startdaemon + ;; + *) + echo "Usage: ntpd { start | stop | restart | reload }" >&2 + exit 1 + ;; +esac + +exit 0 diff --git a/meta/recipes-support/ntp/files/ntpdate b/meta/recipes-support/ntp/files/ntpdate new file mode 100755 index 0000000000..ab0551c5a5 --- /dev/null +++ b/meta/recipes-support/ntp/files/ntpdate @@ -0,0 +1,54 @@ +#!/bin/sh + +PATH=/sbin:/bin:/usr/bin + +test -x /usr/bin/ntpdate || exit 0 + +if test -f /etc/default/ntpdate ; then +. /etc/default/ntpdate +fi + +if [ "$NTPSERVERS" = "" ] ; then + if [ "$METHOD" = "" -a "$1" != "silent" ] ; then + echo "Please set NTPSERVERS in /etc/default/ntpdate" + exit 1 + else + exit 0 + fi +fi + +# This is a heuristic: The idea is that if a static interface is brought +# up, that is a major event, and we can put in some extra effort to fix +# the system time. Feel free to change this, especially if you regularly +# bring up new network interfaces. +if [ "$METHOD" = static ]; then + OPTS="-b" +fi + +if [ "$METHOD" = loopback ]; then + exit 0 +fi + +( + +LOCKFILE=/var/lock/ntpdate + +# Avoid running more than one at a time +if [ -x /usr/bin/lockfile-create ]; then + lockfile-create $LOCKFILE + lockfile-touch $LOCKFILE & + LOCKTOUCHPID="$!" +fi + +if /usr/bin/ntpdate -s $OPTS $NTPSERVERS 2>/dev/null; then + if [ "$UPDATE_HWCLOCK" = "yes" ]; then + hwclock --systohc || : + fi +fi + +if [ -x /usr/bin/lockfile-create ] ; then + kill $LOCKTOUCHPID + lockfile-remove $LOCKFILE +fi + +) & diff --git a/meta/recipes-support/ntp/files/ntpdate.default b/meta/recipes-support/ntp/files/ntpdate.default new file mode 100644 index 0000000000..486b6e07d3 --- /dev/null +++ b/meta/recipes-support/ntp/files/ntpdate.default @@ -0,0 +1,7 @@ +# Configuration script used by ntpdate-sync script + +NTPSERVERS="" + +# Set to "yes" to write time to hardware clock on success +UPDATE_HWCLOCK="no" + diff --git a/meta/recipes-support/ntp/files/openssl-check.patch b/meta/recipes-support/ntp/files/openssl-check.patch new file mode 100644 index 0000000000..8b4a6733cd --- /dev/null +++ b/meta/recipes-support/ntp/files/openssl-check.patch @@ -0,0 +1,59 @@ +Hack OpenSSL check to work when libssl and libcrypto aren't in same dir + +Upstream-Status: Inappropriate [config] + +Signed-off-by: Paul Eggleton +--- + configure | 4 ++-- + m4/ntp_openssl.m4 | 4 ++-- + sntp/configure | 4 ++-- + 3 files changed, 6 insertions(+), 6 deletions(-) + +diff --git a/configure b/configure +index aae2c01..6a3c15e 100755 +--- a/configure ++++ b/configure +@@ -22868,8 +22868,8 @@ case "$ans" in + test -f $i/libcrypto.dylib -a -f $i/libssl.dylib && break + ;; + *) +- test -f $i/libcrypto.so -a -f $i/libssl.so && break +- test -f $i/libcrypto.a -a -f $i/libssl.a && break ++ test -f $i/libssl.so && break ++ test -f $i/libssl.a && break + ;; + esac + done +diff --git a/m4/ntp_openssl.m4 b/m4/ntp_openssl.m4 +index 7d9f477..67bdd55 100644 +--- a/m4/ntp_openssl.m4 ++++ b/m4/ntp_openssl.m4 +@@ -41,8 +41,8 @@ case "$ans" in + test -f $i/libcrypto.dylib -a -f $i/libssl.dylib && break + ;; + *) +- test -f $i/libcrypto.so -a -f $i/libssl.so && break +- test -f $i/libcrypto.a -a -f $i/libssl.a && break ++ test -f $i/libssl.so && break ++ test -f $i/libssl.a && break + ;; + esac + done +diff --git a/sntp/configure b/sntp/configure +index 7782c29..55e82d9 100755 +--- a/sntp/configure ++++ b/sntp/configure +@@ -14810,8 +14810,8 @@ case "$ans" in + test -f $i/libcrypto.dylib -a -f $i/libssl.dylib && break + ;; + *) +- test -f $i/libcrypto.so -a -f $i/libssl.so && break +- test -f $i/libcrypto.a -a -f $i/libssl.a && break ++ test -f $i/libssl.so && break ++ test -f $i/libssl.a && break + ;; + esac + done +-- +1.7.1 + diff --git a/meta/recipes-support/ntp/files/tickadj.c.patch b/meta/recipes-support/ntp/files/tickadj.c.patch new file mode 100644 index 0000000000..9ef9de9e1f --- /dev/null +++ b/meta/recipes-support/ntp/files/tickadj.c.patch @@ -0,0 +1,32 @@ +Index: ntp-4.2.2p3-r0/ntp-4.2.2p3/util/tickadj.c +=================================================================== +--- ntp-4.2.2p3/util/tickadj.c 2004-02-25 06:58:33.000000000 +0100 ++++ ntp-4.2.2p3/util/tickadj.c 2007-07-07 01:00:54.000000000 +0200 +@@ -21,7 +21,8 @@ + # include + #endif /* HAVE_UNISTD_H */ + +-#ifdef HAVE___ADJTIMEX /* Linux */ ++/* proper handling here has been moved to upstream ntp bugzilla */ ++#ifdef linux + + #include + struct timex txc; +@@ -91,7 +92,7 @@ + } + + if (!errflg) { +- if (__adjtimex(&txc) < 0) ++ if (adjtimex(&txc) < 0) + perror("adjtimex"); + else if (!quiet) + printf("tick = %ld\ntick_adj = %d\n", +@@ -146,7 +147,7 @@ + #endif + } + +- if (__adjtimex(&txc) < 0) ++ if (adjtimex(&txc) < 0) + { + perror("adjtimex"); + } diff --git a/meta/recipes-support/ntp/ntp.inc b/meta/recipes-support/ntp/ntp.inc new file mode 100644 index 0000000000..d93f22d473 --- /dev/null +++ b/meta/recipes-support/ntp/ntp.inc @@ -0,0 +1,93 @@ +SUMMARY = "Network Time Protocol daemon and utilities" +DESCRIPTION = "The Network Time Protocol (NTP) is used to \ +synchronize the time of a computer client or server to \ +another server or reference time source, such as a radio \ +or satellite receiver or modem." +HOMEPAGE = "http://support.ntp.org" +SECTION = "console/network" +LICENSE = "NTP" +LIC_FILES_CHKSUM = "file://COPYRIGHT;md5=fea4b50c33b18c2194b4b1c9ca512670" + +INC_PR = "r3" + +SRC_URI = "http://www.eecis.udel.edu/~ntp/ntp_spool/ntp4/ntp-4.2/ntp-${PV}.tar.gz \ + file://tickadj.c.patch \ + file://ntp-4.2.4_p6-nano.patch \ + file://openssl-check.patch \ + file://ntpd \ + file://ntp.conf \ + file://ntpdate \ + file://ntpdate.default \ + " + +inherit autotools update-rc.d + +# The ac_cv_header_readline_history is to stop ntpdc depending on either +# readline or curses +EXTRA_OECONF += "--with-net-snmp-config=no --without-ntpsnmpd ac_cv_header_readline_history_h=no" +CFLAGS_append = " -DPTYS_ARE_GETPT -DPTYS_ARE_SEARCHED" + +PACKAGECONFIG ??= "" +PACKAGECONFIG[openssl] = "--with-openssl-libdir=${STAGING_LIBDIR} \ + --with-openssl-incdir=${STAGING_INCDIR} \ + --with-crypto, \ + --without-openssl --without-crypto, \ + openssl" + +do_install_append() { + install -d ${D}${sysconfdir}/init.d + install -m 644 ${WORKDIR}/ntp.conf ${D}${sysconfdir} + install -m 755 ${WORKDIR}/ntpd ${D}${sysconfdir}/init.d + install -d ${D}${bindir} + install -m 755 ${WORKDIR}/ntpdate ${D}${bindir}/ntpdate-sync + + # Fix hardcoded paths in scripts + sed -i 's!/usr/sbin/!${sbindir}/!g' ${D}${sysconfdir}/init.d/ntpd ${D}${bindir}/ntpdate-sync + sed -i 's!/usr/bin/!${bindir}/!g' ${D}${sysconfdir}/init.d/ntpd ${D}${bindir}/ntpdate-sync + sed -i 's!/etc/!${sysconfdir}/!g' ${D}${sysconfdir}/init.d/ntpd ${D}${bindir}/ntpdate-sync + sed -i 's!/var/!${localstatedir}/!g' ${D}${sysconfdir}/init.d/ntpd ${D}${bindir}/ntpdate-sync + sed -i 's!^PATH=.*!PATH=${base_sbindir}:${base_bindir}:${sbindir}:${bindir}!' ${D}${bindir}/ntpdate-sync + + install -d ${D}/${sysconfdir}/default + install -m 644 ${WORKDIR}/ntpdate.default ${D}${sysconfdir}/default/ntpdate + install -d ${D}/${sysconfdir}/network/if-up.d + ln -s ${bindir}/ntpdate-sync ${D}/${sysconfdir}/network/if-up.d +} + +PACKAGES += "ntpdate ${PN}-tickadj ${PN}-utils" +# NOTE: you don't need ntpdate, use "ntpd -q -g -x" + +# ntp originally includes tickadj. It's split off for inclusion in small firmware images on platforms +# with wonky clocks (e.g. OpenSlug) +RDEPENDS_${PN} = "${PN}-tickadj" +# Handle move from bin to utils package +RPROVIDES_${PN}-utils = "${PN}-bin" +RREPLACES_${PN}-utils = "${PN}-bin" +RCONFLICTS_${PN}-utils = "${PN}-bin" + +RSUGGESTS_${PN} = "iana-etc" + +FILES_${PN} = "${bindir}/ntpd ${sysconfdir}/ntp.conf ${sysconfdir}/init.d/ntpd ${sbindir} ${libdir}" +FILES_${PN}-tickadj = "${bindir}/tickadj" +FILES_${PN}-utils = "${bindir}" +FILES_ntpdate = "${bindir}/ntpdate ${sysconfdir}/network/if-up.d/ntpdate-sync ${bindir}/ntpdate-sync ${sysconfdir}/default/ntpdate" + +CONFFILES_${PN} = "${sysconfdir}/ntp.conf" +CONFFILES_ntpdate = "${sysconfdir}/default/ntpdate" + +INITSCRIPT_NAME = "ntpd" +# No dependencies, so just go in at the standard level (20) +INITSCRIPT_PARAMS = "defaults" + +pkg_postinst_ntpdate() { +if test "x$D" != "x"; then + exit 1 +else + if ! grep -q -s ntpdate /var/spool/cron/root; then + echo "adding crontab" + test -d /var/spool/cron || mkdir -p /var/spool/cron + echo "30 * * * * ${bindir}/ntpdate-sync silent" >> /var/spool/cron/root + fi +fi +} + diff --git a/meta/recipes-support/ntp/ntp_4.2.6p5.bb b/meta/recipes-support/ntp/ntp_4.2.6p5.bb new file mode 100644 index 0000000000..f1e9ecd7a8 --- /dev/null +++ b/meta/recipes-support/ntp/ntp_4.2.6p5.bb @@ -0,0 +1,7 @@ +require ntp.inc + +PR = "${INC_PR}.0" + +SRC_URI[md5sum] = "00df80a84ec9528fcfb09498075525bc" +SRC_URI[sha256sum] = "d6ab8371f9d31e594eb6922823d5ccd03dcc4e9d84b0e23ea25ac1405432f91c" + -- cgit v1.2.3-54-g00ecf