E-Book, Englisch, 550 Seiten
Sally Pro Linux Embedded Systems
1. ed
ISBN: 978-1-4302-7226-7
Verlag: Apress
Format: PDF
Kopierschutz: 1 - PDF Watermark
E-Book, Englisch, 550 Seiten
ISBN: 978-1-4302-7226-7
Verlag: Apress
Format: PDF
Kopierschutz: 1 - PDF Watermark
Today, Linux is included with nearly every embedded platform. Embedded developers can take a more modern route and spend more time tuning Linux and taking advantage of open source code to build more robust, feature-rich applications. While Gene Sally does not neglect porting Linux to new hardware, modern embedded hardware is more sophisticated than ever: most systems include the capabilities found on desktop systems. This book is written from the perspective of a user employing technologies and techniques typically reserved for desktop systems. Modern guide for developing embedded Linux systems Shows you how to work with existing Linux embedded system, while still teaching how to port Linux Explains best practices from somebody who has done it before
Gene Sally has been working with computers ever since his awkward teenage years. For the past eight or so years, Gene has been employed as an engineer, technical writer, trainer and expert tinkerer with Linux in an embedded environment.
Autoren/Hrsg.
Weitere Infos & Material
1;Contents at a Glance;5
2;Table of contents;6
3;About the Author;17
4;About the Technical Reviewer;18
5;Acknowledgments;19
6;Introduction;20
7;CHAPTER 1 About Embedded Linux;22
7.1;Why Use Embedded Linux?;23
7.1.1;Technical Reasons to Use Embedded Linux;23
7.1.1.1;Standards Based;24
7.1.1.2;Process Isolation and Control;25
7.1.1.3;Peripheral Support;27
7.1.1.4;Security;27
7.1.2;Commercial Reasons to Use Embedded Linux;28
7.2;10,000-Foot Embedded Linux Development Flyover;30
7.2.1;Target Hardware;30
7.2.2;Obtaining Linux;31
7.2.3;Booting Linux;31
7.2.4;Development Environment;31
7.2.5;System Design;32
7.3;Anatomy of an Embedded Linux System;32
7.3.1;Boot Loader;33
7.3.2;Kernel;34
7.3.3;Root File System;34
7.3.4;Your Application;35
7.3.5;Cross-Compiler;35
7.3.6;Tools of the Trade;36
7.3.6.1;The GNU Compiler Collection;36
7.3.6.1.1;GDB;36
7.3.6.2;BusyBox;37
7.3.6.3;uClibc;37
7.3.6.4;Automake/Autoconf;38
7.3.6.5;Packaging Systems;38
7.3.6.6;Patch;39
7.3.6.7;Make;39
7.4;Where to Get Help;40
7.4.1;University of Google;40
7.4.2;Mailing Lists and Newsgroups;40
7.4.2.1;Etiquette;41
7.4.3;Trade Group and Community Interest Sites;42
7.4.3.1;Vendor-Sponsored Resources;41
7.4.4;IRC;44
7.5;Next Up;44
8;CHAPTER 2 Configuring the Software Environment;45
8.1;Host Services;63
8.1.1;Host Environment;46
8.1.1.1;Linux;46
8.1.1.1.1;Debian (Ubuntu) Systems;47
8.1.1.1.2;RPM;48
8.1.1.2;Windows;49
8.1.1.2.1;Cygwin;49
8.1.1.2.2;Virtual Linux Machines on Windows;59
8.1.2;Turn Off Your Firewall;64
8.1.3;TFTP;64
8.1.4;DHCP;65
8.1.5;NFS;67
8.1.5.1;NFS with Cygwin;68
8.1.6;PXE;70
8.2;Cabling;71
8.2.1;Serial (for Console);71
8.2.2;Network;71
8.3;Avoiding an Angry Visit from IT;72
8.3.1;Dual-Homed Host;72
9;CHAPTER 3 Target Emulationand Virtual Machines;74
9.1;Why Target Emulation?;74
9.2;Emulation via QEMU;75
9.2.1;Compiling QEMU;75
9.2.2;Using QEMU to Emulate a Target;77
9.2.3;Using QEMU to Compile under Emulation;79
9.3;Virtualization Software for x86 Hosts;80
9.3.1;Approaches to Virtualization;80
9.4;Summary;81
10;CHAPTER 4 Starting Your Project;82
10.1;Most Boards Include a Linux Distribution;83
10.2;What to Do After Unpacking the Board;84
10.2.1;Have Linux? Boot It!;85
10.2.2;Assess the Kernel;92
10.2.2.1;Locate Sources and Patches;92
10.2.2.2;Locate the Configuration;93
10.2.3;Understand the RFS;95
10.2.3.1;File System Format;95
10.2.3.2;Locate Sources for the Root File System;98
10.2.3.3;Devices and In-Memory File Systems;98
10.3;Suitability for Your Project;99
10.3.1;Cross-Compiler;100
10.4;Moving Forward;101
11;CHAPTER 5 Getting Linux for Your Board;102
11.1;Obtaining Linux from the Board Vendor;103
11.1.1;Questions You Should Ask Your Board Vendor;103
11.1.2;Now That You’re a Customer…;106
11.2;Open Source Embedded Distributions;106
11.2.1;Why Embedded Linux Distribution Builders Exist;107
11.2.2;Should You Use One?;107
11.2.3;Popular Open Source Embedded Distributions;108
11.2.3.1;LTIB (http://www.bitshrine.org);108
11.2.3.2;Buildroot (http://buildroot.uclibc.org/);112
11.2.3.3;OpenEmbedded (http://wiki.openembedded.net/);117
11.2.4;Getting Linux from Commercial Vendors and Consultants;121
11.2.4.1;Do You Need a Commercial Vendor?;121
11.2.4.2;What You Should Expect;122
11.2.5;Roundup of Vendors;123
11.2.5.1;Wind River;123
11.2.5.2;MontaVista;123
11.2.5.3;Embedded Alley;124
11.2.5.4;DENX;124
11.2.5.5;Free Electrons;124
11.2.5.6;Code Sourcery;125
11.2.6;What’s Next;125
12;CHAPTER 6 Creating a Linux Distributionfrom Scratch;126
12.1;Cross-Compiler Basics;127
12.1.1;A Note about Building Software;128
12.1.2;Get Comfortable with the Command Line;129
12.2;Overview of Building a GCC Cross-Compiler;130
12.2.1;The C Library;131
12.2.2;Gathering Sources;131
12.2.2.1;Getting Sources via Source Control;132
12.2.2.2;Getting via Source Archives;134
12.2.3;Building GCC;136
12.2.3.1;The Build Environment;136
12.2.3.2;Binutils;138
12.2.3.3;Kernel Headers;139
12.2.3.4;Bootstrap (Stage 1) GCC;140
12.2.3.5;Creating Glibc Headers;142
12.2.3.6;Building Glibc;144
12.2.3.7;Building the Next GCC;145
12.2.3.8;Building GMP and MPFR;146
12.2.3.9;Building the Final GCC;148
12.3;Building Toolchains with Crosstool-NG;149
12.4;Creating the Root File System;150
12.4.1;Configuring the Environment;151
12.4.2;Building and Installing BusyBox;151
12.4.3;Libraries;152
12.4.4;Finishing Touches;153
12.4.5;Building the Kernel;154
12.4.6;Troubleshooting Booting Problems;157
12.4.6.1;Improperly Configured Board;157
12.4.6.2;The Root File System Can’t Be Mounted;158
12.4.6.3;The Root File System init Program Doesn’t Run;158
12.5;Distributing the Distribution;159
12.6;Wrapping Up;160
13;CHAPTER 7 Booting the Board;161
13.1;Booting a Linux System Is a Three-Act Play;161
13.1.1;The Boot Loader;161
13.1.2;Kernel-Land vs. Userland;164
13.2;Boot Loaders;165
13.2.1;RedBoot;165
13.2.2;YAMON;167
13.2.3;Das U-Boot;168
13.2.4;LILO;169
13.2.5;GRUB;170
13.2.6;About Flash Memory;170
13.3;Kernel Startup;171
13.3.1;The Kernel Entry Point;172
13.3.1.1;Sysfs and Device Management;173
13.3.1.2;Finding a Root File System;174
13.3.2;Userland Startup;179
13.3.2.1;What an Init Program Needs to Do;182
13.3.2.2;Mysteries of the /etc/init.d Directory;182
13.3.3;BusyBox Init;183
13.3.4;Your Init;183
13.4;What’s Next;185
14;CHAPTER 8 Configuring the ApplicationDevelopment Environment;186
14.1;Pick the Right Tool for the Job;186
14.2;Know Your Application;186
14.2.1;Hardware Constraints;187
14.2.1.1;Software Constraints;188
14.3;What to Use for Development;189
14.3.1;C;189
14.3.2;C++;190
14.3.3;Java;190
14.3.3.1;Java Runtime Environment;190
14.3.3.2;Embedding Java: Using GCJ;191
14.3.3.3;Compiling Java Code with GCJ;191
14.3.3.4;Embedded GCJ;191
14.4;Non-Traditional Embedded Languages;192
14.4.1;Python;192
14.4.1.1;Embedding Python;192
14.4.1.2;Debugging;193
14.4.2;TCL;194
14.4.2.1;Embedding TCL;194
14.4.2.2;Debugging;195
14.4.3;Shell Scripting;195
14.4.3.1;Embedded Shell Scripting;196
14.4.4;PHP;196
14.4.4.1;Embedding PHP;197
14.5;Performance and Profiling Tools;197
14.5.1;Profiling;197
14.5.1.1;Gprof Option Reference;201
14.5.2;Leak Detection;201
14.5.2.1;dmalloc;202
14.5.2.2;Mpatrol;203
14.5.3;Static Analysis;204
14.6;IDE;205
14.6.1;Your Editor + Make + Shell;205
14.6.1.1;Using Make;206
14.6.2;Eclipse;208
14.6.2.1;Installing Eclipse and Plug-ins;208
14.6.2.2;Using Eclipse;211
14.7;What’s Next;213
15;CHAPTER 9 Application Development;214
15.1;Getting Started on Your Application;214
15.2;Desktop vs. Target;214
15.2.1;Coding for Portability;215
15.2.2;System Differences;216
15.2.2.1;FIFO;216
15.3;Hello World;217
15.3.1;Getting the Tools;218
15.3.2;Making Make Work;218
15.3.3;Running the Code on the Target;222
15.3.4;More Complex Projects;223
15.4;Getting Ready for Debugging;228
15.5;What’s Next;230
16;CHAPTER 10 Debugging Applications;231
16.1;Getting Started on Your Application;231
16.2;Types of Debugging;231
16.3;Remote Debugging Overview;232
16.4;Debugging C and C++;233
16.4.1;Building GDB;233
16.4.2;GDB Front Ends;234
16.4.3;Compiling for Debugging;235
16.4.3.1;GDB Command Line Survival Guide;237
16.4.3.2;Remote Debugging with DDD;238
16.4.3.3;Remote Debugging with GNU Emacs;240
16.4.3.4;Remote Debugging with Eclipse;241
16.5;Debugging Java;245
16.6;Instrumentation;249
16.7;Java Instrumentation;251
16.8;Instrumentation in Scripting Languages;252
16.9;What’s Next;252
17;CHAPTER 11 Kernel Configurationand Development;253
17.1;Kernel Project Layout;253
17.1.1;Downloading the Kernel;255
17.1.1.1;Downloading a Compressed Tar File;256
17.1.1.2;Using Git to Clone the Repository;257
17.1.2;Building the Kernel;257
17.1.2.1;How Kernel Configuration Works;260
17.1.2.2;Default Configurations;261
17.1.2.3;Editing .config By Hand;263
17.1.2.4;Building the Kernel;263
17.1.2.5;Building Modules;266
17.1.2.6;Cleaning Up;267
17.2;Open Source Community;268
17.2.1;The Kernel Development Process;268
17.2.2;Contributing to the Linux Kernel;268
17.2.3;Applying Patches;270
17.2.4;What’s Next;271
18;CHAPTER 12 Real Time;272
18.1;Real-Time Core Concepts;273
18.1.1;Deadline;273
18.1.2;Latency;274
18.1.3;Jitter;274
18.1.4;Predictability;274
18.1.5;Worst Case;274
18.1.6;Priority Inversion;274
18.1.7;Periodic Task;274
18.2;The Linux Scheduler;275
18.2.1;Group Scheduling;275
18.3;Real-Time Scheduler;275
18.4;Real-Time Implementation in Linux;276
18.4.1;Getting the Patch;277
18.5;Real-Time Programming Practices;279
18.5.1;The One Real-Time Process;279
18.5.2;Lock Memory;279
18.5.3;Avoid the Heap;280
18.5.4;Asking for Priority Inheritance Mutexes;280
18.5.5;I/O Is Nondeterministic;281
18.5.6;Using Thread Pools;281
18.5.7;LatencyTOP;282
18.6;Common Hardware Pitfalls;285
18.6.1;System Management Interrupts;285
18.6.2;VGA Console;285
18.6.3;DMA Bus Mastering;285
18.7;Summary;286
19;CHAPTER 13 Using Open Source Software Projects;287
19.1;Using Open Source Packages;287
19.1.1;How an Open Source Project Is Structured;288
19.1.2;The Project Team Isn’t Your Extended Workforce;289
19.1.3;Understand the Licensing;289
19.1.3.1;Permissive vs. Restrictive Licenses;289
19.1.3.2;Common Licensing Types;290
19.1.4;Downloading;291
19.1.5;Using Source Control Systems to Fetch Code;292
19.1.5.1;Using CVS;293
19.1.5.2;Using Subversion;294
19.1.5.3;Using Git;295
19.1.5.4;Using Mercurial;295
19.1.6;Cross-Compiling;296
19.1.7;Using configure;296
19.1.7.1;Creating the Script;297
19.1.7.2;Gaming the Cache;299
19.1.7.3;Installation;300
19.1.7.4;Setting Other Configure Options;300
19.1.7.5;Configuration Process for Non-Automake Projects;301
19.1.8;Building and Installing;302
19.2;Commonly Used Projects;303
19.2.1;DirectFB;303
19.2.2;Dropbear;303
19.2.3;QT/Qtopia;303
19.2.4;JamVM;303
19.2.5;Rzsz;304
19.2.6;Netcat;304
19.2.7;TinyXML;304
19.2.8;Micro_httpd;304
19.2.9;Stupid-FTPd;305
19.2.10;Quagga;305
19.2.11;Tslib;305
19.2.12;fgetty;305
20;CHAPTER 14 BusyBox;306
20.1;How a BusyBox-Based System Is Structured;306
20.2;Building a BusyBox-Based System;307
20.2.1;Download the Software;308
20.2.2;Configure;308
20.2.2.1;Build;310
20.2.2.2;Install;311
20.2.2.3;Copy Libraries;312
20.2.2.3.1;Add Help Text;318
20.2.2.4;Default Init Scripts;312
20.2.2.5;Update Permissions;314
20.2.2.6;Create Additional Folders;314
20.2.2.7;Create Device Nodes;315
20.3;What Makes BusyBox Small?;315
20.4;Creating Your Own Applet;316
20.4.1;Create the Applet Code;316
20.4.1.1;Add the Applet to the Make File;317
20.4.1.2;Register Applet with BusyBox;317
20.4.1.3;Build and Verify;318
20.5;Getting Help;320
20.6;What’s Next;320
21;CHAPTER 15 System Design;321
21.1;The Big Picture;321
21.2;Configuring the Boot Loader and Kernel;322
21.2.1;U-Boot;322
21.2.2;Other Boot loaders;325
21.2.3;Execute in Place;325
21.3;Selecting a Root File System;325
21.3.1;Block-Based File Systems;326
21.3.1.1;Ext2;328
21.3.1.2;Ext3;329
21.3.1.3;SquashFS;329
21.3.1.4;CramFS;329
21.3.1.5;Romfs;329
21.3.1.6;MINIX;329
21.3.2;MTD File Systems;330
21.3.2.1;JFFS2;330
21.3.2.2;YAFFS2;331
21.3.3;RAM Buffer–Based File Systems;331
21.3.3.1;Rafms;331
21.3.3.2;Tmpfs;331
21.3.3.3;Initramfs;331
21.3.4;File System Pairings;332
21.4;Assembling a Root File System;332
21.4.1;Create the Staging Area;332
21.4.2;Create a Directory Skeleton;333
21.4.3;Gather Libraries and Required Files;333
21.4.3.1;Required Files;334
21.4.4;Create Initialization Scripts;335
21.4.4.1;Using Init and Inittab;336
21.4.4.2;Using a Script;337
21.4.4.3;Using a Program;337
21.4.5;Set Ownership and Permissions;339
21.5;Security;340
21.5.1;Built-In Security;340
21.5.2;SELinux;341
21.5.2.1;Reference Policies;343
21.5.2.2;Using SEEdit;343
21.5.3;PAM;344
21.6;What’s Next;346
22;CHAPTER 16 System Tuning;347
22.1;Three or Fewer Megabytes;347
22.2;16–32 Megabytes;348
22.3;More than a Gigabyte;348
22.4;Reducing the Size of the Root File System;349
22.4.1;Start from Zero;349
22.4.1.1;Mounting Small File Systems;350
22.4.1.2;Shared Libraries;351
22.4.2;Compiling to Save Space;352
22.4.2.1;GCCs -Os;353
22.4.2.2;Static Linking;353
22.4.2.3;Stripping;355
22.5;Reducing the Size of the Kernel;355
22.6;Removing Unneeded Features and Drivers;356
22.6.1;Recommendations for Embedded Systems;357
22.6.2;Measuring;359
22.6.3;Using the Bloat-O-Meter;361
22.7;Minimizing Boot Time;361
22.7.1;Reducing Kernel Boot-Up Time;362
22.7.1.1;Uncompressed Kernel Image;362
22.7.1.2;No Console Output on Boot;362
22.7.1.3;Deferred Initialization;363
22.7.1.4;No Kernel Modules;364
22.7.2;Reducing Kernel Boot-Up Time;362
22.7.2.1;Uncompressed Kernel Image;362
22.7.2.2;No Console Output on Boot;362
22.7.2.3;Deferred Initialization;363
22.7.2.4;No Kernel Modules;364
22.7.3;Measuring Kernel Boot-Up Times;364
22.7.3.1;/proc/uptime;364
22.7.3.2;Grabserial;364
22.7.3.3;Initcall_debug;367
22.7.4;Reducing Root File System Startup Times;368
22.7.4.1;Use a Read-Only File System;368
22.7.4.2;Replacing Initialization Scripts;369
22.7.4.3;Inittab Abuse;371
22.7.4.4;Link with GNU Hash Style;372
22.8;What’s Next;373
23;CHAPTER 17 Deploying Applications;374
23.1;Deployment for Embedded Devices;374
23.1.1;Requirements;375
23.1.2;Industrial Design;376
23.1.3;Mechanical Design;376
23.1.4;Electrical Engineering;377
23.1.5;Manufacturing Engineering;378
23.1.6;Software Design;378
23.1.7;Software Engineering;379
23.1.8;Manufacturing;380
23.2;Deployment Strategies and Tactics;382
23.3;Boot Loaders;383
23.3.1;In General;383
23.3.2;UBOOT: Configuring Initial Parameters;384
23.3.3;Expect;385
23.3.3.1;Installing Expect;386
23.3.3.2;Expect on Windows;386
23.3.3.3;Using Expect;386
23.3.4;Boot Loaders Are Just Programs;388
23.4;Deployment Root File Systems;389
23.4.1;Application Files and Libraries;390
23.4.1.1;Small Root File Systems;390
23.4.2;First Field Update at the Factory;392
23.5;What’s Next;392
24;CHAPTER 18 Handling Field Updates;393
24.1;Root File System Updates;393
24.1.1;Basic Strategies;394
24.1.2;Forklift Upgrade;394
24.1.2.1;Designing for Forklift Upgrades;395
24.1.2.2;MTD Utilities;396
24.1.2.3;Forklift-Upgrade Example;396
24.1.3;Parallel Systems;398
24.1.3.1;Parallel System Example;398
24.1.4;Do It Yourself;399
24.1.4.1;Do-It-Yourself Example;400
24.1.5;Using Package Managers;400
24.1.5.1;RPM;401
24.1.5.2;Dpkg;405
24.1.5.3;Ipkg;408
24.1.6;Initramfs Root File Systems;411
24.2;Kernel Updates;411
24.2.1;Basic Strategies;412
24.2.1.1;Update Kernel Modules;412
24.2.1.2;Forklift Upgrade;412
24.2.2;Modules;413
24.2.2.1;Using Modprobe;413
24.2.2.2;Roll Your Own;414
24.2.3;Forklift;415
24.3;Field Update Failures;416
24.3.1;Report Failure, Stop;416
24.3.2;Failsafe Root File System;416
24.3.3;Failsafe Kernel;416
24.4;In Summary;417
25;Index;418




