1. Enable I2C-RTC driver in kernel, Eg.<DS3232>.
Device Drivers->
Real Time Clock-->
[*] Set system time from RTC on startup and resume (new)
(rtc0) RTC used to set the system time (new)
<[*] /sys/class/rtc/rtcN (sysfs)
<[*] /proc/driver/rtc (procfs for rtc0)
<[*] /dev/rtcN (character devices)
I2C RTC drivers
<[*] Dallas/Maxim DS3232
After booting up Linux.
# dmesg |grep rtc
# ls -l /dev/rtc*
# cat /proc/devices |grep rtc
# mknod /dev/rtc0 c 254 0
# ln -s /dev/rtc0 /dev/rtc
# hwclock -r
# date
# date 081815202008
# hwclock -w
# date 010101012011
# date
# hwclock
# hwclock -s
# date
If your RTC chip supports NVRAM, it will be exposed as a sysfs file named nvram. To find the file, run
find /sys -name nvram
and you will get output like
/sys/devices/platform/i2c_davinci.1/i2c-1/1-0068/nvram
If your busybox configuration includes
CONFIG_OD=y
then you can dump the contents of NVRAM using
od -x /sys/devices/platform/i2c_davinci.1/i2c-1/1-0068/nvram
and you will get output similar to
0000000 d67a 8472 5de8 b5d6 7e1d 10da 4aef 8016 0000020 26df 1027 56a5 b814 61ca 5214 1259 5aca 0000040 ba49 5930 e452 a730 f653 ec0a f0bb 2ad0 0000060 88dc 657e 3468 9be8
You can test that you can write to NVRAM using
echo "123456789a123456789b123456789c123456789d123456789e1234" > /sys/devices/platform/i2c_davinci.1/i2c-1/1-0068/nvram