Sreekrishnan Venkateswaran has worked in IBM's Linux Product Development Labs for 10 years in Bangalore, Austin, Rochester and Raleigh. For the past six years he has been working on putting Linux on various devices like a wrist watch, a cell phone, an MP3 player, a PDA and a pacemaker. Prior to this, he developed ATM device drivers and networking protocols on AIX. He has also worked in software development for network processors and routers. Venkateswaran holds a Master's degree in Computer Science from the Indian Institute of Technology, Kanpur, India. He is currently a contributing editor and kernel columnist for Linux Magazine.
Foreword xxi
Preface xxiii
Acknowledgments xxix
About the Author xxx
Chapter 1 Introduction 1
Evolution 2
The GNU Copyleft 3
Kernelorg 4
Mailing Lists and Forums 4
Linux Distributions 5
Looking at the Sources 6
Building the Kernel 10
Loadable Modules 12
Before Starting 14
Chapter 2 A Peek Inside the Kernel 17
Booting Up 18
Kernel Mode and User Mode 30
Process Context and Interrupt Context 30
Kernel Timers 31
HZ and Jiffies 31
Long Delays 33
Short Delays 36
Pentium Time Stamp Counter 36
Real Time Clock 37
Concurrency in the Kernel 39
Spinlocks and Mutexes 39
Atomic Operators 45
Reader-Writer Locks 46
Debugging 48
Process Filesystem 49
Allocating Memory 49
Looking at the Sources 52
Chapter 3 Kernel Facilities 55
Kernel Threads 56
Creating a Kernel Thread 56
Process States and Wait Queues 61
User Mode Helpers 63
Helper Interfaces 65
Linked Lists 65
Hash Lists 72
Work Queues 72
Notifier Chains 74
Completion Interface 78
Kthread Helpers 81
Error-Handling Aids 83
Looking at the Sources 85
Chapter 4 Laying the Groundwork 89
Introducing Devices and Drivers 90
Interrupt Handling 92
Interrupt Context 92
Assigning IRQs 94
Device Example: Roller Wheel 94
Softirqs and Tasklets 99
The Linux Device Model 103
Udev 103
Sysfs, Kobjects, and Device Classes 106
Hotplug and Coldplug 110
Microcode Download 111
Module Autoload 112
Memory Barriers 114
Power Management 114
Looking at the Sources 115
Chapter 5 Character Drivers 119
Char Driver Basics 120
Device Example: System CMOS 121
Driver Initialization 122
Open and Release 127
Exchanging Data 129
Seek 136
Control 137
Sensing Data Availability 139
Poll 139
Fasync 142
Talking to the Parallel Port 145
Device Example: Parallel Port LED Board 146
RTC Subsystem 156
Pseudo Char Drivers 157
Misc Drivers 160
Device Example: Watchdog Timer 160
Character Caveats 166
Looking at the Sources 167
6556_Bookindb i6556_ix 3/4/08 9:31:21 AM
Chapter 6 Serial Drivers 171
Layered Architecture 173
UART Drivers 176
Device Example: Cell Phone 1...