introduction to android rom cooking, part of my andevcon workshop (andevcon sf 2013)

22
X86 Android Bringup - A ROM Cooking Tutorial Ron Munitz November, 2013 © all rights reserved - Ron Munitz 2013 Permission to use and distribute slides is granted by specifying this copyright note, and accrediting the original author.

Upload: ron-munitz

Post on 16-Aug-2015

50 views

Category:

Technology


3 download

TRANSCRIPT

Page 1: Introduction to Android ROM cooking, part of my AnDevCon workshop (AnDevCon SF 2013)

X86 Android Bringup - A ROM Cooking TutorialRon MunitzNovember, 2013

© all rights reserved - Ron Munitz 2013Permission to use and distribute slides is granted by specifying this copyright note, and accrediting the original author.

Page 2: Introduction to Android ROM cooking, part of my AnDevCon workshop (AnDevCon SF 2013)

Part I - IntroductionRon Munitz2013

Page 3: Introduction to Android ROM cooking, part of my AnDevCon workshop (AnDevCon SF 2013)

Agenda● History● The Android Open Source Project● Introduction to working with the AOSP● Building your first ROM - the Android Emulator

Page 4: Introduction to Android ROM cooking, part of my AnDevCon workshop (AnDevCon SF 2013)

● 2002 - SideKick by Danger Inc. - The first “Internet Phone”.○ Technical session at Stanford by Andy Rubin, CEO of Danger Inc.○ Google’s Brin&Page attend, and soon become Sidekick users.○ Sidekick fails to acheive commercial success

● 2003 - Andy Rubin forms “Android”, targeted at operating mobile phones and cameras

● 2005 - Google Acquires “Android”.

● 2007 - The Open Handset Alliance is formed○ November 5th - The OHA Announces Android, an open source

mobile phone platform based on the linux kernel○ November 12th - Google Announces the Android SDK, along with a

$10 million Android developer challenge

Android History (2002-2007)

Page 5: Introduction to Android ROM cooking, part of my AnDevCon workshop (AnDevCon SF 2013)

● 2008 - T-mobile and Google announce the first Android phone - the G1○ AKA. The HTC “Dream”○ Approved by the FCC on August 18th 2008○ First available - October 22nd

● 2009 - Motorola Droid is announced, running Android 2.0○ Considered by many as the opening note for the smartphone wars.○ Added at least two exclusive features:

■ Hardware keyboard ■ Replaceable battery

Android History (2008-2009)

Page 6: Introduction to Android ROM cooking, part of my AnDevCon workshop (AnDevCon SF 2013)

● 2010 was an exciting year for Android:○ Google Announces its first flagship device - the Nexus One

■ Which is one of the best phones I have ever had.○ Samsung sets a giant’s foot on the battlefield

■ Galaxy S and its variants hit the market○ HTC’s EVO4G hits the market

■ Was widely considered as the best iPhone alternative at that time○ Android’s market share first passes the iPhone’s market share○ Google announces the Gingerbread (2.3) Android version, debuting

on the Nexus S.■ Introducing the most popular Android version until the end of 2013■ Introducing NFC and SIP

Android History (2010)

Page 7: Introduction to Android ROM cooking, part of my AnDevCon workshop (AnDevCon SF 2013)

Android History (2011-2013)

● 2011 - Honeycomb (3.0), google’s first aim at the tablet market is out○ Android’s market share first passes the Blackberry’s market share○ November 2011 - Ice Scream Sandwich is out, debutting on the

Galaxy Nexus

● 2012 - JellyBean is released○ Introducing significant enhancement in user experience (Project

butter)○ Introducing multi user for tablets ○ Samsung confidently ranks as the top Android phone maker on earth

● 2013 - More devices, more market share, ○ Android 4.3 is out: Enhanced WiFi-Display, Open GL ES 3.0,...○ Android 4.4 (KitKat) is out: First time a commercial brand pays for an

Android version branding, and more...

Page 8: Introduction to Android ROM cooking, part of my AnDevCon workshop (AnDevCon SF 2013)

Android History (Future)● Foreseeable future:

○ More devices○ More power○ More features○ More apps○ More developers○ More competition○ More embedded Android engineers required.

● Will Android be crowned as the new Embedded Linux?

Page 9: Introduction to Android ROM cooking, part of my AnDevCon workshop (AnDevCon SF 2013)

Platform Versions

● Data collected during a 14-day period ending on August 1, 2013.● Any versions with less than 0.1% distribution are not shown

Page 10: Introduction to Android ROM cooking, part of my AnDevCon workshop (AnDevCon SF 2013)

Screen Sizes and Densities

Page 11: Introduction to Android ROM cooking, part of my AnDevCon workshop (AnDevCon SF 2013)

Android Platform Overview

Page 12: Introduction to Android ROM cooking, part of my AnDevCon workshop (AnDevCon SF 2013)

Android Open Source Project ● “Semi-Open source”

○ Why “Semi” ? In next slide!● Maintained by Google● Contributions accepted using “gerrit”● Mostly Apache licensed● Provides templates for building an Android system, including

bootloaders etc.● Vendors derive their products for their hardware layout (BSP,

binaries, etc.)● Provides the complete source code (but usually missing proprietary

binaries) for a bunch of supported devices (e.g. Galaxy Nexus, Nexus 4/7/10, Android Emulator)

Page 13: Introduction to Android ROM cooking, part of my AnDevCon workshop (AnDevCon SF 2013)

Android and Open Source● Source code (For most components) is publicly available● Contributions are accepted

○ Sometimes. Usually takes time, really depends on the contribution.

● “Latest and greatest” development is done behind close doors

● No participation in project direction

Page 14: Introduction to Android ROM cooking, part of my AnDevCon workshop (AnDevCon SF 2013)

Android and Open Source

“Open source is different than a community-driven project. Android is light on community-driven, somewhat heavy on open source.” - Andy Rubin

Page 15: Introduction to Android ROM cooking, part of my AnDevCon workshop (AnDevCon SF 2013)

Android and Open Source● So far, history has proven that Google publishes major code

releases about every six months - close the announcement of a new device running that new code release

● Latest and greatest open source work (that is what is not done exclusively behind google’s close doors) can be viewed, reviewed and contributed to:○ http://android-review.googlesource.com/ - Gerrit.

■ View current patches○ http://android.googlesource.com - Gitweb.

■ View state of published source○ https://code.google.com/p/android/issues - View or submit bug, issue,

feature request

● (If at all,) Bug fixes usually make their ways to the master branch. ○ See http://source.android.com/source/submit-patches.html

Page 16: Introduction to Android ROM cooking, part of my AnDevCon workshop (AnDevCon SF 2013)

Building the AOSP● Minimum Requirements

○ 64-bit Linux or Mac system (HW or VM). at least 16GB of RAM/swap○ 30GB of free disk space to complete a single build and up to 100GB or

more for a full set of builds. The source download is over 10GB in size.

○ Python 2.6 -- 2.7, which you can download from python.org.○ GNU Make 3.81 -- 3.82, which you can download from gnu.org,○ JDK 6 -- 7 which you can download from oracle.com○ Git 1.7 or newer. You can find it at git-scm.com.

● Your building life will be easy with○ Lots of cores○ Lots of memory○ SSD

Page 17: Introduction to Android ROM cooking, part of my AnDevCon workshop (AnDevCon SF 2013)

Building the AOSP - Checklist✓ Setup your workstation (Hardware, VM)✓ Configure all the necessary packages

○ @see http://source.android.com ✓ Configure path for “repo” tool✓ Configure ccache✓ Double check RAM and free disk space requirements.

Page 18: Introduction to Android ROM cooking, part of my AnDevCon workshop (AnDevCon SF 2013)

Obtaining the source code● The AOSP uses repo, a multi git project wrapper written in Python for

source code management. ● Before building the AOSP, or any other Android build system, one must

first decide the branch or tag they would like to work on. ○ That would be the same branch/tag for a given, public Android release

● Then, to initialize the repository configuration at their hosts one should create a directory, change the working directory to it, and:○ repo init -u https://android.googlesource.com/platform/manifest

■ For working on the master branch

○ repo init -u https://android.googlesource.com/platform/manifest -b <branch>

■ For working on the <branch> branch

● Once repo has been initialized with parameters such as your name and email address, you can synchronize the code to the latest remote state:○ repo sync -j${NumJobs}

■ The -j parameter is the number of simultaneous jobs

. build/envsetup.sh including device/asus/grouper/vendorsetup.shincluding device/asus/tilapia/vendorsetup.shincluding device/generic/armv7-a-neon/vendorsetup.shincluding device/generic/armv7-a/vendorsetup.shincluding device/generic/mips/vendorsetup.shincluding device/generic/x86/vendorsetup.shincluding device/lge/mako/vendorsetup.shincluding device/samsung/maguro/vendorsetup.shincluding device/samsung/manta/vendorsetup.shincluding device/samsung_slsi/arndale/vendorsetup.shincluding device/samsung/toroplus/vendorsetup.shincluding device/samsung/toro/vendorsetup.shincluding device/ti/panda/vendorsetup.shincluding sdk/bash_completion/adb.bash

Page 19: Introduction to Android ROM cooking, part of my AnDevCon workshop (AnDevCon SF 2013)

Building the source code● Let us deal with a device supported in the AOSP (i.e. *Nexus*, or emulator)● Once the source is ready, you first need to configure the build

environment:○ . build/envsetup.sh

■ This will setup the base Android build system environment● Then, you choose your specific device configuration:

○ lunch <devicename>-<variant>■ <devicename> is the code name for the device (e.g. maguro, grouper,

full_x86) , responsible of setting the device specific configuration, BSP, partition layout, etc.

■ <variant> Can be one of the following:● user - production build● userdebug - production with debug features● eng - engineering builds● tests - google internal● Note: The list can be modified, and it has been (RIP “debug”)

● Once the build target has been selected - you are good to build:○ make -j${NumJobs}

■ The -j parameter is the number of simultaneous jobs

Page 20: Introduction to Android ROM cooking, part of my AnDevCon workshop (AnDevCon SF 2013)

Example● Task: Build and run an Android emulator with the following properties:

○ Based on the android-4.3_r2.1 tag ○ For X86 architecture○ -eng build variant

● Solution:○ mkdir -p ~/edu/AOSP○ cd ~/edu/AOSP○ repo init -u https://android.googlesource.com/platform/manifest -b android-4.3_r2.1

○ repo sync -j4 # This will take a while...○ . build/envsetup.sh○ lunch aosp_x86-eng○ make -j16 # This will take a while○ emulator & #

Page 21: Introduction to Android ROM cooking, part of my AnDevCon workshop (AnDevCon SF 2013)

1 picture == 1000 words

This is an image based on one of the earliest JB versions. Not much, if any has changed since the very early days of “Cupcake” and “Donut”.

Page 22: Introduction to Android ROM cooking, part of my AnDevCon workshop (AnDevCon SF 2013)

References1. http://www.businessinsider.com/history-of-android-2013-8?op=1 2. http://source.android.com3. http://developer.android.com4. Introduction to ROM cooking - Ron Munitz5. “Bringing up Android on your favorite X86 Workstation or VM” - Ron

Munitz, AnDevCon Boston, 20136. “Android IA bringup - words of a veteran” - Ron Munitz, Android Builders

Summit, 20137. http://git-scm.com/