作者weii (迷惑失道)
看板SFFamily
标题[转录][心得] 十本 Linux 核心开发书籍介绍
时间Mon Mar 21 14:07:59 2011
※ [本文转录自 LinuxDev 看板 #1DWbDT_v ]
作者: rextsai (Rex Tsai) 看板: LinuxDev
标题: [心得] 十本 Linux 核心开发书籍介绍
时间: Fri Mar 18 02:30:51 2011
※ [本文转录自 Linux 看板 #1DWUdB-o ]
作者: rextsai (Rex Tsai) 看板: Linux
标题: [心得] 十本 Linux 核心开发书籍介绍
时间: Thu Mar 17 19:00:22 2011
网页版:
http://bit.ly/hJL3gJ
[2] 十本 Linux 核心开发书籍介绍
「利益揭露: 本文英文书籍连接使用 [3]Amazon Associates Program.」
我相信绝大部分 Linux 开发者都会告诉你,Driver 的开发比 Linux Application 容易许
多,即便写驱动程式听起来莫名伟大,其实也不过是一段 C/assembly 的组合程式码。有
别於桌面应用程式,Linux kernel API 较少因?不同的新软硬体规格,而进行大幅度 API
更动 (参数的简化倒是十分常见),且由杰出的软体开发者撰写的核心架构,稳定性已经十
分可靠。
相较与 userland 高度复杂的设定机制,Linux Kernel 暴露的界面十分简单,在硬体稳定
的前提之下,你也难得碰到 API 反应与预期不符合的处境。一般开发者对於核心驱动程式
上手的时间,应该不会比开发桌面软体来的更久。花费时间较多应该是研读硬体手册,以
及不严谨的开发习惯造成臭虫而所需的除错时间。
对於深具经验的开发者,在学习开发 Linux kernel driver 时,最快的方法莫过於直接解
开 Kernel tarbar, 切进欲开发的 subsystem 目录,拿出 [4]global, [5]vim, [6]LXR
直接把现成程式码当作范例学习,很快就可以理解程式结构。不过,偶尔还是需要参考书
来验证对於架构得理解是否正确,另外接触新的 subsystem 时先阅读入门文章也可以减少
无谓的撞墙期。
所幸,几位 Linux kernel hacker 也是杰出的文件作者。在 Linux kernel sourc tree
中已有一些各子系统的架构、操作参考文件,涵盖了基本的 coding style、设计哲学等。
另外,像是 [7]Robert Love, [8]Greg Kroah-Hartman (PCI, USB maintainer) 等开发者
也出版了完整的书籍,很值得参考。
不过市面上针对 Linux kernel 开发的书籍也不少,那一本是适合你的呢?这类的技术书
籍,通常设定不同的读者?来设定内容,有的偏重知识,有的偏重操作实务。且出版版次
也会影响所介绍的 API 差异,造成无法编译其范例,但并非旧书,所谈之理论就不正确。
以下分享不才对於市面上 2005 年之後出版的[9]核心开发书籍的评论,希望对於想扩充团
队图书馆的朋友提供些参考。
[10][9780596100797-]
[11]Linux Kernel in a Nutshell 是 2006 年年底发行,作者是 GregKH,使用核心为
2.6.18,部分操作方式或指令已经略有更改。GregKH 基於让更多新手参与开发行列,针对
的读者是从未编译过 Linux kernel,想了解下载、设定、编译需求等等细节,适合刚从其
他平台进入 Linux 核心开发的朋友,可以较快熟悉核心编译的操作程序。书内主要介绍通
用性知识,因此未提各 distro 间安装 kernel 的细节 (如 initrd 建制方式)。
LKN 已采 [12]CC BY-SA 2.5 授权。电子书可於 GregKH 的[13]网页下载。
[14][0596005652]
[15]Understanding the Linux Kernel, Third Edition* 这本由两位博士 Daniel P.
Bovet 与 [16]Marco Cesati 所撰写,从 2000 年底出版之後,到 2005 已经是第三版,
介绍的核心是 2.6.24。有[17]中译版。
此书结构以流水帐方式带过各个子系统,但稍嫌肤浅的仅仅介绍表面的细节,未能给予概
观性的理论说明,也未能直指程式核心。篇幅常用於注记资料结构或函式用途,适合想寻
着面包屑理解 Linux kernel 运作的探险家使用。
[18][0470343435]
[19]Professional Linux Kernel Architecture 在2008 年出版,作者是 Wolfgang
Mauerer,作者的背景是量子物理学家。在没有社群内知名开发者的背书与协助下,他完成
了一本巨大的书籍,篇幅高达 1368 页。
有别於 UTLK,也许是为了非科班出生的读者,作者试着详尽的叙述作业系统的基本概念,
另外一方面也以程式码告诉读者 Linux 的运作模式。
如果你读不下纯粹理论导向的作业系统教科书,而想透过 Linux理解一个作业系统的设计
原理,这是适合你的书。本书基於 Linux kernel 2.6.24.
[20][0672329468]
身为知名的 kernal hacker, [21]Robert Love 在 [22]Linux Kernel Development (3rd
Edition) 一书中为读者拆解 Linux kernel source tree, 直接从设计理念切入,酌以程
式码辅助,读者需要有作业系统理论素养以及 Linux 开发经验,才能消化理解笔者的解剖
。最新第三版发表於 2010 年初版,更新到 2.6.34.
简体中译版 [23]Linux ?核??与??翻译自 Linux Kernel Development 第二版。正体
中文版有维科图书有限公司出版沈中庸, 沈彦男翻译的 [24]Linux 核心开发指南, 2/e。
[25][0596002556]
[26]Linux Network Internals 的作者是 [27]Christian Benvenuti,发表於 2005 年。
少数专谈 Linux Network stacks 的书籍,作者循序的从设定工具、核心启动开始,逐一
介绍封包传送接受、Bridging、IPv4、Neighboring Subsystem 与 Routing。
书中涵盖了 Layer 2, Layer 3 等协定, 可惜遗漏了 IPv6, IGMP, PIM, Traffic
Control, [28]Netfilter, Virtual devices (802.1Q, bonding, IPIP, GRE) 等等重要原
件。读者需要基本开发能力与网路协定常识。此书有[29]中译版。
[30][1584504811]
[31]The Linux TCP/IP Stack: Networking for Embedded Systems [32]第一版发表与
2004 年,最新[33]第二版 2006 年,针对的版本是 2.6.16,作者是 Thomas F. Herbert
。此书对於读者的定位不明。虽然意图以一个章节讨论嵌入式系统中的 TCP/IP Stack,但
除了说明一般嵌入式系统需求外,缺乏实际有用资讯。
书籍想涵盖各种 TCP/IP Stack 所涵盖的项目,但章节设计杂乱,从基本的 Network
Stack 开始介绍,对於 API 部分又缺乏系统性描述。既无法了解网路协定,或撰写网路程
式或作业系统核心架构。
书中时常夹杂叙述与程式码,令读者难以连贯消化,读者需要开启原始程式码才能领会作
者的。这是一本关於网路协定的原始码注记,适合已具核心开发经验的开发者参考使用,
考量其版本日期,书籍的功能可能比自行追踪程式码的效用还差。另外,若你想了解嵌入
式系统,这也不是你该买的书。
[34][0596005903]
[35]Linux Device Drivers, 3rd Edition* 的作者是 [36]Jonathan Corbet ([37]LWN 的
[38]创办人)、[39]Alessandro Rubini、[40]Greg Kroah-Hartman。即便 LDD3 已经出版
许久,还是所有想写 Linux kernel driver 的第一优先入门参考书阿。此书有[41]中译版
。
LDD3 务实的从实做范例开始,带领读者理解各种 subsystem,含括了入门操作与基本观念
,对於初次开发 lkm 的开发者提供了灯塔般的指引。
LDD3 授权采 [42]CC BY-SA 2.0,线上版可於此下载 [43]
http://lwn.net/Kernel/LDD3/
。但由於书籍年代较久,针对的核心版本为 2.6.10,书中范例需要一点调整才能正常运作
。已有同好改了几份摆在 github ([44]jesstess, [45]martinezjavier).
[46][0132396556]
[47]Essential Linux Device Drivers 的作者是长期在 IBM 工作的 [48]Sreekrishnan
Venkateswaran,参与 [49]Linux Watch, [50]PDA, [51]Nurse Call Systems, [52]
Merlin Patient Care System 等等开发专案。有正体中译版 [53]Linux驱动程式开发实战
以及简体中译版 [54]精通Linux驱动程序开发。
这本书是作者的实务工程笔记,出版於 2008 年,针对核心为 2.6.23/2.6.24,透过此书
新手可以从中漫游一个深具经验的开发者,如何从原始码迷雾之中理解 Linux device
driver,老手或可从杂乱的描述中再次验证自己的理解。
虽然篇幅高达 744 页,却被引用程式码占了许多页面。这本书不足以提供开发者撰写驱动
程式的基本观念,也无法协助理解作业系统概观。
作者另有一小册 [55]Debugging Linux Systems 电子书短短九十页,带过几个常见的核心
除错工具与技巧,很有实务参考价值。
[56][0131181637]
[57]《The Linux(R) Kernel Primer: A Top-Down Approach for x86 and PowerPC
Architectures》出版於 2005 年,作者是 Claudia Salzberg Rodriguez, Gordon
Fischer, Steven Smolski。有[58]中文版,但[59]评价颇差。
书名让人非常期待总算有一本核心介绍书籍 x86 外的硬体平台,毕竟 [60]RISC vs [61]
CISC 架构的不同, [62]endianness, [63]alignment, [64]calling convention 等,应当
有许多写核心驱动程式应该注意得事项。但是整本书只在 2.2 节稍微说一下写 Assembly
时,PowerPC, x86 的指令差异,剩下的细节根本没提!
整本书还是着重在一般核心的结构介绍。
而书中除了少量的插图之外,根本没有没有多少逻辑上的说明跟描述。通篇拆解程式码,
对资料结构作注解。这些资讯任何有点基础的工程师都可自行阅读程式码及程式码注解。
新入门工程师还可能因?书中解释而疑惑。
除非你想写没有价值的书评,否则不建议购买。
[65][0131492470]
[66]Linux(R) Debugging and Performance Tuning: Tips and Techniques 出版於 2005,
作者是 Steve Best。此书少见的从除了应用程式之外,还从核心切入的除错、效能测试书
籍,因?这方面的技术资讯总是一下就超过保鲜期。
作者试着含括基本的 Profiling 实务开始,介绍 gdb, 应用程式记忆体管理,再讲核心的
各种资讯界面。很可惜,以一本专讲除错与效能测试的书来说,范例与介绍过於粗浅,以
第十二章 Dynamic Probes 为例,其介绍深度可能还比不上 [67]Documents/kprobes.txt
中的概念介绍与 IBM developerWorks 的[68]范例介绍。
适合刚切换到 Linux 的开发者,可概略学得各种基本开发工具者的入门资讯。
2011-03-17 18:00 更新
增列相关中译版本连接,感谢 [69]ansoncat 告知资讯。
References:
[1]
http://people.debian.org.tw/~chihchun
[2]
http://people.debian.org.tw/~chihchun/2011/03/17/10-linux-kernel-books/
[3]
http://en.wikipedia.org/wiki/Amazon_Affiliates#Third-party_sellers
[4]
http://www.gnu.org/software/global/
[5]
http://www.vim.org/
[6]
http://lxr.linux.no/
[7]
http://blog.rlove.org/
[8]
http://www.kroah.com/linux/
[9]
http://www.anobii.com/chihchun/books/?filterType=3&filterValue=7&tagPage=1&doScroll=true
[10]
http://www.amazon.com/gp/product/0596100795?ie=UTF8&tag=rexsblahblahb-20&linkCode=as2&camp=1789&creative=390957&creativeASIN=0596100795
[11]
http://www.amazon.com/gp/product/0596100795?ie=UTF8&tag=rexsblahblahb-20&linkCode=as2&camp=1789&creative=390957&creativeASIN=0596100795
[12]
http://creativecommons.org/licenses/by-sa/2.5/
[13]
http://www.kroah.com/lkn/
[14]
http://www.amazon.com/gp/product/0596005652?ie=UTF8&tag=rexsblahblahb-20&linkCode=as2&camp=1789&creative=390957&creativeASIN=0596005652
[15]
http://www.amazon.com/gp/product/0596005652?ie=UTF8&tag=rexsblahblahb-20&linkCode=as2&camp=1789&creative=390957&creativeASIN=0596005652
[16]
http://www.sprg.uniroma2.it/home/cesati/
[17]
http://www.anobii.com/books/LINUX%E6%A0%B8%E5%BF%83%E8%A9%B3%E8%A7%A3%EF%BC%88%E4%B8%89%E7%89%88%EF%BC%89/9789867794833/01a1519d5282b63a4a/
[18]
http://www.amazon.com/gp/product/0470343435?ie=UTF8&tag=rexsblahblahb-20&linkCode=as2&camp=1789&creative=390957&creativeASIN=0470343435
[19]
http://www.amazon.com/gp/product/0470343435?ie=UTF8&tag=rexsblahblahb-20&linkCode=as2&camp=1789&creative=390957&creativeASIN=0470343435
[20]
http://www.amazon.com/gp/product/0672329468?ie=UTF8&tag=rexsblahblahb-20&linkCode=as2&camp=1789&creative=390957&creativeASIN=0672329468
[21]
http://rlove.org/
[22]
http://www.amazon.com/gp/product/0672329468?ie=UTF8&tag=rexsblahblahb-20&linkCode=as2&camp=1789&creative=390957&creativeASIN=0672329468
[23]
http://www.books.com.tw/exep/prod/china/chinafile.php?item=CN10623111
[24]
http://www.anobii.com/books/Linux_%E6%A0%B8%E5%BF%83%E9%96%8B%E7%99%BC%E6%8C%87%E5%8D%97,_2e/9789867503084/01f52037ae93f55382/
[25]
http://www.amazon.com/gp/product/0596002556?ie=UTF8&tag=rexsblahblahb-20&linkCode=as2&camp=1789&creative=390957&creativeASIN=0596002556
[26]
http://www.amazon.com/gp/product/0596002556?ie=UTF8&tag=rexsblahblahb-20&linkCode=as2&camp=1789&creative=390957&creativeASIN=0596002556
[27]
http://benve.info/
[28]
http://www.netfilter.org/
[29]
http://www.oreilly.com.tw/product2_linux.php?id=a204
[30]
http://www.amazon.com/gp/product/1584504811?ie=UTF8&tag=rexsblahblahb-20&linkCode=as2&camp=1789&creative=390957&creativeASIN=1584504811
[31]
http://www.amazon.com/gp/product/1584504811?ie=UTF8&tag=rexsblahblahb-20&linkCode=as2&camp=1789&creative=390957&creativeASIN=1584504811
[32]
http://www.amazon.com/gp/product/1584502843?ie=UTF8&tag=rexsblahblahb-20&linkCode=as2&camp=1789&creative=390957&creativeASIN=1584502843
[33]
http://www.amazon.com/gp/product/1584504811?ie=UTF8&tag=rexsblahblahb-20&linkCode=as2&camp=1789&creative=390957&creativeASIN=1584504811
[34]
http://www.amazon.com/gp/product/0596005903?ie=UTF8&tag=rexsblahblahb-20&linkCode=as2&camp=1789&creative=390957&creativeASIN=0596005903
[35]
http://www.amazon.com/gp/product/0596005903?ie=UTF8&tag=rexsblahblahb-20&linkCode=as2&camp=1789&creative=390957&creativeASIN=0596005903
[36]
http://www.oreillynet.com/pub/au/592
[37]
http://lwn.net/
[38]
http://en.wikipedia.org/wiki/LWN.net
[39]
http://www.linux.it/~rubini/
[40]
http://www.kroah.com/linux/
[41]
http://www.oreilly.com.tw/product_linux.php?id=a184_toc
[42]
http://creativecommons.org/licenses/by-sa/2.0/
[43]
http://lwn.net/Kernel/LDD3/
[44]
https://github.com/jesstess/ldd3-examples/
[45]
https://github.com/martinezjavier/ldd3
[46]
http://www.amazon.com/gp/product/0132396556?ie=UTF8&tag=rexsblahblahb-20&linkCode=as2&camp=1789&creative=390957&creativeASIN=0132396556
[47]
http://www.amazon.com/gp/product/0132396556?ie=UTF8&tag=rexsblahblahb-20&linkCode=as2&camp=1789&creative=390957&creativeASIN=0132396556
[48]
http://elinuxdd.com/~elinuxdd/elinuxdd.docs/aboutme.html
[49]
http://www.research.ibm.com/WearableComputing/linuxwatch/linuxwatch.html
[50]
http://www.linuxfordevices.com/c/a/Linux-For-Devices-Articles/Device-Profile-CDL-Paron-secure-PDA/
[51]
http://www.hill-rom.com/usa/NaviCare_NurseCall.htm
[52]
http://www.linuxfordevices.com/c/a/Linux-For-Devices-Articles/Device-Profile-Merlin-Patient-Care-System/
[53]
http://www.anobii.com/books/Linux%E9%A9%85%E5%8B%95%E7%A8%8B%E5%BC%8F%E9%96%8B%E7%99%BC%E5%AF%A6%E6%88%B0/9789866348174/017600ce73d44ab65e/
[54]
http://www.anobii.com/books/Essential_Linux_device_drivers/9787115206473/019c9e0bf8b5932e5f/
[55]
http://www.anobii.com/books/Debugging_Linux_Systems/9780136123545/01c4d74310f48c2430/
[56]
http://people.debian.org.tw/~chihchun/wp-content/uploads/2011/03/0131181637.jpg
[57]
http://www.amazon.com/gp/product/0131181637/ref=as_li_ss_tl?ie=UTF8&tag=rexsblahblahb-20&linkCode=as2&camp=1789&creative=390957&creativeASIN=0131181637
[58]
http://www.anobii.com/books/The_Linux_Kernel_Primer_%E4%B8%AD%E6%96%87%E7%89%88/9789867199614/013342e1203c95f23a/
[59]
http://joyueng.twbbs.org/2006/12/31/the-linux-kernel-primer-chinese-edition/
[60]
http://en.wikipedia.org/wiki/Reduced_instruction_set_computing
[61]
http://en.wikipedia.org/wiki/Complex_instruction_set_computing
[62]
http://en.wikipedia.org/wiki/Endianness
[63]
http://en.wikipedia.org/wiki/Data_structure_alignment
[64]
http://en.wikipedia.org/wiki/Calling_convention
[65]
http://www.amazon.com/gp/product/0131492470/ref=as_li_ss_tl?ie=UTF8&tag=rexsblahblahb-20&linkCode=as2&camp=1789&creative=390957&creativeASIN=0131492470
[66]
http://www.amazon.com/gp/product/0131492470/ref=as_li_ss_tl?ie=UTF8&tag=rexsblahblahb-20&linkCode=as2&camp=1789&creative=390957&creativeASIN=0131492470
[67]
http://www.kernel.org/doc/Documentation/kprobes.txt
[68]
http://www.ibm.com/developerworks/library/l-kprobes.html
[69]
http://blog.ansoncat.com/
--
http://people.debian.org.tw/~chihchun/
--
※ 发信站: 批踢踢实业坊(ptt.cc)
◆ From: 112.104.53.166
1F:推 wyvernlee:能看完这些书还写书评真是太强大了.. 03/17 20:10
2F:推 icycandle:感激 03/17 21:05
3F:推 scribeTW:强大,我只看过The Linux Kernel Primer,这本真的不太推 03/17 22:30
4F:→ scribeTW:理由是它也只带你看程式码,没有给个更具体的概念,难懂 03/17 22:37
5F:→ james732:真的不推The Linux Kernel Primer +1 03/18 00:25
6F:推 trashprince:太感谢了 最近刚好再找参考书 03/18 02:08
--
※ 发信站: 批踢踢实业坊(ptt.cc)
◆ From: 112.104.53.166
7F:推 madoka82:感谢提供的资讯... 03/18 15:14
8F:→ clampsakura:赞... 03/19 00:54
9F:推 goldie:感恩 03/20 00:00
--
我爱用UD
我希望Blizzard可以让nec招换出来的骷髅兵强壮一点
最好身高一米九 一拳三百磅
不然骷髅兵实在太废~
--
※ 发信站: 批踢踢实业坊(ptt.cc)
◆ From: 220.132.117.169