The time setting of the Development Board is valid, but the system restarts and recovers.

Source: Internet
Author: User

When using the Development Board, it is found that the RTC time is always set to November 30, 2015, no matter how you set it, use hwclock-W or program to modify the RTC chip, the modified time and RTC time are both correct, but after the power failure is restarted, the time is changed to November 30, 2015.

Through analysis and search, it is found that the timestamp in the/etc/directory is suspicious, and its value is exactly 113011302015. Therefore, there are two files including:/etc/init. bootmisc. SH and save-rtc.sh. Among them, bootmisc. sh contains the following content: # set the system clock from hardware clock # If the timestamp is 1 day or more recent than the current time, # Use the timestamp instead. test-x/etc/init. d/hwclock. sh &/etc/init. d/hwclock. sh startif test-E/etc/timestampthensystemdate = 'date "+ % Y % m % d" 'timestamp = 'cat/etc/timestamp | awk '{print substr ($, 4) substr ($0, 1, 4);} ''needupdate = 'expr \ ($ timestamp \> $ systemdate \) 'If [$ needupdate-EQ 1]; thendate 'cat/etc/timestamp'/etc/init. d/hwclock. the script above sh stopfifi checks whether the file/etc/timestamp exists and compares the timestamp with the current system time, if the timestamp time is one or more days earlier than the system time, the timestamp is used and written to the RTC time. The script save-rtc.sh has the following content :#! /Bin/sh/etc/init. d/hwclock. sh stop # update the timestampdate + % 2 M % 2D % 2 h % 2 M % Y>/etc/timestamp the script above writes the current time to timestamp. At the same time, bootmis. the sh script is linked to the RCS. s55bootmis in D. sh, executed at system startup, and the script save-rtc.sh is linked to the rc0.d and rc6.d folders and executed at system shutdown and restart. To solve the problem above, you only need to: 1. Modify/etc/timestamp to make it less than or equal to the current system time. 2. Shut down or restart the system normally, instead of directly powering off the power. Http://weimenlove.blog.163.com/blog/static/177754732013825111948983/

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.