logo资料库

Building Embedded Linux Systems 2nd Edition.pdf

第1页 / 共464页
第2页 / 共464页
第3页 / 共464页
第4页 / 共464页
第5页 / 共464页
第6页 / 共464页
第7页 / 共464页
第8页 / 共464页
资料共464页,剩余部分请下载后查看
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
Building Embedded Linux Systems
Other Linux resources from O’Reilly Related titles Designing Embedded Programming Embedded Hardware Linux Device Drivers Linux in a Nutshell Linux Network Adminis- trator’s Guide Systems Running Linux Understanding the Linux Kernel Linux Books Resource Center linux.oreilly.com is a complete catalog of O’Reilly’s books on Linux and Unix and related technologies, including sample chapters and code examples. ONLamp.com is the premier site for the open source web plat- form: Linux, Apache, MySQL, and either Perl, Python, or PHP. Conferences O’Reilly brings diverse innovators together to nurture the ideas that spark revolutionary industries. We specialize in document- ing the latest tools and systems, translating the innovator’s knowledge into useful skills for those in the trenches. Visit con- ferences.oreilly.com for our upcoming events. Safari Bookshelf (safari.oreilly.com) is the premier online refer- ence library for programmers and IT professionals. Conduct searches across more than 1,000 books. Subscribers can zero in on answers to time-critical questions in a matter of seconds. Read the books on your Bookshelf from cover to cover or sim- ply flip to the page you need. Try it today for free.
Building Embedded Linux Systems SECOND EDITION Karim Yaghmour, Jon Masters, Gilad Ben-Yossef, and Philippe Gerum Tomcat™The Definitive GuideJason Brittain and Ian F. DarwinBeijing•Cambridge•Farnham•Köln•Sebastopol•Taipei•Tokyomain.title Page iii Monday, May 19, 2008 11:21 AM
Building Embedded Linux Systems, Second Edition by Karim Yaghmour, Jon Masters, Gilad Ben-Yossef, and Philippe Gerum Copyright © 2008 Karim Yaghmour and Jon Masters. All rights reserved. Printed in the United States of America. Published by O’Reilly Media, Inc., 1005 Gravenstein Highway North, Sebastopol, CA 95472. O’Reilly books may be purchased for educational, business, or sales promotional use. Online editions are also available for most titles (http://safari.oreilly.com). For more information, contact our corporate/ institutional sales department: (800) 998-9938 or corporate@oreilly.com. Editor: Andy Oram Production Editor: Loranah Dimant Copyeditor: Genevieve d’Entremont Proofreader: Loranah Dimant Printing History: April 2003: August 2008: First Edition. Second Edition. Joe Wizda Indexer: Cover Designer: Karen Montgomery Interior Designer: David Futato Illustrator: Jessamyn Read Nutshell Handbook, the Nutshell Handbook logo, and the O’Reilly logo are registered trademarks of O’Reilly Media, Inc. Building Embedded Linux Systems, the image of a windmill, and related trade dress are trademarks of O’Reilly Media, Inc. Many of the designations used by manufacturers and sellers to distinguish their products are claimed as trademarks. Where those designations appear in this book, and O’Reilly Media, Inc. was aware of a trademark claim, the designations have been printed in caps or initial caps. While every precaution has been taken in the preparation of this book, the publisher and authors assume no responsibility for errors or omissions, or for damages resulting from the use of the information con- tained herein. ISBN: 978-0-596-52968-0 [M] 1218037492
Table of Contents Preface . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . ix 1. 2. 3. 4. Introduction . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1 2 Definitions Real Life and Embedded Linux Systems 5 27 Design and Implementation Methodology Basic Concepts . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 33 Types of Hosts 33 39 Types of Host/Target Development Setups 41 Types of Host/Target Debug Setups 43 Generic Architecture of an Embedded Linux System System Startup 47 48 Types of Boot Configurations System Memory Layout 51 Hardware Support . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 55 56 Processor Architectures 64 Buses and Interfaces 72 I/O Storage 79 81 General-Purpose Networking 83 Industrial-Grade Networking System Monitoring 85 Development Tools . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 87 89 A Practical Project Workspace 91 GNU Cross-Platform Development Toolchain C Library Alternatives 115 129 Java 131 Perl Python 134 v
Other Programming Languages Eclipse: An Integrated Development Environment Terminal Emulators 135 135 147 Kernel Considerations . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 155 156 Selecting a Kernel 161 Configuring the Kernel Compiling the Kernel 165 167 Installing the Kernel In the Field 169 Root Filesystem Content . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 173 173 Basic Root Filesystem Structure 177 Libraries 183 Kernel Modules Kernel Images 183 184 Device Files 193 Main System Applications 201 Custom Applications System Initialization 201 Storage Device Manipulation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 209 209 MTD-Supported Devices Disk Devices 231 234 To Swap or Not To Swap Root Filesystem Setup . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 235 Filesystem Types for Embedded Devices 235 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 Handling Software Upgrades 254 254 255 258 261 Setting Up the Bootloader . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 273 274 Embedded Bootloaders 278 Server Setup for Network Boot Using the U-Boot Bootloader 285 5. 6. 7. 8. 9. 10. Setting Up Networking Services . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 301 Network Settings 302 vi | Table of Contents
分享到:
收藏