agentleFS
processmissionprocessmission/oh-my-qemu/skills/qemu-kernel-build/SKILL.md

qemu-kernel-build

Skill60 starsChanged 13 days agoMITView on GitHub

Use for building Linux kernels for QEMU boot testing, including defconfig selection, cross compile variables, Docker or host toolchains, Image, DTB, modules, initramfs inputs, output hashes, and provenance records.

We split this skill into the rules it gives an agent

2 rules. About 0 are common, 1 is distinctive, and 1 is very specific to this project.

  • ≈0

    Common · estimate

    Many files like this have a rule of this kind.

  • ≈1

    Distinctive · estimate

    This author's own choices. Worth a look.

  • 1

    Very specific

    Tied to their project's names, files or tools. Probably skip.

  • Common
  • Distinctive
  • Very specific
  1. Very specific:

    Use an absolute O= path; relative paths are resolved differently by recursive make.

    line 59
  2. Distinctive:

    If modules fail to load, compare running kernel release and module tree before changing QEMU or the driver.

    line 73

≈ “Common” is an estimate: at least 1 in 5 of the 308,232 skill files we read have a rule of the same kind, not the same words. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.

Keep what fits and drop the rest. Your version, ready for your agents.
Files
SKILL.md

QEMU Kernel Build

Audit workflow

For a non-trivial task that writes to the workspace, use only the needed entries under .oh-my-qemu/<task-slug>/: audit.md (baseline, plan, decisions, evidence, verification, and gaps), commands.md (redacted commands, working directories, and results), logs/ (decisive build, test, and runtime output), scripts/ (probes, parsers, and harnesses), and output/ (generated deliverables, third-party dependencies, and non-QEMU binaries). Keep QEMU's own build tree at source-root builds/build-<target>/, never an unqualified build/. In a Git worktree, add .agents/, .oh-my-qemu/, and builds/ to the file from git rev-parse --git-path info/exclude before writing artifacts or configuring QEMU; preserve existing entries and avoid duplicates. Never stage or commit these paths; stage source only when the user explicitly requests that separate action. At handoff, reconcile git status --short with the baseline and report the task directory, build directory, source changes, pre-existing changes, and unresolved gaps.

QEMU upstream boundary

QEMU's official GitLab and mailing lists are upstream channels. A patch becomes an upstream contribution when it is sent to the maintainers selected through MAINTAINERS. Do not prepare or send agent-generated code, documentation, commit messages, or patches for upstream submission; see the checked-out tree's docs/devel/code-provenance.rst. Research, debugging, analysis, local experiments, verification, and workflow guidance remain allowed. Local branches, commits, patch files, pushes, and pull requests are not by themselves upstream contributions; perform those Git actions only when requested.

Scope

Build Linux kernel artifacts consumed by QEMU. QEMU itself belongs to qemu-build and U-Boot to qemu-uboot-build. Keep kernel outputs under the task output/ directory.

Config provenance

Record kernel source revision and dirty state; architecture and defconfig; every config fragment and the resulting .config; exact commands; and a hash of .config. A merged config is not a plain defconfig: record the fragments and merge command. Copy assets/build-record-template.md into the task directory for every kernel build.

Build flow

Record cross compiler prefix, absolute compiler path and version; output directory and parallelism; DTB names and destinations; module install path; initramfs or rootfs inputs; and a hash of every artifact passed to QEMU or packed into an image. A typical shape, adapted to the tree's own documentation:

make ARCH=<arch> O=<abs-output>/linux-<arch> <defconfig>
make ARCH=<arch> O=<abs-output>/linux-<arch> CROSS_COMPILE=<prefix> -j<nproc> Image modules dtbs

Use an absolute O= path; relative paths are resolved differently by recursive make. If Docker is used, record image, mounts, user, working directory, and the command inside the container.

Initramfs

Build initramfs explicitly when the boot contract needs one: create a tree, copy required binaries and init, pack with cpio in newc format, compress only when the boot command expects compression, and hash the archive passed to QEMU. Initramfs and block rootfs are different contracts; record which one the run uses.

Modules and release check

  • Install modules into a task-local directory; check the kernel release in include/config/kernel.release against the installed /lib/modules/ directory name.
  • If modules fail to load, compare running kernel release and module tree before changing QEMU or the driver.
  • For an external module against a prepared kernel output, use KBUILD_MODPOST_WARN=1 when Module.symvers is absent and record the weakened symbol check; Image modules_prepare is enough when a full module set is not needed.

Common failures

SymptomCheck
dtc, flex, bison, or libssl missinghost build dependencies
Compiler or target mismatchCROSS_COMPILE, ARCH, compiler path and version
Output appears in the source treemissing or relative O=
Image rejected by QEMUcompressed vs uncompressed image expected by the machine
Module version mismatchkernel release vs module tree

Upstream references

  • docs/system/linuxboot.rst
  • docs/system/invocation.rst
  • docs/devel/testing/main.rst
  • docs/devel/code-provenance.rst

Paths can differ between QEMU versions; locate them in the checked-out tree.

Download now (ZIP)

Does it work?

Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.

Reviews can't be read right now.

Your trail

Files you open will collect here, so you can find them again.

Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.

Now do this for your own.

Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.