Building LineageOS 20.0 from source requires some familiarity with Linux and the command line. Follow these steps to get started:
sudo apt-get install bc bison build-essential ccache curl flex g++-multilib gcc-multilib git gnupg gperf imagemagick lib32ncurses5-dev lib32readline-dev lib32z1-dev liblz4-tool libncurses5 libncurses5-dev libsdl1.2-dev libssl-dev libxml2 libxml2-utils lzop pngcrush rsync schedtool squashfs-tools xsltproc zip zlib1g-dev
mkdir -p ~/bin
echo 'PATH=~/bin:$PATH' >> ~/.bashrc
source ~/.bashrc
curl https://storage.googleapis.com/git-repo-downloads/repo > ~/bin/repo
chmod a+x ~/bin/repo
mkdir -p ~/android/lineage
cd ~/android/lineage
repo init -u git://github.com/mt8163/android.git -b lineage-20.0
git clone https://github.com/mt8163/local_manifests -b lineage-20.0 .repo/local_manifests
repo sync
Make sure you have adb
and fastboot
installed and in your PATH. If not, follow the instructions here: ADB and Fastboot installation guide
source build/envsetup.sh
brunch lineage_karnak-userdebug
To speed up future builds, you can enable ccache support. Run the following command before each build:
export USE_CCACHE=1
To persistently enable ccache and set the maximum disk space it can use, add the following lines to your ~/.bashrc
file:
export USE_CCACHE=1
ccache -M 50G # Set cache size to 50GB (adjust as needed)
Using ccache can significantly reduce build times, so consider allocating enough disk space for caching.
- Note: The above instructions are meant for LineageOS 20.0. Make sure to use the appropriate branch and repository URLs for other versions.