How to Build LineageOS 18.1 ROM on Windows 10 (WSL2)

Advertisement

If you plan to install lineage OS 18.1 on your Android device, why not build lineage OS 18.1 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 18.1 which is based on Android 10 (code-name Q). It’s a custom ROM that you need to flash/install through a custom recovery. This requires you to learn a couple of things. If you plan to install Lineage OS on your phone, you can visit the download section on the Lineage OS site. It’s very easy to download Lineage OS ROM and flash on an android smartphone.

You can manually build lineage OS for your Android device; this tutorial will help you set up the Ubuntu environment on Windows 10 and create lineage OS for your android. Since what you are doing is entirely manual it requires at least 256 GB of 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 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

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.

Install the app.

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

Build Lineage OS 18 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 are installed properly.

sudo apt update && sudo apt full-upgrade -y && sudo apt install -y build-essential ccache libncurses5 libssl-dev m4 unzip zip

At last, see the 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 git://github.com/LineageOS/android.git -b lineage-18.1

Having issues, try https instead of git command.

Step 4.

Sync the sources. đź‘Ť

Sync the source, or better use device-specific command

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 the 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 updated 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 in 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?

4 comments
  1. I”m a novice at this but I keep getting the following error after Step 3:

    File “/home/********/android/lineage/.repo/repo/main.py”, line 79
    file=sys.stderr)
    ^
    SyntaxError: invalid syntax

    Any suggestions? In the above I’ve replaced my name with *********

    THanks!

  2. Make it Branch Specific… you made me download the entire Lineage OS branch
    repo sync -j 4 down to -j 1 -c (-c means current branch only)
    Just doing repo sync download everything in that github including older version of Lineage OS Aka CyanogenMod

Leave a Reply

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