Linux kernel patch提交

1. 下载最新kernel源码

https://www.kernel.org/

mainline: 5.12-rc7 2021-04-11 [tarball]   [patch] [inc. patch] [view diff] [browse]

点击browse后,点击summary,在网页下方显示git下载命令

Clone
git://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
https://kernel.googlesource.com/pub/scm/linux/kernel/git/torvalds/linux.git

2. 配置本地git

vim ~/.gitconfig

user会显示在commit message中

[color]
        ui = auto
[user]
        name = Ming Xing
        email = ming.xing@gmail.com
[alias]
        pretty = log --branches --remotes --tags --graph --oneline --decorate
        compare = log --oneline --cherry-pick
[sendemail]
## for gmail
        from = Ming Xing <ming.xing@gmail.com>
        smtpencryption = tls
        smtpserver = smtp.gmail.com
        smtpserverport = 587
        smtpuser = ming.xing@gmail.com
#        smtppass = <password>

        suppresscc = all ##禁止自动抄送相关人
        confirm = always ##发送之前提示确认
#        to = 主送列表
#        cc = 抄送列表
#
[core]
    editor = vim
[push]
    default = simple

sendemail 是发送所使用的邮箱配置

3. 填写commit message

git commit

git commit --amend -s

主体格式

tags: title

body

signed-off-by:

4. 生成patch

git format-patch -num --cover-letter --subject-prefix="PATCH v2" --subject-prefix第一版不需要添加

-num表示从HEAD的commit开始,向前生成两个commit的patch。

--cover-letter会生成一个0000-cover-letter.patch,格式和commit message类似,第一行是patchset的主题,第二行描述这组patchset的详细信息,它就是邮件中的【PATCH 0/n】

git format-patch -1 --cover-letter

5. 脚本检查patch格式问题

./scripts/checkpatch.pl 0001-xx-yy-zz.patch

6. 脚本获取maintainer

./scripts/get_maintainer.pl 0001-xx-yy-zz.patch

./scripts/get_maintainer.pl 0001-xx-yy-zz.patch
Russell King <linux@armlinux.org.uk> (odd fixer:ARM PORT)
Sudeep Holla <sudeep.holla@arm.com> (maintainer:GENERIC ARCHITECTURE TOPOLOGY)
Greg Kroah-Hartman <gregkh@linuxfoundation.org> (supporter:DRIVER CORE, KOBJECTS, DEBUGFS AND SYSFS)
"Rafael J. Wysocki" <rafael@kernel.org> (reviewer:DRIVER CORE, KOBJECTS, DEBUGFS AND SYSFS)
Dietmar Eggemann <dietmar.eggemann@arm.com> (commit_signer:2/3=67%)
Valentin Schneider <valentin.schneider@arm.com> (commit_signer:2/3=67%,authored:2/3=67%,added_lines:1/5=20%,removed_lines:27/41=66%)
Peter Zijlstra <a.p.zijlstra@chello.nl> (commit_signer:2/3=67%)
Ingo Molnar <mingo@kernel.org> (commit_signer:2/3=67%)
linux-arm-kernel@lists.infradead.org (moderated list:ARM PORT)
linux-kernel@vger.kernel.org (open list)

7. 邮箱发送patch

将获取到的人员放入主送,邮箱组放入抄送,以逗号分隔

git send-email 0001-xx-yy-zz.patch --to linux@armlinux.org.uk,sudeep.holla@arm.com,gregkh@linuxfoundation.org,rafael@kernel.org,a.p.zijlstra@chello.nl,dietmar.eggemann@arm.com,mingo@kernel.org,valentin.schneider@arm.com --cc linux-arm-kernel@lists.infradead.org,linux-kernel@vger.kernel.org

8. 成功日志

发送成功后会显示log

OK. Log says:

9. 等待回复
 

上一篇:diff和patch更新补丁


下一篇:20条Linux命令笔试常见问答