[systemd-devel] Support machines with multiple RTCs?

Martin Langhoff martin.langhoff at gmail.com
Tue Nov 22 10:13:08 PST 2011


On Tue, Nov 22, 2011 at 12:28 PM, Kay Sievers <kay.sievers at vrfy.org> wrote:
>>  #1 -- check for the hctosys property. If _any_ rtc present in the
>> system has sysfs attribute hctosys == 1, it means that the kernel took
>> care of it all, and userland doesn't need to call hwclock, at all.
>
> Systemd requires that the time was set by the kernel. It does not
> support any other config natively, that would be done by plugging-in
> hwclock like it was on non-systemd systems.

Cool. That's very appropriate given a minimally modern linux kernel...

> The kernel's hctosys is hard coded in the kernel config, right?

It is set by the kernel to 1, only when CONFIG_RTC_HCTOSYS_DEVICE is
set, and when the device is the device named in this config var.

If you don't have CONFIG_RTC_HCTOSYS_DEVICE, then the kernel won't
sync system time during boot, and your rtc device will have
hctosys==0.

So if systemd counts on the kernel to set system time during boot,
then you already depend on CONFIG_RTC_HCTOSYS_DEVICE, and you should
be all set :-)

>>  #2 -- is customary to prefer /dev/rtc if present -- so that we can
>> symlink to the right rtc from udev. src/util.c seems to hardcode rtc0.
>
> Udev does that by default today:
>  SUBSYSTEM=="rtc", DRIVERS=="rtc_cmos", SYMLINK+="rtc"

Yes, but that means that it expects other programs to first try to
open /dev/rtc . So to complete the picture, I think src/util.c should
try /dev/rtc first :-)

> If possible, we could invent a /dev/rtc-systemtime symlink and use
> that, if its not needed during bootup before udev is started and has
> created the symlink?

that be the same as /dev/rtc I think... so no need for it that I can see.



m
-- 
 martin.langhoff at gmail.com
 martin at laptop.org -- Software Architect - OLPC
 - ask interesting questions
 - don't get distracted with shiny stuff  - working code first
 - http://wiki.laptop.org/go/User:Martinlanghoff


More information about the systemd-devel mailing list