Skip to content

Add QEMU-based devtools#373

Merged
jserv merged 1 commit into
masterfrom
devtools
Apr 24, 2026
Merged

Add QEMU-based devtools#373
jserv merged 1 commit into
masterfrom
devtools

Conversation

@jserv
Copy link
Copy Markdown
Contributor

@jserv jserv commented Apr 24, 2026

Kernel module development previously required a bare Linux machine or manual VM setup. This adds self-contained devtools/ directory that boots a minimal QEMU guest with the project tree shared via 9p virtfs, so modules built on the host are instantly visible inside the guest.


Summary by cubic

Adds a self-contained devtools/ to boot a minimal QEMU guest with the repo shared via 9p for fast, isolated module testing. Also adds prebuilts and CI hooks to cut setup time, fixes out-of-tree symbol resolution, and skips kbleds in QEMU to avoid a kernel oops.

  • New Features

    • devtools/setup.sh builds kernel (6.12.6) + static BusyBox, creates initramfs; auto-downloads matching prebuilt kernel-build from GitHub Releases; copies vmlinux.symvers to Module.symvers for out-of-tree builds.
    • devtools/boot.sh launches QEMU with --gdb, --test, extra args; shares the repo at /mnt/lkmpg/ (test cmd is base64-encoded to avoid cmdline splitting). devtools/guest-test.sh runs insmod/rmmod in-guest.
    • devtools/build-modules.sh compiles examples/ against the dev kernel. devtools/test-modules.sh runs non-interactive tests with --no-build and --timeout; respects .ci/non-working and devtools/non-working (QEMU-only); kbleds is excluded in QEMU.
    • devtools/check.sh adds fast offline validation (shell syntax, shellcheck, config/interface checks, non-working list consistency); fixes word-splitting in list iteration.
    • devtools/pack-prebuilt.sh produces minimal tarballs (kbuild headers/scripts/tools, bzImage, initramfs; no vmlinux).
    • CI: devtools-release builds/publishes prebuilts; status-check adds devtools-check (offline) and devtools-qemu (kernel+QEMU tests), required when devtools/**, examples/**, or .ci/non-working change.
    • Docs describe the QEMU workflow and GDB usage; .gitignore excludes devtools/.cache/ and devtools/config.local.
  • Migration

    • Optional; no changes to existing examples.
    • To try it: devtools/setup.shdevtools/build-modules.shdevtools/boot.sh (interactive) or devtools/test-modules.sh (CI-style).

Written for commit 7f03cd3. Summary will update on new commits.

cubic-dev-ai[bot]

This comment was marked as resolved.

@jserv jserv force-pushed the devtools branch 3 times, most recently from db4fcca to 30df6ed Compare April 24, 2026 14:01
cubic-dev-ai[bot]

This comment was marked as resolved.

Kernel module development previously required a bare Linux machine or
manual VM setup. This adds self-contained devtools/ directory that boots
a minimal QEMU guest with the project tree shared via 9p virtfs, so
modules built on the host are instantly visible inside the guest.

Skip kbleds in QEMU tests (no virtual console in headless VM)

kbleds accesses vc_cons[fg_console].d->port.tty to blink keyboard
LEDs. In QEMU -nographic mode there is no virtual console, so this
dereferences NULL and triggers a kernel oops. The module works on
bare-metal CI runners (which have a virtual console), so it must
not be added to .ci/non-working.

Add devtools/non-working as a QEMU-specific exclusion list. The
guest-test.sh script now checks both .ci/non-working and
devtools/non-working before loading each module. check.sh validates
entries in both lists.
@jserv jserv merged commit 8f6201b into master Apr 24, 2026
7 checks passed
@jserv jserv deleted the devtools branch April 24, 2026 15:17
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant