Building Android OS Topics: Building Android and Kernel

Slides:



Advertisements
Similar presentations
Android Application Development A Tutorial Driven Course.
Advertisements

Prashant Somashekar. What will we discuss? -Brief overview of a kernel -How a kernel fits into the hierarchy -Android versus Linux kernel -Building an.
Android Platform Overview (1)
1 DOS with Windows 3.1 and 3.11 Operating Environments n Designed to allow applications to have a graphical interface DOS runs in the background as the.
Operating Systems Concepts 1. A Computer Model An operating system has to deal with the fact that a computer is made up of a CPU, random access memory.
Asst.Prof.Dr.Ahmet Ünveren SPRING Computer Engineering Department Asst.Prof.Dr.Ahmet Ünveren SPRING Computer Engineering Department.
UFCFX5-15-3Mobile Device Development Android Development Environments and Windows.
Systems Software Operating Systems.
Introduction to Android Platform Overview
Chapter 3 Operating Systems Concepts 1. A Computer Model An operating system has to deal with the fact that a computer is made up of a CPU, random access.
Chapter 3.1:Operating Systems Concepts 1. A Computer Model An operating system has to deal with the fact that a computer is made up of a CPU, random access.
Computer Organization
Basic Input Output System
Flash Cards Computer Technology.
Tutorial 11 Installing, Updating, and Configuring Software
Hands-On Virtual Computing
Chapter 2 – Software Part A. Definition Computer is made up of two components Hardware Physical components Software Instructions for the computer Two.
University of Management & Technology 1 Operating Systems & Utility Programs.
Booting. Booting is the process of powering it on and starting the operating system. power on your machine, and in a few minutes your computer will be.
ANDROID Presented By Mastan Vali.SK. © artesis 2008 | 2 1. Introduction 2. Platform 3. Software development 4. Advantages Main topics.
Linux and Real Time Real-time systems are characterized by deadlines. When a missed deadline results in inconvenience or a diminished customer experience,
Introduction to Interactive Media Interactive Media Tools: Software.
Linux in a Virtual Environment Nagarajan Prabakar School of Computing and Information Sciences Florida International University.
Android architecture & setting up. Android operating system comprises of different software components arranges in stack. Different components of android.
Unit - VI. Linux and Real Time: Real Time Tasks Hard and Soft Real Time Tasks Linux Scheduling Latency Kernel Preemption Challenges in Kernel Preemption.
ANDROID BY:-AANCHAL MEHTA MNW-880-2K11. Introduction to Android Open software platform for mobile development A complete stack – OS, Middleware, Applications.
Android. Basic Architecture Linux Kernel Libraries Applications Android Runtime Application Framework.
Building Your Own Android Systems from Source Adam C. Champion CSE 5236: Mobile App Development 1.
CSC190 Introduction to Computing Operating Systems and Utility Programs.
Embedded Software Design Week II Linux Intro Linux Kernel.
OPERATING SYSTEMS DO YOU REQUIRE AN OPERATING SYSTEM IN YOUR SYSTEM?
Linux Introduction Linux was developed in the early 1990’s by Linus Torvald computer science student at the University of Helsinki Linux is distributed.
Android Build System and Overview Karthik Dantu and Steve Ko.
Introduction to Operating Systems Concepts
Computer System Structures
Mobile Device Development
Andrea Chierici Virtualization tutorial Catania 1-3 dicember 2010
Computer System Laboratory
bitcurator-access-webtools Quick Start Guide
Android Mobile Application Development
Outline Installing Gem5 SPEC2006 for Gem5 Configuring Gem5.
Implementation of Embedded OS
Bare metal OS project CSSE 332 Operating Systems
Operating System & Application Software
Chapter Objectives In this chapter, you will learn:
Operating System Review
Computer System Laboratory
Topics Introduction Hardware and Software How Computers Store Data
UBUNTU INSTALLATION
Architecture of Android
Chapter 2: Operating-System Structures
Desktop Virtualization
chapter 6- Android Introduction
Chapter 2: System Structures
CMPE419 Mobile Application Development
IB Computer Science Topic 2.1.1
CIT 480: Securing Computer Systems
Chapter 3: Windows7 Part 1.
Operating System Review
Application Development A Tutorial Driven Course
Topics Introduction Hardware and Software How Computers Store Data
Outline Chapter 2 (cont) OS Design OS structure
bitcurator-access-webtools Quick Start Guide
Korea Software HRD Center
The Main Features of Operating Systems
Android Platform, Android App Basic Components
The bios.
CMPE419 Mobile Application Development
Operating System By Prakash G Asnani
Building Your Own Android Systems from Source
Presentation transcript:

Building Android OS Topics: Building Android and Kernel Date: 11/7/2017

References (study these) https://source.android.com/source/index.html https://source.android.com/source/requirements.html https://source.android.com/source/building-kernels.html#building https://source.android.com/devices/index.html

Android OS Architecture

Android Binary Component 1. Application Processor Images Bootloader Image Kernel Image Platform Image 2. Communication Processor Image

Android OS Image Component Bootloader Image Initialize system and launch Linux kernel Kernel Image Include Linux Kernel (bzImage) Basic Linux OS system and device drivers “kernel” or other names Platform Image Include Android Framework, Native Libraries, Android Runtime, HAL The core of Android OS except kernel image “system.img” Other Images CP(Communication Processor) Image, User Data, …

Android Boot Sequence 1. Kernel Booting - Initialization - Call init process 2. Init Process - Launch daemons - Start Zygote 3. Start Zygote and Dalvik - Virtual machine - Initial process 4. System Server - Start Java Service

Android Boot Sequence 1. Power On and System Startup Starts when we press the power button. The Boot ROM code starts executing from a pre-defined location which is hardwired in ROM. It loads the Bootloader into RAM and starts executing.

Android Boot Sequence 2. Bootloader The bootloader is a small program which runs before Android does. Bootloader is NOT part of the Android operating system. The bootloader executes in two stages. In the first stage it detects external RAM and loads a program which helps in the second stage. In the second stage, the bootloader setups the network, memory, etc, which requires to run kernel.

Android Boot Sequence 3. Kernel The Android kernel starts in a similar way as the Linux kernel.  Setup cache, protected memory, scheduling and loads drivers. binder, ashmem, logger, wakelocks, oom, … When the kernel finishes the system setup, it looks for “init” in the system files.

Android Boot Sequence 4. init process Init is the very first process It is a root process, or the grandfather of all processes. The init process has two responsibilities.        1- Mounts directories like /sys , /dev    or /proc      2- Runs init.rc script At  this stage, you can finally see the Android logo in your screen.

Android Boot Sequence 5. Zygote and Dalvik Start Davlik Virtual Machine - an interpreter for the Java programming language. It’s written for CPU utilization and to minimize memory usage Starts a process called “Zygote”. The Zygote enables code sharing across the Dalvik VM, achieving a lower memory footprint and minimal startup time. The Zygote preloads and initializes core library classes. At this time, you can see the boot animation.

Android Boot Sequence 6. System Services After the above steps are completed,  Zygote launches the system services.  The Zygote forks a new process to launch the system services. Core services: Starting power manager Creating the Activity Manager Starting context manager Starting system contact providers Starting battery service Starting alarm manager Starting sensor service …

Android Source Tree art - Android RunTime bionic - libc library, math library, (dynamic) linker dalvik – Dalvik virtual machine device – configurations for various smartphone models external - not Android original code(sqlite, openCV) docs - documentation frameworks The heart of Android source code Built-in application, Java framework, C++ Native code, Android service hardware – hardware vendor specific code(Intel, ARM…) kernel – kernel source tree out – build output files are located prebuilt – toolchain(gcc), other pre-built image or program

Android Platform Build

Android OS Build Basic hardware requirements: 64bit machine for Gingerbread or higher version 100GB hard disk for source code 200GB hard disk for build Multi-core server is strongly recommended!! Basic software requirements: Linux (Ubuntu 12.04) for Gingerbread or higher version Java Development Kit (1.8 or higher version) Python 2.6 GNU Make and GCC https://source.android.com/source/initializing

Android Platform Build 1. Download Repo $ mkdir ~/bin $ PATH=~/bin:$PATH $ curl https://storage.googleapis.com/git-repo- downloads/repo > ~/bin/repo $ chmod a+x ~/bin/repo

Android Platform Build 2. Repo init $ repo init -u https://android.googlesource.com/platform/manifest

Android Platform Build 3. Repo sync (downloading source files) $ repo sync

Android Platform Build 4. Build setting $ source build/envsetup.sh $ lunch

Android Platform Build 5. Make We build platform image for emulator Select building setting (1) in the lunch menu $ make

Android Platform Build 6. Output files After a few hours later, build finishes “android/out/target/product/mini-emulator-x86_64/” “ramdisk.img”, “system.img”, “userdata.img”

Android Kernel Build

Android Kernel Build 1. Download source files $ git clone https://android.googlesource.com/kernel/goldfish.git Reference for Android Kernel list https://source.android.com/source/building-kernels

Android Kernel Build 1. Download source files No files downloaded, we need to checkout branch $ cd goldfish $ git branch -a

Android Kernel Build 1. Download source files $ git checkout -t origin/android-goldfish-3.10 -b goldfish $ ls

Android Kernel Build 2. Build kernel for Emulator We build kernel image for Android emulator $ /home/seulki/android/prebuilts/qemu-kernel/build- kernel.sh --arch=x86

Android Kernel Build 3. Output kernel image “goldfish/arch/x86/boot/bzImage”

Loading kernel to Emulator 1. Copy “bzImage” to the Android emulator folder “C:\Users\Seulki\AppData\Local\Android\Sdk\system- images\android-23\google_apis\x86” 2. Change filename from “kernel-qemu” to “kernel-qemu2” 3. Change filename from “bzImage” to “kernel-qemu” 4. Launch Android Emulator

Flashing images into real device 1. Your custom images can be flashed to real devices “fastboot” tool in Android SDK 2. Entering to the download mode Turn off the phone. Press and hold the volume down and power buttons simultaneously, and keep holding them for about 10 seconds. 3. Flashing flash-all fastboot flash bootloader <bootloader image file name>.img fastboot flash boot <boot image file name>.img fastboot flash system <system file name>.img fastboot flash radio <radio image file name>.img DO NOT FLASH IMAGES IF YOU’RE NOT SURE!

Make-up Assignment Part 1 - Kernel Android uses many input devices such as touchscreen, touch key and hardware key. But for an emulator, it cannot use physical input devices mentioned above. Instead, a mouse pointer connected to your laptop is used as a touchscreen pointer for an emulator screen. Find the location of pointer device driver in Kernel source. Print a log message for pointer every time your laptop-mouse clicks on the emulator screen like the below picture (you need to load your modified kernel to the emulator).

Make-up Assignment Part 2 - Platform Sensor data from sensor devices in your phone travel though multiple Android software layers to arrive at a sensor application. It starts from a physical sensor device and travels though kernel device driver, sensor HAL(Hardware Abstraction Layer), sensor service, sensor framework(SensorManger) and finally arrives at an application. In this assignment, we are going to look at sensor HAL in detail. Where is the location of sensor HAL source files? What is the difference between sensor HAL code for real device and emulator? Add one sensor to the HAL that is not currently supported for emulator. You don’t need to add the new sensor to other layers(sensor service, sensor framework) and kernel. Build your own sensor HAL with the sensor you have newly added (make sure it does not make any compile errors).