FORUMS
Remove All Ads from XDA

[GUIDE][WIP] How to build LineageOS 16.0 on Windows 10 (via WSL)

205 posts
Thanks Meter: 133
 
By Uldiniad, Senior Member on 15th February 2018, 04:54 PM
Post Reply Email Thread
Requirements
  • Windows 10 (64-bit) installed on a drive (256GB or bigger) (SSD recommended)
  • 16GB RAM or more
Warnings
  • 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
Setting up a Windows Subsystem for Linux (WSL) build environment
  1. Open Microsoft Store
  2. Search for the Ubuntu 18.04 app
  3. Install the app
  4. Open the app and follow the first-time setup steps
  5. Update packages and install the following:
    Code:
    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 openjdk-8-jdk pngcrush repo rsync schedtool squashfs-tools xsltproc zip zlib1g-dev
  6. Make a directory for the source code (and go to it):
    Code:
    mkdir -p ~/android/lineage && cd android/lineage
  7. Initialize the LineageOS source repository:
    Code:
    repo init -u https://github.com/LineageOS/android.git -b lineage-16.0
  8. Sync the sources:
    Code:
    repo sync
  9. (Optional; Recommended) https://wiki.lineageos.org/devices/k...speed-up-build
  10. Run
    Code:
    source build/envsetup.sh
  11. Prepare the device-specific code:
    Code:
    breakfast your device codename
  12. 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" />
  13. Sync the sources again:
    Code:
    repo sync
  14. Make 64-bit bison:
    Code:
    make bison
  15. Use 64-bit bison to build:
  16. Start the build:
    Code:
    brunch your device codename

For future builds, you need to repeat steps 13 -> 10 -> 16 at the root of the tree
Repeat step 14 every time you clean the out directory
The Following 57 Users Say Thank You to Uldiniad For This Useful Post: [ View ] Gift Uldiniad Ad-Free
 
 
15th February 2018, 05:20 PM |#2  
OP Senior Member
Thanks Meter: 133
 
Donate to Me
More
Useful resources

Installing a desktop environment on WSL:
https://solarianprogrammer.com/2017/...-linux-xfce-4/

Linux common commands cheat sheet:
https://www.cheatography.com/davechi...-command-line/

Navigating to C: or other partitions:
check /mnt folder
The Following 5 Users Say Thank You to Uldiniad For This Useful Post: [ View ] Gift Uldiniad Ad-Free
16th February 2018, 12:45 AM |#3  
Junior Member
Thanks Meter: 2
 
More
Hello, Thanks for your great guide. I was able to finish the build nearly successfully.

USE_HOST_BISON is opt-in, so you don't need to set it false unless you've exported USE_HOST_BISON=true before.

I've seen the change 196115, but is this change really needed for WSL build?
It seems like change for non-WSL build. (whose don't need to use prebuilt FLEX)
The Following 2 Users Say Thank You to 1a2a3a4aq For This Useful Post: [ View ] Gift 1a2a3a4aq Ad-Free
16th February 2018, 01:20 AM |#4  
OP Senior Member
Thanks Meter: 133
 
Donate to Me
More
Quote:
Originally Posted by 1a2a3a4aq

Hello, Thanks for your great guide. I was able to finish the build nearly successfully.

USE_HOST_BISON is opt-in, so you don't need to set it false unless you've exported USE_HOST_BISON=true before.

I've seen the change 196115, but is this change really needed for WSL build?
It seems like change for non-WSL build. (whose don't need to use prebuilt FLEX)

Thanks for your feedback.
As you pointed out, I made a mistake in the number of the commit to be cherrypicked. I've corrected the OP, so, the command should now work and you can also see the code that is added by the commit by following the link. Thanks for pointing that out.
WSL only supports 64-bit binaries. That is why I've left out bison and flex from the packages to be installed for the build environment and instead have put the code to my forked repos which have prebuilt 64-bit bison and flex. Then I've set USE_HOST_BISON and USE_HOST_FLEX to false in bashrc so that it doesn't go looking for the packages that would typically be installed with apt-get and makes sure the 64-bit prebuilts are used (but as you said, it might be an unnecessary precaution but it doesn't hurt to have it).

Hope that helps. And if you have more questions, ask away.
The Following User Says Thank You to Uldiniad For This Useful Post: [ View ] Gift Uldiniad Ad-Free
16th February 2018, 06:07 AM |#5  
Junior Member
Thanks Meter: 2
 
More
Quote:
Originally Posted by Uldiniad

Thanks for your feedback.
As you pointed out, I made a mistake in the number of the commit to be cherrypicked. I've corrected the OP, so, the command should now work and you can also see the code that is added by the commit by following the link. Thanks for pointing that out.
WSL only supports 64-bit binaries. That is why I've left out bison and flex from the packages to be installed for the build environment and instead have put the code to my forked repos which have prebuilt 64-bit bison and flex. Then I've set USE_HOST_BISON and USE_HOST_FLEX to false in bashrc so that it doesn't go looking for the packages that would typically be installed with apt-get and makes sure the 64-bit prebuilts are used (but as you said, it might be an unnecessary precaution but it doesn't hurt to have it).

Hope that helps. And if you have more questions, ask away.

btw, using "/bin/bash -c" instead of brunch does not make effect for me.
build stucks while doing dex2oat jobs just like using brunch.
build with WITH_DEXPREOPT=false was successful, but 8.1 must use dexpreopt due to sepolicy changes. still searching on this.
16th February 2018, 01:49 PM |#6  
OP Senior Member
Thanks Meter: 133
 
Donate to Me
More
Quote:
Originally Posted by 1a2a3a4aq

btw, using "/bin/bash -c" instead of brunch does not make effect for me.
build stucks while doing dex2oat jobs just like using brunch.
build with WITH_DEXPREOPT=false was successful, but 8.1 must use dexpreopt due to sepolicy changes. still searching on this.

Ok, thanks for mentioning this. I had success with the /bin/bash -c command but if this is not universal, then, as you said, we should find another universal workaround or fix and I'll replace mine with it in the OP. I'll look into WITH_DEXPREOPT and other possibilities on my end too.
I've reopened the issue on GitHub while there is no universal fix or workaround: https://github.com/Microsoft/WSL/issues/2948
The Following User Says Thank You to Uldiniad For This Useful Post: [ View ] Gift Uldiniad Ad-Free
16th February 2018, 02:19 PM |#7  
OP Senior Member
Thanks Meter: 133
 
Donate to Me
More
Quote:
Originally Posted by 1a2a3a4aq

btw, using "/bin/bash -c" instead of brunch does not make effect for me.
build stucks while doing dex2oat jobs just like using brunch.
build with WITH_DEXPREOPT=false was successful, but 8.1 must use dexpreopt due to sepolicy changes. still searching on this.

I've opened this page: https://source.android.com/devices/t...lvik/configure
I'm thinking of trying out different makefile options instead of disabling dex2oat altogether and see if it makes a difference for the brunch command. Maybe you can do the same and keep us posted
The Following User Says Thank You to Uldiniad For This Useful Post: [ View ] Gift Uldiniad Ad-Free
16th February 2018, 05:15 PM |#9  
Senior Member
Flag New Delhi
Thanks Meter: 22
 
Donate to Me
More
Thanks for posting the tutorial
@Uldiniad
I'm very thankful to you for this.
One question, is it possible to download the whole source somewhere else so that we don't have to download the complete source across windows formats and system restores?
16th February 2018, 08:15 PM |#10  
OP Senior Member
Thanks Meter: 133
 
Donate to Me
More
Quote:
Originally Posted by akash.galaxy07

Thanks for posting the tutorial
@Uldiniad
I'm very thankful to you for this.
One question, is it possible to download the whole source somewhere else so that we don't have to download the complete source across windows formats and system restores?

As far as I know, at this point in time it is not (that's why I put up the requirements and warnings on the OP). WSL is made to work mostly within its own environment (somewhat separate from Windows) and intercompatibility/interoperability with the Windows file system is limited. Linux and Windows don't have the same file management systems (which is why manipulating files of the subsystem from Windows Explorer and the mount option are out the window for now). Also, there is no simple way of changing the installation location of lxss as of today (although, you can check WSL's GitHub if you're really determined to move it ).
WSL is picky and that is why threads like this exist. If WSL worked like Ubuntu out of the box this thread wouldn't be necessary (LineageOS' guide would suffice).
The Following 3 Users Say Thank You to Uldiniad For This Useful Post: [ View ] Gift Uldiniad Ad-Free
17th February 2018, 12:41 AM |#11  
Junior Member
Thanks Meter: 2
 
More
Quote:
Originally Posted by akash.galaxy07

Thanks for posting the tutorial
@Uldiniad
I'm very thankful to you for this.
One question, is it possible to download the whole source somewhere else so that we don't have to download the complete source across windows formats and system restores?

Check LxRunOffline on GitHub. It can install WSL distribution to another directory from tar file.
Post Reply Subscribe to Thread

Tags
bashonwindows, lineageos, windows, wsl

Guest Quick Reply (no urls or BBcode)
Message:
Previous Thread Next Thread
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes