Results 1 to 10 of 13
Hello!
I'm trying to set the hw clock of a board running a LFS. I tried to run hwclock, but it returns "hwclock: can't open '/dev/misc/rtc': No such device". I've ...
- 09-06-2011 #1
Set hardware clock
Hello!
I'm trying to set the hw clock of a board running a LFS. I tried to run hwclock, but it returns "hwclock: can't open '/dev/misc/rtc': No such device". I've found in /dev a file named rtc, but after create a symbolic link in /dev/misc/rtc the error remains.
- 09-08-2011 #2Linux Guru
- Join Date
- May 2011
- Posts
- 1,838
What is your hardware - do you know that it has a hardware clock?
What if you bypass the character device, e.g.:
Code:hwclock --directisa
- 09-09-2011 #3
My hardware is a FriendlyARM mini2440. The directisa option is unknown by hwclock. With ls, I see that /dev has a device called rtc, but when I tried 'hwclock -f /dev/rtc', it says '/dev/rtc - no such device'. Using 'find' searching for 'rtc', it returned the following:
Code:/dev/rtc /sys/devices/platform/s3c2410-rtc/rtc /sys/class/rtc /proc/driver/rtc
- 09-09-2011 #4Linux Guru
- Join Date
- May 2011
- Posts
- 1,838
Does the character device look right? e.g.:
Is there a kernel module you need to load first, in order to access it? I'm guess it is already loaded, which is where yourCode:# ls -l /dev/misc/rtc crw-r--r-- 1 root root 10, 135 Jul 13 15:39 /dev/rtc
/sys/devices/platform/s3c2410-rtc/rtc
comes from.
Is there anything helpful in the syslog or dmesg regarding rtc? e.g.:
Code:dmesg|egrep -i 'rtc|clock'
- 09-09-2011 #5
My device don't have /dev/misc/rtc, only /dev/rtc.
I run the other command, too:Code:# ls -l /dev/rtc crw-r----- 1 root root 10, 135 Aug 2 08:34 /dev/rtc
Code:#dmesg | egrep -i 'rtc|clock' S3C24XX Clocks, (c) 2004 Simtec Electronics CLOCK: Slow mode (1.500 MHz), fast, MPLL on, UPLL on S3C244X: Clock Support, DVS off 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 s3c2410-rtc s3c2410-rtc: setting system clock to 2011-09-08 09:14:22 UTC (1315473262)
- 09-09-2011 #6Linux Guru
- Join Date
- May 2011
- Posts
- 1,838
I said /dev/misc/rtc because that's where you said it was originally, but /dev/rtc is the normal location anyway, i think.
What version of hwclock are you using? Did you compile it yourself (LFS) or is it busybox, or something else?
Does setting the date first make a difference?Code:hwclock --version
- 09-09-2011 #7
I compiled using Buildroot (that uses Busybox). The --version arg isn't recognized by hwclock.
Code:Busybox v1.18.5 (2011-08-02 09:53:04 BRT) multi-call binary. Usage: hwclock [-r|--show] [-s|--hctosys] [-w|--systohc] [-l|--localtime] [-u|--utc] [-f FILE] Query and set hardware clock (RTC) Options: -r Show hardware clock time -s Set system time from hardware clock -w Set hardware clock to system time -u Hardware clock is in UTC -l Hardware clock is in local time -f FILE Use specified device (e.g. /dev/rtc2)
- 09-09-2011 #8Linux Guru
- Join Date
- May 2011
- Posts
- 1,838
I've had trouble before with busybox applets that replace actual binaries. Is there any chance you can compile hwclock from source yourself, for your platform? It is part of the util-linux (or util-linux-ng) package.
There's a section on it in the LFS installation guide.
- 09-09-2011 #9
Well, I don't have much skills in compiling from source, but I can try. I used the Buildroot to build the whole system because I need some specific libraries to use in the board (I compiled the dependencies with the Buildroot, and then my libraries using the generated toolchain). But the problem seems to be the rtc device, isn't? Although the rtc device is present, it always says "No such device"...
- 09-09-2011 #10Linux Guru
- Join Date
- May 2011
- Posts
- 1,838
Yeah, I may be way off on that, anyway...just an idea.
Out of curiosity, what is in the /proc/driver/rtc file?
Kernel.org is still down, but I see the util-linux-ng source is here.Code:cat /proc/driver/rtc
Is your toolchain set up (for compiling for the ARM platform)? Hopefully, it will be as straight-forward as:
If cross-compiling, you'll probably need to set some env vars before-hand, or tell configure where your compiler, libs, headers, etc. are.Code:wget http://somesite/util-linux-ng-2.14.2.tar.bz2 tar jxf util-linux-ng-2.14.2.tar.bz2 cd util-linux-ng-2.14.2 ./configure make
If the make command completes successfully, you'll have hwclock in ./hwclock/hwlock
good luck!
EDIT: Check out the kernel documentation for rtc, too - do you need /dev/rtc0?Last edited by atreyu; 09-09-2011 at 01:53 PM. Reason: kernel doc


Reply With Quote
