3,301
社区成员




我们在Linux系统中,可以使用systemd的service完成这个事情,命令如下:
adb wait-for-device root
adb shell mount -o remount,rw /
adb push hwrtc.service /lib/systemd/system/hwrtc.service
adb shell ln -s /lib/systemd/system/hwrtc.service /lib/systemd/system/multi-user.target.wants/hwrtc.service
然后重启系统, 那么开机之后会尝试从RTC中获取到时间.
hwrtc内容:
[Unit]
Description=Synchronise System clock to hardware RTC
DefaultDependencies=no
After=adbd.service
[Service]
Type=oneshot
RemainAfterExit=yes
ExecStart=/sbin/hwclock --hctosys --utc --noadjfile -f /dev/rtc1
RestrictRealtime=yes
[Install]
WantedBy=multi-user.target