You are previewing Embedded Android.

Embedded Android

Cover of Embedded Android by Karim Yaghmour Published by O'Reilly Media, Inc.
  1. Dedication
  2. Praise for Embedded Android
  3. Special Upgrade Offer
  4. 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
  5. 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
      2. Compliance Test Suite
    8. Development Setup and Tools
  6. 2. Internals Primer
    1. App Developer’s View
      1. Android Concepts
      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
      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
  7. 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
  8. 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
  9. 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
  10. 6. Native User-Space
    1. Filesystem
      1. The Root Directory
      2. /system
      3. /data
      4. SD Card
      5. The Build System and the Filesystem
    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
      6. Filesystem Commands
      7. State-Altering Commands
      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
      4. Core Native Utilities and Daemons
      5. Extra Native Utilities and Daemons
      6. Framework Utilities and Daemons
    4. Init
      1. Theory of Operation
      2. Configuration Files
      3. Global Properties
      4. ueventd
      5. Boot Logo
  11. 7. Android Framework
    1. Kick-Starting the Framework
      1. Core Building Blocks
      2. System Services
      3. Boot Animation
      4. Dex Optimization
      5. Apps Startup
    2. Utilities and Commands
      1. General-Purpose Utilities
      2. Service-Specific Utilities
      3. Dalvik Utilities
    3. Support Daemons
      1. installd
      2. vold
      3. netd
      4. rild
      5. keystore
      6. Other Support Daemons
    4. Hardware Abstraction Layer
  12. 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
  13. 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
  14. C. Customizing the Default Lists of Packages
    1. Overall Dependencies
    2. Assembling the Final PRODUCT_PACKAGES
    3. Trimming Packages
  15. 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
  16. 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
  17. Index
  18. About the Author
  19. Colophon
  20. Special Upgrade Offer
  21. Copyright
O'Reilly logo

Appendix C. Customizing the Default Lists of Packages

As we saw in Chapter 4, the build system can be modified to add new packages to those it builds by default. What we didn’t cover in that chapter is how the build system creates the default list of packages that it uses when creating images or how we can customize it. Obviously, playing around with something as fundamental as the default set of packages required to get a functional AOSP has its risks, as you may end up generating stale images. Still, it’s worth taking a look at how this works and what’s in there. If nothing else, you’ll get a better idea of where to look in case you have to get your hands in there.

Overall Dependencies

In 2.3/Gingerbread, there are two main variables that dictate what gets included in the AOSP: GRANDFATHERED_USER_MODULES and PRODUCT_PACKAGES. The first is generated from a static list found in build/core/user_tags.mk and contains the bulk of the “core” packages required for the AOSP, with such things as adbd, the system services, and Bionic. This file isn’t meant to be edited and starts with a warning to that effect:

# This is the list of modules grandfathered to use a user tag

# DO NOT ADD ANY NEW MODULE TO THIS FILE
#
# user modules are hard to control and audit and we don't want
# to add any new such module in the system

In effect, the list of packages in GRANDFATHERED_USER_MODULES is more or less fixed in stone—what we want to focus our attention on is the packages added to PRODUCT_PACKAGES. There’s ...

The best content for your career. Discover unlimited learning on demand for around $1/day.