This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
echo "dtoverlay=i2c-rtc,ds3231" >> /boot/config.txt | |
cat <<EOF > /etc/udev/rules.d/55-rtc-i2c.rules | |
#/lib/udev/rules.d/50-udev-default.rules:SUBSYSTEM=="rtc", ATTR{hctosys}=="1", SYMLINK+="rtc" | |
#/lib/udev/rules.d/50-udev-default.rules:SUBSYSTEM=="rtc", KERNEL=="rtc0", SYMLINK+="rtc", OPTIONS+="link_priority=-100" | |
# I2C RTC, when added and not the source of the sys clock (kernel), is used | |
ACTION=="add", SUBSYSTEMS=="i2c", SUBSYSTEM=="rtc", KERNEL=="rtc0", ATTR{hctosys}=="0", \\ | |
RUN+="/sbin/hwclock '--rtc=\$root/\$name' --hctosys", \\ | |
RUN+="/sbin/logger --tag systemd-udevd 'System clock set from i2c hardware clock \$name (\$attr{name})'" |