Table of Contents
Preface
Focus on Self-Sufficiency
Audience for This Book
Scope and Background Information
Organization of the Material
Hardware Used in This Book
Software Versions
Typographical Conventions
Using Code Examples
Contact Information
Safari® Books Online
Acknowledgments for the First Edition
Acknowledgments for the Second Edition
Chapter 1. Introduction
Definitions
What Is Linux?
What Is Embedded Linux?
What Is Real-Time Linux?
Real Life and Embedded Linux Systems
Types of Embedded Linux Systems
Size
Time constraints
Networkability
User interaction
Reasons for Choosing Linux
Quality and reliability of code
Availability of code
Hardware support
Communication protocol and software standards
Available tools
Community support
Licensing
Vendor independence
Cost
Players in the Embedded Linux Scene
Free software and open source community
Industry
Resources
Copyright and Patent Issues
Textbook GPL
Pending issues
RTLinux patent
A Word on Distributions
To use or not to use
How to choose a distribution
What to avoid doing with a distribution
Design and Implementation Methodology
Creating a Target Linux System
Setting Up and Using Development Tools
Developing for the Embedded
Networking
Types of Hosts
Chapter 2. Basic Concepts
Types of Host/Target Development Setups
Linked Setup
Removable Storage Setup
Standalone Setup
Types of Host/Target Debug Setups
Generic Architecture of an Embedded Linux System
System Startup
Types of Boot Configurations
Solid-State Storage Media
Disk
Network
System Memory Layout
Chapter 3. Hardware Support
Processor Architectures
ARM
AVR32
Intel x86
M32R
MIPS
Motorola 68000
PowerPC
SuperH
Buses and Interfaces
PCI/PCI-X/PCIe
ExpressCard (Replaces PCMCIA’s PC Card)
PC/104, PC/104-Plus, PCI-104, and PCI/104-Express
CompactPCI/CompactPCIe
SCSI/iSCSI
USB
IEEE1394 (FireWire)
InfiniBand
GPIB
I2C
I/O
Serial Port
Parallel Port
Modem
Data Acquisition
Keyboard
Mouse
Display
Sound
Printer
Storage
Memory Technology Devices
PATA, SATA, and ATAPI (IDE)
Non-MTD Flash-Based devices
General-Purpose Networking
Ethernet
IrDA
IEEE 802.11A/B/G/N (Wireless)
Bluetooth
Industrial-Grade Networking
CAN
Modbus
System Monitoring
Chapter 4. Development Tools
A Practical Project Workspace
GNU Cross-Platform Development Toolchain
Introduction to Building a GNU Toolchain
Terms and GNU configuration names
Linux kernel headers
Binutils
The C library
The threading library
Component versions
Additional build requirements
Build overview
Workspace setup
Resources
Building the Toolchain
Manually building a toolchain
Automated cross toolchain build systems
Crosstool
Ptxdist
Using the Toolchain
C Library Alternatives
uClibc
Buildroot
Customizing the uClibc configuration
Diet libc
Library setup
Usage
Java
Sun Java Micro Edition
Non-Sun-Related Open Source Virtual Machines
The GNU Java Compiler
Perl
Microperl
Miniperl
Python
Other Programming Languages
Eclipse: An Integrated Development Environment
Installing Eclipse
Running Eclipse
Extending Eclipse
Installing a plug-in
Target Management toolkit
Subclipse
Working With Eclipse
Projects
Development
Target management
Terminal Emulators
Accessing the Serial Port
Eclipse Terminal
Minicom
UUCP cu
C-Kermit
Chapter 5. Kernel Considerations
Selecting a Kernel
Embedded Linux Kernels
2.4 Series Kernels
The 2.6 Series Linux Kernel
Using a stable release tarball
Tracking development with git
Third-party kernel trees and patches
Configuring the Kernel
Configuration Options
Configuration Methods
Managing Multiple Configurations
Using the EXTRAVERSION Variable
Compiling the Kernel
Building the Kernel
Building the Modules
Installing the Kernel
Managing Multiple Kernel Images
Installing Kernel Modules
In the Field
Dealing with Kernel Failure
Basic Root Filesystem Structure
Chapter 6. Root Filesystem Content
Libraries
glibc
uClibc
Kernel Modules
Kernel Images
Device Files
Static Device Files
udev
The need for dynamic devices
Building udev
Starting udev
udev’s operation
udev rules
Coldplugging
Kernel configuration
Lightweight udev implementation: BusyBox mdev
Main System Applications
Complete Standard Applications
BusyBox
Setup
Compilation
Usage
TinyLogin: BusyBox logging utilities
embutils
Setup
Usage
Custom Applications
System Initialization
Standard System V init
BusyBox init
Minit
MTD-Supported Devices
Chapter 7. Storage Device Manipulation
Disk Devices
CompactFlash
Floppy Disk
Hard Disk
To Swap or Not To Swap
Filesystem Types for Embedded Devices
Characterizing Filesystems
Chapter 8. Root Filesystem Setup
Writing a Filesystem Image to Flash Using an NFS-Mounted Root Filesystem
Placing a Disk Filesystem on a RAM Disk
Rootfs and Initramfs
Choosing a Filesystem’s Type and Layout
Applications, Libraries, and Static Data
Keeping the filesystem in RAM
Using read-only persistent storage
Using online writable persistent storage
Dynamic Configuration Files and Data
Temporary Files
Layout Example
Handling Software Upgrades
Software Upgrades in Controlled Environments (Non-Fail-Safe)
Replacing a filesystem in-place in RAM
rsync
Package management tools
Fail-Safe Software Upgrades
Architecture of a fail-safe solution
Example procedure for a fail-safe solution
Chapter 9. Setting Up the Bootloader
Embedded Bootloaders
LILO
GRUB
loadlin
Coreboot (Formerly the LinuxBIOS)
U-Boot
RedBoot
Server Setup for Network Boot
Setting Up the DHCP Daemon
Setting Up the TFTP Daemon
Mounting a Root Filesystem on an NFS Server
Using the U-Boot Bootloader
Compiling and Installing
Booting with U-Boot
Using U-Boot’s Environment Variables
Creating Boot Scripts
Preparing Binary Images
Booting Using BOOTP/DHCP, TFTP, and NFS
Downloading Binary Images to Flash
Updating U-Boot
Chapter 10. Setting Up Networking Services
Network Settings
Busybox
Dynamic Configuration Through DHCP
The Internet Super-Server
inetd
xinetd
Remote Administration with SNMP
Network Login Through Telnet
netkit-telnetd
Secure Communication with SSH
Serving Web Content Through HTTP
Boa
thttpd
A Word on Apache
Dynamically Generated Web Content
Provisioning
Chapter 11. Debugging Tools
Eclipse
Debugging Applications with gdb
Building and Installing gdb Components
Using the gdb Components to Debug Target Applications
Interfacing with a Graphical Frontend
Tracing
Single-Process Tracing
System Tracing
Performance Analysis
Process Profiling
Code Coverage
System Profiling
Basic /proc figures
Complete profile using LTTng
Kernel Profiling
Measuring Interrupt Latency
Memory Debugging
Electric Fence and DUMA
Electric Fence
DUMA
MEMWATCH
A Word on Hardware Tools
What Is Real-Time Processing?
Chapter 12. Introduction to Real-Time
Linux
Should Your Linux Be Real-Time?
Why Does the Kernel Need to Be Real-Time Aware?
What Is Latency?
Common Real-Time Kernel Requirements
A Fine-Grained Preemptible Kernel
Strictly Enforced Task Priorities
Handling External Events in a Bounded Time Frame
Some Typical Users of Real-Time Computing Technology
The Linux Paths to Real-Time
The Co-Kernel Approach
The Fully Preemptible Kernel Approach
Chapter 13. The Xenomai Real-Time
System
Porting Traditional RTOS Applications to Linux
The Xenomai Architecture
The Interrupt Pipeline
The Hardware and System Abstraction Layers
The Xenomai Core and Nucleus
The Xenomai Skins
How Xenomai Works
The Real-Time Shadow
New Sets of System Calls
Sharing Kernel Features and Domain Migration
The Real-Time Driver Model
RTDM Mediation
Xenomai, Chameleon by Design
Chapter 14. The RT Patch
Interrupts As Threads
Hard IRQs As Threads
Interrupts and CPU Affinities
Softirqs As Threads
Softirq Timer Threads
Priority Inheritance
Configuring the Kernel with the RT Patch
No Forced Preemption
Voluntary Kernel Preemption
Preemptible Kernel
Complete Preemption
High-Resolution Timers
The Latency Tracer
Event Trace
Function Call Trace
Wakeup Latency Timing
Conclusion
Index