Porównaj commity

...

24 Commity

Autor SHA1 Wiadomość Data
Adrian Batzill 150f2828ef fix for OGN wrong aircraft type reporting 2024-04-07 12:22:16 +02:00
Adrian Batzill 6b1adbdf54 minor tweaks, also correctly import persistent logging setting on first boot, thanks to @TomBric 2024-04-07 10:08:50 +02:00
Adrian Batzill 7c32d0c7bb wrong path 2024-04-07 09:32:09 +02:00
Adrian Batzill 7a7bd277fe use jq instead of heuristic grep for overlay enable/disable 2024-04-07 09:31:49 +02:00
Adrian Batzill 1cd1382676 add pico-tts to release image for future voice alert support 2024-04-03 13:01:27 +02:00
Adrian Batzill d4ac867e50 Merge branch 'master' into bookworm 2024-04-02 08:12:04 +01:00
Adrian Batzill d8c53c998e Merge branch 'master' into bookworm 2024-04-01 19:12:23 +02:00
Adrian Batzill c66bfddf40 disable quiet boot 2024-04-01 13:59:24 +02:00
Adrian Batzill 474c031c82 fix kernel driver crash when TTGO T-Motion connected 2024-04-01 12:56:38 +02:00
Adrian Batzill 97cb1d5171 Merge branch 'master' into bookworm 2024-03-26 09:56:17 +00:00
Adrian Batzill 28060d2739 write config file to home directory when not running as root 2024-03-26 08:46:12 +01:00
Adrian Batzill 523bd56f19 fix for parted not wanting to shrink partitions from script 2024-03-25 08:02:58 +01:00
Adrian Batzill 902a622180 fixed partition accidentally being shrunk too much 2024-03-24 17:35:11 +01:00
Adrian Batzill ed5c29e3aa adjust first-boot handling for bookworm 2024-03-24 16:11:53 +01:00
Adrian Batzill 9f47302a20 make a bit more space during image building 2024-03-24 14:34:45 +01:00
Adrian Batzill 28cdfe35f3 Merge branch 'master' into bookworm 2024-03-24 14:04:31 +01:00
Adrian Batzill 245949fe01 back to hardcoded clone url 2024-03-23 13:33:55 +01:00
Adrian Batzill 9fba560c90 fixed bookworm first boot behaviour 2024-03-23 13:26:52 +01:00
Adrian Batzill 8c299958fb latest image 2024-03-23 10:43:54 +00:00
Adrian Batzill dd49b573a7 Revert "use beidou instead of glonass"
This reverts commit 3c87208264.
2024-03-23 10:43:54 +00:00
Adrian Batzill eab5115304 Also read GNGST via UART 2024-03-23 10:43:54 +00:00
Adrian Batzill 081f27a6a2 read GNGST NMEA for accuracy estimation, hdop estimation only as fallback 2024-03-23 10:43:54 +00:00
Adrian Batzill 642ca783fe make GPS solution text same on backend/status page and GPS page 2024-03-23 10:43:54 +00:00
Adrian Batzill 6a3f58d4e5 bookworm migration WIP 2024-02-14 16:37:37 +01:00
12 zmienionych plików z 107 dodań i 79 usunięć

Wyświetl plik

@ -11,7 +11,7 @@ function wLog () {
wLog "Running Stratux Updater Script."
SCRIPT_MASK="update*stratux*v*.sh"
TEMP_LOCATION="/boot/StratuxUpdates/$SCRIPT_MASK"
TEMP_LOCATION="/boot/firmware/StratuxUpdates/$SCRIPT_MASK"
UPDATE_LOCATION="/root/$SCRIPT_MASK"
if [ -e ${TEMP_LOCATION} ]; then
@ -40,13 +40,29 @@ if [ -e ${UPDATE_LOCATION} ]; then
fi
if [ -f /boot/.stratux-first-boot ]; then
rm /boot/.stratux-first-boot
if [ -f /boot/stratux.conf ] && grep -q WiFi /boot/stratux.conf ; then
# Import old stratux.conf.. apply network settings
/opt/stratux/bin/gen_gdl90 -write-network-config
wLog "re-wrote network configuration for first-boot config import. Rebooting... Bye"
reboot
if [ -f /boot/firmware/.stratux-first-boot ]; then
rm /boot/firmware/.stratux-first-boot
if [ -f /boot/firmware/stratux.conf ]; then
# In case of US build, a stratux.conf file will always be imported, only containing UAT/OGN options.
# We don't want to force-reboot for that.. Only for network/overlay changes
do_reboot=false
# re-apply overlay
if [ "$(jq -r .PersistentLogging /boot/firmware/stratux.conf)" = "true" ]; then
/sbin/overlayctl disable
do_reboot=true
wLog "overlayctl disabled due to stratux.conf settings"
fi
# write network config
if grep -q WiFi /boot/firmware/stratux.conf ; then
/opt/stratux/bin/gen_gdl90 -write-network-config
do_reboot=true
wLog "re-wrote network configuration for first-boot config import. Rebooting... Bye"
fi
if $do_reboot; then
reboot
fi
fi
fi

Wyświetl plik

@ -52,7 +52,7 @@ var (
)
const (
configLocation = "/boot/stratux.conf"
configLocation = "/boot/firmware/stratux.conf"
// CPU temperature target, degrees C
defaultTempTarget = 50.

Wyświetl plik

@ -1,4 +1,4 @@
# RPi /boot/config.txt
# RPi /boot/firmware/config.txt
dtparam=audio=on
max_usb_current=1
@ -14,6 +14,9 @@ dtoverlay=disable-bt
# i2c serial support
dtoverlay=sc16is752-i2c,int_pin=4,addr=0x4d,xtal=1843900
# Otherwise TTGO T-Motion will cause kernel panic on bookworm
dtoverlay=dwc2
# disable default (mmc0) behavior on the ACT LED.
dtparam=act_led_trigger=none
dtparam=act_led_activelow=off

Wyświetl plik

@ -32,26 +32,31 @@ if [ -f /var/grow_root_part ]; then
mount -n -t proc proc /proc
mount -n -t sysfs sys /sys
sleep 1 # otherwise proc/sys not yet ready?
mount -n -o remount,rw $(findmnt / -o source -n) /
rm /var/grow_root_part
touch /var/grow_root_fs
/usr/lib/raspi-config/init_resize.sh
fi
# On second boot, we then increase the filesystem itself..
if [ -f /var/grow_root_fs ]; then
mount -n -t proc proc /proc
mount -n -t sysfs sys /sys
sleep 1 # otherwise proc/sys not yet ready?
mount -n -o remount,rw $(findmnt / -o source -n) /
rm /var/grow_root_fs
rm -f /etc/init.d/resize2fs_once # so we don't get error messages on boot
resize2fs $(findmnt / -o source -n)
ROOT_PART_DEV=$(findmnt / -no source)
ROOT_DEV_NAME=$(lsblk -no pkname "$ROOT_PART_DEV")
ROOT_DEV="/dev/${ROOT_DEV_NAME}"
echo "Growing root partition..."
parted $ROOT_DEV resizepart 2 100%
partprobe $ROOT_DEV
echo "Growing root fs..."
mount -o remount,rw /
resize2fs $ROOT_PART_DEV
rm /var/grow_root_part
#mount -o remount,ro /
umount /sys
umount /proc
mount -o remount,ro /
sync
reboot -f
sleep 5
exit 0
fi
if [ -e "/overlay/disable" ] ; then
echo "Overlay disabled"
# Stratux: make sure we always have something usable in /overlay/robase, so we can upload update .sh files there

Wyświetl plik

@ -6,11 +6,12 @@
# Run this script as root.
# Run with argument "dev" to not clone the stratux repository from remote, but instead copy this current local checkout onto the image
set -x
BASE_IMAGE_URL="https://downloads.raspberrypi.org/raspios_lite_arm64/images/raspios_lite_arm64-2022-04-07/2022-04-04-raspios-bullseye-arm64-lite.img.xz"
ZIPNAME="2022-04-04-raspios-bullseye-arm64-lite.img.xz"
BASE_IMAGE_URL="https://downloads.raspberrypi.com/raspios_lite_arm64/images/raspios_lite_arm64-2024-03-15/2024-03-15-raspios-bookworm-arm64-lite.img.xz"
ZIPNAME="2024-03-15-raspios-bookworm-arm64-lite.img.xz"
IMGNAME="$(basename $ZIPNAME .xz)"
TMPDIR="$HOME/stratux-tmp"
REMOTE_ORIGIN=$(git config --get remote.origin.url)
# REMOTE_ORIGIN=$(git config --get remote.origin.url) # would be nicer, but doesn't work with ssh clone..
REMOTE_ORIGIN="https://github.com/b3nn0/stratux.git"
die() {
echo $1
@ -44,12 +45,12 @@ bootoffset=$(( 512*bootoffset ))
# Original image partition is too small to hold our stuff.. resize it to 2.5gb
# Append one GB and truncate to size
truncate -s 3000M $IMGNAME || die "Image resize failed"
truncate -s 3500M $IMGNAME || die "Image resize failed"
lo=$(losetup -f)
losetup $lo $IMGNAME
partprobe $lo
e2fsck -f ${lo}p2
parted ${lo} resizepart 2 100%
e2fsck -y -f ${lo}p2
parted --script ${lo} resizepart 2 100%
partprobe $lo || die "Partprobe failed failed"
resize2fs -p ${lo}p2 || die "FS resize failed"
@ -58,12 +59,12 @@ resize2fs -p ${lo}p2 || die "FS resize failed"
# Mount image locally, clone our repo, install packages..
mkdir -p mnt
mount -t ext4 ${lo}p2 mnt/ || die "root-mount failed"
mount -t vfat ${lo}p1 mnt/boot || die "boot-mount failed"
mount -t vfat ${lo}p1 mnt/boot/firmware || die "boot-mount failed"
cd mnt/root/
if [ "$1" == "dev" ]; then
rsync -av --progress --exclude=ogn/esp-idf $SRCDIR ./
rsync -av --progress --exclude=ogn/esp-idf --exclude="**/*.mbtiles" --exclude=esp32-ogn-tracker $SRCDIR ./
cd stratux && git checkout $2 && cd ..
else
git clone --recursive -b $2 $REMOTE_ORIGIN
@ -83,7 +84,7 @@ mkdir -p out
# Move the selfupdate file out of there..
mv mnt/root/update-*.sh out
umount mnt/boot
umount mnt/boot/firmware
umount mnt
# Shrink the image to minimum size.. it's still larger than it really needs to be, but whatever
@ -94,11 +95,13 @@ resize2fs -p ${lo}p2 $minsize
zerofree ${lo}p2 # for smaller zip
bytesEnd=$((partoffset + $minsizeBytes))
echo "Yes" | parted ${lo} resizepart 2 ${bytesEnd}B yes
partprobe $lo
bytesEnd=$(($partoffset + $minsizeBytes))
losetup -d ${lo}
# parted --script $IMGNAME resizepart 2 ${bytesEnd}B Yes doesn't seem tow rok any more... echo yes | parted .. neither. So we re-create partition with proper size
parted --script $IMGNAME rm 2
parted --script $IMGNAME unit B mkpart primary $partoffset $bytesEnd
truncate -s $(($bytesEnd + 4096)) $IMGNAME

Wyświetl plik

@ -27,7 +27,7 @@ apt update
apt clean
PATH=/root/fake:$PATH apt install --yes libjpeg62-turbo-dev libconfig9 rpi-update dnsmasq git cmake \
libusb-1.0-0-dev build-essential autoconf libtool i2c-tools libfftw3-dev libncurses-dev python3-serial jq ifplugd iptables
libusb-1.0-0-dev build-essential autoconf libtool i2c-tools libfftw3-dev libncurses-dev python3-serial jq ifplugd iptables libttspico-utils
# Downgrade to older brcm wifi firmware - the new one seems to be buggy in AP+Client mode
# see https://github.com/raspberrypi/firmware/issues/1463
@ -48,11 +48,11 @@ apt clean
systemctl enable ssh
systemctl disable dnsmasq # we start it manually on respective interfaces
systemctl disable dhcpcd
systemctl disable hciuart
systemctl disable triggerhappy
systemctl disable wpa_supplicant
systemctl disable systemd-timesyncd # We sync time with GPS. Make sure there is no conflict if we have internet connection
systemctl disable resize2fs_once
systemctl disable apt-daily.timer
@ -105,7 +105,7 @@ cd /root && rm -rf kalibrate-rtl
# Prepare wiringpi for ogn trx via GPIO
cd /root && git clone https://github.com/WiringPi/WiringPi.git
cd WiringPi && ./build
cd WiringPi && WIRINGPI_SUDO="" ./build
cd /root && rm -r WiringPi
# Debian seems to ship with an invalid pkgconfig for librtlsdr.. fix it:
@ -114,9 +114,8 @@ cd /root && rm -r WiringPi
# Install golang
cd /root
wget https://go.dev/dl/go1.20.1.linux-arm64.tar.gz
tar xzf go1.20.1.linux-arm64.tar.gz
rm go1.20.1.linux-arm64.tar.gz
wget -O- https://go.dev/dl/go1.20.1.linux-arm64.tar.gz | tar xz
# Compile stratux
cd /root/stratux
@ -134,7 +133,7 @@ cd /root/stratux
rm -r /root/go_path/* # safe space again..
make install
rm -r /root/.cache
rm -rf /root/.cache
##### Some device setup - copy files from image directory ####
cd /root/stratux/image
@ -159,7 +158,7 @@ cp -f rtl-sdr-blacklist.conf /etc/modprobe.d/
cp -f modules.txt /etc/modules
#boot settings
cp -f config.txt /boot/
cp -f config.txt /boot/firmware/
#Create default pi password as in old times, and disable initial user creation
systemctl disable userconfig
@ -173,7 +172,7 @@ touch /var/grow_root_part
mkdir -p /overlay/robase # prepare so we can bind-mount root even if overlay is disabled
# So we can import network settings if needed
touch /boot/.stratux-first-boot
touch /boot/firmware/.stratux-first-boot
#startup scripts
cp -f rc.local /etc/rc.local
@ -182,11 +181,15 @@ cp -f rc.local /etc/rc.local
echo -e "\n/dev/sda1 /var/log auto defaults,nofail,noatime,x-systemd.device-timeout=1ms 0 2" >> /etc/fstab
#disable serial console, disable rfkill state restore, enable wifi on boot
sed -i /boot/cmdline.txt -e "s/console=serial0,[0-9]\+ /systemd.restore_state=0 rfkill.default_state=1 /"
sed -i /boot/firmware/cmdline.txt -e "s/console=serial0,[0-9]\+ /systemd.restore_state=0 rfkill.default_state=1 /"
sed -i 's/quiet//g' /boot/firmware/cmdline.txt
#Set the keyboard layout to US.
sed -i /etc/default/keyboard -e "/^XKBLAYOUT/s/\".*\"/\"us\"/"
# Legacy stratux.conf path so it can be found easily..
ln -s /boot/firmware/stratux.conf /boot/stratux.conf
# Set hostname
echo "stratux" > /etc/hostname
sed -i /etc/hosts -e "s/raspberrypi/stratux/g"
@ -198,12 +201,13 @@ rm -r /root/stratux
# Uninstall packages we don't need, clean up temp stuff
rm -rf /root/go /root/go_path /root/.cache
PATH=/root/fake:$PATH apt remove --purge --yes alsa-ucm-conf alsa-topology-conf bluez bluez-firmware cifs-utils cmake cmake-data \
v4l-utils rsync pigz pi-bluetooth cpp cpp-10 zlib1g-dev
PATH=/root/fake:$PATH apt autoremove --purge --yes alsa-ucm-conf alsa-topology-conf bluez bluez-firmware cifs-utils cmake cmake-data \
v4l-utils rsync pigz pi-bluetooth cpp zlib1g-dev network-manager apparmor autotools-dev automake autoconf build-essential gcc-12 \
git mkvtoolnix gdb
PATH=/root/fake:$PATH apt autoremove --purge --yes
apt clean
rm -rf /var/cache/apt
rm -r /root/fake

Wyświetl plik

@ -19,32 +19,32 @@
modify_boot_cmdline()
{
if [ ! -e /boot/cmdline.txt ] ; then
if [ ! -e /boot/firmware/cmdline.txt ] ; then
umount_boot=yes
mount /boot || exit 1
mount /boot/firmware || exit 1
fi
if [ ! -e /boot/cmdline.txt ] ; then
echo "/boot/cmdline.txt missing"
if [ ! -e /boot/firmware/cmdline.txt ] ; then
echo "/boot/firmware/cmdline.txt missing"
exit 1
fi
if [ ! -w /boot ] ; then
if [ ! -w /boot/firmware ] ; then
remount_boot_ro=yes
mount -o remount,rw /boot || exit 1
mount -o remount,rw /boot/firmware || exit 1
fi
if ! grep -q '/sbin/init-overlay' /boot/cmdline.txt ; then
cp /boot/cmdline.txt /boot/cmdline.bak
if ! grep -q '/sbin/init-overlay' /boot/firmware/cmdline.txt ; then
cp /boot/firmware/cmdline.txt /boot/firmware/cmdline.bak
fi
rm -f /boot/cmdline.new
rm -f /boot/firmware/cmdline.new
sed -e 's/\( \|^\)\(ro\|rw\)\( \|$\)/ /g' \
-e 's/\( \|^\)\(init=[^ ]*\)\( \|$\)/ /g' \
-e 's/^ //' -e 's/ $//' /boot/cmdline.txt \
-e 's/^ //' -e 's/ $//' /boot/firmware/cmdline.txt \
-e 's#^\(.*root=.*\)$#\1'"$1"'#'\
>/boot/cmdline.new
mv /boot/cmdline.new /boot/cmdline.txt
>/boot/firmware/cmdline.new
mv /boot/firmware/cmdline.new /boot/firmware/cmdline.txt
if [ -n "$umount_boot" ] ; then
umount /boot
umount /boot/firmware
elif [ -n "$remount_boot_ro" ] ; then
mount -o remount,ro /boot
mount -o remount,ro /boot/firmware
fi
}

Wyświetl plik

@ -111,7 +111,7 @@ func computeRelativeVertical(ti TrafficInfo) (relativeVertical int32) {
func gdl90EmitterCatToNMEA(emitterCat uint8) string {
acType := "0"
switch emitterCat {
case 1, 6: acType = "8" // light/"highly maneuverable > 56" = piston
case 1, 6: acType = "8" // light/"highly maneuverable > 5g" = piston
case 2, 3, 4, 5: acType = "9" // small/large/heavy = jet
case 7: acType = "3" // helicopter = helicopter
case 9: acType = "1" // glider = glider

Wyświetl plik

@ -47,7 +47,6 @@ var dataLogFilef string // Set according to OS config.
const (
STRATUX_HOME = "/opt/stratux/"
configLocation = "/boot/stratux.conf"
managementAddr = ":80"
logDir = "/var/log/"
dataLogFile = "stratux.sqlite"
@ -120,6 +119,8 @@ const (
)
var STRATUX_WWW_DIR = STRATUX_HOME + "www/"
var configLocation = "/boot/firmware/stratux.conf"
var maxSignalStrength int
var stratuxBuild string
@ -1626,6 +1627,7 @@ func main() {
ex = filepath.Dir(ex)
STRATUX_WWW_DIR = ex + "/web/"
}
configLocation = os.Getenv("HOME") + "/.stratux.conf"
}
// Set up mySituation, do it here so logging JSON doesn't panic

Wyświetl plik

@ -213,7 +213,7 @@ func logChipConfig(line1 string, chip string, device string, baudrate int, appen
if line1 == "auto" {
logInf("Gps - autodected gps, using following parameters:")
} else if line1 == "man" {
logInf("GPS - manual configuration with following parameters from /boot/stratux.conf:")
logInf("GPS - manual configuration with following parameters from /boot/firmware/stratux.conf:")
}
msg := "GPS - chip: %s, device: %s, baudrate: %d"
if(append != "") { msg += ", " + append}
@ -235,7 +235,7 @@ func initGPSSerial() bool {
if globalSettings.GpsManualConfig {
//logInf("GPS - manual configuration with parameters from /boot/stratux.conf:")
//logInf("GPS - manual configuration with parameters from /boot/firmware/stratux.conf:")
var chip string = globalSettings.GpsManualChip
device = globalSettings.GpsManualDevice
@ -316,7 +316,7 @@ func initGPSSerial() bool {
baudrates = []int{115200, 38400, 9600}
logInf("GPS - device detected at serial port /dev/ttyAMA0, assuming this is an ublox device, configuring as generic ublox:")
logChipConfig("", "generic ublox", device, targetBaudRate, "")
logInf("GPS - consider to configure this device manually in /boot/stratux.conf for optimal performance")
logInf("GPS - consider to configure this device manually in /boot/firmware/stratux.conf for optimal performance")
} else {
logDbg("GPS - no gps device found.\n")
return false

Plik binarny nie jest wyświetlany.

Wyświetl plik

@ -27,13 +27,13 @@ chmod 644 /lib/systemd/system/stratux.service
ln -fs /lib/systemd/system/stratux.service /etc/systemd/system/multi-user.target.wants/stratux.service
#boot config
cp -f config.txt /boot/config.txt
cp -f config.txt /boot/firmware/config.txt
#rc.local
cp -f rc.local /etc/
#disable serial console
sed -i /boot/cmdline.txt -e "s/console=ttyAMA0,[0-9]\+ //"
sed -i /boot/firmware/cmdline.txt -e "s/console=ttyAMA0,[0-9]\+ //"
#modprobe.d blacklist
cp -f rtl-sdr-blacklist.conf /etc/modprobe.d/
@ -64,24 +64,19 @@ systemctl disable apt-daily.timer
systemctl disable apt-daily-upgrade.timer
# cleanup after switch to overlayfs: remove tmpfs lines from fstab, move stratux.conf to /boot and potentially enable the overlay depending on user settings
cat /etc/fstab | grep -v tmpfs > /tmp/fstab
mv /tmp/fstab /etc/fstab
mv /etc/stratux.conf /boot/stratux.conf
# Rewrite network settings to make sure the format is up to date for next boot
/opt/stratux/bin/gen_gdl90 -write-network-config
# Add optional usb stick mount if it's not already there
if [ "$(grep /dev/sda1 /etc/fstab)" == "" ]; then
if [ "$(grep /dev/sda1 /etc/fstab)" = "" ]; then
echo -e "\n/dev/sda1 /var/log auto defaults,nofail,noatime,x-systemd.device-timeout=1ms 0 2" >> /etc/fstab
fi
cd /
rm -rf /root/stratux-update
# re-enable overlay if it is configured. TODO: switch to jq for json parsing in the future once it's available in all installations
if [ "$(cat /boot/stratux.conf | grep 'PersistentLogging.:\s*true')" != "" ]; then
# re-enable overlay if it is configured.
if [ "$(jq -r .PersistentLogging /boot/firmware/stratux.conf)" = "true" ]; then
/sbin/overlayctl disable
else
/sbin/overlayctl enable