feature gate GPU stats for arm v7

This commit is contained in:
jasonwitty 2025-11-21 15:23:44 -08:00
parent f9462a1633
commit 31c2b59fd4
3 changed files with 26 additions and 15 deletions

View File

@ -116,12 +116,12 @@ jobs:
cargo deb --package socktop --target ${{ matrix.target }} --no-strip cargo deb --package socktop --target ${{ matrix.target }} --no-strip
- name: Build socktop_agent .deb package (with GPU support) - name: Build socktop_agent .deb package (with GPU support)
if: matrix.target != 'riscv64gc-unknown-linux-gnu' if: matrix.target != 'riscv64gc-unknown-linux-gnu' && matrix.target != 'armv7-unknown-linux-gnueabihf'
run: | run: |
cargo deb --package socktop_agent --target ${{ matrix.target }} --no-strip cargo deb --package socktop_agent --target ${{ matrix.target }} --no-strip
- name: Build socktop_agent .deb package (without GPU support for RISC-V) - name: Build socktop_agent .deb package (without GPU support for RISC-V and ARMv7)
if: matrix.target == 'riscv64gc-unknown-linux-gnu' if: matrix.target == 'riscv64gc-unknown-linux-gnu' || matrix.target == 'armv7-unknown-linux-gnueabihf'
run: | run: |
cargo deb --package socktop_agent --target ${{ matrix.target }} --no-strip --no-default-features cargo deb --package socktop_agent --target ${{ matrix.target }} --no-strip --no-default-features

View File

@ -51,15 +51,23 @@ exec bash # or: exec zsh / exec fish
Windows (for the brave): install from https://rustup.rs with the MSVC toolchain. Yes, youll need Visual Studio Build Tools. You chose Windows — enjoy the ride. Windows (for the brave): install from https://rustup.rs with the MSVC toolchain. Yes, youll need Visual Studio Build Tools. You chose Windows — enjoy the ride.
### Raspberry Pi / Ubuntu / PopOS (required) ### Raspberry Pi / Ubuntu / PopOS (required for GPU support)
Install GPU support with apt command below **Note:** GPU monitoring is only supported on x86_64 and aarch64 (64-bit ARM) platforms. ARMv7 (32-bit) and RISC-V builds do not include GPU support.
For 64-bit systems with GPU support:
```bash ```bash
sudo apt-get update sudo apt-get update
sudo apt-get install libdrm-dev libdrm-amdgpu1 sudo apt-get install libdrm-dev libdrm-amdgpu1
``` ```
For ARMv7 (32-bit Raspberry Pi), build with `--no-default-features` to disable GPU support:
```bash
cargo build --release -p socktop_agent --no-default-features
```
_Additional note for Raspberry Pi users. Please update your system to use the newest kernel available through app, kernel version 6.6+ will use considerably less overall CPU to run the agent. For example on a rpi4 the kernel < 6.6 the agent will consume .8 cpu but on the same hardware on > 6.6 the agent will consume only .2 cpu. (these numbers indicate continuous polling at web socket endpoints, when not in use the usage is 0)_ _Additional note for Raspberry Pi users. Please update your system to use the newest kernel available through app, kernel version 6.6+ will use considerably less overall CPU to run the agent. For example on a rpi4 the kernel < 6.6 the agent will consume .8 cpu but on the same hardware on > 6.6 the agent will consume only .2 cpu. (these numbers indicate continuous polling at web socket endpoints, when not in use the usage is 0)_
--- ---

View File

@ -2,6 +2,8 @@
This guide explains how to cross-compile the socktop_agent on various host systems and deploy it to a Raspberry Pi. Cross-compiling is particularly useful for older or resource-constrained Pi models where native compilation might be slow. This guide explains how to cross-compile the socktop_agent on various host systems and deploy it to a Raspberry Pi. Cross-compiling is particularly useful for older or resource-constrained Pi models where native compilation might be slow.
**Note:** GPU monitoring support is not available on ARMv7 (32-bit) and RISC-V architectures due to library limitations. When building for these platforms, the `--no-default-features` flag must be used to disable GPU support.
## Cross-Compilation Host Setup ## Cross-Compilation Host Setup
Choose your host operating system: Choose your host operating system:
@ -23,8 +25,9 @@ sudo apt update
sudo apt install gcc-aarch64-linux-gnu libc6-dev-arm64-cross libdrm-dev:arm64 sudo apt install gcc-aarch64-linux-gnu libc6-dev-arm64-cross libdrm-dev:arm64
# For 32-bit Raspberry Pi (armv7) # For 32-bit Raspberry Pi (armv7)
# Note: GPU support not available on armv7
sudo apt update sudo apt update
sudo apt install gcc-arm-linux-gnueabihf libc6-dev-armhf-cross libdrm-dev:armhf sudo apt install gcc-arm-linux-gnueabihf libc6-dev-armhf-cross
``` ```
### Setup Rust Cross-Compilation Targets ### Setup Rust Cross-Compilation Targets
@ -65,9 +68,8 @@ sudo pacman -S aarch64-linux-gnu-gcc
yay -S aarch64-linux-gnu-libdrm yay -S aarch64-linux-gnu-libdrm
# For 32-bit Raspberry Pi (armv7) # For 32-bit Raspberry Pi (armv7)
# Note: GPU support not available on armv7
sudo pacman -S arm-linux-gnueabihf-gcc sudo pacman -S arm-linux-gnueabihf-gcc
# Install libdrm for armv7 using an AUR helper
yay -S arm-linux-gnueabihf-libdrm
``` ```
### Setup Rust Cross-Compilation Targets ### Setup Rust Cross-Compilation Targets
@ -114,8 +116,8 @@ cd path/to/socktop
# For 64-bit Raspberry Pi # For 64-bit Raspberry Pi
docker run --rm -it -v "$(pwd)":/home/rust/src messense/rust-musl-cross:aarch64-musl cargo build --release --target aarch64-unknown-linux-musl -p socktop_agent docker run --rm -it -v "$(pwd)":/home/rust/src messense/rust-musl-cross:aarch64-musl cargo build --release --target aarch64-unknown-linux-musl -p socktop_agent
# For 32-bit Raspberry Pi # For 32-bit Raspberry Pi (without GPU support)
docker run --rm -it -v "$(pwd)":/home/rust/src messense/rust-musl-cross:armv7-musleabihf cargo build --release --target armv7-unknown-linux-musleabihf -p socktop_agent docker run --rm -it -v "$(pwd)":/home/rust/src messense/rust-musl-cross:armv7-musleabihf cargo build --release --target armv7-unknown-linux-musleabihf -p socktop_agent --no-default-features
``` ```
The compiled binaries will be available in your local target directory. The compiled binaries will be available in your local target directory.
@ -133,11 +135,11 @@ The recommended approach for Windows is to use Windows Subsystem for Linux (WSL2
After setting up your environment, build the socktop_agent for your target Raspberry Pi: After setting up your environment, build the socktop_agent for your target Raspberry Pi:
```bash ```bash
# For 64-bit Raspberry Pi # For 64-bit Raspberry Pi (with GPU support)
cargo build --release --target aarch64-unknown-linux-gnu -p socktop_agent cargo build --release --target aarch64-unknown-linux-gnu -p socktop_agent
# For 32-bit Raspberry Pi # For 32-bit Raspberry Pi (without GPU support)
cargo build --release --target armv7-unknown-linux-gnueabihf -p socktop_agent cargo build --release --target armv7-unknown-linux-gnueabihf -p socktop_agent --no-default-features
``` ```
## Transfer the Binary to Your Raspberry Pi ## Transfer the Binary to Your Raspberry Pi
@ -161,11 +163,12 @@ SSH into your Raspberry Pi and install the required dependencies:
```bash ```bash
ssh pi@raspberry-pi-ip ssh pi@raspberry-pi-ip
# For Raspberry Pi OS (Debian-based) # For Raspberry Pi OS (Debian-based) - 64-bit only
# (32-bit armv7 builds don't require these)
sudo apt update sudo apt update
sudo apt install libdrm-dev libdrm-amdgpu1 sudo apt install libdrm-dev libdrm-amdgpu1
# For Arch Linux ARM # For Arch Linux ARM - 64-bit only
sudo pacman -Syu sudo pacman -Syu
sudo pacman -S libdrm sudo pacman -S libdrm
``` ```