SourceForge.net Logo

4.5. Network Time Protocol (NTP)

Network Time Protocol (NTP) is a protocol for synchronizing computer clocks variable-latency networks.

Download and unpack the stable version.

wget -P $DL_DIR ftp://ftp.udel.edu/pub/ntp/ntp4/ntp-4.2.2p3.tar.gz # was dev-4.2.0a-20041130
tar -C $PRJ_DIR/apps -xvzf $DL_DIR/ntp-4.2.2p3.tar.gz
cd $PRJ_DIR/apps/ntp-4.2.2p3

The Makefile tries to execute ntpdc-layout on the compile host. If the compile host is i386 based, it will then look for ld-uClibc.so.0 in /lib instead of $TOOLCHAIN_DIR/lib. Workaround this by:

sudo ln -s $TOOLCHAIN_DIR/lib/ld-uClibc.so.0 /lib/ld-uClibc.so.0

Configure, compile and install to rootfs.d.

rm -rf config.cache
AR=${TOOLCHAIN_CROSS}ar   AS=${TOOLCHAIN_CROSS}as   LD=${TOOLCHAIN_CROSS}ld \
NM=${TOOLCHAIN_CROSS}nm   CC=${TOOLCHAIN_CROSS}gcc  GCC=${TOOLCHAIN_CROSS}gcc \
CXX=${TOOLCHAIN_CROSS}g++ RANLIB=${TOOLCHAIN_CROSS}ranlib \
./configure --build=i686-linux              --host=i586-linux \
            --includedir=$ROOTFS_DIR/usr/include \
            --oldincludedir=$ROOTFS_DIR/usr/include \
            --sysconfdir=/etc/sysconfig  \
            --disable-all-clocks            --disable-parse-clocks \
            --enable-LOCAL-CLOCK            --disable-ipv6 \
            --with-shared \                 --disable-debugging \
            --without-crypto         	    --program-transform-name=s,,,
make
install -s -m 755 ntpd/ntpd $ROOTFS_DIR/usr/bin/
install -s -m 755 ntpdate/ntpdate $ROOTFS_DIR/usr/bin/
install -s -m 755 ntpq/ntpq $ROOTFS_DIR/usr/bin/
install -d -m 755 $ROOTFS_DIR/var/ntpd
echo "0.000" > $ROOTFS_DIR/var/ntpd/drift

Example configuration files are listed below. Note that the examples are for a dial-on demand system and only synchronize the clock on system startup.