[Vibrant General] stinga11:
This guide is an adaptation/update of the following guides:

http://xdaforums.com/showthread.php...mctr=(not provided)&__utmv=-&__utmk=231246620

http://xdaforums.com/nexus-4/general/guide-cm11-how-to-build-cyanogenmod-11-t2515305

Disclaimer

My linux skills are not very good but following a few of guides I could compile a very stable and functional ROM. Everything written here is tested by me several times and works, but I am not responsible for any damage.

Requirements:

Linux - Ubuntu 14.04 - 64bit (AFAIK, a 64 bit host is needed to compile KK)

An SGH-T959 with cm11 compile with this guide or cm-10.1-2014xxxx-NIGHTLY-vibrantmtd already installed - Get the latest nightly here: http://get.cm/?device=vibrantmtd

About 14GB of storage for the repository plus about 15GB for building

1 - Install Ubuntu Packages

Terminal

sudo apt-get install bison build-essential curl flex \
g++-multilib gcc-multilib git-core gnupg gperf \
lib32ncurses5-dev lib32readline-gplv2-dev lib32z1-dev \
libesd0-dev libncurses5-dev libsdl1.2-dev \
libwxgtk2.8-dev libxml2 libxml2-utils lzop \
pngcrush schedtool \
squashfs-tools xsltproc zip zlib1g-dev

2 - Install JAVA

2.1 Download Java JDK for Linux 64-bit from: http://ghaffarian.net/downloads/Java/JDK/jdk-6u45-linux-x64.bin

2.2 Move jdk-6u45-linux-x64.bin to your home directory

2.3 Remove any other java packages from system:

sudo apt-get purge openjdk-\* icedtea-\* icedtea6-\*

2.4 Install Java JDK:

sudo mkdir -p /opt/java/64/
sudo cp jdk-6u45-linux-x64.bin /opt/java/64
sudo su -
cd /opt/java/64
chmod +x jdk-6u45-linux-x64.bin
./jdk-6u45-linux-x64.bin
exit

2.5 Add JDK PATH to .bashrc:

gedit ~/.bashrc

Add these lines to .bashrc:

# Java PATHs
export JAVA_HOME=/opt/java/64/jdk1.6.0_45
export PATH=$PATH:$JAVA_HOME/bin

3 - Install Android SDK

3.1 Setup directories:

cd ~
mkdir android
cd android
mkdir sdk

3.2 Download Android SDK from http://developer.android.com/sdk/index.html

3.3 Extract SDK contents to ~/android/sdk

3.4 Add Android SDK Path:

gedit ~/.bashrc

Add these lines to .bashrc:

#Android PATH
export PATH=$PATH:~/android/sdk
export PATH=$PATH:~/android/sdk/platform-tools
export PATH=$PATH:~/android/sdk/tools

4 - Install Repository

4.1 Download Repo:

mkdir -p ~/bin
mkdir -p ~/android/system
curl http://commondatastorage.googleapis.com/git-repo-downloads/repo > ~/bin/repo
chmod a+x ~/bin/repo

4.2 Add Repo Path:

gedit ~/.bashrc

Add these lines to .bashrc:

export PATH=$PATH:~/bin

4.3 Close and open new terminal.

4.4 Initialize Repository:

cd ~/android/system/
repo init -u git://github.com/CyanogenMod/android.git -b stable/cm-11.0

5 - Download the specific code for Vibrant SGH-T959

mkdir ~/android/system/.repo/local_manifests && touch ~/android/system/.repo/local_manifests/vibrantmtd.xml && gedit ~/android/system/.repo/local_manifests/vibrantmtd.xml

Copy the following path and save the file:

<?xml version="1.0" encoding="UTF-8"?>
<manifest>
<project path="device/samsung/vibrantmtd" name="CyanogenMod/android_device_samsung_vibrantmtd" remote="github" revision="cm-10.2" />
<project path="device/samsung/aries-common" name="CyanogenMod/android_device_samsung_aries-common" remote="github" revision="cm-11.0" />
<project path="packages/apps/SamsungServiceMode" name="CyanogenMod/android_packages_apps_SamsungServiceMode" remote="github" revision="cm-11.0" />
<project path="kernel/samsung/aries" name="CyanogenMod/android_kernel_samsung_aries" remote="github" revision="cm-11.0" />
<project path="hardware/samsung" name="CyanogenMod/android_hardware_samsung" remote="github" revision="cm-11.0" />
</manifest>

Note: For specific code for vibrant, aries and samsung does not use the stable branch to have the latest fixes available

6 - Sync. the Repository

cd ~/android/system/
repo sync

NOTE: When finished, run the repo sync command again to be sure there are no errors.

7 - Edit a one file from vibrant.

When you finished the download the Repository you need edit a vibrant file or it will not compile.

gedit ~/android/system/device/samsung/vibrantmtd/recovery/recovery_keys.c

Delete all code and replace it and save the file.

Replace with this code:

#include <linux/input.h>

#include "recovery_ui.h"
#include "common.h"
#include "extendedcommands.h"

int device_handle_key(int key_code, int visible) {
if (visible) {
switch (key_code) {
case KEY_VOLUMEDOWN:
case 217: // SEARCH
return HIGHLIGHT_DOWN;

case KEY_VOLUMEUP:
case 139: // MENU
return HIGHLIGHT_UP;

case KEY_POWER:
case 158: // HOME
return SELECT_ITEM;

case 102: // BACK
return GO_BACK;

default:
return NO_ACTION;
}
}

return NO_ACTION;
}

8 - Extract files from phone:

NOTE: You need to have cm10.1 (or cm11 compile with this guide) installed on the phone and the phone has to be in usb debugging.

Connect phone to pc and in terminal type:

adb root
cd ~/android/system/device/samsung/vibrantmtd/
./extract-files.sh

9 - Download Extra Files

~/android/system/vendor/cm/get-prebuilts

10 - Building Android

cd ~/android/system
. build/envsetup.sh && brunch vibrantmtd

11 - Install on Phone

11.1 Copy your .zip file from ~/android/system/out/target/product/vibrantmtd/cm-11-XXXXXXXXX-UNOFFICIAL-vibrantmtd.zip to the root of the SD card.

11.2 Optional: Download Google Apps for KitKat from http://goo.im/gapps and place it on the root of the SD card.

11.3 Flash both of these .zip files from recovery.

Note: I put this guide in general because I do not have the necessary permission to put in the development area. If any Administrator can put in the dev. area would be helpful.