After investigation time syncronization I found that ntpdate is probably
not the best solution. So I tried to fully implement ntpd.
I've done this using SDK Phrozen Patch with glibc and full internet
access. It's my first implementation of a package for fox. So
probably there might be some enhancements.
The advantage of using ntpd among other time syncronization mechanisms
is its continous adaption to a time server time provided in the
internet. The other advantage is that you might not need to add a
hardware RTC.
Download the following files from
http://developer.axis.com/download/contrib/NTP/
<http://developer.axis.com/download/contrib/NTP/>
ntp-4.1.1a.tgz
<http://developer.axis.com/download/contrib/NTP/ntp-4.1.1a.tgz>
conf_ntp.tgz
<http://developer.axis.com/download/contrib/NTP/conf_ntp.tgz> is not
required as it is incomplete.
Untar ntp-4.1.1a.tgz at .../devboard*/apps/
The original package does not strip the binaries and installs libntp.a.
This results in a package being too large to fit in an fimage. In order
to solve this go to ../devboard*/apps/ntp-4.1.1a
In Makefile change:
old:
STRIP = strip
new:
STRIP = cris-strip
Go to ../devboard*/apps/ntp-4.1.1a/libntp
In Makefile comment the install part for libntp.a as it is not required:
old:
install: $(EXE)
[EMAIL PROTECTED] "Installing $(EXE)"
#chmod ugo+x $(EXE)
$(INSTALL) -d $(INSTDIR)
$(INSTALL) -m $(INSTMODE) -o $(INSTOWNER) -g $(INSTGROUP) $(PROGS)
$(INSTDIR)
new:
install: $(EXE)
[EMAIL PROTECTED] "Installing $(EXE)"
#chmod ugo+x $(EXE)
#$(INSTALL) -d $(INSTDIR)
#$(INSTALL) -m $(INSTMODE) -o $(INSTOWNER) -g $(INSTGROUP) $(PROGS)
$(INSTDIR)
Create file ../devboard*/files/etc/ntp.conf and insert appropriate
server addresses from www.pool.ntp.org
<http://tech.groups.yahoo.com/group/foxboard/www.pool.ntp.org> The
location and use of a driftfile which stores the average drift for
initialization purposes should be well thought of. I didn't want to
locate it on the flash to avoid an early damage of the flash, as the
file is continuously written. Instead I start ntpdate before ntpd is
started, so the drift at starttime is already very small.
# /etc/ntp.conf
server 0.europe.pool.ntp.org
server 1.europe.pool.ntp.org
server 2.europe.pool.ntp.org
driftfile /var/log/ntp.drift # remember the drift of the local clock
Create file ../devboard*/files/etc/init.d/ntpd:
#!/bin/sh
. /etc/init.d/functions.sh
case "$1" in
start)
begin "Starting service ntpd"
start_daemon /bin/ntpd
;;
stop)
begin "Shutting down service ntpd"
stop_daemon /bin/ntpd
;;
*)
error "Usage: $0 stop | start"
;;
esac
exit 0
Create file ../devboard*/files/etc/init.d/ntpdate:
#!/bin/sh
. /etc/init.d/functions.sh
case "$1" in
start)
begin "Initializing NTP"
/bin/ntpdate -v ntp.ubuntu.com pool.ntp.org >>
/var/log/ntpdate.out 2>&1
;;
stop)
begin "Nothing to stop"
;;
*)
error "Usage: $0 stop | start"
;;
esac
exit 0
Informations about setting the timezone
http://www.debian.org/doc/manuals/system-administrator/ch-sysadmin-time.\
html
<http://www.debian.org/doc/manuals/system-administrator/ch-sysadmin-time\
.html>
If you have configured your development linux platform timezone then you
can copy the files
cp /etc/localtime ../devboard*/files/etc/localtime
cp /etc/timezone ../devboard*/files/etc/timezone
cp /etc/default/rcS ../devboard*/files/etc/default/rcS
Otherwise you have to manually edit these files except the localtime.
This has to be copied from /usr/share/zoneinfo
.<yourtimezone>
Be aware of the fact that the ntpd daemon is using UTC to synconize.
Thus in rcS utc=yes should be set.
Create or edit a file named post in ../devboard*/configure-files
Add the following lines:
sub apps/ntp-4.1.1a
file files/etc/ntp.conf /etc/ntp.conf mode=0666
file files/etc/timezone /etc/timezone mode=0666
file files/etc/localtime /etc/localtime mode=0666
file files/etc/default/rcS /etc/defaultrcS mode=0666
file files/etc/init.d/ntpdate /etc/init.d/ntpdate mode=0755
symlink ../init.d/ntpdate $prefix/etc/rc3.d/S32ntpdate
file files/etc/init.d/ntpd /etc/init.d/ntpd mode=0755
symlink ../init.d/ntpd $prefix/etc/rc0.d/K24ntpd
symlink ../init.d/ntpd $prefix/etc/rc1.d/K24ntpd
symlink ../init.d/ntpd $prefix/etc/rc2.d/K24ntpd
symlink ../init.d/ntpd $prefix/etc/rc3.d/S33ntpd
symlink ../init.d/ntpd $prefix/etc/rc6.d/K24ntpd
Change directory to ../devboard* and
./configure
make
ftp 192.168.0.90 <ftp://ftp%20192.168.0.90/>
put fimage flash_all
After boot the date and time should be syncronized.
[EMAIL PROTECTED] /usr]130# date
Mon Dec 25 13:33:27 CET 2006
Happy Christmas
Klaus