[GUIDE] Build LineageOS 14.1

Search This thread

_mone

Inactive Recognized Developer
Jul 25, 2015
950
2,898
London
Hi there!
I'm receiving some pm about users that want to learn how to build LineageOS for the Galaxy Note 4 (snapdragon), so here is a quick guide:

Only supported device for now are trltexx/trltedt (N910F/N910G) and trltetmo/trltecan (N910T/N910W8)

I suggest to use a LTS version of ubuntu, in this guide I'll be using Ubuntu 16.04

Let's start with a bit of cleaning:
Code:
sudo apt-get remove openjdk-* icedtea-* icedtea6-*
Install java8:
Code:
sudo add-apt-repository ppa:openjdk-r/ppa
sudo apt-get update && sudo apt-get install openjdk-8-jdk
Install build tools:
Code:
sudo apt-get install git ccache automake lzop bison gperf build-essential zip curl zlib1g-dev zlib1g-dev:i386 g++-multilib python-networkx libxml2-utils bzip2 libbz2-dev libbz2-1.0 libghc-bzlib-dev squashfs-tools pngcrush schedtool dpkg-dev liblz4-tool make optipng maven
Install repo:
Code:
mkdir ~/bin && curl http://commondatastorage.googleapis.com/git-repo-downloads/repo > ~/bin/repo && chmod a+x ~/bin/repo
Edit ~/.bashrc (in this exaple I'm using gedit to do it):
Code:
gedit ~/.bashrc
Add those 2 lines at the bottom of the file (we are going to add also ccache to speed up our build time):
Code:
export PATH=~/bin:$PATH
export USE_CCACHE=1
Save it, close gedit and run:
Code:
source ~/.bashrc
Let's create some folders where we'll be doing the magic:
Code:
mkdir ~/android && cd ~/android
mkdir lineageos && cd lineageos
Initialize the local repo and download the source:
Code:
repo init -u git://github.com/LineageOS/android.git -b cm-14.1
repo sync --force-sync
It'll take quite some time, depends on your internet connection.
Once it's done downloading and checking out the files:
Code:
cd .repo
mkdir local_manifests && cd local_manifests
Now create a new file in this folder, name it "roomservice.xml" and add this into it:

For trltexx/trltedt:
Code:
<?xml version="1.0" encoding="UTF-8"?>
<manifest>
  <project name="underscoremone/android_kernel_samsung_trlte" path="kernel/samsung/trlte" remote="github" revision="cm-14.1" />
  <project name="underscoremone/android_device_samsung_trlte-common" path="device/samsung/trlte-common" remote="github" revision="cm-14.1" />
  <project name="underscoremone/android_device_samsung_trltexx" path="device/samsung/trltexx" remote="github" revision="cm-14.1" />
  <project name="underscoremone/proprietary_vendor_samsung_trlte" path="vendor/samsung" remote="github" revision="cm-14.1" />
  <project name="LineageOS/android_device_samsung_qcom-common" path="device/samsung/qcom-common" remote="github" revision="cm-14.1" />
  <project name="LineageOS/android_external_stlport" path="external/stlport" remote="github" revision="cm-14.1" />
  <project name="LineageOS/android_device_qcom_common" path="device/qcom/common" remote="github" revision="cm-14.1" />
</manifest>
For trltetmo/trltecan:
Code:
<?xml version="1.0" encoding="UTF-8"?>
<manifest>
  <project name="underscoremone/android_kernel_samsung_trlte" path="kernel/samsung/trlte" remote="github" revision="cm-14.1" />
  <project name="underscoremone/android_device_samsung_trlte-common" path="device/samsung/trlte-common" remote="github" revision="cm-14.1" />
  <project name="fat-tire/android_device_samsung_trltetmo" path="device/samsung/trltetmo" remote="github" revision="cm-14.1" />
  <project name="underscoremone/proprietary_vendor_samsung_trlte" path="vendor/samsung" remote="github" revision="cm-14.1" />
  <project name="LineageOS/android_device_samsung_qcom-common" path="device/samsung/qcom-common" remote="github" revision="cm-14.1" />
  <project name="LineageOS/android_external_stlport" path="external/stlport" remote="github" revision="cm-14.1" />
  <project name="LineageOS/android_device_qcom_common" path="device/qcom/common" remote="github" revision="cm-14.1" />
</manifest>
Now go back to the root of the source ("lineageos" folder) and repo sync again
Code:
cd ../..
repo sync
It'll now download the specific repositories for your device.
Then run
for trltexx/trltedt
Code:
. build/envsetup.sh && brunch trltexx
or for trltetmo/trltecan
Code:
. build/envsetup.sh && brunch trltetmo
And your build will start.
Once done you'll find your flashable rom.zip file in out/target/product/trlte**/

Congratulations you've successfully compiled LineageOS 14.1 for your device.

Remember to "make clean" every now and then.

------
Sometimes you'll get some errors, try to google the error and if you can not find a solution ask for help here at xda.
------

Hopefully I didn't forget anything.. if you have any trouble following this guide reply to this thread; myself or someone else will try to help you as soon as possible.
 
Last edited:

_mone

Inactive Recognized Developer
Jul 25, 2015
950
2,898
London
If you like to have the keyboard with the extra numbers row add this (before "</manifest>") to your roomservice.xml:
Code:
  <remove-project name="LineageOS/android_packages_inputmethods_LatinIME" />
  <project name="underscoremone/android_packages_inputmethods_LatinIME" path="packages/inputmethods/LatinIME" remote="github" revision="_cm-14.1" />

-----------------------------------------------------------------------------------------

If you want to include su to your builds you have to run
Code:
export WITH_SU=true
before starting the build.
If you want to always include it you can add the same line to your .bashrc (remember to run "source ~/.bashrc" after you modify .bashrc)
 
Last edited:

Diload

Member
May 10, 2012
9
4
Hello,

First of all thank you for sharing this guide.

I haven't yet compiled with success but so far one of the errors I've encountered is that i need to include the following in my local manifest:

Code:
  <project name="LineageOS/android_hardware_samsung" path="hardware/samsung" remote="github" revision="cm-14.1" />

or else I'm getting an error about missing macloader.h

Running a compile now so i will return once that finished :)
 

_mone

Inactive Recognized Developer
Jul 25, 2015
950
2,898
London
Hello,

First of all thank you for sharing this guide.

I haven't yet compiled with success but so far one of the errors I've encountered is that i need to include the following in my local manifest:

Code:
  <project name="LineageOS/android_hardware_samsung" path="hardware/samsung" remote="github" revision="cm-14.1" />

or else I'm getting an error about missing macloader.h

Running a compile now so i will return once that finished :)
Yep, you're right; I've missed it. I've updated the op.

Edit:
Actually I thought it was going to be downloaded automatically because it is included in the dependencies of "android_device_samsung_qcom-common".. maybe I'm wrong. Anyway I've added it to the guide's trltexx.xml, you may want to be aware that we still need "android_packages_resources_devicesettings" "android_packages_apps_FlipFlap" and "android_hardware_sony_timekeep", they should be automatically added to your roomservice.xml (because they are included in our lineage.dependencies) but if it doesn't happen you probably want to add it to your trltexx.xml.
 
Last edited:
  • Like
Reactions: Diload

_mone

Inactive Recognized Developer
Jul 25, 2015
950
2,898
London
How are things different if I want to build for TMO? How much disk space you need?

Sent from my SM-N910T using Tapatalk

I've updated the op with the changes needed for trltetmo/trltecan.

You need approximately 60gb, but I would go with more if you can.
 
Last edited:
  • Like
Reactions: 9h0s7

Diload

Member
May 10, 2012
9
4
Okay so i finally got a working build compiled, got a lot of issues with java compiler and javadoc using too much memory,
if anyone is interested it is fixed by setting
Code:
$ export ANDROID_JACK_VM_ARGS="-Dfile.encoding=UTF-8 -XX:+TieredCompilation -Xmx4G"

Just edit the 4G in the end to the amount of ram you would allow the java compiler to run, be aware that you would still need about an additional of 4,5 gigs of ram available other than what you specify here, at least that was the case for me, since the java compiler doesn't clear out when other stuff is processed during the compile (like c, c++ and javadoc compilation)

Yep, you're right; I've missed it. I've updated the op.

Edit:
Actually I thought it was going to be downloaded automatically because it is included in the dependencies of "android_device_samsung_qcom-common".. maybe I'm wrong. Anyway I've added it to the guide's trltexx.xml, you may want to be aware that we still need "android_packages_resources_devicesettings" "android_packages_apps_FlipFlap" and "android_hardware_sony_timekeep", they should be automatically added to your roomservice.xml (because they are included in our lineage.dependencies) but if it doesn't happen you probably want to add it to your trltexx.xml.

I don't know, when I run brunch it doesn't create the roomservice.xml file, i think that it gets done with the breakfast command, but that would create instances in my roomservice.xml that conflicted with the trltexx repos pulled from another source from the other local manifest.

So i ended up with this local manifest (i.e. trltexx.xml)

Code:
<?xml version="1.0" encoding="UTF-8"?>
<manifest>

<project path="device/samsung/trlte-common" name="Diload/android_device_samsung_trlte-common" remote="github" revision="cm-14.1" />

<project path="kernel/samsung/trlte" name="Diload/android_kernel_samsung_trlte" remote="github" revision="cm-14.1" />

<project path="device/samsung/trltexx" name="Diload/android_device_samsung_trltexx" remote="github" revision="cm-14.1" />

<project path="vendor/samsung" name="Diload/proprietary_vendor_samsung_trlte" remote="github" revision="cm-14.1" />

  <project name="LineageOS/android_device_samsung_qcom-common" path="device/samsung/qcom-common" remote="github" revision="cm-14.1" />

<project name="LineageOS/android_external_stlport" path="external/stlport" remote="github" revision="cm-14.1" />

<project name="LineageOS/android_device_qcom_common" path="device/qcom/common" remote="github" revision="cm-14.1" />

<project name="LineageOS/android_hardware_samsung" path="hardware/samsung" remote="github" revision="cm-14.1" />

<project name="LineageOS/android_packages_resources_devicesettings" path="packages/resources/devicesettings" remote="github" revision="cm-14.1" />

<project name="LineageOS/android_packages_apps_FlipFlap" path="packages/apps/FlipFlap" remote="github" revision="cm-14.1" />

<project name="LineageOS/android_hardware_sony_timekeep" path="hardware/sony/timekeep" remote="github" revision="cm-14.1" />


</manifest>

And it is now running on my phone ;)
 
Last edited:

dalincn

Member
Dec 16, 2013
22
0
hi! I how about NOTE 4 DUOS N9100 which has two sim? Now only one sim works,wifi and another sim donot work. how solve it?Thanks!:)
 

bat0nas

Senior Member
Feb 23, 2009
1,228
130
Vilnius
What's the point installing lineageos on note4?
Not trolling... Just curious.
I bet we will lose everything this phone is great about (s pen menu etc.).

Thanks!
 

Incarniac

Senior Member
Aug 16, 2008
689
284
London
What's the point installing lineageos on note4?.
This is probably not the right place for such a discussion as this is about building LineageOS yourself, based on the the guide that _mone has very kindly provided. I suggest opening a new thread yourself inviting discussion/advice, or maybe look around the various LineageOS dev threads to see what people are saying. The known issues / missing functionality is pretty well documented, but I'm sure people will be happy let you know in a thread where it is appropriate :)
 
  • Like
Reactions: _mone

Top Liked Posts

  • There are no posts matching your filters.
  • 28
    Hi there!
    I'm receiving some pm about users that want to learn how to build LineageOS for the Galaxy Note 4 (snapdragon), so here is a quick guide:

    Only supported device for now are trltexx/trltedt (N910F/N910G) and trltetmo/trltecan (N910T/N910W8)

    I suggest to use a LTS version of ubuntu, in this guide I'll be using Ubuntu 16.04

    Let's start with a bit of cleaning:
    Code:
    sudo apt-get remove openjdk-* icedtea-* icedtea6-*
    Install java8:
    Code:
    sudo add-apt-repository ppa:openjdk-r/ppa
    sudo apt-get update && sudo apt-get install openjdk-8-jdk
    Install build tools:
    Code:
    sudo apt-get install git ccache automake lzop bison gperf build-essential zip curl zlib1g-dev zlib1g-dev:i386 g++-multilib python-networkx libxml2-utils bzip2 libbz2-dev libbz2-1.0 libghc-bzlib-dev squashfs-tools pngcrush schedtool dpkg-dev liblz4-tool make optipng maven
    Install repo:
    Code:
    mkdir ~/bin && curl http://commondatastorage.googleapis.com/git-repo-downloads/repo > ~/bin/repo && chmod a+x ~/bin/repo
    Edit ~/.bashrc (in this exaple I'm using gedit to do it):
    Code:
    gedit ~/.bashrc
    Add those 2 lines at the bottom of the file (we are going to add also ccache to speed up our build time):
    Code:
    export PATH=~/bin:$PATH
    export USE_CCACHE=1
    Save it, close gedit and run:
    Code:
    source ~/.bashrc
    Let's create some folders where we'll be doing the magic:
    Code:
    mkdir ~/android && cd ~/android
    mkdir lineageos && cd lineageos
    Initialize the local repo and download the source:
    Code:
    repo init -u git://github.com/LineageOS/android.git -b cm-14.1
    repo sync --force-sync
    It'll take quite some time, depends on your internet connection.
    Once it's done downloading and checking out the files:
    Code:
    cd .repo
    mkdir local_manifests && cd local_manifests
    Now create a new file in this folder, name it "roomservice.xml" and add this into it:

    For trltexx/trltedt:
    Code:
    <?xml version="1.0" encoding="UTF-8"?>
    <manifest>
      <project name="underscoremone/android_kernel_samsung_trlte" path="kernel/samsung/trlte" remote="github" revision="cm-14.1" />
      <project name="underscoremone/android_device_samsung_trlte-common" path="device/samsung/trlte-common" remote="github" revision="cm-14.1" />
      <project name="underscoremone/android_device_samsung_trltexx" path="device/samsung/trltexx" remote="github" revision="cm-14.1" />
      <project name="underscoremone/proprietary_vendor_samsung_trlte" path="vendor/samsung" remote="github" revision="cm-14.1" />
      <project name="LineageOS/android_device_samsung_qcom-common" path="device/samsung/qcom-common" remote="github" revision="cm-14.1" />
      <project name="LineageOS/android_external_stlport" path="external/stlport" remote="github" revision="cm-14.1" />
      <project name="LineageOS/android_device_qcom_common" path="device/qcom/common" remote="github" revision="cm-14.1" />
    </manifest>
    For trltetmo/trltecan:
    Code:
    <?xml version="1.0" encoding="UTF-8"?>
    <manifest>
      <project name="underscoremone/android_kernel_samsung_trlte" path="kernel/samsung/trlte" remote="github" revision="cm-14.1" />
      <project name="underscoremone/android_device_samsung_trlte-common" path="device/samsung/trlte-common" remote="github" revision="cm-14.1" />
      <project name="fat-tire/android_device_samsung_trltetmo" path="device/samsung/trltetmo" remote="github" revision="cm-14.1" />
      <project name="underscoremone/proprietary_vendor_samsung_trlte" path="vendor/samsung" remote="github" revision="cm-14.1" />
      <project name="LineageOS/android_device_samsung_qcom-common" path="device/samsung/qcom-common" remote="github" revision="cm-14.1" />
      <project name="LineageOS/android_external_stlport" path="external/stlport" remote="github" revision="cm-14.1" />
      <project name="LineageOS/android_device_qcom_common" path="device/qcom/common" remote="github" revision="cm-14.1" />
    </manifest>
    Now go back to the root of the source ("lineageos" folder) and repo sync again
    Code:
    cd ../..
    repo sync
    It'll now download the specific repositories for your device.
    Then run
    for trltexx/trltedt
    Code:
    . build/envsetup.sh && brunch trltexx
    or for trltetmo/trltecan
    Code:
    . build/envsetup.sh && brunch trltetmo
    And your build will start.
    Once done you'll find your flashable rom.zip file in out/target/product/trlte**/

    Congratulations you've successfully compiled LineageOS 14.1 for your device.

    Remember to "make clean" every now and then.

    ------
    Sometimes you'll get some errors, try to google the error and if you can not find a solution ask for help here at xda.
    ------

    Hopefully I didn't forget anything.. if you have any trouble following this guide reply to this thread; myself or someone else will try to help you as soon as possible.
    6
    If you like to have the keyboard with the extra numbers row add this (before "</manifest>") to your roomservice.xml:
    Code:
      <remove-project name="LineageOS/android_packages_inputmethods_LatinIME" />
      <project name="underscoremone/android_packages_inputmethods_LatinIME" path="packages/inputmethods/LatinIME" remote="github" revision="_cm-14.1" />

    -----------------------------------------------------------------------------------------

    If you want to include su to your builds you have to run
    Code:
    export WITH_SU=true
    before starting the build.
    If you want to always include it you can add the same line to your .bashrc (remember to run "source ~/.bashrc" after you modify .bashrc)
    3
    N910V never gets any love

    ok so what would I have to do to make one strictly for the N910V ? id just change it to trltevzw ?

    For trltevzw you may want to have a look at the verzion forum and ask the recognized developers that are building LineageOS to share their source. Good luck with that!
    3
    As soon as you launch your terminal app, run this command to enter root mode. Then you can run all root commands without sudo in front.
    Thanks, yeah I am familiar with Linux and general development (just not Android ROM dev) - my question was about this 'sudo' in particular. The others are needed. As I said, a very minor and really out of curiosity than anything :)

    (Also, prefer not to run a shell as root, that's a recipe for disaster :) )
    3
    Sounds good, but does that also mean if I delete a repo I no longer want from roomservice, the local files will continue taking up space?
    "Yes" -> I need to find a way to clear up that space; "no" -> it's still not feasible to use separate roomservices for different devices.

    Yes, they will take up space. Why isn't it feasible to use separate roomservices for different devices? It's a hard truth I had to accept when I started building.