Yes this is an old thread but it is the one that hits top of my search results and so where I started trying to do the same. Instructions didn’t work but got me started on the path.
The biggest issue is that the Neo seems to have a RTC onboard that doesn’t have the battery powered lines connected.. This causes /dev/rtc0 to be created and the system attaches to it during boot. Adding an external clock gets added as /dev/rtc1 and the system doesn’t use it.
Helps but a) didn’t work (newer version years later I suspect) and b) during boot the clock attaches to the first found, so sets from the built-in rtc, making the system time is wrong.
After lots of reading various posts online and lots of experimenting.. I have a solution that is somewhat straight forward and can be re-produced..
From a new/clean system..
First step is to kill the built in rtc, /dev/rtc0 that makes this so difficult..
install device-tree-compiler and i2c-tools
Use dtc to convert sun8i-h3-nanopi-neo.dtb to source text. Edit the source text to remove the rtc section and the rtc line near the bottom.
Convert your edited source back to the blob.
Remove the fake-clock
apt purge fake-hwclock
Create a service to initialize the ds3231,
vi /etc/systemd/system/rtc.service
[Unit]
Description=Start External RTC
Before=basic.target
After=local-fs.target sysinit.target
DefaultDependencies=no
[Service]
Type=oneshot
ExecStart=/etc/rtc.sh
[Install]
WantedBy=basic.target
vi /etc/rtc.sh
#!/bin/bash
echo "ds1307 0x68" > /sys/class/i2c-dev/i2c-0/device/new_device
Make executable,
chmod 744 /etc/rtc.sh
enable the new service,
systemctl enable rtc.service
and reboot.
I tried but it didn’t work when I tried doing it with just ExecStart.
After the system is running again leave the clock for a couple hours so the external clock updates, do your other setup if needed/wanted..
Shutdown the system and remove power, wait 5 minutes, 8 hours, however long you wish, then reapply power.
After the system boots,
dmesg | grep rtc
[ 19.341579] rtc-ds1307 0-0068: registered as rtc0
[ 19.342659] rtc-ds1307 0-0068: setting system clock to 2025-11-11T04:52:59 UTC (1762836779)
This will confirm it is working, the built in rtc would show at ~6 seconds, you see the correct time, a few seconds after you connected power.
If there is an overlay that could disable the onboard rtc I couldn’t find it and I don’t have the knowledge/experience to create it. Removing the RTC was simple and worked the first time. If there is ever an update that updates the device-tree files, edit the new file and make the same changes.