SlideShare a Scribd company logo
Android Porting Amit Pundir Android Engineer, Linaro [email_address] @pundiramit
Agenda For This Session Android Software Stack
Android Open Source Project Build Requirements
Code Access
Code Structure
Target Build Configurations Android Boot Process
Android Debugging/Troubleshooting
Android Software Stack
Applications Applications Application Frameworks Libraries & Runtime Linux Kernel Audio Display Hardware Abstraction Layers Firmware Binaries WiFi Binder Camera Logger ... GPS Radio (RIL) Camera Media NFS Sensors Audio ... Skia Core Libraries Dalvik VM ... SQlite ALSA Freetype Input Webkit System Services Power Manager Activity Manager Content Manager Battery Service Location Manager Audio Service Network Manager Package Manager Window Manager ... Home Settings Media Player Camera Dialer ... Media Server Service Manager ...
Android Open Source Project (AOSP)
Heads up: Preparing Development Machines for AOSP JBQ's  mail  on android-building list for the future release of ICS in AOSP. ->  06GB of download ->  25GB disk space to do single build ->  80GB disk space to build all AOSP configs ->  16GB RAM recommended ->  5+ hours of CPU time for a single build on a 2x quad-core    2.4 GHz HT with 24GB RAM and no SSD. Initializing Android build environment ->  64bit Ubuntu-10.04. Workarounds available to build AOSP  on 32bit machines as well. ->  Sun-Java6, git, build-essentials, libgl1-mesa, libc6 ... etc
AOSP Code Access AOSP consists of multiple independent projects maintained by Git. Moved to android.googlesource.com after kernel.org shutdown. ->  No Git web preview and Gerrit available yet. `repo` tool. ->  Git Wrapper script to download AOSP. AOSP manifest file to download/sync-up with a specific AOSP snapshot.
AOSP Code Access (contd.) repo init -u $(REPO_MANIFEST_URL) -b $(MANIFEST_BRANCH) -m $(MANIFEST_FILE)  ->  `repo` initialization. repo sync ->  Start download or sync-up. Example: $  repo init -u   https://android.googlesource.com/platform/manifest -b   android-4.0.1_r1 $  repo sync
AOSP Code Structure
bionic Android's C library. bootable Legacy Bootloader/Recovery code for reference build AOSP Build framework cts Android's Compatibility Test Suite dalvik Dalvik Virtual Machine development Development tools #tutorials #monkey device Vendor specific configuration files external External projects used in AOSP frameworks Android core application framework hardware Hardware specific libraries/modules #HAL kernel Linux Kernel libcore Apache Harmony. Free Java implementation. Used by Dalvik. ndk Native Development Kit packages AOSP's stock applications prebuilt Prebuilt binaries such as Toolchain sdk Android's Software Development Kit system Android's core system libraries/binaries #init #toolbox #adb
Android Kernel
Android Kernel Android patches are not available in upstream Linux kernel.
Android maintains `android-common` tree ->  Android patches on top of Linus's base tree. Extract patches and apply them to your Target specific kernel.
Android Kernel Features Binder ->  Android's IPC mechanism. Inspired from Open Binder project. Ashmem or Anonymous Shared Memory ->  Shared memory allocator. Discards shared units under memory pressure. Logger ->  Android's driver which logs data from user space. Wakelocks ->  Prevents a system to enter suspend or low power states.
Android Kernel Features (contd.) Out Of Memory handler ->  Aggressive OOM handler. Triggers before Kernel's default implementation. Alarm ->  Android's alarm timer implementation on top of Kernel's RTC implementation. RAM console ->  Logs last Kernel log. Accessible through /proc/last_kmsg Paranoid network ->  Network administration through uid/pid e.g AID_NET_*
Android HAL
Android Hardware Abstraction Layers HAL interfaces are exposed through *HardwareInterface Classes. ->  Hooked to System at run time using hw_get_module() or dynamic linking, dlopen() HALs linked to framework at build time. HAL modules using standard Linux `sysfs` and `/dev` node entries
AOSP Build Process
AOSP Build System Building the system ->  . build/envsetup.sh -> Setting up build environment ->  lunch -> Choose the TARGET_PRODUCT ->  export USE_CCACHE = 1 -> will cache object files generated by the C/C++ compiler which can be used to speed up next build. ->  make -jX -> where X = “number of CPU cores in your build machine” + 1. OR ->  m ,  mm  or  mmm ->  make aliases which is handy while building AOSP projects independently.
AOSP Build configuration Target build requirements are set by  build/core/{main.mk, config.mk, product.mk, product_config.mk} Build process looks for target specific config file BoardConfig.mk at  device/*/$(TARGET_DEVICE)  or  vendor/*/$(TARGET_DEVICE) TARGET_PRODUCT = TARGET_DEVICE = PRODUCT_DEVICE, where PRODUCT_DEVICE  is defined in  AndroidProducts.mk  present at  device/*/* .
Target Build/Run time configuration Build time config files  device/*/{AndroidProducts.mk, BoardConfig.mk, AndroidBoard.mk} Run time config files  init.rc ,  init.TARGET_PRODUCT.rc ,  ueventd.rc ,  ueventd.TARGET_PRODUCT.rc ,  vold.fstab  etc Set optional PRODUCT_PACKAGES in build configuration for Pre-loaded applications. Generate Project manifest file for Target. It is different from an Android Application Manifest file.
Android Boot Process

More Related Content

What's hot (20)

PDF
Using and Customizing the Android Framework / part 4 of Embedded Android Work...
Opersys inc.
 
ODP
Android crash debugging
Ashish Agrawal
 
PDF
Android Internals at Linaro Connect Asia 2013
Opersys inc.
 
PDF
Working with the AOSP - Linaro Connect Asia 2013
Opersys inc.
 
PDF
Porting Android
Opersys inc.
 
PDF
Inside Android's UI
Opersys inc.
 
PDF
Android On Development Boards at AnDevCon3
Opersys inc.
 
PDF
Android is NOT just 'Java on Linux'
Tetsuyuki Kobayashi
 
PDF
Android Security, From the Ground Up
Opersys inc.
 
PDF
Android Internals
Opersys inc.
 
PDF
Android Variants, Hacks, Tricks and Resources
Opersys inc.
 
PDF
Kernel Recipes 2013 - Overview display in the Linux kernel
Anne Nicolas
 
PDF
Embedded Android Workshop with Marshmallow
Opersys inc.
 
PDF
Android Hacks, Variants, Tricks and Resources ESC SV 2012
Opersys inc.
 
PDF
Digging for Android Kernel Bugs
Jiahong Fang
 
PDF
Booting Android: bootloaders, fastboot and boot images
Chris Simmonds
 
PDF
Tip: How to enable wireless debugging with Android?
Sarath C
 
PDF
Hacking Android OS
Jimmy Software
 
PDF
Memory Management in Android
Opersys inc.
 
Using and Customizing the Android Framework / part 4 of Embedded Android Work...
Opersys inc.
 
Android crash debugging
Ashish Agrawal
 
Android Internals at Linaro Connect Asia 2013
Opersys inc.
 
Working with the AOSP - Linaro Connect Asia 2013
Opersys inc.
 
Porting Android
Opersys inc.
 
Inside Android's UI
Opersys inc.
 
Android On Development Boards at AnDevCon3
Opersys inc.
 
Android is NOT just 'Java on Linux'
Tetsuyuki Kobayashi
 
Android Security, From the Ground Up
Opersys inc.
 
Android Internals
Opersys inc.
 
Android Variants, Hacks, Tricks and Resources
Opersys inc.
 
Kernel Recipes 2013 - Overview display in the Linux kernel
Anne Nicolas
 
Embedded Android Workshop with Marshmallow
Opersys inc.
 
Android Hacks, Variants, Tricks and Resources ESC SV 2012
Opersys inc.
 
Digging for Android Kernel Bugs
Jiahong Fang
 
Booting Android: bootloaders, fastboot and boot images
Chris Simmonds
 
Tip: How to enable wireless debugging with Android?
Sarath C
 
Hacking Android OS
Jimmy Software
 
Memory Management in Android
Opersys inc.
 

Viewers also liked (20)

PDF
Eric Lafortune - The Jack and Jill build system
GuardSquare
 
PDF
Android open source project build system phi innovations - android summit 2015
Rafael Coutinho
 
PDF
Embedded Android Workshop
Opersys inc.
 
PDF
Android OTA updates
Gary Bisson
 
PPTX
Red Bend Software: Optimizing the User Experience with Over-the-Air Updates
Red Bend Software
 
PPTX
Tips dan Third Party Library untuk Android - Part 1
Ibnu Sina Wardy
 
ODP
Android training day 4
Vivek Bhusal
 
ODP
Android permission system
Shivang Goel
 
PPT
Sandbox Introduction
msimkin
 
ODP
Android(1)
Nikola Milosevic
 
PPTX
Security threats in Android OS + App Permissions
Hariharan Ganesan
 
ODP
Android permission system
Shivang Goel
 
PDF
Anatomizing online payment systems: hack to shop
Abhinav Mishra
 
PDF
Web Services and Android - OSSPAC 2009
sullis
 
PPTX
Android secuirty permission - upload
Bin Yang
 
PDF
Android 6.0 permission change
彥彬 洪
 
ODP
Json Tutorial
Napendra Singh
 
PPTX
Android AsyncTask Tutorial
Perfect APK
 
PDF
Basic Android Push Notification
Chaiyasit Tayabovorn
 
PDF
Android new permission model
Takuji Nishibayashi
 
Eric Lafortune - The Jack and Jill build system
GuardSquare
 
Android open source project build system phi innovations - android summit 2015
Rafael Coutinho
 
Embedded Android Workshop
Opersys inc.
 
Android OTA updates
Gary Bisson
 
Red Bend Software: Optimizing the User Experience with Over-the-Air Updates
Red Bend Software
 
Tips dan Third Party Library untuk Android - Part 1
Ibnu Sina Wardy
 
Android training day 4
Vivek Bhusal
 
Android permission system
Shivang Goel
 
Sandbox Introduction
msimkin
 
Android(1)
Nikola Milosevic
 
Security threats in Android OS + App Permissions
Hariharan Ganesan
 
Android permission system
Shivang Goel
 
Anatomizing online payment systems: hack to shop
Abhinav Mishra
 
Web Services and Android - OSSPAC 2009
sullis
 
Android secuirty permission - upload
Bin Yang
 
Android 6.0 permission change
彥彬 洪
 
Json Tutorial
Napendra Singh
 
Android AsyncTask Tutorial
Perfect APK
 
Basic Android Push Notification
Chaiyasit Tayabovorn
 
Android new permission model
Takuji Nishibayashi
 
Ad

Similar to Android porting for dummies @droidconin 2011 (20)

PDF
An Introduction To Android
natdefreitas
 
PDF
Core Android
Dominik Helleberg
 
PPTX
Android
Nishant Jain
 
PDF
Kandroid for nhn_deview_20131013_v5_final
NAVER D2
 
PDF
Droidcon uk2012 androvm
dfages
 
PPTX
Android tools for testers
Maksim Kovalev
 
PPT
Android Anatomy
Bhavya Siddappa
 
PPTX
Presentation1.pptx
JayakumarS71
 
PPTX
C# Production Debugging Made Easy
Alon Fliess
 
PDF
Embedded Android
晓东 杜
 
PPTX
Android session-1-sajib
Hussain Behestee
 
PDF
Building
Satpal Parmar
 
PDF
Droidcon 2013 France - Android Platform Anatomy
Benjamin Zores
 
PPT
Agnostic Device Drivers
Heiko Joerg Schick
 
PDF
GDG-ANDROID-ATHENS Meetup: Build in Docker with Jenkins
Mando Stam
 
PDF
Android Logging System
William Lee
 
PPTX
OWF12/PAUG Conf Days Alternative to google's android emulator, daniel fages, ...
Paris Open Source Summit
 
PPTX
Manish Chasta - Securing Android Applications
Positive Hack Days
 
PDF
01 02 - introduction - adroid stack
Siva Kumar reddy Vasipally
 
PPT
Choosing the right processor
Pantech ProLabs India Pvt Ltd
 
An Introduction To Android
natdefreitas
 
Core Android
Dominik Helleberg
 
Android
Nishant Jain
 
Kandroid for nhn_deview_20131013_v5_final
NAVER D2
 
Droidcon uk2012 androvm
dfages
 
Android tools for testers
Maksim Kovalev
 
Android Anatomy
Bhavya Siddappa
 
Presentation1.pptx
JayakumarS71
 
C# Production Debugging Made Easy
Alon Fliess
 
Embedded Android
晓东 杜
 
Android session-1-sajib
Hussain Behestee
 
Building
Satpal Parmar
 
Droidcon 2013 France - Android Platform Anatomy
Benjamin Zores
 
Agnostic Device Drivers
Heiko Joerg Schick
 
GDG-ANDROID-ATHENS Meetup: Build in Docker with Jenkins
Mando Stam
 
Android Logging System
William Lee
 
OWF12/PAUG Conf Days Alternative to google's android emulator, daniel fages, ...
Paris Open Source Summit
 
Manish Chasta - Securing Android Applications
Positive Hack Days
 
01 02 - introduction - adroid stack
Siva Kumar reddy Vasipally
 
Choosing the right processor
Pantech ProLabs India Pvt Ltd
 
Ad

Recently uploaded (20)

PDF
LLMs.txt: Easily Control How AI Crawls Your Site
Keploy
 
PDF
Transcript: New from BookNet Canada for 2025: BNC BiblioShare - Tech Forum 2025
BookNet Canada
 
PDF
The Builder’s Playbook - 2025 State of AI Report.pdf
jeroen339954
 
PDF
NewMind AI - Journal 100 Insights After The 100th Issue
NewMind AI
 
PDF
"Beyond English: Navigating the Challenges of Building a Ukrainian-language R...
Fwdays
 
PDF
Newgen 2022-Forrester Newgen TEI_13 05 2022-The-Total-Economic-Impact-Newgen-...
darshakparmar
 
PDF
Using FME to Develop Self-Service CAD Applications for a Major UK Police Force
Safe Software
 
PDF
Presentation - Vibe Coding The Future of Tech
yanuarsinggih1
 
PDF
CIFDAQ Market Insights for July 7th 2025
CIFDAQ
 
PDF
How Startups Are Growing Faster with App Developers in Australia.pdf
India App Developer
 
PDF
Fl Studio 24.2.2 Build 4597 Crack for Windows Free Download 2025
faizk77g
 
PDF
Python basic programing language for automation
DanialHabibi2
 
PDF
Bitcoin for Millennials podcast with Bram, Power Laws of Bitcoin
Stephen Perrenod
 
PDF
[Newgen] NewgenONE Marvin Brochure 1.pdf
darshakparmar
 
PDF
"AI Transformation: Directions and Challenges", Pavlo Shaternik
Fwdays
 
PDF
Complete JavaScript Notes: From Basics to Advanced Concepts.pdf
haydendavispro
 
PDF
From Code to Challenge: Crafting Skill-Based Games That Engage and Reward
aiyshauae
 
PDF
Jak MŚP w Europie Środkowo-Wschodniej odnajdują się w świecie AI
dominikamizerska1
 
PDF
July Patch Tuesday
Ivanti
 
PDF
Chris Elwell Woburn, MA - Passionate About IT Innovation
Chris Elwell Woburn, MA
 
LLMs.txt: Easily Control How AI Crawls Your Site
Keploy
 
Transcript: New from BookNet Canada for 2025: BNC BiblioShare - Tech Forum 2025
BookNet Canada
 
The Builder’s Playbook - 2025 State of AI Report.pdf
jeroen339954
 
NewMind AI - Journal 100 Insights After The 100th Issue
NewMind AI
 
"Beyond English: Navigating the Challenges of Building a Ukrainian-language R...
Fwdays
 
Newgen 2022-Forrester Newgen TEI_13 05 2022-The-Total-Economic-Impact-Newgen-...
darshakparmar
 
Using FME to Develop Self-Service CAD Applications for a Major UK Police Force
Safe Software
 
Presentation - Vibe Coding The Future of Tech
yanuarsinggih1
 
CIFDAQ Market Insights for July 7th 2025
CIFDAQ
 
How Startups Are Growing Faster with App Developers in Australia.pdf
India App Developer
 
Fl Studio 24.2.2 Build 4597 Crack for Windows Free Download 2025
faizk77g
 
Python basic programing language for automation
DanialHabibi2
 
Bitcoin for Millennials podcast with Bram, Power Laws of Bitcoin
Stephen Perrenod
 
[Newgen] NewgenONE Marvin Brochure 1.pdf
darshakparmar
 
"AI Transformation: Directions and Challenges", Pavlo Shaternik
Fwdays
 
Complete JavaScript Notes: From Basics to Advanced Concepts.pdf
haydendavispro
 
From Code to Challenge: Crafting Skill-Based Games That Engage and Reward
aiyshauae
 
Jak MŚP w Europie Środkowo-Wschodniej odnajdują się w świecie AI
dominikamizerska1
 
July Patch Tuesday
Ivanti
 
Chris Elwell Woburn, MA - Passionate About IT Innovation
Chris Elwell Woburn, MA
 

Android porting for dummies @droidconin 2011

  • 1. Android Porting Amit Pundir Android Engineer, Linaro [email_address] @pundiramit
  • 2. Agenda For This Session Android Software Stack
  • 3. Android Open Source Project Build Requirements
  • 6. Target Build Configurations Android Boot Process
  • 9. Applications Applications Application Frameworks Libraries & Runtime Linux Kernel Audio Display Hardware Abstraction Layers Firmware Binaries WiFi Binder Camera Logger ... GPS Radio (RIL) Camera Media NFS Sensors Audio ... Skia Core Libraries Dalvik VM ... SQlite ALSA Freetype Input Webkit System Services Power Manager Activity Manager Content Manager Battery Service Location Manager Audio Service Network Manager Package Manager Window Manager ... Home Settings Media Player Camera Dialer ... Media Server Service Manager ...
  • 10. Android Open Source Project (AOSP)
  • 11. Heads up: Preparing Development Machines for AOSP JBQ's mail on android-building list for the future release of ICS in AOSP. -> 06GB of download -> 25GB disk space to do single build -> 80GB disk space to build all AOSP configs -> 16GB RAM recommended -> 5+ hours of CPU time for a single build on a 2x quad-core 2.4 GHz HT with 24GB RAM and no SSD. Initializing Android build environment -> 64bit Ubuntu-10.04. Workarounds available to build AOSP on 32bit machines as well. -> Sun-Java6, git, build-essentials, libgl1-mesa, libc6 ... etc
  • 12. AOSP Code Access AOSP consists of multiple independent projects maintained by Git. Moved to android.googlesource.com after kernel.org shutdown. -> No Git web preview and Gerrit available yet. `repo` tool. -> Git Wrapper script to download AOSP. AOSP manifest file to download/sync-up with a specific AOSP snapshot.
  • 13. AOSP Code Access (contd.) repo init -u $(REPO_MANIFEST_URL) -b $(MANIFEST_BRANCH) -m $(MANIFEST_FILE) -> `repo` initialization. repo sync -> Start download or sync-up. Example: $ repo init -u https://android.googlesource.com/platform/manifest -b android-4.0.1_r1 $ repo sync
  • 15. bionic Android's C library. bootable Legacy Bootloader/Recovery code for reference build AOSP Build framework cts Android's Compatibility Test Suite dalvik Dalvik Virtual Machine development Development tools #tutorials #monkey device Vendor specific configuration files external External projects used in AOSP frameworks Android core application framework hardware Hardware specific libraries/modules #HAL kernel Linux Kernel libcore Apache Harmony. Free Java implementation. Used by Dalvik. ndk Native Development Kit packages AOSP's stock applications prebuilt Prebuilt binaries such as Toolchain sdk Android's Software Development Kit system Android's core system libraries/binaries #init #toolbox #adb
  • 17. Android Kernel Android patches are not available in upstream Linux kernel.
  • 18. Android maintains `android-common` tree -> Android patches on top of Linus's base tree. Extract patches and apply them to your Target specific kernel.
  • 19. Android Kernel Features Binder -> Android's IPC mechanism. Inspired from Open Binder project. Ashmem or Anonymous Shared Memory -> Shared memory allocator. Discards shared units under memory pressure. Logger -> Android's driver which logs data from user space. Wakelocks -> Prevents a system to enter suspend or low power states.
  • 20. Android Kernel Features (contd.) Out Of Memory handler -> Aggressive OOM handler. Triggers before Kernel's default implementation. Alarm -> Android's alarm timer implementation on top of Kernel's RTC implementation. RAM console -> Logs last Kernel log. Accessible through /proc/last_kmsg Paranoid network -> Network administration through uid/pid e.g AID_NET_*
  • 22. Android Hardware Abstraction Layers HAL interfaces are exposed through *HardwareInterface Classes. -> Hooked to System at run time using hw_get_module() or dynamic linking, dlopen() HALs linked to framework at build time. HAL modules using standard Linux `sysfs` and `/dev` node entries
  • 24. AOSP Build System Building the system -> . build/envsetup.sh -> Setting up build environment -> lunch -> Choose the TARGET_PRODUCT -> export USE_CCACHE = 1 -> will cache object files generated by the C/C++ compiler which can be used to speed up next build. -> make -jX -> where X = “number of CPU cores in your build machine” + 1. OR -> m , mm or mmm -> make aliases which is handy while building AOSP projects independently.
  • 25. AOSP Build configuration Target build requirements are set by build/core/{main.mk, config.mk, product.mk, product_config.mk} Build process looks for target specific config file BoardConfig.mk at device/*/$(TARGET_DEVICE) or vendor/*/$(TARGET_DEVICE) TARGET_PRODUCT = TARGET_DEVICE = PRODUCT_DEVICE, where PRODUCT_DEVICE is defined in AndroidProducts.mk present at device/*/* .
  • 26. Target Build/Run time configuration Build time config files device/*/{AndroidProducts.mk, BoardConfig.mk, AndroidBoard.mk} Run time config files init.rc , init.TARGET_PRODUCT.rc , ueventd.rc , ueventd.TARGET_PRODUCT.rc , vold.fstab etc Set optional PRODUCT_PACKAGES in build configuration for Pre-loaded applications. Generate Project manifest file for Target. It is different from an Android Application Manifest file.
  • 28. Kernel Init Service Manager system server Zygote (-> Dalvik) On init ... On boot ... binder Android Framework Services/Servers Activity Manager Power Manager Package Manager Content Manager Battery Service Window Manager Location Manager Audio Service Alarm Manager Network Manager Media Server ... Android Application
  • 30. Android Debugging/Troubleshooting (contd.) Debug logs are important. Get as much as you can. -> Increase loglevel in init.rc Run time debugging. -> dmesg -> Dump Kernel logs -> logcat -> Dump logs (Main, System, Events, Radio). -> adb and ddms -> Android debug bridge and tool for remote debugging. -> dumpsys and dumpstate -> Dump system services meminfo
  • 31. Android Debugging/Troubleshooting (contd.) Android Postmortem -> /proc/last_kmsg -> Last dmesg or kernel log to debug random Kernel crashes. Traceview -> debug and profile an Android application.
  • 32. Android Debugging/Troubleshooting (contd.) Android community support channels. -> android-porting google group. -> for porting AOSP to new devices -> #android on freenode IRC server -> android-building google group. -> help in building AOSP -> ask-linaro forum -> Ask Linux/Android queries. -> #linaro-android on freenode -> rowboat google group. -> for porting AOSP to Omap3 devices. -> #rowboat on freenode.