[Galaxy S 4 General] BenLue:
Make your 'own' Nougat-ROM today!

Thank you note: Thank you to the whole CM-Team for bringing up-to-date-Android to so many devices.

Overview

I. Preparation

II. Installation of the required packages

III. The sources

IV. Building the ROM

I. Preparation

Things you need for building:

A computer

An internet connection

An open mind

Time

Patience

First of all, you need a running up-to-date Ubuntu/Linux system. I am using

Debian Stretch (testing) 64-bit

.

Use the terminal to make the steps. A terminal window can be opened by pressing Ctrl+Alt+T. Every single command for the terminal is marked with a $ sign. Just paste every command (without the $ sign) to your terminal window and there shouldn't be any problem.

IMPORTANT: INSTALL EVERYTHING AS A NORMAL USER. DON'T INSTALL AS ROOT!

II. Installation of the required packages (Debian Stretch (testing) 64-bit)

For both 32-bit & 64-bit systems, you'll need:

$ sudo apt-get install bison build-essential curl flex \
git gnupg gperf libesd0-dev liblz4-tool \
libncurses5-dev libsdl1.2-dev libwxgtk2.8-dev libxml2 libxml2-utils \
lzop maven openjdk-7-jdk pngcrush schedtool \
squashfs-tools xsltproc zip zlib1g-dev

In addition to the above, for 64-bit systems, get these:

$ sudo apt-get install g++-multilib gcc-multilib \
lib32ncurses5-dev lib32readline-gplv2-dev lib32z1-dev

For Ubuntu 15.10 (wily) and newer, substitute:

lib32readline-gplv2-dev -> lib32readline6-dev

For Ubuntu 16.04 (xenial) and newer, substitute (additionally see java notes below):

libwxgtk2.8-dev -> libwxgtk3.0-dev

openjdk-7-jdk -> openjdk-8-jdk

Java versions: Different versions of CyanogenMod require different versions of the JDK (Java Development Kit):

CyanogenMod 7 - 9: Sun/Oracle Java SE 1.6

CyanogenMod 10.1: Sun/Oracle Java SE 1.6 or 1.7

CyanogenMod 10.2 - 11.0: Sun/Oracle Java SE 1.6 or 1.7 (OpenJDK 1.7 works fine, but the build system will display a warning)

CyanogenMod 12.0 - 13.0: OpenJDK 1.7 (see note about OpenJDK 1.8 below)

CyanogenMod 14.1: OpenJDK 1.8

Ubuntu 16.04 (Xenial Xerus) or newer and OpenJDK: Since OpenJDK 1.7 was removed from the official Ubuntu repositories, you have a couple options:

Obtain OpenJDK 1.7 from the openjdk-r PPA

Enable experimental OpenJDK 1.8 support in CyanogenMod 13.0 (not available in earlier version). To enable OpenJDK 1.8 support, add this line to your $HOME/.bashrc file:

export EXPERIMENTAL_USE_JAVA8=true

III. The sources

You will need to set up some directories in your build environment.

To create them:

$ mkdir -p ~/bin
$ mkdir -p ~/android/system

Install the repo command

Enter the following to download the "repo" binary and make it executable (runnable):

$ curl https://storage.googleapis.com/git-repo-downloads/repo > ~/bin/repo
$ chmod a+x ~/bin/repo

Put the ~/bin directory in your path of execution

In recent versions of Ubuntu, ~/bin should already be in your PATH. You can check this by opening ~/.profile with a text editor and verifying the following code exists (add it if it is missing):

# set PATH so it includes user's private bin if it exists
if [ -d "$HOME/bin" ] ; then
PATH="$HOME/bin:$PATH"
fi

Time to initialize the CyanogenMod source repository

Enter the following to initialize the repository:

Note: Make sure the cm branch entered here is the one you wish to build and is supported on your device.

$ cd ~/android/system/
$ repo init -u https://github.com/CyanogenMod/android.git -b cm-14.1

Download the source code

To start the download of all the source code to your computer:

$ repo sync

The CM manifests include a sensible default configuration for repo, which we strongly suggest you use (i.e. don't add any options to sync). For reference, our default values are -j4 and -c. The -j4 part means that there will be four simultaneous threads/connections. If you experience problems syncing, you can lower this to -j3 or -j2. -c will ask repo to pull in only the current branch, instead of the entire CM history.

Prepare to wait a long time while the source code downloads.

IV. Building the ROM

Prepare the device-specific code

$ source build/envsetup.sh
$ breakfast jfltexx

Turn on caching to speed up build

You can speed up subsequent builds by adding

export USE_CCACHE=1

to your ~/.bashrc file. Then, specify the amount of disk space to dedicate to ccache by typing this from the top of your Android tree:

prebuilts/misc/linux-x86/ccache/ccache -M 50G

Start the build

Time to start building! So now type:

$ croot
$ brunch jfltexx

Happy building!