This guide walks you through building LineageOS (a custom Android ROM) directly on a Windows 10 PC, without needing a separate Linux machine or virtual machine. You’ll use the Windows Subsystem for Linux (WSL) to run the required Linux build environment, then compile a flashable ZIP for your device. Before starting, you’ll need a decent PC (16GB RAM recommended, 200GB free disk space), a fast internet connection, and a supported device.
What You’ll Need
- Windows 10 version 2004 or later (64-bit)
- At least 16GB RAM (8GB minimum, but builds will be slow)
- 200GB free disk space (SSD strongly recommended)
- An unlocked bootloader on your target device
- Basic familiarity with command line
- Patience – first builds can take several hours
Step-by-Step
- Enable Windows Subsystem for Linux (WSL2)
Open PowerShell as Administrator and run:wsl --install -d Ubuntu
This installs WSL2 and Ubuntu. Restart your PC when prompted. - Set up Ubuntu
After restart, launch Ubuntu from the Start menu. Create a username and password when asked. - Update Ubuntu packages
In the Ubuntu terminal, run:sudo apt update && sudo apt upgrade -y - Install required packages
Run:sudo apt install git-core gnupg flex bison build-essential zip curl zlib1g-dev libc6-dev-i386 libncurses5 lib32ncurses5-dev x11proto-core-dev libx11-dev lib32z1-dev libgl1-mesa-dev libxml2-utils xsltproc unzip fontconfig - Install repo tool
Run:mkdir -p ~/bin && curl https://storage.googleapis.com/git-repo-downloads/repo > ~/bin/repo && chmod a+x ~/bin/repo
Add~/binto your PATH by editing~/.bashrc. - Configure Git
Run:git config --global user.name "Your Name"git config --global user.email "you@example.com" - Initialize LineageOS source
Create a directory and initialize the repo:mkdir ~/lineage && cd ~/lineagerepo init -u https://github.com/LineageOS/android.git -b lineage-20.0
(Replacelineage-20.0with the latest branch for your device.) - Sync the source code
Run:repo sync -c -j8
This downloads the entire Android source tree – it can take several hours. Use-j16if you have a fast CPU and good internet. - Prepare device-specific code
For your specific device, you’ll need vendor blobs and device trees. The LineageOS wiki provides extraction scripts. Typically, you run:source build/envsetup.shbreakfast
This downloads the necessary device configuration. - Start the build
Run:brunch
The build will take 2-6 hours depending on your hardware. The output ZIP will be inout/target/product/./
Common Mistakes
- Not enough disk space – The source tree alone is ~50GB, and the build adds another 50-100GB. Ensure you have 200GB free.
- Running out of RAM – If the build crashes with OOM errors, reduce parallel jobs with
-j4or add swap space. - Wrong branch – Using an outdated branch can cause build failures. Always check the LineageOS wiki for your device’s supported branch.
- Missing vendor blobs – Without proprietary drivers, the build will fail. Extract them from your device using the provided scripts.
- Ignoring WSL version – WSL1 does not work well; ensure you’re on WSL2.
Tips
- Use an SSD – building on a hard drive is painfully slow.
- Close all other programs during the build to free up RAM.
- Keep your Ubuntu installation up to date to avoid dependency issues.
- If you run into errors, search the LineageOS subreddit or XDA forums – many issues are common and have fixes.
- Consider using
ccacheto speed up subsequent builds:export USE_CCACHE=1 && ccache -M 50G.
Troubleshooting
If the build fails, read the error message carefully. Common issues include:
- Missing packages – Re-run the package install command; you may have missed one.
- Java version errors – LineageOS requires OpenJDK 11 for Android 11+; install it with
sudo apt install openjdk-11-jdk. - Repo sync fails – Try
repo sync -c -j4to reduce network load, or runrepo sync --force-sync. - Out of memory – Add a swap file:
sudo fallocate -l 8G /swapfile && sudo chmod 600 /swapfile && sudo mkswap /swapfile && sudo swapon /swapfile. - WSL hangs – Restart WSL with
wsl --shutdownin PowerShell, then relaunch Ubuntu.
Frequently Asked Questions
Can I build on Windows without WSL?
Officially, LineageOS only supports building on Linux. WSL2 is the recommended way on Windows; native Windows builds are not supported.
How long does the first build take?
On a modern 8-core CPU with 16GB RAM and an SSD, expect 2-4 hours. On slower hardware, it can take 8+ hours.
Do I need to unlock my device’s bootloader?
Yes, you must unlock the bootloader to flash the custom ROM. This process varies by device and may void your warranty.
Will building LineageOS brick my phone?
If you follow official instructions and use the correct build for your device, the risk is low. However, flashing any custom ROM carries some risk, so backup your data first.
Can I use a virtual machine instead of WSL?
Yes, but WSL2 is more efficient and integrates better with Windows. A VM will be slower due to overhead.
What if my device isn’t officially supported?
You can try building from community device trees, but you’ll need to find them on GitHub or XDA. Expect more troubleshooting.
Related
General steps for current mainstream versions; menus can differ by device and version. See the disclaimer or report an error.
More in this bed
- Gmail Gemini Privacy: Data Access & Limit Settings
- Fix Outlook Inbox Corruption with DISM in Windows
- How to Set Up Apple Pay on iPhone
- How to Choose a Refurbished iPhone With Years of Support
- Voice Dictation in Google Docs: How to Use It
- Turn Off Message Notifications on Mac