提交linux kernel patch流程

缩进

git commit 要求自动换行(按照社区具体已要求,内核要求75字符)
git config --global core.editor "vim"

~/.vimrc 中写入
autocmd FileType gitcommit setlocal textwidth=75

本地提交commit

git commit -s

-s会自动在结尾加上Signed-off-by,注意要修改成真名 + 邮箱,而不是昵称 + 邮箱(看社区要求)

第一行会作为title

复制代码
bpf: it is title

The tcp_bpf_recvmsg_parser() xxxx

xxx

Signed-off-by: Jiayuan Chen <[email protected]>

注意如果commit message你是拷贝进去的话,不会自动换行,要么手输然后回自动换行,要么外面自动换行完再拷贝。

生成本地patch文件

将当前第一个commit生成patch,到tmp目录下
git format-patch HEAD~1 -o /tmp

如果如果生成多个patch,会自动加上 x/y ,无需手动

复制代码
[patch 1/2]
[patch 2/2]

如果多个patch(即多个commit打成的patchsets),建议加上 --cover-letter 参数, 这会生成一个独立的、额外的、top的email,相当于菜单

加上 --cover-letter ,[patch 0/2] 就是那个菜单,里面需要手动vim编辑,包括subject也需要编辑。

效果如下:

复制代码
[patch 0/2] introduce xxx
     [patch 1/2] 
     [patch 2/2]

规范性检查

每次修改完需要从头来过,检查脚本在linux源码目录
./scripts/checkpatch.pl /tmp/0001-bpf-fix-filed-access-without-lock.patch

发送给谁

./scripts/get_maintainer.pl /tmp/0001-bpf-fix-filed-access-without-lock.patch

其实这些都不准确,很多都没人理,具体看邮件列表当前谁在review,把这些人也加上去

配置邮箱

发送的时候需要配置stmp。请参考对应邮箱服务,一次配置,后续send-email的时候就不需要填了,以163为例

git config --global sendemail.smtpserver smtp.163.com

git config --global sendemail.smtpserverport 465

git config --global sendemail.smtpuser 邮箱账号

git config --global sendemail.smtppass 密码

git config --global sendemail.smtpencryption ssl

发送

发送patch,指定patch以及收件人,收件人由 get_maintainer.pl 列出,以及当前谁比较活跃

注意,通常先只发送给自己,然后看看效果,没问题了再发给社区

发送给社区,例如这里的人就是我获取到的的reviewer:
git send-email --to [email protected] --to [email protected] --to [email protected] --to [email protected] --to [email protected] --to [email protected] --to [email protected] --to [email protected] --to [email protected] /tmp/你的patch文件

如果是多个patch,使用目录/youpatch/* 来代替 单个文件

回复

一般会提出意见,你要按照意见改,可以重新revert掉本地commit,从头来过,然后生成patch
git format-patch -v2 HEAD~ -o /tmp ,-v2会让subject自动打上v2,例如[PATCH v2]

同时使用git commit --amend 编辑你的commit信息,在最后加入如下信息,这样,方便review(非强制,但是这样review比较快,特别是不同人review的时候)

复制代码
---
v1 -> v2 : 干了什么
           v1 链接
---

git send-email --to 那个人 --cc 其他人 /tmp/v2patch

这样生成了独立的thread,个人喜欢独立的thread。特别是多个patch的时候,来回回复,根本看不清。

如果是单独patch,则可以简单回复并且相同的thread:
git send-email --no-thread --to 那个人 --in-reply-to $messageid --cc 其他人 /tmp/v2patch

messageid你看还要回复谁

复制代码
[a]
 	 [b]
  	 [c]

你回复a则

复制代码
[a]
 	 [b]
  	 [c]
     [你的邮件]

你回复b则

复制代码
[a]
 	[b]
   	   [你的邮件]
  	[c]

9、单纯回复

像reviewer一样回复,通常是用来简单交流的,不需要patch。由于需要按照bottom-posting(和163 gmail等相反的格式= =),以及需要引用收到的内容,这里使用各种webmail肯定是不合适的(至少我没找到),git send-email 也麻烦。

这里建议使用mutt客户,纯命令行的,参考https://wonderful.blog.csdn.net/article/details/143483526

相关推荐
SuperW3 小时前
Linux学习——UDP
linux·学习·udp
OpenLoong 开源社区3 小时前
技术视界 | 开源新视野: 人形机器人技术崛起,开源社区驱动创新
机器人·开源
菜狗想要变强4 小时前
Linux驱动开发--异步通知与异步I/O
linux·运维·驱动开发
SuperW4 小时前
Linux学习——IO多路复用知识
linux·服务器·学习
CopyLower4 小时前
Spring Boot的优点:赋能现代Java开发的利器
java·linux·spring boot
终身学习基地5 小时前
第七篇:linux之基本权限、进程管理、系统服务
linux·运维·服务器
安顾里5 小时前
LInux平均负载
linux·服务器·php
unlockjy5 小时前
Linux——进程优先级/切换/调度
linux·运维·服务器
该死的碳酸饮料呀5 小时前
PLOG安装
linux·ubuntu
成工小白5 小时前
【Linux】详细介绍进程的概念
linux·运维·服务器