qemu-for-kernel-development — Claude Code skill: how to install
Guides agents in booting custom Linux kernels and testing drivers inside QEMU. Useful for rapid module development, Buildroot rootfs integration, and GDB debugging.
npx skills add mohitmishra786/low-level-dev-skills --skill qemu-for-kernel-development -a claude-codeWhat qemu-for-kernel-development does
This skill guides coding agents through testing custom Linux kernels and out-of-tree drivers inside QEMU. It provides command-line recipes for arm64 virt machines and x86_64 targets. You get configurations for direct kernel booting, virtio storage, and Buildroot rootfs generation.
For driver iterations, it covers host cross-compilation and 9p directory sharing with virtio-9p-pci. The instructions explain how to attach a remote GDB session on port 1234 using -s -S flags or pass custom Device Tree blobs via -dtb.
Without -enable-kvm on x86 hosts, TCG software emulation runs noticeably slower. Kernel modules trigger vermagic errors if built against a tree different from the booted image.
What it helps with
- boot a custom arm64 or x86_64 Linux kernel in QEMU
- attach a remote GDB session to the kernel via port 1234
- share host directories with the guest using virtio-9p
- build a minimal test rootfs with Buildroot
- fix vermagic mismatches when inserting kernel modules
Example prompts for the agent
- /qemu-for-kernel-development Boot arm64 virt with custom Image and virtio rootfs for driver CI
- /qemu-for-kernel-development configure a 9p shared folder to test my kernel module in QEMU
- /qemu-for-kernel-development how do I start QEMU with a GDB stub and break at start_kernel?
How to install qemu-for-kernel-development
1Skills CLI (Vercel)
npx skills add mohitmishra786/low-level-dev-skills --skill qemu-for-kernel-development -a claude-code2Manually: put the files in place
~/.claude/skills/qemu-for-kernel-development/SKILL.mdCopy the whole skill folder; for one project use .claude/skills/qemu-for-kernel-development/
1Skills CLI (Vercel)
npx skills add mohitmishra786/low-level-dev-skills --skill qemu-for-kernel-development -a codex2Manually: put the files in place
.agents/skills/qemu-for-kernel-development/SKILL.mdFor all projects use ~/.agents/skills/
1Skills CLI (Vercel)
npx skills add mohitmishra786/low-level-dev-skills --skill qemu-for-kernel-development -a cursor2Manually: put the files in place
.cursor/skills/qemu-for-kernel-development/SKILL.mdCursor also reads .agents/skills/ and .claude/skills/
1GitHub CLI
gh skill install mohitmishra786/low-level-dev-skills qemu-for-kernel-development2Manually: put the files in place
.github/skills/qemu-for-kernel-development/SKILL.md1Skills CLI (Vercel)
npx skills add mohitmishra786/low-level-dev-skills --skill qemu-for-kernel-development -a gemini-cli2Platform CLI
gemini skills install https://github.com/mohitmishra786/low-level-dev-skills --path skills/kernel-dev/qemu-for-kernel-developmentManually: put the files in place
.devin/skills/qemu-for-kernel-development/SKILL.mdThe legacy .windsurf/skills/ path still works
Skills CLI (Vercel)
npx skills add mohitmishra786/low-level-dev-skills --skill qemu-for-kernel-development -a opencodeClaude.ai
Zip the folder and upload it in Settings → Capabilities → Skills
Step by step, with commands for each platform: How to install skills in Claude Code: five ways
Questions about qemu-for-kernel-development
How do I install qemu-for-kernel-development in Claude Code?
Run npx skills add mohitmishra786/low-level-dev-skills --skill qemu-for-kernel-development -a claude-code in your terminal. The skill file is placed in ~/.claude/skills/qemu-for-kernel-development/SKILL.md.
What is qemu-for-kernel-development used for?
It guides developers through testing custom Linux kernels and drivers inside QEMU without physical hardware. The skill provides launch parameters for arm64 and x86_64 architectures, rootfs setup instructions, and debugging workflows.
Why does the kernel trigger a panic with a no root error?
This typically happens when the root= parameter on the kernel command line is incorrect. When using virtio-blk storage, specify root=/dev/vda rw.
Source text
SKILL.md · MIT
--- name: qemu-for-kernel-development description: QEMU kernel development skill for driver and kernel testing. Use when booting custom kernels in QEMU, Buildroot/Yocto rootfs, virtio devices, or NFS root for driver iteration. Activates on queries about QEMU kernel dev, Buildroot QEMU, virtio block, kernel module test QEMU, or -append root= --- # QEMU for Kernel Development ## Purpose Guide agents through QEMU-based kernel and driver development workflows: building/booting custom kernels, attaching virtio block/network, using Buildroot or minimal initramfs, and rapid module test cycles — focused on kernel dev vs general `skills/virtualization/qemu-kvm`. ## When to Use - Test kernel patch without bare metal - Develop driver against virtio or emulated DT platform - CI kernel boot smoke test - NFS or 9p root for fast edit-compile-test ## Workflow ### 1. Minimal direct kernel boot (arm64 virt) ```bash qemu-system-aarch64 \ -machine virt -cpu cortex-a57 -smp 4 -m 2G \ -kernel arch/arm64/boot/Image \ -append "console=ttyAMA0 root=/dev/vda rw" \ -drive if=virtio,file=rootfs.ext4,format=raw \ -netdev user,id=net0 -device virtio-net-device,netdev=net0 \ -nographic ``` x86_64: ```bash qemu-system-x86_64 -enable-kvm -m 4G -smp 4 \ -kernel arch/x86/boot/bzImage \ -append "console=ttyS0 root=/dev/vda rw" \ -drive file=rootfs.img,format=raw,if=virtio \ -nographic ``` ### 2. Buildroot rootfs loop ```bash cd buildroot make qemu_aarch64_virt_defconfig make # output/images/Image, rootfs.ext4 ``` Integrate custom kernel: set `BR2_LINUX_KERNEL_CUSTOM_VERSION` or external tree. ### 3. Out-of-tree module test ```bash # on host — cross build make -C $KERNEL_SRC M=$PWD modules # in guest or via initramfs insmod mydriver.ko dmesg | tail ``` Share tree with 9p: ```bash -fsdev local,id=dev,path=$PWD,security_model=none \ -device virtio-9p-pci,fsdev=dev,mount_tag=hostshare # guest: mount -t 9p -o trans=virtio hostshare /mnt ``` ### 4. GDB stub for kernel ```bash qemu-system-aarch64 ... -s -S gdb vmlinux (gdb) target remote :1234 (gdb) break start_kernel ``` Use `CONFIG_KGDB` for live kernel debugging after boot. ### 5. Device tree overrides ```bash qemu-system-aarch64 -machine virt -dtb myboard.dtb ... ``` virt machine provides virtio devices; platform drivers can target QEMU `-device` models. ### 6. Agent usage ``` /qemu-for-kernel-development Boot arm64 virt with custom Image and virtio rootfs for driver CI ``` ## Common Problems | Symptom | Cause | Fix | |---------|-------|-----| | Kernel panic no root | Wrong `root=` | `root=/dev/vda` for virtio blk | | No console output | Missing `console=` on cmdline | `console=ttyAMA0` / `ttyS0` | | Module vermagic error | Built against wrong tree | Same `KERNEL_SRC` as booted image | | Slow without KVM | TCG emulation | `-enable-kvm` on x86 host | | DTB mismatch | Wrong machine | Use `virt` DTB from kernel `make dtbs` | ## Related Skills - `skills/virtualization/qemu-kvm` — KVM, VFIO, libvirt - `skills/qemu/qemu-embedded-simulation` — bare-metal MCU QEMU - `skills/kernel/kernel-testing` — KUnit, kselftest - `skills/kernel-dev/device-tree` — DT for virt/platform - `skills/debuggers/gdb` — remote GDB basics
© mohitmishra786 · MIT · mohitmishra786/low-level-dev-skills