/**********************************************************************
* buildroot ntp 网络时钟同步
* 说明:
* 文件系统需要网络时钟同步,于是使用ntp来做这件事情。
*
* 2016-12-1 深圳 南山平山村 曾剑锋
*********************************************************************/
一、buildroot配置:
1. 时区:
┌───────────────────────── System configuration ──────────────────────────┐
│ Arrow keys navigate the menu. <Enter> selects submenus ---> (or empty │
│ submenus ----). Highlighted letters are hotkeys. Pressing <Y> │
│ selectes a feature, while <N> will exclude a feature. Press │
│ <Esc><Esc> to exit, <?> for Help, </> for Search. Legend: [*] feature │
│ ┌────^(-)─────────────────────────────────────────────────────────────┐ │
│ │ [*] Purge unwanted locales │ │
│ │ (C en_US) Locales to keep │ │
│ │ () Generate locale data │ │
│ │ [*] Install timezone info │ │
│ │ (default) timezone list │ │
│ │ (Etc/UTC) default local time │ │
│ │ () Path to the users tables │ │
│ │ () Root filesystem overlay directories │ │
│ │ () Custom scripts to run before creating filesystem images │ │
│ │ () Custom scripts to run inside the fakeroot environment │ │
│ └────┴(+)─────────────────────────────────────────────────────────────┘ │
├─────────────────────────────────────────────────────────────────────────┤
│ <Select> < Exit > < Help > < Save > < Load > │
└─────────────────────────────────────────────────────────────────────────┘
2. ntpdate命令:
┌──────────────────────── Networking applications ────────────────────────┐
│ Arrow keys navigate the menu. <Enter> selects submenus ---> (or empty │
│ submenus ----). Highlighted letters are hotkeys. Pressing <Y> │
│ selectes a feature, while <N> will exclude a feature. Press │
│ <Esc><Esc> to exit, <?> for Help, </> for Search. Legend: [*] feature │
│ ┌────^(-)─────────────────────────────────────────────────────────────┐ │
│ │ [ ] noip │ │
│ │ [*] ntp │ │
│ │ [ ] sntp │ │
│ │ [ ] ntp-keygen │ │
│ │ [ ] SHM clock support │ │
│ │ [ ] ntpd │ │
│ │ [*] ntpdate │ │
│ │ [ ] ntpdc │ │
│ │ [ ] ntpq │ │
│ │ [ ] ntpsnmpd │ │
│ └────┴(+)─────────────────────────────────────────────────────────────┘ │
├─────────────────────────────────────────────────────────────────────────┤
│ <Select> < Exit > < Help > < Save > < Load > │
└─────────────────────────────────────────────────────────────────────────┘
二、执行命令
[zengjf@root /etc]# cp /usr/share/zoneinfo/Asia/Shanghai /etc/localtime
[zengjf@root /etc]# cat timezone
Asia/Shanghai
[zengjf@root /etc]# ntpdate us.pool.ntp.org
1 Dec 12:04:59 ntpdate[2437]: adjust time server 204.9.54.119 offset 0.009610 sec
[zengjf@root /etc]#