[Galaxy S II General] LastStandingDroid:
To compile Jellybean on Ubuntu I'm going to first give you steps to set up your computer to get this thing rolling. Also note that this appears to be a development preview source code.

This is the base how you build it for our device, it will be updated daily if fixes are made

Running into an error, make sure to write what the problem is.

Thanks List:

koudd For helping me out wih errors/Pointing me to right direction

stormtroopercs For Helping Me out/point to right direction

MemoryController Helping US, with errors while compiling,

Kalgecin for helping me fix my errors/pointing me to right direction

dastin1015 For his brilliant Tutorial which this is based uppon: Here

Krizp0 for pointing out that i missed to credit dastin1015 for tutorial which this one is based uppon!

princescar for pointing out that the java jdk was wrong :D

Note: The source download is approximately 6GB in size. You will need 25GB free to complete a single build, and up to 80GB (or more) for a full set of builds.

1) You need the following:

-JDK 6 if you wish to build Jellybean.

$ sudo apt-get install sun-java6-jdk

if you got any problem go: https://github.com/flexiondotorg/oab-java6 or to developers website: http://www.oracle.com/technetwork/java/javase/downloads/index.html

-Python 2.4 -- 2.7, which you can download from python.org. Or:

$ sudo apt-get install python

-Git 1.7 or newer. You can find it at git-scm.com. Or:

$ sudo apt-get install git-core

-Android SDK:

Download the SDK here: http://developer.android.com/sdk/index.html

Extract the SDK and place it in your home directory.

I renamed my SDK to android-sdk to make it easier to navigate to.

Go to your home folder, press Ctrl+H to show hidden files, and open up your .bashrc file.

Add these lines at the bottom of the file:

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

Find your .profile file and add this at the bottom of the file:

PATH="$HOME/android-sdk/tools:$HOME/android-sdk/platform-tools:$PATH"

You have now successfully installed the Android SDK.

To check for updates issue this into your terminal:

$ android

2) Install required packages. 64-bit (recommended)

$ sudo apt-get install git-core gnupg flex bison gperf build-essential \
zip curl zlib1g-dev libc6-dev lib32ncurses5-dev ia32-libs \
x11proto-core-dev libx11-dev lib32readline5-dev lib32z-dev \
libgl1-mesa-dev g++-multilib mingw32 tofrodos python-markdown \
libxml2-utils

On newer versions of Ubuntu such as 11.10 you may need to do the following:

$ sudo ln -s /usr/lib/i386-linux-gnu/libX11.so.6 /usr/lib/i386-linux-gnu/libX11.so

Building on Ubuntu 12.04 is currently only experimentally supported and is not guaranteed to work on branches other than master.

$ sudo apt-get install git-core gnupg flex bison gperf build-essential \
zip curl libc6-dev libncurses5-dev:i386 x11proto-core-dev \
libx11-dev:i386 libreadline6-dev:i386 libgl1-mesa-glx:i386 \
libgl1-mesa-dev g++-multilib mingw32 openjdk-6-jdk tofrodos \
python-markdown libxml2-utils xsltproc zlib1g-dev:i386
$ sudo ln -s /usr/lib/i386-linux-gnu/mesa/libGL.so.1 /usr/lib/i386-linux-gnu/libGL.so

3) Configure your USB.

$ gksudo gedit /etc/udev/rules.d/51-android.rules

in this case we only need Samsung USB (If your building for other devices such as LG you can add thoose too!)

#Samsung
SUBSYSTEM=="usb", ATTR{idVendor}=="04e8", MODE="0666"

Inside of this blank text file insert:

#Acer
SUBSYSTEM=="usb", ATTR{idVendor}=="0502", MODE="0666"

#ASUS
SUBSYSTEM=="usb", ATTR{idVendor}=="0b05", MODE="0666"

#Dell
SUBSYSTEM=="usb", ATTR{idVendor}=="413c", MODE="0666"

#Foxconn
SUBSYSTEM=="usb", ATTR{idVendor}=="0489", MODE="0666"

#Garmin-Asus
SUBSYSTEM=="usb", ATTR{idVendor}=="091E", MODE="0666"

#Google
SUBSYSTEM=="usb", ATTR{idVendor}=="18d1", MODE="0666"

#HTC
SUBSYSTEM=="usb", ATTR{idVendor}=="0bb4", MODE="0666"

#Huawei
SUBSYSTEM=="usb", ATTR{idVendor}=="12d1", MODE="0666"

#K-Touch
SUBSYSTEM=="usb", ATTR{idVendor}=="24e3", MODE="0666"

#KT Tech
SUBSYSTEM=="usb", ATTR{idVendor}=="2116", MODE="0666"

#Kyocera
SUBSYSTEM=="usb", ATTR{idVendor}=="0482", MODE="0666"

#Lenevo
SUBSYSTEM=="usb", ATTR{idVendor}=="17EF", MODE="0666"

#LG
SUBSYSTEM=="usb", ATTR{idVendor}=="1004", MODE="0666"

#Motorola
SUBSYSTEM=="usb", ATTR{idVendor}=="22b8", MODE="0666"

#NEC
SUBSYSTEM=="usb", ATTR{idVendor}=="0409", MODE="0666"

#Nook
SUBSYSTEM=="usb", ATTR{idVendor}=="2080", MODE="0666"

#Nvidia
SUBSYSTEM=="usb", ATTR{idVendor}=="0955", MODE="0666"

#OTGV
SUBSYSTEM=="usb", ATTR{idVendor}=="2257", MODE="0666"

#Pantech
SUBSYSTEM=="usb", ATTR{idVendor}=="10A9", MODE="0666"

#Philips
SUBSYSTEM=="usb", ATTR{idVendor}=="0471", MODE="0666"

#PMC-Sierra
SUBSYSTEM=="usb", ATTR{idVendor}=="04da", MODE="0666"

#Qualcomm
SUBSYSTEM=="usb", ATTR{idVendor}=="05c6", MODE="0666"

#SK Telesys
SUBSYSTEM=="usb", ATTR{idVendor}=="1f53", MODE="0666"

#Samsung
SUBSYSTEM=="usb", ATTR{idVendor}=="04e8", MODE="0666"

#Sharp
SUBSYSTEM=="usb", ATTR{idVendor}=="04dd", MODE="0666"

#Sony Ericsson
SUBSYSTEM=="usb", ATTR{idVendor}=="0fce", MODE="0666"

#Toshiba
SUBSYSTEM=="usb", ATTR{idVendor}=="0930", MODE="0666"

#ZTE
SUBSYSTEM=="usb", ATTR{idVendor}=="19D2", MODE="0666"

4) Save the file and close it and then issue this command:

$ sudo chmod a+r /etc/udev/rules.d/51-android.rules

5) Install the repo:

$ mkdir ~/bin
$ PATH=~/bin:$PATH
$ curl https://dl-ssl.google.com/dl/googlesource/git-repo/repo > ~/bin/repo
$ chmod a+x ~/bin/repo

6) Initialize the repo:

$ mkdir WORKING_DIRECTORY (Note the WORKING_DIRECTORY can be named whatever you wan't just don't use a name with spaces!)
$ cd WORKING_DIRECTORY
$ repo init -u https://android.googlesource.com/platform/manifest -b android-4.1.1_r1

6.1) For people who have already done a repo init:

$ cd WORKING_DIRECTORY
$ repo init -b android-4.1.1_r1
$ repo sync

7) When prompted, enter your real name and email address.

8) Gather the files:

$ repo sync

This is not nessesary to do now, this is more a check to see if anything is working properly! (if you know everything is working skip to how to add a device to the list!)

9) Compiling: [CODE]$ source build/envsetup.sh

Or:

$ . build/envsetup.sh

10) Issue:

$ lunch

11) Pick your poison.

12) Now issue (The '#' is the number of cores your processor has plus 1, ex. I have a dual core processor so I type 'make -j3':

$ make -j#

[/CODE]

~How To Add A Device To The List~

1) Find the github for your device you wish to add. In this tutorial we use GalaxyS2 :cowboy:

2) Now navigate to the location you are going clone the device tree to:

$ cd WORKING_DIRECTORY/device
$ mkdir samsung

3) Clone the github device tree from remote to local: in this case i clone the git to non existing folder, this folder will be created if you write etc galaxys2 after the git tree.

$ git clone git://github.com/cleaton/device_samsung_galaxys2 galaxys2

4) Now navigate into the folder:

$ cd galaxys2

5) Connect phone to computer and make sure USB debugging is enabled and you have adb set up.

6) Extract Device Proprietary Files:

$ ./extract-files.sh

7) Navigate back to your home directory for building:

$ cd ~/WORKING_DIRECTORY

Now before doing an buld/evensetup.sh compile, make sure you have the exynos4.mk file its located in hardware/samsung

if you don't have any samsung folder in the hardware folder make sure to clone one from: git clone git://github.com/cleaton/android_hardware_samsung.git -b jb-dirtyfix hardware/samsung (don't use cyanogenmod samsung_hardware as its doesn't have updated drivers!)

8) Prepare To Compile:

$ source build/envsetup.sh

Or:

$ . build/envsetup.sh

9) Get your list of devices:

$ lunch

10) Pick your poison.

11) Now compile:

$ make -j#

Or for a flashable zip:

$ make -j# otapackage

~FIXES~

If you are running into issues such as:

Which would you like? [full-eng] 5
build/core/product_config.mk:209: *** No matches for product "full_shooter". Stop.
Device shooter not found. Attempting to retrieve device repository from CyanogenMod Github (http://github.com/CyanogenMod).
Repository for shooter not found in the CyanogenMod Github repository list. If this is in error, you may need to manually add it to your local_manifest.xml.
build/core/product_config.mk:209: *** No matches for product "full_shooter". Stop.

** Don't have a product spec for: 'full_shooter'
** Do you have the right repo manifest?

What you need to do is to edit your blob to match the PRODUCT_NAME to the file name. For example with mine I have full_shooter.mk therefore in this file I need to have PRODUCT_NAME to match it. Whatever error it is looking for you just need to change the PRODUCT_NAME line to match what the error shows.

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

If you run into issues with Java being the incorrect version here is the fix:

Make sure Java 6 JDK is installed by typing in:

$ java -version

Open the file main.mk in build/core and delete this line from the java error code section:

$(error stop)

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

Change all references in your device repo from frameworks/base to frameworks/native