Linux 内核社区交互与补丁提交指南

本指南记录了向 Linux Kernel Mailing List (LKML) 及其分支列表(如 RISC-V)发送邮件/补丁的标准流程.

https://lore.kernel.org/all/6eafdd754222e11a43be4bbc3652f7605d47afa6.1766559840.git.sanjayembeddedse@gmail.com/ 为例.

1 环境准备

  • git-email

  • b4

2 配置

1
2
3
4
5
6
7
8
9
10
11
12
# 基础身份配置
# git config --global user.name "Keke Ming"
# git config --global user.email "ming.jvle@gmail.com"
git config --global user.name <"Your Real Name">
git config --global user.email <"yourname@gmail.com">

# SMTP 配置 (Gmail)
git config --global sendemail.smtpserver smtp.gmail.com
git config --global sendemail.smtpserverport 587
git config --global sendemail.smtpencryption tls
# git config --global sendemail.smtpuser ming.jvle@gmail.com
git config --global sendemail.smtpuser <yourname@gmail.com>

3 邮件格式

1
2
3
4
5
6
7
8
9
10
11
12
13
14
Subject: Re: [PATCH] 补丁的原始完整标题

On [日期], [作者名字] wrote:
> (引用补丁中相关的 2-3 行关键描述或报错信息)
> (不需要引用整封邮件,用 ... 代替省略部分)

(这里写你的反馈,例如:)
Tested this on riscv64 (cross-compiled on x86_64) using linux-next.
The patch fixes the compilation error as expected.

# Acked-by: Name <email>: 表示该模块的维护者看过这个补丁, 认为逻辑没问题, 同意合入.
# Reviewed-by: Name <email>: 表示你对代码进行了详细的审查, 包括逻辑、编码风格、潜在漏洞等.
# Tested-by: Name <email>: 表示你实际编译并运行了补丁, 验证了它确实解决了问题或没有引入新问题.
Tested-by: Your Real Name <yourname@gmail.com>

例如.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
Subject: Re: [PATCH] irqchip/riscv-aplic: adapt to syscore API passing context data

On Wed, Dec 24, 2025 at 16:41:46 +0530, Sanjay Chitroda wrote:
> The RISC-V APLIC driver started preserving state across suspend/resume,
> but its syscore usage still assumed the old API. Building against
> linux-next after a97fbc3ee3e2 fails because the callbacks don’t receive
> the necessary driver context.

Tested this on riscv64 (cross-compiled on x86_64) using linux-next
(next-20251219). Without this patch, the build fails with:

drivers/irqchip/irq-riscv-aplic-main.c:111:20: error: initialization of
‘int (*)(void *)’ from incompatible pointer type ‘int (*)(void)’

This patch correctly fixes the compilation error by updating the APLIC
driver to the new syscore API.

Tested-by: Keke Ming <ming.jvle@gmail.com>

4 发送前准备

最好先给自己的邮箱发送一封.

1
2
3
4
git send-email \
--to=yourname@gmail.com \
--in-reply-to=原始邮件的Message-ID \
./邮件内容

确认无误之后再正式发送.

1
2
3
4
5
6
7
8
git send-email \
--in-reply-to=原始邮件的Message-ID \
--to="作者邮箱" \
--cc="维护者1邮箱" \
--cc="维护者2邮箱" \
--cc="linux-riscv@lists.infradead.org" \
--cc="linux-kernel@vger.kernel.org" \
./邮件内容

之后即可在邮件列表查看到相应的邮件.

5 其他操作

5.1 拉取补丁

这会生成一个 .mbx 文件.

1
2
3
4
# b4 am 6eafdd754222e11a43be4bbc3652f7605d47afa6.1766559840.git.sanjayembeddedse@gmail.com
# -v n: 如果讨论已经到了第 2 版, 你可以指定版本如 `-v 2`如果不指定, b4 默认下载它能找到的最新版.
# -t: 它会告诉 b4 去抓取该邮件列表下所有的回复(Tested-by, Reviewed-by, Acked-by), 并自动把这些标签补齐到补丁里.
b4 am -t -o ./patches/ <Message-ID>

然后应用补丁.

1
git am <对应的patch>.mbx