| |
| |
Foreword | |
| |
| |
Preface | |
| |
| |
Acknowledgments | |
| |
| |
About the Author | |
| |
| |
| |
Introduction | |
| |
| |
| |
Why Linux? | |
| |
| |
| |
Embedded Linux Today | |
| |
| |
| |
Open Source and the GPL | |
| |
| |
| |
Free Versus Freedom | |
| |
| |
| |
Standards and Relevant Bodies | |
| |
| |
| |
Linux Standard Base | |
| |
| |
| |
Open Source Development Labs | |
| |
| |
| |
Chapter Summary | |
| |
| |
| |
Suggestions for Additional Reading | |
| |
| |
| |
Your First Embedded Experience | |
| |
| |
| |
Embedded or Not? | |
| |
| |
| |
BIOS Versus Bootloader | |
| |
| |
| |
Anatomy of an Embedded System | |
| |
| |
| |
Typical Embedded Linux Setup | |
| |
| |
| |
Starting the Target Board | |
| |
| |
| |
Booting the Kernel | |
| |
| |
| |
Kernel Initialization: Overview | |
| |
| |
| |
First User Space Process: init | |
| |
| |
| |
Storage Considerations | |
| |
| |
| |
Flash Memory | |
| |
| |
| |
NAND Flash | |
| |
| |
| |
Flash Usage | |
| |
| |
| |
Flash File Systems | |
| |
| |
| |
Memory Space | |
| |
| |
| |
Execution Contexts | |
| |
| |
| |
Process Virtual Memory | |
| |
| |
| |
Cross-Development Environment | |
| |
| |
| |
Embedded Linux Distributions | |
| |
| |
| |
Commercial Linux Distributions | |
| |
| |
| |
Do-It-Yourself Linux Distributions | |
| |
| |
| |
Chapter Summary | |
| |
| |
| |
Suggestions for Additional Reading | |
| |
| |
| |
Processor Basics | |
| |
| |
| |
Stand-alone Processors | |
| |
| |
| |
IBM 970FX | |
| |
| |
| |
Intel Pentium M | |
| |
| |
| |
Freescale MPC7448 | |
| |
| |
| |
Companion Chipsets | |
| |
| |
| |
Integrated Processors: Systems on Chip | |
| |
| |
| |
PowerPC | |
| |
| |
| |
AMCC PowerPC | |
| |
| |
| |
Freescale PowerPC | |
| |
| |
| |
MIPS | |
| |
| |
| |
Broadcom MIPS | |
| |
| |
| |
AMD MIPS | |
| |
| |
| |
Other MIPS | |
| |
| |
| |
ARM | |
| |
| |
| |
TI ARM | |
| |
| |
| |
Freescale ARM | |
| |
| |
| |
Intel ARM XScale | |
| |
| |
| |
Other ARM | |
| |
| |
| |
Other Architectures | |
| |
| |
| |
Hardware Platforms | |
| |
| |
| |
CompactPCI | |
| |
| |
| |
ATCA | |
| |
| |
| |
Chapter Summary | |
| |
| |
| |
Suggestions For Additional Reading | |
| |
| |
| |
The Linux Kernel-A Different Perspective | |
| |
| |
| |
Background | |
| |
| |
| |
Kernel Versions | |
| |
| |
| |
Kernel Source Repositories | |
| |
| |
| |
Linux Kernel Construction | |
| |
| |
| |
Top-Level Source Directory | |
| |
| |
| |
Compiling the Kernel | |
| |
| |
| |
The Kernel Proper: vmlinux | |
| |
| |
| |
Kernel Image Components | |
| |
| |
| |
Subdirectory Layout | |
| |
| |
| |
Kernel Build System | |
| |
| |
| |
The Dot-Config | |
| |
| |
| |
Configuration Editor(s) | |
| |
| |
| |
Makefile Targets | |
| |
| |
| |
Kernel Configuration | |
| |
| |
| |
Custom Configuration Options | |
| |
| |
| |
Kernel Makefiles | |
| |
| |
| |
Kernel Documentation | |
| |
| |
| |
Obtaining a Linux Kernel | |
| |
| |
| |
What Else Do I Need? | |
| |
| |
| |
Chapter Summary | |
| |
| |
| |
Suggestions for Additional Reading | |
| |
| |
| |
Kernel Initialization | |
| |
| |
| |
Composite Kernel Image: Piggy and Friends | |
| |
| |
| |
The Image Object | |
| |
| |
| |
Architecture Objects | |
| |
| |
| |
Bootstrap Loader | |
| |
| |
| |
Boot Messages | |
| |
| |
| |
Initialization Flow of Control | |
| |
| |
| |
Kernel Entry Point: head.o | |
| |
| |
| |
Kernel Startup: main.c | |
| |
| |
| |
Architecture Setup | |
| |
| |
| |
Kernel Command Line Processing | |
| |
| |
| |
The_setup Macro | |
| |
| |
| |
Subsystem Initialization | |
| |
| |
| |
The*_initcall Macros | |
| |
| |
| |
The init Thread | |
| |
| |
| |
Initialization via initcalls | |
| |
| |
| |
Final Boot Steps | |
| |
| |
| |
Chapter Summary | |
| |
| |
| |
Suggestions for Additional Reading | |
| |
| |
| |
System Initialization | |
| |
| |
| |
Root File System | |
| |
| |
| |
FHS: File System Hierarchy Standard | |
| |
| |
| |
File System Layout | |
| |
| |
| |
Minimal File System | |
| |
| |
| |
The Root FS Challenge | |
| |
| |
| |
Trial-and-Error Method | |
| |
| |
| |
Automated File System Build Tools | |
| |
| |
| |
Kernel's Last Boot Steps | |
| |
| |
| |
First User Space Program | |
| |
| |
| |
Resolving Dependencies | |
| |
| |
| |
Customized Initial Process | |
| |
| |
| |
The Init Process | |
| |
| |
| |
inittab | |
| |
| |
| |
Example Web Server Startup Script | |
| |
| |
| |
Initial RAM Disk | |
| |
| |
| |
Initial RAM Disk Purpose | |
| |
| |
| |
Booting with initrd | |
| |
| |
| |
Bootloader Support for initrd | |
| |
| |
| |
initrd Magic: linuxrc | |
| |
| |
| |
The initrd Plumbing | |
| |
| |
| |
Building an initrd Image | |
| |
| |
| |
Using initramfs | |
| |
| |
| |
Shutdown | |
| |
| |
| |
Chapter Summary | |
| |
| |
| |
Suggestions for Additional Reading | |
| |
| |
| |
Bootloaders | |
| |
| |
| |
Role of a Bootloader | |
| |
| |
| |
Bootloader Challenges | |
| |
| |
| |
DRAM Controller | |
| |
| |
| |
Flash Versus RAM | |
| |
| |
| |
Image Complexity | |
| |
| |
| |
Execution Context | |
| |
| |
| |
A Universal Bootloader: Das U-Boot | |
| |
| |
| |
System Configuration: U-Boot | |
| |
| |
| |
U-Boot Command Sets | |
| |
| |
| |
Network Operations | |
| |
| |
| |
Storage Subsystems | |
| |
| |
| |
Booting from Disk: U-Boot | |
| |
| |
| |
Porting U-Boot | |
| |
| |
| |
EP405 U-Boot Port | |
| |
| |
| |
U-Boot Makefile Configuration Target | |
| |
| |
| |
EP405 Processor Initialization | |
| |
| |
| |
Board-Specific Initialization | |
| |
| |
| |
Porting Summary | |
| |
| |
| |
U-Boot Image Format | |
| |
| |
| |
Other Bootloaders | |
| |
| |
| |
Lilo | |
| |
| |
| |
GRUB | |
| |
| |
| |
Still More Bootloaders | |
| |
| |
| |
Chapter Summary | |
| |
| |
| |
Suggestions for Additional Reading | |
| |
| |
| |
Device Driver Basics | |
| |
| |
| |
Device Driver Concepts | |
| |
| |
| |
Loadable Modules | |
| |
| |
| |
Device Driver Architecture | |
| |
| |
| |
Minimal Device Driver Example | |
| |
| |
| |
Module Build Infrastructure | |
| |
| |
| |
Installing Your Device Driver | |
| |
| |
| |
Loading Your Module | |
| |
| |
| |
Module Utilities | |
| |
| |
| |
insmod | |
| |
| |
| |
Module Parameters | |
| |
| |
| |
lsmod | |
| |
| |
| |
modprobe | |
| |
| |
| |
depmod | |
| |
| |
| |
rmmod | |
| |
| |
| |
modinfo | |
| |
| |
| |
Driver Methods | |
| |
| |
| |
Driver File System Operations | |
| |
| |
| |
Device Nodes and mknod | |
| |
| |
| |
Bringing It All Together | |
| |
| |
| |
Device Drivers and the GPL | |
| |
| |
| |
Chapter Summary | |
| |
| |
| |
Suggestions for Additional Reading | |
| |
| |
| |
File Systems | |
| |
| |
| |
Linux File System Concepts | |
| |
| |
| |
Partitions | |
| |
| |
| |
ext2 | |
| |
| |
| |
Mounting a File System | |
| |
| |
| |
Checking File System Integrity | |
| |
| |
| |
ext3 | |
| |
| |
| |
ReiserFS | |
| |
| |
| |
JFFS2 | |
| |
| |
| |
cramfs | |
| |
| |
| |
Network File System | |
| |
| |
| |
Root File System on NFS | |
| |
| |
| |
Pseudo File Systems | |
| |
| |
| |
Proc File System | |
| |
| |
| |
sysfs | |
| |
| |
| |
Other File Systems | |
| |
| |
| |
Building a Simple File System | |
| |
| |
| |
Chapter Summary | |
| |
| |
| |
Suggestions for Additional Reading | |
| |
| |
| |
MTD Subsystem | |
| |
| |
| |
Enabling MTD Services | |
| |
| |
| |
Building MTD | |
| |
| |
| |
MTD Basics | |
| |
| |
| |
Configuring MTD | |
| |
| |
| |
MTD Partitions | |
| |
| |
| |
Redboot Partition Table Partitioning | |
| |
| |
| |
Kernel Command Line Partitioning | |
| |
| |
| |
Mapping Driver | |
| |
| |
| |
Flash Chip Drivers | |
| |
| |
| |
Board-Specific Initialization | |
| |
| |
| |
MTD Utilities | |
| |
| |
| |
JFFS2 Root File System | |
| |
| |
| |
Chapter Summary | |
| |
| |
| |
Suggestions for Additional Reading | |
| |
| |
| |
BusyBox | |
| |
| |
| |
Introduction to BusyBox | |
| |
| |
| |
BusyBox is Easy | |
| |
| |
| |
BusyBox Configuration | |
| |
| |
| |
Cross-Compiling BusyBox | |
| |
| |
| |
BusyBox Operation | |
| |
| |
| |
BusyBox Init | |
| |
| |
| |
Example rcS Initialization Script | |
| |
| |
| |
BusyBox Target Installation | |
| |
| |
| |
BusyBox Commands | |
| |
| |
| |
Chapter Summary | |
| |
| |
| |
Suggestions for Additional Reading | |
| |
| |
| |
Embedded Development Environment | |
| |
| |
| |
Cross-Development Environment | |
| |
| |
| |
"Hello World"-Embedded | |
| |
| |
| |
Host System Requirements | |
| |
| |
| |
Hardware Debug Probe | |
| |
| |
| |
Hosting Target Boards | |
| |
| |
| |
TFTP Server | |
| |
| |
| |
BOOTP/DHCP Server | |
| |
| |
| |
NFS Server | |
| |
| |
| |
Target NFS Root Mount | |
| |
| |
| |
U-Boot NFS Root Mount Example | |
| |
| |
| |
Chapter Summary | |
| |
| |
| |
Suggestions for Additional Reading | |
| |
| |
| |
Development Tools | |
| |
| |
| |
GNU Debugger (GDB) | |
| |
| |
| |
Debugging a Core Dump | |
| |
| |
| |
Invoking GDB | |
| |
| |
| |
Debug Session in GDB | |
| |
| |
| |
Data Display Debugger | |
| |
| |
| |
cbrowser/cscope | |
| |
| |
| |
Tracing and Profiling Tools | |
| |
| |
| |
strace | |
| |
| |
| |
strace Variations | |
| |
| |
| |
ltrace | |
| |
| |
| |
ps | |
| |
| |
| |
top | |
| |
| |
| |
mtrace | |
| |
| |
| |
dmalloc | |
| |
| |
| |
Kernel Oops | |
| |
| |
| |
Binary Utilities | |
| |
| |
| |
readelf | |
| |
| |
| |
Examining Debug Info Using readelf | |
| |
| |
| |
objdump | |
| |
| |
| |
objcopy | |
| |
| |
| |
Miscellaneous Binary Utilities | |
| |
| |
| |
strip | |
| |
| |
| |
addr2line | |
| |
| |
| |
strings | |
| |
| |
| |
ldd | |
| |
| |
| |
nm | |
| |
| |
| |
prelink | |
| |
| |
| |
Chapter Summary | |
| |
| |
| |
Suggestions for Additional Reading | |
| |
| |
| |
Kernel Debugging Techniques | |
| |
| |
| |
Challenges to Kernel Debugging | |
| |
| |
| |
Using KGDB for Kernel Debugging | |
| |
| |
| |
KGDB Kernel Configuration | |
| |
| |
| |
Target Boot with KGDB Support | |
| |
| |
| |
Useful Kernel Breakpoints | |
| |
| |
| |
Debugging the Linux Kernel | |
| |
| |
| |
gdb Remote Serial Protocol | |
| |
| |
| |
Debugging Optimized Kernel Code | |
| |
| |
| |
gdb User-Defined Commands | |
| |
| |
| |
Useful Kernel gdb Macros | |
| |
| |
| |
Debugging Loadable Modules | |
| |
| |
| |
printk Debugging | |
| |
| |
| |
Magic SysReq Key | |
| |
| |
| |
Hardware-Assisted Debugging | |
| |
| |
| |
Programming Flash Using a JTAG Probe | |
| |
| |
| |
Debugging with a JTAG Probe | |
| |
| |
| |
When It Doesn't Boot | |
| |
| |
| |
Early Serial Debug Output | |
| |
| |
| |
Dumping the printk Log Buffer | |
| |
| |
| |
KGDB on Panic | |
| |
| |
| |
Chapter Summary | |
| |
| |
| |
Suggestions for Additional Reading | |
| |
| |
| |
Debugging Embedded Linux Applications | |
| |
| |
| |
Target Debugging | |
| |
| |
| |
Remote (Cross) Debugging | |
| |
| |
| |
gdbserver | |
| |
| |
| |
Debugging with Shared Libraries | |
| |
| |
| |
Shared Library Events in GDB | |
| |
| |
| |
Debugging Multiple Tasks | |
| |
| |
| |
Debugging Multiple Processes | |
| |
| |
| |
Debugging Multithreaded Applications | |
| |
| |
| |
Debugging Bootloader/Flash Code | |
| |
| |
| |
Additional Remote Debug Options | |
| |
| |
| |
Debugging via Serial Port | |
| |
| |
| |
Attaching to a Running Process | |
| |
| |
| |
Chapter Summary | |
| |
| |
| |
Suggestions for Additional Reading | |
| |
| |
| |
Porting Linux | |
| |
| |
| |
Linux Source Organization | |
| |
| |
| |
The Architecture Branch | |
| |
| |
| |
Custom Linux for Your Board | |
| |
| |
| |
Prerequisites and Assumptions | |
| |
| |
| |
Customizing Kernel Initialization | |
| |
| |
| |
Static Kernel Command Line | |
| |
| |
| |
Platform Initialization | |
| |
| |
| |
Early Variable Access | |
| |
| |
| |
Board Information Structure | |
| |
| |
| |
Machine-Dependent Calls | |
| |
| |
| |
Putting It All Together | |
| |
| |
| |
Other Architectures | |
| |
| |
| |
Chapter Summary | |
| |
| |
| |
Suggestions for Additional Reading | |
| |
| |
| |
Linux and Real Time | |
| |
| |
| |
What Is Real Time? | |
| |
| |
| |
Soft Real Time | |
| |
| |
| |
Hard Real Time | |
| |
| |
| |
Linux Scheduling | |
| |
| |
| |
Latency | |
| |
| |
| |
Kernel Preemption | |
| |
| |
| |
Impediments to Preemption | |
| |
| |
| |
Preemption Models | |
| |
| |
| |
SMP Kernel | |
| |
| |
| |
Sources of Preemption Latency | |
| |
| |
| |
Real-Time Kernel Patch | |
| |
| |
| |
Real-Time Features | |
| |
| |
| |
O(1) Scheduler | |
| |
| |
| |
Creating a Real-Time Process | |
| |
| |
| |
Critical Section Management | |
| |
| |
| |
Debugging the Real-Time Kernel | |
| |
| |
| |
Soft Lockup Detection | |
| |
| |
| |
Preemption Debugging | |
| |
| |
| |
Debug Wakeup Timing | |
| |
| |
| |
Wakeup Latency History | |
| |
| |
| |
Interrupt Off Timing | |
| |
| |
| |
Interrupt Off History | |
| |
| |
| |
Latency Tracing | |
| |
| |
| |
Debugging Deadlock Conditions | |
| |
| |
| |
Runtime Control of Locking Mode | |
| |
| |
| |
Chapter Summary | |
| |
| |
| |
Suggestions for Additional Reading | |
| |
| |
| |
GNU Public License | |
| |
| |
| |
U-Boot Configurable Commands | |
| |
| |
| |
BusyBox Commands | |
| |
| |
| |
SDRAM Interface Considerations | |
| |
| |
| |
SDRAM Basics | |
| |
| |
| |
SDRAM Refresh | |
| |
| |
| |
Clocking | |
| |
| |
| |
SDRAM Setup | |
| |
| |
| |
Summary | |
| |
| |
| |
Suggestions for Additional Reading | |
| |
| |
| |
Open Source Resources | |
| |
| |
| |
Sample BDI-2000 Configuration File | |
| |
| |
Index | |