How to build LineageOS on Windows 10 using WSL 2

0
15

The second generation of Windows Subsystem for Linux, commonly referred to as WSL 2, was announced during Microsoft’s Build 2019 developer conference. Compared to the legacy WSL implementation, WSL 2 performs substantially better on filesystem-heavy operations due to the major architectural rewrite. Windows 10’s latest stable channel build, i.e. Windows 10 May 2020 update, makes WSL 2 available to all users. With WSL 2, it’s rather easy for Windows users to compile AOSP or custom ROMs like LineageOS from scratch without installing a full-fledged GNU/Linux distribution.

This is not the first time we highlighted the possibility of building LineageOS on Windows using WSL, but the situation is a bit different now. The first stable build of Windows Terminal is here, and CLI lovers can now natively get features like GPU-accelerated text rendering, custom key bindings, tabbed shells with customized color schemes, and a whole lot of other useful goodies. Given that you can directly invoke WSL just like another tab in your terminal, users of Windows 10 can apply different configurations and shortcuts (just like a pre-configured Linux environment) while compiling LineageOS.

XDA Senior Member/LineageOS team member Uldiniad has updated his forum post with a guide on how to compile the latest version of LineageOS, LineageOS 17.1 based on Android 10, on a Windows 10 PC using WSL 2. Before attempting to perform a local build, make sure that you have A LOT of free storage space and an unlimited Internet plan. For example, it took about 340GB of storage space for Uldiniad to compile a clean LineageOS 17.1 build for the OnePlus 6 (code-name “enchilada”), taking account of the synced source code as well as the build output.

If your PC meets the hardware requirements for building Android from source, then follow these steps to set up a WSL 2 build environment in Windows 10 and compile LineageOS 17.1:

  1. Open Microsoft Store
  2. Search for and install the Ubuntu app
  3. Open the app and follow the first-time setup steps
  4. Update packages and install the following
    sudo apt update && sudo apt full-upgrade -y && sudo apt install -y build-essential ccache libncurses5 libssl-dev m4 unzip zip
  5. Make a directory for the source code (and go to it):
    mkdir -p ~/android/lineage && cd android/lineage
  6. Initialize the LineageOS source repository:
    repo init -u https://github.com/LineageOS/android.git -b lineage-17.1
  7. Sync the sources:
    repo sync
  8. Turn on caching to speed up build. This step is optional but recommended for subsequent builds.
  9. Run
    source build/envsetup.sh
  10. Prepare the device-specific code:
    breakfast your_device_codename
  11. Add the following to .repo/local_manifests/roomservice.xml:
  12. Sync the sources again:
    repo sync
  13. Start the build:
    brunch your_device_codename

Build LineageOS 17.1 on Windows 10 with WSL 2 — XDA Discussion Thread

According to Uldiniad, his AMD Ryzen 9 3950X-powered PC (full specifications can be found here) took 22 minutes to compile the aforementioned LineageOS 17.1 build with ccache populated.


Do you think your PC is powerful enough to handle the compilation job? Let us know your experience with LineageOS building on WSL in the comments below!

Want more posts like this delivered to your inbox? Enter your email to be subscribed to our newsletter.

Source link

LEAVE A REPLY

Please enter your comment!
Please enter your name here