Deploying a Python application on an RK3588 Buildroot system by hand is tedious and error-prone: files must be uploaded one by one via adb, dependencies installed, and an init.d autostart script configured. I therefore developed a one-click deployment toolkit that supports PowerShell and Git Bash and completes the entire workflow, from upload to autostart configuration, with a single command. The project is open-sourced on GitHub: Yu-Xiang-Yang/deploy.
1 Background and Problems
The RK3588 is a high-performance edge-computing chip. Running Python applications on its Buildroot system typically involves the following problems:
- No network access on the device:
pip installcannot be used directly, so dependencies must be installed offline - Tedious deployment steps: every code update requires a manual adb push and a service restart
- Complex autostart configuration: an init.d script must be written by hand and its permissions set
This project automates these steps so that they are completed with a single command.
2 Project Structure
├── deploy.sh # One-click deployment script (Git Bash)
├── deploy.ps1 # One-click deployment script (PowerShell)
├── download_packages.sh # Automatic download of offline dependencies (Git Bash)
├── download_packages.ps1 # Automatic download of offline dependencies (PowerShell)
├── S99rk3588app # init.d autostart service script
└── app/
├── main.py # Application entry point (replace with the actual application)
├── requirements.txt # Python dependency list (optional)
└── packages/ # Offline .whl dependency packages (downloaded automatically)
3 Prerequisites
- The RK3588 device is connected via USB and is recognised by
adb devices - Python3 is installed on the device (
/usr/bin/python3) - The host environment is Windows (PowerShell / Git Bash) or Linux/macOS
4 Quick Start
4.1 Cloning the Project
git clone https://github.com/Yu-Xiang-Yang/deploy.git
cd deploy
4.2 Adding the Application
Place the Python program in the app/ directory and name the entry file main.py.
Example app/main.py:
import time
while True:
print("test", flush=True)
time.sleep(10)
Note:
flush=True; otherwise the log is not written in real time when the program runs in the background.
4.3 One-Click Deployment
PowerShell (recommended):
.\deploy.ps1
If a script execution policy restriction is reported, run the following once first:
Set-ExecutionPolicy -Scope CurrentUser RemoteSigned
Git Bash:
bash deploy.sh
The script automatically performs the following steps:
- Checks the ADB connection
- Stops the old service
- Uploads all files under
app/to/data/rk3588app/on the device - Installs offline dependency packages (if
.whlfiles exist underapp/packages/) - Installs the autostart script to
/etc/init.d/S99rk3588app - Starts the service and verifies it
4.4 Verifying the Deployment
# Check the service status
adb shell /etc/init.d/S99rk3588app status
# View the log
adb shell cat /data/rk3588app/app.log
5 Offline Installation of Python Dependencies
RK3588 devices usually have no network access, so .whl files must be downloaded on a computer in advance.
5.1 Automatic Download (Recommended)
Create requirements.txt under app/ and list the dependencies:
requests
numpy==1.26.4
Run the download script, which automatically downloads the .whl files matching the RK3588 architecture (aarch64 + Python 3.10):
PowerShell:
.\download_packages.ps1
Git Bash:
bash download_packages.sh
After the download completes, run the deployment script; the dependencies are then uploaded to and installed on the device automatically.
5.2 Manual Download
The .whl files can also be downloaded manually and placed in app/packages/:
pip download <package_name> --platform linux_aarch64 --python-version 310 --only-binary=:all: -d app/packages/
If
pip downloadcannot find a package for the target platform, the.whlfile forcp310-linux_aarch64can be downloaded manually from PyPI.
5.3 Version Compatibility Issues
Some older package versions may not provide aarch64 prebuilt files, in which case the download reports an error:
ERROR: No matching distribution found for psutil==5.8.0
Solution: change == to >= in requirements.txt to allow a newer compatible version to be downloaded:
psutil>=5.8.0
In general, pure-Python packages (such as pyserial and six) are not platform-restricted, whereas packages with C extensions (such as numpy and psutil) require checking whether the given version provides aarch64 prebuilt files.
6 Common Commands
| Operation | Command |
|---|---|
| Start the service | adb shell /etc/init.d/S99rk3588app start |
| Stop the service | adb shell /etc/init.d/S99rk3588app stop |
| Restart the service | adb shell /etc/init.d/S99rk3588app restart |
| Check the status | adb shell /etc/init.d/S99rk3588app status |
| View the log | adb shell cat /data/rk3588app/app.log |
| Clear the log | adb shell "> /data/rk3588app/app.log" |
7 Custom Configuration
To change the deployment path or service name, edit the variables at the top of deploy.sh (or deploy.ps1):
REMOTE_APP_DIR="/data/rk3588app" # Application directory on the device
SERVICE_NAME="S99rk3588app" # Service script name (a larger number starts later)
The corresponding path in S99rk3588app must be changed accordingly.
8 Principle
The RK3588 Buildroot system manages boot-time services with init.d. Scripts under /etc/init.d/ whose names begin with S are executed in numerical order at system startup.
8.1 Core Logic of the Autostart Script
S99rk3588app uses start-stop-daemon to run the Python program as a background process and redirects stdout/stderr to a log file:
case "$1" in
start)
printf "Starting rk3588app: "
sleep 3
start-stop-daemon -S -b -m -p $PIDFILE \
--exec /bin/sh -- -c "exec $DAEMON $SCRIPT >> $LOGFILE 2>&1"
echo "OK"
;;
stop)
printf "Stopping rk3588app: "
start-stop-daemon -K -p $PIDFILE
rm -f $PIDFILE
echo "OK"
;;
esac
8.2 Startup Order
The number following S in the script name determines the startup order; smaller numbers are executed earlier:
S00mountall.sh → mount file systems
S10udev → device management
S40network → network
S50sshd → SSH service
S99rk3588app → user application (started last)
S99 ensures that the application starts only after system services such as networking and serial ports are ready. For an earlier start, the number can be reduced (e.g. S50rk3588app), but retaining S99 is generally recommended.
9 Project Repository
GitHub: https://github.com/Yu-Xiang-Yang/deploy
Stars and issues are welcome.