Luckfox Pico系统校对时间,同步网络时间

2023-12-08 14:48:15 提问

Luckfox Pico系统校对时间,同步网络时间

我来答
浏览 438 次
已有1个回答
斑梨游客463aa
回答时间:
2023-12-08 14:54:09

1.打开配置界面

执行如下指令,打开 buildroot 配置界面:

cd <SD目录>/sysdrv/source/buildroot/buildroot-2023.02.6/

make luckfox_pico_defconfig

make menuconfig

2.添加ntpd软件包

执行指令后显示的配置界面如下:

按下  输入 "ntpd" 后回车进行搜索,显示多个搜索结果,我们找到 "ntp" 下的 "ntpd",按  进行跳转

按  分别 "ntp" 和 "ntpd",使能 "ntp" 后会显示 "ntpd",


3.保存配置

配置好后连续按 Esc,提示是否保存时选择 "Yes",保存后重新进行编译:

make savedefconfig

make

4.编译镜像
41.编译选择分支,指定开发板型号

luckfox@luckfox:~/luckfox-pico$ ./build.sh lunch
ls: cannot access 'BoardConfig*.mk': No such file or directory

You're building on Linux
Lunch menu...pick a combo:

BoardConfig-*.mk naming rules:
BoardConfig-"启动介质"-"电源方案"-"硬件版本"-"应用场景".mk
BoardConfig-"boot medium"-"power solution"-"hardware version"-"applicaton".mk

----------------------------------------------------------------
0. BoardConfig_IPC/BoardConfig-EMMC-NONE-RV1103_Luckfox_Pico-IPC.mk
                             boot medium(启动介质): EMMC
                          power solution(电源方案): NONE
                        hardware version(硬件版本): RV1103_Luckfox_Pico
                              applicaton(应用场景): IPC
----------------------------------------------------------------

----------------------------------------------------------------
1. BoardConfig_IPC/BoardConfig-EMMC-NONE-RV1103_Luckfox_Pico_Mini_A-IPC.mk
                             boot medium(启动介质): EMMC
                          power solution(电源方案): NONE
                        hardware version(硬件版本): RV1103_Luckfox_Pico_Mini_A
                              applicaton(应用场景): IPC
----------------------------------------------------------------

----------------------------------------------------------------
2. BoardConfig_IPC/BoardConfig-SPI_NAND-NONE-RV1103_Luckfox_Pico_Mini_B-IPC.mk
                             boot medium(启动介质): SPI_NAND
                          power solution(电源方案): NONE
                        hardware version(硬件版本): RV1103_Luckfox_Pico_Mini_B
                              applicaton(应用场景): IPC
----------------------------------------------------------------

----------------------------------------------------------------
3. BoardConfig_IPC/BoardConfig-SPI_NAND-NONE-RV1103_Luckfox_Pico_Plus-IPC.mk
                             boot medium(启动介质): SPI_NAND
                          power solution(电源方案): NONE
                        hardware version(硬件版本): RV1103_Luckfox_Pico_Plus
                              applicaton(应用场景): IPC
----------------------------------------------------------------

----------------------------------------------------------------
4. BoardConfig_IPC/BoardConfig-SPI_NAND-NONE-RV1106_Luckfox_Pico_Pro_Max-IPC.mk
                             boot medium(启动介质): SPI_NAND
                          power solution(电源方案): NONE
                        hardware version(硬件版本): RV1106_Luckfox_Pico_Pro_Max
                              applicaton(应用场景): IPC
----------------------------------------------------------------

Which would you like? [0]: 0
[build.sh:info] switching to board: /home/luckfox/luckfox-pico/project/cfg/BoardConfig_IPC/BoardConfig-EMMC-NONE-RV1103_Luckfox_Pico-IPC.mk
[build.sh:info] Running build_select_board succeeded.

42.重新编译

luckfox@luckfox:~/Luckfox-Pico/luckfox-pico$ ./build.sh


5.网络校时
-》修改时区打开文件vi /etc/profile添加内容export TZ=CST-8

-》重启reboot

-》查看当前时区date -R

-》终止ntpd进程

# ps | grep ntpd
  204 root     /usr/sbin/ntpd -g -p /var/run/ntpd.pid
  423 root     grep ntpd
# kill -9 204

-》网络校时

# ntpd -p cn.ntp.org.cn -qn
8 Dec 14:27:51 ntpd[423]: ntpd 4.2.8p15@1.3728-o Fri Dec 8 06:12:46 UTC 2023 (1): Starting
8 Dec 14:27:51 ntpd[423]: Command line: ntpd -p cn.ntp.org.cn -qn
8 Dec 14:27:51 ntpd[423]: ----------------------------------------------------
8 Dec 14:27:51 ntpd[423]: ntp-4 is maintained by Network Time Foundation,
8 Dec 14:27:51 ntpd[423]: Inc. (NTF), a non-profit 501(c)(3) public-benefit
8 Dec 14:27:51 ntpd[423]: corporation. Support and training for ntp-4 are
8 Dec 14:27:51 ntpd[423]: available at https://www.nwtime.org/support
8 Dec 14:27:51 ntpd[423]: ----------------------------------------------------
8 Dec 14:27:51 ntpd[423]: proto: precision = 1.166 usec (-20)
8 Dec 14:27:51 ntpd[423]: basedate set to 2023-11-26
8 Dec 14:27:51 ntpd[423]: gps base set to 2023-11-26 (week 2290)
8 Dec 14:27:53 ntpd[423]: restrict: ignoring line 11, address/host '[::1]' unusable.
8 Dec 14:27:53 ntpd[423]: Listen and drop on 0 v4wildcard 0.0.0.0:123
8 Dec 14:27:53 ntpd[423]: Listen normally on 1 lo 127.0.0.1:123
8 Dec 14:27:53 ntpd[423]: Listen normally on 2 eth0 192.168.10.148:123
8 Dec 14:27:53 ntpd[423]: Listen normally on 3 usb0 172.32.0.93:123
8 Dec 14:27:53 ntpd[423]: Listening on routing socket on fd #20 for interface updates
8 Dec 14:28:00 ntpd[423]: ntpd: time slew -0.019767 s
ntpd: time slew -0.019767s

-》将系统时间同步到hwclockhwclock --systohc

-》查看hwclockhwclock

-》开机启动时,从hwclock同步到系统时间hwclock -u -s

点赞0

举报