https://www.kernel.org/ 查看 Latest Stable Kernel 4.0.2
1. 獲取倉庫
Linux kernel 的官方 GIT地址是:
穩定的倉庫: http://git.kernel.org/cgit/linux/kernel/git/stable/linux-stable.git
git clone git://git.kernel.org/pub/scm/linux/kernel/git/stable/linux-stable.git
Linus 大神在維護的主線: https://git.kernel.org/cgit/linux/kernel/git/torvalds/linux.git
可以從這個地址拿到 kernel 的 代碼倉庫。
git clone git://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
2. 查看狀態,查看分支信息:
git status
On branch master
Your branch is up-to-date with 'origin/master'.
<pre code_snippet_id="661066" snippet_file_name="blog_20150507_3_6650190" name="code" class="cpp"><pre name="code" class="cpp"><pre name="code" class="cpp"><pre name="code" class="cpp">git branch -av
* master 5ebe6af Linux 4.1-rc2
remotes/origin/HEAD -> origin/master
remotes/origin/linux-2.6.11.y 8e63197 Linux 2.6.11.12
remotes/origin/linux-2.6.12.y d04a379 Linux 2.6.12.6
remotes/origin/linux-2.6.13.y 816e9c6 Linux 2.6.13.5
remotes/origin/linux-2.6.14.y 789f444 Linux 2.6.14.7
remotes/origin/linux-2.6.15.y f70602f Linux 2.6.15.7
remotes/origin/linux-2.6.16.y 6b0daf9 Linux 2.6.16.62
remotes/origin/linux-2.6.17.y 78ace17 Linux 2.6.17.14
remotes/origin/linux-2.6.18.y 299a247 Linux 2.6.18.8
remotes/origin/linux-2.6.19.y 09780ab Linux 2.6.19.7
remotes/origin/linux-2.6.20.y f3815da Linux 2.6.20.21
remotes/origin/linux-2.6.21.y a31a903 Linux 2.6.21.7
remotes/origin/linux-2.6.22.y 37579d1 Linux 2.6.22.19
remotes/origin/linux-2.6.23.y 6531868 Linux 2.6.23.17
remotes/origin/linux-2.6.24.y 928bb8c Linux 2.6.24.7
remotes/origin/linux-2.6.25.y 00935da Linux 2.6.25.20
remotes/origin/linux-2.6.26.y 63e0e67 Linux 2.6.26.8
remotes/origin/linux-2.6.27.y bc4e1a7 Linux 2.6.27.62
remotes/origin/linux-2.6.28.y 5861c85 Linux 2.6.28.10
remotes/origin/linux-2.6.29.y 1201010 Linux 2.6.29.6
remotes/origin/linux-2.6.30.y 0d0675c Linux 2.6.30.10
remotes/origin/linux-2.6.31.y a389e98 Linux 2.6.31.14
remotes/origin/linux-2.6.32.y 3bd0d1a Linux 2.6.32.65
remotes/origin/linux-2.6.33.y 86a7052 Linux 2.6.33.20
remotes/origin/linux-2.6.34.y 5878e06 Linux 2.6.34.15
remotes/origin/linux-2.6.35.y 675f766 release 2.6.35.14
remotes/origin/linux-2.6.36.y 69ad303 Linux 2.6.36.4
remotes/origin/linux-2.6.37.y e396c9d8 Linux 2.6.37.6
remotes/origin/linux-2.6.38.y 4b7a6d2 Linux 2.6.38.8
remotes/origin/linux-2.6.39.y ea0dc0d Linux 2.6.39.4
remotes/origin/linux-3.0.y 5dba9dd Linux 3.0.101
remotes/origin/linux-3.1.y 9bb1282 Linux 3.1.10
remotes/origin/linux-3.10.y 9182148 Linux 3.10.77
remotes/origin/linux-3.11.y 5ee54f3 Linux 3.11.10
remotes/origin/linux-3.12.y 6d4397a Linux 3.12.42
remotes/origin/linux-3.13.y 2d20120 Linux 3.13.11
remotes/origin/linux-3.14.y 99e64c4 Linux 3.14.41
remotes/origin/linux-3.15.y f35b5e4 Linux 3.15.10
remotes/origin/linux-3.16.y d0335e4 Linux 3.16.7
remotes/origin/linux-3.17.y bc15d46 Linux 3.17.8
remotes/origin/linux-3.18.y 72d391f Linux 3.18.13
remotes/origin/linux-3.19.y 7214c55 Linux 3.19.7
remotes/origin/linux-3.2.y 9b81446 Linux 3.2.68
remotes/origin/linux-3.3.y 8457206 Linux 3.3.8
remotes/origin/linux-3.4.y 56b48fc Linux 3.4.107
remotes/origin/linux-3.5.y f2b1525 Linux 3.5.7
remotes/origin/linux-3.6.y b2824f4 Linux 3.6.11
remotes/origin/linux-3.7.y 356d8c6 Linux 3.7.10
remotes/origin/linux-3.8.y dbf932a Linux 3.8.13
remotes/origin/linux-3.9.y 896f500 Linux 3.9.11
remotes/origin/linux-4.0.y 072cab6 Linux 4.0.2
remotes/origin/master 5ebe6af Linux 4.1-rc2
3. 切換到分支到4.0.2:C
git checkout linux-4.0.y
Switched to branch 'linux-4.0.y'
4. 更新本地的代碼:
git feach origin
git meage origin/linux-4.0.y
5. 創建一個屬於自己的新分支:
git checkout -b linux-4.0.y-joe
然後就可以開始查看代碼和進行本地修改了。
參考文檔:http://www.opensourceforu.com/2011/05/linux-kernel-development-using-git/
源代碼閱讀 http://lxr.linux.no/linux