diff --git a/.github/workflows/build-deb.yml b/.github/workflows/build-deb.yml index a6205b7..ee1cf6a 100644 --- a/.github/workflows/build-deb.yml +++ b/.github/workflows/build-deb.yml @@ -116,12 +116,12 @@ jobs: cargo deb --package socktop --target ${{ matrix.target }} --no-strip - 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: | cargo deb --package socktop_agent --target ${{ matrix.target }} --no-strip - - name: Build socktop_agent .deb package (without GPU support for RISC-V) - if: matrix.target == 'riscv64gc-unknown-linux-gnu' + - name: Build socktop_agent .deb package (without GPU support for RISC-V and ARMv7) + if: matrix.target == 'riscv64gc-unknown-linux-gnu' || matrix.target == 'armv7-unknown-linux-gnueabihf' run: | cargo deb --package socktop_agent --target ${{ matrix.target }} --no-strip --no-default-features diff --git a/README.md b/README.md index c7db51a..d16a03b 100644 --- a/README.md +++ b/README.md @@ -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, you’ll 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 sudo apt-get update 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)_ --- diff --git a/docs/cross-compiling.md b/docs/cross-compiling.md index d0ce42d..f2e7cdf 100644 --- a/docs/cross-compiling.md +++ b/docs/cross-compiling.md @@ -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. +**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 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 # For 32-bit Raspberry Pi (armv7) +# Note: GPU support not available on armv7 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 @@ -65,9 +68,8 @@ sudo pacman -S aarch64-linux-gnu-gcc yay -S aarch64-linux-gnu-libdrm # For 32-bit Raspberry Pi (armv7) +# Note: GPU support not available on armv7 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 @@ -114,8 +116,8 @@ cd path/to/socktop # 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 -# For 32-bit Raspberry Pi -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 +# 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 --no-default-features ``` 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: ```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 -# For 32-bit Raspberry Pi -cargo build --release --target armv7-unknown-linux-gnueabihf -p socktop_agent +# For 32-bit Raspberry Pi (without GPU support) +cargo build --release --target armv7-unknown-linux-gnueabihf -p socktop_agent --no-default-features ``` ## Transfer the Binary to Your Raspberry Pi @@ -161,11 +163,12 @@ SSH into your Raspberry Pi and install the required dependencies: ```bash 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 install libdrm-dev libdrm-amdgpu1 -# For Arch Linux ARM +# For Arch Linux ARM - 64-bit only sudo pacman -Syu sudo pacman -S libdrm ```