logo资料库

Embedded Android 英文原版PDF.pdf

第1页 / 共412页
第2页 / 共412页
第3页 / 共412页
第4页 / 共412页
第5页 / 共412页
第6页 / 共412页
第7页 / 共412页
第8页 / 共412页
资料共412页,剩余部分请下载后查看
Copyright
Table of Contents
Preface
Learning How to Embed Android
Audience for This Book
Organization of the Material
Software Versions
Conventions Used in This Book
Using Code Examples
Safari® Books Online
How to Contact Us
Acknowledgments
Chapter 1. Introduction
History
Features and Characteristics
Development Model
Differences From “Classic” Open Source Projects
Feature Inclusion, Roadmaps, and New Releases
Ecosystem
A Word on the Open Handset Alliance
Getting “Android”
Legal Framework
Code Licenses
Branding Use
Google’s Own Android Apps
Alternative App Markets
Oracle versus Google
Mobile Patent Warfare
Hardware and Compliance Requirements
Compliance Definition Document
Compliance Test Suite
Development Setup and Tools
Chapter 2. Internals Primer
App Developer’s View
Android Concepts
Framework Intro
App Development Tools
Native Development
Overall Architecture
Linux Kernel
Wakelocks
Low-Memory Killer
Binder
Anonymous Shared Memory (ashmem)
Alarm
Logger
Other Notable Androidisms
Hardware Support
The Linux Approach
Android’s General Approach
Loading and Interfacing Methods
Device Support Details
Native User-Space
Filesystem Layout
Libraries
Init
Toolbox
Daemons
Command-Line Utilities
Dalvik and Android’s Java
Java Native Interface (JNI)
System Services
Service Manager and Binder Interaction
Calling on Services
A Service Example: the Activity Manager
Stock AOSP Packages
System Startup
Chapter 3. AOSP Jump-Start
Development Host Setup
Getting the AOSP
Inside the AOSP
Build Basics
Build System Setup
Building Android
Running Android
Using the Android Debug Bridge (ADB)
Mastering the Emulator
Chapter 4. The Build System
Comparison with Other Build Systems
Architecture
Configuration
envsetup.sh
Function Definitions
Main Make Recipes
Cleaning
Module Build Templates
Output
Build Recipes
The Default droid Build
Seeing the Build Commands
Building the SDK for Linux and Mac OS
Building the SDK for Windows
Building the CTS
Building the NDK
Updating the API
Building a Single Module
Building Out of Tree
Building Recursively, In-Tree
Basic AOSP Hacks
Adding a Device
Adding an App
Adding an App Overlay
Adding a Native Tool or Daemon
Adding a Native Library
Chapter 5. Hardware Primer
Typical System Architecture
The Baseband Processor
Core Components
Real-World Interaction
Connectivity
Expansion, Development, and Debugging
What’s in a System-on-Chip (SoC)?
Memory Layout and Mapping
Development Setup
Evaluation Boards
Chapter 6. Native User-Space
Filesystem
The Root Directory
/system
/data
SD Card
The Build System and the Filesystem
adb
Theory of Operation
Main Flags, Parameters, and Environment Variables
Basic Local Commands
Device Connection and Status
Basic Remote Commands
Filesystem Commands
State-Altering Commands
Tunneling PPP
Android’s Command Line
The Shell Up to 2.3/Gingerbread
The Shell Since 4.0/Ice-Cream Sandwich
Toolbox
Core Native Utilities and Daemons
Extra Native Utilities and Daemons
Framework Utilities and Daemons
Init
Theory of Operation
Configuration Files
Global Properties
ueventd
Boot Logo
Chapter 7. Android Framework
Kick-Starting the Framework
Core Building Blocks
System Services
Boot Animation
Dex Optimization
Apps Startup
Utilities and Commands
General-Purpose Utilities
Service-Specific Utilities
Dalvik Utilities
Support Daemons
installd
vold
netd
rild
keystore
Other Support Daemons
Hardware Abstraction Layer
Appendix A. Legacy User-Space
Basics
Theory of Operation
Merging with the AOSP
Using the Combined Stacks
Caveats and Pending Issues
Moving Forward
Appendix B. Adding Support for New Hardware
The Basics
The System Service
The HAL and Its Extension
The HAL Module
Calling the System Service
Starting the System Service
Caveats and Recommendations
Appendix C. Customizing the Default Lists of Packages
Overall Dependencies
Assembling the Final PRODUCT_PACKAGES
Trimming Packages
Appendix D. Default init.rc Files
2.3/Gingerbread’s default init.rc
4.2/Jelly Bean’s Default init Files
init.rc
init.usb.rc
init.trace.rc
Appendix E. Resources
Websites and Communities
Google
SoC Vendors
Forks
Documentation and Forums
Embedded Linux Build Tools
Open Hardware Projects
Books
Conferences and Events
Index
About the Author
www.it-ebooks.info
Praise for Embedded Android “This is the definitive book for anyone wanting to create a system based on Android. If you don’t work for Google and you are working with the low-level Android interfaces, you need this book.” —Greg Kroah-Hartman, Core Linux Kernel Developer “If you or your team works on creating custom Android images, devices, or ROM mods, you want this book! Other than the source code itself, this is the only place where you’ll find an explanation of how Android works, how the Android build system works, and an overall view of how Android is put together. I especially like the chapters on the build system and frameworks (4, 6, and 7), where there are many nuggets of information from the AOSP source that are hard to reverse-engineer. This book will save you and your team a lot of time. I wish we had it back when our teams were starting on the Frozen Yogurt version of Android two years ago. This book is likely to become required reading for new team members working on Intel Android stacks for the Intel reference phones.” —Mark Gross, Android/Linux Kernel Architect, Platform System Integration/Mobile Communications Group/Intel Corporation “Karim methodically knocks out the many mysteries Android poses to embedded system developers. This book is a practical treatment of working with the open source software project on all classes of devices, beyond just consumer phones and tablets. I’m personally pleased to see so many examples provided on affordable hardware, namely BeagleBone, not just on emulators.” —Jason Kridner, Sitara Software Architecture Manager at Texas Instruments and cofounder of BeagleBoard.org “This book contains information that previously took hundreds of hours for my engineers to discover. It is required reading for any new person that is working with Android on my team.” —Dr. Mark Micire, Researcher in Space and Mobile Field Robotics, Carnegie Mellon University www.it-ebooks.info
“Thanks to this book, for the first time embedded system developers have access to an open and vertically integrated stack that contains everything they need to build robust and high- performing Linux-based products. Android’s revolutionary execution model transcends phones and tablets, and its application developer platform is unmatched in the industry for features and development speed. This book will give developers a valuable resource for understanding everything between the application layer and the kernel, and how to extend and change things to create an infinite variety of Androids.” —Zach Pfeffer, Tech Lead for Linaro’s Android team “Finally, a book on the Android platform from a systems perspective! There are plenty of books on creating Android applications, but for too long no single, comprehensive source for information on Android’s internals. In Embedded Android, Karim has collected a vast quantity of material that is essential and helpful for Android systems programmers and integrators (although, to be sure, application developers would benefit from a reading as well). Karim’s copious examples, references, and explanations are gleaned from his extensive experience with and analysis of Android. It’s the book I wish I had had when I walked my own trail of tears learning Android for work at Sony. With this book, I could have saved myself months learning the ins and outs of Android. No doubt this will be the canonical reference book for Android system developers for years to come.” —Tim Bird, Senior Staff Engineer, Sony Network Entertainment, and Architecture Group Chair, CE Workgroup of the Linux Foundation “Karim Yaghmour’s book is an excellent guide for those wishing to get into the burgeoning field of Android-based embedded projects and products. The book covers the full range from kernel support through licensing and trademark issues, including information on running Android systems in “headless” mode as well. This book deserves a place on every serious embedded Android developer’s bookshelf.” —Paul E. McKenney, IBM Distinguished Engineer and Linux Kernel RCU Maintainer “Although Android is officially designed for mobile and tablet segments, it’s unquestionably getting considered for many other product segments, like automotive, UI panels like HMI, wearable gadgets, and so on. This book is highly recommended, as it covers all the essential fundamentals and concepts that help developers port and develop Android-based solutions for both mobile and nonmobile product segments.” —Khasim Syed Mohammed, Lead Engineer, Texas Instruments www.it-ebooks.info
“A great resource not only for embedded Android developers, but also for Android app developers to learn the wiring below the Java surface.” —Lars Vogel, CEO, vogella GmbH “Once again, Karim has hit the nail on the head. If you’re interested in porting Android to a new device or just interested in the guts of how Android runs on a piece of hardware, this is the book you’ve been searching for. This book leads you through all of the facets of build- environment setup, getting the AOSP sources, adding your hardware to the Android sources and deploying a new Android build to the hardware. It discusses the underpinnings of Android including the HAL and how to give your custom hardware support within the Android framework. In short, of all the books on Android, this is the one book that targets the Android device builder rather than Android application developer or end user. I just wish this book would have been available when I first got into Android porting. It could have saved me months of trial and error efforts.” —Mike Anderson, Chief Scientist, The PTR Group, Inc. “Embedded Android has been a great resource for our company. It is a must-have when porting Android to new hardware or integrating new features at a low level. Karim is a great instructor, and his writing captures his style well.” —Jim Steele, VP of Engineering, Sensor Platforms “Embedded Android is a must-read for anyone who wants to seriously work the Android internals and bring up Android on new platforms. It helps in navigating the extensive AOSP codebase, and understanding the overall architecture and design of the system.” —Balwinder Kaur, Senior Member, Technical Staff, Aptina Imaging “So you thought you knew about Android internals? Well, think again! Chapter after chapter, you’ll discover what’s behind the scenes and why Android is not just another embedded Linux distribution. Get yourself ready for stepping into a whirlpool, ’cause Embedded Android is a gold mine for anyone looking to do serious hacking on Google’s OS.” —Benjamin Zores, Android Platform Architect, Alcatel-Lucent www.it-ebooks.info
“Definitely one of the most valuable and complete resources about the Android system stack. A must-have for every Android system engineer.” —Maxime Ripard, Android Lead, Free Electrons “When I was handed a development board running Linux, and was told to ‘get Android running on it,’ it was difficult to find much information about how to bring Android up on a new device. Luckily for me, Embedded Android became available about the same time that I was beginning development. What a lifesaver! Embedded Android gave me the kick- start I needed to understand the underpinnings of Android and what I would need to do to bring Android up on a new piece of hardware. I loved all the details and background, from the boot sequence to the build system. After having read Embedded Android, I felt I had a much better grasp of Android and how it interacted with the Linux kernel.” —Casey Anderson, Embedded Systems Architect, Trendril www.it-ebooks.info
Embedded Android Karim Yaghmour www.it-ebooks.info
Embedded Android by Karim Yaghmour Copyright © 2013 Karim Yaghmour. All rights reserved. Printed in the United States of America. Published by O’Reilly Media, Inc., 1005 Gravenstein Highway North, Sebastopol, CA 95472. O’Reilly books may be purchased for educational, business, or sales promotional use. Online editions are also available for most titles (http://my.safaribooksonline.com). For more information, contact our corporate/ institutional sales department: 800-998-9938 or corporate@oreilly.com. Editors: Andy Oram and Mike Hendrickson Production Editor: Kara Ebrahim Copyeditor: Rebecca Freed Proofreader: Julie Van Keuren Indexer: Bob Pfahler Cover Designer: Randy Comer Interior Designer: David Futato Illustrator: Rebecca Demarest March 2013: First Edition Revision History for the First Edition: 2013-03-11: First release See http://oreilly.com/catalog/errata.csp?isbn=9781449308292 for release details. Nutshell Handbook, the Nutshell Handbook logo, and the O’Reilly logo are registered trademarks of O’Reilly Media, Inc. Embedded Android, the image of a Moorish wall gecko, and related trade dress are trademarks of O’Reilly Media, Inc. Many of the designations used by manufacturers and sellers to distinguish their products are claimed as trademarks. Where those designations appear in this book, and O’Reilly Media, Inc., was aware of a trade‐ mark claim, the designations have been printed in caps or initial caps. While every precaution has been taken in the preparation of this book, the publisher and author assume no responsibility for errors or omissions, or for damages resulting from the use of the information contained herein. ISBN: 978-1-449-30829-2 [LSI] www.it-ebooks.info
分享到:
收藏