Build AOSP — Android source code
Wondering how to build Android images by your own!!
You need high speed internet and also System with Ubuntu 14.04, at least 4GB RAM, JDK(version 7), at least 250 GB free space on HD, Python, Git.
Don’t go by message 3 min read, it will take HOURS…
Steps shown here, are performed on Ubuntu (14.04).
Get bhavana vadodariya’s stories in your inbox
Join Medium for free to get updates from this writer.
First thing we need to install repo and Git tool.
Create one empty folder and start downloading source code into it. We are targeting Android Mashmellow.
Have patience, it will take time. After successfully downloading source code, you should get similar message:
As real device has different h/w like NFC, Camera, Sensors and so on… So we need driver for our device. This driver is not part of AOSP. To download driver first we need build number. As per your device model and AOSP version you have downloaded, get your build number from this site:
For Nexus 5, I have taken latest build, which is Marshmallow(android-6.0.1_r77). So our build number is M4B30Z. You can take old one also, like for Kitkat-Android 4 version build number is KOT49H/E etc...
Now go to driver page and get your driver as per your build number.
Now, create one more empty folder (not inside your AOSP source code). Run following command:
Run above extracted .sh files from AOSP base directory:
For Marshmallow-Android 6, we need java 7. See Supporting Older Versions for precise versions and instructions.
Build AOSP source code.
Take a break…. It will take time, in hours. Depends on your system configuration and internet speed. At the end you will get images under nexus5/out/target/hammerhead folder
Troubleshoot: You might need to install compile dependent software. Eg…
$ sudo apt-get install gperf
Next time we will see how to flash these images on Android device.


![Android — Change fastboot and bootloader screen’s images [AOSP]](https://miro.medium.com/v2/resize:fit:1358/format:webp/1*ap4ItcIL_9df8bQZ-dyYTA.jpeg)






