Embedded Linux Primer: a Practical Real-World Approach
Total Page:16
File Type:pdf, Size:1020Kb
Embedded Linux Primer: A Practical, Real-World Approach By Christopher Hallinan ............................................... Publisher: Prentice Hall Pub Date: September 18, 2006 Print ISBN-10: 0-13-167984-8 Print ISBN-13: 978-0-13-167984-9 Pages: 576 Table of Contents | Index 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 embedded Linux environment, and shows how to use it as productively as possible. Hallinan begins by touring a typical Linux-based embedded system, introducing key concepts and components, and calling attention to differences between Linux and traditional embedded environments. Writing from the embedded developer's viewpoint, he thoroughly addresses issues ranging from kernel building and initialization to bootloaders, device drivers to file systems. Hallinan thoroughly covers the increasingly popular BusyBox utilities; presents a step-by-step walkthrough of porting Linux to custom boards; and introduces real-time configuration via CONFIG_RT--one of today's most exciting developments in embedded Linux. You'll find especially detailed coverage of using development tools to analyze and debug embedded systems--including the art of kernel debugging. Compare leading embedded Linux processors Understand the details of the Linux kernel initialization process Learn about the special role of bootloaders in embedded Linux systems, with specific emphasis on U-Boot Use embedded Linux file systems, including JFFS2--with detailed guidelines for building Flash- resident file system images Understand the Memory Technology Devices subsystem for flash (and other) memory devices Master gdb, KGDB, and hardware JTAG debugging Learn many tips and techniques for debugging within the Linux kernel Maximize your productivity in cross-development environments Prepare your entire development environment, including TFTP, DHCP, and NFS target servers Configure, build, and initialize BusyBox to support your unique requirements About the Author Christopher Hallinan, field applications engineer at MontaVista software, has worked for more than 20 years in assignments ranging from engineering and engineering management to marketing and business development. He spent four years as an independent development consultant in the embedded Linux marketplace. His work has appeared in magazines, including Telecommunications Magazine, Fiber Optics Magazine, and Aviation Digest. Embedded Linux Primer: A Practical, Real-World Approach By Christopher Hallinan ............................................... Publisher: Prentice Hall Pub Date: September 18, 2006 Print ISBN-10: 0-13-167984-8 Print ISBN-13: 978-0-13-167984-9 Pages: 576 Table of Contents | Index Copyright Prentice Hall Open Source Software Development Series Foreword Preface Acknowledgments About the Author Chapter 1. Introduction Section 1.1. Why Linux? Section 1.2. Embedded Linux Today Section 1.3. Open Source and the GPL Section 1.4. Standards and Relevant Bodies Section 1.5. Chapter Summary Chapter 2. Your First Embedded Experience Section 2.1. Embedded or Not? Section 2.2. Anatomy of an Embedded System Section 2.3. Storage Considerations Section 2.4. Embedded Linux Distributions Section 2.5. Chapter Summary Chapter 3. Processor Basics Section 3.1. Stand-alone Processors Section 3.2. Integrated Processors: Systems on Chip Section 3.3. Hardware Platforms Section 3.4. Chapter Summary Chapter 4. The Linux KernelA Different Perspective Section 4.1. Background Section 4.2. Linux Kernel Construction Section 4.3. Kernel Build System Section 4.4. Obtaining a Linux Kernel Section 4.5. Chapter Summary Chapter 5. Kernel Initialization Section 5.1. Composite Kernel Image: Piggy and Friends Section 5.2. Initialization Flow of Control Section 5.3. Kernel Command Line Processing Section 5.4. Subsystem Initialization Section 5.5. The init Thread Section 5.6. Chapter Summary Chapter 6. System Initialization Section 6.1. Root File System Section 6.2. Kernel's Last Boot Steps Section 6.3. The Init Process Section 6.4. Initial RAM Disk Section 6.5. Using initramfs Section 6.6. Shutdown Section 6.7. Chapter Summary Chapter 7. Bootloaders Section 7.1. Role of a Bootloader Section 7.2. Bootloader Challenges Section 7.3. A Universal Bootloader: Das U-Boot Section 7.4. Porting U-Boot Section 7.5. Other Bootloaders Section 7.6. Chapter Summary Chapter 8. Device Driver Basics Section 8.1. Device Driver Concepts Section 8.2. Module Utilities Section 8.3. Driver Methods Section 8.4. Bringing It All Together Section 8.5. Device Drivers and the GPL Section 8.6. Chapter Summary Chapter 9. File Systems Section 9.1. Linux File System Concepts Section 9.2. ext2 Section 9.3. ext3 Section 9.4. ReiserFS Section 9.5. JFFS2 Section 9.6. cramfs Section 9.7. Network File System Section 9.8. Pseudo File Systems Section 9.9. Other File Systems Section 9.10. Building a Simple File System Section 9.11. Chapter Summary Chapter 10. MTD Subsystem Section 10.1. Enabling MTD Services Section 10.2. MTD Basics Section 10.3. MTD Partitions Section 10.4. MTD Utilities Section 10.5. Chapter Summary Chapter 11. BusyBox Section 11.1. Introduction to BusyBox Section 11.2. BusyBox Configuration Section 11.3. BusyBox Operation Section 11.4. Chapter Summary Chapter 12. Embedded Development Environment Section 12.1. Cross-Development Environment Section 12.2. Host System Requirements Section 12.3. Hosting Target Boards Section 12.4. Chapter Summary Chapter 13. Development Tools Section 13.1. GNU Debugger (GDB) Section 13.2. Data Display Debugger Section 13.3. cbrowser/cscope Section 13.4. Tracing and Profiling Tools Section 13.5. Binary Utilities Section 13.6. Miscellaneous Binary Utilities Section 13.7. Chapter Summary Chapter 14. Kernel Debugging Techniques Section 14.1. Challenges to Kernel Debugging Section 14.2. Using KGDB for Kernel Debugging Section 14.3. Debugging the Linux Kernel Section 14.4. Hardware-Assisted Debugging Section 14.5. When It Doesn't Boot Section 14.6. Chapter Summary Chapter 15. Debugging Embedded Linux Applications Section 15.1. Target Debugging Section 15.2. Remote (Cross) Debugging Section 15.3. Debugging with Shared Libraries Section 15.4. Debugging Multiple Tasks Section 15.5. Additional Remote Debug Options Section 15.6. Chapter Summary Chapter 16. Porting Linux Section 16.1. Linux Source Organization Section 16.2. Custom Linux for Your Board Section 16.3. Platform Initialization Section 16.4. Putting It All Together Section 16.5. Chapter Summary Chapter 17. Linux and Real Time Section 17.1. What Is Real Time? Section 17.2. Kernel Preemption Section 17.3. Real-Time Kernel Patch Section 17.4. Debugging the Real-Time Kernel Section 17.5. Chapter Summary Appendix A. GNU Public License Preamble Terms and Conditions for Copying, Distribution and Modification No Warranty Appendix B. U-Boot Configurable Commands Appendix C. BusyBox Commands Appendix D. SDRAM Interface Considerations Section D.1. SDRAM Basics Section D.2. Clocking Section D.3. SDRAM Setup Section D.4. Summary Appendix E. Open Source Resources Source Repositories and Developer Information Mailing Lists Linux News and Developments Open Source Insight and Discussion Appendix F. Sample BDI-2000 Configuration File Index Copyright 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 the publisher was aware of a trademark claim, the designations have been printed with initial capital letters or in all capitals. The author and publisher have taken care in the preparation of this book but make no expressed or implied warranty of any kind and assume no responsibility for errors or omissions. No liability is assumed for incidental or consequential damages in connection with or arising out of the use of the information or programs contained herein. The publisher offers excellent discounts on this book when ordered in quantity for bulk purchases or special sales, which may include electronic versions and/or custom covers and content particular to your business, training goals, marketing focus, and branding interests. For more information, please contact: U.S. Corporate and Government Sales (800) 382-3419 [email protected] For sales outside the United States, please contact: International Sales [email protected] Visit us on the Web: www.prenhallprofessional.com Copyright © 2007 Pearson Education, Inc. All rights reserved. Printed in the United States of America. This publication is protected by copyright, and permission must be obtained from the publisher prior to any prohibited reproduction, storage in a retrieval system, or transmission in any form or by any means, electronic, mechanical, photocopying, recording, or likewise. For information regarding permissions, write to: Pearson Education, Inc. Rights and Contracts Department One Lake Street Upper Saddle River, NJ 07458 Fax: (201) 236-3290 Text printed in the United States on recycled paper at R.R. Donnelley in Crawfordsville, Indiana. First printing, September, 2006 Library of Congress Cataloging-in-Publication Data: Hallinan, Christopher.