Embedded Linux Primer: A Practical Real-World Approach

Hardcover
from $0.00

Author: Christopher Hallinan

ISBN-10: 0137017839

ISBN-13: 9780137017836

Category: Linux

Comprehensive Real-World Guidance for Every Embedded Developer and Engineer\ This book brings together indispensable knowledge for building efficient, high-value, Linux-based embedded products: information that has never been assembled in one place before. Drawing on years of experience as an embedded Linux consultant and field application engineer, Christopher Hallinan offers solutions for the specific technical issues you’re most likely to face, demonstrates how to build an effective...

Search in google:

Up-to-the-Minute, Complete Guidance for Developing Embedded Solutions with LinuxLinux has emerged as today’s #1 operating system for embedded products. Christopher Hallinan’s Embedded Linux Primer has proven itself as the definitive real-world guide to building efficient, high-value, embedded systems with Linux. Now, Hallinan has thoroughly updated this highly praised book for the newest Linux kernels, capabilities, tools, and hardware support, including advanced multicore processors.Drawing on more than a decade of embedded Linux experience, Hallinan helps you rapidly climb the learning curve, whether you’re moving from legacy environments or you’re new to embedded programming. Hallinan addresses today’s most important development challenges and demonstrates how to solve the problems you’re most likely to encounter.You’ll learn how to build a modern, efficient embedded Linux development environment, and then utilize it as productively as possible. Hallinan offers up-to-date guidance on everything from kernel configuration and initialization to bootloaders, device drivers to file systems, and BusyBox utilities to real-time configuration and system analysis. This edition adds entirely new chapters on UDEV, USB, and open source build systems. Tour the typical embedded system and development environment and understand its concepts and components. Understand the Linux kernel and userspace initialization processes. Preview bootloaders, with specific emphasis on U-Boot. Configure the Memory Technology Devices (MTD) subsystem to interface with flash (and other) memory devices. Make the most of BusyBox and latest open source development tools. Learn from expanded and updated coverage of kernel debugging. Build and analyze real-time systems with Linux. Learn to configure device files and driver loading with UDEV. Walk through detailed coverage of the USB subsystem. Introduces the latest open source embedded Linux build systems. Reference appendices include U-Boot and BusyBox commands.

Embedded Linux PrimerEmbedded Linux PrimerPreface\ Although many good books cover Linux, none brings together so many dimensions of information and advice specifically targeted to the embedded Linux developer. Indeed, there are some very good books written about the Linux kernel, Linux system administration, and so on. You will find references right here in this book to many of the ones that I consider to be at the top of their categories.\ Much of the material presented in this book is motivated by questions I've received over the years from development engineers, in my capacity as an embedded Linux consultant and my present role as a Field Application Engineer for Monta Vista Software, the leading vendor of embedded Linux distributions.\ Embedded Linux presents the experienced software engineer with several unique challenges. First, those with many years of experience with legacy real-time operating systems (RTOSes) find it difficult to transition their thinking from those environments to Linux. Second, experienced application developers often have difficulty understanding the relative complexities of a cross-development environment.\ Although this is a primer, intended for developers new to embedded Linux, I am confident that even developers who are experienced in embedded Linux will find some useful tips and techniques that I have learned over the years.Practical Advice for the Practicing Embedded Developer\ This book contains my view of what an embedded engineer needs to know to get up to speed fast in an embedded Linux environment. Instead of focusing on Linux kernel internals, the kernel chapter in this book focuses on the project nature of thekernel and leaves the internals to the other excellent texts on the subject. You will learn the organization and layout of the kernel source tree. You will discover the binary components that make up a kernel image, and how they are loaded and what purpose they serve on an embedded system. One of my favorite figures in the book is Figure 5-1, which schematically illustrates the build process of a composite kernel image.\ In the pages of this book, you will learn how the build system works and how to incorporate into the Linux kernel your own custom changes that are required for your own projects. You will discover the mechanism used to drive the configuration of different architectures and features within the Linux kernel source tree and, more important, how to modify this system to customize it to your own requirements. We also cover in detail the kernel command-line mechanism. You will learn how it works, how to configure the kernel's runtime behavior for your requirements, and how to extend this functionality to your own project. You will learn how to navigate the kernel source code and how to configure the kernel for specific tasks related to an embedded system. You will learn many useful tips and tricks for your embedded project, from bootloaders, system initialization, file systems, and Flash memory to advanced kernel- and application-debugging techniques. Intended Audience\ This book is intended for programmers with a working knowledge of programming in C. I assume that you have a rudimentary understanding of local area networks and the Internet. You should understand and recognize an IP address and how it is used on a simple local area network. I also assume that you have an understanding of hexadecimal and octal numbering systems, and their common usage in a text such as this.\ Several advanced concepts related to C compiling and linking are explored, so you will benefit from having at least a cursory understanding of the role of the linker in ordinary C programming. Knowledge of the GNU make operation and semantics will also prove beneficial.What This Book Is Not\ This book is not a detailed hardware tutorial. One of the difficulties the embedded developer faces is the huge variety of hardware devices in use today. The user manual for a modern 32-bit processor with some integrated peripherals can easily exceed 1,000 pages. There are no shortcuts. If you need to understand a hardware device from a programmer's point of view, you will need to spend plenty of hours in your favorite reading chair with hardware data sheets and reference guides, and many more hours writing and testing code for these hardware devices!\ This is also not a book about the Linux kernel or kernel internals. In this book, you won't learn about the intricacies of the Memory Management Unit (MMU) used to implement Linux's virtual memory-management policies and procedures; there are already several good books on this subject. You are encouraged to take advantage of the "Suggestions for Additional Reading" section found at the end of every chapter.Conventions Used\ Filenames and code statements are presented in Courier. Commands issued by the reader are indicated in bold Courier. New terms or important concepts are presented in italics.\ When you see a pathname preceded with three dots, this references a well-known but unspecified top-level directory. The top-level directory is context dependent but almost universally refers to a top-level Linux source directory. For example, .../arch/ppc/kernel/setup.c refers to the setup.c file located in the architecture branch of a Linux source tree. The actual path might be something like ~/sandbox/linux.2.6.14/arch/ppc/kernel/setup.c.Organization of the Book\ Chapter 1, "Introduction," provides a brief look at the factors driving the rapid adoption of Linux in the embedded environment. Several important standards and organizations relevant to embedded Linux are introduced.\ Chapter 2, "Your First Embedded Experience," introduces the reader to many concepts related to embedded Linux upon which we build in later chapters.\ In Chapter 3, "Processor Basics," we present a high-level look at the more popular processors and platforms that are being used to build embedded Linux systems. We examine selected products from many of the major processor manufacturers. All of the major architecture families are represented.\ Chapter 4, "The Linux Kernel—A Different Perspective," examines the Linux kernel from a slightly different perspective. Instead of kernel theory or internals, we look at its structure, layout, and build construction so you can begin to learn your way around this large software project and, more important, learn where your own customization efforts must be focused. This includes detailed coverage of the kernel build system.\ Chapter 5, "Kernel Initialization," details the Linux kernel's initialization process. You will learn how the architecture- and bootloader-specific image components are concatenated to the image of the kernel proper for downloading to Flash and booting by an embedded bootloader. The knowledge gained here will help you customize the Linux kernel to your own embedded application requirements.\ Chapter 6, "System Initialization," continues the detailed examination of the initialization process. When the Linux kernel has completed its own initialization, application programs continue the initialization process in a predetermined manner. Upon completing Chapter 6, you will have the necessary knowledge to customize your own userland application startup sequence.\ Chapter 7, "Bootloaders," is dedicated to the booloader and its role in an embedded Linux system. We examine the popular open-source bootloader U-Boot and present a porting example. We briefly introduce additional bootloaders in use today so you can make an informed choice about your particular requirements.\ Chapter 8, "Device Driver Basics," introduces the Linux device driver model and provides enough background to launch into one of the great texts on device drivers, listed as "Suggestions for Additional Reading" at the end of the chapter.\ Chapter 9, "File Systems," presents the more popular file systems being used in embedded systems today. We include coverage of the JFFS2, an important embedded file system used on Flash memory devices. This chapter includes a brief introduction on building your own file system image, one of the more difficult tasks the embedded Linux developer faces.\ Chapter 10, "MTD Subsystem," explores the Memory Technology Devices (MTD) subsystem. MTD is an extremely useful abstraction layer between the Linux file system and hardware memory devices, primarily Flash memory.\ Chapter 11, "BusyBox," introduces BusyBox, one of the most useful utilities for building small embedded systems. We describe how to configure and build BusyBox for your particular requirements, along with detailed coverage of system initialization unique to a BusyBox environment. Appendix C, "BusyBox Commands," lists the available BusyBox commands from a recent BusyBox release.\ Chapter 12, "Embedded Development Environment," takes a detailed look at the unique requirements of a typical cross-development environment. Several techniques are presented to enhance your productivity as an embedded developer, including the powerful NFS root mount development configuration.\ Chapter 13, "Development Tools," examines many useful development tools. Debugging with gdb is introduced, including coverage of core dump analysis. Many more tools are presented and explained, with examples including strace, ltrace, top, and ps, and the memory profilers mtrace and dmalloc. The chapter concludes with an introduction to the more important binary utilities, including the powerful readelf utility.\ Chapter 14, "Kernel Debugging Techniques," provides a detailed examination of many debugging techniques useful for debugging inside the Linux kernel. We introduce the use of the kernel debugger KGDB, and present many useful debugging techniques using the combination of gdb and KGDB as debugging tools. Included is an introduction to using hardware JTAG debuggers and some tips for analyzing failures when the kernel won't boot.\ Chapter 15, "Debugging Embedded Linux Applications," moves the debugging context from the kernel to your application programs. We continue to build on the gdb examples from the previous two chapters, and we present techniques for multithreaded and multiprocess debugging.\ Chapter 16, "Porting Linux," introduces the issues related to porting Linux to your custom board. We walk through a simple example and highlight the steps taken to produce a working Linux kernel on a custom PowerPC board. Several important concepts are presented that have trapped many newcomers to Linux kernel porting. Together with the techniques presented in Chapters 13 and 14, you should be ready to tackle your own custom board port after reading this chapter.\ Chapter 17, "Linux and Real Time," provides an introduction to one of the more exciting developments in embedded Linux: configuring for real time via the CONFIG_RT option. We cover the features available with RT and how they can be used in a design. We also present techniques for measuring latency in your application configuration.\ The appendixes cover the GNU Public License, U-Boot Configurable Commands, BusyBox Commands, SDRAM Interface Considerations, resources for the open source developer, and a sample configuration file for one of the more popular hardware JTAG debuggers, the BDI-2000.Follow Along\ You will benefit most from this book if you can divide your time between the pages of this book and your favorite Linux workstation. Grab an old x86 computer to experiment on an embedded system. Even better, if you have access to a single-board computer based on another architecture, use that. You will benefit from learning the layout and organization of a very large code base (the Linux kernel), and you will gain significant knowledge and experience as you poke around the kernel and learn by doing.\ Look at the code and try to understand the examples produced in this book. Experiment with different settings, configuration options, and hardware devices. Much can be gained in terms of knowledge, and besides, it's loads of fun!GPL Copyright Notice\ Portions of open-source code reproduced in this book are copyrighted by a large number of individual and corporate contributors. The code reproduced here has been licensed under the terms of the GNU Public License or GPL.\ Appendix A contains the text of the GNU General Public License.\ \ © Copyright Pearson Education. All rights reserved.

Foreword for the First Edition xxvForeword for the Second Edition xxviPreface xxviiAcknowledgments for the First Edition xxxiiiAcknowledgments for the Second Edition xxxvAbout the Author xxxviChapter 1 Introduction 11.1 Why Linux 21.2 Embedded Linux Today 31.3 Open Source and the GPL 31.3.1 Free Versus Freedom 41.4 Standards and Relevant Bodies 51.4.1 Linux Standard Base 51.4.2 Linux Foundation 61.4.3 Carrier-Grade Linux 61.4.4 Mobile Linux Initiative: Moblin 71.4.5 Service Availability Forum 71.5 Summary 81.5.1 Suggestions for Additional Reading 8Chapter 2 The Big Picture 92.1 Embedded or Not? 102.1.1 BIOS Versus Bootloader 112.2 Anatomy of an Embedded System 122.2.1 Typical Embedded Linux Setup 132.2.2 Starting the Target Board 142.2.3 Booting the Kernel 162.2.4 Kernel Initialization: Overview 182.2.5 First User Space Process: init 192.3 Storage Considerations 202.3.1 Flash Memory 202.3.2 NAND Flash 222.3.3 Flash Usage 232.3.4 Flash File Systems 242.3.5 Memory Space 252.3.6 Execution Contexts 262.3.7 Process Virtual Memory 282.3.8 Cross-Development Environment 302.4 Embedded Linux Distributions 322.4.1 Commercial Linux Distributions 332.4.2 Do-It-Yourself Linux Distributions 332.5 Summary 342.5.1 Suggestions for Additional Reading 35Chapter 3 Processor Basics 373.1 Stand-Alone Processors 383.1.1 IBM 970FX 393.1.2 Intel Pentium M 393.1.3 Intel Atom™ 403.1.4 Freescale MPC7448 403.1.5 Companion Chipsets 413.2 Integrated Processors: Systems on Chip 433.2.1 Power Architecture 443.2.2 Freescale Power Architecture 443.2.3 Freescale PowerQUICC I 453.2.4 Freescale PowerQUICC II 463.2.5 PowerQUICC II Pro 473.2.6 Freescale PowerQUICC III 483.2.7 Freescale QorIQ™ 483.2.8 AMCC Power Architecture 503.2.9 MIPS 533.2.10 Broadcom MIPS 543.2.11 Other MIPS 553.2.12 ARM 553.2.13 TI ARM 563.2.14 Freescale ARM 583.2.15 Other ARM Processors 593.3 Other Architectures 593.4 Hardware Platforms 603.4.1 CompactPCI 603.4.2 ATCA 603.5 Summary 613.5.1 Suggestions for Additional Reading 62Chapter 4 The Linux Kernel: A Different Perspective 634.1 Background 644.1.1 Kernel Versions 654.1.2 Kernel Source Repositories 674.1.3 Using git to Download a Kernel 684.2 Linux Kernel Construction 684.2.1 Top-Level Source Directory 694.2.2 Compiling the Kernel 694.2.3 The Kernel Proper: vmlinux 724.2.4 Kernel Image Components 734.2.5 Subdirectory Layout 774.3 Kernel Build System 784.3.1 The Dot-Config 784.3.2 Configuration Editor(s 804.3.3 Makefile Targets 834.4 Kernel Configuration 894.4.1 Custom Configuration Options 914.4.2 Kernel Makefiles 954.5 Kernel Documentation 964.6 Obtaining a Custom Linux Kernel 964.6.1 What Else Do I Need 974.7 Summary 974.7.1 Suggestions for Additional Reading 98Chapter 5 Kernel Initialization 995.1 Composite Kernel Image: Piggy and Friends 1005.1.1 The Image Object 1035.1.2 Architecture Objects 1045.1.3 Bootstrap Loader 1055.1.4 Boot Messages 1065.2 Initialization Flow of Control 1095.2.1 Kernel Entry Point: head.o 1115.2.2 Kernel Startup: main.c 1135.2.3 Architecture Setup 1145.3 Kernel Command-Line Processing 1155.3.1 The __setup Macro 1165.4 Subsystem Initialization 1225.4.1 The *__initcall Macros 1225.5 The init Thread 1255.5.1 Initialization Via initcalls 1265.5.2 initcall_debug 1275.5.3 Final Boot Steps 1275.6 Summary 1295.6.1 Suggestions for Additional Reading 130Chapter 6 User Space Initialization 1316.1 Root File System 1326.1.1 FHS: File System Hierarchy Standard 1336.1.2 File System Layout 1336.1.3 Minimal File System 1346.1.4 The Embedded Root FS Challenge 1366.1.5 Trial-and-Error Method 1376.1.6 Automated File System Build Tools 1376.2 Kernel’s Last Boot Steps 1376.2.1 First User Space Program 1396.2.2 Resolving Dependencies 1396.2.3 Customized Initial Process 1406.3 The init Process 1406.3.1 inittab 1436.3.2 Sample Web Server Startup Script 1456.4 Initial RAM Disk 1466.4.1 Booting with initrd 1476.4.2 Bootloader Support for initrd 1486.4.3 initrd Magic: linuxrc 1506.4.4 The initrd Plumbing 1516.4.5 Building an initrd Image 1526.5 Using initramfs 1536.5.1 Customizing initramfs 1546.6 Shutdown 1566.7 Summary 1566.7.1 Suggestions for Additional Reading 157Chapter 7 Bootloaders 1597.1 Role of a Bootloader 1607.2 Bootloader Challenges 1617.2.1 DRAM Controller 1617.2.2 Flash Versus RAM 1627.2.3 Image Complexity 1627.2.4 Execution Context 1657.3 A Universal Bootloader: Das U-Boot 1667.3.1 Obtaining U-Boot 1667.3.2 Configuring U-Boot 1677.3.3 U-Boot Monitor Commands 1697.3.4 Network Operations 1707.3.5 Storage Subsystems 1737.3.6 Booting from Disk 1747.4 Porting U-Boot 1747.4.1 EP405 U-Boot Port 1757.4.2 U-Boot Makefile Configuration Target 1767.4.3 EP405 First Build 1777.4.4 EP405 Processor Initialization 1787.4.5 Board-Specific Initialization 1817.4.6 Porting Summary 1847.4.7 U-Boot Image Format 1857.5 Device Tree Blob (Flat Device Tree 1877.5.1 Device Tree Source 1897.5.2 Device Tree Compiler 1927.5.3 Alternative Kernel Images Using DTB 1937.6 Other Bootloaders 1947.6.1 Lilo 1947.6.2 GRUB 1957.6.3 Still More Bootloaders 1977.7 Summary 1977.7.1 Suggestions for Additional Reading 198Chapter 8 Device Driver Basics 2018.1 Device Driver Concepts 2028.1.1 Loadable Modules 2038.1.2 Device Driver Architecture 2048.1.3 Minimal Device Driver Example 2048.1.4 Module Build Infrastructure 2058.1.5 Installing a Device Driver 2098.1.6 Loading a Module 2108.1.7 Module Parameters 2118.2 Module Utilities 2128.2.1 insmod 2128.2.2 lsmod 2138.2.3 modprobe 2138.2.4 depmod 2148.2.5 rmmod 2158.2.6 modinfo 2168.3 Driver Methods 2178.3.1 Driver File System Operations 2178.3.2 Allocation of Device Numbers 2208.3.3 Device Nodes and mknod 2208.4 Bringing It All Together 2228.5 Building Out-of-Tree Drivers 2238.6 Device Drivers and the GPL 2248.7 Summary 2258.7.1 Suggestions for Additional Reading 226Chapter 9 File Systems 2279.1 Linux File System Concepts 2289.1.1 Partitions 2299.2 ext2 2309.2.1 Mounting a File System 2329.2.2 Checking File System Integrity 2339.3 ext3 2359.4 ext4 2379.5 ReiserFS 2389.6 JFFS2 2399.6.1 Building a JFFS2 Image 2409.7 cramfs 2429.8 Network File System 2449.8.1 Root File System on NFS 2469.9 Pseudo File Systems 2489.9.1 /proc File System 2499.9.2 sysfs 2529.10 Other File Systems 2559.11 Building a Simple File System 2569.12 Summary 2589.12.1 Suggestions for Additional Reading 259Chapter 10 MTD Subsystem 26110.1 MTD Overview 26210.1.1 Enabling MTD Services 26310.1.2 MTD Basics 26510.1.3 Configuring MTD on Your Target 26710.2 MTD Partitions 26710.2.1 Redboot Partition Table Partitioning 26910.2.2 Kernel Command-Line Partitioning 27310.2.3 Mapping Driver 27410.2.4 Flash Chip Drivers 27610.2.5 Board-Specific Initialization 27610.3 MTD Utilities 27910.3.1 JFFS2 Root File System 28110.4 UBI File System 28410.4.1 Configuring for UBIFS 28410.4.2 Building a UBIFS Image 28410.4.3 Using UBIFS as the Root File System 28710.5 Summary 28710.5.1 Suggestions for Additional Reading 288Chapter 11 BusyBox 28911.1 Introduction to BusyBox 29011.1.1 BusyBox Is Easy 29111.2 BusyBox Configuration 29111.2.1 Cross-Compiling BusyBox 29311.3 BusyBox Operation 29311.3.1 BusyBox init 29711.3.2 Sample rcS Initialization Script 29911.3.3 BusyBox Target Installation 30011.3.4 BusyBox Applets 30211.4 Summary 30311.4.1 Suggestions for Additional Reading 304Chapter 12 Embedded Development Environment 30512.1 Cross-Development Environment 30612.1.1 “Hello World” Embedded 30712.2 Host System Requirements 31112.2.1 Hardware Debug Probe 31112.3 Hosting Target Boards 31212.3.1 TFTP Server 31212.3.2 BOOTP/DHCP Server 31312.3.3 NFS Server 31612.3.4 Target NFS Root Mount 31812.3.5 U-Boot NFS Root Mount Example 32012.4 Summary 32212.4.1 Suggestions for Additional Reading 323Chapter 13 Development Tools 32513.1 GNU Debugger (GDB) 32613.1.1 Debugging a Core Dump 32713.1.2 Invoking GDB 32913.1.3 Debug Session in GDB 33113.2 Data Display Debugger 33313.3 cbrowser/cscope 33513.4 Tracing and Profiling Tools 33713.4.1 strace 33713.4.2 strace Variations 34113.4.3 ltrace 34313.4.4 ps 34413.4.5 top 34613.4.6 mtrace 34813.4.7 dmalloc 35013.4.8 Kernel Oops 35313.5 Binary Utilities 35513.5.1 readelf 35513.5.2 Examining Debug Information Using readelf 35713.5.3 objdump 35913.5.4 objcopy 36013.6 Miscellaneous Binary Utilities 36113.6.1 strip 36113.6.2 addr2line 36113.6.3 strings 36213.6.4 ldd 36213.6.5 nm 36313.6.6 prelink 36413.7 Summary 36413.7.1 Suggestions for Additional Reading 365Chapter 14 Kernel Debugging Techniques 36714.1 Challenges to Kernel Debugging 36814.2 Using KGDB for Kernel Debugging 36914.2.1 KGDB Kernel Configuration 37114.2.2 Target Boot with KGDB Support 37214.2.3 Useful Kernel Breakpoints 37614.2.4 Sharing a Console Serial Port with KGDB 37714.2.5 Debugging Very Early Kernel Code 37914.2.6 KGDB Support in the Mainline Kernel 38014.3 Kernel Debugging Techniques 38114.3.1 gdb Remote Serial Protocol 38214.3.2 Debugging Optimized Kernel Code 38514.3.3 GDB User-Defined Commands 39214.3.4 Useful Kernel GDB Macros 39314.3.5 Debugging Loadable Modules 40214.3.6 printk Debugging 40714.3.7 Magic SysReq Key 40914.4 Hardware-Assisted Debugging 41014.4.1 Programming Flash Using a JTAG Probe 41114.4.2 Debugging with a JTAG Probe 41314.5 When It Doesn’t Boot 41714.5.1 Early Serial Debug Output 41714.5.2 Dumping the printk Log Buffer 41714.5.3 KGDB on Panic 42014.6 Summary 42114.6.1 Suggestions for Additional Reading 422Chapter 15 Debugging Embedded Linux Applications 42315.1 Target Debugging 42415.2 Remote (Cross) Debugging 42415.2.1 gdbserver 42715.3 Debugging with Shared Libraries 42915.3.1 Shared Library Events in GDB 43115.4 Debugging Multiple Tasks 43515.4.1 Debugging Multiple Processes 43515.4.2 Debugging Multithreaded Applications 43815.4.3 Debugging Bootloader/Flash Code 44115.5 Additional Remote Debug Options 44215.5.1 Debugging Using a Serial Port 44215.5.2 Attaching to a Running Process 44215.6 Summary 44315.6.1 Suggestions for Additional Reading 444Chapter 16 Open Source Build Systems 44516.1 Why Use a Build System? 44616.2 Scratchbox 44716.2.1 Installing Scratchbox 44716.2.2 Creating a Cross-Compilation Target 44816.3 Buildroot 45116.3.1 Buildroot Installation 45116.3.2 Buildroot Configuration 45116.3.3 Buildroot Build 45216.4 OpenEmbedded 45416.4.1 OpenEmbedded Composition 45516.4.2 BitBake Metadata 45616.4.3 Recipe Basics 45616.4.4 Metadata Tasks 46016.4.5 Metadata Classes 46116.4.6 Configuring OpenEmbedded 46216.4.7 Building Images 46316.5 Summary 46416.5.1 Suggestions for Additional Reading 464Chapter 17 Linux and Real Time 46517.1 What Is Real Time 46617.1.1 Soft Real Time 46617.1.2 Hard Real Time 46717.1.3 Linux Scheduling 46717.1.4 Latency 46717.2 Kernel Preemption 46917.2.1 Impediments to Preemption 46917.2.2 Preemption Models 47117.2.3 SMP Kernel 47217.2.4 Sources of Preemption Latency 47317.3 Real-Time Kernel Patch 47317.3.1 Real-Time Features 47517.3.2 O(1) Scheduler 47617.3.3 Creating a Real-Time Process 47717.4 Real-Time Kernel Performance Analysis 47817.4.1 Using Ftrace for Tracing 47817.4.2 Preemption Off Latency Measurement 47917.4.3 Wakeup Latency Measurement 48117.4.4 Interrupt Off Timing 48317.4.5 Soft Lockup Detection 48417.5 Summary 48517.5.1 Suggestion for Additional Reading 485Chapter 18 Universal Serial Bus 48718.1 USB Overview 48818.1.1 USB Physical Topology 48818.1.2 USB Logical Topology 49018.1.3 USB Revisions 49118.1.4 USB Connectors 49218.1.5 USB Cable Assemblies 49418.1.6 USB Modes 49418.2 Configuring USB 49518.2.1 USB Initialization 49718.3 sysfs and USB Device Naming 50018.4 Useful USB Tools 50218.4.1 USB File System 50218.4.2 Using usbview 50418.4.3 USB Utils (lsusb 50718.5 Common USB Subsystems 50818.5.1 USB Mass Storage Class 50818.5.2 USB HID Class 51118.5.3 USB CDC Class Drivers 51218.5.4 USB Network Support 51518.6 USB Debug 51618.6.1 usbmon 51718.6.2 Useful USB Miscellanea 51818.7 Summary 51918.7.1 Suggestions for Additional Reading 519Chapter 19 udev 52119.1 What Is udev? 52219.2 Device Discovery 52319.3 Default udev Behavior 52519.4 Understanding udev Rules 52719.4.1 Modalias 53019.4.2 Typical udev Rules Configuration 53319.4.3 Initial System Setup for udev 53519.5 Loading Platform Device Drivers 53819.6 Customizing udev Behavior 54019.6.1 udev Customization Example: USB Automounting 54019.7 Persistent Device Naming 54119.7.1 udev Helper Utilities 54219.8 Using udev with busybox 54519.8.1 busybox mdev 54519.8.2 Configuring mdev 54719.9 Summary 54819.9.1 Suggestions for Additional Reading 548Appendix A GNU Public License 549Preamble 550Terms and Conditions for Copying, Distribution, and Modification 551No Warranty 555Appendix B U-Boot Configurable Commands 557Appendix C BusyBox Commands 561Appendix D SDRAM Interface Considerations 571D.1 SDRAM Basics 572D.1.1 SDRAM Refresh 573D.2 Clocking 574D.3 SDRAM Setup 575D.4 Summary 580D.4.1 Suggestions for Additional Reading 580Appendix E Open Source Resources 581Source Repositories and Developer Information 582Mailing Lists 582Linux News and Developments 583Open Source Legal Insight and Discussion 583Appendix F Sample BDI-2000 Configuration File 585Index 593