From 35c1c386df207364aa20aa1b4e36ef47f12b5da0 Mon Sep 17 00:00:00 2001 From: nagumii Date: Tue, 3 Dec 2024 21:56:33 +0200 Subject: [PATCH] Limit nodeid seed to 32 bits --- .../overlay/overlay-luckfox-ubuntu/etc/rc.local | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/foxbuntu/project/cfg/BoardConfig_IPC/overlay/overlay-luckfox-ubuntu/etc/rc.local b/foxbuntu/project/cfg/BoardConfig_IPC/overlay/overlay-luckfox-ubuntu/etc/rc.local index 90e7531..1a61e17 100755 --- a/foxbuntu/project/cfg/BoardConfig_IPC/overlay/overlay-luckfox-ubuntu/etc/rc.local +++ b/foxbuntu/project/cfg/BoardConfig_IPC/overlay/overlay-luckfox-ubuntu/etc/rc.local @@ -14,12 +14,16 @@ if ! grep -A 1 "iface eth0 inet dhcp" /etc/network/interfaces | grep -q "hwaddre echo "Making current eth0 MAC address permanent." fi -#run once to set meshtastic nodeid to derivative of CPU serial number (unique to this board) +#run once to set meshtastic nodeid to derivative of CPU serial number (unique to this board). Check at boot in case of upgrade overwriting this. if ! grep -q "^ExecStart=.*--hwid" /usr/lib/systemd/system/meshtasticd.service; then - sed -i "/^ExecStart=/ s:$: --hwid $((16#$(cat /proc/cpuinfo | grep Serial | awk '{print $3}' | tail -c 8))):" /usr/lib/systemd/system/meshtasticd.service + sed -i "/^ExecStart=/ s:$: --hwid $((0x$(awk '/Serial/ {print $3}' /proc/cpuinfo) & 0xFFFFFFFF)):" /usr/lib/systemd/system/meshtasticd.service echo "Used Luckfox CPU S/N to generate unique nodeid seed for Meshtastic." + systemctl stop meshtasticd + systemctl daemon-reload + systemctl start meshtasticd fi + # try enable RTC echo 'ds1307 0x68' | sudo tee /sys/class/i2c-adapter/i2c-3/new_device > /dev/null 2>&1