售 价:¥
温馨提示:数字商品不支持退换货,不提供源文件,不支持导出打印
为你推荐
Embedded Linux for Developers
Table of Contents
Embedded Linux for Developers
Embedded Linux for Developers
Credits
Preface
What this learning path covers
What you need for this learning path
Who this learning path is for
Reader feedback
Customer support
Downloading the example code
Errata
Piracy
Questions
1. Module 1
1. Introduction
Advantages of Linux and open source systems
Embedded systems
General description
Examples
Introducing GNU/Linux
Introduction to the Yocto Project
Buildroot
OpenEmbedded
Summary
2. Cross-compiling
Introducing toolchains
Components of toolchains
Delving into C libraries
Working with toolchains
Advice on robust programming
Generating the toolchain
The Yocto Project reference
Summary
3. Bootloaders
The role of the bootloader
Comparing various bootloaders
Delving into the bootloader cycle
The U-Boot bootloader
Booting the U-Boot options
Porting U-Boot
The Yocto Project
Summary
4. Linux Kernel
The role of the Linux kernel
Delving into the features of the Linux kernel
Memory mapping and management
Page cache and page writeback
The process address space
Process management
Process scheduling
System calls
The virtual file system
Interrupts
Bottom halves
Methods to perform kernel synchronization
Timers
Linux kernel interaction
The development process
Kernel porting
Community interaction
Kernel sources
Configuring kernel
Compiling and installing the kernel
Cross-compiling the Linux kernel
Devices and modules
Debugging a kernel
The Yocto Project reference
Summary
5. The Linux Root Filesystem
Interacting with the root filesystem
Delving into the filesystem
Device drivers
Filesystem options
Understanding BusyBox
Minimal root filesystem
The Yocto Project
Summary
6. Components of the Yocto Project
Poky
Eclipse ADT plug-ins
Hob and Toaster
Autobuilder
Lava
Wic
Summary
7. ADT Eclipse Plug-ins
The Application Development Toolkit
Setting up the environment
Eclipse IDE
QEMU emulator
Debugging
Profiling and tracing
The Yocto Project bitbake commander
Summary
8. Hob, Toaster, and Autobuilder
Hob
Toaster
Autobuilder
Summary
9. Wic and Other Tools
Swabber
Wic
LAVA
Summary
10. Real-time
Understanding GPOS and RTOS
PREEMPT_RT
Applying the PREEMPT_RT patch
The Yocto Project -rt kernel
Disadvantages of the PREEMPT_RT patches
Linux real-time applications
Benchmarking
Meta-realtime
Summary
11. Security
Security in Linux
SELinux
Grsecurity
Security for the Yocto Project
Meta-security and meta-selinux
Meta-security
Meta-selinux
Summary
12. Virtualization
Linux virtualization
SDN and NFV
NFV
ETSI NFV
SDN
OPNFV
Virtualization support for the Yocto Project
Summary
13. CGL and LSB
Linux Standard Base
Carrier grade options
Carrier Grade Linux
Automotive Grade Linux
Carrier Grade Virtualization
Specific support for the Yocto Project
Summary
2. Module 2
1. The Build System
Introduction
Setting up the host system
Getting ready
How to do it...
How it works...
There's more...
See also
Installing Poky
Getting ready
How to do it...
How it works...
There's more...
See also
Creating a build directory
How to do it...
How it works...
There's more...
Building your first image
Getting ready
How to do it...
How it works...
There's more...
Explaining the Freescale Yocto ecosystem
Getting ready
How to do it...
How it works...
There's more...
See also
Installing support for Freescale hardware
Getting ready
How to do it...
How it works...
There's more...
See also
Building Wandboard images
How to do it...
How it works...
See also
Troubleshooting your Wandboard's first boot
Getting ready
How to do it...
There's more...
Configuring network booting for a development setup
Getting ready
Installing a TFTP server
Installing an NFS server
How to do it...
Sharing downloads
Getting ready
How to do it...
Sharing the shared state cache
How to do it...
There's more...
Setting up a package feed
Getting ready
Versioning packages
How to do it...
See also
Using build history
How to do it...
How it works...
Looking at the build history
There's more...
Working with build statistics
How to do it...
How it works...
There's more...
Debugging the build system
Getting ready
Finding recipes
Dumping BitBake's environment
Using the development shell
How to do it...
Task log and run files
Adding logging to recipes
Looking at dependencies
Debugging BitBake
Error reporting tool
There's more...
2. The BSP Layer
Introduction
Creating a custom BSP layer
How to do it...
How it works...
There's more...
Adding a new machine
Adding a custom device tree to the Linux kernel
Adding a custom U-Boot machine
Adding a custom formfactor file
Introducing system development workflows
How to do it...
How it works...
External development
Working directory development
External source development
Adding a custom kernel and bootloader
Getting Ready
Finding the Linux kernel source
Finding the U-Boot source
Developing using a Git repository fork
How to do it...
How it works...
Explaining Yocto's Linux kernel support
How to do it...
How it works...
See also
Describing Linux's build system
How to do it...
How it works...
There's more...
Configuring the Linux kernel
Getting ready
How to do it...
There's more...
Using configuration fragments
Building the Linux kernel
How to do it...
How it works...
External development
External source development
Working directory development
Building external kernel modules
Getting ready
How to do it...
There's more...
Debugging the Linux kernel and modules
How to do it...
How it works...
There's more...
Using dynamic debug
Rate-limiting debug messages
See also
Debugging the Linux kernel booting process
How to do it...
How it works...
Dumping the kernel's printk buffer from the bootloader
There's more...
Using the kernel function tracing system
Getting ready...
How to do it...
How it works...
There's more...
Filtering function traces
Enabling trace options
Using the function tracer on oops
Getting a stack trace for a given function
Configuring the function tracer at boot
See also
Managing the device tree
Getting ready
How to do it...
How it works...
The compatible property
The Wandboard device tree file
Defining buses and memory-addressable devices
There's more...
Modifying and compiling the device tree in Yocto
See also
Debugging device tree issues
How to do it...
How it works...
Looking at the device tree from U-Boot
Looking at the device tree from the Linux kernel
3. The Software Layer
Introduction
Exploring an image's contents
Getting ready
How to do it...
How it works...
Adding a new software layer
Getting ready
How to do it...
How it works...
There's more...
Selecting a specific package version and providers
How to do it...
How do we select which provider to use?
How do we select which version to use?
How do we select which version not to use?
Adding supported packages
Getting ready
How to do it...
How it works...
There's more...
Configuring packages
Adding new packages
Getting ready
How to do it...
How it works...
Package licensing
Fetching package contents
Specifying task overrides
Configuring packages
Splitting into several packages
Setting machine-specific variables
Adding data, scripts, or configuration files
How to do it...
Managing users and groups
Getting ready
How to do it...
There's more...
Using the sysvinit initialization manager
Getting ready
How to do it...
Using the systemd initialization manager
Getting ready
How to do it...
There's more...
Installing systemd unit files
Installing package-installation scripts
Getting ready
How to do it...
How it works...
Reducing the Linux kernel image size
How to do it...
How it works...
Reducing the root filesystem image size
How to do it...
How it works...
Releasing software
Getting ready
How to do it...
There's more…
See also
Analyzing your system for compliance
How to do it...
There's more
Working with open source and proprietary code
How to do it...
How it works...
The U-Boot bootloader
The Linux kernel
Glibc
BusyBox
The Qt framework
The X Windows system
There's more...
See also
4. Application Development
Introduction
Preparing and using an SDK
Getting ready
How to do it...
Using the Application Development Toolkit
Getting ready
How to do it...
How it works...
Using the Eclipse IDE
Getting ready
How to do it...
There's more...
See also
Developing GTK+ applications
Getting ready
How to do it...
There's more...
Using the Qt Creator IDE
Getting ready
How to do it...
Developing Qt applications
Getting ready
How to do it...
There's more...
Describing workflows for application development
How to do it...
How it works...
External development
Working directory development
External source development
Working with GNU make
How to do it...
See also
Working with the GNU build system
Getting ready
How to do it...
See also
Working with the CMake build system
Getting ready
How to do it...
See also
Working with the SCons builder
Getting ready
How to do it...
See also
Developing with libraries
Getting ready
Building a static library
Building a shared dynamic library
How to do it...
How it works...
There's more...
See also
Working with the Linux framebuffer
Getting ready
How to do it...
How it works...
There's more...
See also
Using the X Windows system
Getting ready
How to do it...
There's more...
See also
Using Wayland
Getting ready
How to do it...
There's more...
See also
Adding Python applications
Getting ready
How to do it...
There's more...
Integrating the Oracle Java Runtime Environment
Getting ready
How to do it...
There's more...
Integrating the Open Java Development Kit
Getting ready
How to do it...
How it works...
There's more...
See also
Integrating Java applications
Getting ready
How to do it...
How it works...
There's more...
5. Debugging, Tracing, and Profiling
Introduction
Analyzing core dumps
Getting ready
How to do it...
How it works...
See also
Native GDB debugging
Getting ready
How to do it...
There's more...
See also
Cross GDB debugging
Getting ready
How to do it...
How it works...
Using strace for application debugging
Getting ready
How to do it...
How it works...
See also
Using the kernel's performance counters
Getting ready
How to do it...
How it works...
There's more...
See also
Using static kernel tracing
Getting ready
How to do it...
How it works...
There's more...
See also
Using dynamic kernel tracing
Getting ready
How to do it...
There's more...
See also
Using dynamic kernel events
Getting ready
How to do it...
How it works...
There's more...
Exploring Yocto's tracing and profiling tools
Getting ready
How to do it...
There's more...
Tracing and profiling with perf
Getting ready
How to do it...
How it works...
Reading tracing data
There's more...
Profile charts
Using perf as strace substitute
See also
Using SystemTap
Getting ready
How to do it...
How it works...
See also
Using OProfile
Getting ready
How to do it...
How it works...
There's more...
See also
Using LTTng
Getting ready
How to do it...
How it works...
Extending application profiling
There's more...
See also
Using blktrace
Getting ready
How to do it...
How it works...
There's more...
3. Module 3
1. Starting Out
Selecting the right operating system
The players
Project lifecycle
The four elements of embedded Linux
Open source
Licenses
Hardware for embedded Linux
Hardware used in this book
The BeagleBone Black
QEMU
Software used in this book
Summary
2. Learning About Toolchains
What is a toolchain?
Types of toolchain - native versus cross toolchain
CPU architectures
Choosing the C library
Finding a toolchain
Building a toolchain using crosstool-NG
Installing crosstool-NG
Selecting the toolchain
Anatomy of a toolchain
Finding out about your cross compiler
The sysroot, library, and header files
Other tools in the toolchain
Looking at the components of the C library
Linking with libraries: static and dynamic linking
Static libraries
Shared libraries
Understanding shared library version numbers
The art of cross compiling
Simple makefiles
Autotools
An example: SQLite
Package configuration
Problems with cross compiling
Summary
3. All About Bootloaders
What does a bootloader do?
The boot sequence
Phase 1: ROM code
Phase 2: SPL
Phase 3: TPL
Booting with UEFI firmware
Moving from bootloader to kernel
Introducing device trees
Device tree basics
The reg property
Phandles and interrupts
Device tree include files
Compiling a device tree
Choosing a bootloader
U-Boot
Building U-Boot
Installing U-Boot
Using U-Boot
Environment variables
Boot image format
Loading images
Booting Linux
Automating the boot with U-Boot scripts
Porting U-Boot to a new board
Kconfig and U-Boot
Board-specific files
Configuration header files
Building and testing
Falcon mode
Barebox
Getting Barebox
Building Barebox
Summary
4. Porting and Configuring the Kernel
What does the kernel do?
Choosing a kernel
Kernel development cycle
Stable and long term support releases
Vendor support
Licensing
Building the kernel
Getting the source
Understanding kernel configuration
Using LOCALVERSION to identify your kernel
Kernel modules
Compiling
Compiling the kernel image
Compiling device trees
Compiling modules
Cleaning kernel sources
Booting your kernel
BeagleBone Black
QEMU
Kernel panic
Early user space
Kernel messages
Kernel command line
Porting Linux to a new board
With a device tree
Without a device tree
Additional reading
Summary
5. Building a Root Filesystem
What should be in the root filesystem?
Directory layout
Staging directory
POSIX file access permissions
File ownership permissions in the staging directory
Programs for the root filesystem
The init program
Shell
Utilities
BusyBox to the rescue!
Building BusyBox
ToyBox – an alternative to BusyBox
Libraries for the root filesystem
Reducing size by stripping
Device nodes
The proc and sysfs filesystems
Mounting filesystems
Kernel modules
Transfering the root filesystem to the target
Creating a boot ramdisk
Standalone ramdisk
Booting the ramdisk
Booting with QEMU
Booting the BeagleBone Black
Mounting proc
Building a ramdisk cpio into the kernel image
Another way to build a kernel with ramdisk
The old initrd format
The init program
Configuring user accounts
Adding user accounts to the root filesystem
Starting a daemon process
A better way of managing device nodes
An example using devtmpfs
An example using mdev
Are static device nodes so bad after all?
Configuring the network
Network components for glibc
Creating filesystem images with device tables
Putting the root filesytem onto an SD card
Mounting the root filesystem using NFS
Testing with QEMU
Testing with BeagleBone Black
Problems with file permissions
Using TFTP to load the kernel
Additional reading
Summary
6. Selecting a Build System
No more rolling your own embedded Linux
Build systems
Package formats and package managers
Buildroot
Background
Stable releases and support
Installing
Configuring
Running
Creating a custom BSP
U-Boot
Linux
Build
Adding your own code
Overlay
Adding a package
License compliance
The Yocto Project
Background
Stable releases and support
Installing the Yocto Project
Configuring
Building
Running
Layers
BitBake and recipes
Customizing images via local.conf
Writing an image recipe
Creating an SDK
License audit
Further reading
Summary
7. Creating a Storage Strategy
Storage options
NOR flash
NAND flash
Managed flash
MultiMediaCard and secure digital cards
eMMC
Other types of managed flash
Accessing flash memory from the bootloader
U-Boot and NOR flash
U-Boot and NAND flash
U-Boot and MMC, SD and eMMC
Accessing flash memory from Linux
Memory technology devices
MTD partitions
MTD device drivers
The MTD character device, mtd
The MTD block device, mtdblock
Logging kernel oops to MTD
Simulating NAND memory
The MMC block driver
Filesystems for flash memory
Flash translation layers
Filesystems for NOR and NAND flash memory
JFFS2
Summary nodes
Clean markers
Creating a JFFS2 filesystem
YAFFS2
Creating a YAFFS2 filesystem
UBI and UBIFS
UBI
UBIFS
Filesystems for managed flash
Flashbench
Discard and TRIM
Ext4
F2FS
FAT16/32
Read-only compressed filesystems
squashfs
Temporary filesystems
Making the root filesystem read-only
Filesystem choices
Updating in the field
Granularity: file, package, or image?
Atomic image update
Further reading
Summary
8. Introducing Device Drivers
The role of device drivers
Character devices
Block devices
Network devices
Finding out about drivers at runtime
Getting information from sysfs
The devices: /sys/devices
The drivers: /sys/class
The block drivers: /sys/block
Finding the right device driver
Device drivers in user-space
GPIO
Handling interrupts from GPIO
LEDs
I2C
SPI
Writing a kernel device driver
Designing a character device interface
Anatomy of a device driver
Compile and load
Loading kernel modules
Discovering hardware configuration
Device trees
Platform data
Linking hardware with device drivers
Additional reading
Summary
9. Starting up - the init Program
After the kernel has booted
Introducing the init programs
BusyBox init
Buildroot init scripts
System V init
inittab
The init.d scripts
Adding a new daemon
Starting and stopping services
systemd
Building systemd with the Yocto Project and Buildroot
Introducing targets, services, and units
Units
Services
Targets
How systemd boots the system
Adding your own service
Adding a watchdog
Implications for embedded Linux
Further reading
Summary
10. Learning About Processes and Threads
Process or thread?
Processes
Creating a new process
Terminating a process
Running a different program
Daemons
Inter-process communication
Message-based IPC
Unix (or local) sockets
FIFOs and named pipes
POSIX message queues
Summary of message-based IPC
Shared memory-based IPC
POSIX shared memory
Threads
Creating a new thread
Terminating a thread
Compiling a program with threads
Inter-thread communication
Mutual exclusion
Changing conditions
Partitioning the problem
Scheduling
Fairness versus determinism
Timeshare policies
Niceness
Real-time policies
Choosing a policy
Choosing a real-time priority
Further reading
Summary
11. Managing Memory
Virtual memory basics
Kernel space memory layout
How much memory does the kernel use?
User space memory layout
Process memory map
Swap
Swap to compressed memory (zram)
Mapping memory with mmap
Using mmap to allocate private memory
Using mmap to share memory
Using mmap to access device memory
How much memory does my application use?
Per-process memory usage
Using top and ps
Using smem
Other tools to consider
Identifying memory leaks
mtrace
Valgrind
Running out of memory
Further reading
Summary
12. Debugging with GDB
The GNU debugger
Preparing to debug
Debugging applications using GDB
Remote debugging using gdbserver
Setting up the Yocto Project
Setting up Buildroot
Starting to debug
Connecting GDB and gdbserver
Setting the sysroot
GDB command files
Overview of GDB commands
Breakpoints
Running and stepping
Information commands
Running to a breakpoint
Debugging shared libraries
The Yocto Project
Buildroot
Other libraries
Just-in-time debugging
Debugging forks and threads
Core files
Using GDB to look at core files
GDB user interfaces
Terminal user interface
Data display debugger
Eclipse
Debugging kernel code
Debugging kernel code with kgdb
A sample debug session
Debugging early code
Debugging modules
Debugging kernel code with kdb
Looking at an oops
Preserving the oops
Additional reading
Summary
13. Profiling and Tracing
The observer effect
Symbol tables and compile flags
Beginning to profile
Profiling with top
Poor man's profiler
Introducing perf
Configuring the kernel for perf
Building perf with the Yocto Project
Building perf with Buildroot
Profiling with perf
Call graphs
perf annotate
Other profilers: OProfile and gprof
Tracing events
Introducing Ftrace
Preparing to use Ftrace
Using Ftrace
Dynamic Ftrace and trace filters
Trace events
Using LTTng
LTTng and the Yocto Project
LTTng and Buildroot
Using LTTng for kernel tracing
Using Valgrind for application profiling
Callgrind
Helgrind
Using strace to show system calls
Summary
14. Real-time Programming
What is real-time?
Identifying the sources of non-determinism
Understanding scheduling latency
Kernel preemption
The real-time Linux kernel (PREEMPT_RT)
Threaded interrupt handlers
Preemptible kernel locks
Getting the PREEMPT_RT patches
The Yocto Project and PREEMPT_RT
High resolution timers
Avoiding page faults in a real-time application
Interrupt shielding
Measuring scheduling latencies
cyclictest
Using Ftrace
Combining cyclictest and Ftrace
Further reading
Summary
A. Bibliography
Index
买过这本书的人还买过
读了这本书的人还在读
同类图书排行榜