RTC on Linux - VIM1/VIM2

How to get RTC working on VIM1/VIM2 with linux?

Which ROM you tested now?

I have tried all roms for VIM2 they loose date & time once device is powered off. I have connected battery to device. I tried to build rom using fenix script, even with that rom same results.

I tested it with android Nougat rom there it retains date & time but not with linux rom.

Please guide me how to take care of this.

Hello rajendrapatil,

It seems that the RTC driver on linux is missing, I will check and feedback here.

Thanks.

Hello rajendrapatil,

RTC support added for linux 3.14 & 4.9. Please update you linux repo.

You can try to build image with Fenix.

Note: You need to delete the old linux deb packages: build/images/debs/0.4/linux--amlogic-_0.4_arm64.deb.

Hi,

Yes, it is working now.
Is there any document for further customization of ROM. I would like to remove certain components & would like to add our libraries & services in the custom rom for our regular use?

Regards,
Rajendra

No such document yet. You can read the Fenix script to find out how it works.

Hi,
is RTC still working on VIM1 eMMC 4.9, bionic? this is what I get when trying to read RTC

root@Khadas:~/pyapp# hwclock -rD
hwclock from util-linux 2.31.1
System Time: 1548663630.436706
Trying to open: /dev/rtc0
Using the rtc interface to the clock.
Last drift adjustment done at 1548637461 seconds after 1969
Last calibration done at 1548637461 seconds after 1969
Hardware clock is on UTC time
Assuming hardware clock is kept in UTC time.
Waiting for clock tick…
hwclock: select() to /dev/rtc0 to wait for clock tick timed out
…synchronization failed

from dmesg, the following can be found related to RTC:
[ 7.298348] aml_vrtc rtc: setting system clock to 2017-01-01 00:00:11 UTC (1483228811)
[ 40.264336] systemd[1]: System time before build time, advancing clock.

root@Khadas:~/pyapp# uname -a
Linux Khadas 4.9.40 #2 SMP PREEMPT Tue Oct 30 15:47:54 CST 2018 aarch64 aarch64 aarch64 GNU/Linux

Hi,

I have tested it with VIM2 & it is working fine.

RTC is NOT working on VIM1 with bionic.
This is what I get if started without network (RTC battery is connected of course):

khadas@Khadas:~$ hwclock -rD
hwclock from util-linux 2.31.1
System Time: 1550849645.592730
Trying to open: /dev/rtc0
No usable clock interface found.
hwclock: Cannot access the Hardware Clock via any known method.

khadas@Khadas:~$ ls -l /dev/rtc0 # the device exists
crw------- 1 root root 252, 0 Feb 22 15:25 /dev/rtc0

when network is restored, the message became a bit different

root@Khadas:~# hwclock -rD
hwclock from util-linux 2.31.1
System Time: 1552546284.863137
Trying to open: /dev/rtc0
Using the rtc interface to the clock.
Assuming hardware clock is kept in UTC time.
Waiting for clock tick…
hwclock: select() to /dev/rtc0 to wait for clock tick timed out
…synchronization failed

Have noticed that fake-hwclock is installed and enabled. We should not need this if RTC is is present and battery connected. That can be disabled of course, but HOW to get the real RTC working first?