在 Ubuntu 上面安裝 mainline kernels - Linux

Erin avatar
By Erin
at 2014-07-15T14:25

Table of Contents

所謂的 mainline kernels 就是在 The Linux Kernel Archives [1] 上面由 Linus
Torvalds 本人釋出的版本, 而 Ubuntu 本來有一個 Ubuntu Kernel PPA 專門用來編譯
這些 mainline kernels, 只是後來不曉得為何就不再使用 PPA 改用手動編譯的方式,
可能是因為 Linux kernel 的釋出方式有了許多變化,除了原本的 stable 跟 mainline
還另加入了 longterm 的支援, 而 Ubuntu 的 Kernel team 本來就有準備一個
http://kernel.ubuntu.com/~kernel-ppa/mainline/ 上面備份了所有的 mainline
kernels, 所以就繼續沿用這樣的名稱,但其實這上面還包括了 stable 跟 longterm 後
來所有的版本。

總之 http://kernel.ubuntu.com/~kernel-ppa/mainline/ 上面放的是沒有 Ubuntu 額外
加料的原始 kernel 版本,只是都編譯成了 Debian package, 所以想要使用的人可以直
接下載來安裝就可以使用了,而這些 kernel 如果在安裝上會是使用上有什麼問題,當然
也不會在 Ubuntu 的支援之中,這些 kernel 的存在只是用來測試的,藉由安裝不同的版
本來找出問題是在哪兩個版本之間發生的,或是在哪兩個版本之間解決的,進而幫助開發
者縮小問題發生的地方,來找出相關合適的修補檔。

但是這樣不斷地手動下載安裝,也是很麻煩的,所以我寫了一個小工具來幫忙,它就叫做
mainline-kernels.sh [2],下載後像下面這樣執行就可以看到使用說明:

$ ./mainline-kernels.sh --help
Usage ./mainline-kernels.sh:
-h|--help The manual of this script
-f|--from NUM Lower bound of kernel version
-t|--to NUM Upper bound of kernel version
-l|--list List available kernel versions
-r|--remove Remove mainline kernels

可以先使用 ./mainline-kernels.sh --list 來找出現在有哪些 kernel 可以使用。

$ ./mainline-kernels.sh --list
...
3.15~rc3-utopic 3.15~rc4-utopic 3.15~rc5-utopic
3.15~rc6-utopic 3.15~rc7-utopic 3.15~rc8-utopic
3.15-utopic 3.15.1-utopic 3.15.2-utopic
3.15.3-utopic 3.15.4-utopic 3.15.5-utopic
3.16~rc1-utopic 3.16~rc2-utopic 3.16~rc3-utopic

然後直接安裝想要的 Linux kernel

$ ./mainline-kernels.sh 3.16~rc4-utopic 3.16~rc5-utopic

或是指定一個範圍來安裝

$ ./mainline-kernels.sh --from 3.15~ --to 3.16

或是什麼都不指定直接執行,之後再慢慢從選單上面挑選。

$ ./mainline-kernels.sh

最後再將安裝的 Linux kernel 移除掉。

$ ./mainline-kernels.sh --remove

要提醒的一點是,這邊的版本號碼是遵循 Debian version 的規則,所以波浪符號有特別
的意義,可以參考我以前的文章[3]。

最後分享一下 Ubuntu to Mainline kernel version mapping [4],結束這一回合。

[1]: https://www.kernel.org/
[2]: https://bit.ly/mainline_kernels
[3]: http://fourdollars.blogspot.com/2010/06/debian-package-5.html
[4]: http://people.canonical.com/~kernel/info/kernel-version-map.html

--
http://about.me/fourdollars

--
Tags: Linux

All Comments

Caitlin avatar
By Caitlin
at 2014-07-18T12:48
推一個
Necoo avatar
By Necoo
at 2014-07-19T17:32
少有的文刊
Tracy avatar
By Tracy
at 2014-07-23T03:03
cool, push!
Puput avatar
By Puput
at 2014-07-26T06:24
推推, 對於想自幹原味 kernel 的人來說很有幫助
Frederica avatar
By Frederica
at 2014-07-29T23:44
推薦文章。
Rachel avatar
By Rachel
at 2014-08-01T08:18
推!看起來很方便
Margaret avatar
By Margaret
at 2014-08-04T00:28
nice tool!!

Slax 7.0.8

Dorothy avatar
By Dorothy
at 2014-07-15T01:08
剛剛在virtualbox上面試了一下 以光碟開機的話 開機後打開dolphin會有個Slax CD 這裡面有slax的程式 但是要自己做格式化把硬碟分配好 我是先用fdisk把硬碟切割以後mkfs -t ext3 /dev/sda1 之後mount -t ext3 /dev/sda1 /media ...

Slax 7.0.8

Odelette avatar
By Odelette
at 2014-07-14T23:21
不好意思 想請問 現在有一台小筆電(目前是XP) 然後想要安裝SLAX (不要用隨身碟或光碟開機) 直接安裝在硬碟上 我的步驟是要 1. 把XP格式化 2. 把SLAX先安裝到USB上 3. 用小筆電插USB用USB開機後 可以直接從USB在安裝到硬碟上嗎? 之前有看到 好像說5.X版有選項 ...

灌完NetworkManager之後,xfce的權限問題

Ingrid avatar
By Ingrid
at 2014-07-14T20:57
最近開始在玩Gentoo,source版本是hardened 3.14, 依據官方的教學一直裝到xwindows的部份 不過compile kernel的部份用genkernel很快的做過了 剛灌好xfce時,進入xwindows後,剛開始很美好, 裝好中文字形,酷音輸入法,把terminal也換掉後,想說 ...

fsck died with exit status 8

Callum avatar
By Callum
at 2014-07-14T20:51
安安 各位大德 小弟對Linux不是很熟,但網站出問題我要負責orz 目前遇到了問題如連結: http://goo.gl/6qXPB8 我照關鍵字查詢 fsck died with exit status 8 或 unrecoverable error reading M ...

Win 8.1 -> Linux Mint 17 LIVE 黑屏

Yedda avatar
By Yedda
at 2014-07-14T18:09
好不容易載了 ISO 然後有做成 USB 開機碟 然後爬文看了硬碟空間分配 分配完想要安裝 結果開機都無法進入到 LIVE 裡面,選單選完 Linux Mint 就黑屏沒再跑了 我 Fast boot, Security boot 都關了還是不行 我也不知道怎麼弄 http://goo.gl/WUjsqc ...