SlideShare une entreprise Scribd logo
1  sur  33
Télécharger pour lire hors ligne
Linux Kernel Patch
Submission Tips
蔡鎮宇 Tsai, Chen-Yu (wens) / 2017-08-06
www.puffinbrowser.com
#你誰啊 亂公告給Talk
• Systems Engineer / SRE @
CloudMosa, Inc. (maker of Puffin Browser)
• 批踢踢系統總監
• Linux Kernel Allwinner SoC Co-maintainer
2
今天不提…
• Git
• C
• 怎麼找東西寫 patch
• 工具怎麼用
• Live Demo
3
程式改好了…
4
切 commit
• 每個 commit 要獨立
• 每個 commit 做一件事
• 每個 commit 都要可以編
• 檢查 coding style
5
Commit Message
phy: sun4i-usb: Support A83T USB PHYs
The A83T has 3 USB PHYs, 1 for OTG, 1 for standard
USB, 1 for USB HSIC. The phy initialization
procedure is very different from other SoCs, but
the PMU bits are the same, with additional bits
for HSIC.
Signed-off-by: Chen-Yu Tsai <wens@csie.org>
6
Commit 標題
phy: sun4i-usb: Support A83T USB PHYs
The A83T has 3 USB PHYs, 1 for OTG, 1 for standard
USB, 1 for USB HSIC. The phy initialization
procedure is very different from other SoCs, but
the PMU bits are the same, with additional bits
for HSIC.
Signed-off-by: Chen-Yu Tsai <wens@csie.org>
7
一行80字元內簡述更動內容
Commit Message
phy: sun4i-usb: Support A83T USB PHYs
The A83T has 3 USB PHYs, 1 for OTG, 1 for standard
USB, 1 for USB HSIC. The phy initialization
procedure is very different from other SoCs, but
the PMU bits are the same, with additional bits
for HSIC.
Signed-off-by: Chen-Yu Tsai <wens@csie.org>
8
解釋更動背後的動機和情境
Signed-off-by
phy: sun4i-usb: Support A83T USB PHYs
The A83T has 3 USB PHYs, 1 for OTG, 1 for standard
…
Signed-off-by: Chen-Yu Tsai <wens@csie.org>
9
畫押:認證更動是自己寫的,
或是自己有權利貢獻的。
Signed-off-by
• Developer's Certificate of Origin
• 請見
Documentation/process/submitting-
patches.rst
• 需要用真名
10
送 patch
11
準則
• 送信時不要更動到內容
• 複製貼上很容易出錯
• 多個 patch 請寫 cover letter
• 不要一次送太多
12
Cover Letter
• 解釋一系列的 patch 在做什麼
• 如有需要,簡述每個 patch 的內容
• 預期 maintainer 怎麼處理
13
工具
• scripts/checkpatch.pl
• 自動化檢查 coding style (跟拼字)
• scipts/get_maintainer.pl
• 找出相關的 maintainer 跟 mailing list
14
工具
• git format-patch
• 生出 patch 的 email
• git send-email
• 自動送出去
15
Patch 送出去了!
然後呢?
石沉大海
• Maintainer 度假去了
• 歐洲人常會放暑假
• 美國人放感恩節、聖誕節連續假期
• 寄錯人了…
17
Checkpatch errors
• 你沒跑 checkpatch 對不對?
• 改好重送
18
Does not apply
• 你的修改是基於哪個版本? 哪個 repository?
• 通常要基於 maintainer 的 -next 或 -fixes
• 偷懶可用 linux-next
• 也可能是別人的 patch 捷足先登
19
NACK
• Reviewer 不同意變更的方向
• 思考有沒有其他的解法
20
Looks good, but…
• Reviewer 認為有改進空間
• 討論,改進,送出新的版本 v(N+1)
21
Build error
• 你有測試過你的程式嗎?
22
Build error w/ xxxconfig
• Kconfig 相依性不對?
• 一定需要某個選項有開或沒開?
• 不能編成模組?
• 平台限定?
23
Applied!
• 沒事了!
• 過幾天看有沒有出現在 maintainer 的 repository 或
是 linux-next
24
回信要注意
• 回信一樣純文字
• 不要更動引用原文
• 回文回在前後文中間,不要回在最上面
• In-reply-to 標頭要有
25
改進完了
26
送第二版
• git format-patch -v2
• 要附修改紀錄 (changelog)
• Reviewer 可能不會記得跟你說過什麼
27
Reviewer 不和善 
• Reviewer 通常對事不對人
• 把 review 當成學習的機會
28
Maintainer 很辛苦
• 多數是無給薪志願者利用自己閒暇時間
• 一天的信件量很可觀
• Maintainer 也是人
29
Maintainer 的各種毛
• 回應周期
• 各式偏好
• 各平台或子系統的不成文規定
30
Q&A
31
參考資料
• Write and Submit your first Linux kernel Patch
• https://youtu.be/LLBrBBImJt4
• https://kernelnewbies.org/FirstKernelPatch
32
謝謝大家
33

Contenu connexe

Similaire à Linux Kernel Patch Submission Tips

20121111 linux intro
20121111 linux intro20121111 linux intro
20121111 linux introChang Mt
 
該怎麼樣(認真的)部署你的 Python Web 應用程式?
該怎麼樣(認真的)部署你的 Python Web 應用程式?該怎麼樣(認真的)部署你的 Python Web 應用程式?
該怎麼樣(認真的)部署你的 Python Web 應用程式?Andy Dai
 
初心者 Git 上手攻略
初心者 Git 上手攻略初心者 Git 上手攻略
初心者 Git 上手攻略Lucien Lee
 
嵌入式平台移植技巧概說
嵌入式平台移植技巧概說嵌入式平台移植技巧概說
嵌入式平台移植技巧概說Joseph Lu
 
U boot 程式碼打掃計畫
U boot 程式碼打掃計畫U boot 程式碼打掃計畫
U boot 程式碼打掃計畫Macpaul Lin
 
20121213 foundation of software development 2 2-ktchuang
20121213 foundation of software development 2 2-ktchuang20121213 foundation of software development 2 2-ktchuang
20121213 foundation of software development 2 2-ktchuangnetdbncku
 
使用 Pytest 進行單元測試 (PyCon TW 2021)
使用 Pytest 進行單元測試 (PyCon TW 2021)使用 Pytest 進行單元測試 (PyCon TW 2021)
使用 Pytest 進行單元測試 (PyCon TW 2021)Max Lai
 
Raspberry pi 基本操作
Raspberry pi 基本操作Raspberry pi 基本操作
Raspberry pi 基本操作艾鍗科技
 
[3]投影片 futurewad樹莓派研習會 141204
[3]投影片 futurewad樹莓派研習會 141204[3]投影片 futurewad樹莓派研習會 141204
[3]投影片 futurewad樹莓派研習會 141204CAVEDU Education
 
軟體組裝心得分享
軟體組裝心得分享軟體組裝心得分享
軟體組裝心得分享Wen Liao
 
Docker tutorial
Docker tutorialDocker tutorial
Docker tutorialazole Lai
 
Python 于 webgame 的应用
Python 于 webgame 的应用Python 于 webgame 的应用
Python 于 webgame 的应用勇浩 赖
 
Continuous Delivery with Ansible x GitLab CI
Continuous Delivery with Ansible x GitLab CIContinuous Delivery with Ansible x GitLab CI
Continuous Delivery with Ansible x GitLab CIChu-Siang Lai
 
141118 Raspberry Pi 電鈴工作坊@松山文創園區
141118 Raspberry Pi 電鈴工作坊@松山文創園區141118 Raspberry Pi 電鈴工作坊@松山文創園區
141118 Raspberry Pi 電鈴工作坊@松山文創園區CAVEDU Education
 
[1]投影片 futurewad樹莓派研習會 141120
[1]投影片 futurewad樹莓派研習會 141120[1]投影片 futurewad樹莓派研習會 141120
[1]投影片 futurewad樹莓派研習會 141120CAVEDU Education
 
Learning to Use Git | WeiYuan
Learning to Use Git | WeiYuanLearning to Use Git | WeiYuan
Learning to Use Git | WeiYuanWei-Yuan Chang
 
Docker 基礎介紹與實戰
Docker 基礎介紹與實戰Docker 基礎介紹與實戰
Docker 基礎介紹與實戰Bo-Yi Wu
 
A brief introduction to Vagrant – 原來 VirtualBox 可以這樣玩
A brief introduction to Vagrant – 原來 VirtualBox 可以這樣玩A brief introduction to Vagrant – 原來 VirtualBox 可以這樣玩
A brief introduction to Vagrant – 原來 VirtualBox 可以這樣玩Wen-Tien Chang
 

Similaire à Linux Kernel Patch Submission Tips (20)

20121111 linux intro
20121111 linux intro20121111 linux intro
20121111 linux intro
 
該怎麼樣(認真的)部署你的 Python Web 應用程式?
該怎麼樣(認真的)部署你的 Python Web 應用程式?該怎麼樣(認真的)部署你的 Python Web 應用程式?
該怎麼樣(認真的)部署你的 Python Web 應用程式?
 
初心者 Git 上手攻略
初心者 Git 上手攻略初心者 Git 上手攻略
初心者 Git 上手攻略
 
嵌入式平台移植技巧概說
嵌入式平台移植技巧概說嵌入式平台移植技巧概說
嵌入式平台移植技巧概說
 
Linux File system
Linux File systemLinux File system
Linux File system
 
U boot 程式碼打掃計畫
U boot 程式碼打掃計畫U boot 程式碼打掃計畫
U boot 程式碼打掃計畫
 
20121213 foundation of software development 2 2-ktchuang
20121213 foundation of software development 2 2-ktchuang20121213 foundation of software development 2 2-ktchuang
20121213 foundation of software development 2 2-ktchuang
 
使用 Pytest 進行單元測試 (PyCon TW 2021)
使用 Pytest 進行單元測試 (PyCon TW 2021)使用 Pytest 進行單元測試 (PyCon TW 2021)
使用 Pytest 進行單元測試 (PyCon TW 2021)
 
Raspberry pi 基本操作
Raspberry pi 基本操作Raspberry pi 基本操作
Raspberry pi 基本操作
 
[3]投影片 futurewad樹莓派研習會 141204
[3]投影片 futurewad樹莓派研習會 141204[3]投影片 futurewad樹莓派研習會 141204
[3]投影片 futurewad樹莓派研習會 141204
 
軟體組裝心得分享
軟體組裝心得分享軟體組裝心得分享
軟體組裝心得分享
 
Docker tutorial
Docker tutorialDocker tutorial
Docker tutorial
 
42qu thrift1
42qu thrift142qu thrift1
42qu thrift1
 
Python 于 webgame 的应用
Python 于 webgame 的应用Python 于 webgame 的应用
Python 于 webgame 的应用
 
Continuous Delivery with Ansible x GitLab CI
Continuous Delivery with Ansible x GitLab CIContinuous Delivery with Ansible x GitLab CI
Continuous Delivery with Ansible x GitLab CI
 
141118 Raspberry Pi 電鈴工作坊@松山文創園區
141118 Raspberry Pi 電鈴工作坊@松山文創園區141118 Raspberry Pi 電鈴工作坊@松山文創園區
141118 Raspberry Pi 電鈴工作坊@松山文創園區
 
[1]投影片 futurewad樹莓派研習會 141120
[1]投影片 futurewad樹莓派研習會 141120[1]投影片 futurewad樹莓派研習會 141120
[1]投影片 futurewad樹莓派研習會 141120
 
Learning to Use Git | WeiYuan
Learning to Use Git | WeiYuanLearning to Use Git | WeiYuan
Learning to Use Git | WeiYuan
 
Docker 基礎介紹與實戰
Docker 基礎介紹與實戰Docker 基礎介紹與實戰
Docker 基礎介紹與實戰
 
A brief introduction to Vagrant – 原來 VirtualBox 可以這樣玩
A brief introduction to Vagrant – 原來 VirtualBox 可以這樣玩A brief introduction to Vagrant – 原來 VirtualBox 可以這樣玩
A brief introduction to Vagrant – 原來 VirtualBox 可以這樣玩
 

Plus de Chen-Yu Tsai

Putting Taiwan on the kernel.org Keysigning Map
Putting Taiwan on the kernel.org Keysigning MapPutting Taiwan on the kernel.org Keysigning Map
Putting Taiwan on the kernel.org Keysigning MapChen-Yu Tsai
 
Identifying and Supporting 'X-compatible' Hardware Blocks
Identifying and Supporting 'X-compatible' Hardware BlocksIdentifying and Supporting 'X-compatible' Hardware Blocks
Identifying and Supporting 'X-compatible' Hardware BlocksChen-Yu Tsai
 
Allwinner Kernel Upstreaming Experiences
Allwinner Kernel Upstreaming ExperiencesAllwinner Kernel Upstreaming Experiences
Allwinner Kernel Upstreaming ExperiencesChen-Yu Tsai
 
Upstream Allwinner ARM SoC (sunxi) Support
Upstream Allwinner ARM SoC (sunxi) SupportUpstream Allwinner ARM SoC (sunxi) Support
Upstream Allwinner ARM SoC (sunxi) SupportChen-Yu Tsai
 
linux-sunxi - OSDC.tw 2014 Lightning Talk
linux-sunxi - OSDC.tw 2014 Lightning Talklinux-sunxi - OSDC.tw 2014 Lightning Talk
linux-sunxi - OSDC.tw 2014 Lightning TalkChen-Yu Tsai
 
Open Standards and Open Source in Datacenter Management - OSDC.tw 2014
Open Standards and Open Source in Datacenter Management - OSDC.tw 2014Open Standards and Open Source in Datacenter Management - OSDC.tw 2014
Open Standards and Open Source in Datacenter Management - OSDC.tw 2014Chen-Yu Tsai
 

Plus de Chen-Yu Tsai (6)

Putting Taiwan on the kernel.org Keysigning Map
Putting Taiwan on the kernel.org Keysigning MapPutting Taiwan on the kernel.org Keysigning Map
Putting Taiwan on the kernel.org Keysigning Map
 
Identifying and Supporting 'X-compatible' Hardware Blocks
Identifying and Supporting 'X-compatible' Hardware BlocksIdentifying and Supporting 'X-compatible' Hardware Blocks
Identifying and Supporting 'X-compatible' Hardware Blocks
 
Allwinner Kernel Upstreaming Experiences
Allwinner Kernel Upstreaming ExperiencesAllwinner Kernel Upstreaming Experiences
Allwinner Kernel Upstreaming Experiences
 
Upstream Allwinner ARM SoC (sunxi) Support
Upstream Allwinner ARM SoC (sunxi) SupportUpstream Allwinner ARM SoC (sunxi) Support
Upstream Allwinner ARM SoC (sunxi) Support
 
linux-sunxi - OSDC.tw 2014 Lightning Talk
linux-sunxi - OSDC.tw 2014 Lightning Talklinux-sunxi - OSDC.tw 2014 Lightning Talk
linux-sunxi - OSDC.tw 2014 Lightning Talk
 
Open Standards and Open Source in Datacenter Management - OSDC.tw 2014
Open Standards and Open Source in Datacenter Management - OSDC.tw 2014Open Standards and Open Source in Datacenter Management - OSDC.tw 2014
Open Standards and Open Source in Datacenter Management - OSDC.tw 2014
 

Linux Kernel Patch Submission Tips