From b17aea04b303cff4bfb9740cf5aea8a27ea8218f Mon Sep 17 00:00:00 2001 From: Nagy Karoly Gabriel Date: Mon, 8 Dec 2008 17:21:31 +0200 Subject: [PATCH] sheba: integrated clockspeed with Sheba ( just adapted mnemocs work ) --- ...ir_clockspeed_clockspeed-adjust_log_run.sh | 22 +++++++++++ ...onfdir_clockspeed_clockspeed-adjust_run.sh | 37 +++++++++++++++++++ ...sysconfdir_clockspeed_clockspeed_finish.sh | 21 +++++++++++ ...ysconfdir_clockspeed_clockspeed_log_run.sh | 22 +++++++++++ .../D%sysconfdir_clockspeed_clockspeed_run.sh | 24 ++++++++++++ .../D%sysconfdir_conf_clockspeed.txt | 17 +++++++++ .../var_service_clockspeed-adjust.ln | 1 + pkgs/clockspeed/var_service_clockspeed.ln | 1 + 8 files changed, 145 insertions(+) create mode 100644 pkgs/clockspeed/D%sysconfdir_clockspeed_clockspeed-adjust_log_run.sh create mode 100644 pkgs/clockspeed/D%sysconfdir_clockspeed_clockspeed-adjust_run.sh create mode 100644 pkgs/clockspeed/D%sysconfdir_clockspeed_clockspeed_finish.sh create mode 100644 pkgs/clockspeed/D%sysconfdir_clockspeed_clockspeed_log_run.sh create mode 100644 pkgs/clockspeed/D%sysconfdir_clockspeed_clockspeed_run.sh create mode 100644 pkgs/clockspeed/D%sysconfdir_conf_clockspeed.txt create mode 100644 pkgs/clockspeed/var_service_clockspeed-adjust.ln create mode 100644 pkgs/clockspeed/var_service_clockspeed.ln diff --git a/pkgs/clockspeed/D%sysconfdir_clockspeed_clockspeed-adjust_log_run.sh b/pkgs/clockspeed/D%sysconfdir_clockspeed_clockspeed-adjust_log_run.sh new file mode 100644 index 0000000..dde4695 --- /dev/null +++ b/pkgs/clockspeed/D%sysconfdir_clockspeed_clockspeed-adjust_log_run.sh @@ -0,0 +1,22 @@ +#!/bin/sh +# --- SDE-COPYRIGHT-NOTE-BEGIN --- +# This copyright note is auto-generated by ./scripts/Create-CopyPatch. +# +# Filename: target/sheba/pkgs/clockspeed/D%sysconfdir_clockspeed_clockspeed-adjust_log_run.sh +# Copyright (C) 2008 The OpenSDE Project +# +# More information can be found in the files COPYING and README. +# +# This program is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; version 2 of the License. A copy of the +# GNU General Public License can be found in the file COPYING. +# --- SDE-COPYRIGHT-NOTE-END --- + +LOGDIR=/var/log/clockspeed/adjust + +mkdir -p "$LOGDIR" +[ -d "main/" ] || ln -s "$LOGDIR" main + +exec svlogd -tt main/ + diff --git a/pkgs/clockspeed/D%sysconfdir_clockspeed_clockspeed-adjust_run.sh b/pkgs/clockspeed/D%sysconfdir_clockspeed_clockspeed-adjust_run.sh new file mode 100644 index 0000000..67c137f --- /dev/null +++ b/pkgs/clockspeed/D%sysconfdir_clockspeed_clockspeed-adjust_run.sh @@ -0,0 +1,37 @@ +#!/bin/sh +# --- SDE-COPYRIGHT-NOTE-BEGIN --- +# This copyright note is auto-generated by ./scripts/Create-CopyPatch. +# +# Filename: target/sheba/pkgs/clockspeed/D%sysconfdir_clockspeed_clockspeed-adjust_run.sh +# Copyright (C) 2008 The OpenSDE Project +# +# More information can be found in the files COPYING and README. +# +# This program is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; version 2 of the License. A copy of the +# GNU General Public License can be found in the file COPYING. +# --- SDE-COPYRIGHT-NOTE-END --- + +# based on http://www.thedjbway.org/clocksd/index.html + +exec 2>&1 + +WAIT=$( expr 9 \* 3600 ) # first in 9 hours +WAIT_MAX=$( expr 7 \* 24 \* 3600 ) # at least once per week + +# loop indefinitely +while true; do + echo "Waiting ${WAIT} seconds until next adjustment..." + sleep ${WAIT} + # obtain timing mark for calibrating clockspeed adjust: + clockctl mark + # log current "attoseconds": + clockctl atto + echo "===" + if [ $WAIT -lt $WAIT_MAX ]; then + WAIT=$( expr $WAIT \* 2 ) + [ $WAIT -le $WAIT_MAX ] || WAIT=$WAIT_MAX + fi + done + diff --git a/pkgs/clockspeed/D%sysconfdir_clockspeed_clockspeed_finish.sh b/pkgs/clockspeed/D%sysconfdir_clockspeed_clockspeed_finish.sh new file mode 100644 index 0000000..dacf733 --- /dev/null +++ b/pkgs/clockspeed/D%sysconfdir_clockspeed_clockspeed_finish.sh @@ -0,0 +1,21 @@ +#!/bin/sh +# --- SDE-COPYRIGHT-NOTE-BEGIN --- +# This copyright note is auto-generated by ./scripts/Create-CopyPatch. +# +# Filename: target/sheba/pkgs/clockspeed/D%sysconfdir_clockspeed_clockspeed_finish.sh +# Copyright (C) 2008 The OpenSDE Project +# +# More information can be found in the files COPYING and README. +# +# This program is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; version 2 of the License. A copy of the +# GNU General Public License can be found in the file COPYING. +# --- SDE-COPYRIGHT-NOTE-END --- + +exec 2>&1 + +# save the current time on BIOS +echo "Saving current time in BIOS" +exec /sbin/hwclock -w -u + diff --git a/pkgs/clockspeed/D%sysconfdir_clockspeed_clockspeed_log_run.sh b/pkgs/clockspeed/D%sysconfdir_clockspeed_clockspeed_log_run.sh new file mode 100644 index 0000000..0517e9a --- /dev/null +++ b/pkgs/clockspeed/D%sysconfdir_clockspeed_clockspeed_log_run.sh @@ -0,0 +1,22 @@ +#!/bin/sh +# --- SDE-COPYRIGHT-NOTE-BEGIN --- +# This copyright note is auto-generated by ./scripts/Create-CopyPatch. +# +# Filename: target/sheba/pkgs/clockspeed/D%sysconfdir_clockspeed_clockspeed_log_run.sh +# Copyright (C) 2008 The OpenSDE Project +# +# More information can be found in the files COPYING and README. +# +# This program is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; version 2 of the License. A copy of the +# GNU General Public License can be found in the file COPYING. +# --- SDE-COPYRIGHT-NOTE-END --- + +LOGDIR=/var/log/clockspeed/clockspeed + +mkdir -p "$LOGDIR" +[ -d "main/" ] || ln -s "$LOGDIR" main + +exec svlogd -tt main/ + diff --git a/pkgs/clockspeed/D%sysconfdir_clockspeed_clockspeed_run.sh b/pkgs/clockspeed/D%sysconfdir_clockspeed_clockspeed_run.sh new file mode 100644 index 0000000..01c82ef --- /dev/null +++ b/pkgs/clockspeed/D%sysconfdir_clockspeed_clockspeed_run.sh @@ -0,0 +1,24 @@ +#!/bin/sh +# --- SDE-COPYRIGHT-NOTE-BEGIN --- +# This copyright note is auto-generated by ./scripts/Create-CopyPatch. +# +# Filename: target/sheba/pkgs/clockspeed/D%sysconfdir_clockspeed_clockspeed_run.sh +# Copyright (C) 2008 The OpenSDE Project +# +# More information can be found in the files COPYING and README. +# +# This program is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; version 2 of the License. A copy of the +# GNU General Public License can be found in the file COPYING. +# --- SDE-COPYRIGHT-NOTE-END --- + +exec 2>&1 + +if [ ! -e /var/state/clockspeed/adjust ]; then + /usr/bin/clockctl sync || exit 1 +fi + +echo "Starting clockspeed" +exec /usr/bin/clockspeed + diff --git a/pkgs/clockspeed/D%sysconfdir_conf_clockspeed.txt b/pkgs/clockspeed/D%sysconfdir_conf_clockspeed.txt new file mode 100644 index 0000000..3f94b04 --- /dev/null +++ b/pkgs/clockspeed/D%sysconfdir_conf_clockspeed.txt @@ -0,0 +1,17 @@ +# --- SDE-COPYRIGHT-NOTE-BEGIN --- +# This copyright note is auto-generated by ./scripts/Create-CopyPatch. +# +# Filename: target/sheba/pkgs/clockspeed/D%sysconfdir_conf_clockspeed.txt +# Copyright (C) 2008 The OpenSDE Project +# +# More information can be found in the files COPYING and README. +# +# This program is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; version 2 of the License. A copy of the +# GNU General Public License can be found in the file COPYING. +# --- SDE-COPYRIGHT-NOTE-END --- + +CLOCK_TYPE=ntp +CLOCK_IP=$( dnsip de.pool.ntp.org | cut -d' ' -f1 ) + diff --git a/pkgs/clockspeed/var_service_clockspeed-adjust.ln b/pkgs/clockspeed/var_service_clockspeed-adjust.ln new file mode 100644 index 0000000..d7336d7 --- /dev/null +++ b/pkgs/clockspeed/var_service_clockspeed-adjust.ln @@ -0,0 +1 @@ +/etc/clockspeed/clockspeed-adjust diff --git a/pkgs/clockspeed/var_service_clockspeed.ln b/pkgs/clockspeed/var_service_clockspeed.ln new file mode 100644 index 0000000..7ac859c --- /dev/null +++ b/pkgs/clockspeed/var_service_clockspeed.ln @@ -0,0 +1 @@ +/etc/clockspeed/clockspeed