Story: I have used armbian-config to check Hardware (if my I2C bus is enabled). I have noticed very strange behavior of function: grep was outputted in "usage" mode. I revieved all the scripts and it appeared that line which is searching for "overlays=" is throwing this error. My /boot/armbianEnv.txt didn't have any overlay, especially for I2C, enabled. So, I have added as following (+ overlay prefix):
[root@PKTEST ~]# cat /boot/armbianEnv.txt
rootdev=UUID=f8301761-6756-4f97-aa80-12c05ea037cf
extraargs=pty.legacy_count=2
overlays=i2c0 i2c1 i2c2
user_overlays=ds1307
overlay_prefix=sun8i-h3
usbstoragequirks=0x2537:0x1066:u,0x2537:0x1068:u,0x1058:0x10b8:u
[root@PKTEST ~]#
Then I have modified my user overlay file to be as following:
[root@PKTEST ~]# cat /boot/overlay-user/ds1307.dts
/dts-v1/;
/plugin/;
/ {
compatible = "allwinner,sun4i-a10", "allwinner,sun7i-a20", "allwinner,sun8i-h3", "allwinner,sun50i-a64", "allwinner,sun50i-h5";
/*
* Aliases can be used to set the external RTC as rtc0
* Needs supplying the correct path to the I2C controller RTC is connected to,
* this example is for I2C1 on H3
* NOTE: setting time at boot by the kernel
* may not work in some cases if the external RTC module is loaded too late
*/
fragment@0 {
target-path = "/aliases";
__overlay__ {
rtc0 = "/soc/i2c@1c2ac00/ds1307@68";
};
};
fragment@1 {
target = <&i2c0>;
__overlay__ {
#address-cells = <1>;
#size-cells = <0>;
ds1307@68 {
compatible = "dallas,ds1307";
reg = <0x68>;
status = "okay";
};
};
};
};
[root@PKTEST ~]#
The address in fragment@0 is determined by looking where system placed i2c0 bus (I am sure that my RTC is connected to bus 0).
It is giving /dev/rtc1,m which I have verified as following:
[root@PKTEST ~]# ll /dev/rtc*
crw------- 1 root root 253, 0 May 22 2016 /dev/rtc0
lrwxrwxrwx 1 root root 4 May 22 2016 /dev/rtc -> rtc0
crw------- 1 root root 253, 1 May 22 2016 /dev/rtc1
[root@PKTEST ~]# hwclock -r -f /dev/rtc0
Sun 22 May 2016 12:38:25 AM CEST -1.593015 seconds
[root@PKTEST ~]# hwclock -r -f /dev/rtc1
Fri 05 Oct 2018 11:57:03 AM CEST -0.927469 seconds
[root@PKTEST ~]#
Unfortunately it seems that line frogment@0 is not making this device available as rtc0 (it is assigning rtc1):
[root@PKTEST ~]# dmesg | grep -i rtc
[ 3.636229] [drm] Cannot find any crtc or sizes
[ 3.756932] sun6i-rtc 1f00000.rtc: rtc core: registered rtc-sun6i as rtc0
[ 3.756939] sun6i-rtc 1f00000.rtc: RTC enabled
[ 4.641465] [drm] Cannot find any crtc or sizes
[ 9.740172] rtc-ds1307 0-0068: /aliases ID 0 not available
[ 9.741555] rtc-ds1307 0-0068: registered as rtc1
[root@PKTEST ~]#
Can anybody help and answer if it is possible somehow "override" the device? Of course I have my own systemd script to use it and set correct date at boot time. If "overriding" is not possible then I will use it.