Building Embedded Linux Systems

Book description

Linux® is being adopted by an increasing number of embedded systems developers, who have been won over by its sophisticated scheduling and networking, its cost-free license, its open development model, and the support offered by rich and powerful programming tools. While there is a great deal of hype surrounding the use of Linux in embedded systems, there is not a lot of practical information. Building Embedded Linux Systems is the first in-depth, hard-core guide to putting together an embedded system based on the Linux kernel. This indispensable book features arcane and previously undocumented procedures for:

  • Building your own GNU development toolchain
  • Using an efficient embedded development framework
  • Selecting, configuring, building, and installing a target-specific kernel
  • Creating a complete target root filesystem
  • Setting up, manipulating, and using solid-state storage devices
  • Installing and configuring a bootloader for the target
  • Cross-compiling a slew of utilities and packages
  • Debugging your embedded system using a plethora of tools and techniques
Details are provided for various target architectures and hardware configurations, including a thorough review of Linux's support for embedded hardware. All explanations rely on the use of open source and free software packages. By presenting how to build the operating system components from pristine sources and how to find more documentation or help, this book greatly simplifies the task of keeping complete control over one's embedded operating system, whether it be for technical or sound financial reasons.Author Karim Yaghmour, a well-known designer and speaker who is responsible for the Linux Trace Toolkit, starts by discussing the strengths and weaknesses of Linux as an embedded operating system. Licensing issues are included, followed by a discussion of the basics of building embedded Linux systems. The configuration, setup, and use of over forty different open source and free software packages commonly used in embedded Linux systems are also covered. uClibc, BusyBox, U-Boot, OpenSSH, thttpd, tftp, strace, and gdb are among the packages discussed.

Publisher resources

View/Submit Errata

Table of contents

  1. Dedication
  2. Preface
    1. Audience of This Book
    2. Scope and Background Information
    3. Organization of the Material
    4. Hardware Used in This Book
    5. Software Versions
    6. Book Web Site
    7. Typographical Conventions
    8. Contact Information
    9. Acknowledgments
  3. 1. Introduction
    1. 1.1. Definitions
      1. 1.1.1. What Is Linux?
      2. 1.1.2. What Is Embedded Linux?
      3. 1.1.3. What Is Real-Time Linux?
    2. 1.2. Real Life and Embedded Linux Systems
      1. 1.2.1. Types of Embedded Linux Systems
        1. 1.2.1.1. Size
        2. 1.2.1.2. Time constraints
        3. 1.2.1.3. Networkability
        4. 1.2.1.4. User interaction
      2. 1.2.2. Examples
        1. 1.2.2.1. Accelerator control
        2. 1.2.2.2. Computer-aided training system
        3. 1.2.2.3. Ericsson “blip”
        4. 1.2.2.4. SCADA protocol converter
        5. 1.2.2.5. Sharp Zaurus
        6. 1.2.2.6. Space vehicle control
      3. 1.2.3. Survey Findings
      4. 1.2.4. Reasons for Choosing Linux
        1. 1.2.4.1. Quality and reliability of code
        2. 1.2.4.2. Availability of code
        3. 1.2.4.3. Hardware support
        4. 1.2.4.4. Communication protocol and software standards
        5. 1.2.4.5. Available tools
        6. 1.2.4.6. Community support
        7. 1.2.4.7. Licensing
        8. 1.2.4.8. Vendor independence
        9. 1.2.4.9. Cost
      5. 1.2.5. Players of the Embedded Linux Scene
        1. 1.2.5.1. Free software and open source community
        2. 1.2.5.2. Industry
        3. 1.2.5.3. Organizations
        4. 1.2.5.4. Resources
      6. 1.2.6. Copyright and Patent Issues
        1. 1.2.6.1. Textbook GPL
        2. 1.2.6.2. Pending issues
        3. 1.2.6.3. RTLinux patent
      7. 1.2.7. Using Distributions
        1. 1.2.7.1. To use or not to use
        2. 1.2.7.2. How to choose a distribution
        3. 1.2.7.3. What to avoid doing with a distribution
    3. 1.3. Example Multicomponent System
      1. 1.3.1. General Architecture
      2. 1.3.2. Requirements of Each Component
        1. 1.3.2.1. Data acquisition module
        2. 1.3.2.2. Control module
        3. 1.3.2.3. System management module
        4. 1.3.2.4. User interface modules
      3. 1.3.3. Variations in Requirements
    4. 1.4. Design and Implementation Methodology
      1. 1.4.1. Creating a Target Linux System
      2. 1.4.2. Setting Up and Using Development Tools
      3. 1.4.3. Developing for the Embedded
      4. 1.4.4. Networking
  4. 2. Basic Concepts
    1. 2.1. Types of Hosts
      1. 2.1.1. Linux Workstation
      2. 2.1.2. Unix Workstation
      3. 2.1.3. Windows (2000, NT, 98, etc.) Workstation
    2. 2.2. Types of Host/Target Development Setups
      1. 2.2.1. Linked Setup
      2. 2.2.2. Removable Storage Setup
      3. 2.2.3. Standalone Setup
    3. 2.3. Types of Host/Target Debug Setups
    4. 2.4. Generic Architecture of an Embedded Linux System
    5. 2.5. System Startup
    6. 2.6. Types of Boot Configurations
      1. 2.6.1. Solid State Storage Media
      2. 2.6.2. Disk
      3. 2.6.3. Network
    7. 2.7. System Memory Layout
  5. 3. Hardware Support
    1. 3.1. Processor Architectures
      1. 3.1.1. x86
      2. 3.1.2. ARM
      3. 3.1.3. IBM/Motorola PowerPC
      4. 3.1.4. MIPS
      5. 3.1.5. Hitachi SuperH
      6. 3.1.6. Motorola 68000
    2. 3.2. Buses and Interfaces
      1. 3.2.1. ISA
      2. 3.2.2. PCI
      3. 3.2.3. PCMCIA
      4. 3.2.4. PC/104
      5. 3.2.5. VME
      6. 3.2.6. CompactPCI
      7. 3.2.7. Parallel Port
      8. 3.2.8. SCSI
      9. 3.2.9. USB
      10. 3.2.10. IEEE1394 (FireWire)
      11. 3.2.11. GPIB
      12. 3.2.12. I2C
    3. 3.3. I/O
      1. 3.3.1. Serial Port
      2. 3.3.2. Parallel Port
      3. 3.3.3. Modem
      4. 3.3.4. Data Acquisition
      5. 3.3.5. Process Control
      6. 3.3.6. Home Automation
      7. 3.3.7. Keyboard
      8. 3.3.8. Mouse
      9. 3.3.9. Display
      10. 3.3.10. Sound
      11. 3.3.11. Printer
    4. 3.4. Storage
      1. 3.4.1. Memory Technology Devices
      2. 3.4.2. ATA-ATAPI (IDE)
      3. 3.4.3. SCSI
    5. 3.5. General Purpose Networking
      1. 3.5.1. Ethernet
      2. 3.5.2. IrDA
      3. 3.5.3. IEEE 802.11 (Wireless)
      4. 3.5.4. Bluetooth
    6. 3.6. Industrial Grade Networking
      1. 3.6.1. CAN
      2. 3.6.2. ARCnet
      3. 3.6.3. Modbus
      4. 3.6.4. A Word on the Other Industrial Networks
    7. 3.7. System Monitoring
  6. 4. Development Tools
    1. 4.1. Using a Practical Project Workspace
    2. 4.2. GNU Cross-Platform Development Toolchain
      1. 4.2.1. GNU Toolchain Basics
        1. 4.2.1.1. Component versions
        2. 4.2.1.2. Build requirements
        3. 4.2.1.3. Build overview
        4. 4.2.1.4. Workspace setup
        5. 4.2.1.5. Preparing the build-tools directory
        6. 4.2.1.6. Resources
        7. 4.2.1.7. A word on prebuilt cross-platform toolchains
      2. 4.2.2. Kernel Headers Setup
      3. 4.2.3. Binutils Setup
      4. 4.2.4. Bootstrap Compiler Setup
      5. 4.2.5. C Library Setup
      6. 4.2.6. Full Compiler Setup
      7. 4.2.7. Finalizing the Toolchain Setup
      8. 4.2.8. Using the Toolchain
    3. 4.3. C Library Alternatives
      1. 4.3.1. uClibc
        1. 4.3.1.1. Library setup
        2. 4.3.1.2. Usage
      2. 4.3.2. Diet libc
        1. 4.3.2.1. Library setup
        2. 4.3.2.2. Usage
    4. 4.4. Java
      1. 4.4.1. The Blackdown Project
      2. 4.4.2. Open Source Virtual Machines
      3. 4.4.3. The GNU Java Compiler
    5. 4.5. Perl
      1. 4.5.1. Microperl
      2. 4.5.2. Miniperl
    6. 4.6. Python
    7. 4.7. Ada
    8. 4.8. Other Programming Languages
    9. 4.9. Integrated Development Environments
    10. 4.10. Terminal Emulators
      1. 4.10.1. Accessing the Serial Port
      2. 4.10.2. Minicom
      3. 4.10.3. UUCP cu
      4. 4.10.4. C-Kermit
  7. 5. Kernel Considerations
    1. 5.1. Selecting a Kernel
    2. 5.2. Configuring the Kernel
      1. 5.2.1. Configuration Options
      2. 5.2.2. Configuration Methods
      3. 5.2.3. Managing Multiple Configurations
      4. 5.2.4. Using the EXTRAVERSION Variable
    3. 5.3. Compiling the Kernel
      1. 5.3.1. Building Dependencies
      2. 5.3.2. Building the Kernel
      3. 5.3.3. Building the Modules
    4. 5.4. Installing the Kernel
      1. 5.4.1. Managing Multiple Kernel Images
      2. 5.4.2. Installing Kernel Modules
    5. 5.5. In the Field
      1. 5.5.1. Dealing with Kernel Failure
  8. 6. Root Filesystem Content
    1. 6.1. Basic Root Filesystem Structure
    2. 6.2. Libraries
      1. 6.2.1. glibc
      2. 6.2.2. uClibc
    3. 6.3. Kernel Modules
    4. 6.4. Kernel Images
    5. 6.5. Device Files
    6. 6.6. Main System Applications
      1. 6.6.1. Complete Standard Applications
      2. 6.6.2. BusyBox
        1. 6.6.2.1. Setup
        2. 6.6.2.2. Usage
      3. 6.6.3. TinyLogin
        1. 6.6.3.1. Setup
        2. 6.6.3.2. Usage
      4. 6.6.4. embutils
        1. 6.6.4.1. Setup
        2. 6.6.4.2. Usage
    7. 6.7. Custom Applications
    8. 6.8. System Initialization
      1. 6.8.1. Standard System V init
      2. 6.8.2. BusyBox init
      3. 6.8.3. Minit
  9. 7. Storage Device Manipulation
    1. 7.1. MTD-Supported Devices
      1. 7.1.1. MTD Usage Basics
        1. 7.1.1.1. MTD /dev entries
        2. 7.1.1.2. Configuring the kernel
        3. 7.1.1.3. The MTD utilities
        4. 7.1.1.4. Installing the MTD utilities for the host
        5. 7.1.1.5. Installing the MTD utilities for the target
      2. 7.1.2. Native CFI Flash
        1. 7.1.2.1. Kernel configuration
        2. 7.1.2.2. Partitioning
        3. 7.1.2.3. Required /dev entries
        4. 7.1.2.4. Erasing
        5. 7.1.2.5. Writing and reading
      3. 7.1.3. DiskOnChip
        1. 7.1.3.1. Preliminary manipulations
        2. 7.1.3.2. Kernel configuration
        3. 7.1.3.3. Required /dev entries
        4. 7.1.3.4. Erasing
        5. 7.1.3.5. Installing bootloader image
        6. 7.1.3.6. NFTL formatting
        7. 7.1.3.7. Partitioning
    2. 7.2. Disk Devices
      1. 7.2.1. CompactFlash
      2. 7.2.2. Floppy Disk
      3. 7.2.3. Hard Disk
    3. 7.3. To Swap or Not to Swap
  10. 8. Root Filesystem Setup
    1. 8.1. Selecting a Filesystem
      1. 8.1.1. Characterizing Filesystems
      2. 8.1.2. Guidelines for Filesystem Selection
      3. 8.1.3. Filesystems for Disk Devices
    2. 8.2. Using an NFS-Mounted Root Filesystem to Write a Filesystem Image to Flash
    3. 8.3. CRAMFS
    4. 8.4. JFFS2
    5. 8.5. Disk Filesystem over NFTL
    6. 8.6. Disk Filesystem over RAM Disk
    7. 8.7. Mounting Directories on TMPFS
    8. 8.8. Live Updates
      1. 8.8.1. The rsync Utility
      2. 8.8.2. Package Management Tools
      3. 8.8.3. Ad Hoc Scripts
        1. 8.8.3.1. Installing the patch utility
        2. 8.8.3.2. Scripts for performing updates
  11. 9. Setting Up the Bootloader
    1. 9.1. Bootloaders Galore
      1. 9.1.1. LILO
      2. 9.1.2. GRUB
      3. 9.1.3. ROLO
      4. 9.1.4. loadlin
      5. 9.1.5. EtherBoot
      6. 9.1.6. LinuxBIOS
      7. 9.1.7. Compaq’s bootldr
      8. 9.1.8. blob
      9. 9.1.9. PMON
      10. 9.1.10. sh-Boot
      11. 9.1.11. U-Boot
      12. 9.1.12. RedBoot
    2. 9.2. Server Setup for Network Boot
      1. 9.2.1. Setting Up the DHCP Daemon
      2. 9.2.2. Setting Up the TFTP Daemon
      3. 9.2.3. Mounting a Root Filesystem on an NFS Server
    3. 9.3. Using LILO with Disk and CompactFlash Devices
    4. 9.4. Using GRUB with DiskOnChip Devices
      1. 9.4.1. Configuring and Building GRUB for the DOC
      2. 9.4.2. Installing GRUB on a DOC
      3. 9.4.3. Configuring GRUB to Boot from a DOC
    5. 9.5. U-Boot
      1. 9.5.1. Compiling and Installing
      2. 9.5.2. Booting with U-Boot
      3. 9.5.3. Using U-Boot’s Environment Variables
      4. 9.5.4. Creating Boot Scripts
      5. 9.5.5. Preparing Binary Images
      6. 9.5.6. Booting Using BOOTP/DHCP, TFTP, and NFS
      7. 9.5.7. Downloading Binary Images to Flash
      8. 9.5.8. Booting Using a RAM Disk
      9. 9.5.9. Booting from CompactFlash Devices
      10. 9.5.10. Updating U-Boot
  12. 10. Setting Up Networking Services
    1. 10.1. The Internet Super-Server
      1. 10.1.1. inetd
      2. 10.1.2. xinetd
    2. 10.2. Remote Administration with SNMP
    3. 10.3. Network Login Through Telnet
      1. 10.3.1. netkit-telnetd
      2. 10.3.2. utelnetd
    4. 10.4. Secure Communication with SSH
      1. 10.4.1. OpenSSH
      2. 10.4.2. A Word on Other SSH Implementations
    5. 10.5. Serving Web Content Through HTTP
      1. 10.5.1. Boa
      2. 10.5.2. thttpd
      3. 10.5.3. A Word on Apache
    6. 10.6. Dynamic Configuration Through DHCP
  13. 11. Debugging Tools
    1. 11.1. Debugging Applications with gdb
      1. 11.1.1. Building and Installing gdb Components
      2. 11.1.2. Using the gdb Components to Debug Target Applications
      3. 11.1.3. Interfacing with a Graphical Frontend
    2. 11.2. Tracing
      1. 11.2.1. Single Process Tracing
      2. 11.2.2. System Tracing
        1. 11.2.2.1. Preliminary manipulations
        2. 11.2.2.2. Patching the kernel
        3. 11.2.2.3. Building the trace daemon
        4. 11.2.2.4. Installing the visualization tool
        5. 11.2.2.5. Tracing the target and visualizing its behavior
    3. 11.3. Performance Analysis
      1. 11.3.1. Process Profiling
      2. 11.3.2. Code Coverage
      3. 11.3.3. System Profiling
        1. 11.3.3.1. Basic /proc figures
        2. 11.3.3.2. Complete profile using LTT
      4. 11.3.4. Kernel Profiling
      5. 11.3.5. Measuring Interrupt Latency
    4. 11.4. Memory Debugging
      1. 11.4.1. Electric Fence
      2. 11.4.2. MEMWATCH
    5. 11.5. A Word on Hardware Tools
  14. A. Worksheet
    1. A.1. Project Identification
    2. A.2. Hardware Summary
    3. A.3. Development Tools
    4. A.4. Kernel
    5. A.5. Root filesystem
    6. A.6. Storage Device Organization
    7. A.7. Bootloader Configuration and Use
    8. A.8. Networking services
    9. A.9. Custom Project Software
    10. A.10. Debug Notes
    11. A.11. Additional Notes
    12. A.12. Embedded Linux Systems Worksheet
  15. B. Resources
    1. B.1. Online
    2. B.2. Books
    3. B.3. Publications
    4. B.4. Organizations
    5. B.5. Linux and Open-Source-Oriented Hardware Projects
  16. C. Important Licenses and Notices
    1. C.1. Exclusion of User-Space Applications from Kernel’s GPL
    2. C.2. Notices on Binary Kernel Modules
      1. C.2.1. First Posting by Linus in Kernel Interface Thread
      2. C.2.2. Second Posting by Linus in Kernel Interface Thread
      3. C.2.3. Post by Alan Cox in Kernel Hooks Thread
      4. C.2.4. First Post by Linus in Security Hooks License Thread
      5. C.2.5. Second Post by Linus in Security Hooks License Thread
    3. C.3. Legal Clarifications About the Kernel by Linus Torvalds
  17. About the Author
  18. Colophon
  19. Copyright

Product information

  • Title: Building Embedded Linux Systems
  • Author(s): Karim Yaghmour
  • Release date: April 2003
  • Publisher(s): O'Reilly Media, Inc.
  • ISBN: 9780596002220