Cargando…

Mastering Embedded Linux Programming - Second Edition.

Master the techniques needed to build great, efficient embedded devices on LinuxAbout This Book* Discover how to build and configure reliable embedded Linux devices* This book has been updated to include Linux 4.9 and Yocto Project 2.2 (Morty)* This comprehensive guide covers the remote update of de...

Descripción completa

Detalles Bibliográficos
Clasificación:Libro Electrónico
Autor principal: Simmonds, Chris
Formato: Electrónico eBook
Idioma:Inglés
Publicado: Birmingham : Packt Publishing, 2017.
Edición:2nd ed.
Temas:
Acceso en línea:Texto completo
Tabla de Contenidos:
  • Cover
  • Copyright
  • Credits
  • About the Author
  • About the Reviewers
  • www.PacktPub.com
  • Customer Feedback
  • Table of Contents
  • Preface
  • Chapter 1: Starting Out
  • Selecting the right operating system
  • The players
  • Project life cycle
  • 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
  • Chapter 2: Learning About Toolchains
  • Introducing toolchains
  • Types of toolchains
  • CPU architectures
  • Choosing the C library
  • Finding a toolchain
  • Building a toolchain using crosstool-NG
  • Installing crosstool-NG
  • Building a toolchain for BeagleBone Black
  • Building a toolchain for QEMU
  • 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
  • Chapter 3: All About Bootloaders
  • What does a bootloader do?
  • The boot sequence
  • Phase 1
  • ROM code
  • Phase 2
  • secondary program loader
  • Phase 3
  • TPL
  • Booting with UEFI firmware
  • Moving from bootloader to kernel
  • Introducing device trees
  • Device tree basics
  • The reg property
  • Labels 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.
  • Board-specific files
  • Configuring header files
  • Building and testing
  • Falcon mode
  • Barebox
  • Getting barebox
  • Building barebox
  • Using barebox
  • Summary
  • Chapter 4: Configuring and Building 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
  • Kconfig
  • Using LOCALVERSION to identify your kernel
  • Kernel modules
  • Compiling
  • Kbuild
  • Finding out which kernel target to build
  • Build artifacts
  • Compiling device trees
  • Compiling modules
  • Cleaning kernel sources
  • Building a kernel for the BeagleBone Black
  • Building a kernel for QEMU
  • Booting the kernel
  • Booting the BeagleBone Black
  • Booting QEMU
  • Kernel panic
  • Early user space
  • Kernel messages
  • Kernel command line
  • Porting Linux to a new board
  • A new device tree
  • Setting the board compatible property
  • Additional reading
  • Summary
  • Chapter 5: Building a Root Filesystem
  • What should be in the root filesystem?
  • The directory layout
  • The 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 the size by stripping
  • Device nodes
  • The proc and sysfs filesystems
  • Mounting filesystems
  • Kernel modules
  • Transferring the root filesystem to the target
  • Creating a boot initramfs
  • Standalone initramfs
  • Booting the initramfs
  • Booting with QEMU
  • Booting the BeagleBone Black
  • Mounting proc
  • Building an initramfs into the kernel image
  • Building an initramfs using a device table.
  • The old initrd format
  • The init program
  • Starting a daemon process
  • Configuring user accounts
  • Adding user accounts to the root filesystem
  • 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
  • Booting the BeagleBone Black
  • Mounting the root filesystem using NFS
  • Testing with QEMU
  • Testing with the BeagleBone Black
  • Problems with file permissions
  • Using TFTP to load the kernel
  • Additional reading
  • Summary
  • Chapter 6: Selecting a Build System
  • Build systems
  • Package formats and package managers
  • Buildroot
  • Background
  • Stable releases and long-term support
  • Installing
  • Configuring
  • Running
  • Creating a custom BSP
  • U-Boot
  • Linux
  • Build
  • Adding your own code
  • Overlays
  • Adding a package
  • License compliance
  • The Yocto Project
  • Background
  • Stable releases and supports
  • Installing the Yocto Project
  • Configuring
  • Building
  • Running the QEMU target
  • Layers
  • BitBake and recipes
  • Customizing images via local.conf
  • Writing an image recipe
  • Creating an SDK
  • The license audit
  • Further reading
  • Summary
  • Chapter 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
  • Further reading
  • Summary
  • Chapter 8: Updating Software in the Field
  • What to update?
  • Bootloader
  • Kernel
  • Root filesystem
  • System applications
  • Device-specific data
  • Components that need to be updated
  • The basics of software update
  • Making updates robust
  • Making updates fail-safe
  • Making updates secure
  • Types of update mechanism
  • Symmetric image update
  • Asymmetric image update
  • Atomic file updates
  • OTA updates
  • Using Mender for local updates
  • Building the Mender client
  • Installing an update
  • Using Mender for OTA updates
  • Summary
  • Chapter 9: Interfacing with 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
  • Serial Peripheral Interface (SPI)
  • Writing a kernel device driver
  • Designing a character driver interface
  • The anatomy of a device driver
  • Compiling kernel modules
  • Loading kernel modules
  • Discovering the hardware configuration
  • Device trees
  • The platform data
  • Linking hardware with device drivers
  • Additional reading
  • Summary
  • Chapter 10: 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
  • Chapter 11: Managing Power
  • Measuring power usage
  • Scaling the clock frequency
  • The CPUFreq driver
  • Using CPUFreq
  • Selecting the best idle state
  • The CPUIdle driver
  • Tickless operation
  • Powering down peripherals
  • Putting the system to sleep
  • Power states
  • Wakeup events
  • Timed wakeups from the real-time clock
  • Further reading
  • Summary
  • Chapter 12: 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
  • Time-shared policies
  • Niceness
  • Real-time policies
  • Choosing a policy
  • Choosing a real-time priority
  • Further reading
  • Summary
  • Chapter 13: Managing Memory
  • Virtual memory basics
  • Kernel space memory layout
  • How much memory does the kernel use?
  • User space memory layout
  • The process memory map
  • Swapping
  • Swapping to compressed memory (zram)
  • Mapping memory with mmap.