2017-01-17 11:29:09 UTC
I am aware of the fact that systemd relies on the kernel to set system
clock from hardware clock, and that requires compiling rtc drivers into
the kernel, not as modules.
I am also aware that doing it othervise would mix timestamps in log entries.
The question is: if I have rtc driver as a module anyway, how to modify
initramfs so that system time would be set, in such a way so that it
happens *before* journald in initramfs starts? I assume it is an
initramfs using systemd inside of it.
One approach would be to have an udev rule that does trigger after rtc
appears or rtc symlink is added, this rule would start a service that
sets the system clock, but this service would have to always run before
journald, and that seems not possible in such a configuration, because
if someone would unplug the rtc the service would not run?
Another thing is to load rtc and i2c bus module where rtc is connected
statically without udev detection, and then the hwclock service would
always be triggered before journald without looking for rtcs appearing...