[Linux][PR]使用B4向linux内核提交补丁
本文介绍了使用b4工具向Linux内核提交补丁的完整流程:从安装b4、创建补丁分支、撰写提交信息,到签名验证、邮件发送和后续审核。重点包括使用b4 prep创建补丁分支,通过patatt genkey生成签名密钥,进行dry-run检查,使用web端点验证身份,以及最终通过b4 send发送补丁。最后还展示了如何查看已提交的补丁并响应审核意见,例如当维护者建议改用static_assert进行编译
·
文章目录

https://people.kernel.org/monsieuricon/sending-a-kernel-patch-with-b4-part-1
1. 使用pip安装
$ pip install --user b4
[...]
$ b4 --version
0.11.1
2. 使用b4切换分支
b4 prep -n [name-of-branch] -f [nearest-tag]
例如:b4 prep -n __reserved_mem_init_node v6.15-rc2,最好使用-f固定tag版本
3. b4 prep --edit-cover
- 将自己的补丁信息描述清楚并提交
- 可以参考修改的文件的其他pr的描述格式进行提交
- 例如
of: reserved-mem: Warn for missing initfn in __reservedmem_of_table
For the data in __reservedmem_of_table, its function pointer initfn might
be NULL. However, __reserved_mem_init_node() only considers non-NULL cases
and ignores NULL function pointers.
Therefore, a check for the possibility of initfn being NULL has been added
here, along with skipping the initfn() and issuing a warning.
To: Rob Herring <robh@kernel.org>
To: Saravana Kannan <saravanak@google.com>
Cc: Marek Szyprowski <m.szyprowski@samsung.com>
Cc: devicetree@vger.kernel.org
Cc: linux-kernel@vger.kernel.org
Signed-off-by: Liya Huang <1425075683@qq.com>
4. 下一步是像往常一样使用 git add 和 git commit 提交更改:
5. 收集收件人地址和抄送地址
b4 prep --auto-to-cc
6. 第一次需要的配置chaozuo
patatt genkey
- 运行 patatt genkey 并将输出中指示的 [patatt] 部分添加到您的 ~/.gitconfig 中
7. Dry-run
b4 send -o /tmp/tosend
./scripts/checkpatch.pl /tmp/tosend/*
$ ./scripts/checkpatch.pl /tmp/tosend/*
total: 0 errors, 0 warnings, 14 lines checked
/tmp/tosend/0001-arm-lanyang-fix-lable-label-typo-for-lanyang-dts.eml has no obvious style problems and is ready for submission.
- 根据检测错误进行修复
- 接下来,生成补丁并查看其内容,以确保一切看起来正常。需要检查的包括:
- From: address
- the To: and Cc: addresses
- 补丁的一般格式
- 求职信格式(如果系列中包含多个补丁
8. 使用 Web 提交端点注册您的密钥
b4 send --web-auth-new
b4 send --web-auth-verify [challenge]
$ b4 send --web-auth-new
Will submit a new email authorization request to:
Endpoint: https://lkml.kernel.org/_b4_submit
Name: Konstantin Ryabitsev
Identity: icon@mricon.com
Selector: 20221221
Pubkey: ed25519:24L8+ejW6PwbTbrJ/uT8HmSM8XkvGGtjTZ6NftSSI6I=
---
Press Enter to confirm or Ctrl-C to abort
Submitting new auth request to https://lkml.kernel.org/_b4_submit
---
Challenge generated and sent to icon@mricon.com
Once you receive it, run b4 send --web-auth-verify [challenge-string]
- change是一个 UUID4 字符串,这一步是一个简单的验证,以确保您能够接收与该密钥关联的电子邮件地址的电子邮件。一旦您收到,请按照描述完成流程:
$ b4 send --web-auth-verify 897851db-9b84-4117-9d82-1d970f9df5f8
Signing challenge
Submitting verification to https://lkml.kernel.org/_b4_submit
---
Challenge successfully verified for icon@mricon.com
You may now use this endpoint for submitting patches.
9 . 或者,设置你的 [sendemail] 部分
9.1 b4 prep --check
10. 反射邮件给自己
- b4 send --reflect
- 这是在发送您的贡献之前要执行的最后一个步骤。注意,这将填充所有消息的 To: 和 Cc: 标头,以实际收件人信息,但它实际上不会向他们发送邮件,只会向您自己发送。邮件服务器实际上不会关注那些标头——对他们来说,唯一重要的是在协商的 RCPT TO 外部信封中指定的内容。
11. 发送!!
- b4 send
12. 查看补丁内容 – 等待10分钟之后在查看是否存在
https://lore.kernel.org/lkml/
- 在这里等待并查看是否有补丁发送上去了

- 这是我的补丁内容
https://lore.kernel.org/lkml/tencent_FFC8E7A5A76050982D28F811C81F936D9205@qq.com/T/#u
13 仅回复审批邮件,不进行代码修改
- 参考
https://blog.csdn.net/JiMoKuangXiangQu/article/details/129424340
- 新建txt,查看如下
- 记得去
https://lore.kernel.org/all/CAL_Jsq++MbY=s5t1hmE0AhcmFA14t3fxLM1xPFZAA0ETX_ee-g@mail.gmail.com/T/#t查看建议的发送方式 - 直接进行邮件回复有可能不被看到
Subject: Re: [PATCH] of: reserved-mem: Warn for missing initfn in __reservedmem_of_table
> On Tue, Apr 15, 2025 at 9:16 AM Liya Huang <1425075683@qq.com> wrote:
> >
> > For the data in __reservedmem_of_table, its function pointer initfn might
> > be NULL. However, __reserved_mem_init_node() only considers non-NULL cases
> > and ignores NULL function pointers.
>
> If initfn is NULL, there's no point to the entry and that's a bug.
> Unless you have a build time check, there's no point to add this.
>
> Rob
Thank you for your response. Based on your suggestion, I have made the
modifications and used static_assert() to perform the check at compile
time. The specific code is as follows. Could you please review whether
this modification is reasonable? If it is acceptable, I will proceed with
submitting the patch.
I did not find any usage of static_assert() for null pointer checks in the
kernel code. Additionally, BUILD_BUG_ON() cannot be used globally.
---
diff --git a/include/linux/of_reserved_mem.h b/include/linux/of_reserved_mem.h
index e338282da652..87446ad2deb2 100644
--- a/include/linux/of_reserved_mem.h
+++ b/include/linux/of_reserved_mem.h
@@ -29,6 +29,7 @@ typedef int (*reservedmem_of_init_fn)(struct reserved_mem *rmem);
#ifdef CONFIG_OF_RESERVED_MEM
#define RESERVEDMEM_OF_DECLARE(name, compat, init) \
+ static_assert((init) != NULL); \
_OF_DECLARE(reservedmem, name, compat, init, reservedmem_of_init_fn)
int of_reserved_mem_device_init_by_idx(struct device *dev,
---
Thanks,
--
Liya Huang <1425075683@qq.com>
更多推荐



所有评论(0)