SlideShare a Scribd company logo
1 of 34
Android Internals
Course Objectives
 Develop embedded systems with Google Android

 Customize and install Google Android for your target platform




Android Internals @ SAS               2               08/23/12
Course Prerequisites
 C/C++

 Basic Java

 Basic Unix/Linux command line interface experience
       An extra 1 day training may be needed.


 Embedded systems development is a plus.




Android Internals @ SAS                   3            08/23/12
Course Notes
 Ask any time.

 Set your cell to silent.

 Course assumes Linux is already ported to your hardware.
       An extra 5 days training may be needed.




Android Internals @ SAS                   4          08/23/12
Outline
Lectures                                     Labs
    Introduction to Android                  Android Source Code
    Android Source Code & Compilation        1st Compilation
    Linux Kernel Introduction                Compile and Boot an Android Kernel
    Changes Introduced in the Android
     Kernel
    Android Booting Scenarios                Supporting a New Board
    Developing and Debugging with ADB        Use ADB
    Android Filesystem Layout
    Android Build System                     System Customization
    Android Native Layer                     Building a Library
                                              Adding a Native Application to the
                                               Build

Android Internals @ SAS                  5                   08/23/12
How does Embedded Linux System
Boot?
 We will talk about bootloader and Init process only.




Android Internals @ SAS               6                  08/23/12
What does a Bootloader do?
    Basic HW initialization
    Loading of an application binary, usually an operating system kernel
    Decompression of the application binary
    Execution of the application
    Most bootloaders provide a shell with various commands implementing
     different operations.
          Loading data
          Memory inspection
          HW diagnostics
          Testing
          ...




Android Internals @ SAS                7               08/23/12
PC Boatloaders
                                      BIOS executes from on board
                                       ROM.
                                          Basic HW initialization + 1st
                    BIOS                   bootloader loading
                                      1st stage bootloader loads a full
          1st stage bootloader         boatloader.
                                      Full bootloader with full
                                       functionality and features.
             Full boatloader
                                          It can load a kernel from a
                                           filesystem.
                   Kernel             Examples:
                                          GRUB
                                          Syslinux


Android Internals @ SAS          8                    08/23/12
Booting on Embedded CPUs – NOR
Flash
                               CPU starts executing code at a
                                fixed address when powered up.

                               HW design ensures that a NOR
                                flash is at this address.
                                   It can hold the 1st stage
                                    bootloader or even a full
                                    bootloader.


                               NOR flashes are very expensive
                                and limited in size.

                               Not very common nowdays

Android Internals @ SAS   9                   08/23/12
Booting on Embedded CPUs – !NOR
Flash
                                      ROM code is stored in an internal
                                       ROM in the CPU.

                ROM code
                                      ROM code loads bootstrap
                                       bootloader from non-volatile
         Bootstrap bootloader          storage into SRAM.


             Full boatloader          Bootstrap loads full bootloader
                                       into DRAM which in return loads
                                       the kernel in the DRAM.
                   Kernel




Android Internals @ SAS         10                  08/23/12
Examples of Embedded Bootloaders
 U-Boot
       http://www.denx.de/wiki/U-Boot

 Barebox
       http://www.barebox.org

 Redboot

 Yaboot

 PMON

 ...


Android Internals @ SAS                  11   08/23/12
Android Bootloader
 The bootloader is outside the realm of Android itself.

 The first-stage bootloader will provide support for:
       Loading recovery images to the system flash
       Putting the device into a mode where the developer can perform
        development tasks
              AKA fastboot mode
       These features should be disabled in production.


 In addition, it supports normal booting sequence.




Android Internals @ SAS                    12               08/23/12
What is Fastboot?
 A protocol to communicate bootloaders over USB.

 It is synchronous and driven by the host.

 Accessible with the fastboot command.

 Allows to:
          Transmit data
          Flash the various partitions of the device
          Get variables from the bootloader
          Control the boot sequence




Android Internals @ SAS                        13       08/23/12
Fastboot Usage
1.    Make sure that ADB or SDK installed on host.
2.    Install fastboot for your host.
3.    Turn off the device.
4.    Boot device into bootloader.
5.    Make sure the device is in FASTBOOT and not HBOOT.
6.    Connect the device to the computer via USB.
7.    On your computer, open terminal and run fastboot command.




Android Internals @ SAS              14              08/23/12
Fastboot Command
 Usage: fastboot [ <option> ] <command>
Command                               Description
update <filename>                     Reflash device from filename
flashall                              Flash boot + recovery + system
flash <partition> [ <filename> ]      Write a file to a flash Partion
erase <partition>                     Erase a flash partition
getvar <variable>                     Display a bootloader variable
boot <kernel> [ <ramdisk> ]           Download and boot kernel
flash:raw boot <kernel> [ <ramdisk> ] Create bootimage and flash it
devices                               List all connected devices
continue                              Continue with autoboot
reboot                                Reboot device normally
reboot-bootloader                     Reboot device into bootloader
Android Internals @ SAS                   15                    08/23/12
Fastboot Command cont’d

Option                    Description
-w                        Erase userdata and cache
-s <serial number>        Specify device serial number
-p <product>              Specify product name
-c <cmdline>              Override kernel commandline
-i <vendor id>            Specify a custom USB vendor id
-b <base_addr>            Specify a custom kernel base address
-n <page size>            Specify the nand page size. default:2048




Android Internals @ SAS                        16                    08/23/12
Fastboot Session Example




Android Internals @ SAS   17   08/23/12
Init Starts Daemons
 Including
          usbd
          adbd
          debuggerd
          rild
          ...




                          Daemon
                           Daemon
                            Daemon

                                      Init


Android Internals @ SAS          18          08/23/12
Init Starts Zygote Process
 A Zygote process:
          Initializes a Dalvik VM instance
          Loads classes
          Listens for requests to spawn VMs
          Forks on requests VMs using copy-on-write to minimize footprint




                                   Daemon
                                    Daemon                          Zygote
                                     Daemon

                                                     Init

Android Internals @ SAS                      19                 08/23/12
Init Starts Runtime Process
    A runtime process:
          Initializes a service manager and
           registers it as a default context
           manager for Binder services




                                                    Service
                                                    Manager

                                   Daemon
                                    Daemon          Runtime        Zygote
                                     Daemon

                                                      Init

Android Internals @ SAS                        20             08/23/12
Runtime Requests to Start the System
Server Process
 Requested from Zygote
 Zygote forks a new VM for the system server process and starts the
  server.



                                                           System
                                                           Server

                                           Service          Dalvik
                                           Manager           VM

                           Daemon
                            Daemon         Runtime         Zygote
                             Daemon

                                             Init

Android Internals @ SAS               21              08/23/12
System Server Starts the Native
System Servers
 Including:
       Surface flinger
       Audio flinger
       ...                                Daemon
                                            Daemon
                                             Flingers

                                                             System
 Native system servers register                             Server
  with service manager as IPC
                                           Service            Dalvik
  service targets.
                                           Manager             VM

                           Daemon
                            Daemon         Runtime           Zygote
                            Daemons

                                             Init

Android Internals @ SAS               22                08/23/12
System Server Starts the Android
Managed Services
 Including
          Content manager
          Window manager
          Telephony service                   Daemon
                                                Daemon                     Daemon
                                                                            Daemon
                                                 Flingers                   Managers
          Activity manager
          …
                                                                 System
                                                                 Server

                                               Service            Dalvik
                                               Manager             VM

                               Daemon
                                Daemon         Runtime           Zygote
                                 Daemon

                                                 Init

Android Internals @ SAS                   23                08/23/12
Android Managed Services Register
with the Service Manager


                                          Daemon
                                           Daemon                     Daemon
                                                                       Daemon
                                            Flingers                   Managers

                                                            System
                                                            Server

                                          Service            Dalvik
                                          Manager             VM

                          Daemon
                           Daemon         Runtime           Zygote
                            Daemon

                                            Init

Android Internals @ SAS              24                08/23/12
Android Startup Overview

                          System Startup




Android Internals @ SAS         25         08/23/12
Android Startup Overview – Home
Window




                          libc




Android Internals @ SAS          26   08/23/12
Android Startup Overview – Any
Application




                          libc




Android Internals @ SAS          27   08/23/12
How do Layers Interact?
 There are 3 main scenarios for the app to talk to the native libraries.
       Directly
       Through a service
       Through a daemon


 Depends on:
                                                       Applications
       Application
       Native library implementation              Application Framework
       Android version                                  Libraries

                                                       Linux Kernel




Android Internals @ SAS                 28                08/23/12
Direct Layers Interaction
       Applications




                          Application

                                                      Binder IPC
       Application
       Framework




                                          Runtime Service


                                                     JNI




                                        Native Service Binding
       Libraries




                                                       Dynamic Loading

                                              HAL Library
       Linux Kernel




                                              Device Driver


Android Internals @ SAS                  29                              08/23/12
Direct Layers Interaction – Location
ManagerApplications




                          Application

                                                       Binder IPC
       Application
       Framework




                                         Location Manager Service



                                           GPS Location Provider

                                                       JNI

                                        GPS Location Provider Binder
       Libraries




                                                        Dynamic Loading

                                                 libgps.so
       Linux Kernel




                                             GPS Device Driver


Android Internals @ SAS                     30                            08/23/12
Through a Service Layers Interaction
       Applications




                      Application

                                                 Binder IPC
       Application
       Framework




                                      Runtime Service


                                                JNI



                                                              Binder IPC
                                    Native Service Binding                     Native Service
       Libraries




                                                                                        Dynamic Loading

                                                                                HAL Library
       Linux Kernel




                                                                               Device Driver



Android Internals @ SAS                               31                   08/23/12
Through a Service Layers Interaction –
Media Player
       Applications




                      Application

                                               Binder IPC
       Application
       Framework




                                       Media Player


                                              JNI



                                                            Binder IPC
                                    Media Player Binder                       Audio Flinger
       Libraries




                                                                                         Dynamic Loading
                                    Media Framework
                                                                               libaudio.so
       Linux Kernel




                                                                                  ALSA



                                                                          Speakers Device Driver

Android Internals @ SAS                             32                   08/23/12
Through a Daemon Layers Interaction
       Applications




                      Application

                                                 Binder IPC
       Application
       Framework




                                      Runtime Service


                                                JNI



                                                              Sockets
                                    Native Service Binding                  Native Daemon
       Libraries




                                                                                     Dynamic Loading

                                                                             HAL Library
       Linux Kernel




                                                                            Device Driver



Android Internals @ SAS                               33                08/23/12
Android Internals @ SAS   34   08/23/12

More Related Content

What's hot

Android Boot Time Optimization
Android Boot Time OptimizationAndroid Boot Time Optimization
Android Boot Time OptimizationKan-Ru Chen
 
Understanding the Android System Server
Understanding the Android System ServerUnderstanding the Android System Server
Understanding the Android System ServerOpersys inc.
 
"Learning AOSP" - Android Hardware Abstraction Layer (HAL)
"Learning AOSP" - Android Hardware Abstraction Layer (HAL)"Learning AOSP" - Android Hardware Abstraction Layer (HAL)
"Learning AOSP" - Android Hardware Abstraction Layer (HAL)Nanik Tolaram
 
Android booting sequece and setup and debugging
Android booting sequece and setup and debuggingAndroid booting sequece and setup and debugging
Android booting sequece and setup and debuggingUtkarsh Mankad
 
Q4.11: Porting Android to new Platforms
Q4.11: Porting Android to new PlatformsQ4.11: Porting Android to new Platforms
Q4.11: Porting Android to new PlatformsLinaro
 
Learning AOSP - Android Linux Device Driver
Learning AOSP - Android Linux Device DriverLearning AOSP - Android Linux Device Driver
Learning AOSP - Android Linux Device DriverNanik Tolaram
 
Android's HIDL: Treble in the HAL
Android's HIDL: Treble in the HALAndroid's HIDL: Treble in the HAL
Android's HIDL: Treble in the HALOpersys inc.
 
Android Binder IPC for Linux
Android Binder IPC for LinuxAndroid Binder IPC for Linux
Android Binder IPC for LinuxYu-Hsin Hung
 
Android graphic system (SurfaceFlinger) : Design Pattern's perspective
Android graphic system (SurfaceFlinger) : Design Pattern's perspectiveAndroid graphic system (SurfaceFlinger) : Design Pattern's perspective
Android graphic system (SurfaceFlinger) : Design Pattern's perspectiveBin Chen
 
Android for Embedded Linux Developers
Android for Embedded Linux DevelopersAndroid for Embedded Linux Developers
Android for Embedded Linux DevelopersOpersys inc.
 
A deep dive into Android OpenSource Project(AOSP)
A deep dive into Android OpenSource Project(AOSP)A deep dive into Android OpenSource Project(AOSP)
A deep dive into Android OpenSource Project(AOSP)Siji Sunny
 

What's hot (20)

Android Boot Time Optimization
Android Boot Time OptimizationAndroid Boot Time Optimization
Android Boot Time Optimization
 
Android Things : Building Embedded Devices
Android Things : Building Embedded DevicesAndroid Things : Building Embedded Devices
Android Things : Building Embedded Devices
 
Understanding the Android System Server
Understanding the Android System ServerUnderstanding the Android System Server
Understanding the Android System Server
 
"Learning AOSP" - Android Hardware Abstraction Layer (HAL)
"Learning AOSP" - Android Hardware Abstraction Layer (HAL)"Learning AOSP" - Android Hardware Abstraction Layer (HAL)
"Learning AOSP" - Android Hardware Abstraction Layer (HAL)
 
Android booting sequece and setup and debugging
Android booting sequece and setup and debuggingAndroid booting sequece and setup and debugging
Android booting sequece and setup and debugging
 
Embedded Android : System Development - Part I
Embedded Android : System Development - Part IEmbedded Android : System Development - Part I
Embedded Android : System Development - Part I
 
Q4.11: Porting Android to new Platforms
Q4.11: Porting Android to new PlatformsQ4.11: Porting Android to new Platforms
Q4.11: Porting Android to new Platforms
 
Learning AOSP - Android Linux Device Driver
Learning AOSP - Android Linux Device DriverLearning AOSP - Android Linux Device Driver
Learning AOSP - Android Linux Device Driver
 
Explore Android Internals
Explore Android InternalsExplore Android Internals
Explore Android Internals
 
Android's HIDL: Treble in the HAL
Android's HIDL: Treble in the HALAndroid's HIDL: Treble in the HAL
Android's HIDL: Treble in the HAL
 
Embedded Android : System Development - Part III
Embedded Android : System Development - Part IIIEmbedded Android : System Development - Part III
Embedded Android : System Development - Part III
 
Android Binder IPC for Linux
Android Binder IPC for LinuxAndroid Binder IPC for Linux
Android Binder IPC for Linux
 
Android graphic system (SurfaceFlinger) : Design Pattern's perspective
Android graphic system (SurfaceFlinger) : Design Pattern's perspectiveAndroid graphic system (SurfaceFlinger) : Design Pattern's perspective
Android graphic system (SurfaceFlinger) : Design Pattern's perspective
 
Android for Embedded Linux Developers
Android for Embedded Linux DevelopersAndroid for Embedded Linux Developers
Android for Embedded Linux Developers
 
Android Binder: Deep Dive
Android Binder: Deep DiveAndroid Binder: Deep Dive
Android Binder: Deep Dive
 
Android Internals
Android InternalsAndroid Internals
Android Internals
 
A deep dive into Android OpenSource Project(AOSP)
A deep dive into Android OpenSource Project(AOSP)A deep dive into Android OpenSource Project(AOSP)
A deep dive into Android OpenSource Project(AOSP)
 
Embedded Android : System Development - Part II (Linux device drivers)
Embedded Android : System Development - Part II (Linux device drivers)Embedded Android : System Development - Part II (Linux device drivers)
Embedded Android : System Development - Part II (Linux device drivers)
 
Binder: Android IPC
Binder: Android IPCBinder: Android IPC
Binder: Android IPC
 
Deep Dive into the AOSP
Deep Dive into the AOSPDeep Dive into the AOSP
Deep Dive into the AOSP
 

Similar to Android Booting Scenarios

Android crash debugging
Android crash debuggingAndroid crash debugging
Android crash debuggingAshish Agrawal
 
Taking Control of Your Mobile Device - Rooting-n-Roms
Taking Control of Your Mobile Device - Rooting-n-RomsTaking Control of Your Mobile Device - Rooting-n-Roms
Taking Control of Your Mobile Device - Rooting-n-Romsjimboks
 
Real-World Docker: 10 Things We've Learned
Real-World Docker: 10 Things We've Learned  Real-World Docker: 10 Things We've Learned
Real-World Docker: 10 Things We've Learned RightScale
 
Introducing resinOS: An Operating System Tailored for Containers and Built fo...
Introducing resinOS: An Operating System Tailored for Containers and Built fo...Introducing resinOS: An Operating System Tailored for Containers and Built fo...
Introducing resinOS: An Operating System Tailored for Containers and Built fo...Balena
 
Android porting for dummies @droidconin 2011
Android porting for dummies @droidconin 2011Android porting for dummies @droidconin 2011
Android porting for dummies @droidconin 2011pundiramit
 
Linux Kernel Development
Linux Kernel DevelopmentLinux Kernel Development
Linux Kernel DevelopmentPriyank Kapadia
 
Develop with docker 2014 aug
Develop with docker 2014 augDevelop with docker 2014 aug
Develop with docker 2014 augVincent De Smet
 
An Introduction To Android
An Introduction To AndroidAn Introduction To Android
An Introduction To Androidnatdefreitas
 
#VirtualDesignMaster 3 Challenge 4 – James Brown
#VirtualDesignMaster 3 Challenge 4 – James Brown#VirtualDesignMaster 3 Challenge 4 – James Brown
#VirtualDesignMaster 3 Challenge 4 – James Brownvdmchallenge
 
Working with the AOSP - Linaro Connect Asia 2013
Working with the AOSP - Linaro Connect Asia 2013Working with the AOSP - Linaro Connect Asia 2013
Working with the AOSP - Linaro Connect Asia 2013Opersys inc.
 
Timings of Init : Android Ramdisks for the Practical Hacker
Timings of Init : Android Ramdisks for the Practical HackerTimings of Init : Android Ramdisks for the Practical Hacker
Timings of Init : Android Ramdisks for the Practical HackerStacy Devino
 
OFM SOA Suite 11gR1 – Installation Demonstration
OFM SOA Suite 11gR1 – Installation DemonstrationOFM SOA Suite 11gR1 – Installation Demonstration
OFM SOA Suite 11gR1 – Installation DemonstrationSreenivasa Setty
 
Android on Intel Architecture: ROM Cooking Tutorial
Android on Intel Architecture: ROM Cooking TutorialAndroid on Intel Architecture: ROM Cooking Tutorial
Android on Intel Architecture: ROM Cooking TutorialRon Munitz
 
Introduction to Docker storage, volume and image
Introduction to Docker storage, volume and imageIntroduction to Docker storage, volume and image
Introduction to Docker storage, volume and imageejlp12
 
Medooze MCU Video Multiconference Server Installation and configuration guide...
Medooze MCU Video Multiconference Server Installation and configuration guide...Medooze MCU Video Multiconference Server Installation and configuration guide...
Medooze MCU Video Multiconference Server Installation and configuration guide...sreeharsha43
 

Similar to Android Booting Scenarios (20)

Android crash debugging
Android crash debuggingAndroid crash debugging
Android crash debugging
 
Building
BuildingBuilding
Building
 
Taking Control of Your Mobile Device - Rooting-n-Roms
Taking Control of Your Mobile Device - Rooting-n-RomsTaking Control of Your Mobile Device - Rooting-n-Roms
Taking Control of Your Mobile Device - Rooting-n-Roms
 
Real-World Docker: 10 Things We've Learned
Real-World Docker: 10 Things We've Learned  Real-World Docker: 10 Things We've Learned
Real-World Docker: 10 Things We've Learned
 
Introducing resinOS: An Operating System Tailored for Containers and Built fo...
Introducing resinOS: An Operating System Tailored for Containers and Built fo...Introducing resinOS: An Operating System Tailored for Containers and Built fo...
Introducing resinOS: An Operating System Tailored for Containers and Built fo...
 
Android porting for dummies @droidconin 2011
Android porting for dummies @droidconin 2011Android porting for dummies @droidconin 2011
Android porting for dummies @droidconin 2011
 
Android Attacks
Android AttacksAndroid Attacks
Android Attacks
 
Linux Kernel Development
Linux Kernel DevelopmentLinux Kernel Development
Linux Kernel Development
 
Docker
DockerDocker
Docker
 
Develop with docker 2014 aug
Develop with docker 2014 augDevelop with docker 2014 aug
Develop with docker 2014 aug
 
An Introduction To Android
An Introduction To AndroidAn Introduction To Android
An Introduction To Android
 
#VirtualDesignMaster 3 Challenge 4 – James Brown
#VirtualDesignMaster 3 Challenge 4 – James Brown#VirtualDesignMaster 3 Challenge 4 – James Brown
#VirtualDesignMaster 3 Challenge 4 – James Brown
 
5. boot process
5. boot process5. boot process
5. boot process
 
Working with the AOSP - Linaro Connect Asia 2013
Working with the AOSP - Linaro Connect Asia 2013Working with the AOSP - Linaro Connect Asia 2013
Working with the AOSP - Linaro Connect Asia 2013
 
Timings of Init : Android Ramdisks for the Practical Hacker
Timings of Init : Android Ramdisks for the Practical HackerTimings of Init : Android Ramdisks for the Practical Hacker
Timings of Init : Android Ramdisks for the Practical Hacker
 
OFM SOA Suite 11gR1 – Installation Demonstration
OFM SOA Suite 11gR1 – Installation DemonstrationOFM SOA Suite 11gR1 – Installation Demonstration
OFM SOA Suite 11gR1 – Installation Demonstration
 
Android on Intel Architecture: ROM Cooking Tutorial
Android on Intel Architecture: ROM Cooking TutorialAndroid on Intel Architecture: ROM Cooking Tutorial
Android on Intel Architecture: ROM Cooking Tutorial
 
Path to Surfdroid
Path to SurfdroidPath to Surfdroid
Path to Surfdroid
 
Introduction to Docker storage, volume and image
Introduction to Docker storage, volume and imageIntroduction to Docker storage, volume and image
Introduction to Docker storage, volume and image
 
Medooze MCU Video Multiconference Server Installation and configuration guide...
Medooze MCU Video Multiconference Server Installation and configuration guide...Medooze MCU Video Multiconference Server Installation and configuration guide...
Medooze MCU Video Multiconference Server Installation and configuration guide...
 

More from Amr Ali (ISTQB CTAL Full, CSM, ITIL Foundation)

More from Amr Ali (ISTQB CTAL Full, CSM, ITIL Foundation) (20)

Introduction to state machines in Embedded Software Design
Introduction to state machines in Embedded Software DesignIntroduction to state machines in Embedded Software Design
Introduction to state machines in Embedded Software Design
 
Embedded SW Testing
Embedded SW TestingEmbedded SW Testing
Embedded SW Testing
 
Cracking the interview
Cracking the interviewCracking the interview
Cracking the interview
 
Embedded linux network device driver development
Embedded linux network device driver developmentEmbedded linux network device driver development
Embedded linux network device driver development
 
Embedded summer camps 2017
Embedded summer camps 2017Embedded summer camps 2017
Embedded summer camps 2017
 
Introduction to Embedded Systems a Practical Approach
Introduction to Embedded Systems a Practical ApproachIntroduction to Embedded Systems a Practical Approach
Introduction to Embedded Systems a Practical Approach
 
ISTQB Advanced Test Manager Training 2012 - Testing Process
ISTQB Advanced Test Manager Training 2012 - Testing Process ISTQB Advanced Test Manager Training 2012 - Testing Process
ISTQB Advanced Test Manager Training 2012 - Testing Process
 
Introduction to Software Test Automation
Introduction to Software Test AutomationIntroduction to Software Test Automation
Introduction to Software Test Automation
 
ISTQB Foundation Agile Tester 2014 Training, Agile SW Development
ISTQB Foundation Agile Tester 2014 Training, Agile SW DevelopmentISTQB Foundation Agile Tester 2014 Training, Agile SW Development
ISTQB Foundation Agile Tester 2014 Training, Agile SW Development
 
ISTQB Technical Test Analyst 2012 Training - Structure-Based Testing
ISTQB Technical Test Analyst 2012 Training - Structure-Based TestingISTQB Technical Test Analyst 2012 Training - Structure-Based Testing
ISTQB Technical Test Analyst 2012 Training - Structure-Based Testing
 
ISTQB Technical Test Analyst 2012 Training - The Technical Test Analyst's Tas...
ISTQB Technical Test Analyst 2012 Training - The Technical Test Analyst's Tas...ISTQB Technical Test Analyst 2012 Training - The Technical Test Analyst's Tas...
ISTQB Technical Test Analyst 2012 Training - The Technical Test Analyst's Tas...
 
Simulation Using Isim
Simulation Using Isim Simulation Using Isim
Simulation Using Isim
 
Introduction to C Programming
Introduction to C ProgrammingIntroduction to C Programming
Introduction to C Programming
 
Introduction to embedded systems
Introduction to embedded systemsIntroduction to embedded systems
Introduction to embedded systems
 
Introduction to stm32-part1
Introduction to stm32-part1Introduction to stm32-part1
Introduction to stm32-part1
 
Introduction to stm32-part2
Introduction to stm32-part2Introduction to stm32-part2
Introduction to stm32-part2
 
Fpga programming
Fpga programmingFpga programming
Fpga programming
 
Synthesis Using ISE
Synthesis Using ISESynthesis Using ISE
Synthesis Using ISE
 
Simulation using model sim
Simulation using model simSimulation using model sim
Simulation using model sim
 
FreeRTOS Course - Semaphore/Mutex Management
FreeRTOS Course - Semaphore/Mutex ManagementFreeRTOS Course - Semaphore/Mutex Management
FreeRTOS Course - Semaphore/Mutex Management
 

Recently uploaded

Strategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
Strategize a Smooth Tenant-to-tenant Migration and Copilot TakeoffStrategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
Strategize a Smooth Tenant-to-tenant Migration and Copilot Takeoffsammart93
 
Apidays New York 2024 - Passkeys: Developing APIs to enable passwordless auth...
Apidays New York 2024 - Passkeys: Developing APIs to enable passwordless auth...Apidays New York 2024 - Passkeys: Developing APIs to enable passwordless auth...
Apidays New York 2024 - Passkeys: Developing APIs to enable passwordless auth...apidays
 
AXA XL - Insurer Innovation Award Americas 2024
AXA XL - Insurer Innovation Award Americas 2024AXA XL - Insurer Innovation Award Americas 2024
AXA XL - Insurer Innovation Award Americas 2024The Digital Insurer
 
Connector Corner: Accelerate revenue generation using UiPath API-centric busi...
Connector Corner: Accelerate revenue generation using UiPath API-centric busi...Connector Corner: Accelerate revenue generation using UiPath API-centric busi...
Connector Corner: Accelerate revenue generation using UiPath API-centric busi...DianaGray10
 
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers:  A Deep Dive into Serverless Spatial Data and FMECloud Frontiers:  A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FMESafe Software
 
MINDCTI Revenue Release Quarter One 2024
MINDCTI Revenue Release Quarter One 2024MINDCTI Revenue Release Quarter One 2024
MINDCTI Revenue Release Quarter One 2024MIND CTI
 
Apidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, Adobe
Apidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, AdobeApidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, Adobe
Apidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, Adobeapidays
 
AWS Community Day CPH - Three problems of Terraform
AWS Community Day CPH - Three problems of TerraformAWS Community Day CPH - Three problems of Terraform
AWS Community Day CPH - Three problems of TerraformAndrey Devyatkin
 
Axa Assurance Maroc - Insurer Innovation Award 2024
Axa Assurance Maroc - Insurer Innovation Award 2024Axa Assurance Maroc - Insurer Innovation Award 2024
Axa Assurance Maroc - Insurer Innovation Award 2024The Digital Insurer
 
Modular Monolith - a Practical Alternative to Microservices @ Devoxx UK 2024
Modular Monolith - a Practical Alternative to Microservices @ Devoxx UK 2024Modular Monolith - a Practical Alternative to Microservices @ Devoxx UK 2024
Modular Monolith - a Practical Alternative to Microservices @ Devoxx UK 2024Victor Rentea
 
Emergent Methods: Multi-lingual narrative tracking in the news - real-time ex...
Emergent Methods: Multi-lingual narrative tracking in the news - real-time ex...Emergent Methods: Multi-lingual narrative tracking in the news - real-time ex...
Emergent Methods: Multi-lingual narrative tracking in the news - real-time ex...Zilliz
 
EMPOWERMENT TECHNOLOGY GRADE 11 QUARTER 2 REVIEWER
EMPOWERMENT TECHNOLOGY GRADE 11 QUARTER 2 REVIEWEREMPOWERMENT TECHNOLOGY GRADE 11 QUARTER 2 REVIEWER
EMPOWERMENT TECHNOLOGY GRADE 11 QUARTER 2 REVIEWERMadyBayot
 
Biography Of Angeliki Cooney | Senior Vice President Life Sciences | Albany, ...
Biography Of Angeliki Cooney | Senior Vice President Life Sciences | Albany, ...Biography Of Angeliki Cooney | Senior Vice President Life Sciences | Albany, ...
Biography Of Angeliki Cooney | Senior Vice President Life Sciences | Albany, ...Angeliki Cooney
 
Navigating the Deluge_ Dubai Floods and the Resilience of Dubai International...
Navigating the Deluge_ Dubai Floods and the Resilience of Dubai International...Navigating the Deluge_ Dubai Floods and the Resilience of Dubai International...
Navigating the Deluge_ Dubai Floods and the Resilience of Dubai International...Orbitshub
 
Apidays New York 2024 - Accelerating FinTech Innovation by Vasa Krishnan, Fin...
Apidays New York 2024 - Accelerating FinTech Innovation by Vasa Krishnan, Fin...Apidays New York 2024 - Accelerating FinTech Innovation by Vasa Krishnan, Fin...
Apidays New York 2024 - Accelerating FinTech Innovation by Vasa Krishnan, Fin...apidays
 
Why Teams call analytics are critical to your entire business
Why Teams call analytics are critical to your entire businessWhy Teams call analytics are critical to your entire business
Why Teams call analytics are critical to your entire businesspanagenda
 
Web Form Automation for Bonterra Impact Management (fka Social Solutions Apri...
Web Form Automation for Bonterra Impact Management (fka Social Solutions Apri...Web Form Automation for Bonterra Impact Management (fka Social Solutions Apri...
Web Form Automation for Bonterra Impact Management (fka Social Solutions Apri...Jeffrey Haguewood
 
Apidays New York 2024 - APIs in 2030: The Risk of Technological Sleepwalk by ...
Apidays New York 2024 - APIs in 2030: The Risk of Technological Sleepwalk by ...Apidays New York 2024 - APIs in 2030: The Risk of Technological Sleepwalk by ...
Apidays New York 2024 - APIs in 2030: The Risk of Technological Sleepwalk by ...apidays
 
"I see eyes in my soup": How Delivery Hero implemented the safety system for ...
"I see eyes in my soup": How Delivery Hero implemented the safety system for ..."I see eyes in my soup": How Delivery Hero implemented the safety system for ...
"I see eyes in my soup": How Delivery Hero implemented the safety system for ...Zilliz
 

Recently uploaded (20)

+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
 
Strategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
Strategize a Smooth Tenant-to-tenant Migration and Copilot TakeoffStrategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
Strategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
 
Apidays New York 2024 - Passkeys: Developing APIs to enable passwordless auth...
Apidays New York 2024 - Passkeys: Developing APIs to enable passwordless auth...Apidays New York 2024 - Passkeys: Developing APIs to enable passwordless auth...
Apidays New York 2024 - Passkeys: Developing APIs to enable passwordless auth...
 
AXA XL - Insurer Innovation Award Americas 2024
AXA XL - Insurer Innovation Award Americas 2024AXA XL - Insurer Innovation Award Americas 2024
AXA XL - Insurer Innovation Award Americas 2024
 
Connector Corner: Accelerate revenue generation using UiPath API-centric busi...
Connector Corner: Accelerate revenue generation using UiPath API-centric busi...Connector Corner: Accelerate revenue generation using UiPath API-centric busi...
Connector Corner: Accelerate revenue generation using UiPath API-centric busi...
 
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers:  A Deep Dive into Serverless Spatial Data and FMECloud Frontiers:  A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
 
MINDCTI Revenue Release Quarter One 2024
MINDCTI Revenue Release Quarter One 2024MINDCTI Revenue Release Quarter One 2024
MINDCTI Revenue Release Quarter One 2024
 
Apidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, Adobe
Apidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, AdobeApidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, Adobe
Apidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, Adobe
 
AWS Community Day CPH - Three problems of Terraform
AWS Community Day CPH - Three problems of TerraformAWS Community Day CPH - Three problems of Terraform
AWS Community Day CPH - Three problems of Terraform
 
Axa Assurance Maroc - Insurer Innovation Award 2024
Axa Assurance Maroc - Insurer Innovation Award 2024Axa Assurance Maroc - Insurer Innovation Award 2024
Axa Assurance Maroc - Insurer Innovation Award 2024
 
Modular Monolith - a Practical Alternative to Microservices @ Devoxx UK 2024
Modular Monolith - a Practical Alternative to Microservices @ Devoxx UK 2024Modular Monolith - a Practical Alternative to Microservices @ Devoxx UK 2024
Modular Monolith - a Practical Alternative to Microservices @ Devoxx UK 2024
 
Emergent Methods: Multi-lingual narrative tracking in the news - real-time ex...
Emergent Methods: Multi-lingual narrative tracking in the news - real-time ex...Emergent Methods: Multi-lingual narrative tracking in the news - real-time ex...
Emergent Methods: Multi-lingual narrative tracking in the news - real-time ex...
 
EMPOWERMENT TECHNOLOGY GRADE 11 QUARTER 2 REVIEWER
EMPOWERMENT TECHNOLOGY GRADE 11 QUARTER 2 REVIEWEREMPOWERMENT TECHNOLOGY GRADE 11 QUARTER 2 REVIEWER
EMPOWERMENT TECHNOLOGY GRADE 11 QUARTER 2 REVIEWER
 
Biography Of Angeliki Cooney | Senior Vice President Life Sciences | Albany, ...
Biography Of Angeliki Cooney | Senior Vice President Life Sciences | Albany, ...Biography Of Angeliki Cooney | Senior Vice President Life Sciences | Albany, ...
Biography Of Angeliki Cooney | Senior Vice President Life Sciences | Albany, ...
 
Navigating the Deluge_ Dubai Floods and the Resilience of Dubai International...
Navigating the Deluge_ Dubai Floods and the Resilience of Dubai International...Navigating the Deluge_ Dubai Floods and the Resilience of Dubai International...
Navigating the Deluge_ Dubai Floods and the Resilience of Dubai International...
 
Apidays New York 2024 - Accelerating FinTech Innovation by Vasa Krishnan, Fin...
Apidays New York 2024 - Accelerating FinTech Innovation by Vasa Krishnan, Fin...Apidays New York 2024 - Accelerating FinTech Innovation by Vasa Krishnan, Fin...
Apidays New York 2024 - Accelerating FinTech Innovation by Vasa Krishnan, Fin...
 
Why Teams call analytics are critical to your entire business
Why Teams call analytics are critical to your entire businessWhy Teams call analytics are critical to your entire business
Why Teams call analytics are critical to your entire business
 
Web Form Automation for Bonterra Impact Management (fka Social Solutions Apri...
Web Form Automation for Bonterra Impact Management (fka Social Solutions Apri...Web Form Automation for Bonterra Impact Management (fka Social Solutions Apri...
Web Form Automation for Bonterra Impact Management (fka Social Solutions Apri...
 
Apidays New York 2024 - APIs in 2030: The Risk of Technological Sleepwalk by ...
Apidays New York 2024 - APIs in 2030: The Risk of Technological Sleepwalk by ...Apidays New York 2024 - APIs in 2030: The Risk of Technological Sleepwalk by ...
Apidays New York 2024 - APIs in 2030: The Risk of Technological Sleepwalk by ...
 
"I see eyes in my soup": How Delivery Hero implemented the safety system for ...
"I see eyes in my soup": How Delivery Hero implemented the safety system for ..."I see eyes in my soup": How Delivery Hero implemented the safety system for ...
"I see eyes in my soup": How Delivery Hero implemented the safety system for ...
 

Android Booting Scenarios

  • 2. Course Objectives  Develop embedded systems with Google Android  Customize and install Google Android for your target platform Android Internals @ SAS 2 08/23/12
  • 3. Course Prerequisites  C/C++  Basic Java  Basic Unix/Linux command line interface experience  An extra 1 day training may be needed.  Embedded systems development is a plus. Android Internals @ SAS 3 08/23/12
  • 4. Course Notes  Ask any time.  Set your cell to silent.  Course assumes Linux is already ported to your hardware.  An extra 5 days training may be needed. Android Internals @ SAS 4 08/23/12
  • 5. Outline Lectures Labs  Introduction to Android  Android Source Code  Android Source Code & Compilation  1st Compilation  Linux Kernel Introduction  Compile and Boot an Android Kernel  Changes Introduced in the Android Kernel  Android Booting Scenarios  Supporting a New Board  Developing and Debugging with ADB  Use ADB  Android Filesystem Layout  Android Build System  System Customization  Android Native Layer  Building a Library  Adding a Native Application to the Build Android Internals @ SAS 5 08/23/12
  • 6. How does Embedded Linux System Boot?  We will talk about bootloader and Init process only. Android Internals @ SAS 6 08/23/12
  • 7. What does a Bootloader do?  Basic HW initialization  Loading of an application binary, usually an operating system kernel  Decompression of the application binary  Execution of the application  Most bootloaders provide a shell with various commands implementing different operations.  Loading data  Memory inspection  HW diagnostics  Testing  ... Android Internals @ SAS 7 08/23/12
  • 8. PC Boatloaders  BIOS executes from on board ROM.  Basic HW initialization + 1st BIOS bootloader loading  1st stage bootloader loads a full 1st stage bootloader boatloader.  Full bootloader with full functionality and features. Full boatloader  It can load a kernel from a filesystem. Kernel  Examples:  GRUB  Syslinux Android Internals @ SAS 8 08/23/12
  • 9. Booting on Embedded CPUs – NOR Flash  CPU starts executing code at a fixed address when powered up.  HW design ensures that a NOR flash is at this address.  It can hold the 1st stage bootloader or even a full bootloader.  NOR flashes are very expensive and limited in size.  Not very common nowdays Android Internals @ SAS 9 08/23/12
  • 10. Booting on Embedded CPUs – !NOR Flash  ROM code is stored in an internal ROM in the CPU. ROM code  ROM code loads bootstrap bootloader from non-volatile Bootstrap bootloader storage into SRAM. Full boatloader  Bootstrap loads full bootloader into DRAM which in return loads the kernel in the DRAM. Kernel Android Internals @ SAS 10 08/23/12
  • 11. Examples of Embedded Bootloaders  U-Boot  http://www.denx.de/wiki/U-Boot  Barebox  http://www.barebox.org  Redboot  Yaboot  PMON  ... Android Internals @ SAS 11 08/23/12
  • 12. Android Bootloader  The bootloader is outside the realm of Android itself.  The first-stage bootloader will provide support for:  Loading recovery images to the system flash  Putting the device into a mode where the developer can perform development tasks  AKA fastboot mode  These features should be disabled in production.  In addition, it supports normal booting sequence. Android Internals @ SAS 12 08/23/12
  • 13. What is Fastboot?  A protocol to communicate bootloaders over USB.  It is synchronous and driven by the host.  Accessible with the fastboot command.  Allows to:  Transmit data  Flash the various partitions of the device  Get variables from the bootloader  Control the boot sequence Android Internals @ SAS 13 08/23/12
  • 14. Fastboot Usage 1. Make sure that ADB or SDK installed on host. 2. Install fastboot for your host. 3. Turn off the device. 4. Boot device into bootloader. 5. Make sure the device is in FASTBOOT and not HBOOT. 6. Connect the device to the computer via USB. 7. On your computer, open terminal and run fastboot command. Android Internals @ SAS 14 08/23/12
  • 15. Fastboot Command  Usage: fastboot [ <option> ] <command> Command Description update <filename> Reflash device from filename flashall Flash boot + recovery + system flash <partition> [ <filename> ] Write a file to a flash Partion erase <partition> Erase a flash partition getvar <variable> Display a bootloader variable boot <kernel> [ <ramdisk> ] Download and boot kernel flash:raw boot <kernel> [ <ramdisk> ] Create bootimage and flash it devices List all connected devices continue Continue with autoboot reboot Reboot device normally reboot-bootloader Reboot device into bootloader Android Internals @ SAS 15 08/23/12
  • 16. Fastboot Command cont’d Option Description -w Erase userdata and cache -s <serial number> Specify device serial number -p <product> Specify product name -c <cmdline> Override kernel commandline -i <vendor id> Specify a custom USB vendor id -b <base_addr> Specify a custom kernel base address -n <page size> Specify the nand page size. default:2048 Android Internals @ SAS 16 08/23/12
  • 17. Fastboot Session Example Android Internals @ SAS 17 08/23/12
  • 18. Init Starts Daemons  Including  usbd  adbd  debuggerd  rild  ... Daemon Daemon Daemon Init Android Internals @ SAS 18 08/23/12
  • 19. Init Starts Zygote Process  A Zygote process:  Initializes a Dalvik VM instance  Loads classes  Listens for requests to spawn VMs  Forks on requests VMs using copy-on-write to minimize footprint Daemon Daemon Zygote Daemon Init Android Internals @ SAS 19 08/23/12
  • 20. Init Starts Runtime Process  A runtime process:  Initializes a service manager and registers it as a default context manager for Binder services Service Manager Daemon Daemon Runtime Zygote Daemon Init Android Internals @ SAS 20 08/23/12
  • 21. Runtime Requests to Start the System Server Process  Requested from Zygote  Zygote forks a new VM for the system server process and starts the server. System Server Service Dalvik Manager VM Daemon Daemon Runtime Zygote Daemon Init Android Internals @ SAS 21 08/23/12
  • 22. System Server Starts the Native System Servers  Including:  Surface flinger  Audio flinger  ... Daemon Daemon Flingers System  Native system servers register Server with service manager as IPC Service Dalvik service targets. Manager VM Daemon Daemon Runtime Zygote Daemons Init Android Internals @ SAS 22 08/23/12
  • 23. System Server Starts the Android Managed Services  Including  Content manager  Window manager  Telephony service Daemon Daemon Daemon Daemon Flingers Managers  Activity manager  … System Server Service Dalvik Manager VM Daemon Daemon Runtime Zygote Daemon Init Android Internals @ SAS 23 08/23/12
  • 24. Android Managed Services Register with the Service Manager Daemon Daemon Daemon Daemon Flingers Managers System Server Service Dalvik Manager VM Daemon Daemon Runtime Zygote Daemon Init Android Internals @ SAS 24 08/23/12
  • 25. Android Startup Overview System Startup Android Internals @ SAS 25 08/23/12
  • 26. Android Startup Overview – Home Window libc Android Internals @ SAS 26 08/23/12
  • 27. Android Startup Overview – Any Application libc Android Internals @ SAS 27 08/23/12
  • 28. How do Layers Interact?  There are 3 main scenarios for the app to talk to the native libraries.  Directly  Through a service  Through a daemon  Depends on: Applications  Application  Native library implementation Application Framework  Android version Libraries Linux Kernel Android Internals @ SAS 28 08/23/12
  • 29. Direct Layers Interaction Applications Application Binder IPC Application Framework Runtime Service JNI Native Service Binding Libraries Dynamic Loading HAL Library Linux Kernel Device Driver Android Internals @ SAS 29 08/23/12
  • 30. Direct Layers Interaction – Location ManagerApplications Application Binder IPC Application Framework Location Manager Service GPS Location Provider JNI GPS Location Provider Binder Libraries Dynamic Loading libgps.so Linux Kernel GPS Device Driver Android Internals @ SAS 30 08/23/12
  • 31. Through a Service Layers Interaction Applications Application Binder IPC Application Framework Runtime Service JNI Binder IPC Native Service Binding Native Service Libraries Dynamic Loading HAL Library Linux Kernel Device Driver Android Internals @ SAS 31 08/23/12
  • 32. Through a Service Layers Interaction – Media Player Applications Application Binder IPC Application Framework Media Player JNI Binder IPC Media Player Binder Audio Flinger Libraries Dynamic Loading Media Framework libaudio.so Linux Kernel ALSA Speakers Device Driver Android Internals @ SAS 32 08/23/12
  • 33. Through a Daemon Layers Interaction Applications Application Binder IPC Application Framework Runtime Service JNI Sockets Native Service Binding Native Daemon Libraries Dynamic Loading HAL Library Linux Kernel Device Driver Android Internals @ SAS 33 08/23/12
  • 34. Android Internals @ SAS 34 08/23/12

Editor's Notes

  1. Init starts Linux daemons, including: • USB Daemon (usbd) to manage USB connections • Android Debug Bridge (adbd) to manage ADB connections • Debugger Daemon (debuggerd) to manage debug processes requests (dump memory, etc.) • Radio Interface Layer Daemon (rild) to manage communication with the radio
  2. System server is the java framework corresponding to the native service manager.
  3. A flinger is like a user space driver that combines different inputs from different applications and send them to the HW device.