Pro Linux Embedded Systems (eBook)
XX, 550 Seiten
Apress (Verlag)
978-1-4302-7226-7 (ISBN)
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.
When I got started in embedded Linux nearly a decade ago, the question was, "e;Should I even use an operating system?"e; Going with Linux frequently meant porting the operating system to run on your target hardware and building to the tools to do so. Much has changed over the years, to the point that Linux is selected by default for many projects, and the decisions revolve around what features of the operating system can be used on the project. The question today is, "e;How should I configure my Linux distribution?"e; In technology terms, this is a seismic shift in developer attitudes in a very short time frame. Linux is so pervasive in the embedded space that embedded processors and boards ship with Linux by default. Buyers simply expect that the board will boot Linux and they'll have the tools they need for embedded development provided along with the hardware. Unlike in the early days of Linux, as a developer, you won't be porting Linux to your board but rather configuring an already-running Linux kernel and root file system so that they suit your application.
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.
Contents at a Glance 5
Table of contents 6
About the Author 17
About the Technical Reviewer 18
Acknowledgments 19
Introduction 20
CHAPTER 1 About Embedded Linux 22
Why Use Embedded Linux? 23
Technical Reasons to Use Embedded Linux 23
Standards Based 24
Process Isolation and Control 25
Peripheral Support 27
Security 27
Commercial Reasons to Use Embedded Linux 28
10,000-Foot Embedded Linux Development Flyover 30
Target Hardware 30
Obtaining Linux 31
Booting Linux 31
Development Environment 31
System Design 32
Anatomy of an Embedded Linux System 32
Boot Loader 33
Kernel 34
Root File System 34
Your Application 35
Cross-Compiler 35
Tools of the Trade 36
The GNU Compiler Collection 36
GDB 36
BusyBox 37
uClibc 37
Automake/Autoconf 38
Packaging Systems 38
Patch 39
Make 39
Where to Get Help 40
University of Google 40
Mailing Lists and Newsgroups 40
Etiquette 41
Trade Group and Community Interest Sites 42
Vendor-Sponsored Resources 41
IRC 44
Next Up 44
CHAPTER 2 Configuring the Software Environment 45
Host Services 63
Host Environment 46
Linux 46
Debian (Ubuntu) Systems 47
RPM 48
Windows 49
Cygwin 49
Virtual Linux Machines on Windows 59
Turn Off Your Firewall 64
TFTP 64
DHCP 65
NFS 67
NFS with Cygwin 68
PXE 70
Cabling 71
Serial (for Console) 71
Network 71
Avoiding an Angry Visit from IT 72
Dual-Homed Host 72
CHAPTER 3 Target Emulationand Virtual Machines 74
Why Target Emulation? 74
Emulation via QEMU 75
Compiling QEMU 75
Using QEMU to Emulate a Target 77
Using QEMU to Compile under Emulation 79
Virtualization Software for x86 Hosts 80
Approaches to Virtualization 80
Summary 81
CHAPTER 4 Starting Your Project 82
Most Boards Include a Linux Distribution 83
What to Do After Unpacking the Board 84
Have Linux? Boot It! 85
Assess the Kernel 92
Locate Sources and Patches 92
Locate the Configuration 93
Understand the RFS 95
File System Format 95
Locate Sources for the Root File System 98
Devices and In-Memory File Systems 98
Suitability for Your Project 99
Cross-Compiler 100
Moving Forward 101
CHAPTER 5 Getting Linux for Your Board 102
Obtaining Linux from the Board Vendor 103
Questions You Should Ask Your Board Vendor 103
Now That You’re a Customer… 106
Open Source Embedded Distributions 106
Why Embedded Linux Distribution Builders Exist 107
Should You Use One? 107
Popular Open Source Embedded Distributions 108
LTIB (http://www.bitshrine.org) 108
Buildroot (http://buildroot.uclibc.org/) 112
OpenEmbedded (http://wiki.openembedded.net/) 117
Getting Linux from Commercial Vendors and Consultants 121
Do You Need a Commercial Vendor? 121
What You Should Expect 122
Roundup of Vendors 123
Wind River 123
MontaVista 123
Embedded Alley 124
DENX 124
Free Electrons 124
Code Sourcery 125
What’s Next 125
CHAPTER 6 Creating a Linux Distributionfrom Scratch 126
Cross-Compiler Basics 127
A Note about Building Software 128
Get Comfortable with the Command Line 129
Overview of Building a GCC Cross-Compiler 130
The C Library 131
Gathering Sources 131
Getting Sources via Source Control 132
Getting via Source Archives 134
Building GCC 136
The Build Environment 136
Binutils 138
Kernel Headers 139
Bootstrap (Stage 1) GCC 140
Creating Glibc Headers 142
Building Glibc 144
Building the Next GCC 145
Building GMP and MPFR 146
Building the Final GCC 148
Building Toolchains with Crosstool-NG 149
Creating the Root File System 150
Configuring the Environment 151
Building and Installing BusyBox 151
Libraries 152
Finishing Touches 153
Building the Kernel 154
Troubleshooting Booting Problems 157
Improperly Configured Board 157
The Root File System Can’t Be Mounted 158
The Root File System init Program Doesn’t Run 158
Distributing the Distribution 159
Wrapping Up 160
CHAPTER 7 Booting the Board 161
Booting a Linux System Is a Three-Act Play 161
The Boot Loader 161
Kernel-Land vs. Userland 164
Boot Loaders 165
RedBoot 165
YAMON 167
Das U-Boot 168
LILO 169
GRUB 170
About Flash Memory 170
Kernel Startup 171
The Kernel Entry Point 172
Sysfs and Device Management 173
Finding a Root File System 174
Userland Startup 179
What an Init Program Needs to Do 182
Mysteries of the /etc/init.d Directory 182
BusyBox Init 183
Your Init 183
What’s Next 185
CHAPTER 8 Configuring the ApplicationDevelopment Environment 186
Pick the Right Tool for the Job 186
Know Your Application 186
Hardware Constraints 187
Software Constraints 188
What to Use for Development 189
C 189
C++ 190
Java 190
Java Runtime Environment 190
Embedding Java: Using GCJ 191
Compiling Java Code with GCJ 191
Embedded GCJ 191
Non-Traditional Embedded Languages 192
Python 192
Embedding Python 192
Debugging 193
TCL 194
Embedding TCL 194
Debugging 195
Shell Scripting 195
Embedded Shell Scripting 196
PHP 196
Embedding PHP 197
Performance and Profiling Tools 197
Profiling 197
Gprof Option Reference 201
Leak Detection 201
dmalloc 202
Mpatrol 203
Static Analysis 204
IDE 205
Your Editor + Make + Shell 205
Using Make 206
Eclipse 208
Installing Eclipse and Plug-ins 208
Using Eclipse 211
What’s Next 213
CHAPTER 9 Application Development 214
Getting Started on Your Application 214
Desktop vs. Target 214
Coding for Portability 215
System Differences 216
FIFO 216
Hello World 217
Getting the Tools 218
Making Make Work 218
Running the Code on the Target 222
More Complex Projects 223
Getting Ready for Debugging 228
What’s Next 230
CHAPTER 10 Debugging Applications 231
Getting Started on Your Application 231
Types of Debugging 231
Remote Debugging Overview 232
Debugging C and C++ 233
Building GDB 233
GDB Front Ends 234
Compiling for Debugging 235
GDB Command Line Survival Guide 237
Remote Debugging with DDD 238
Remote Debugging with GNU Emacs 240
Remote Debugging with Eclipse 241
Debugging Java 245
Instrumentation 249
Java Instrumentation 251
Instrumentation in Scripting Languages 252
What’s Next 252
CHAPTER 11 Kernel Configurationand Development 253
Kernel Project Layout 253
Downloading the Kernel 255
Downloading a Compressed Tar File 256
Using Git to Clone the Repository 257
Building the Kernel 257
How Kernel Configuration Works 260
Default Configurations 261
Editing .config By Hand 263
Building the Kernel 263
Building Modules 266
Cleaning Up 267
Open Source Community 268
The Kernel Development Process 268
Contributing to the Linux Kernel 268
Applying Patches 270
What’s Next 271
CHAPTER 12 Real Time 272
Real-Time Core Concepts 273
Deadline 273
Latency 274
Jitter 274
Predictability 274
Worst Case 274
Priority Inversion 274
Periodic Task 274
The Linux Scheduler 275
Group Scheduling 275
Real-Time Scheduler 275
Real-Time Implementation in Linux 276
Getting the Patch 277
Real-Time Programming Practices 279
The One Real-Time Process 279
Lock Memory 279
Avoid the Heap 280
Asking for Priority Inheritance Mutexes 280
I/O Is Nondeterministic 281
Using Thread Pools 281
LatencyTOP 282
Common Hardware Pitfalls 285
System Management Interrupts 285
VGA Console 285
DMA Bus Mastering 285
Summary 286
CHAPTER 13 Using Open Source Software Projects 287
Using Open Source Packages 287
How an Open Source Project Is Structured 288
The Project Team Isn’t Your Extended Workforce 289
Understand the Licensing 289
Permissive vs. Restrictive Licenses 289
Common Licensing Types 290
Downloading 291
Using Source Control Systems to Fetch Code 292
Using CVS 293
Using Subversion 294
Using Git 295
Using Mercurial 295
Cross-Compiling 296
Using configure 296
Creating the Script 297
Gaming the Cache 299
Installation 300
Setting Other Configure Options 300
Configuration Process for Non-Automake Projects 301
Building and Installing 302
Commonly Used Projects 303
DirectFB 303
Dropbear 303
QT/Qtopia 303
JamVM 303
Rzsz 304
Netcat 304
TinyXML 304
Micro_httpd 304
Stupid-FTPd 305
Quagga 305
Tslib 305
fgetty 305
CHAPTER 14 BusyBox 306
How a BusyBox-Based System Is Structured 306
Building a BusyBox-Based System 307
Download the Software 308
Configure 308
Build 310
Install 311
Copy Libraries 312
Add Help Text 318
Default Init Scripts 312
Update Permissions 314
Create Additional Folders 314
Create Device Nodes 315
What Makes BusyBox Small? 315
Creating Your Own Applet 316
Create the Applet Code 316
Add the Applet to the Make File 317
Register Applet with BusyBox 317
Build and Verify 318
Getting Help 320
What’s Next 320
CHAPTER 15 System Design 321
The Big Picture 321
Configuring the Boot Loader and Kernel 322
U-Boot 322
Other Boot loaders 325
Execute in Place 325
Selecting a Root File System 325
Block-Based File Systems 326
Ext2 328
Ext3 329
SquashFS 329
CramFS 329
Romfs 329
MINIX 329
MTD File Systems 330
JFFS2 330
YAFFS2 331
RAM Buffer–Based File Systems 331
Rafms 331
Tmpfs 331
Initramfs 331
File System Pairings 332
Assembling a Root File System 332
Create the Staging Area 332
Create a Directory Skeleton 333
Gather Libraries and Required Files 333
Required Files 334
Create Initialization Scripts 335
Using Init and Inittab 336
Using a Script 337
Using a Program 337
Set Ownership and Permissions 339
Security 340
Built-In Security 340
SELinux 341
Reference Policies 343
Using SEEdit 343
PAM 344
What’s Next 346
CHAPTER 16 System Tuning 347
Three or Fewer Megabytes 347
16–32 Megabytes 348
More than a Gigabyte 348
Reducing the Size of the Root File System 349
Start from Zero 349
Mounting Small File Systems 350
Shared Libraries 351
Compiling to Save Space 352
GCCs -Os 353
Static Linking 353
Stripping 355
Reducing the Size of the Kernel 355
Removing Unneeded Features and Drivers 356
Recommendations for Embedded Systems 357
Measuring 359
Using the Bloat-O-Meter 361
Minimizing Boot Time 361
Reducing Kernel Boot-Up Time 362
Uncompressed Kernel Image 362
No Console Output on Boot 362
Deferred Initialization 363
No Kernel Modules 364
Reducing Kernel Boot-Up Time 362
Uncompressed Kernel Image 362
No Console Output on Boot 362
Deferred Initialization 363
No Kernel Modules 364
Measuring Kernel Boot-Up Times 364
/proc/uptime 364
Grabserial 364
Initcall_debug 367
Reducing Root File System Startup Times 368
Use a Read-Only File System 368
Replacing Initialization Scripts 369
Inittab Abuse 371
Link with GNU Hash Style 372
What’s Next 373
CHAPTER 17 Deploying Applications 374
Deployment for Embedded Devices 374
Requirements 375
Industrial Design 376
Mechanical Design 376
Electrical Engineering 377
Manufacturing Engineering 378
Software Design 378
Software Engineering 379
Manufacturing 380
Deployment Strategies and Tactics 382
Boot Loaders 383
In General 383
UBOOT: Configuring Initial Parameters 384
Expect 385
Installing Expect 386
Expect on Windows 386
Using Expect 386
Boot Loaders Are Just Programs 388
Deployment Root File Systems 389
Application Files and Libraries 390
Small Root File Systems 390
First Field Update at the Factory 392
What’s Next 392
CHAPTER 18 Handling Field Updates 393
Root File System Updates 393
Basic Strategies 394
Forklift Upgrade 394
Designing for Forklift Upgrades 395
MTD Utilities 396
Forklift-Upgrade Example 396
Parallel Systems 398
Parallel System Example 398
Do It Yourself 399
Do-It-Yourself Example 400
Using Package Managers 400
RPM 401
Dpkg 405
Ipkg 408
Initramfs Root File Systems 411
Kernel Updates 411
Basic Strategies 412
Update Kernel Modules 412
Forklift Upgrade 412
Modules 413
Using Modprobe 413
Roll Your Own 414
Forklift 415
Field Update Failures 416
Report Failure, Stop 416
Failsafe Root File System 416
Failsafe Kernel 416
In Summary 417
Index 418
Erscheint lt. Verlag | 29.4.2010 |
---|---|
Zusatzinfo | XX, 550 p. |
Verlagsort | Berkeley |
Sprache | englisch |
Themenwelt | Informatik ► Betriebssysteme / Server ► Unix / Linux |
Mathematik / Informatik ► Informatik ► Theorie / Studium | |
Schlagworte | Embedded Linux • Embedded Systems • Kernel • Linux • Open Source • Technology • Time |
ISBN-10 | 1-4302-7226-0 / 1430272260 |
ISBN-13 | 978-1-4302-7226-7 / 9781430272267 |
Haben Sie eine Frage zum Produkt? |
Größe: 5,8 MB
DRM: Digitales Wasserzeichen
Dieses eBook enthält ein digitales Wasserzeichen und ist damit für Sie personalisiert. Bei einer missbräuchlichen Weitergabe des eBooks an Dritte ist eine Rückverfolgung an die Quelle möglich.
Dateiformat: PDF (Portable Document Format)
Mit einem festen Seitenlayout eignet sich die PDF besonders für Fachbücher mit Spalten, Tabellen und Abbildungen. Eine PDF kann auf fast allen Geräten angezeigt werden, ist aber für kleine Displays (Smartphone, eReader) nur eingeschränkt geeignet.
Systemvoraussetzungen:
PC/Mac: Mit einem PC oder Mac können Sie dieses eBook lesen. Sie benötigen dafür einen PDF-Viewer - z.B. den Adobe Reader oder Adobe Digital Editions.
eReader: Dieses eBook kann mit (fast) allen eBook-Readern gelesen werden. Mit dem amazon-Kindle ist es aber nicht kompatibel.
Smartphone/Tablet: Egal ob Apple oder Android, dieses eBook können Sie lesen. Sie benötigen dafür einen PDF-Viewer - z.B. die kostenlose Adobe Digital Editions-App.
Zusätzliches Feature: Online Lesen
Dieses eBook können Sie zusätzlich zum Download auch online im Webbrowser lesen.
Buying eBooks from abroad
For tax law reasons we can sell eBooks just within Germany and Switzerland. Regrettably we cannot fulfill eBook-orders from other countries.
aus dem Bereich