If you plan to install lineage OS 16 on your Android device, and wanted to build lineage OS 16 for your device on your Windows 10 computer this guide will help you to the exact without any hassle.
Lineage OS’s latest version is 16 which is based on Android 9 (code-name Pie) since it’s a custom ROM that you need to flash using a custom recovery you need to learn a couple of things doing that. If you plan to install Lineage OS 16 on your phone, you can visit the download section in Lineage OS site. It is simple as downloading Lineage OS 16 ROM and flashing on your phone. But for most of the phone, Lineage OS doesn’t provide the latest version which is 16 at the time.
But you can manually build lineage OS 16 for your Android device; this tutorial will help you setting up Ubuntu environment on your Windows 10 and creating lineage OS 16 for your device. Since what you are doing is entirely manual it requires at least 256 GB free space on your Windows installation drive. Moreover, 16 GB RAM is needed for the process and storage should be solid state hard drive. And not to forget a high-speed internet connection because in the process you will be downloading lots of GB.
Build Lineage OS 16 ROM for any device.
- Windows 10 (64-bit) on a drive with 256GB SSD storage is recommended.
- 16GB RAM or more.
- Supported device.
- Do NOT add/edit your Linux files from Windows. The files will most likely be broken in bash.
Instead, add/edit the files from within the Linux subsystem.
- Make sure there is no power cut, the process takes hours.
- Using mnt to download the source code to other drives and then attempting to follow this guide will probably result in failures. Download the source to folders only within the subsystem
Setting up a Windows Subsystem for Linux (WSL) build environment
- Open the Microsoft Store.
- Search for the Ubuntu 18.04 app.
- Install the app
- Open the app and follow the first-time setup steps
- Update packages and install the following:
Do not mistake this with the GUI Ubuntu operating system, this is the LTS version just about ~200MB for all the terminal and commands work.
Step 1. Update and install the following.
Simply open the Ubuntu app after installing and copy paste the following code. This step is required and will need an active internet connection. If you see some errors, make sure to rerun the code until all the tools installed properly.
sudo apt update && sudo apt full-upgrade -y && sudo apt install -y 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 m4 openjdk-8-jdk pngcrush repo rsync schedtool squashfs-tools xsltproc zip zlib1g-dev
At last, see output message. After installing make a new directory and move there.
Step 2. Make a directory for the source code (and go to it). 👍
Code: mkdir -p ~/android/lineage && cd android/lineage
Here mkdir command creates a directory, and cd command will take you to a directory where you’ll be fetching source code.
Step 3. Initialize the LineageOS source repository.
The below code will fetch the source from the official Lineage OS GitHub repository.
Code: repo init -u https://github.com/LineageOS/android.git -b lineage-16.0
Step 4. Sync the sources. 👍
(Optional; Recommended) https://wiki.lineageos.org/devices/klte/build#turn-on-caching-to-speed-up-build
Step 5. Start setup.
It’s time to start the setup, connect your phone to PC while turning USB debugging/ADB on. Make sure to install fastboot and ADB drivers, run fastboot devices to check the connection.
Run the code: source build/envsetup.sh
If you see some vendor information error, follow these steps and type rerun breakfast.
Step 6. Prepare the device-specific code.
- breakfast your device codename
- example breakfast dumpling
Here dumpling is the codename of Oneplus 5T, to know your device codename search it on Google. When you’re making Lineage OS ROM for your mobile, it is essential to know device codename because the codename will fetch device specific files and kernel. Otherwise, you’ll end up wasting time and bandwidth.
Step 7. Add the info to roomservice.xml file.
Add the following to .repo/local_manifests/roomservice.xml (you can create the file if it doesn’t exist):
Code: <project name=”TheMuppets/proprietary_vendor_your device brand” path=”vendor/your device brand” remote=”github” />
Replace your device brand with device vendor. Visit https://github.com/TheMuppets and use the search bar to find your device vendor.
Example: <project name=”TheMuppets/proprietary_vendor_oneplus” path=”vendor/oneplus” remote=”github” />
Step 8. Sync the sources again:
Code: repo sync
Step 9. Start the build:
Code: brunch your device codename
This command will start compiling the ROM for your device, trust me it will take a lot of time. Simply set your PC not to go into sleep and do other work meanwhile.
Type cd $OUT and you’ll find all the files created during the process. These are the two files you should be interested in are the following.
- recovery.img, which is the LineageOS recovery image.
The ZIP file is the Lineage OS 16 ROM, flash it to your devices using a custom recovery like TWRP.
Instructions for future builds.
Now that you have Lineage OS 16 ROM, with time it gets updates and when it does you can compile new ROM applying these steps.
- Code: repo sync
- Run Code: source build/envsetup.sh
- brunch your device codename
Steps #8 then #5 then #9.
Now let’s assume that the process was completed without any error, this will result two important files, one important file if you’re already using a custom recovery. The lineage-16xx…zip file is all you need. Frankly, this is not a beginners guide, and there are some aspects that I’ve not mentioned assuming you know them.
Few Windows 10 articles.