How to build LineageOS on Windows 10 using Windows Subsystem for Linux

Android is currently leading the mobile OS market share at around 88%. The majority of the rest of the share is owned by Apple’s iOS. Android being an open source operating system, allows developers to tweak the OS and build a new custom operating system. People call them Custom ROMsThese custom ROMs are famous in communities around the globe. With the availability of Custom ROMs, users can now get the latest and greats of Android that Google has to offer even sometimes before the OEMs push out an update for a particular device. This also helps to revive an unsupported device to run the Custom version of Android that the OEM never pushed or developed. One such popular Custom ROM is LineageOS.

LineageOS

LineageOS was formerly called as CynogenMod OS. Version 16 of LineageOS is the latest release and is based on Android 9 Pie from Google. Many devices are currently supported by it. The main reason that people tend to install LineageOS is because it provides a Stock Android experience without any custom skin. This is liked and admired by a lot of people. This is the reason many Power users on Samsung or Xiaomi devices go-ahead to install LineagoOS just to get rid of the custom skin like Samsung Experience and MIUI respectively. I can confirm that because I have a custom operating system on my Xiaomi phone.

Anyway, let dig into the main thing here.

Build LineageOS 16.0 on Windows 10 using Windows Subsystem for Linux

First of all, we will check out the system requirements for this task.

System Requirements

You should at least have 16 Gigabytes of RAM on your computer. It should be running Windows 10 (64-bit only). And for storage, it is recommended for you to have 256 Gigabytes or more space free where having an SSD is preferred.

Some things to take care of

As mentioned by the original developer, here are the main things that you need to keep in mind while carrying out this task.

  • 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
  • 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

Building LineageOS 16

The following steps should be taken one by one to get this task working.

  1. Installing and setting up Ubuntu under Windows Subsystem for Linux.
  2. Getting the required files for the BASH shell.
  3. Creating a directory to store all the files from the Github repository.
  4. Initializing the LineageOS repository.
  5. Syncing the resources.
  6. Running the script.
  7. Preparing device specific code.
  8. Adding the project manifest.
  9. Syncing the resources again.
  10. Start the build for the created files.

First of all, start by downloading WSL & Ubuntu 18.04 LTS from the Microsoft Store and setting it up.

Now, let us get the latest required files for our BASH shell.

For that, enter the following command in the shell,

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

It will take some time to download the required files. So until then, you can just sit back and relax.

You should now create a custom directory to store all the downloaded files from the LineageOS Github repository.

For that, enter this command,

mkdir -p ~/android/lineage && cd android/lineage

Let us start working with the Github repository for LineageOS.

For that, enter this command,

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

Finally, sync the repository.

repo sync

build LineageOS on Windows 10 using Windows Subsystem for Linux

There is an optional yet recommended step that you can take to speed up the process. You can read more about it here.

Then you need to run the script file to prepare to build the project.

For that, enter this command,

source build/envsetup.sh

Then prepare the code for a specific device. To do that, you need to know the codename of that device. You can search the internet by entering <YOUR DEVICE MARKETING NAME> Codename on any search engines.

The command for preparing the device-specific code is,

breakfast your device codename

Now, you need to add a line to the manifest file. You can look for it and if it does not exists, create a manifest file named roomservice.xml inside this path: .repo/local_manifests/.

The line that you need to add is,

<project name="TheMuppets/proprietary_vendor_your device brand" path="vendor/your device brand" remote="github" />

Sync with the repository again. Use this command,

repo sync

We are now done with the tedious part, Just starting the build is left.

To start the build, enter the following code,

brunch your device codename

In case you wish to build a newer build of LineageOS, you need to just sync the repository, run the script and then directly start the build.
It will save you a lot of time and Internet Data.

You can read more about this task and building LineageOS 15.1 based on Google’s Android Oreo 8.1 here on XDA Developers.

Download this VPN to secure all your Windows devices and browse anonymously
Posted by on , in Category General with Tags
Ayush has been a Windows enthusiast since the day he got his first PC with Windows 98SE. He is an active Windows Insider since Day 1 and is now a Windows Insider MVP. He has been testing pre-release services on his Windows 10 PC, Lumia, and Android devices.

Leave a Reply

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


5 + 2 =