Prerequisites¶
- Alpine Linux v3.11 (or later) installed on a Raspberry Pi 3 B+
- DS3231 Real Time Clock Module for Raspberry Pi
Pre-Setup¶
Install the RTC module on GPIO pins 1, 3, 5, 7 & 9 on the Raspberry Pi 3 B+
Create (or edit) usercfg.txt
on the SD card partition and add
dtoverlay=i2c-rtc,ds3231
Boot into Alpine Linux and login
If you are running Alpine version v3.13 this is all you need to do, if running an older version continue below.
Setup¶
Install mkinitfs package
# apk add mkinitfs
add rpirtc
to /etc/mkinitfs/mkinitfs.conf
Example after:
features="ata base cdrom ext4 keymap kms mmc raid scsi usb virtio rpirtc"
Rebuild initramfs in order to add the kernel modules needed for the ds3231 device.
# . /etc/lbu/lbu.conf # ln -s /media/$LBU_MEDIA/boot /boot # mount /media/$LBU_MEDIA -o remount,rw # . /etc/mkinitfs/mkinitfs.conf # mkinitfs -F "$features base squashfs" # mount /media/$LBU_MEDIA -o remount,ro
Enable the hwclock service
# rc-update del swclock boot # rc-update add hwclock boot # hwclock -w # lbu commit
Now you can reboot
and the rtc hwclock should be used.