内核开发技能
- 作者仓库星标 47
- 作者仓库 MateBot
- 领域
- 通用
- 作者声明的智能体
- 未找到明确声明;不据此推断已兼容或已测试
- 静态检查
- 88 / 100 · 启发式扫描,不代表运行安全
- 运行环境证据
- 未执行;当前没有隔离运行测试证据
- 作者 / 版本 / 许可证
- @aresbit · 未声明许可证
- 上下文用量评级
- 低消耗
- 接入复杂程度
- 需简单配置
- 是否需要外部接口密钥
- 不需要
- 兼容的系统
- Linux
- 运行环境要求
- 未检出明确要求
- 检测到的文件与系统行为
-
- 只读
- 命令执行
- 网络行为
- 仅限本地
- 安装命令数
- 无(仅作为资料)
需要注意: 未声明工具权限范围;实际权限由运行环境决定。
1. Subsystem and failure class
2. Evidence used
3. Relevant local material
4. Smallest patch sequence
5. Verification step and expected signal
6. Risks / assumptions
# Linux Kernel Development
Core rule: `simple is superior to everything`.
This skill is for practical kernel engineering. Use it to analyze failures, choose the smallest relevant subsystem material, make minimal verifiable changes, and validate with evidence.
## Use this skill when
- Kernel code fails to build or run on a target kernel
- A module, subsystem patch, or lab skeleton needs implementation
- You need help on process, syscall, interrupt, SMP, memory, filesystem, networking, or architecture topics
- You are decoding oops/panic, lock bugs, memory bugs, or performance regressions
- You are working on device-model or driver-adjacent kernel paths
## Scope
Includes:
- kernel modules and build flow
- kernel API and execution context rules
- system calls and process interactions
- interrupts and deferred work
- SMP and synchronization
- memory management and mapping
- filesystems and VFS-facing logic
- networking stack and net path basics
- architecture layer and portability concerns
- debugging and profiling
- device and driver model
## Coverage contract
When responding, ensure the chosen path explicitly maps to one of these kernel components:
- module lifecycle
- syscall boundary
- process/scheduler path
- interrupts/deferred work
- locking/SMP behavior
- memory subsystem (allocation, mapping, lifetime, reclaim-facing assumptions)
- filesystem/VFS path
- networking path
- architecture portability
- debugging/profiling or device model
If the issue touches memory, call out which memory aspect is involved:
- allocation/lifetime (`kmalloc`, `vmalloc`, `kzalloc`, free path symmetry)
- user/kernel copy boundary
- mapping or virtual memory behavior (`mmap`, vm area assumptions)
- context safety (sleeping/atomic constraints)
Excludes:
- pure user-space programs
- generic Linux administration without kernel code
## Required inputs
Collect minimal hard evidence before proposing a patch:
- target kernel version, distro, architecture
- source path and build entry (`Makefile` / `Kbuild` / target)
- first failing build log or runtime log
- subsystem guess: module, syscall, process, irq, memory, fs, net, arch, driver, or unknown
- desired outcome: compile fix, runtime fix, behavior change, or learning implementation
## Workflow
1. Freeze baseline.
Run one build or collect one complete runtime failure trace.
2. Classify failure.
Place blockers into one class: API break, context violation, concurrency, memory, lifecycle, functional bug, or performance issue.
3. Route to one reference first.
Use [references/source-map.md](references/source-map.md) to pick the smallest matching file from `references/labs` or `references/lectures`.
4. Patch one theme per step.
Avoid mixing unrelated refactors.
5. Verify immediately.
Rebuild and run one focused check that proves the specific blocker moved.
6. Expand only after proof.
After the first fix is validated, handle next blocker.
## Hard rules
- Minimal, reversible, evidence-based changes.
- No API claims without code/log evidence.
- Do not redesign architecture while baseline is broken.
- Do not hide uncertainty; label assumptions and provide next confirming command.
- Keep recommendations subsystem-specific, not generic Linux advice.
## Command set
```bash
make -C /lib/modules/$(uname -r)/build M=$PWD V=1 modules
make -C /lib/modules/$(uname -r)/build M=$PWD W=1 C=1 modules
dmesg -T | tail -n 200
scripts/checkpatch.pl --strict -f path/to/file.c
```
Add subsystem commands only when they directly test the current blocker.
## Subsystem verification rule
For the selected subsystem, include at least one verification step with an expected signal:
- memory: allocator path, user-copy return handling, or mapping behavior check
- interrupts: handler registration and interrupt-path signal in logs
- process/scheduler: task state transition or wake/sleep behavior evidence
- filesystem: VFS callback path evidence
- networking: packet path or interface state transition evidence
- syscall boundary: errno and copy boundary behavior evidence
## Output format
```text
1. Subsystem and failure class
2. Evidence used
3. Relevant local material
4. Smallest patch sequence
5. Verification step and expected signal
6. Risks / assumptions
```
Output must satisfy all items:
- name one primary kernel component from the coverage contract
- cite the local material file used for that component (`references/labs/*.md` or `references/lectures/*.md`)
- provide one concrete verification step with expected signal
- if subsystem is unknown, state the shortest command to disambiguate it
## Fast mode
For firefighting requests:
- show top 3 blockers only
- map each blocker to one local reference
- provide smallest next patch and one verification step
## References
- [references/source-map.md](references/source-map.md)
- [references/getting-started.md](references/getting-started.md)
- [references/api-migration-checklist.md](references/api-migration-checklist.md)
章节与文件索引
按说明文件中的顺序排列。
使用这个技能的时候
适用范围
承保合同
所需的输入
工作流程
文件/命令 -> simple is superior to everything · kmalloc · vmalloc · kzalloc · mmap · Makefile · Kbuild · references/labs
内容校验值 -> 3b54d6f2590e
当前原文的自动摘译,尚未人工审校。
使用这个技能的时候
内核代码无法在目标内核上构建或运行 模块、子系统补丁或实验室框架需要实现 您需要有关进程、系统调用、中断、SMP、内存、文件系统、网络或体系结构主题的帮助 您正在解码 oops/panic、锁定错误、内存错误或性能回归 您正在处理设备模型或驱动程序相邻的内核路径
适用范围
包括: 内核模块和构建流程 内核 API 和执行上下文规则 系统调用和进程交互 中断和延迟工作
承保合同
响应时,确保所选路径显式映射到以下内核组件之一:模块生命周期系统调用边界进程/调度程序路径中断/延迟工作
所需的输入
在提出补丁之前收集最少的确凿证据:目标内核版本、发行版、架构源路径和构建条目(
Makefile/Kbuild/目标)首先失败的构建日志或运行时日志子系统猜测:模块、系统调用、进程、irq、内存、fs、net、arch、驱动程序或未知工作流程
冻结基线。运行一个构建或收集一个完整的运行时故障跟踪。对失败进行分类。将阻碍因素归为一类:API 中断、上下文冲突、并发、内存、生命周期、功能错误或性能问题。首先路由到一个参考。