Return to Training Programs


Course-Number: ATR-004

Course-Description: Linux Kernel Internals Plus Device Drivers

Duration of course: 5 days

Course Description:

This 5-day course introduces key concepts and functions of the Linux Kernel. This is an absolutely necessary course for Systems Engineers, Architects and Programmers working in the areas of porting applications from any environment into Linux, device driver writers, and engineers working to extend the linux kernel in areas like Virtual File Systems, Advanced I/O and System Calls.

Starting from absolute basics such as an introduction to the Linux Kernel and its components, the course describes how tocompile a new kernel and install it. It describes in detail the booting process, the root file system and device I/O. The course then covers Process Management and the important data structures maintained by the kernel for the creation, management and deletion of processes. It looks at how System Calls are implemented and how to create a new System Call.

The course looks at Memory Management in great detail. It describes Real-Mode to Protected Mode transition and the Intel 32-bit Protected Mode Architecture. The course teaches the different memory addresses available such as Physical Memory, Virtual Memory, Bus-addresses, DMA etc.

The course then looks at a detailed description of File Systems. It looks into the Virtual File System Switch, Registering new file systems, mounting/unmounting, Superblocks and inodes. It also describes modern File System architectures such as Distributed File System and journaling file systems.

The course then covers writing Loadable Kernel Modules in detail since this is necessary to write Kernel Extensions. Starting from basic concepts like writing/compiling LKMs to passing arguments to LKMs and exporting/suppressing-the-export of symbols into the Kernel Symbol tree, it then goes on into advanced concepts like writing stackable modules, Inter-Module communication mechanisms and writing modules to support Kernel Versioning.

The course covers Kernel Programming Mechanisms like Kernel Timers, Wait-queues, Task-Queues, writing Interrupt Service Routines using Tasklets etc. It covers core concepts like managing deadlock resolutions using kernel semaphores, circular buffers and bit operations. It also looks at Symmetric Multi-processing architectures and the usage of spin-locks to handle access to critical regions.

The course then looks at Character Device Drivers, the major and minor numbers as an entry point from the user’s code, the VFS and its role in standard access to driver methods, system calls and how they invoke the respective driver methods and a detailed treatment of ioctls, macros used to encode and decode ioctls and other advanced issues in character devices such as multi-user concurrency, kernel semaphores, single-open devices, Blocking and Non-blocking I/O etc. Character devices are taught with respect to RAM disks as an example and also using simple LED boards driven through the parallel port.

The course covers the Peripheral Component Interconnect ( PCI ) bus and its architecture and how device drivers are written for PCI bus devices. The course also looks at USB devices and their interfacing. The course then covers Network drivers and uses the RTL-8139 chipset as an example to explain driver writing.

 Target Audience:

The course is ideal for Systems Software programmers and device driver writers wanting to know more about how the Linux Kernel functions. The course will also be appreciated by Application Programmers and Systems Administrators having a good knowledge of ‘C’ programming, who wish to know more about how things work "under the hood".


The course expects a reasonably good knowledge of ‘C’ programming. Knowledge of basic Unix/Linux commands to navigate, write source-code, search for files, compile, execute etc. is expected.






Introduction to the Linux Kernel

1.5 hrs

Kernel structure, components, modules, organization/architecture

Development tools under linux

1.5 hrs

The 'C' compiler, assembler, linker, static and dynamic libraries, objdump, ldd, ldconfig, nm and strip.
Introduction to System Calls.

Linux Process Management 1.5 hrs Scheduler, the task structure, process-states, ELF format, mode-switching, fork, exec and clone system calls, copy-on-write mechanism, threads vs processes

Compiling a new kernel & the booting process

1.5 hrs

Sources, headers, compiling, boot and root directories, /boot and the 8.4 GB limit for disk partitions, Linux Loaders, Chain boot-loaders.


Kernel Loadable Modules

1.5 hrs

Writing LKMs, passing arguments, exporting symbols, suppressing the export of symbols, module cascading, Inter-module communication, versioning support.

Device Management

1.5 hrs

How devices interact with the kernel, I/O and memory-mapped devices, character, block and network devices, Introduction to Peripheral Buses – ISA, PCI, USB etc.

Interrupts and Interrupt Service Routines

1.5 hrs

Interrupt strategies, writing fast interrupt handlers, shared interrupts, tasklets, methods of avoiding deadlocks – circular buffers, bitops.

Character Device Drivers

1.5 hrs

Major number, minor number, link between file system and driver methods written as LKMs, registering driver methods, unregistering, requesting resources from the kernel etc.


Memory Management

1.5 hrs

The 32-bit Protected Mode Architecture, Hardware support for common memory management functions, demand paging, virtual memory, swapping, daemons.
Page allocation tables, user memory versus kernel memory, kmalloc and kfree, atomic calls, DMA, Bus-memory, High-memory, memory mapped I/O and Interface functions.

Kernel Programming Mechanisms

3.0 hrs

Kernel timers, task queues, predefined and custom task queues, tasklets, kernel semaphores, wait queues, kernel support for linked lists & wait queues.

File System

1.5 hrs

Hierarchy, registering a new file system, mounting/unmounting, superblock, root block, inodes, directory handling, data indirection, journaling filesystems.
The implementation of ext2/ext3 and the proc file system.


PCI Bus Interfacing

1.5 hrs

Bus architectures, ISA and PCI. The PCI 2.2 standards, lspci and setpci.
PCI related API, accessing the configuration space, requesting I/O or memory, converting physical address to a kernel logical address etc.

USB Interfacing

1.5 hrs

Protocol, kernel interfacing mechanisms, example driver.

Network Drivers

3.0 hrs

Kernel data structures, algorithms, registering & unregistering, device initialization, transmission/reception of a packet.
Case study - RTL-8139 chipset
Case study - PL-2301 chipset (usbnet.o)


Kernel Interfacing

1.5 hrs

proc fs interface, Magic SysRq interface, ioctl calls.

Basic kernel debugging

1.5 hrs

ksymoops,  strace,  configuring console output etc.

Advanced kernel debugging

1.5 hrs

kdb - The linux kernel debugger


1.5 hrs

Open house. Other topics not covered in above.

(C) 2005 -   All Rights Reserved.

Return to Training Programs