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 A. Legacy User-Space

As I explained in Chapter 2, despite being based on the Linux kernel, Android bears little resemblance to any other Linux system out there. Indeed, as you can see in Figure 2-1, Android’s user-space, which we explored in Chapters 6 and 7, is a custom creation of Google. Hence, if you’re familiar with “legacy” Linux systems or come from an embedded Linux background, you may find yourself reminiscing about classic Linux tools and components you’ve been using for a long time. This appendix will show you how to get a legacy Linux user-space to coexist side by side with the AOSP on top of the same Linux kernel.

Basics

To start, we need to agree on what exactly a “legacy” Linux user-space is. For the present discussion, we’ll assume we’re talking about a Filesystem Hierarchy Standard (FHS)-compliant root filesystem. As I mentioned earlier, Android’s root filesystem isn’t FHS-compliant, and it crucially doesn’t use key FHS directories such as /bin and /lib, allowing us to superimpose, side by side with it, a root filesystem that does use these directories.

Now, I’m not saying you’ll be able to use these instructions to get yourself a root filesystem that houses both the AOSP and, say, a large distribution like Ubuntu. There are a lot more details about Ubuntu as a distribution and the AOSP that you’d need to take into account than resolving how to match a few of the top-level directories of the root filesystem. Nevertheless, if you are familiar with how to create ...

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