Fix serial port config for modern Pi OS

main
Ryan Collier 2 weeks ago
parent 6a4e9bf610
commit 3cdcf6b376

@ -1,6 +1,6 @@
#!/bin/bash
# D-Star Site Install Script
# For Raspberry Pi 3 running Raspberry Pi OS Lite
# For Raspberry Pi 3B running Raspberry Pi OS Lite (64-bit)
# Usage: sudo bash install.sh
set -e
@ -45,14 +45,42 @@ echo "Installing ZeroTier..."
curl -s https://install.zerotier.com | bash
zerotier-cli join $ZEROTIER_NETWORK
echo "ZeroTier installed and joined network $ZEROTIER_NETWORK"
echo "NOTE: Approve this device in ZeroTier Central before continuing"
echo ""
read -p "Press ENTER once device is approved in ZeroTier Central..."
echo "NOTE: Approve this device in ZeroTier Central before continuing"
read -p "Press ENTER once device is approved..."
# Enable serial port
# Configure serial port for MMDVM board
echo "Configuring serial port..."
raspi-config nonint do_serial_hw 0
raspi-config nonint do_serial_cons 1
# Modern Pi OS - config in /boot/firmware/config.txt
CONFIG_FILE="/boot/firmware/config.txt"
if [ ! -f "$CONFIG_FILE" ]; then
# Fall back to old path
CONFIG_FILE="/boot/config.txt"
fi
# Disable Bluetooth and enable UART for MMDVM board
if ! grep -q "dtoverlay=disable-bt" "$CONFIG_FILE"; then
echo "" >> "$CONFIG_FILE"
echo "# MMDVM Board - disable BT, enable hardware UART" >> "$CONFIG_FILE"
echo "dtoverlay=disable-bt" >> "$CONFIG_FILE"
echo "enable_uart=1" >> "$CONFIG_FILE"
echo "Serial port configured in $CONFIG_FILE"
fi
# Disable serial console so Linux doesn't use the UART
echo "Disabling serial console..."
systemctl stop serial-getty@ttyAMA0.service 2>/dev/null || true
systemctl disable serial-getty@ttyAMA0.service 2>/dev/null || true
# Remove serial console from cmdline.txt
CMDLINE_FILE="/boot/firmware/cmdline.txt"
if [ ! -f "$CMDLINE_FILE" ]; then
CMDLINE_FILE="/boot/cmdline.txt"
fi
sed -i 's/console=serial0,[0-9]* //' "$CMDLINE_FILE"
sed -i 's/console=ttyAMA0,[0-9]* //' "$CMDLINE_FILE"
echo "Serial console removed from $CMDLINE_FILE"
# Add pi user to dialout
usermod -a -G dialout pi
@ -102,7 +130,6 @@ echo "Installing systemd service..."
cp "$REPO_DIR/services/mmdvmhost.service" /etc/systemd/system/
systemctl daemon-reload
systemctl enable mmdvmhost
systemctl start mmdvmhost
echo ""
echo "================================================"
@ -112,8 +139,12 @@ echo ""
echo "ZeroTier status:"
zerotier-cli status
echo ""
echo "Service status:"
systemctl status mmdvmhost --no-pager
echo "A reboot is required to activate serial port changes."
echo ""
echo "Logs:"
echo " journalctl -u mmdvmhost -f"
read -p "Reboot now? [y/N]: " REBOOT
if [ "$REBOOT" = "y" ] || [ "$REBOOT" = "Y" ]; then
reboot
else
echo "Run 'sudo reboot' when ready."
echo "MMDVMHost will start automatically after reboot."
fi

Loading…
Cancel
Save

Powered by TurnKey Linux.