contribute to linux...

30
Contribute To Linux Mainline Wu Zhangjin / Falcon [email protected] Tiny Lab – S/ http://tinylab.org June 3, 2013

Upload: others

Post on 17-Oct-2020

8 views

Category:

Documents


0 download

TRANSCRIPT

Page 1: Contribute To Linux Mainlinetinylab.org/wp-content/uploads/2013/06/how-to-contribute-to-linux-mainline.pdfGit Tips Merge another branch of the same git-repo git merge branch-name Pick

Contribute To Linux Mainline

Wu Zhangjin / [email protected]

Tiny Lab – 泰晓实验室http://tinylab.org

June 3, 2013

Page 2: Contribute To Linux Mainlinetinylab.org/wp-content/uploads/2013/06/how-to-contribute-to-linux-mainline.pdfGit Tips Merge another branch of the same git-repo git merge branch-name Pick

Outline

1 About Linux Kernel Development

2 Upstream your source code

3 Reference

4 APPENDIX

Page 3: Contribute To Linux Mainlinetinylab.org/wp-content/uploads/2013/06/how-to-contribute-to-linux-mainline.pdfGit Tips Merge another branch of the same git-repo git merge branch-name Pick

About Linux Kernel Development

Linux Introduction

Development Model

Release Frequency

Rate of Change

Kernel Source Size

Who is Doing the Work

Who is Sponsoring the Work

Linux Kernel Patch Statistic

NOTE: this ”Linux kernel development” part refers to the following paperhttp://www.linuxfoundation.org/publications/linuxkerneldevelopment.php

Page 4: Contribute To Linux Mainlinetinylab.org/wp-content/uploads/2013/06/how-to-contribute-to-linux-mainline.pdfGit Tips Merge another branch of the same git-repo git merge branch-name Pick

Linux Introduction

Launched at 1991

The original author: Linus

Linux is the kernel itself, don’t forget GNU project...

http://www.kernel.org

http://git.kernel.org

[email protected]

Page 5: Contribute To Linux Mainlinetinylab.org/wp-content/uploads/2013/06/how-to-contribute-to-linux-mainline.pdfGit Tips Merge another branch of the same git-repo git merge branch-name Pick

Development Model

From 2.6.x series,

Time-based release model

Releases happen every 2-3 months

Include new features and internal API changes

Relesae type:

mainline: 3.xx/-rcYstable: 3.xx.yylongterm (stable): 3.xx.yy, 2.6.xx.ylinux-next (merge conflicts fixup): next-YEARMONTHDAY

Page 6: Contribute To Linux Mainlinetinylab.org/wp-content/uploads/2013/06/how-to-contribute-to-linux-mainline.pdfGit Tips Merge another branch of the same git-repo git merge branch-name Pick

Development Model(cont.)

Release Types

mainline: 3.xx/-rcY, Linus Torvaldsgit://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git

stable and longterm: 3.xx.yy, Greg Kroah-Hartman and othersgit://git.kernel.org/pub/scm/linux/kernel/git/stable/linux-stable.git

linux-next, Stephen Rothwellgit://git.kernel.org/pub/scm/linux/kernel/git/next/linux-next.git

experimental patchsets

-mm, Andrew Mortonhttp://www.ozlabs.org/ akpm/mmotm/

patchworkhttp://patchwork.kernel.org/

Page 7: Contribute To Linux Mainlinetinylab.org/wp-content/uploads/2013/06/how-to-contribute-to-linux-mainline.pdfGit Tips Merge another branch of the same git-repo git merge branch-name Pick

Development Model(cont.)

Figure: Linux Kernel Release Cycle

Page 8: Contribute To Linux Mainlinetinylab.org/wp-content/uploads/2013/06/how-to-contribute-to-linux-mainline.pdfGit Tips Merge another branch of the same git-repo git merge branch-name Pick

Release Frequency

Figure: Frequency of kernel releases

Page 9: Contribute To Linux Mainlinetinylab.org/wp-content/uploads/2013/06/how-to-contribute-to-linux-mainline.pdfGit Tips Merge another branch of the same git-repo git merge branch-name Pick

Rate of Change

Figure: Changes per kernel release

Page 10: Contribute To Linux Mainlinetinylab.org/wp-content/uploads/2013/06/how-to-contribute-to-linux-mainline.pdfGit Tips Merge another branch of the same git-repo git merge branch-name Pick

Rate of Change

Figure: Changes per hour by kernel release

Page 11: Contribute To Linux Mainlinetinylab.org/wp-content/uploads/2013/06/how-to-contribute-to-linux-mainline.pdfGit Tips Merge another branch of the same git-repo git merge branch-name Pick

Kernel Source Size

Figure: Size per kernel release

Page 12: Contribute To Linux Mainlinetinylab.org/wp-content/uploads/2013/06/how-to-contribute-to-linux-mainline.pdfGit Tips Merge another branch of the same git-repo git merge branch-name Pick

Kernel Source Size

Figure: Rate of change by kernel release

Page 13: Contribute To Linux Mainlinetinylab.org/wp-content/uploads/2013/06/how-to-contribute-to-linux-mainline.pdfGit Tips Merge another branch of the same git-repo git merge branch-name Pick

Who is Doing the Work

Figure: Number of individual developers and employers

Page 14: Contribute To Linux Mainlinetinylab.org/wp-content/uploads/2013/06/how-to-contribute-to-linux-mainline.pdfGit Tips Merge another branch of the same git-repo git merge branch-name Pick

Who is Doing the Work

Figure: Individual kernel contributors

Page 15: Contribute To Linux Mainlinetinylab.org/wp-content/uploads/2013/06/how-to-contribute-to-linux-mainline.pdfGit Tips Merge another branch of the same git-repo git merge branch-name Pick

Who is Sponoring the Work

Figure: Companies working toward the improvement of the kernel

Page 16: Contribute To Linux Mainlinetinylab.org/wp-content/uploads/2013/06/how-to-contribute-to-linux-mainline.pdfGit Tips Merge another branch of the same git-repo git merge branch-name Pick

Linux Kernel Patch Statistic

WebSitehttp://www.remword.com/kps result/index.php

Page 17: Contribute To Linux Mainlinetinylab.org/wp-content/uploads/2013/06/how-to-contribute-to-linux-mainline.pdfGit Tips Merge another branch of the same git-repo git merge branch-name Pick

Upstream your source code

Clone a git tree

Code Reading

Coding Style

SCM

Git Tips

Code Test & Debug

Generate & Release your patches

Incorporate with feedbacks & Resend

Bug Report

Page 18: Contribute To Linux Mainlinetinylab.org/wp-content/uploads/2013/06/how-to-contribute-to-linux-mainline.pdfGit Tips Merge another branch of the same git-repo git merge branch-name Pick

Clone a git tree

Linux-official git treegit://git.kernel.org/pub/scm/ + project path

Subsystem specific git treeE.g. MIPS-specific git tree:git://git.linux-mips.org/pub/scm/linux

Clone a git tree, we use linux-mips as an examplegit clone git://git.linux-mips.org/pub/scm/linux linux-mips

Checkout the latest development branchgit remote add origin git://git.linux-mips.org/pub/scm/linux

git checkout -b branch-name –track origin/master

Page 19: Contribute To Linux Mainlinetinylab.org/wp-content/uploads/2013/06/how-to-contribute-to-linux-mainline.pdfGit Tips Merge another branch of the same git-repo git merge branch-name Pick

Code Reading

DocumentDocumentation/make help |grep doc

Tools

vim + cscope + ctags:help tag:help cs-findLXR: http://lxr.linux.no/linux

Page 20: Contribute To Linux Mainlinetinylab.org/wp-content/uploads/2013/06/how-to-contribute-to-linux-mainline.pdfGit Tips Merge another branch of the same git-repo git merge branch-name Pick

Coding Style

DocumentDocumentation/CodingStyle

Toolsindent -linux source-file:gqap

Page 21: Contribute To Linux Mainlinetinylab.org/wp-content/uploads/2013/06/how-to-contribute-to-linux-mainline.pdfGit Tips Merge another branch of the same git-repo git merge branch-name Pick

SCM

SCM toolsswitch cvs, svn to git

git & gitk & git-guiinit, fetch, pull, push, cherry-pick, merge, gchistory: git logstatus: git statusbasic op: add, commit, rm, mvpatch: diff, apply, am, format-patch, send-email

Page 22: Contribute To Linux Mainlinetinylab.org/wp-content/uploads/2013/06/how-to-contribute-to-linux-mainline.pdfGit Tips Merge another branch of the same git-repo git merge branch-name Pick

Git Tips

Merge another branch of the same git-repogit merge branch-name

Pick up a specific commit from another branchgit cherry-pick commit-name

Merge a branch from another local git repogit pull /path/to/git-repo branch-name

Rebase your commitsgit rebase -i commit-nameˆ

Rebase a branch onto mastergit rebase –onto master –root

Delete a remote branchgit push origin :branch

Recommendation: Get more tips from ’Git Usage: Hello, The GitWorld’, http://www.tinylab.org/git-usage-hello-the-git-world/

Page 23: Contribute To Linux Mainlinetinylab.org/wp-content/uploads/2013/06/how-to-contribute-to-linux-mainline.pdfGit Tips Merge another branch of the same git-repo git merge branch-name Pick

Code Test & Debug

DocumentDocumentation/SubmitChecklist

Testcompile with sparse, coccicheck, smatch ...run with lockdep detection, kmemleak detection ...module: insmod, rmmodcheck with Ftrace, Perf

Debugprintk, WARN ON, BUG ON, kgdb, kernel hackingVirtual Machine. E.g. qemuhardware-based, E.g. watchpoint, breakpoint

Page 24: Contribute To Linux Mainlinetinylab.org/wp-content/uploads/2013/06/how-to-contribute-to-linux-mainline.pdfGit Tips Merge another branch of the same git-repo git merge branch-name Pick

Generate & Release your patches

Generate patchesgit format-patch -s –cover-letter –thread commit1ˆ..commit2 –cc=”Name <[email protected]>”

Check&fix up your patchesDocumentation/SubmitChecklistscript/checkpatch.pl,cleanfile

Release your patchesConfig send-email: git config, man git-send-email(Sending)Get maintainers: ./scripts/get maintainer.pl

Send out your patch:git send-email –to=”LKML <[email protected]>” –cc=”Maintainers’ Email Address”

Page 25: Contribute To Linux Mainlinetinylab.org/wp-content/uploads/2013/06/how-to-contribute-to-linux-mainline.pdfGit Tips Merge another branch of the same git-repo git merge branch-name Pick

Incorporate with feedbacks & Resend

Who give feedbackMailing lists, http://vger.kernel.org/vger-lists.html

E-mails listed by ./scripts/get maintainer.pl

FeedbacksTest Report. E.g. Don’t work on x86Review, E.g. something is wrong.

Incorporate with feedbacksFix up patches and make a revision

Resend with feedback informationTested-by: ...Reviewed-by: ...Signed-off-by: ...

Page 26: Contribute To Linux Mainlinetinylab.org/wp-content/uploads/2013/06/how-to-contribute-to-linux-mainline.pdfGit Tips Merge another branch of the same git-repo git merge branch-name Pick

Bug report

Kernel Bug Trackerhttp://bugzilla.kernel.org/

Using Bugzillahttp://bugzilla.kernel.org/docs/en/html/using.html

Page 27: Contribute To Linux Mainlinetinylab.org/wp-content/uploads/2013/06/how-to-contribute-to-linux-mainline.pdfGit Tips Merge another branch of the same git-repo git merge branch-name Pick

References

Linux kernel Development:http://www.linuxfoundation.org/publications/linuxkerneldevelopment.php

Linux Kernel Development: Getting Started

Documentation/SubmittingPatches

Documentation/SubmittingDrivers

Documentation/SubmitChecklist

http://vger.kernel.org/vger-lists.html

Page 28: Contribute To Linux Mainlinetinylab.org/wp-content/uploads/2013/06/how-to-contribute-to-linux-mainline.pdfGit Tips Merge another branch of the same git-repo git merge branch-name Pick

Contribute to GNU Toolchain

Coding Style: totally differs from Linuxindent -gnu

Mailing listGcc: http://gcc.gnu.org/lists.htmlBinutils: http://www.gnu.org/software/binutils/

Git Repository or Git MirrorGcc: git://gcc.gnu.org/git/gcc.gitBinutils: git://github.com/bneumeier/binutils.git

Bug TrackingGcc: http://gcc.gnu.org/bugzilla/Binutils: http://sourceware.org/bugzilla/

Page 29: Contribute To Linux Mainlinetinylab.org/wp-content/uploads/2013/06/how-to-contribute-to-linux-mainline.pdfGit Tips Merge another branch of the same git-repo git merge branch-name Pick

Contribute to GNU Toolchain(cont.)

Upstream your patch

Make your patch acceptable

Cleanup your patch and test itSend it to the maintainer of the subsystemIncoporate with the feedbacks

Assign your copyright to FSF

Page 30: Contribute To Linux Mainlinetinylab.org/wp-content/uploads/2013/06/how-to-contribute-to-linux-mainline.pdfGit Tips Merge another branch of the same git-repo git merge branch-name Pick

Thank You!