Progress Β· 0/7 phases
π§ π§ Phase 1 β Prerequisites & Environment Setup
4 min read Β· Notion
Phase 1 β Prerequisites & Environment Setup
Duration: 2β3 weeks | Level: Foundation
You cannot learn AOSP without a working build. Get the machine ready first, then learn the theory.
π Prerequisites You Must Have
Linux / Command Line
- Comfortable with
bash,grep,find,make,git - Understand file permissions, symlinks, environment variables
- Know how to read a
Makefile
C / C++ Basics
- Pointers, memory management, structs
- Compilation pipeline: preprocessor β compiler β linker
- Reading
.hheader files - AOSP Framework and HAL are heavily C/C++
Java / Kotlin (you already have this β )
- Android Framework APIs are Java/Kotlin
- Android System Services are written in Java
Git
git log,git diff,git cherry-pick,git rebase- AOSP uses
repotool (a wrapper around multiple git repos)
π₯οΈ Machine Requirements
| Requirement | Minimum | Recommended |
|---|---|---|
| OS | Ubuntu 20.04 LTS | Ubuntu 22.04 LTS |
| RAM | 16 GB | 32β64 GB |
| Disk | 250 GB free | 500 GB SSD |
| CPU | 8 cores | 16+ cores |
| Build time | ~3β5 hours | ~1β2 hours |
β οΈ macOS is officially unsupported for building recent AOSP versions. Use Linux or a Linux VM/WSL2.
βοΈ Environment Setup Steps
Step 1 β Install build dependencies
sudo apt-get update
sudo apt-get install -y git-core gnupg flex bison build-essential \
zip curl zlib1g-dev libc6-dev-i386 libncurses5 \
lib32ncurses5-dev x11proto-core-dev libx11-dev lib32z1-dev \
libgl1-mesa-dev libxml2-utils xsltproc unzip fontconfig \
python3 python-is-python3 openjdk-11-jdkStep 2 β Install repo tool
mkdir -p ~/.bin
curl https://storage.googleapis.com/git-repo-downloads/repo > ~/.bin/repo
chmod a+x ~/.bin/repo
export PATH="${HOME}/.bin:${PATH}"Step 3 β Initialize AOSP source
mkdir ~/aosp && cd ~/aosp
repo init -u https://android.googlesource.com/platform/manifest \
-b android-14.0.0_r1 # pick a stable branch
repo sync -c -j$(nproc) --force-sync --no-clone-bundle
# This downloads ~100 GB. Leave it overnight.Step 4 β Set up build environment
cd ~/aosp
source build/envsetup.sh
lunch aosp_x86_64-eng # for emulator
# or: lunch aosp_arm64-engStep 5 β Build AOSP
m -j$(nproc) # full build β takes 1β5 hours
# Incremental: m -j$(nproc) frameworkStep 6 β Run on emulator
emulator &π AOSP Source Tree β First Look
aosp/
βββ art/ # Android Runtime (ART) β Java bytecode execution
βββ bionic/ # Android's C library (replaces glibc)
βββ build/ # Build system (Soong + Make)
βββ device/ # Device-specific configs
βββ frameworks/ # Android Framework (Java APIs, System Services)
β βββ base/ # Core framework β AMS, WMS, PMS, etc.
β βββ native/ # Native framework (SurfaceFlinger, etc.)
βββ hardware/ # HAL interfaces and implementations
βββ kernel/ # Linux kernel
βββ packages/ # Built-in apps (Settings, SystemUI, etc.)
βββ system/ # Low-level system (init, vold, netd)
βββ vendor/ # OEM/vendor-specific code
βββ external/ # Third-party open-source libsπ οΈ Key Tools to Learn
| Tool | Purpose |
|---|---|
repo | Manage multi-git AOSP workspace |
lunch | Select build target (device + variant) |
m / mm / mmm | Build entire tree / current module / specific module |
adb | Connect to device/emulator, push/pull files |
fastboot | Flash system partitions |
logcat | View system logs |
Android Studio | Browse AOSP source with indexing |
OpenGrok | Web-based AOSP code search (cs.android.com) |
β Phase 1 Checklist
- Ubuntu machine or VM ready with 250 GB+ free
- All build dependencies installed
-
repotool installed - AOSP source synced (android-14 branch)
-
source build/envsetup.sh&&lunchworking - Full AOSP build completed (
m) - Emulator launches successfully
- Can
adb shellinto the emulator - Familiar with top-level directory structure
- Can use
cs.android.comto search source code - Read a simple
Android.bpbuild file - Made a trivial code change + incremental build