Embedded Android

Book description

Looking to port Android to other platforms such as embedded devices? This hands-on book shows you how Android works and how you can adapt it to fit your needs. You’ll delve into Android’s architecture and learn how to navigate its source code, modify its various components, and create your own version of Android for your particular device. You’ll also discover how Android differs from its Linux roots.

If you’re experienced with embedded systems development and have a good handle on Linux, this book helps you mold Android to hardware platforms other than mobile devices.

  • Learn about Android’s development model and the hardware you need to run it
  • Get a quick primer on Android internals, including the Linux kernel and Dalvik virtual machine
  • Set up and explore the AOSP without hardware, using a functional emulator image
  • Understand Android’s non-recursive build system, and learn how to make your own modifications
  • Use evaluation boards to prototype your embedded Android system
  • Examine the native user-space, including the root filesystem layout, the adb tool, and Android’s command line
  • Discover how to interact with—and customize—the Android Framework

Publisher resources

View/Submit Errata

Table of contents

  1. Dedication
  2. Praise for Embedded Android
  3. Preface
    1. Learning How to Embed Android
    2. Audience for This Book
    3. Organization of the Material
    4. Software Versions
    5. Conventions Used in This Book
    6. Using Code Examples
    7. Safari® Books Online
    8. How to Contact Us
    9. Acknowledgments
  4. 1. Introduction
    1. History
    2. Features and Characteristics
    3. Development Model
      1. Differences From “Classic” Open Source Projects
      2. Feature Inclusion, Roadmaps, and New Releases
    4. Ecosystem
      1. A Word on the Open Handset Alliance
    5. Getting “Android”
    6. Legal Framework
      1. Code Licenses
      2. Branding Use
      3. Google’s Own Android Apps
      4. Alternative App Markets
      5. Oracle versus Google
      6. Mobile Patent Warfare
    7. Hardware and Compliance Requirements
      1. Compliance Definition Document
        1. Software
        2. Application packaging compatibility
        3. Multimedia compatibility
        4. Developer tool compatibility
        5. Hardware compatibility
        6. Performance compatibility
        7. Security model compatibility
        8. Software compatibility testing
        9. Updatable software
      2. Compliance Test Suite
    8. Development Setup and Tools
  5. 2. Internals Primer
    1. App Developer’s View
      1. Android Concepts
        1. Components
        2. Intents
        3. Component lifecycle
        4. Manifest file
        5. Processes and threads
        6. Remote procedure calls (RPCs)
      2. Framework Intro
      3. App Development Tools
      4. Native Development
    2. Overall Architecture
    3. Linux Kernel
      1. Wakelocks
      2. Low-Memory Killer
      3. Binder
      4. Anonymous Shared Memory (ashmem)
      5. Alarm
      6. Logger
      7. Other Notable Androidisms
    4. Hardware Support
      1. The Linux Approach
      2. Android’s General Approach
      3. Loading and Interfacing Methods
      4. Device Support Details
    5. Native User-Space
      1. Filesystem Layout
      2. Libraries
      3. Init
        1. Configuration language
        2. Global properties
        3. udev events
      4. Toolbox
      5. Daemons
      6. Command-Line Utilities
    6. Dalvik and Android’s Java
      1. Java Native Interface (JNI)
    7. System Services
      1. Service Manager and Binder Interaction
      2. Calling on Services
      3. A Service Example: the Activity Manager
    8. Stock AOSP Packages
    9. System Startup
  6. 3. AOSP Jump-Start
    1. Development Host Setup
    2. Getting the AOSP
    3. Inside the AOSP
    4. Build Basics
      1. Build System Setup
      2. Building Android
    5. Running Android
    6. Using the Android Debug Bridge (ADB)
    7. Mastering the Emulator
  7. 4. The Build System
    1. Comparison with Other Build Systems
    2. Architecture
      1. Configuration
      2. envsetup.sh
      3. Function Definitions
      4. Main Make Recipes
      5. Cleaning
      6. Module Build Templates
      7. Output
    3. Build Recipes
      1. The Default droid Build
      2. Seeing the Build Commands
      3. Building the SDK for Linux and Mac OS
      4. Building the SDK for Windows
      5. Building the CTS
      6. Building the NDK
      7. Updating the API
      8. Building a Single Module
      9. Building Out of Tree
      10. Building Recursively, In-Tree
    4. Basic AOSP Hacks
      1. Adding a Device
      2. Adding an App
      3. Adding an App Overlay
      4. Adding a Native Tool or Daemon
      5. Adding a Native Library
  8. 5. Hardware Primer
    1. Typical System Architecture
      1. The Baseband Processor
      2. Core Components
      3. Real-World Interaction
      4. Connectivity
      5. Expansion, Development, and Debugging
    2. What’s in a System-on-Chip (SoC)?
    3. Memory Layout and Mapping
    4. Development Setup
    5. Evaluation Boards
  9. 6. Native User-Space
    1. Filesystem
      1. The Root Directory
      2. /system
      3. /data
        1. Multiuser support
      4. SD Card
      5. The Build System and the Filesystem
        1. Build templates and file locations
        2. Explicitly copying files
        3. Default rights and ownership
    2. adb
      1. Theory of Operation
      2. Main Flags, Parameters, and Environment Variables
      3. Basic Local Commands
      4. Device Connection and Status
      5. Basic Remote Commands
        1. Shell
        2. Dumping the logs
        3. Getting a bug report
        4. Port forwarding
        5. Dalvik debugging
      6. Filesystem Commands
      7. State-Altering Commands
        1. Rebooting
        2. Running as root
        3. Switching connection type
        4. Controlling the emulator
      8. Tunneling PPP
    3. Android’s Command Line
      1. The Shell Up to 2.3/Gingerbread
      2. The Shell Since 4.0/Ice-Cream Sandwich
      3. Toolbox
        1. Common Linux commands
        2. Global properties
        3. Input events
        4. Controlling services
        5. Logging
        6. ioctl
        7. Wiping the device
        8. Other Android-specific commands
          1. nandread
          2. newfs_msdos
          3. notify
          4. r
          5. schedtop
          6. setconsole
          7. smd
      4. Core Native Utilities and Daemons
        1. logcat
        2. netcfg
        3. debuggerd
        4. Other Android-specific core utilities and daemons
          1. check_prereq
          2. linker
          3. logwrapper
          4. run-as
          5. sdcard utility
      5. Extra Native Utilities and Daemons
      6. Framework Utilities and Daemons
    4. Init
      1. Theory of Operation
      2. Configuration Files
        1. Location
        2. Semantics
          1. Property-based triggers
          2. Action commands
          3. Service declarations
          4. Service options
        3. Main init.rc
        4. Board-specific .rc files
      3. Global Properties
        1. Theory of operation
        2. Nomenclature and sets
        3. Storage
          1. The build system
          2. Additional property files
          3. .rc files
          4. Code
          5. /data/property
      4. ueventd
      5. Boot Logo
  10. 7. Android Framework
    1. Kick-Starting the Framework
      1. Core Building Blocks
      2. System Services
      3. Boot Animation
        1. bootanimation.zip
        2. Disabling the boot animation
      4. Dex Optimization
      5. Apps Startup
        1. Input methods
        2. Persistent apps
        3. Home screen
        4. BOOT_COMPLETED intent
        5. APPWIDGET_UPDATE intent
    2. Utilities and Commands
      1. General-Purpose Utilities
        1. service
        2. dumpsys
        3. dumpstate
        4. rawbu
      2. Service-Specific Utilities
        1. am
        2. pm
        3. svc
        4. ime
        5. input
        6. monkey
        7. bmgr
        8. stagefright
      3. Dalvik Utilities
        1. dalvikvm
        2. dvz
        3. dexdump
    3. Support Daemons
      1. installd
      2. vold
      3. netd
      4. rild
      5. keystore
      6. Other Support Daemons
    4. Hardware Abstraction Layer
  11. A. Legacy User-Space
    1. Basics
    2. Theory of Operation
    3. Merging with the AOSP
    4. Using the Combined Stacks
    5. Caveats and Pending Issues
    6. Moving Forward
  12. B. Adding Support for New Hardware
    1. The Basics
    2. The System Service
    3. The HAL and Its Extension
    4. The HAL Module
    5. Calling the System Service
    6. Starting the System Service
    7. Caveats and Recommendations
  13. C. Customizing the Default Lists of Packages
    1. Overall Dependencies
    2. Assembling the Final PRODUCT_PACKAGES
    3. Trimming Packages
  14. D. Default init.rc Files
    1. 2.3/Gingerbread’s default init.rc
    2. 4.2/Jelly Bean’s Default init Files
      1. init.rc
      2. init.usb.rc
      3. init.trace.rc
  15. E. Resources
    1. Websites and Communities
      1. Google
      2. SoC Vendors
      3. Forks
      4. Documentation and Forums
      5. Embedded Linux Build Tools
      6. Open Hardware Projects
    2. Books
    3. Conferences and Events
  16. Index
  17. About the Author
  18. Colophon
  19. Copyright

Product information

  • Title: Embedded Android
  • Author(s): Karim Yaghmour
  • Release date: March 2013
  • Publisher(s): O'Reilly Media, Inc.
  • ISBN: 9781449308292