ARM-Linux使用ntpdate同步本机时间

版权声明:转载请注明出处 https://blog.csdn.net/understand125/article/details/78272904

1.   下载 ntp-4.2.8p8.tar.gz(注:ntpdate依赖openssl,需现编译openssl)

2.   解压

     tar -zxf ntp-4.2.8p8.tar.gz

    cd ntp-4.2.8p8

3.  在ntpd/ntp_loopfilter.c文件末尾增加"MOD_NANO"宏定义

    #ifndef MOD_NANO

    #define MOD_NANO 0x2000

   #endif

4. 生成makefile文件

    ./configure --prefix=/usr/local/arm/ntp --host=arm-hisiv100nptl-linux CC=arm-hisiv100nptl-linux-gcc --with-yielding-select=yes --enable-openssl LIBS=-L/usr/local/arm/ssl/lib CPPFLAGS=-I/usr/local/arm/ssl/include --exec-prefix=/usr/local/arm/ntp

   说明:prefix为安装目录,host为目标板交叉编译工具链, --enable-openssl:ntpdate依赖openssl,CPPFLAGS:openssl头文件,LIBS:openssl库

5. 编译并安装

   make

   sudo make install

6. 编译好的工具位于安装目录的bin文件夹中,拷贝需要的工具到arm板的/usr/sbin目录中


遇到问题汇总:

     1.  执行ntpdate ntp_server_IP,报错:

          no server suitable for synchronization found

        原因:选择的ntp时间服务器不合适,被服务器拒绝

        解决方案: 选择公开的ntp时间服务器,如us.ntp.org.cn

 
 

    



猜你喜欢

转载自blog.csdn.net/understand125/article/details/78272904
今日推荐