This provides basic instructions for building QEMU.

Tested-by: Chao Liu <[email protected]>
Signed-off-by: Alex Bennée <[email protected]>

---
caveman
  - cavemanned
v3
  - add builds to gitignore
v2
  - drop ECA/qemu-helper-agent sub-agent language
  - mention configure --help
  - drop mention of full paths - not needed for compilation
  - moved earlier is series so code-reviewer can refer to it
---
 .agents/skills/qemu-build/SKILL.md | 49 ++++++++++++++++++++++++++++++
 .gitignore                         |  1 +
 AGENTS.md                          |  1 +
 3 files changed, 51 insertions(+)
 create mode 100644 .agents/skills/qemu-build/SKILL.md

diff --git a/.agents/skills/qemu-build/SKILL.md 
b/.agents/skills/qemu-build/SKILL.md
new file mode 100644
index 00000000000..a19010d70c2
--- /dev/null
+++ b/.agents/skills/qemu-build/SKILL.md
@@ -0,0 +1,49 @@
+---
+name: qemu-build
+description: Step-by-step configure and build QEMU. Trigger when user asks 
build QEMU or debug build failures. Includes build dir reuse and spawning 
sub-agents.
+license: GPL-2.0-or-later
+---
+
+# Instructions
+
+## Check and Reuse Build Dirs
+Check if existing build dir reusable before new one. QEMU uses out-of-tree 
builds (often `build` or `builds/`).
+
+1. **Check configs**: Read `config.log` in existing build dir. Run `head -n 2 
builds/<dir>/config.log` to get full configure command.
+2. **Reuse and Reconfigure**: Reuse general-purpose dirs (like 
`builds/debug`). Reconfigure same flags with new `--target-list` if needed:
+   ```bash
+   cd builds/debug
+   ../../configure <old-flags> --target-list=<new-targets>
+   ```
+
+## Launch Builds via Sub-Agent
+**CRITICAL**: NEVER build in main agent context. ALWAYS spawn sub-agent.
+Pass exact build commands and directory in sub-agent `task` argument. Instruct 
sub-agent what to verify and report.
+Example: `task: "Go to builds/debug, run ninja. If fail, report exact compiler 
errors."`
+
+## Configure New Build
+If no good dir exists, make new.
+
+1. **Make dir**: `mkdir -p builds/test-target; cd builds/test-target`
+2. **Configure**: `../../configure --target-list=[targets]`
+   - Targets: `x86_64-softmmu`, `aarch64-softmmu`, `riscv64-softmmu`, 
`x86_64-linux-user`.
+3. **Common flags**:
+   - `--enable-debug-info`: Symbols.
+   - `--enable-debug`: Assertions.
+4. **Sanitizers**:
+   - `--enable-asan`: Address Sanitizer.
+   - `--enable-tsan`: Thread Sanitizer.
+   - `--enable-ubsan`: Undefined Behavior Sanitizer.
+5. **Help**:
+   - `--help`: All options.
+
+## Build
+**Important**: Re-build after modifying source code.
+
+## Report Results
+**CRITICAL**: Provide concise build summary to user.
+1. **Summary**: Success or failure.
+2. **Failures**: Include exact compiler/linker error log excerpt if fail.
+
+## Debug
+- **Verbose**: `V=1` for full output.
diff --git a/.gitignore b/.gitignore
index 4ccba871d16..83bdf3df59c 100644
--- a/.gitignore
+++ b/.gitignore
@@ -1,5 +1,6 @@
 /GNUmakefile
 /build/
+/builds/
 /.cache/
 /.vscode/
 *.pyc
diff --git a/AGENTS.md b/AGENTS.md
index c751652babf..207a0075ed8 100644
--- a/AGENTS.md
+++ b/AGENTS.md
@@ -47,6 +47,7 @@ If unsure read the linked `security.rst` document for further 
guidance.
 ## Agent Skills (see `.agents/skills`)
 You should use the following specialized skills for common tasks:
 - `qemu-code-explorer`: For finding where things are defined, how they're 
used, or understanding a specific subsystem.
+- `qemu-build`: For configuring and building QEMU (including debug and 
sanitizer builds).
 
 ## Source Code Layout (see `docs/devel/codebase.rst`)
 - **`accel/`**: Hardware accelerators (KVM, TCG, HVF, Xen, etc.) and 
architecture-agnostic acceleration code.
-- 
2.47.3


Reply via email to