How to Build LineageOS 16 ROM on Windows 10 (WSL)

If you plan to install lineage OS 16 on your Android device, why not build lineage OS 16 on Windows 10 computer with help of Windows Subsystem Linux. Excited? This guide will help you do the exact without any hassle.

The latest version of Lineage OS is 16 which is based on Android 9 (code-name Pie). It’s a custom ROM which you need to flash/install through a custom recovery. This requires you to learn couple of things. If you plan to install Lineage OS 16 on your phone, you can visit the download section in Lineage OS site. It’s very easy to download Lineage OS 16 ROM and flash on a android smartphone. But for most of the phone, Lineage OS doesn’t provide the latest version which is 16 at the time.

You can manually build lineage OS 16 for your Android device; this tutorial will help you setting up Ubuntu environment on Windows 10 and creating lineage OS 16 for your android. 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.

The 5 Best Lineage OS Alternatives
Lineage OS Download Links and Supported Device List
How to Install Lineage OS 16 on Your Android + Download Links

Requirements for building LineageOS 16 on Windows 10.

  • Windows 10 (64-bit) on a drive with 256GB SSD storage is recommended.
  • 16GB RAM or more.
  • Supported device.

Warnings to read before you go ahead.

  • 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

Learn to setup Linux within Windows 10.

  1. Open Windows store.

    Search for the Ubuntu 18.04 app.
    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.

  2. Install the app.

    Open the app and follow the first-time setup steps.
    Update packages and install the following.

Build Lineage OS 16 ROM for any android.

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). 👍

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.

repo init -u https://github.com/LineageOS/android.git -b lineage-16.0

Step 4. Sync the sources. 👍

Sync the source.

repo sync

(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, learn your device codename by a simple search on Google. When you’re building Lineage OS ROM for your mobile, it is essential to know device codename because 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:

Run the repo sync command again to make everything saved.

repo sync

Step 9. Start the build:

This command will start compiling Lineage OS 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.

brunch "your-device-codename"

Type cd $OUT and you’ll find all the files created during the process. Look for these two files.

1. recovery.img, which is the LineageOS recovery image.
2. lineage-16.1-2018xx.xx-UNOFFICIAL-dumpling.zip

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.

  1. Code: repo sync
  2. Run Code: source build/envsetup.sh
  3. brunch your device codename

Steps #8 then #5 then #9.

Brunching it.

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.

Windows 10 latest build ISO Download
How to use OneDrive on Windows 10 to Sync and Share Files
What Windows Do I Have? 5 Ways To Know Your Windows Version And OS Build?

Leave a Reply

Your email address will not be published. Required fields are marked *