38 lines
1.2 KiB
Bash
38 lines
1.2 KiB
Bash
#!/bin/bash
|
|
# script for iono-pi when starting from fresh rpi image
|
|
sudo apt install -y git raspberrypi-kernel-headers
|
|
git clone --depth 1 https://github.com/sfera-labs/iono-pi-kernel-module
|
|
cd iono-pi-kernel-module
|
|
make
|
|
sudo make install
|
|
dtc -@ -Hepapr -I dts -O dtb -o ionopi.dtbo ionopi.dts
|
|
sudo cp ionopi.dtbo /boot/overlays/
|
|
|
|
sudo_append_to () {
|
|
sudo bash -c "grep -qxF '$2' $1 || sudo echo '$2' >> $1"
|
|
}
|
|
sudo_append_to /boot/config.txt dtoverlay=ionopi
|
|
sudo_append_to /boot/config.txt dtoverlay=i2c-rtc,mcp7941x
|
|
sudo groupadd ionopi || true
|
|
sudo cp 99-ionopi.rules /etc/udev/rules.d/
|
|
sudo raspi-config nonint do_i2c 1
|
|
sudo apt install -y i2c-tools
|
|
sudo apt autoremove -y --purge fake-hwclock
|
|
|
|
# RTC clock
|
|
sudo cp ../config-rtc-MCP79410.service /etc/systemd/system/
|
|
sudo cp ../configrtc.sh /usr/local/bin/
|
|
sudo chmod 744 /usr/local/bin/configrtc.sh
|
|
sudo chown root:root /usr/local/bin/configrtc.sh
|
|
sudo systemctl enable config-rtc-MCP79410.service
|
|
sudo_append_to /etc/systemd/timesyncd.conf "NTP=pstime1.psi.ch pstime2.psi.ch pstime3.psi.ch"
|
|
|
|
echo "do the following:"
|
|
echo ""
|
|
echo "> sudo reboot now"
|
|
echo ""
|
|
echo "and, after reboot set RTC time and check it is working"
|
|
echo ""
|
|
echo "> sudo hwclock -w"
|
|
echo "> timedatectl status"
|