Configure your PlutoSDR to execute custom scripts or programs automatically on boot — no firmware recompilation required. A one‑time setup for truly headless, standalone operation.
The Problem: Manual Execution After Every Boot
Using the Linaro toolchain, you can cross‑compile programs for the PlutoSDR's ARM core from an Ubuntu host. However, each run still requires:
- Cross‑compiling on the host
- Transferring the binary via
scpto the PlutoSDR - SSH into the PlutoSDR's Linux system
- Manually executing the program
This is only a semi‑standalone workflow — not very elegant for embedded applications.
The Solution: init.d Autorun Hook
According to official firmware issue #74, starting from firmware version v0.36, PlutoSDR includes a built‑in autorun script capability. The file /etc/init.d/S98autorun contains:
#!/bin/sh
#
# Script to check for and run user-supplied /mnt/jffs2/autorun.sh
#
case "$1" in
start)
if test -f /mnt/jffs2/autorun.sh; then
source /mnt/jffs2/autorun.sh
fi
;;
stop)
;;
restart|reload)
;;
*)
echo "Usage: $0 {start|stop|restart}"
exit 1
esac
exit $?
On every boot, this script checks for the existence of /mnt/jffs2/autorun.sh. If present, it executes it. In other words, anything you place in /mnt/jffs2/autorun.sh will run automatically each time the PlutoSDR powers on.
Quick Test: Creating an Autorun Script
Let's verify the mechanism. First, check the current contents of /root (initially empty):
$ pwd
/root
$ ls
Now create the autorun script:
vi /mnt/jffs2/autorun.sh
Add the following content (creates two empty files in /root):
touch /root/foobar
touch /root/123
Save and exit (:wq in vi).
Power‑cycle the PlutoSDR (unplug and reconnect power). After boot, SSH back in and verify:
$ pwd
/root
$ ls
123 foobar
The autorun script executed successfully on boot!
Persistent Storage for Your Programs
One remaining challenge: the PlutoSDR's Linux system reverts most file changes after reboot. Files created in /root or other directories disappear. How can you store your compiled binary persistently?
/mnt/jffs2 directory uses a jffs2 (Journaling Flash File System) that does persist across reboots. Place your compiled executables here, and they will survive power cycles.Workflow for a fully standalone application:
- Cross‑compile your program on the host machine using the Linaro toolchain
-
scpthe binary to/mnt/jffs2/on the PlutoSDR - Create
/mnt/jffs2/autorun.shthat executes your binary (with full path) - Make the script executable:
chmod +x /mnt/jffs2/autorun.sh - Power‑cycle — your program now runs automatically on every boot
/mnt/jffs2. Everything placed there will persist across reboots.Example: Auto‑Running a Custom SDR Application
Suppose you've cross‑compiled a program called my_sdr_app. The setup would look like:
# Copy binary to persistent storage
scp my_sdr_app root@192.168.2.1:/mnt/jffs2/
# Create autorun script
ssh root@192.168.2.1
echo '#!/bin/sh' > /mnt/jffs2/autorun.sh
echo '/mnt/jffs2/my_sdr_app' >> /mnt/jffs2/autorun.sh
chmod +x /mnt/jffs2/autorun.sh
# Reboot to test
reboot
After reboot, my_sdr_app will execute automatically — no host computer needed.
Important Notes
- This method works on PlutoSDR firmware v0.36 and later. Check your version with
cat /etc/issue. - The autorun script runs as root, so you have full system access.
- If your program runs continuously (e.g., a server or data logger), consider adding an ampersand (
&) to background it, or use a process manager. - To stop automatic execution, simply delete or rename
/mnt/jffs2/autorun.sh.
Troubleshooting
-
Script not executing? Verify the file is at the exact path
/mnt/jffs2/autorun.shand has execute permissions (chmod +x). -
Binary not found? Use absolute paths in your script (e.g.,
/mnt/jffs2/my_appinstead of./my_app). -
Want to see boot logs? Connect via serial console or check
/var/log/messagesafter boot.
Hardware Support
This technique applies to the PlutoSDR platform. For a ready‑to‑use PlutoSDR with full frequency support (70MHz–6GHz) and Gigabit Ethernet: