A true mainline Linux Kernel for the Pinebook Pro
#86
I've spent some time investigating the failing to load time from RTC at boot. (Some people are circumventing it by fumbling around with NTP daemons).

Looking at the logs:

Code:
$ journalctl --boot | grep -P 'rtc0|timesyncd'|head -n 3
Dec 17 13:44:08 nereid kernel: hctosys: unable to open rtc device (rtc0)
Dec 17 13:44:13 nereid kernel: rk808-rtc rk808-rtc: registered as rtc0
Dec 17 13:44:17 nereid systemd-timesyncd[791]: System clock time unset or jumped backwards, restoring from recorded timestamp: Tue 2019-12-17 23:29:02 CET

Seems that there's a race condition: kernel's `hctosys` tries to fetch time before the RTC driver has actually registered a device to fetch from, and thus when timesyncd starts the clock is still wrong and gets restored from last shutdown timestamp.

It looks like a time race that looks exactly like this bug report.

In pinebook pro's situation:
Code:
$ zgrep -P 'RTC_(HCTOSYS|SYSTOHC|DRV_RK808)' /proc/config.gz
CONFIG_RTC_HCTOSYS=y
CONFIG_RTC_HCTOSYS_DEVICE="rtc0"
# CONFIG_RTC_SYSTOHC is not set
CONFIG_RTC_DRV_RK808=m

it seems that we hit the same situation:
- hctosys is a built-in kernel function and is ran immediately during kernel start-up, at which time there is no RTC available yet.
- rk808 is a module and is loaded much later (5 sec later), by which time it's too late.

Compare with a PC Workstation:
Code:
> zgrep -E 'RTC_(HCTOSYS|SYSTOHC|DRV_CMOS)' /proc/config.gz
CONFIG_RTC_HCTOSYS=y
CONFIG_RTC_HCTOSYS_DEVICE="rtc0"
CONFIG_RTC_SYSTOHC=y
CONFIG_RTC_SYSTOHC_DEVICE="rtc0"
CONFIG_RTC_DRV_CMOS=y
and thus
Code:
> sudo dmesg | grep rtc0
[    1.384356] rtc_cmos 00:04: registered as rtc0
RTC is loaded almost immediately and there are no error from hctosys.

Would it be possible to:
- either compile the RK808 driver as builtin? (CONFIG_RTC_DRV_RK808=y like the bug report mentionned above)
- or add a udev rule to `hwclock --hctosys` as soon as rtc0 is registered ?


Messages In This Thread
RE: A true mainline Linux Kernel for the Pinebook Pro - by DrYak - 12-18-2019, 07:19 AM
5.12 - by kalpazanius - 04-26-2021, 04:38 PM
RE: 5.12 - by ramsey - 06-19-2021, 05:36 PM
RE: 5.12 - by linuxad - 06-20-2021, 09:26 AM

Possibly Related Threads…
Thread Author Replies Views Last Post
  Upgrading Armbian from v24.2.1 gnome, breaks pinebook pro Sb2024 0 104 11-10-2024, 02:50 PM
Last Post: Sb2024
  Attempting to install Void Linux, boots into a black screen 9a3eedi 1 1,186 09-28-2024, 09:23 AM
Last Post: throwawayforvoid
  Pinebook pro won't boot after bootloader installation jwensouls 4 933 08-21-2024, 04:17 AM
Last Post: KC9UDX
  Slackware Linux working on PBP vxzero 0 604 06-05-2024, 04:30 PM
Last Post: vxzero
  [Pinebook Pro/Mobian/XFCE4] can fix touch or screen in greeter not both SynthGal 0 401 05-31-2024, 09:42 AM
Last Post: SynthGal
  Debian on Pinebook Pro u974615 7 2,891 03-31-2024, 10:11 AM
Last Post: u974615
  Pinebook Pro upgrading from the factory image yamsoup 12 4,108 02-22-2024, 04:02 PM
Last Post: tllim
  Help installing Manjaro on eMMC of Pinebook Pro pine4546464 4 3,218 12-13-2023, 07:22 PM
Last Post: trillobite
  Need Help Recovering Manjaro /boot Contents on Pinebook Pro calinb 6 3,509 12-11-2023, 03:47 AM
Last Post: calinb
  Gentoo on Pinebook Pro RELEASE jannik2099 54 103,488 12-08-2023, 11:25 PM
Last Post: tllim

Forum Jump:


Users browsing this thread: 1 Guest(s)