Skip to content

Commit

Permalink
Make AP a argos node (#168)
Browse files Browse the repository at this point in the history
* add chrony

* further fixes, switch ap

* misc fixes, bump calypso for reconnect, add time back to iroh

* fix ip fowarding
  • Loading branch information
jr1221 authored Oct 2, 2024
1 parent aeac5d3 commit 897e98c
Show file tree
Hide file tree
Showing 17 changed files with 111 additions and 22 deletions.
2 changes: 1 addition & 1 deletion odysseus_tree/board/ap/cmdline.txt
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
root=/dev/mmcblk0p2 rootwait console=tty1 console=serial0,115200 init=/sbin/ody-resize cgroup_enable=cpuset cgroup_enable=memory
root=/dev/mmcblk0p2 rootwait console=tty1 cgroup_enable=cpuset cgroup_enable=memory init=/sbin/ody-resize

3 changes: 1 addition & 2 deletions odysseus_tree/board/iroh/cmdline.txt
Original file line number Diff line number Diff line change
@@ -1,2 +1 @@
root=/dev/mmcblk0p2 rootwait console=tty1 console=serial0,115200 init=/sbin/ody-resize cgroup_enable=cpuset cgroup_enable=memory

root=/dev/mmcblk0p2 rootwait console=tty1 console=serial0,115200 cgroup_enable=cpuset cgroup_enable=memory init=/sbin/ody-resize
2 changes: 1 addition & 1 deletion odysseus_tree/board/tpu/cmdline.txt
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
root=/dev/mmcblk0p2 rootwait console=tty1 logo.nologo init=/sbin/ody-resize cgroup_enable=cpuset cgroup_enable=memory
root=/dev/mmcblk0p2 rootwait console=tty1 logo.nologo cgroup_enable=cpuset cgroup_enable=memory init=/sbin/ody-resize

8 changes: 7 additions & 1 deletion odysseus_tree/configs/raspberrypi3_64_ap_defconfig
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ BR2_PACKAGE_LINUX_TOOLS_GPIO=y
BR2_PACKAGE_BUSYBOX_SHOW_OTHERS=y
BR2_PACKAGE_XZ=y
BR2_PACKAGE_ZSTD=y
BR2_PACKAGE_GIT=y
BR2_PACKAGE_E2FSPROGS=y
BR2_PACKAGE_E2FSPROGS_RESIZE2FS=y
BR2_PACKAGE_RPI_FIRMWARE=y
Expand All @@ -34,8 +35,11 @@ BR2_PACKAGE_LM_SENSORS=y
BR2_PACKAGE_RASPI_GPIO=y
BR2_PACKAGE_PYTHON3=y
BR2_PACKAGE_CA_CERTIFICATES=y
BR2_PACKAGE_OPENSSL=y
BR2_PACKAGE_LIBQMI=y
BR2_PACKAGE_LIBCURL=y
BR2_PACKAGE_BMON=y
BR2_PACKAGE_CHRONY=y
BR2_PACKAGE_DHCPCD=y
BR2_PACKAGE_DROPBEAR=y
BR2_PACKAGE_GESFTPSERVER=y
Expand All @@ -47,9 +51,11 @@ BR2_PACKAGE_IPUTILS=y
BR2_PACKAGE_IW=y
BR2_PACKAGE_UQMI=y
BR2_PACKAGE_WIRELESS_REGDB=y
BR2_PACKAGE_DOCKER_CLI=y
BR2_PACKAGE_DOCKER_COMPOSE=y
BR2_PACKAGE_DOCKER_ENGINE=y
BR2_PACKAGE_HTOP=y
BR2_PACKAGE_KMOD_TOOLS=y
BR2_PACKAGE_UTIL_LINUX_FSCK=y
BR2_PACKAGE_NANO=y
BR2_TARGET_ROOTFS_EXT2=y
BR2_TARGET_ROOTFS_EXT2_4=y
Expand Down
1 change: 1 addition & 0 deletions odysseus_tree/configs/raspberrypi3_64_iroh_defconfig
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,7 @@ BR2_PACKAGE_CA_CERTIFICATES=y
BR2_PACKAGE_OPENSSL=y
BR2_PACKAGE_BMON=y
BR2_PACKAGE_CAN_UTILS=y
BR2_PACKAGE_CHRONY=y
BR2_PACKAGE_DHCPCD=y
BR2_PACKAGE_DROPBEAR=y
BR2_PACKAGE_GESFTPSERVER=y
Expand Down
9 changes: 9 additions & 0 deletions odysseus_tree/overlays/rootfs_overlay_ap/etc/chrony.conf
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
pool pool.ntp.org iburst
server argos.internal
driftfile /var/lib/chrony/drift

makestep 1.0 50
hwtimestamp *
allow

logdir /var/log/chrony
73 changes: 71 additions & 2 deletions odysseus_tree/overlays/rootfs_overlay_ap/etc/dhcpcd.conf
Original file line number Diff line number Diff line change
@@ -1,4 +1,73 @@
denyinterfaces eth0 wlan0
noipv6
noipv6rs

# A sample configuration for dhcpcd.
# See dhcpcd.conf(5) for details.

# Allow users of this group to interact with dhcpcd via the control socket.
#controlgroup wheel

# Inform the DHCP server of our hostname for DDNS.
hostname

# Use the hardware address of the interface for the Client ID.
clientid
# or
# Use the same DUID + IAID as set in DHCPv6 for DHCPv4 ClientID as per RFC4361.
# Some non-RFC compliant DHCP servers do not reply with this set.
# In this case, comment out duid and enable clientid above.
#duid

# Persist interface configuration when dhcpcd exits.
#persistent

# run as daemon in background forever and listen for carriers forever
background
timeout 0

# Rapid commit support.
# Safe to enable by default because it requires the equivalent option set
# on the server to actually work.
option rapid_commit

# A list of options to request from the DHCP server.
option domain_name_servers, domain_name, domain_search, host_name
option classless_static_routes
# Most distributions have NTP support.
option ntp_servers
# Respect the network MTU. This is applied to DHCP routes.
option interface_mtu

# A ServerID is required by RFC2131.
require dhcp_server_identifier

# Generate Stable Private IPv6 Addresses instead of hardware based ones
slaac private

# Example static IP configuration:
#interface eth0
#static ip_address=192.168.0.10/24
#static ip6_address=fd51:42f8:caae:d92e::ff/64
#static routers=192.168.0.1
#static domain_name_servers=192.168.0.1 8.8.8.8 fd51:42f8:caae:d92e::1

# It is possible to fall back to a static IP if DHCP fails:
# define static profile
#profile static_eth0
#static ip_address=192.168.1.23/24
#static routers=192.168.1.1
#static domain_name_servers=192.168.1.1

# fallback to static profile on eth0
#interface eth0
#fallback static_eth0

# wlan0
interface br0
static ip_address=192.168.100.11
metric 100
static ip_address=192.168.100.11/24
static routers=192.168.100.1


# prevent abstracted interfaces from getting IPs
denyinterfaces eth0 wlan0
1 change: 1 addition & 0 deletions odysseus_tree/overlays/rootfs_overlay_ap/etc/sysctl.conf
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
net.ipv4.ip_forward = 1
Original file line number Diff line number Diff line change
@@ -1 +1 @@
options brcmfmac roamoff=1 feature_disable=0x82000
options brcmfmac roamoff=1 feature_disable=0x82000
9 changes: 9 additions & 0 deletions odysseus_tree/overlays/rootfs_overlay_iroh/etc/chrony.conf
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
pool pool.ntp.org iburst
server argos.internal
driftfile /var/lib/chrony/drift

makestep 1.0 50
hwtimestamp *
allow

logdir /var/log/chrony
Original file line number Diff line number Diff line change
Expand Up @@ -3,12 +3,10 @@
PIDFILE=/var/run/calypso.pid
EXECUTABLE=/usr/bin/calypso
INTERFACE_NAME=can0
BROKER_IP="192.168.100.1:1883"
BROKER_IP="192.168.100.11:1883"

case "$1" in
start)
echo "Sleeping, waiting to start"
sleep 20s
echo "Starting calypso..."
# start (S) executable (x) in background (b), make pid file (m) at p
start-stop-daemon -S -x "$EXECUTABLE" -b -m -p "$PIDFILE" -- -u $BROKER_IP -c $INTERFACE_NAME
Expand Down

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,8 @@ ctrl_interface=/var/run/wpa_supplicant_base
ap_scan=1
country=US
network={
ssid="H68K"
ssid="Hermes"
key_mgmt=WPA-PSK
scan_freq= 2432
psk="password"
}
ignore_old_scan_res=1
Original file line number Diff line number Diff line change
Expand Up @@ -109,11 +109,11 @@ autosave_interval 30

#autosave_on_changes false

#persistence false
persistence true

#persistence_file mosquitto.db
persistence_file mosquitto.db

#persistence_location
persistence_location /var/log


# =================================================================
Expand Down Expand Up @@ -173,7 +173,7 @@ plugin /usr/lib/mosquitto/mosquitto_message_timestamp.so

connection base_station
# *** base station ip
address 192.168.100.1
address 192.168.100.11
# below is not a comment !!! #***
topic # both 0 "" ""

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,8 @@ ctrl_interface=/var/run/wpa_supplicant_base
ap_scan=1
country=US
network={
ssid="H68K"
ssid="Hermes"
key_mgmt=WPA-PSK
scan_freq= 2432
psk="password"
}
ignore_old_scan_res=1
2 changes: 1 addition & 1 deletion odysseus_tree/package/calypso/calypso.mk
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
CALYPSO_VERSION = 27aec3ffe8d86e825e75783ae8e5fd3d132c39ab
CALYPSO_VERSION = 2d6d467effb66c8a549e15e89645cd6bad02bef2
CALYPSO_SITE_METHOD = git
CALYPSO_SITE = https://github.com/Northeastern-Electric-Racing/Calypso
CALYPSO_GIT_SUBMODULES = YES
Expand Down
2 changes: 1 addition & 1 deletion odysseus_tree/post-build-base-connect.sh
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

# hashes the password so it cannot be read in a dsitributed image (does not secure wifi!)
# this regex extras the part after psk=
hashed_block=$(wpa_passphrase "H68K" "$ODY_BASE_WIFI_PASSWORD" | sed -n -e 's/^.*[[:space:]]psk=//p')
hashed_block=$(wpa_passphrase "Hermes" "$ODY_BASE_WIFI_PASSWORD" | sed -n -e 's/^.*[[:space:]]psk=//p')

# this replaces the psk in the target directory with the hashed block found above
sed -i "s/\(psk=\)\(.*\)/\1$hashed_block/" "$TARGET_DIR"/etc/wpa_supplicant_base.conf

0 comments on commit 897e98c

Please sign in to comment.