To get started with building Android, please review common building comands Git and Repo.
Requirements:
- Windows 10 (64-bit) installed on a drive (256GB or bigger) (SSD recommended)
- 16GB RAM or more
- Modern CPU (i5, i7)
- Modern GPU (GTX 670+)
Setup up your Build Environment:
-
Install and Enable: Windows Subsystem Linux (WSL) and choose a distro app (Ubuntu recommended)
-
Once Ubuntu is installed, within the same Ubuntu Terminal, enter the following commands:
sudo apt update -y
sudo apt install git android-sdk-platform-tools bc build-essential ccache curl g++-multilib gcc-multilib git gnupg gperf imagemagick lib32ncurses5-dev lib32readline-dev lib32z1-dev liblz4-tool libncurses5-dev libsdl1.2-dev libssl-dev libwxgtk3.0-dev libxml2 libxml2-utils lzop pngcrush repo rsync schedtool squashfs-tools xsltproc zip zlib1g-de openjdk-8-jdk
- Next, go to 51-android.rules and copy this entire page and save it as 51-android.rules to your desktop.
In the terminal: Change the directory to the required folder with this command:
cd ~/etc/udev/rules.d
Then:
cp /mnt/c/Users/USERNAME/Desktop/51-android.rules ~/etc/udev/51-android.rules
- Setup and Initialize your local repository of this ROM.
Use the following command:
Note: Makes the directory: (Noted this must be done through command line, if created through explorer it will fail)
mkdir -p ~/android/AOSiP
Then: Change the directory to the ROM folder:
cd ~/android/AOSiP
Then: Point to where the source is located on Github:
repo init -u git://github.com/wavedashdoc/platform_manifest.git -b oreo-mr1-test
Then: To start syncing the source:
repo sync -f --force-sync --no-tags --no-clone-bundle
Then....
- Wait, this will take a LONG TIME depending on your internet connection. (You'll be downloading around 30+GB)
- While waiting for the source to finish syncing, add the following to the very bottom of your .bashrc file located:
C:\Users\"USERNAME"\AppData\Local\Packages\CanonicalGroupLimited.UbuntuonWindows_79rhkp1fndgsc\LocalState\rootfs\home\"LINUXUSER"\.bashrc
Note: for "USERNAME" = username for your computer
For "LINUXUSER" = the name you chose for your Linux Distro
# ccache
export USE_CCACHE=1
export CCACHE_DIR=~/.ccache
ccache -M 100G;
export BISON_EXEC=~/android/AOSiP/out/host/linux-x86/bin/bison
export IJAR_EXEC=~/android/AOSiP/out/host/linux-x86/bin/ijar
# Android tools
export PATH=${PATH}:~/Android/Sdk/tools
export PATH=${PATH}:~/Android/Sdk/platform-tools
export PATH=${PATH}:~/bin
export ANDROID_HOME=~/Android/Sdk
export LC_ALL=C
Prebuilding Bison and Ijar
Note: We need to build Bison and Ijar because WSL runs 64-bit binaries, not 32-bit. Building them from source first before the ROM will avoid the fatal build error "cannot execute binary file: Exec format error":
Building the ROM
- In the same Ubuntu terminal window:
make bison
Then:
make ijar
Then:
. build/envsetup.sh
lunch
aosip_shamu-userdebug
time mka kronic
- Profit Hopefully?!! Finished build will be located in android/AOSiP/out/target/product/shamu
Success!? So... what's next?
You've done it! Welcome to the elite club of self-builders. You've built your operating system from scratch, from the ground up. You are the master/mistress of your domain... and hopefully you've learned a bit on the way and had some fun too.
ROM building is based off of LineageOS Building with WSL.
And also XDA [GUIDE] How to build LineageOS 16.0 on Windows 10 (via WSL).
And thanks to Camcory for his help this past year.