一、说明
网络时间协议Network Time Protocol(NTP)
是一种确保时钟保持准确的方法。如果可以访问互联网,只需安装ntp
的客户端软件到互联网上的公共ntp
服务器自动修正时间即可
二、准备工作
1 、ntp 源码包:ntp-dev-4.3.91.tar.gz(可下载地址: http://www.ntp.org/downloads.html)
2 、交叉编译工具:arm-none-linux-gnueabi-gcc 4.7.3
3、编译环境Ubuntu 13.02
三、移植步骤
1 、解压ntp 源码包到指定目录
satellite@ubuntu:~/share$ tar -zxvf ntp-dev-4.3.91.tar.gz
2 、进入刚解压目录,并配置
(1 )satellite@ubuntu:~/share$ cd ntp-dev-4.3.91
(2)在ntpd/ntp_loopfilter.c中增加下面的宏定义
#ifndef MOD_NANO
#define MOD_NANO 0x2000
#endif
(
2
)
satellite@ubuntu:~/share/ntp-dev-4.3.91$
./configure --prefix=$PWD/install --exec-prefix=$PWD/install --host=arm-none-linux-gnueabi CC=arm-none-linux-gnueabi-gcc
注意:a.指定的安装目录位源码目录下的install文件夹, b.运行configure前要先设置好arm-linux开发环境,否则报错。configure具体的参数详解间另一篇文章。
出现错误:
checking for pthread_kill_other_threads_np... no
checking for LinuxThreads implementation... no
checking for LinuxThreads consistency... no
checking if pthread_create() works... yes
checking if select yields when using pthreads... cross
configure: error: crossing compiling: use --with-yielding-select=yes|no|manual
执行命令:satellite@ubuntu:~/share/ntp-dev-4.3.91$ ./configure --prefix=$PWD/install --exec-prefix=$PWD/install --host=arm-none-linux-gnueabi CC=arm-none-linux-gnueabi-gcc --with-yielding-select=yes
此次,在安装目录下成功生成了Makefile文件。
3 、编译并安装
satellite@u
出现错误:
checking for pthread_kill_other_threads_np... no
checking for LinuxThreads implementation... no
checking for LinuxThreads consistency... no
checking if pthread_create() works... yes
checking if select yields when using pthreads... cross
configure: error: crossing compiling: use --with-yielding-select=yes|no|manual
执行命令:satellite@ubuntu:~/share/ntp-dev-4.3.91$ ./configure --prefix=$PWD/install --exec-prefix=$PWD/install --host=arm-none-linux-gnueabi CC=arm-none-linux-gnueabi-gcc --with-yielding-select=yes
此次,在安装目录下成功生成了Makefile文件。
3 、编译并安装
satellite@u