Skip to content
Snippets Groups Projects
Commit 5dcd0dd1 authored by Aurelien Jarno's avatar Aurelien Jarno Committed by Andreas Henriksson
Browse files

Set system time directly from hw clock in udev rule

With the new armmp kernel, RTC drivers are built as modules, and thus
the kernel doesn't set the system clock from the hardware clock when
the module is loaded, as explained in the RTC_HCTOSYS_DEVICE KConfig
option:

| The driver for this RTC device must be loaded before late_initcall
| functions run, so it must usually be statically linked.

In that case, util-linux should set the system clock from the RTC
itself. This is correctly done through /etc/init.d/hwclock.sh when udev
is not used. When using udev, the rule 85-hwclock.rules call
hwclock-set, which assumes that the system clock has already been set
earlier by the kernel and that the only remaining thing to do is the
correct it to the local timezone (--systz). While this was true with
the wheezy kernels, it's not longer true with the jessie one, and the
--systohc option has to be used instead.

Closes: #751238
parent 8c3144b5
No related branches found
No related tags found
No related merge requests found
......@@ -22,7 +22,7 @@ if [ -f /etc/default/hwclock ] ; then
fi
if [ yes = "$BADYEAR" ] ; then
/sbin/hwclock --rtc=$dev --systz --badyear
/sbin/hwclock --rtc=$dev --hctosys --badyear
else
/sbin/hwclock --rtc=$dev --systz
/sbin/hwclock --rtc=$dev --hctosys
fi
# Reset the System Clock to UTC if the hardware clock from which it was
# copied by the kernel was in localtime.
# Set the System Time from the Hardware Clock and set the kernel's timezone
# value to the local timezone when the kernel clock module is loaded.
KERNEL=="rtc0", RUN+="/lib/udev/hwclock-set $root/$name"
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment