Posted onEdited onIn系统构建Views: Word count in article: 2.4kReading time ≈2 mins.
timedatectl will enable ntp by default and automatically synchronize system time if systemd was chosen as system init service. The recipe provides by openembedded will use google’s ntp server in configurations, user might need to append systemd recipe to make it work in China mainland.
Here we use ntp server provided by ubuntu in timesyncd.conf:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15
# This file is part of systemd. # # systemd is free software; you can redistribute it and/or modify it # under the terms of the GNU Lesser General Public License as published by # the Free Software Foundation; either version 2.1 of the License, or # (at your option) any later version. # # Entries in this file show the compile time defaults. # You can change settings by editing this file. # Defaults can be restored by simply deleting this file. # # See timesyncd.conf(5) for details.
# This is the most basic ntp configuration file # The driftfile must remain in a place specific to this # machine - it records the machine specific clock error driftfile /etc/ntp.drift # This obtains a random server which will be close # (in IP terms) to the machine. Add other servers # as required, or change this. server pool.ntp.org # Using local hardware clock as fallback server 127.127.1.0 fudge 127.127.1.0 stratum 14 # Defining a default security setting restrict default nomodify nopeer
To trigger time synchronization while booting up, user need to execute ntpd -nqp in boot scripts. This will make ntpd run only once, synchronize system time and quit, which might be useful for saving system resources: