AI-assisted Linux Kernel Workflow 構築まとめ
# AI-assisted Linux Kernel Workflow 構築まとめ
## 概要
Linux Kernel upstream 開発において、AIを「単発の便利ツール」ではなく、再現可能な開発ワークフローとして活用するための環境を構築した。
目的は以下:
- Linux kernel patch投稿作業の再現性向上
- AI利用時の品質ばらつき抑制
- 最小差分主義(minimal diff)の徹底
- upstream投稿までの確認漏れ防止
- 将来の patch 作業効率化
---
# 環境
## 開発環境
- Windows 10
- VSCode
- Ubuntu / WSL2
## AI / Tooling
- Claude Code (Pro)
- Codex CLI (gpt-5.5)
- OpenClaw + openai-codex/gpt-5.5
- Gemini CLI
- GitHub Copilot
---
# 基本思想
## AIを「自動修正ツール」にしない
目的は:
- AIに全部やらせる
ではなく、
- AIを再現可能な補助系として固定化
すること。
---
## Linux kernel upstream に合わせた運用
特に重視した点:
- minimal diff
- no logic changes
- standalone patch
- no unrelated cleanup
- reviewer noise reduction
---
# 作成した workflow repository
## 作成場所
```text
~/kernel-workflow
構成
~/kernel-workflow
├── archives
├── checklists
├── logs
├── prompts
├── scripts
├── templates
└── workflow
各ディレクトリの役割
prompts/
AI向け固定プロンプト。
claude_cleanup_prompt.md
Claude Code 用。
目的:
- checkpatch cleanup
- minimal diff
- no refactoring
を強制。
codex_review_prompt.md
Codex 用。
目的:
- maintainer視点レビュー
- hidden logic change検出
- over-refactoring検出
workflow/
kernel_patch_workflow.md
patch作成〜送信〜投稿後確認までの標準手順。
内容:
- tree sync
- warning確認
- lore確認
- OpenClaw調査
- Claude修正
- validation
- Codex review
- commit
- format-patch
- get_maintainer
- git send-email
- lore確認
scripts/
kpatch-check.sh
patch前後確認の自動化。
実行内容:
git diff --check
scripts/checkpatch.pl --strict --file TARGET.c
scripts/checkpatch.pl --strict -g HEAD
scripts/get_maintainer.pl -f TARGET.c
git format-patch -1 --stdout | head
目的:
- 確認漏れ防止
- 手順固定化
- ヒューマンエラー削減
checklists/
pre_send_checklist.md
送信前確認リスト。
確認項目:
- minimal diff
- no unrelated cleanup
- checkpatch clean
- Signed-off-by
- maintainer確認
- lore確認
templates/
commit_message_cleanup.md
cleanup patch 用 commit message template。
目的:
- WHAT
- WHY
- no functional impact
を毎回漏れなく記載。
logs/
2026-05-08-axis-fifo-first-patch.md
初 upstream patch の実戦ログ。
記録内容:
- 発生した問題
- 有効だった対応
- skip判断理由
- useful commands
- lore確認結果
git send-email 環境整備
設定
[sendemail]
smtpserver = <your smtp server>
smtpserverport = 587
smtpencryption = tls
smtpuser = <your user name>
from = <your mail address>
confirm = always
suppresscc = self
annotate = yes
chainreplyto = false
目的
confirm = always
誤送信防止。
suppresscc = self
不要な self-cc 削減。
annotate = yes
送信前最終編集可能化。
chainreplyto = false
新規 thread 化。
実際に投稿した patch
内容
staging: axis-fifo: fix alignment in wait_event_interruptible()
種類
- checkpatch cleanup
- alignment修正
- whitespace-only patch
成果
- lore.kernel.org 投稿成功
- git send-email 環境完成
- upstream patch flow 実地確認完了
実際に発生した問題
stale ref 問題
git remote prune staging
rm -rf .git/refs/remotes/staging
git fetch staging
で解決。
commit message 誤操作
最初の commit に:
git add drivers/...
が混入。
git commit --amend
で修正。
Gmail 認証
通常 password は拒否。
Google App Password が必要。
bounce mail
Dan Carpenter の linaro address が bounce。
今後は:
- lore.kernel.org
- recent review activity
も確認する方針。
今後の拡張予定
優先度高
kpatch-build.sh
make M=drivers/staging/xxx/
による build validation。
logs 運用継続
- reviewer feedback
- v2 patch理由
- rejected理由
を資産化。
将来検討
sparse check
make C=2
lore helper
maintainer傾向解析
この workflow の本質
最重要なのは:
AIを使った
ことではなく、
AIを再現可能な kernel workflow に固定化した
こと。
これにより:
- 品質安定
- upstream適合性向上
- 作業速度向上
- 知識継承
が可能になった。
現時点の到達点
この workflow により、
- cleanup patch
- staging driver cleanup
- checkpatch warning 修正
は高い再現性で upstream 投稿可能な状態になった。
今後は:
- 小規模 functional change
- bug fix
- locking / error path 修正
へ段階的に拡張予定。