Remote Server Ssh Control
npx machina-cli add skill Jiusi-pys/agent-plugins/remote-server-ssh-control --openclaw---
name: remote-openharmony-build
description: Control remote servers exclusively for OpenHarmony image compilation. Use ONLY when building OpenHarmony system images. Requires syncing local code changes to remote before compilation. Supports multiple build servers.
---
# Remote OpenHarmony Image Compilation
## Server Configuration
| Host | Remote HOME | OpenHarmony Source |
|------|-------------|-------------------|
| cp | /kh_data/pengys | /kh_data/pengys |
Add more servers to this table as needed. OpenHarmony source path may differ from HOME.
## Usage Restriction
Remote servers are **ONLY** for OpenHarmony image compilation. Do NOT use for other compilation tasks.
## Parameters
- `<HOST>`: SSH config host name
- `<REMOTE_HOME>`: Remote home directory
- `<OH_SOURCE>`: OpenHarmony source path on remote
- `<product>`: Product name (e.g., rk3568)
- `<target>`: Build target component
## Workflow
### Step 1: Sync Local Changes to Remote
```bash
# Single file
scp <local_path> <HOST>:<OH_SOURCE>/<corresponding_path>
# Directory
scp -r <local_dir> <HOST>:<OH_SOURCE>/<corresponding_path>
# Rsync (recommended for incremental sync)
rsync -avz --progress <local_path> <HOST>:<OH_SOURCE>/<corresponding_path>
Step 2: Compile Image
ssh <HOST> 'cd <OH_SOURCE> && ./build.sh --product-name <product> --ccache'
Step 3: Retrieve Build Artifacts (Optional)
scp <HOST>:<OH_SOURCE>/out/<product>/packages/phone/images/<image_file> <local_dest>
Build Commands
Full build:
ssh <HOST> 'cd <OH_SOURCE> && ./build.sh --product-name <product> --ccache'
Build specific component:
ssh <HOST> 'cd <OH_SOURCE> && ./build.sh --product-name <product> --build-target <target> --ccache'
Clean build:
ssh <HOST> 'cd <OH_SOURCE> && ./build.sh --product-name <product> --ccache --clean'
Utility Commands
Check build output:
ssh <HOST> 'ls -la <OH_SOURCE>/out/<product>/packages/phone/images/'
Monitor build:
ssh <HOST> 'ps aux | grep build'
View build log:
ssh <HOST> 'tail -f <OH_SOURCE>/out/<product>/build.log'
Kill build:
ssh <HOST> 'pkill -f build.sh'
Check disk:
ssh <HOST> 'df -h <REMOTE_HOME>'
Source
git clone https://github.com/Jiusi-pys/agent-plugins/blob/main/plugins/ohos-porting/skills/remote-server-ssh-control/SKILL.mdView on GitHub Overview
This skill enables controlling remote servers exclusively for OpenHarmony image compilation. It requires syncing local changes to the remote OH_SOURCE before building and supports multiple build servers for distributed workloads. Use a repeatable, SSH-based workflow from local edits to remote builds and optional artifact retrieval.
How This Skill Works
Configure remote hosts with HOST, REMOTE_HOME, and OH_SOURCE. Sync local edits to the remote OH_SOURCE using scp or rsync, then SSH into the host to run the build script (e.g., ./build.sh --product-name <product> [--build-target <target>] --ccache). Optionally retrieve artifacts back to local with scp. The workflow is designed specifically for OpenHarmony image compilation.
When to Use It
- You need to compile OpenHarmony system images on remote servers rather than your local machine.
- You have multiple build servers and want to distribute the OpenHarmony image builds.
- You want incremental syncing of changes to remote OH_SOURCE using rsync for speed.
- You need to run full or targeted builds with a specified product and optional target on remote hosts.
- You want to retrieve built artifacts back to your local environment after the remote build.
Quick Start
- Step 1: Sync Local Changes to Remote
- Step 2: Compile Image
- Step 3: Retrieve Build Artifacts (Optional)
Best Practices
- Use rsync for incremental syncing of local changes to the remote OH_SOURCE.
- Verify that OH_SOURCE paths on the remote server match the expected OpenHarmony source layout.
- Enable --ccache in build commands to speed up repeated builds.
- Keep SSH host configurations secure and up-to-date; use distinct hosts for different servers.
- Limit the remote servers to OpenHarmony image builds and avoid using them for unrelated compilation tasks.
Example Use Cases
- rsync -avz --progress <local_path> <HOST>:<OH_SOURCE>/<corresponding_path>
- ssh <HOST> 'cd <OH_SOURCE> && ./build.sh --product-name <product> --ccache'
- ssh <HOST> 'cd <OH_SOURCE> && ./build.sh --product-name <product> --build-target <target> --ccache'
- scp <HOST>:<OH_SOURCE>/out/<product>/packages/phone/images/<image_file> <local_dest>
- ssh <HOST> 'ls -la <OH_SOURCE>/out/<product>/packages/phone/images/'