etat-systeme.sh

Arduino Portenta X8 · File : etat-systeme.sh · Language : Bash · Use case : Prendre le pouls du Linux de la carte en un coup d'oeil

The full check-up in 30 seconds: kernel, distribution, load, memory, storage and SoC temperature. The first reflex over SSH on the Portenta X8 to confirm the Linux image runs in good conditions.

Hardware

An Arduino Portenta X8 (ST STM32MP1 module: quad Cortex-A7 Linux + dual Cortex-M4 real-time core, 8 GB eMMC, 2 GB LPDDR4, on-board Wi-Fi/BT, optional LTE). None; SSH access or a serial console on the board.

Wiring

Nothing to wire. Recommended access: SSH over USB-C (routed) or network.

How it works

The script stacks standard Linux kernel sysfs/procfs reads; everything is read-only, no risk to the system.

Running it

Linux side: SSH access (routed USB-C or network) on the Portenta Linux image, bash/Python scripts. Real-time side: Arduino IDE with the « Arduino Mbed OS Portenta X8 Boards » core, application M7 core, flashing via mboot from Linux.

Variants

Run it hourly in cron to a file for history, or cross it with the real-time Arduino core.

etat-systeme.sh

#!/bin/bash
# Etat general du Linux embarque : noyau, charge, memoire, stockage.
# Aucune dependance.

echo "== Systeme =="
uname -a
cat /etc/os-release 2>/dev/null | head -3

echo
echo "== Charge et uptime =="
uptime

echo
echo "== Memoire (Mo) =="
free -m | head -3

echo
echo "== Stockage =="
df -h / /home 2>/dev/null | awk 'NR==1 || !seen[$0]++'

echo
echo "== Coeurs =="
nproc
grep -m1 CPU /proc/cpuinfo 2>/dev/null || true

echo
echo "== Temperature (si capteur) =="
for z in /sys/class/thermal/thermal_zone*/temp; do
  [ -r "$z" ] && echo "$z : $(( $(cat "$z") / 1000 )) C"
done

← Back to the board