| name | openwrt-build-runner |
| description | Compile, rebuild, or diagnose failures in this OpenWrt repository. Trigger when asked to build firmware or a package (build, compile, make, 编译, 构建, 固件), view or analyze compile.log, retry a failed build, summarize the first meaningful compile error, or decide the narrowest clean/rebuild step after a failure. |
OpenWrt Build Runner
Use this skill as the default execution path for all OpenWrt builds in this repository. Prefer the bundled script over ad hoc make invocations so logs, retry behavior, and failure summaries stay consistent.
Workflow
- Confirm
Makefile, rules.mk, and .config exist in the repo root.
- Pre-build cleanup (full firmware builds only — skip for single-package rebuilds):
Run
skills/openwrt-target-switch-hygiene/scripts/target_switch.py --apply.
This takes seconds and removes stale tmp/ and bin/targets/<board>/<sub>/ before writing new image files.
- Choose the narrowest target that answers the request.
- Full firmware: run the script with no extra make arguments.
- Single package rebuild: pass targets such as
package/chinadns-ng/clean, package/chinadns-ng/compile, or package/OpenClash/luci-app-openclash/compile.
- Dry run or verbose inspection: pass make flags such as
-n or V=s.
- Run
scripts/run_build.sh. The script writes a log, executes a parallel build first, and retries once with -j1 V=s on failure.
- If the build fails, inspect the first compiler, linker, or packaging error instead of the trailing cascade. Read
references/troubleshooting.md when the failure pattern is ambiguous.
- Recommend the narrowest follow-up command that proves the fix. Only rerun the full build after the local failure is resolved.
Commands
skills/openwrt-target-switch-hygiene/scripts/target_switch.py --apply && \
skills/openwrt-build-runner/scripts/run_build.sh
skills/openwrt-build-runner/scripts/run_build.sh \
package/chinadns-ng/clean \
package/chinadns-ng/compile
skills/openwrt-build-runner/scripts/run_build.sh \
--log-file tmp/openclash.log \
package/OpenClash/luci-app-openclash/compile
Triage Rules
- For the convenience of future debugging, please write the log to a file in
tmp/ and show the filename in the output. Avoid dumping the full log to the console. So, the user can manually open the log file in an editor and search for the error pattern without scrolling through irrelevant lines.
- Prefer the first
error: or *** line emitted during the fallback -j1 V=s phase.
- Distinguish source download failures, toolchain failures, package compile failures, and image assembly failures before proposing a fix.
- If the failure involves custom feeds or local packages, use
openwrt-feed-package-sync before modifying package selections.
Output
Report:
- the exact build command that ran
- the log path
- whether fallback was required
- the first real failure and which package or stage produced it
- the next narrow rebuild or clean step