Build an Android ROM

Table of Contents

1 Objectives

  1. Encourage undertaking the task.
  2. Estimate the time-energy + understanding effort in the task
  3. Estimate the CPU time and disk space needed.

2 Some Numbers

  1. ./aosp-sloccount-2014.txt Source Lines of Code count. Actual counts by sloccount

    cpp:       14650741 (39.79%)
    ansic:      8752928 (23.77%)
    xml:        6158281 (16.73%)
    java:       4644458 (12.61%)
    python:      973862 (2.65%)
    asm:         735531 (2.00%)
    sh:          411197 (1.12%)
    perl:        166852 (0.45%)
    objc:        139542 (0.38%)
    cs:           50718 (0.14%)
    fortran:      26059 (0.07%)
    ruby:         24641 (0.07%)
    yacc:         20958 (0.06%)
    pascal:       19250 (0.05%)
    exp:          10594 (0.03%)
    lex:           7944 (0.02%)
    tcl:           6958 (0.02%)
    ml:            5254 (0.01%)
    awk:           3165 (0.01%)
    lisp:          2925 (0.01%)
    php:           2352 (0.01%)
    ada:           1681 (0.00%)
    sed:           1304 (0.00%)
    cobol:          701 (0.00%)
    csh:            368 (0.00%)
    haskell:        250 (0.00%)
  1. Disk: 40Gb free space needed
  2. RAM: 16 Gb RAM good to have
  3. Your time: A lot of patience
  4. There are some 450 (sub) projects within. E.g.,
    1. Linux Kernel: Wakelocks / Lowmem /
    2. Binder / Logger / Ram Console /…
    3. Libraries Bionic / OpenGL / WebKit …
    4. Native Daemons, HAL, JNI
    5. Init
    6. toolbox
    7. Dalvik / Android Runtime / Zygote System Services
    8. Power Manager / Package Manager / Windows Manager / android.*
    9. Stock Android Apps: Launcher3 / Camera2 / Calculator java.*

3 Build Experiences

  1. ./tools.html Miscellaneous System Build Tools
  2. Not built from within Android SDK

3.1 Our 2014 Nexus-4 (Mako) Experience

3.2 Reading Before Build-a-ROM

  1. AOSP Tour from "Embedded Android" Book
  2. http://elinux.org/Android_Build_System
  3. http://wiki.cyanogenmod.org/w/Doc:_the_cm_source Quick tour through the CM souce code tree.
  4. https://www.xda-developers.com/xda-university-building-your-own-android-rom/ Many tutorials. Does not assume that you have a CS backgroud – so some things are too elementary.
  5. Read about CCACHE of gcc
  6. https://en.wikipedia.org/wiki/LineageOS
  7. https://en.wikipedia.org/wiki/CyanogenMod
  8. https://www.lineageos.org/

3.3 Download the src and Do the Setup

  1. https://source.android.com/setup/develop
  2. "Git is an open source version-control system designed to handle very large projects that are distributed over multiple repositories. In the context of Android, we use Git for local operations such as local branching, commits, diffs, and edits. One of the challenges in setting up the Android project was figuring out how to best support the outside community–from the hobbiest community to large OEMs building mass-market consumer devices. We wanted components to be replaceable, and we wanted interesting components to be able to grow a life of their own outside of Android. We first chose a distributed revision control system, then further narrowed it down to Git."
  3. "Repo is a repository management tool that we built on top of Git. Repo unifies the many Git repositories when necessary, does the uploads to our revision control system, and automates parts of the Android development workflow. Repo is not meant to replace Git, only to make it easier to work with Git in the context of Android. The repo command is an executable Python script that you can put anywhere in your path. In working with the Android source files, you will use Repo for across-network operations. For example, with a single Repo command you can download files from multiple repositories into your local working directory."
  4. Gerrit is a web-based code review system for projects that use git. Gerrit encourages more centralized use of Git by allowing all authorized users to submit changes, which are automatically merged if they pass code review. In addition, Gerrit makes reviewing easier by displaying changes side by side in-browser and enabling inline comments.
  5. http://xda-university.com/as-a-developer/repo-tips-tricks
  6. % du -sh . About 35G

3.4 Build an AOSP ROM

  1. source buildenv.sh Sets up shell environment variables and procedures. (bash has procedures.)
  2. make distclean Cleans out so that a fresh build can be done
 make distclean
  1. https://software.intel.com/en-us/articles/building-an-android-aosp-module-with-the-intel-c-compiler-for-android Once the module is compiled and linked it can be integrated into the AOSP build process as prebuild library. It will be included into the Android system image.
  2. https://software.intel.com/en-us/android/tools
  3. https://software.intel.com/en-us/android/app-testing
  4. http://testdroid.com/news/free-android-app-game-and-web-testing-on-intel-devices 23 Apr 2015

3.5 Build LineageOS

  1. https://github.com/LineageOS/android Getting Started
  2. https://wiki.lineageos.org/devices/mako/build for Google Nexus 4 (code name mako)

4 References

  1. https://source.android.com/ AOSP source code site. Has Many tutorials.
  2. https://github.com/davisRoman/aosp-research 2016. NOt active now (2019), but still a good place to start learning the ROM building.
  3. https://www.mn.uio.no/ifi/english/research/news-and-events/events/conferences-and-seminars/iiios2014/presentations/eatonetal.pdf The Consequences of Generativity The Case of Android Fragmentation;; Several interesting slides, e.g. SLOC slide on iOS to Windows, etc.
  4. https://slideblast.com/las16-205-the-state-of-aosp-common-a-ndroid-44-kernel_593875b21723dd31608cd190.html LAS16-205: The State of AOSP Common a ndroid-4.4 Kernel. {p: Look at the Recommended Documents}
  5. https://wiki.lineageos.org/ Working with proprietary blobs; https://wiki.lineageos.org/build_guides.html
  6. http://www.android-x86.org/ Porting Android to x86. ReleaseNote 8.1-r1. The 8.1-r1 release is based on the latest Android 8.1.0 Oreo MR1 release (8.1.0r60) Mar 2019

5 End

Copyright © 2017 www.wright.edu/~pmateti • 2017-09-27