Android was designed originally for use in consumer electronics especially tablets and phones. Due to its wide proliferation, now there are many needs for developing platforms based on Android OS that finds applications in industrial HMI, Auto infotainment, etc. Simplicity, portability, low cost and rich GUI are some of the advantages of using Android in such applications.

Freescale iMx6 based SECOSBC-A62

On the hardware front, there are a lot of low cost development boards like Raspberry Pi/Raspberry Pi+, TI’s Beagleboard/Beagebone, Freescale’s SABRE platforms, UDOO board, Allwinner based Cubie platforms, Rockchip platforms, Intel boards etc. While these platforms are ideal for many applications, using them for a qualified industrial application is not possible as they are not industrial grade systems. Of a few options available, the latest offering from SECO the A62 SBC is an ideal choice. Available in multiple variants, features of the SECOSBC-A62 board include

  • Processor – Freescale i.MX6 Series – i.MX6S/i.MX6DL/i.MX6Q
  • Memory – 1GB DDR3L, 64-bit interface
  • Graphics – Integrated Graphics, with up to 3 separated HW accelerators for
  • 2D, OpenGL® ES2.0 3D,
  • Video Interfaces – 1 x Dual Channel or 2 x Single Channel 18/24 bit LVDS interface HDMI connector
  • Mass Storage – 4GB eMMC disc soldered onboard, microSD Card slot
  • Networking – Gigabit Ethernet connector, Internal USB connector for Wi-Fi Module
  • USB – 2 x USB 2.0 Type-A ports and 1 x USB 2.0 internal connector, USB micro-B Client port
  • Audio – AC’97 Audio Codec Realtek ALC655 with Mic-In, Line-Out audio Jacks
  • Serial Ports – 1 x Serial (TTL level), 2 x Serial (RS-232), 1 x CAN (TTL level)
  • Other Interfaces – Dedicated connector (I2C, GPIO signals) for external Touch Screen controller, MIPI-CSI Camera connector.
  • Configurable expansion connector with:
    • Up to 28 GPIO
    • SPI interface
    • SPDIF Audio interface
    • CAN interface (TTL level)
    • SDIO interface
    • PWM
    • I2C
    • UARTs

Android Lollipop on iMX6 based SECOSBC-A62

Embien has ported Android Lollipop on iMX6 based industrial grade SECOSBC-A62 platform. Below video demonstrates the same.

About Embien: A leading technology service provider in Embedded domain, Embien offers highly specialized services for Android including BSP porting, HAL developments, Customization, Optimization etc. Our other service offering include embedded software services, hardware design services, Industrial protocol development, technical consultancy etc. We also offer corporate training on Android, Multimedia, GStreamer and other technologies. Kindly contact us for your embedded/Android development and/or training requirements.

Android is one of the mostly widely used operating systems in the world. It is a feature rich system that can be used in a wide range of application areas like CE devices, industrial HMI’s, display interface for medical devices etc. Generally the boot time of the Android – from power up to showing the first screen is a time consuming process. In this series of posts, we will discuss about some of the tools and techniques for a fast Android boot.

This post is split in three parts:

  1. Android boot process
  2. Android boot time analysis
  3. Android boot optimization techniques

Now in this post, we will explain about the android boot process and its internals.

Android Boot Process

Understanding of the boot process of the target platform is the starting point for the optimizing the boot time. Generally on any platform, following components are loaded and executed step by step

  • Boot loader
  • U-boot (optional)
  • Kernel
  • Android

The Android process has the following sequence

  • Init
  • Zygote
  • System Server
  • Service Manager
  • Other Daemons and processes
  • Applications

The following diagram depicts the boot process.
android-boot-process

Boot loader

Up on power up, the processor boots from a ROM area typically located internally. This code determines the boot media and loads the boot loader from the media. The boot loader can be used to initialize the DRAM and load another level of loader or directly the Linux kernel. IT is generally dependent on the processor architecture and implementation.

U-Boot

U-Boot is used as a first or second level boot loader. It reads the Linux and ramdisk images from boot media and validates them. While it may not be mandatory to use u-boot, it offers some flexibility like passing arguments to the kernel (easily used to enter the recovery mode), fast boot modes, as a backup option to reprogram the OS etc.

Kernel

Linux kernel is the heart of the Android responsible for the process creation, inter process communication, device drivers, file system management etc. Android applies a custom patch on the main stream kernel to support certain features like Wake locks etc needed for operation of the Android.

The kernel can be either loaded as uncompressed image or as a compressed image. Up on loading, it mounts the root file system (typically passed as kernel command line arguments) and starts the first application in user space.

Android

Android typically operates wholly on the user space. The android applications are executed over a Virtual Machine called the Dalvik. The following section explains the internals in detail.

init and init.rc

The first user space application executed on booting the kernel is the init executable located in the root folder. The process parses a start up script called the “init.rc” script. This is written in a language designed for android used to start all the necessary processes, daemons and services for a proper operation of android. It offers various types of execution timings such as early-init, on-boot, on-post-fs etc. A detailed explanation of the scripting model is available on Android documentation site.

Demons and Services

The init process creates various daemons and processes like rild, vold, mediaserver, adb, etc each responsible for its own functionality. Descriptions of these processes are not in the scope of this post. Rather we will discuss more about “Zygote” process.

Service Manager

The service manager process manages all the services running in the system. Every service created registers itself with this process and this information is used for future references by other processes/applications.

Zygote

Zygote is one of the first init process created on boot. The term “zygote” is based the biological “initial cell formed that divides to produce offsprings”. Similarly “zygote in android” initializes the Dalivik VM and forks to create multiple instances to support each android process. It facilitates using a shared code across the VM instances resulting in a low memory foot print and short load time, ideal for an embedded system.

Zygote apart from installing a listener on the server socket, also preloads classes and resources to be used later in the Android applications. Once done, the system server is started.

Android System services (SystemServer)

SystemServer process starts all services available in the Android. Some of them are described below.

Service

Description

Activity Manager Manages activities life cycle and new services
Package Manager Manages application package handling (install, uninstall, upgrade, permissions)
Window Manager Manages all the window manipulations (like input events, orientation).
AppWidget Service Handles Android widgets
Backup Manager Manages backup scheduling and transfer
Status Bar Shows software/hardware status. It works with other managers like Notification, Network Status, Battery Status
Power Manager Handles power management while Android’s different modes (lock mode, sleep mode, Adjust brightness)
NetworkManagement Service Deals with network related activities
Notification Manager Manage all notifications (Toasts)
Location Manager Manages location providers
Entropy Mixer Handles (load & save periodically) kernel randomness
Display Manager Manages display properties
Telephony Registry Provides telephony information
Scheduling Policy Manages the process scheduling
Account Manager Handles the users account credential of different online services
Content Manager Handles all the data’s on a device
Battery Service Manages battery level and charging states
Alarm Manager Used to schedule the user applications to be run at future.
Input Manager Handles input devices and key layouts
Device Policy Enforces security policies for the device
Clipboard Service Provides Clipboard based copy/past operations.
NetworkStats Service Monitors Network connection Status
NetworkPolicy Service Enforces network security policies.
Wi-Fi P2pService Handles WiFi peer to peer connection
Ethernet Service Manages Ethernet connectivity.
Wi-Fi Service Manage WiFi connectivity
Connectivity Service Monitors and handles network connection state changes
Network Service Discovery Service Used to find local network devices to share app data

Once all the services are started and are executing, the Android broadcasts a “ACTION_BOOT_COMPLETED” message implying end of the boot process.

Android Home Screen

The Android package Manager on start up, parses each package (“.apk” file) available in the “/system/app” and “/system/vendor/app” and validates its AndroidManifest.xml. The application that is configured as the “Home” in its manifest is launched there by showing the android UI. Typically the Launcher application is launched as it is the default home application.

Generally this whole process may take around 25 to 60 seconds depending up on various factors to be discussed in later posts. Now with the boot process understood, we will look in to the tools available for profiling the boot activity in the next post – Android Boot Time Analysis.