KE

kernel-development

Technical guide for kernel-level development and debugging.

Install

mkdir -p .claude/skills/kernel-development && curl -L -o skill.zip "https://agentskills.codes/api/skills/download/10226" && unzip -o skill.zip -d .claude/skills/kernel-development && rm skill.zip

Installs to .claude/skills/kernel-development

Activation

This is the description your AI agent reads to decide when to run this skill — the better it matches your request, the more reliably it fires.

Guide for modifying and debugging the Nanvix kernel architecture and kernel-call paths. Use this when asked about kernel internals or kernel implementation changes.
164 chars✓ has a “when” trigger
Advanced

Key capabilities

  • Modify kernel modules
  • Debug hardware abstractions
  • Understand IPC implementations
  • Change dispatch logic

How it works

Provides architectural guidance for the Nanvix microkernel, a #![no_std] Rust binary.

Inputs & outputs

You give it
Kernel code change
You get back
Compiled kernel binary

When to use kernel-development

  • Modify kernel modules
  • Debug memory management paths
  • Understand IPC implementations
  • Change kernel-call dispatch logic

About this skill

Kernel Development

Use this skill when the user asks about developing, modifying, or debugging the Nanvix microkernel. The kernel is a #![no_std] Rust binary targeting x86 (32-bit) and lives in src/kernel/.

Architecture Overview

The kernel is a freestanding binary (#![no_std], #![no_main]) that runs in ring 0 on x86. Entry point is src/kernel/src/kmain.rs.

Key Modules

ModulePathPurpose
halsrc/kernel/src/hal/Hardware Abstraction.
mmsrc/kernel/src/mm/Memory Management.
pmsrc/kernel/src/pm/Process Management.
ipcsrc/kernel/src/ipc/IPC (mailboxes).
eventsrc/kernel/src/event/Event subsystem.
iosrc/kernel/src/io/I/O subsystem.
kcallsrc/kernel/src/kcall/Kernel call dispatch.
kargssrc/kernel/src/kargs.rsBoot args parsing.
kimagesrc/kernel/src/kimage.rsKernel image mgmt.
klogsrc/kernel/src/klog.rsKernel logging.
kpanicsrc/kernel/src/kpanic.rsPanic handler.
uartsrc/kernel/src/uart.rsUART serial driver.

Machine Configurations

The kernel supports multiple machine types via Cargo feature flags:

  • microvm (default) — Lightweight VM for KVM.

Virtual Memory Layout

  • KERNEL_BASE_RAW to KPOOL_BASE_RAW — Kernel binary.
  • KPOOL_BASE_RAW to USER_BASE_RAW — Kernel pool.
  • USER_BASE_RAW to USER_MMAP_BASE_RAW — User binary.
  • USER_MMAP_BASE_RAW to USER_LIBS_BASE_RAW — Mapped.
  • USER_LIBS_BASE_RAW to USER_HEAP_BASE_RAW — Libs.
  • USER_HEAP_BASE_RAW to USER_HEAP_END_RAW — Heap.
  • USER_STACK_TOP_RAW to USER_STACK_BASE_RAW — Stack.

Building the Kernel

./z build -- kernel

The kernel uses a custom Cargo target (build/targets/x86-kernel.json) and custom linker scripts (build/kernel/). Kernel builds disable sccache to avoid issues with compiler_builtins.

Key Dependencies

The kernel depends on workspace libraries:

  • arch — Architecture abstractions.
  • bitmap — Bitmap data structure.
  • config — Compile-time configuration.
  • type-safe — Type-safe wrappers.
  • raw-array — Fixed-size arrays.
  • slab — Slab allocator.
  • sys — System-level types (kcall, IPC, MM, PM).

Coding Rules (Kernel-Specific)

  • All kernel code is #![no_std] — only core and alloc are available.
  • No panic!, unwrap(), or expect() in production kernel code.
  • Use explicit type annotations everywhere.
  • Prefix imports with ::.
  • Minimize unsafe blocks and document safety invariants.
  • Log errors with error! macro before returning Err.
  • Use kernel-specific Cargo commands: KERNEL_CARGO_BUILD_CMD.
  • Kernel configuration is in build/kernel_config.toml.

Kernel Calls (System Calls)

Kernel calls are dispatched through src/kernel/src/kcall/dispatcher.rs. Each subsystem (PM, MM, IPC, Event, IO) registers its own kernel call handlers in its respective kcall/ subdirectory.

When not to use it

  • User-space application development

Prerequisites

Rust toolchainCargo

Limitations

  • No standard library available
  • Strict coding rules for safety

How it compares

Specifically tailored for microkernel development and low-level hardware abstraction.

Compared to similar skills

kernel-development side by side with the closest alternatives in the catalog.

SkillInstallsUpdatedSafetyDifficulty
kernel-development (this skill)03moReviewAdvanced
coding06moNo flagsAdvanced
cellar04moReviewIntermediate
deepwiki-rs259moReviewIntermediate

Try saying

Example prompts that trigger this skill in your AI assistant.

Search skills

Search the agent skills registry