1、ntp源码包:ntp-dev-4.3.91.tar.gz(可下载地址:http://www.ntp.org/downloads.html)

2、交叉编译工具:arm-linux-gnueabihf-gcc     解压ntp源码包到指定目录 tar -zxvf ntp-dev-4.3.91.tar.gz

进入刚解压目录,并配置cd ntp-dev-4.3.91,在ntpd/ntp_loopfilter.c中增加下面的宏定义

#ifndef MOD_NANO

#define MOD_NANO  0x2000

#endif

./configure --prefix=$PWD/install --exec-prefix=$PWD/install --host=arm-none-linux-gnueabi CC=arm-none-linux-gnueabi-gcc

出现错误:

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文件。

编译并安装  make

出现错误:

ntp_loopfilter.c: In function 'local_clock':

ntp_loopfilter.c:760: error: 'MOD_NANO' undeclared (first use in this function)

ntp_loopfilter.c:760: error: (Each undeclared identifier is reported only once

ntp_loopfilter.c:760: error: for each function it appears in.)

在ntpd/ntp_loopfilter.c中增加下面的宏定义 #ifndef MOD_NANO

#define MOD_NANO  0x2000

#endif

make  install

4、安装完之后在安装目录下install文件夹会有三个文件夹产生ls

bin  libexec  sbin  share

bin目录中的命令文件有如下: ls bin

calc_tickadj  ntpd  ntpdate  ntpdc  ntp-keygen  ntpq  ntptime  ntptrace  ntp-wait  sntp  tickadj  update-leap

5、把bin目录下的需要的命令文件拷贝到开发板的/bin目录下,或者全部拷贝过去

ntp客户端需要用到的命令有ntpdate,ntp服务器需要用到的命令有ntpd

6、ntp客户端

拷贝ntpdate命令到开发板之后执行以下命令 ntpdate  time.buptnet.edu.cn(或者ntpdate  202.112.10.60)

说明:time.buptnet.edu.cn是北京时间的NTP服务器(IP:202.112.10.60)

提示:Jan 01:19:17 ntpdate[2179]: no server suitable for synchronization found

出现以下问题: ntpdate time.buptnet.edu.cn

ntpdate:error while loading shared libraries: libcap.so.2: cannot open shared object file:

no such file or directory

则解决办法:在安装交叉编译工具的目录arm-linux-gnueabihf/usr/lib中有文件libcap.so.2和libattr.so.1直接拷贝到开发板/lib目录下

拷贝完以上两个文件即可完成时间同步 ntpdate 0.pool.ntp.org

step time server 110.75.186.248 offset 1460632666.423442 sec

date

Thu Apr 14 20:49:19 CST 2016

从网络上获取到的系统时间写入硬件时钟中,则使用命令 hwclock -w

每次开机设备自动同步时间,可在启动脚本中加入命令行:ntpdate 0.pool.ntp.org

或者上位机发给ARM,ARM获取后传入系统时间 date -s "2018-10-31 11:20:35"

7,ntp服务器 (因为用不着,所以暂时没有测试)

ntp服务器的开发板和ntp客户端的系统的网络要正常连接

在要做服务器的开发板上编辑文件/etc/ntp.conf

执行命令: vi  /etc/ntp.conf

#restrict default nomodify notrap noquery

restrict 127.0.0.1

restrict 192.168.1.0 mask 255.255.255.0 nomodify notrap

server  127.127.1.0        # local clock

fudge   127.127.1.0  stratum 5

driftfile /var/lib/ntp/drift

broadcastdelay   0.008

keys                     /etc/ntp/keys

开启ntp服务器 ntpd  -c /etc/ntp.conf

ntp服务器开启后五到十几分钟才能在客户端系统中执行以下命令,否则时间同步会失败

ntpdate  192.168.1.X  (192.168.1.X修改成你的服务器的IP地址)

linux ntpdate交叉编译,arm交叉编译ntpdate与服务器进行时间同步相关推荐

  1. linux curl编译 arm交叉编译

    虚拟机环境 ubuntu12.04 开发板 EasyARM-i.MX280A:   64m  sdram  128M  nandflash   运行官方提供的Linux-2.6.35.3内核linux ...

  2. [ Linux ] CentOS 8下使用 chrony 进行服务器网络时间同步

    文章目录 背景 如何确认自己系统的版本 安装Chrony 配置chrony 背景 当使用的linux版本是CentOS 8.x.x 的时候无法使用 yum安 装ntpdate服务,并提示错误信息 No ...

  3. mDNS实现之Bonjour与Avahi(一)——win/linux/arm交叉编译

    0.Part2:mDNS实现之Bonjour与Avahi(二)--win/linux/arm交叉编译_平凡之路-CSDN博客1.BonjourBonjour - Apple Developer● 源码 ...

  4. 交叉编译php-5.6.30,linux下用arm-none-linux-gnueabi交叉编译arm内核模块

    前不久导师要求交叉编译一个基于arm平台开发的内核模块来练手,在网上查了很多资料才弄出来,于是将这些零散的信息综合起来给和我一样的入门人员了解.水平有限,请谅解~ 1.安装arm-none-linux ...

  5. Arm Linux 交叉编译(交叉编译是什么?CROSS_COMPILE)(交叉编译工具链【待更】)

    文章目录 交叉编译 1.编译 2.本地编译 3.交叉编译 交叉编译工具链 交叉编译 在嵌入式系统开发中,经常会听到一个词:交叉编译.到底什么是"交叉编译"呢?为什么要使用" ...

  6. 在Linux PC上查看arm交叉编译的可执行文件依赖的动态库

    在Ubuntu宿主机上查看ARM交叉编译好的可执行程序和库文件的相关依赖关系,类似于PC linux上的ldd命令.     在电脑上安装的Linux系统中,有一个ldd命令,可以查看对应的可执行文件 ...

  7. Linux ARM交叉编译工具链制作过程

    一.下载源文件 源代码文件及其版本与下载地址: Binutils-2.19.tar.bz2 http://ftp.gnu.org/gnu/binutils/ gcc-4.4.4.tar.bz2 htt ...

  8. 【linux系统如何安装arm交叉编译工具链】

    文章目录 前言 一.arm交叉编译器介绍 命名规则 具体编译器 二.Arm GNU Toolchain安装 总结 前言 本文简要介绍arm交叉编译器及工具链的安装方法 一.arm交叉编译器介绍 命名规 ...

  9. mDNS实现之Bonjour与Avahi(二)——win/linux/arm交叉编译

    0.Part1: mDNS实现之Bonjour与Avahi(一)--win/linux/arm交叉编译_平凡之路-CSDN博客官网:Bonjour - Apple Developerhttps://d ...

最新文章

  1. asp.net中窗口相关操作总结(javascript)
  2. 故对于回调函数来说,在其内部使用 this 是不把稳的做法,解决方案可以在其调用时使用 call / apply / bind 显示绑定。
  3. 对号入座,看看未来几年机器人是否会取代你的工作
  4. php-screw下载,php_screw安装和使用
  5. Tapestry框架概述
  6. android平板交互,安卓平板就应该如此,华为MatePad Pro 交互体验
  7. iOS中,在类的源文件(.m)中,@interface部分的作用?
  8. 网上答题及其自动评测系统
  9. 山海镜花vivo服务器微信号,山海镜花初始号怎么刷
  10. JavaScript 使用面向对象的技术创建高级 Web 应用程序
  11. 1tensorflow 实现端到端的OCR:二代身份证号识别 + 2tensorflow LSTM+CTC实现端到端的不定长数字串识别
  12. 使用Java进行RS232C端口的开发
  13. linux网页视频黑边,ffmpeg去除视频黑边命令
  14. windows环境下zookeeper做成服务并启动
  15. WinForms时代结束,报表控件FastReport.NET开启FastReport.Core.Skia 时代!
  16. win10桌面显示计算机及网上邻居,Win10网上邻居在哪? Win10桌面显示网上邻居网络图标方法...
  17. 3207: 花神的嘲讽计划Ⅰ
  18. PIPI OJ 1203: PIPI发工资(拓扑排序)
  19. 费马小定理及MR素数判断
  20. matlab等于怎么表示,MATLAB里的不等于用什么表示?

热门文章

  1. 神经网络简述(配图赞!)
  2. python logging模块打印log日志到文件和屏幕
  3. K8S之Flannel的vxlan网络模式初步源码解析
  4. ESP32开发-HTTP POST请求发送图片
  5. 网易云音乐API部署Vercel获取接口过程
  6. [Windows Phone 8]如何解决Lumia手机无法进入系统或开启?
  7. linux笔记:安装程序后,使用时显示找不到命令(command not found)
  8. AKShare获取数据放到Mysql
  9. Ubuntu 网络连接不上-右上角WiFi标志都没有
  10. mx350显卡天梯图_2020最新显卡高清天梯图