Device Tree Compiler - dtc - is missing in ARM version of IPfire

dtc - Device Tree Compiler - is used to compile source Device Tree (.dts files) to device tree blog (.dtb). DTB files are used to describe hardware configuration on ARM based computers.

RPI doesn’t have RTC by default but there are several modules (hats) with RTC chip and backup battery. These modules do not work out of the box in IPfire. There is an device tree overlay, i2c-rtc to add support of these chips but this file is missing in IPfire version for ARM.

dtc is missing in core 184 and should be available in default installation or as an optional package…

dtc is installed by default in Armbian, Raspbian and Ubuntu for ARM

To add RTC hat with DS1307 or DS3231 chip, there is an advice to add line
dtoverlay=i2c-rtc,ds1307 to the end of file /boot/config.txt but it doesn’t work because i2c-rtc overlay file is missing. article

Im not sure that the dtc will help you because IPFire use u-boot which not use the dtoverlay section from the config.txt.

try to modprobe the module and register the rtc manually

modprobe rtc-ds1307
echo ds1307 0x68 > /sys/class/i2c-adapter/i2c-1/new_device

I know that dtoverlay do not work but I did not know why, I thought that overlay i2c-rtc is missing and could be added with dtc.

Manual way (modprobe, etc) works but overlay is better from my point of view, kernel can find RTC chip during boot. But I cannot use this method…

I do not know how to patch IPfire init scripts to use RTC. I believe that RTC should be activated ASAP after boot. Some advice is that it should be added to /etc/sysconfig/rc.local but that script is started at the end of boot process, too late from my point of view…

I am not sure but it could be possible to create new dtb configuration for my board and replace dtb included in IPfire. New configuration will include configuration for RTC. I never tried something like this in the past.

I download file /boot/dtb-6.6.15-ipfire/broadcom/bcm2837-rpi-3-b-plus.dtb to my Ubuntu PC, I installed dtc with apt install device-tree-compiler. Then I decompiled dtb to dts file:

$ dtc -v
Version: DTC 1.5.0

$ dtc -I dtb -O dts bcm2837-rpi-3-b-plus.dtb > bcm2837-rpi-3-b-plus.dts

And then I tried to compile it back:

$ dtc -I dts -O dtb bcm2837-rpi-3-b-plus.dts > test.dtb

I verified with md5sum that dts bcm2837-rpi-3-b-plus.dtb and test.dtb are the same. I am shocked when I see all warning that are printed when I compile from dts to dtb, too many warning from my point of view, that scares me…

The kernel source brings it own dtc which IPFire use. (We also build an external version but this is only used for u-boot for rockchip because here the u-boot shipped one fail) The raspberry pi dts files are vanilla. (no patches applied for this) I also not see any warning in the buildlog from the kernel.

DTC arch/arm64/boot/dts/arm/juno-r2.dtb
DTC arch/arm64/boot/dts/broadcom/bcm2837-rpi-3-b.dtb
DTC arch/arm64/boot/dts/amlogic/meson-axg-jethome-jethub-j110-rev-3.dtb
(also the same for the -plus version)

Im not sure if the warnings result from the decompiled source because many values are now hardcoded.

You can add additional scripts in the bootprocess in /etc/rc.d/rcsysinit.d/

I would suggest S55rtc-module as name because this will executed before S60setclock then.

PS: make sure to mark it executable with chmod +x NAME

1 Like