hwclock: settimeofday() failed: Invalid argument

 

hwclock: settimeofday() failed: Invalid argument

 

S3c2416 transplant linux2.6.35 to encounter drivers / rtc / hctosys.c: unable to open rtc device (rtc0) error.
July 9, 2010 Friday 14:26

S3c2416 transplant linux2.6.35 to encounter drivers / rtc / hctosys.c: unable to open rtc device (rtc0) error.

Internet search found a solution, as follows:

Solution:

Information can be seen from the start did not load successfully RTC driver!

TCP cubic registered

NET: Registered protocol family 1

RPC: Registered udp transport module.

RPC: Registered tcp transport module.

drivers/rtc/hctosys.c: unable to open rtc device (rtc0)

IP-Config: Complete:

      device=eth0, addr=192.168.1.230, mask=255.255.255.0, gw=192.168.1.1,

     host=www, domain=, nis-domain=kevin.com,

     boot server = 192.168.1.90, 192.168.1.90 = root server, root path =

Port of RPC 100003/2 up the Looking ON 192.168.1.90
the RTC S3C2416 has been in 2.6.35 kernel, but it did not join smdk2416 targetboard,

So we only need to join the list of RTC device initialization.

1. menu config RTC in part using the default settings.

2. Modify the file mach-smdk2416 .c (/linux2.6.35.6/arch/arm/mach-s3c2416/mach-smdk2416 .c), was added & s3c_device_rtc array smdk2416 _devices [] in.

3. Create rtc rtc device files in the / dev directory.

            mknod rtc c 10 135

4. recompile the kernel. Start to see information.

            ……

            S3C24XX RTC, (c) 2004,2006 Simtec Electronics

            s3c2410-rtc s3c2410-rtc: rtc disabled, re-enabling

            s3c2410-rtc s3c2410-rtc: rtc core: registered s3c as rtc0

            ……

            The above information the RTC device has joined the kernel.

             Bin.

Error: hwclock: settimeofday () failed: Invalid argument

Information described above may not set the RTC time, the initial time of RTC Wed Dec 31 23:59:59 1969. From the kernel function int rtc_valid_tm (struct rtc_time * tm), it can be seen, when the year is less than 1970, the time is considered invalid, the function returns the following -EINVAL to verify this idea J

[username@smdk2416]#
[username@smdk2416]# hwclock
Wed Dec 31 23:59:59 1969 0.000000 seconds
[username@smdk2416]# date
Wed Jul 30 20:34:09 UTC 1975

System time is set by the date, RTC time is set by the hwclock. First, boot the system time to get through the RTC, the RTC is not set, the system will use the time Wed Dec 31 23:59:59 1969.

[root@ltls /]# hwclock --help

BusyBox v1.9.2 (2008-04-01 21:32:34 CST) multi-call binary

Usage: hwclock [-r|--show] [-s|--hctosys] [-w|--systohc] [-l|--localtime] [-u|--utc] [-f FILE]

Query and set a hardware clock (RTC)

Options:

            -r       Read hardware clock and print result

            -s      Set the system time from the hardware clock

            -w      Set the hardware clock to the system time

            -u      The hardware clock is kept in coordinated universal time

            -l       The hardware clock is kept in local time

            -f FILE      Use the specified clock (e.g. /dev/rtc2)

[root@ltls /]# hwclock -s

hwclock: settimeofday() failed: Invalid argument

[root@ltls /]# hwclock -w

s3c2410-rtc s3c2410-rtc: rtc only supports 100 years

hwclock: RTC_SET_TIME: Invalid argument

The above error message because the year are caused by improper settings. Not set RTC, RTC will not start timing.

The following set the correct system time, then the system time is transmitted to the RTC.

[root@ltls /]# date 040612282008.20

Sun Apr 6 12:28:20 UTC 2008

[root@ltls /]# hwclock -w

[root@ltls /]# hwclock

Sun Apr 6 12:29:01 2008 0.000000 seconds

[root@ltls /]# hwclock

Sun Apr 6 12:30:15 2008 0.000000 seconds

Ok, RTC began to work!

To make the system time and the RTC time synchronization, you can add commands in the initialization file
Hwclock -s

Reading each boot time for the RTC, and to synchronize the system time.

Add in the etc / init.d / rcS in
# + kevin080305

/bin/hwclock -s

 

Reference: https: //www.cnblogs.com/sky-heaven/p/5220873.html

Published 162 original articles · won praise 125 · views 470 000 +

Guess you like

Origin blog.csdn.net/jiangchao3392/article/details/103885680