[GUIDE][AOSPA:v3.+] How to Compile AOSPA from Source : + Support and Maintenance

Status
Not open for further replies.
Search This thread

gokussjx

Senior Member
Jul 7, 2011
2,061
4,910
/home/bidyut
NOTE: The method explained here is to be followed for compiling ParanoidAndroid v3.+
The process is WIP.
Feel free to try & compile, post your results/errors here. Community effort would make this a lot faster.
:)

WELCOME TO PARANOIDANDROID
Source Compilation Guide v3.+


pax3u3k.png



Hello, & welcome to a complete reference guide on compiling ParanoidAndroid from source!
I've been getting a lot of mails & PMs, asking for help on PA compilation. I could only help 3 of them, after which, it wasn't feasible for me.
So, here we are, as promised! :cowboy:

This guide will walk you through each & every step involved in compiling the ROM, right after the stage of installing Ubuntu.
This is to help you all explore your own development domains. :)

Remember, I'm NOT responsible if something, or anything goes wrong at your end, on any device or system.




I, & others, will try & help you out whenever possible. If there's some delay, don't whine or complain, just have patience & you'll be helped.
I can't practically reach out to everybody, but I'll try my best.

So, with that,
Good Luck :good:





------------------Pre-requisites------------------


Make sure you have:

  • Ubuntu 12.04 (Precise Pangolin) 64-bit
  • Decent Computer, with at least 4GB RAM
  • Decent Internet (Trust me... you DON'T want to do this on a 512 kbits connection...)
  • Functional Device Tree, Hardware tree, Kernel source tree for your device
  • Device with support for latest CM10.2/AOSP 4.3 Jellybean




------------------Steps Involved------------------


Step 1: Download the sources

Step 2: Add device support to PA, & Builiding ROM

Step 3: The After-life: Git, Gerrit, Patch Submissions





------------------Lets Start :cowboy: ------------------

STEP 1: Downloading the Sources


For the curious kind, here's some theoretical information:

Before compiling any ROM, we need some basic 'stuffs', or tools if you may.
In short, here's what we need:

1) Compile Dependencies (libs)
2) Python 2.7.3
3) Java JDK 6.xx
4) Android SDK
5) USB Configs
6) Git, Repo
7) Project Sources
8) CM10.2/JellyBean Device Tree
9) Device Kernel Tree
10) Device Hardware sources
11) Device Vendor Proprietaries




# Install OpenSSL, for Python:
Code:
$ sudo apt-get install libssl1.0.0=1.0.1-4ubuntu5.3
$ sudo apt-get install libssl-dev


# Install Dependencies:

There are some dependencies that might not be useful. But just in case, I'm gonna give you all dependencies that any Android compilation would need. Its better than facing errors while compiling.


Code:
$ sudo apt-get install git-core gnupg flex bison gperf build-essential \
  zip curl zlib1g-dev zlib1g-dev:i386 libc6-dev lib32ncurses5-dev \
  ia32-libs x11proto-core-dev libx11-dev:i386 libreadline6-dev:i386 \
  lib32z-dev libgl1-mesa-dev g++-multilib mingw32 \
  tofrodos python-markdown libxml2-utils xsltproc readline-common \
  libreadline6-dev libreadline6 lib32readline-gplv2-dev libncurses5-dev \
  lib32readline5 lib32readline6 libreadline-dev libreadline6-dev:i386 \
  libreadline6:i386 bzip2 libbz2-dev libbz2-1.0 libghc-bzlib-dev lib32bz2-dev \
  libsdl1.2-dev libesd0-dev squashfs-tools pngcrush schedtool libwxgtk2.6-dev


Code:
$ sudo ln -s /usr/lib/i386-linux-gnu/mesa/libGL.so.1 /usr/lib/i386-linux-gnu/libGL.so



# Configure USB:

1) Open/Create file 51-android.rules:
Code:
$ gksudo gedit /etc/udev/rules.d/51-android.rules

-> Add these lines:

Code:
#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"


2) Save & Close

3) Set proper permisisons: (Provide read permission to all users, in addition to whatever other permissions are pre-set)
Code:
$ sudo chmod a+r /etc/udev/rules.d/51-android.rules


# JAVA JDK Installation:

1) Download & keep aside the latest Oracle Java 6 JDK. (I dislike OpenJDK. Feel free to use it if you prefer that ;) )
Remember: WE NEED JAVA 6, not any other version (5 or 7 etc). Or this will not work for you.

http://www.oracle.com/technetwork/java/javase/downloads/jdk6-downloads-1637591.html

2) Remove other JAVA Packages:

Code:
$ sudo apt-get purge openjdk-\* icedtea-\* icedtea6-\*

3) Install JAVA JDK:

Code:
$ sudo mkdir -p /opt/java/64/
$ sudo cp jdk-6u[COLOR="Red"]##[/COLOR]-linux-x64.bin /opt/java/64
$ sudo su -
$ cd /opt/java/64
$ chmod +x jdk-6u[COLOR="red"]##[/COLOR]-linux-x64.bin
$ ./jdk-6u[COLOR="red"]##[/COLOR]-linux-x64.bin
$ exit

REPLACE THE HASHes (#) WITH YOUR VERSION NUMBER.

-> Save & Exit

4) Add JDK PATH to .bashrc:

Code:
$ gksudo gedit ~/.bashrc

-> Add these lines:

Code:
# Java PATHs
export JAVA_HOME=/opt/java/64/jdk1.6.0_[COLOR="red"]##[/COLOR]
export PATH=$PATH:$JAVA_HOME/bin

REPLACE THE HASHes (#) WITH YOUR VERSION NUMBER.


# Python Installation:

For Python installation, I give you two choices. Pick whichever you like. But pick ANY ONE.

Option 1: Direct package installation: (Easy way)
Code:
$ sudo apt-get install python

-----OR------

Option 2: Self compile Python from source: (Advanced way. Not recommended if you have no experience with software compilation)

1) Download Python 2.7.3:

http://www.python.org/ftp/python/2.7.3/Python-2.7.3.tgz

-> For 2.7 you need to explicitly enable SSL after running the ./configure script and before running make:

2) Configure Python:

Code:
$ ./configure

3) Navigate to & open Modules/Setup.
There are lines like this:

Code:
#SSL=/usr/local/ssl
#_ssl _ssl.c \
#       -DUSE_SSL -I$(SSL)/include -I$(SSL)/include/openssl \
#       -L$(SSL)/lib -lssl -lcrypto

4) Uncomment these lines and change the SSL variable to /usr:

Code:
SSL=/usr
_ssl _ssl.c \
       -DUSE_SSL -I$(SSL)/include -I$(SSL)/include/openssl \
       -L$(SSL)/lib -lssl -lcrypto

5) Install Python:

Code:
$ make
$ sudo make install

6) Add Python PATH to .bashrc:
Code:
$ gksudo gedit .bashrc

-> Add these lines:
Code:
# Python
export PATH=/usr/bin:$PATH
-> Save & Exit


# Android SDK:

1) Download the SDK here:

http://developer.android.com/sdk/index.html

2) Extract the SDK and place it in your home directory.

3) Add AndroidSDK PATH to .bashrc:
Code:
$ gksudo gedit .bashrc

-> Add the following lines:
Code:
# Android tools
export PATH=${PATH}:~/android-sdk/tools
export PATH=${PATH}:~/android-sdk/platform-tools
export PATH=${PATH}:~/bin
->Save & Exit

4) Add PATH to .profile:
Code:
$ gksudo gedit .profile

-> Add these lines:
Code:
PATH="$HOME/android-sdk/tools:$HOME/android-sdk/platform-tools:$PATH"
-> Save & Exit


*To use the ADB Update software (or to verify a working adb path), use the following command:

Code:
$ android


# Install the Repo:

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


# Initialize the ParanoidAndroid Repo:

Code:
$ mkdir android
$ cd android
$ mkdir system
$ cd system
$ repo init -u git://github.com/ParanoidAndroid/manifest.git -b [B]jb43-legacy[/B]



VERY IMPORTANT: Now, before the final stage sync, make sure there's no code referring to 'ParanoidPreferences' in manifest.

To check that

1) Open your File Browser,
2) Press Ctrl+H (to show hidden files/directories)
3) Navigate to android/system/.repo/manifest.xml
(Right Click & open the XML file in text editor)

*REMOVE ANY 'PARANOIDPREFERENCES' CODE FROM MANIFEST*
*REMOVE GROUPER DEVICE TREE FROM MANIFEST* (This'll be useless, unless you're compiling for Grouper: Nexus 7)


-> Now, Lets add the device specific trees:


Add your own device tree, kernel tree, hardware source tree, & vendor proprietaries tree in the local manifest.

For this, create a new file .repo/local_manifest.xml, & use something in similar terms:

For example, I'm using all corresponding trees for Samsung Galaxy S3 i9300 - International
Following is just an example, not what you should copy/paste. SEARCH & USE YOUR OWN DEVICE SPECIFIC TREES.
Code:
<?xml version="1.0" encoding="UTF-8"?>
<manifest>
  <project name="ParanoidAndroid/android_device_samsung_i9300" path="device/samsung/i9300" remote="github" revision="cm-10.2" />
  <project name="CyanogenMod/android_kernel_samsung_smdk4412" path="kernel/samsung/smdk4412" remote="github" revision="cm-10.2" />
  <project name="ParanoidAndroid/android_device_samsung_smdk4412-common" path="device/samsung/smdk4412-common" remote="github" revision="cm-10.2" />
  <project name="TheMuppets/proprietary_vendor_samsung" path="vendor/samsung" remote="github" revision="cm-10.2" />
  <project name="CyanogenMod/android_packages_apps_SamsungServiceMode" path="packages/apps/SamsungServiceMode" remote="github" revision="cm-10.2" />
  <project name="CyanogenMod/android_hardware_samsung" path="hardware/samsung" remote="github" revision="cm-10.2" />
</manifest>

CAUTION: Your device tree, kernel source, vendor props etc WILL be different. Search & find out where your device specific sources are located.



# Sync the Repo
Code:
$ repo sync [COLOR="Red"]<-parameters->[/COLOR]

Now, here's a reference to the repo sync parameters:

“make” command has ‘-j’ option to run multi jobs parallely. “repo sync” has similar option, too.
Let’s examine command line help:

Code:
$ [B]repo sync[/B] [COLOR="Red"]-h[/COLOR]
Usage: repo sync [...]

Options:
  [COLOR="red"]-h[/COLOR], [COLOR="red"]--help[/COLOR]            show this help message and exit
  [COLOR="red"]-f[/COLOR], [COLOR="red"]--force-broken[/COLOR]    continue sync even if a project fails to sync
  [COLOR="red"]-l[/COLOR], [COLOR="red"]--local-only[/COLOR]      only update working tree, don't fetch
  [COLOR="red"]-n[/COLOR], [COLOR="red"]--network-only[/COLOR]    fetch only, don't update working tree
  [COLOR="red"]-d[/COLOR], [COLOR="red"]--detach[/COLOR]          detach projects back to manifest revision
  [COLOR="red"]-q[/COLOR], [COLOR="red"]--quiet[/COLOR]           be more quiet
  [COLOR="red"]-j[/COLOR][COLOR="SeaGreen"]JOBS[/COLOR], [COLOR="red"]--jobs[/COLOR]=[COLOR="SeaGreen"]JOBS[/COLOR]   number of projects to fetch simultaneously
  [COLOR="red"]-s[/COLOR], [COLOR="red"]--smart-sync[/COLOR]      smart sync using manifest from a known good build

  repo Version options:
    [COLOR="red"]--no-repo-verify[/COLOR]    do not verify repo source code

So, for instance, if you want to run 8 fetching jobs parallelly,
Code:
$ repo sync [COLOR="Red"]-j[/COLOR][COLOR="SeaGreen"]8[/COLOR]

I personally use -j4, due to my awful internet. You may use any no. of jobs value, like -j16.
This can reduce the download time. However, this'll suck lots of the bandwidth of the network. Just so you know ;)



Now that you have the sources, its time to deal with the precompilation & compilation steps :cowboy:
Move on to Post 2.



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


Credits:

- molesarecoming
- D4rKn3sSyS
- dastin1015
- Perka
- pmos69
- ProTekk (Rootzwiki)
 
Last edited:

gokussjx

Senior Member
Jul 7, 2011
2,061
4,910
/home/bidyut
STEP 2: Adding device support to PA, & Building ROM:

STEP 2: Adding device support to PA, & Building ROM:

I've tried to provide you a basic guideline. You might need to make some changes according to the files/device you have.
If your device already has the support, skip to Instruction to compile the ROM.

NOTE: Throughout this guide, I'll be using the device name as '<device>', & in red. So, if the device is 'pa_i9100', I'm using a generic name: 'pa_<device>'. This means, replace the red <device> with your device name, as per your JellyBean Device Tree


After you've the complete source, you need some prebuilts & additional props, & the script needs to know of the existence of the device (<device>) you want to compile for.

For additional prebuilts & props extraction, look for a extraction script.
In some devices, we have 'extract-files.sh', in others we have 'proprietary-files.sh'. There might be other names for the script as well. Just go through make sure you know which one it is.

For example, in case of Galaxy S3 i9300:

You get to the device source, by navigating to android/system/device/samsung/i9300/, & using the script: "proprietary-files.sh"
Here's what you do:

1) Connect your device, running working CM10/AOSP JB, with Android Debugging ACTIVATED.

2) Make the script executable, after cd to device/samsung/i9300:
Code:
$ cd android/system/device/[COLOR="red"]samsung[/COLOR]/[COLOR="red"]i9300[/COLOR]
$ chmod +x [COLOR="Red"]proprietary-files.sh[/COLOR]

3) Execute the script, in terminal:
Code:
$ ./[COLOR="red"]proprietary-files.sh[/COLOR]

----------------------------------------------------DEVICE SPECIFIC CHANGES----------------------------------------------------

Next, here's an overview of what PA needs you to do to allow compilation for your device:


(Everything here is to be done under /vendor/pa)

* Create /manifest/<device>.adds
* Create /manifest/<device>.removes
* Create /prebuilt/pa_<device>.conf
* Create /products/pa_<device>.mk
* Add device makefile entry to /products/AndroidProducts.mk
* Create /vendorprops/<device>.proprietaries
* Add device lunch menu entry to /vendorsetup.sh



Again, lets start:

# Create /manifest/<device>.adds:

I'll give you two examples of .adds, to show the general extent of variation between devices:

For i9300:
Code:
[
    {
        "remote":       "github",
        "account":      "CyanogenMod",
        "repository":   "android_frameworks_av",
        "target_path":  "frameworks/av",
        "revision":     "cm-10.1"
    },
    {
        "remote":       "github",
        "account":      "CyanogenMod",
        "repository":   "android_frameworks_native",
        "target_path":  "frameworks/native",
        "revision":     "cm-10.1"
    },
    {
        "remote":       "github",
        "account":      "CyanogenMod",
        "repository":   "android_hardware_libhardware",
        "target_path":  "hardware/libhardware",
        "revision":     "cm-10.1"
    },
    {
        "remote":       "github",
        "account":      "CyanogenMod",
        "repository":   "android_hardware_libhardware_legacy",
        "target_path":  "hardware/libhardware_legacy",
        "revision":     "cm-10.1"
    },
    {
        "remote":       "github",
        "account":      "CyanogenMod",
        "repository":   "android_frameworks_opt_telephony",
        "target_path":  "frameworks/opt/telephony",
        "revision":     "cm-10.1"
    },
    {
        "remote":       "github",
        "account":      "CyanogenMod",
        "repository":   "android_device_common",
        "target_path":  "device/common",
        "revision":     "cm-10.1"
    },
    {
        "remote":       "github",
        "account":      "CyanogenMod",
        "repository":   "android_device_generic_armv7-a-neon",
        "target_path":  "device/generic/armv7-a-neon",
	"revision":     "cm-10.1"
    },
    {
        "remote":       "github",
        "account":      "CyanogenMod",
        "repository":   "android_device_generic_common",
        "target_path":  "device/generic/common",
        "revision":     "cm-10.1"
    }
]

For bravo:
Code:
[
    {
        "remote":       "github",
        "account":      "WoH",
        "repository":   "android_bionic",
        "target_path":  "bionic",
        "revision":     "jellybean"
    },
    {
        "remote":       "github",
        "account":      "Evervolv",
        "repository":   "android_external_wpa_supplicant_8",
        "target_path":  "external/wpa_supplicant_8",
        "revision":     "jellybean"
    },
    {
        "remote":       "github",
        "account":      "Evervolv",
        "repository":   "android_frameworks_av",
        "target_path":  "frameworks/av",
        "revision":     "jellybean"
    },
    {
        "remote":       "github",
        "account":      "WoH",
        "repository":   "android_frameworks_base",
        "target_path":  "frameworks/base",
        "revision":     "jellybean"
    },
    {
        "remote":       "github",
        "account":      "Evervolv",
        "repository":   "android_frameworks_native",
        "target_path":  "frameworks/native",
        "revision":     "jellybean"
    },
    {
        "remote":       "github",
        "account":      "Evervolv",
        "repository":   "android_hardware_atheros",
        "target_path":  "hardware/atheros",
        "revision":     "jellybean"
    },
    {
        "remote":       "github",
        "account":      "Evervolv",
        "repository":   "android_hardware_gpsshim",
        "target_path":  "hardware/gpsshim",
        "revision":     "jellybean"
    },
    {
        "remote":       "github",
        "account":      "Evervolv",
        "repository":   "android_hardware_libhardware",
        "target_path":  "hardware/libhardware",
        "revision":     "jellybean"
    },
    {
        "remote":       "github",
        "account":      "Evervolv",
        "repository":   "android_hardware_libhardware_legacy",
        "target_path":  "hardware/libhardware_legacy",
        "revision":     "jellybean"
    },
    {
        "remote":       "github",
        "account":      "Evervolv",
        "repository":   "android_hardware_ril",
        "target_path":  "hardware/ril",
        "revision":     "jellybean"
    },
    {
        "remote":       "github",
        "account":      "Evervolv",
        "repository":   "android_hardware_qcom_audio",
        "target_path":  "hardware/qcom/audio",
        "revision":     "jellybean"
    },
    {
        "remote":       "github",
        "account":      "Evervolv",
        "repository":   "android_hardware_qcom_audio-legacy",
        "target_path":  "hardware/qcom/audio-legacy",
        "revision":     "jellybean"
    },
    {
        "remote":       "github",
        "account":      "Evervolv",
        "repository":   "android_hardware_qcom_bt",
        "target_path":  "hardware/qcom/bt",
        "revision":     "jellybean"
    },
    {
        "remote":       "github",
        "account":      "Evervolv",
        "repository":   "android_hardware_qcom_camera",
        "target_path":  "hardware/qcom/camera",
        "revision":     "jellybean"
    },
    {
        "remote":       "github",
        "account":      "Evervolv",
        "repository":   "android_hardware_qcom_display",
        "target_path":  "hardware/qcom/display",
        "revision":     "jellybean"
    },
    {
        "remote":       "github",
        "account":      "Evervolv",
        "repository":   "android_hardware_qcom_display-caf",
        "target_path":  "hardware/qcom/display-caf",
        "revision":     "jellybean"
    },
    {
        "remote":       "github",
        "account":      "Evervolv",
        "repository":   "android_hardware_qcom_display-legacy",
        "target_path":  "hardware/qcom/display-legacy",
        "revision":     "jellybean"
    },
    {
        "remote":       "github",
        "account":      "Evervolv",
        "repository":   "android_hardware_qcom_gps",
        "target_path":  "hardware/qcom/gps",
        "revision":     "jellybean"
    },
    {
        "remote":       "github",
        "account":      "Evervolv",
        "repository":   "android_hardware_qcom_gps-legacy",
        "target_path":  "hardware/qcom/gps-legacy",
        "revision":     "jellybean"
    },
    {
        "remote":       "github",
        "account":      "Evervolv",
        "repository":   "android_hardware_qcom_keymaster",
        "target_path":  "hardware/qcom/keymaster",
        "revision":     "jellybean"
    },
    {
        "remote":       "github",
        "account":      "Evervolv",
        "repository":   "android_hardware_qcom_media",
        "target_path":  "hardware/qcom/media",
        "revision":     "jellybean"
    },
    {
        "remote":       "github",
        "account":      "Evervolv",
        "repository":   "android_hardware_qcom_media-legacy",
        "target_path":  "hardware/qcom/media-legacy",
        "revision":     "jellybean"
    },
    {
        "remote":       "github",
        "account":      "Evervolv",
        "repository":   "android_hardware_qcom_power",
        "target_path":  "hardware/qcom/power",
        "revision":     "jellybean"
    },
    {
        "remote":       "github",
        "account":      "Evervolv",
        "repository":   "android_hardware_qcom_sensors",
        "target_path":  "hardware/qcom/sensors",
        "revision":     "jellybean"
    },
    {
        "remote":       "github",
        "account":      "Evervolv",
        "repository":   "android_hardware_qcom_wlan",
        "target_path":  "hardware/qcom/wlan",
        "revision":     "jellybean"
    },
    {
        "remote":       "github",
        "account":      "Evervolv",
        "repository":   "android_system_bluetooth",
        "target_path":  "system/bluetooth",
        "revision":     "jellybean"
    },
    {
        "remote":       "github",
        "account":      "WoH",
        "repository":   "android_system_core",
        "target_path":  "system/core",
        "revision":     "jellybean"
    },
    {
        "remote":       "github",
        "account":      "Evervolv",
        "repository":   "android_system_extras",
        "target_path":  "system/extras",
        "revision":     "jellybean"
    },
    {
        "remote":       "github",
        "account":      "Evervolv",
        "repository":   "android_system_security",
        "target_path":  "system/security",
        "revision":     "jellybean"
    },
    {
        "remote":       "github",
        "account":      "Evervolv",
        "repository":   "android_system_vold",
        "target_path":  "system/vold",
        "revision":     "jellybean"
    },
    {
        "remote":       "github",
        "account":      "WoH",
        "repository":   "android_frameworks_opt_telephony",
        "target_path":  "frameworks/opt/telephony",
        "revision":     "jellybean"
    },
    {
        "remote":       "github",
        "account":      "Evervolv",
        "repository":   "android_device_common",
        "target_path":  "device/common",
        "revision":     "jellybean"
    },
    {
        "remote":       "github",
        "account":      "CyanogenMod",
        "repository":   "android_device_generic_armv7-a-neon",
        "target_path":  "device/generic/armv7-a-neon",
        "revision":     "cm-10.1"
    },
    {
        "remote":       "github",
        "account":      "CyanogenMod",
        "repository":   "android_device_generic_common",
        "target_path":  "device/generic/common",
        "revision":     "cm-10.1"
    },
    {
        "remote":       "github",
        "account":      "Evervolv",
        "repository":   "android_device_generic_goldfish",
        "target_path":  "device/generic/goldfish",
        "revision":     "jellybean"
    }
]

You may use the i9300 as the base .adds, & make changes, add/remove/modify as per your device requirements.


# Create /manifest/<device>.removes:

Another example based explanation:

For i9300:
Code:
[
    {
        "name":     "platform/frameworks/av",
        "path":     "frameworks/av"
    },
    {
        "name":     "ParanoidAndroid/android_frameworks_native",
        "path":     "frameworks/native"
    },
    {
        "name":     "platform/hardware/libhardware",
        "path":     "hardware/libhardware"
    },
    {
        "name":     "platform/hardware/libhardware_legacy",
        "path":     "hardware/libhardware_legacy"
    },
    {
        "name":     "device/common",
        "path":     "device/common"
    },
    {
        "name":     "ParanoidAndroid/android_frameworks_opt_telephony",
        "path":     "frameworks/opt/telephony"
    }
]

For bravo:
Code:
[
    {
        "name":     "ParanoidAndroid/android_bionic",
        "path":     "bionic"
    },
    {
        "name":     "platform/external/wpa_supplicant_8",
        "path":     "external/wpa_supplicant_8"
    },
    {
        "name":     "platform/frameworks/av",
        "path":     "frameworks/av"
    },
    {
        "name":     "ParanoidAndroid/android_frameworks_base",
        "path":     "frameworks/base"
    },
    {
        "name":     "ParanoidAndroid/android_frameworks_native",
        "path":     "frameworks/native"
    },
    {
        "name":     "platform/hardware/ril",
        "path":     "hardware/ril"
    },
    {
        "name":     "platform/hardware/libhardware",
        "path":     "hardware/libhardware"
    },
    {
        "name":     "platform/hardware/libhardware_legacy",
        "path":     "hardware/libhardware_legacy"
    },
    {
        "name":     "platform/system/bluetooth",
        "path":     "system/bluetooth"
    },
    {
        "name":     "ParanoidAndroid/android_system_core",
        "path":     "system/core"
    },
    {
        "name":     "platform/system/extras",
        "path":     "system/extras"
    },
    {
        "name":     "platform/system/security",
        "path":     "system/security"
    },
    {
        "name":     "platform/system/vold",
        "path":     "system/vold"
    },
    {
        "name":     "device/common",
        "path":     "device/common"
    },
    {
        "name":     "ParanoidAndroid/android_frameworks_opt_telephony",
        "path":     "frameworks/opt/telephony"
    }
]

Basically, you need to remove the official manifest bits that you replaced/overlayed using the <device>.adds, for your device


# Create /prebuilt/pa_<device>.conf:

-> For an HDPI device, use the pa_hdpi.conf
-> For an XHDPI device WITH Hardware buttons, use pa_i9300.conf
-> For an XHDPI device WITHOUT Hardware buttons, use the pa_xhdpi.conf


# Create /products/pa_<device>.mk:

Open, & paste the following: (Read the instruction after this code)(All RED LETTERED parts vary from device to device. Use your own values)

Code:
# Copyright (C) 2012 ParanoidAndroid Project
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
#      http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.

# Check for target product
ifeq (pa_[COLOR="Red"]<device>[/COLOR],$(TARGET_PRODUCT))

# Define PA bootanimation size
PARANOID_BOOTANIMATION_NAME := [COLOR="red"]XHDPI[/COLOR] [B]OR[/B] [COLOR="red"]HDPI[/COLOR]

# OVERLAY_TARGET adds overlay asset source
OVERLAY_TARGET := pa_[COLOR="red"]xhdpi[/COLOR] [B]OR[/B] pa_[COLOR="red"]i9300[/COLOR] [B]OR[/B] pa_[COLOR="red"]hdpi[/COLOR]

# Build paprefs from sources
PREFS_FROM_SOURCE ?= false

# Include ParanoidAndroid common configuration
include vendor/pa/config/pa_common.mk

# Inherit AOSP device configuration
$(call inherit-product, device/[COLOR="red"]<device-manufacturer>[/COLOR]/[COLOR="Red"]<device>[/COLOR]/full_[COLOR="Red"]<device>[/COLOR].mk)

# Product Package Extras - Repos can be added manually or via addprojects.py
-include vendor/pa/packages/[COLOR="Red"]<device>[/COLOR].mk

# CM Package Extras
-include vendor/pa/packages/cm.mk

# Override AOSP build properties
PRODUCT_NAME := pa_[COLOR="Red"]<device>[/COLOR]
PRODUCT_BRAND := [COLOR="red"]<device-manufacturer>[/COLOR]
PRODUCT_MODEL := [COLOR="red"]<Official Device Name, Eg: [COLOR="RoyalBlue"]GT-I9300[/COLOR]>[/COLOR]
PRODUCT_MANUFACTURER := [COLOR="Red"]<device-manufacturer>[/COLOR]
PRODUCT_BUILD_PROP_OVERRIDES += PRODUCT_NAME=[COLOR="red"]<product-name as per CyanogenMod>[/COLOR] TARGET_DEVICE=[COLOR="red"]<target-device as per CyanogenMod>[/COLOR] BUILD_FINGERPRINT="[COLOR="red"]<As per CM>[/COLOR]" PRIVATE_BUILD_DESC="[COLOR="red"]<As per CM>[/COLOR]"

# Update local_manifest.xml
GET_VENDOR_PROPS := $(shell vendor/pa/tools/getvendorprops.py $(PRODUCT_NAME))
GET_PROJECT_RMS := $(shell vendor/pa/tools/removeprojects.py $(PRODUCT_NAME))
GET_PROJECT_ADDS := $(shell vendor/pa/tools/addprojects.py $(PRODUCT_NAME))
GET_CM_PROJECT_ADDS := $(shell vendor/pa/tools/addprojects.py cm.adds)

endif

-> Change the inherit device config directory to device/.... (wherever you've kept your device tree)(could change as per manufact: Samsung, Sony, Motorola etc)

-> Change OVERLAY_TARGET value as per your device pixel density

-> Save & Exit


# Add device makefile entry to /products/AndroidProducts.mk:

Append this at the end:
Code:
ifeq (pa_[COLOR="Red"]<device>[/COLOR],$(TARGET_PRODUCT))
    PRODUCT_MAKEFILES += $(LOCAL_DIR)/pa_[COLOR="red"]<device>[/COLOR].mk
endif

-> Use your device name in place of <device>
-> Save & Exit.



# Create /vendorprops/<device>.proprietaries:

1) Now, navigate to your_workspace/vendor/pa/vendorprops

2) Make a new file, & name it '<device>.proprietaries'

3) You need to point the script towards your device's proprietary vendor files from your manufacturer.

Example of what Samsung's looks like.
(Do some research on google, github, forums etc, & find out your required tree/configs.)

Here's i9300.proprietaries code: (Same for all Samsung devices)
Code:
[
    {
        "remote":       "github",
        "account":      "TheMuppets",
        "repository":   "proprietary_vendor_samsung",
        "target_path":  "vendor/samsung",
        "revision":     "cm-10.1"
    },
    {
        "remote":       "github",
        "account":      "CyanogenMod",
        "repository":   "android_packages_apps_SamsungServiceMode",
        "target_path":  "packages/apps/SamsungServiceMode",
        "revision":     "cm-10.1"
    },
    {
        "remote":       "github",
        "account":      "CyanogenMod",
        "repository":   "android_hardware_samsung",
        "target_path":  "hardware/samsung",
        "revision":     "cm-10.1"
    },
    {
        "remote":       "github",
        "account":      "ParanoidAndroid",
        "repository":   "android_device_samsung_smdk4412-common",
        "target_path":  "device/samsung/smdk4412-common",
        "revision":     "cm-10.1"
    }
]

These are your device specific props that'll get added to local manifest.

If you've added all such prop sources in <device>.adds, no need to add duplicate entries to <device>.proprietaries
Just create the file & paste the following in the proprietaries file:
Code:
[
]

-> Make your changes
-> Save & Exit.

# Add device lunch menu entry to /vendorsetup.sh:

1) Navigate to android/system/vendor/pa, & open 'vendorsetup.sh' (Just right click, open in Text Editor)

2) Append this line :
Code:
add_lunch_combo pa_[COLOR="Red"]<device>[/COLOR]-userdebug

That's it!
Make sure you also have all the hardware, kernel, device specific files, blobs, prebuilts, extracts etc before hand, & set the addresses accordingly.

You've come so far, & here's the final punch.
Build the ROM:

# Build the ROM:


-> For building ParanoidAndroid you must cd to the working directory. Make sure you have your device tree sources, located on:
Code:
$ cd ~/android/system/device/[COLOR="Red"]-manufacturer-[/COLOR]/[COLOR="red"]-device-[/COLOR]

-> Now you can run the build script:
Code:
$ cd ~/android/system
$ ./rom-build.sh [COLOR="red"]-device-[/COLOR]

-> You can also use a second parameter for syncing sources before building

Code:
# ./rom-build.sh [COLOR="red"]-device-[/COLOR] [B]true[/B]


-> There are also a few parameters that you can use together with before mentioned:

threads: Allows to choose a number of threads for syncing operation
clean: Removes intermediates and output files
The usage is the same

Code:
$ ./rom-build.sh [COLOR="red"]-device-[/COLOR] [B]-parameters-[/B] [B]-sync-[/B]

(Parameters will be considered false unless you set them to true)


This will generate a signed zip located at ~/android/system/out/target/product/-device-
(This'll take a while, depending on your processor speed, & memory. On 3GHz Quad Core Processor, with 4GB RAM, it takes me 71-75 minutes to get the final ZIP. If your configs are higher, it'll take you less)


Congratulations! You've successfully compiled ParanoidAndroid for your device!

-> That's it. You're done! You can test your build by flashing the output zip via CWM.
:good: :laugh:

Disclaimer:
It shouldn't be necessary to mention but well, Paranoid-Settings is meant for Official Paranoid Android only, or ports that stay true to our vision. It is not meant to be included in other ROMs or Kangs - unless we give permission. This is our good name that people pull through the mud when they mix it with conflicting source like aokp. Hybrid engine and dpi changer will only result in a crappy user experience for the end-user. Hybrid relies on a clean system and does not change its DPI, thats the whole point of it. Furthermore hybrid engine is huge and complicated to kang because it grew over half a year and hundreds of commits, resets, reverts, rewrites. The only real hybrid engine is the result of a clean repo init and .rom-build.sh devicename.
Kangs and ROMs that don't have our permission can either write their own implementation (its really just a text file reader/writer), or adopt on the old paprefs version in the ICS branch, which is 100% opensource. Hybrid engine is 100% open source as well, of course. :cool:
 
Last edited:

gokussjx

Senior Member
Jul 7, 2011
2,061
4,910
/home/bidyut
STEP 3: The After-life: Git, Gerrit, Patch Submissions:

-Credits to D4rKn3sSyS, for the Git tutorial below-




STEP 3: The After-life: Git, Gerrit, Patch Submissions:


As many of you know, our gerrit is officially up since a few days ago here, so here's a simple how-to for pushing changes to gerrit, mostly taken from here.

If you make any changes, or want to officially maintain PA for a new device, this is where you upload your changes.



You must create a gerrit account first, and add your ssh keys to Settings > SSH Public Keys

Guide on how to generate ssh keys (Only generating part, ignore adding to github)

https://help.github.com/articles/generating-ssh-keys



# Submitting changes:

1) First, you need to start a topic branch. This 'branch' holds the changes you make to the files on your computer that you will ultimately send to the ParanoidAndroid servers for review. Create your topic branch:

Code:
$ repo start [COLOR="Red"]<branch name> <project name>[/COLOR]
Note: This starts a new branch called '<branch name>' in the '<project name>' project. Replace <project name> with the name of your target repository instead.

2) Now, you can cd to the project (directory) that contains the file(s) you want to edit:
Code:
$ cd ~/android/system/[COLOR="red"]path/to/project[/COLOR]

Now you can make your changes. Make sure you do not edit any files before you run repo start, or your changes will happen on a different branch and will not be tracked correctly.


3) After you make your changes, you can commit them just as you would normally:
Code:
$ git add -A
$ git commit -a
$ cd ~/android/system

4) Now you can upload your changes to the ParanoidAndroid server:
Code:
$ repo upload [COLOR="red"]<project name>[/COLOR]

That's it! Your change will be reviewed and may be accepted or rejected.



ProTip: The first line of your commit message will become the Change's Title. Add a blank space after the Title and write the summary of changes there. Make sure that the change's title and summary width do not exceed 80 chars per line.




# Submitting patch sets:

-> It's a common case. Your patch has issues or errors, which are noted in the code review, so you will want to resolve them. Sometimes it's just tabs instead of spaces or typos in strings and variable names.

-> Before you edit those files, type in
Code:
$ git branch -v
to make sure you are on the correct branch.

-> If you are not in the correct branch or in no branch at all, type in
Code:
$ git checkout [COLOR="red"][branchname][/COLOR]
to switch to the correct branch.

-> Now you can edit the files. After you made your changes, do the usual
Code:
$ git status
and notice that git diff will only show you the changes you just made. Once you are satisfied, you can prepare the upload.

-> Add the files that you've modified by using
Code:
$ git add -A
.

-> To Upload, type in
Code:
$ git commit --amend
.
This will open an editor with your initial commit message.

-> You can also change the commit message if you want to, but make sure the last two lines stay as are. They contain the initial commit ID and a blank line. With this id, Gerrit will detect your upload as a patch set and not as a new patch.

-> You can do

Code:
$ git log
and
Code:
$ git status
again.

Notice how Git handles your initial commit and the commit using --amend as one patch. Same for git show. It will show you all the changes, your initial patch & the patch set you just committed, as one patch.

-> Now you can submit you patch set to your initial patch with
Code:
$ repo upload [COLOR="red"]<project name>[/COLOR]


ProTip: If this fails and you get two different reviews on gerrit, abandon the oldest one, you make reviewer life easier!.





# How to know latest commit ID on github project:

-> Open project, example, for frameworks:

https://github.com/ParanoidAndroid/android_frameworks_base

Youll see this, wich is latest commit ID

commit-id.jpg





---Common issues---

  • Permission denied (publickey): Make sure you have ssh keys and your local git username matchs with gerrit username. Is everything correct but you still have issues?, try with "ssh-add" command, or changing your RSA key by a DSA key
  • no branches ready for upload: you must do the following steps
    Code:
    $ cd ~/android/system
    $ repo abandon [COLOR="red"]<branch> <project>[/COLOR]
    $ repo start [COLOR="red"]<branch> <project>[/COLOR]
    $ cd ~/android/system/[COLOR="red"]path/to/project[/COLOR]
    $ git reset --hard [COLOR="Red"]<latest-github-commit-id>[/COLOR]

    MAKE OR RESTORE YOUR CHANGES AND COMMIT

    Code:
    $ cd ~/android/system
    $ repo upload [COLOR="red"]<project>[/COLOR]

 
Last edited:

quentin330

Senior Member
Feb 24, 2012
453
406
Bordeaux
Thank you for this really, that's exactly what I needed =D
Do I really need 4GB RAM? If not will it just take longer or really don't work?
 
  • Like
Reactions: isabeleza

DaXmax

Senior Member
Sep 16, 2008
10,846
9,928
Singapore
Thank you for this really, that's exactly what I needed =D
Do I really need 4GB RAM? If not will it just take longer or really don't work?

It depends. If you have more space on HDD, you can enable ccache...

P.S Ccache really boosted up your device builds. ;)

---------- Post added at 04:49 AM ---------- Previous post was at 04:47 AM ----------


*cough* ParanoidPreferences *cough*

*cough* Submit patch to gerrit *cough*
 

gokussjx

Senior Member
Jul 7, 2011
2,061
4,910
/home/bidyut
reserved ;)


well done, I spotted a small error:

Code:
$ mkdir android
$ mkdir system
$ cd android/system


you should cd into android first ;)

Nice spotting! :good:

Correction made:

Code:
$ mkdir android
$ cd android
$ mkdir system
$ cd system
$ repo init -u git://github.com/ParanoidAndroid/android.git -b jellybean


Thank you for this really, that's exactly what I needed =D
Do I really need 4GB RAM? If not will it just take longer or really don't work?

Well, Minimum RAM requirement of a 64bit Operating System is 4GB. ;)

If you can't even run the OS smoothly, its gonna be nigh on impossible to compile ROMs on it.
Its best you have at least that much RAM.
However convincing one might sound saying you can compile on less than 4GB.. trust me, its not gonna be pleasant.
 
Last edited:

gokussjx

Senior Member
Jul 7, 2011
2,061
4,910
/home/bidyut
*cough* ParanoidPreferences *cough*

*cough* Submit patch to gerrit *cough*

Lol! Yeah, totally forgot about that! xD
I'm way too drowzy to write today... :eek:

Anyway, will update the OP :good:

(I mean just the ParanoidPrefernces. I'll be including git & gerrit basics for submitting to PA as well, in this very thread, But tomorrow morning. Gotta write much more than just 'submit your patch here & here.')
 
Last edited:

gokussjx

Senior Member
Jul 7, 2011
2,061
4,910
/home/bidyut
It depends. If you have more space on HDD, you can enable ccache...

P.S Ccache really boosted up your device builds. ;)


DaX, CCache is a Compiler Cache. Its neither Physical Address Extension, & nor is it a SWAP/ZRAM. Its not a RAM replacement, & nor is it a supplement.

It'll boost the compile speed, but low RAM will still tax the hell outta the compiling system. There's serious risk of overheat, & damage in extreme case. Compiling, is one of the heaviest computer resource user, apart from Animations & Gaming ;)
 
Last edited:

Crenshaw-PCGH

Senior Member
Mar 19, 2012
338
154
"Now, Lets add the device specific trees:

Add your own device tree, kernel tree, hardware source tree, & vendor proprietaries tree in the manifest. (BEFORE the manifest closing tags)

For example, I'm using all corresponding trees for Samsung Galaxy S3 i9300 - International
Following is just an example, not what you should copy/paste. SEARCH & USE YOUR OWN DEVICE SPECIFIC TREES."

Where to find these "trees" ? :eek:
I have a xperia arc and iḿ not sure there to find the information?
 
Last edited:

gokussjx

Senior Member
Jul 7, 2011
2,061
4,910
/home/bidyut
"Now, Lets add the device specific trees:

Add your own device tree, kernel tree, hardware source tree, & vendor proprietaries tree in the manifest. (BEFORE the manifest closing tags)

For example, I'm using all corresponding trees for Samsung Galaxy S3 i9300 - International
Following is just an example, not what you should copy/paste. SEARCH & USE YOUR OWN DEVICE SPECIFIC TREES."

Where to find these "trees" ? :eek:
I have an xperia arc and iḿ not sure there to find the information?

Roughly speaking, Trees are chunks of sources, for specific purpose, which can be independently used or merged. Every Tree has branches based on its version. For example, Branch can be Gingerbread, ICS, ICS-Release, JellyBean, General etc.

Xperia Arc, LT15i Anzu? Your CM10 Jellybean device tree is this one: https://github.com/CyanogenMod/android_device_semc_anzu/tree/jellybean
 

Crenshaw-PCGH

Senior Member
Mar 19, 2012
338
154
Roughly speaking, Trees are chunks of sources, for specific purpose, which can be independently used or merged. Every Tree has branches based on its version. For example, Branch can be Gingerbread, ICS, ICS-Release, JellyBean, General etc.

Xperia Arc, LT15i Anzu? Your CM10 Jellybean device tree is this one: https://github.com/CyanogenMod/android_device_semc_anzu/tree/jellybean

Okay i think i understood :)

Thanks a lot!

Sorry im still confused where to find the right files.. like kernel etc
 
Last edited:

DaXmax

Senior Member
Sep 16, 2008
10,846
9,928
Singapore
DaX, CCache is a Compiler Cache. Its neither Physical Address Extension, & nor is it a SWAP/ZRAM. Its not a RAM replacement, & nor is it a supplement.

It'll boost the compile speed, but low RAM will still tax the hell outta the compiling system. There's serious risk of overheat, & damage in extreme case. Compiling, is one of the heaviest computer resource user, apart from Animations & Gaming ;)

Well, it doesn't overheats quickly as i've recently installed super fans around it. :p
 

gokussjx

Senior Member
Jul 7, 2011
2,061
4,910
/home/bidyut
Well, it doesn't overheats quickly as i've recently installed super fans around it. :p

The topic in hand was about RAMs lesser than 4GB!
You don't count in. Stop that gloating already xD

And CCache is useful only after first compile, & if you don't remove the previous leftovers.
Also, no JAVA support, only C/C++.

Anyway, it works, & is worth it. Keep using it.
 

DaXmax

Senior Member
Sep 16, 2008
10,846
9,928
Singapore
The topic in hand was about RAMs lesser than 4GB!
You don't count in. Stop that gloating already xD

And CCache is useful only after first compile, & if you don't remove the previous leftovers.
Also, no JAVA support, only C/C++.

Anyway, it works, & is worth it. Keep using it.

Keep up the good info about Paranoid, thanks.
 

sthomas38

Senior Member
Feb 9, 2012
695
524
Takes 140 minutes on my old dual-core Athlon 64 with 3 Gb RAM :p.

Envoyé depuis mon GT-I9000 avec Tapatalk
 
Status
Not open for further replies.

Top Liked Posts

  • There are no posts matching your filters.
  • 210
    NOTE: The method explained here is to be followed for compiling ParanoidAndroid v3.+
    The process is WIP.
    Feel free to try & compile, post your results/errors here. Community effort would make this a lot faster.
    :)

    WELCOME TO PARANOIDANDROID
    Source Compilation Guide v3.+


    pax3u3k.png



    Hello, & welcome to a complete reference guide on compiling ParanoidAndroid from source!
    I've been getting a lot of mails & PMs, asking for help on PA compilation. I could only help 3 of them, after which, it wasn't feasible for me.
    So, here we are, as promised! :cowboy:

    This guide will walk you through each & every step involved in compiling the ROM, right after the stage of installing Ubuntu.
    This is to help you all explore your own development domains. :)

    Remember, I'm NOT responsible if something, or anything goes wrong at your end, on any device or system.




    I, & others, will try & help you out whenever possible. If there's some delay, don't whine or complain, just have patience & you'll be helped.
    I can't practically reach out to everybody, but I'll try my best.

    So, with that,
    Good Luck :good:





    ------------------Pre-requisites------------------


    Make sure you have:

    • Ubuntu 12.04 (Precise Pangolin) 64-bit
    • Decent Computer, with at least 4GB RAM
    • Decent Internet (Trust me... you DON'T want to do this on a 512 kbits connection...)
    • Functional Device Tree, Hardware tree, Kernel source tree for your device
    • Device with support for latest CM10.2/AOSP 4.3 Jellybean




    ------------------Steps Involved------------------


    Step 1: Download the sources

    Step 2: Add device support to PA, & Builiding ROM

    Step 3: The After-life: Git, Gerrit, Patch Submissions





    ------------------Lets Start :cowboy: ------------------

    STEP 1: Downloading the Sources


    For the curious kind, here's some theoretical information:

    Before compiling any ROM, we need some basic 'stuffs', or tools if you may.
    In short, here's what we need:

    1) Compile Dependencies (libs)
    2) Python 2.7.3
    3) Java JDK 6.xx
    4) Android SDK
    5) USB Configs
    6) Git, Repo
    7) Project Sources
    8) CM10.2/JellyBean Device Tree
    9) Device Kernel Tree
    10) Device Hardware sources
    11) Device Vendor Proprietaries




    # Install OpenSSL, for Python:
    Code:
    $ sudo apt-get install libssl1.0.0=1.0.1-4ubuntu5.3
    $ sudo apt-get install libssl-dev


    # Install Dependencies:

    There are some dependencies that might not be useful. But just in case, I'm gonna give you all dependencies that any Android compilation would need. Its better than facing errors while compiling.


    Code:
    $ sudo apt-get install git-core gnupg flex bison gperf build-essential \
      zip curl zlib1g-dev zlib1g-dev:i386 libc6-dev lib32ncurses5-dev \
      ia32-libs x11proto-core-dev libx11-dev:i386 libreadline6-dev:i386 \
      lib32z-dev libgl1-mesa-dev g++-multilib mingw32 \
      tofrodos python-markdown libxml2-utils xsltproc readline-common \
      libreadline6-dev libreadline6 lib32readline-gplv2-dev libncurses5-dev \
      lib32readline5 lib32readline6 libreadline-dev libreadline6-dev:i386 \
      libreadline6:i386 bzip2 libbz2-dev libbz2-1.0 libghc-bzlib-dev lib32bz2-dev \
      libsdl1.2-dev libesd0-dev squashfs-tools pngcrush schedtool libwxgtk2.6-dev


    Code:
    $ sudo ln -s /usr/lib/i386-linux-gnu/mesa/libGL.so.1 /usr/lib/i386-linux-gnu/libGL.so



    # Configure USB:

    1) Open/Create file 51-android.rules:
    Code:
    $ gksudo gedit /etc/udev/rules.d/51-android.rules

    -> Add these lines:

    Code:
    #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"


    2) Save & Close

    3) Set proper permisisons: (Provide read permission to all users, in addition to whatever other permissions are pre-set)
    Code:
    $ sudo chmod a+r /etc/udev/rules.d/51-android.rules


    # JAVA JDK Installation:

    1) Download & keep aside the latest Oracle Java 6 JDK. (I dislike OpenJDK. Feel free to use it if you prefer that ;) )
    Remember: WE NEED JAVA 6, not any other version (5 or 7 etc). Or this will not work for you.

    http://www.oracle.com/technetwork/java/javase/downloads/jdk6-downloads-1637591.html

    2) Remove other JAVA Packages:

    Code:
    $ sudo apt-get purge openjdk-\* icedtea-\* icedtea6-\*

    3) Install JAVA JDK:

    Code:
    $ sudo mkdir -p /opt/java/64/
    $ sudo cp jdk-6u[COLOR="Red"]##[/COLOR]-linux-x64.bin /opt/java/64
    $ sudo su -
    $ cd /opt/java/64
    $ chmod +x jdk-6u[COLOR="red"]##[/COLOR]-linux-x64.bin
    $ ./jdk-6u[COLOR="red"]##[/COLOR]-linux-x64.bin
    $ exit

    REPLACE THE HASHes (#) WITH YOUR VERSION NUMBER.

    -> Save & Exit

    4) Add JDK PATH to .bashrc:

    Code:
    $ gksudo gedit ~/.bashrc

    -> Add these lines:

    Code:
    # Java PATHs
    export JAVA_HOME=/opt/java/64/jdk1.6.0_[COLOR="red"]##[/COLOR]
    export PATH=$PATH:$JAVA_HOME/bin

    REPLACE THE HASHes (#) WITH YOUR VERSION NUMBER.


    # Python Installation:

    For Python installation, I give you two choices. Pick whichever you like. But pick ANY ONE.

    Option 1: Direct package installation: (Easy way)
    Code:
    $ sudo apt-get install python

    -----OR------

    Option 2: Self compile Python from source: (Advanced way. Not recommended if you have no experience with software compilation)

    1) Download Python 2.7.3:

    http://www.python.org/ftp/python/2.7.3/Python-2.7.3.tgz

    -> For 2.7 you need to explicitly enable SSL after running the ./configure script and before running make:

    2) Configure Python:

    Code:
    $ ./configure

    3) Navigate to & open Modules/Setup.
    There are lines like this:

    Code:
    #SSL=/usr/local/ssl
    #_ssl _ssl.c \
    #       -DUSE_SSL -I$(SSL)/include -I$(SSL)/include/openssl \
    #       -L$(SSL)/lib -lssl -lcrypto

    4) Uncomment these lines and change the SSL variable to /usr:

    Code:
    SSL=/usr
    _ssl _ssl.c \
           -DUSE_SSL -I$(SSL)/include -I$(SSL)/include/openssl \
           -L$(SSL)/lib -lssl -lcrypto

    5) Install Python:

    Code:
    $ make
    $ sudo make install

    6) Add Python PATH to .bashrc:
    Code:
    $ gksudo gedit .bashrc

    -> Add these lines:
    Code:
    # Python
    export PATH=/usr/bin:$PATH
    -> Save & Exit


    # Android SDK:

    1) Download the SDK here:

    http://developer.android.com/sdk/index.html

    2) Extract the SDK and place it in your home directory.

    3) Add AndroidSDK PATH to .bashrc:
    Code:
    $ gksudo gedit .bashrc

    -> Add the following lines:
    Code:
    # Android tools
    export PATH=${PATH}:~/android-sdk/tools
    export PATH=${PATH}:~/android-sdk/platform-tools
    export PATH=${PATH}:~/bin
    ->Save & Exit

    4) Add PATH to .profile:
    Code:
    $ gksudo gedit .profile

    -> Add these lines:
    Code:
    PATH="$HOME/android-sdk/tools:$HOME/android-sdk/platform-tools:$PATH"
    -> Save & Exit


    *To use the ADB Update software (or to verify a working adb path), use the following command:

    Code:
    $ android


    # Install the Repo:

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


    # Initialize the ParanoidAndroid Repo:

    Code:
    $ mkdir android
    $ cd android
    $ mkdir system
    $ cd system
    $ repo init -u git://github.com/ParanoidAndroid/manifest.git -b [B]jb43-legacy[/B]



    VERY IMPORTANT: Now, before the final stage sync, make sure there's no code referring to 'ParanoidPreferences' in manifest.

    To check that

    1) Open your File Browser,
    2) Press Ctrl+H (to show hidden files/directories)
    3) Navigate to android/system/.repo/manifest.xml
    (Right Click & open the XML file in text editor)

    *REMOVE ANY 'PARANOIDPREFERENCES' CODE FROM MANIFEST*
    *REMOVE GROUPER DEVICE TREE FROM MANIFEST* (This'll be useless, unless you're compiling for Grouper: Nexus 7)


    -> Now, Lets add the device specific trees:


    Add your own device tree, kernel tree, hardware source tree, & vendor proprietaries tree in the local manifest.

    For this, create a new file .repo/local_manifest.xml, & use something in similar terms:

    For example, I'm using all corresponding trees for Samsung Galaxy S3 i9300 - International
    Following is just an example, not what you should copy/paste. SEARCH & USE YOUR OWN DEVICE SPECIFIC TREES.
    Code:
    <?xml version="1.0" encoding="UTF-8"?>
    <manifest>
      <project name="ParanoidAndroid/android_device_samsung_i9300" path="device/samsung/i9300" remote="github" revision="cm-10.2" />
      <project name="CyanogenMod/android_kernel_samsung_smdk4412" path="kernel/samsung/smdk4412" remote="github" revision="cm-10.2" />
      <project name="ParanoidAndroid/android_device_samsung_smdk4412-common" path="device/samsung/smdk4412-common" remote="github" revision="cm-10.2" />
      <project name="TheMuppets/proprietary_vendor_samsung" path="vendor/samsung" remote="github" revision="cm-10.2" />
      <project name="CyanogenMod/android_packages_apps_SamsungServiceMode" path="packages/apps/SamsungServiceMode" remote="github" revision="cm-10.2" />
      <project name="CyanogenMod/android_hardware_samsung" path="hardware/samsung" remote="github" revision="cm-10.2" />
    </manifest>

    CAUTION: Your device tree, kernel source, vendor props etc WILL be different. Search & find out where your device specific sources are located.



    # Sync the Repo
    Code:
    $ repo sync [COLOR="Red"]<-parameters->[/COLOR]

    Now, here's a reference to the repo sync parameters:

    “make” command has ‘-j’ option to run multi jobs parallely. “repo sync” has similar option, too.
    Let’s examine command line help:

    Code:
    $ [B]repo sync[/B] [COLOR="Red"]-h[/COLOR]
    Usage: repo sync [...]
    
    Options:
      [COLOR="red"]-h[/COLOR], [COLOR="red"]--help[/COLOR]            show this help message and exit
      [COLOR="red"]-f[/COLOR], [COLOR="red"]--force-broken[/COLOR]    continue sync even if a project fails to sync
      [COLOR="red"]-l[/COLOR], [COLOR="red"]--local-only[/COLOR]      only update working tree, don't fetch
      [COLOR="red"]-n[/COLOR], [COLOR="red"]--network-only[/COLOR]    fetch only, don't update working tree
      [COLOR="red"]-d[/COLOR], [COLOR="red"]--detach[/COLOR]          detach projects back to manifest revision
      [COLOR="red"]-q[/COLOR], [COLOR="red"]--quiet[/COLOR]           be more quiet
      [COLOR="red"]-j[/COLOR][COLOR="SeaGreen"]JOBS[/COLOR], [COLOR="red"]--jobs[/COLOR]=[COLOR="SeaGreen"]JOBS[/COLOR]   number of projects to fetch simultaneously
      [COLOR="red"]-s[/COLOR], [COLOR="red"]--smart-sync[/COLOR]      smart sync using manifest from a known good build
    
      repo Version options:
        [COLOR="red"]--no-repo-verify[/COLOR]    do not verify repo source code

    So, for instance, if you want to run 8 fetching jobs parallelly,
    Code:
    $ repo sync [COLOR="Red"]-j[/COLOR][COLOR="SeaGreen"]8[/COLOR]

    I personally use -j4, due to my awful internet. You may use any no. of jobs value, like -j16.
    This can reduce the download time. However, this'll suck lots of the bandwidth of the network. Just so you know ;)



    Now that you have the sources, its time to deal with the precompilation & compilation steps :cowboy:
    Move on to Post 2.



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


    Credits:

    - molesarecoming
    - D4rKn3sSyS
    - dastin1015
    - Perka
    - pmos69
    - ProTekk (Rootzwiki)
    95
    STEP 2: Adding device support to PA, & Building ROM:

    STEP 2: Adding device support to PA, & Building ROM:

    I've tried to provide you a basic guideline. You might need to make some changes according to the files/device you have.
    If your device already has the support, skip to Instruction to compile the ROM.

    NOTE: Throughout this guide, I'll be using the device name as '<device>', & in red. So, if the device is 'pa_i9100', I'm using a generic name: 'pa_<device>'. This means, replace the red <device> with your device name, as per your JellyBean Device Tree


    After you've the complete source, you need some prebuilts & additional props, & the script needs to know of the existence of the device (<device>) you want to compile for.

    For additional prebuilts & props extraction, look for a extraction script.
    In some devices, we have 'extract-files.sh', in others we have 'proprietary-files.sh'. There might be other names for the script as well. Just go through make sure you know which one it is.

    For example, in case of Galaxy S3 i9300:

    You get to the device source, by navigating to android/system/device/samsung/i9300/, & using the script: "proprietary-files.sh"
    Here's what you do:

    1) Connect your device, running working CM10/AOSP JB, with Android Debugging ACTIVATED.

    2) Make the script executable, after cd to device/samsung/i9300:
    Code:
    $ cd android/system/device/[COLOR="red"]samsung[/COLOR]/[COLOR="red"]i9300[/COLOR]
    $ chmod +x [COLOR="Red"]proprietary-files.sh[/COLOR]

    3) Execute the script, in terminal:
    Code:
    $ ./[COLOR="red"]proprietary-files.sh[/COLOR]

    ----------------------------------------------------DEVICE SPECIFIC CHANGES----------------------------------------------------

    Next, here's an overview of what PA needs you to do to allow compilation for your device:


    (Everything here is to be done under /vendor/pa)

    * Create /manifest/<device>.adds
    * Create /manifest/<device>.removes
    * Create /prebuilt/pa_<device>.conf
    * Create /products/pa_<device>.mk
    * Add device makefile entry to /products/AndroidProducts.mk
    * Create /vendorprops/<device>.proprietaries
    * Add device lunch menu entry to /vendorsetup.sh



    Again, lets start:

    # Create /manifest/<device>.adds:

    I'll give you two examples of .adds, to show the general extent of variation between devices:

    For i9300:
    Code:
    [
        {
            "remote":       "github",
            "account":      "CyanogenMod",
            "repository":   "android_frameworks_av",
            "target_path":  "frameworks/av",
            "revision":     "cm-10.1"
        },
        {
            "remote":       "github",
            "account":      "CyanogenMod",
            "repository":   "android_frameworks_native",
            "target_path":  "frameworks/native",
            "revision":     "cm-10.1"
        },
        {
            "remote":       "github",
            "account":      "CyanogenMod",
            "repository":   "android_hardware_libhardware",
            "target_path":  "hardware/libhardware",
            "revision":     "cm-10.1"
        },
        {
            "remote":       "github",
            "account":      "CyanogenMod",
            "repository":   "android_hardware_libhardware_legacy",
            "target_path":  "hardware/libhardware_legacy",
            "revision":     "cm-10.1"
        },
        {
            "remote":       "github",
            "account":      "CyanogenMod",
            "repository":   "android_frameworks_opt_telephony",
            "target_path":  "frameworks/opt/telephony",
            "revision":     "cm-10.1"
        },
        {
            "remote":       "github",
            "account":      "CyanogenMod",
            "repository":   "android_device_common",
            "target_path":  "device/common",
            "revision":     "cm-10.1"
        },
        {
            "remote":       "github",
            "account":      "CyanogenMod",
            "repository":   "android_device_generic_armv7-a-neon",
            "target_path":  "device/generic/armv7-a-neon",
    	"revision":     "cm-10.1"
        },
        {
            "remote":       "github",
            "account":      "CyanogenMod",
            "repository":   "android_device_generic_common",
            "target_path":  "device/generic/common",
            "revision":     "cm-10.1"
        }
    ]

    For bravo:
    Code:
    [
        {
            "remote":       "github",
            "account":      "WoH",
            "repository":   "android_bionic",
            "target_path":  "bionic",
            "revision":     "jellybean"
        },
        {
            "remote":       "github",
            "account":      "Evervolv",
            "repository":   "android_external_wpa_supplicant_8",
            "target_path":  "external/wpa_supplicant_8",
            "revision":     "jellybean"
        },
        {
            "remote":       "github",
            "account":      "Evervolv",
            "repository":   "android_frameworks_av",
            "target_path":  "frameworks/av",
            "revision":     "jellybean"
        },
        {
            "remote":       "github",
            "account":      "WoH",
            "repository":   "android_frameworks_base",
            "target_path":  "frameworks/base",
            "revision":     "jellybean"
        },
        {
            "remote":       "github",
            "account":      "Evervolv",
            "repository":   "android_frameworks_native",
            "target_path":  "frameworks/native",
            "revision":     "jellybean"
        },
        {
            "remote":       "github",
            "account":      "Evervolv",
            "repository":   "android_hardware_atheros",
            "target_path":  "hardware/atheros",
            "revision":     "jellybean"
        },
        {
            "remote":       "github",
            "account":      "Evervolv",
            "repository":   "android_hardware_gpsshim",
            "target_path":  "hardware/gpsshim",
            "revision":     "jellybean"
        },
        {
            "remote":       "github",
            "account":      "Evervolv",
            "repository":   "android_hardware_libhardware",
            "target_path":  "hardware/libhardware",
            "revision":     "jellybean"
        },
        {
            "remote":       "github",
            "account":      "Evervolv",
            "repository":   "android_hardware_libhardware_legacy",
            "target_path":  "hardware/libhardware_legacy",
            "revision":     "jellybean"
        },
        {
            "remote":       "github",
            "account":      "Evervolv",
            "repository":   "android_hardware_ril",
            "target_path":  "hardware/ril",
            "revision":     "jellybean"
        },
        {
            "remote":       "github",
            "account":      "Evervolv",
            "repository":   "android_hardware_qcom_audio",
            "target_path":  "hardware/qcom/audio",
            "revision":     "jellybean"
        },
        {
            "remote":       "github",
            "account":      "Evervolv",
            "repository":   "android_hardware_qcom_audio-legacy",
            "target_path":  "hardware/qcom/audio-legacy",
            "revision":     "jellybean"
        },
        {
            "remote":       "github",
            "account":      "Evervolv",
            "repository":   "android_hardware_qcom_bt",
            "target_path":  "hardware/qcom/bt",
            "revision":     "jellybean"
        },
        {
            "remote":       "github",
            "account":      "Evervolv",
            "repository":   "android_hardware_qcom_camera",
            "target_path":  "hardware/qcom/camera",
            "revision":     "jellybean"
        },
        {
            "remote":       "github",
            "account":      "Evervolv",
            "repository":   "android_hardware_qcom_display",
            "target_path":  "hardware/qcom/display",
            "revision":     "jellybean"
        },
        {
            "remote":       "github",
            "account":      "Evervolv",
            "repository":   "android_hardware_qcom_display-caf",
            "target_path":  "hardware/qcom/display-caf",
            "revision":     "jellybean"
        },
        {
            "remote":       "github",
            "account":      "Evervolv",
            "repository":   "android_hardware_qcom_display-legacy",
            "target_path":  "hardware/qcom/display-legacy",
            "revision":     "jellybean"
        },
        {
            "remote":       "github",
            "account":      "Evervolv",
            "repository":   "android_hardware_qcom_gps",
            "target_path":  "hardware/qcom/gps",
            "revision":     "jellybean"
        },
        {
            "remote":       "github",
            "account":      "Evervolv",
            "repository":   "android_hardware_qcom_gps-legacy",
            "target_path":  "hardware/qcom/gps-legacy",
            "revision":     "jellybean"
        },
        {
            "remote":       "github",
            "account":      "Evervolv",
            "repository":   "android_hardware_qcom_keymaster",
            "target_path":  "hardware/qcom/keymaster",
            "revision":     "jellybean"
        },
        {
            "remote":       "github",
            "account":      "Evervolv",
            "repository":   "android_hardware_qcom_media",
            "target_path":  "hardware/qcom/media",
            "revision":     "jellybean"
        },
        {
            "remote":       "github",
            "account":      "Evervolv",
            "repository":   "android_hardware_qcom_media-legacy",
            "target_path":  "hardware/qcom/media-legacy",
            "revision":     "jellybean"
        },
        {
            "remote":       "github",
            "account":      "Evervolv",
            "repository":   "android_hardware_qcom_power",
            "target_path":  "hardware/qcom/power",
            "revision":     "jellybean"
        },
        {
            "remote":       "github",
            "account":      "Evervolv",
            "repository":   "android_hardware_qcom_sensors",
            "target_path":  "hardware/qcom/sensors",
            "revision":     "jellybean"
        },
        {
            "remote":       "github",
            "account":      "Evervolv",
            "repository":   "android_hardware_qcom_wlan",
            "target_path":  "hardware/qcom/wlan",
            "revision":     "jellybean"
        },
        {
            "remote":       "github",
            "account":      "Evervolv",
            "repository":   "android_system_bluetooth",
            "target_path":  "system/bluetooth",
            "revision":     "jellybean"
        },
        {
            "remote":       "github",
            "account":      "WoH",
            "repository":   "android_system_core",
            "target_path":  "system/core",
            "revision":     "jellybean"
        },
        {
            "remote":       "github",
            "account":      "Evervolv",
            "repository":   "android_system_extras",
            "target_path":  "system/extras",
            "revision":     "jellybean"
        },
        {
            "remote":       "github",
            "account":      "Evervolv",
            "repository":   "android_system_security",
            "target_path":  "system/security",
            "revision":     "jellybean"
        },
        {
            "remote":       "github",
            "account":      "Evervolv",
            "repository":   "android_system_vold",
            "target_path":  "system/vold",
            "revision":     "jellybean"
        },
        {
            "remote":       "github",
            "account":      "WoH",
            "repository":   "android_frameworks_opt_telephony",
            "target_path":  "frameworks/opt/telephony",
            "revision":     "jellybean"
        },
        {
            "remote":       "github",
            "account":      "Evervolv",
            "repository":   "android_device_common",
            "target_path":  "device/common",
            "revision":     "jellybean"
        },
        {
            "remote":       "github",
            "account":      "CyanogenMod",
            "repository":   "android_device_generic_armv7-a-neon",
            "target_path":  "device/generic/armv7-a-neon",
            "revision":     "cm-10.1"
        },
        {
            "remote":       "github",
            "account":      "CyanogenMod",
            "repository":   "android_device_generic_common",
            "target_path":  "device/generic/common",
            "revision":     "cm-10.1"
        },
        {
            "remote":       "github",
            "account":      "Evervolv",
            "repository":   "android_device_generic_goldfish",
            "target_path":  "device/generic/goldfish",
            "revision":     "jellybean"
        }
    ]

    You may use the i9300 as the base .adds, & make changes, add/remove/modify as per your device requirements.


    # Create /manifest/<device>.removes:

    Another example based explanation:

    For i9300:
    Code:
    [
        {
            "name":     "platform/frameworks/av",
            "path":     "frameworks/av"
        },
        {
            "name":     "ParanoidAndroid/android_frameworks_native",
            "path":     "frameworks/native"
        },
        {
            "name":     "platform/hardware/libhardware",
            "path":     "hardware/libhardware"
        },
        {
            "name":     "platform/hardware/libhardware_legacy",
            "path":     "hardware/libhardware_legacy"
        },
        {
            "name":     "device/common",
            "path":     "device/common"
        },
        {
            "name":     "ParanoidAndroid/android_frameworks_opt_telephony",
            "path":     "frameworks/opt/telephony"
        }
    ]

    For bravo:
    Code:
    [
        {
            "name":     "ParanoidAndroid/android_bionic",
            "path":     "bionic"
        },
        {
            "name":     "platform/external/wpa_supplicant_8",
            "path":     "external/wpa_supplicant_8"
        },
        {
            "name":     "platform/frameworks/av",
            "path":     "frameworks/av"
        },
        {
            "name":     "ParanoidAndroid/android_frameworks_base",
            "path":     "frameworks/base"
        },
        {
            "name":     "ParanoidAndroid/android_frameworks_native",
            "path":     "frameworks/native"
        },
        {
            "name":     "platform/hardware/ril",
            "path":     "hardware/ril"
        },
        {
            "name":     "platform/hardware/libhardware",
            "path":     "hardware/libhardware"
        },
        {
            "name":     "platform/hardware/libhardware_legacy",
            "path":     "hardware/libhardware_legacy"
        },
        {
            "name":     "platform/system/bluetooth",
            "path":     "system/bluetooth"
        },
        {
            "name":     "ParanoidAndroid/android_system_core",
            "path":     "system/core"
        },
        {
            "name":     "platform/system/extras",
            "path":     "system/extras"
        },
        {
            "name":     "platform/system/security",
            "path":     "system/security"
        },
        {
            "name":     "platform/system/vold",
            "path":     "system/vold"
        },
        {
            "name":     "device/common",
            "path":     "device/common"
        },
        {
            "name":     "ParanoidAndroid/android_frameworks_opt_telephony",
            "path":     "frameworks/opt/telephony"
        }
    ]

    Basically, you need to remove the official manifest bits that you replaced/overlayed using the <device>.adds, for your device


    # Create /prebuilt/pa_<device>.conf:

    -> For an HDPI device, use the pa_hdpi.conf
    -> For an XHDPI device WITH Hardware buttons, use pa_i9300.conf
    -> For an XHDPI device WITHOUT Hardware buttons, use the pa_xhdpi.conf


    # Create /products/pa_<device>.mk:

    Open, & paste the following: (Read the instruction after this code)(All RED LETTERED parts vary from device to device. Use your own values)

    Code:
    # Copyright (C) 2012 ParanoidAndroid Project
    #
    # Licensed under the Apache License, Version 2.0 (the "License");
    # you may not use this file except in compliance with the License.
    # You may obtain a copy of the License at
    #
    #      http://www.apache.org/licenses/LICENSE-2.0
    #
    # Unless required by applicable law or agreed to in writing, software
    # distributed under the License is distributed on an "AS IS" BASIS,
    # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
    # See the License for the specific language governing permissions and
    # limitations under the License.
    
    # Check for target product
    ifeq (pa_[COLOR="Red"]<device>[/COLOR],$(TARGET_PRODUCT))
    
    # Define PA bootanimation size
    PARANOID_BOOTANIMATION_NAME := [COLOR="red"]XHDPI[/COLOR] [B]OR[/B] [COLOR="red"]HDPI[/COLOR]
    
    # OVERLAY_TARGET adds overlay asset source
    OVERLAY_TARGET := pa_[COLOR="red"]xhdpi[/COLOR] [B]OR[/B] pa_[COLOR="red"]i9300[/COLOR] [B]OR[/B] pa_[COLOR="red"]hdpi[/COLOR]
    
    # Build paprefs from sources
    PREFS_FROM_SOURCE ?= false
    
    # Include ParanoidAndroid common configuration
    include vendor/pa/config/pa_common.mk
    
    # Inherit AOSP device configuration
    $(call inherit-product, device/[COLOR="red"]<device-manufacturer>[/COLOR]/[COLOR="Red"]<device>[/COLOR]/full_[COLOR="Red"]<device>[/COLOR].mk)
    
    # Product Package Extras - Repos can be added manually or via addprojects.py
    -include vendor/pa/packages/[COLOR="Red"]<device>[/COLOR].mk
    
    # CM Package Extras
    -include vendor/pa/packages/cm.mk
    
    # Override AOSP build properties
    PRODUCT_NAME := pa_[COLOR="Red"]<device>[/COLOR]
    PRODUCT_BRAND := [COLOR="red"]<device-manufacturer>[/COLOR]
    PRODUCT_MODEL := [COLOR="red"]<Official Device Name, Eg: [COLOR="RoyalBlue"]GT-I9300[/COLOR]>[/COLOR]
    PRODUCT_MANUFACTURER := [COLOR="Red"]<device-manufacturer>[/COLOR]
    PRODUCT_BUILD_PROP_OVERRIDES += PRODUCT_NAME=[COLOR="red"]<product-name as per CyanogenMod>[/COLOR] TARGET_DEVICE=[COLOR="red"]<target-device as per CyanogenMod>[/COLOR] BUILD_FINGERPRINT="[COLOR="red"]<As per CM>[/COLOR]" PRIVATE_BUILD_DESC="[COLOR="red"]<As per CM>[/COLOR]"
    
    # Update local_manifest.xml
    GET_VENDOR_PROPS := $(shell vendor/pa/tools/getvendorprops.py $(PRODUCT_NAME))
    GET_PROJECT_RMS := $(shell vendor/pa/tools/removeprojects.py $(PRODUCT_NAME))
    GET_PROJECT_ADDS := $(shell vendor/pa/tools/addprojects.py $(PRODUCT_NAME))
    GET_CM_PROJECT_ADDS := $(shell vendor/pa/tools/addprojects.py cm.adds)
    
    endif

    -> Change the inherit device config directory to device/.... (wherever you've kept your device tree)(could change as per manufact: Samsung, Sony, Motorola etc)

    -> Change OVERLAY_TARGET value as per your device pixel density

    -> Save & Exit


    # Add device makefile entry to /products/AndroidProducts.mk:

    Append this at the end:
    Code:
    ifeq (pa_[COLOR="Red"]<device>[/COLOR],$(TARGET_PRODUCT))
        PRODUCT_MAKEFILES += $(LOCAL_DIR)/pa_[COLOR="red"]<device>[/COLOR].mk
    endif

    -> Use your device name in place of <device>
    -> Save & Exit.



    # Create /vendorprops/<device>.proprietaries:

    1) Now, navigate to your_workspace/vendor/pa/vendorprops

    2) Make a new file, & name it '<device>.proprietaries'

    3) You need to point the script towards your device's proprietary vendor files from your manufacturer.

    Example of what Samsung's looks like.
    (Do some research on google, github, forums etc, & find out your required tree/configs.)

    Here's i9300.proprietaries code: (Same for all Samsung devices)
    Code:
    [
        {
            "remote":       "github",
            "account":      "TheMuppets",
            "repository":   "proprietary_vendor_samsung",
            "target_path":  "vendor/samsung",
            "revision":     "cm-10.1"
        },
        {
            "remote":       "github",
            "account":      "CyanogenMod",
            "repository":   "android_packages_apps_SamsungServiceMode",
            "target_path":  "packages/apps/SamsungServiceMode",
            "revision":     "cm-10.1"
        },
        {
            "remote":       "github",
            "account":      "CyanogenMod",
            "repository":   "android_hardware_samsung",
            "target_path":  "hardware/samsung",
            "revision":     "cm-10.1"
        },
        {
            "remote":       "github",
            "account":      "ParanoidAndroid",
            "repository":   "android_device_samsung_smdk4412-common",
            "target_path":  "device/samsung/smdk4412-common",
            "revision":     "cm-10.1"
        }
    ]

    These are your device specific props that'll get added to local manifest.

    If you've added all such prop sources in <device>.adds, no need to add duplicate entries to <device>.proprietaries
    Just create the file & paste the following in the proprietaries file:
    Code:
    [
    ]

    -> Make your changes
    -> Save & Exit.

    # Add device lunch menu entry to /vendorsetup.sh:

    1) Navigate to android/system/vendor/pa, & open 'vendorsetup.sh' (Just right click, open in Text Editor)

    2) Append this line :
    Code:
    add_lunch_combo pa_[COLOR="Red"]<device>[/COLOR]-userdebug

    That's it!
    Make sure you also have all the hardware, kernel, device specific files, blobs, prebuilts, extracts etc before hand, & set the addresses accordingly.

    You've come so far, & here's the final punch.
    Build the ROM:

    # Build the ROM:


    -> For building ParanoidAndroid you must cd to the working directory. Make sure you have your device tree sources, located on:
    Code:
    $ cd ~/android/system/device/[COLOR="Red"]-manufacturer-[/COLOR]/[COLOR="red"]-device-[/COLOR]

    -> Now you can run the build script:
    Code:
    $ cd ~/android/system
    $ ./rom-build.sh [COLOR="red"]-device-[/COLOR]

    -> You can also use a second parameter for syncing sources before building

    Code:
    # ./rom-build.sh [COLOR="red"]-device-[/COLOR] [B]true[/B]


    -> There are also a few parameters that you can use together with before mentioned:

    threads: Allows to choose a number of threads for syncing operation
    clean: Removes intermediates and output files
    The usage is the same

    Code:
    $ ./rom-build.sh [COLOR="red"]-device-[/COLOR] [B]-parameters-[/B] [B]-sync-[/B]

    (Parameters will be considered false unless you set them to true)


    This will generate a signed zip located at ~/android/system/out/target/product/-device-
    (This'll take a while, depending on your processor speed, & memory. On 3GHz Quad Core Processor, with 4GB RAM, it takes me 71-75 minutes to get the final ZIP. If your configs are higher, it'll take you less)


    Congratulations! You've successfully compiled ParanoidAndroid for your device!

    -> That's it. You're done! You can test your build by flashing the output zip via CWM.
    :good: :laugh:

    Disclaimer:
    It shouldn't be necessary to mention but well, Paranoid-Settings is meant for Official Paranoid Android only, or ports that stay true to our vision. It is not meant to be included in other ROMs or Kangs - unless we give permission. This is our good name that people pull through the mud when they mix it with conflicting source like aokp. Hybrid engine and dpi changer will only result in a crappy user experience for the end-user. Hybrid relies on a clean system and does not change its DPI, thats the whole point of it. Furthermore hybrid engine is huge and complicated to kang because it grew over half a year and hundreds of commits, resets, reverts, rewrites. The only real hybrid engine is the result of a clean repo init and .rom-build.sh devicename.
    Kangs and ROMs that don't have our permission can either write their own implementation (its really just a text file reader/writer), or adopt on the old paprefs version in the ICS branch, which is 100% opensource. Hybrid engine is 100% open source as well, of course. :cool:
    48
    STEP 3: The After-life: Git, Gerrit, Patch Submissions:

    -Credits to D4rKn3sSyS, for the Git tutorial below-




    STEP 3: The After-life: Git, Gerrit, Patch Submissions:


    As many of you know, our gerrit is officially up since a few days ago here, so here's a simple how-to for pushing changes to gerrit, mostly taken from here.

    If you make any changes, or want to officially maintain PA for a new device, this is where you upload your changes.



    You must create a gerrit account first, and add your ssh keys to Settings > SSH Public Keys

    Guide on how to generate ssh keys (Only generating part, ignore adding to github)

    https://help.github.com/articles/generating-ssh-keys



    # Submitting changes:

    1) First, you need to start a topic branch. This 'branch' holds the changes you make to the files on your computer that you will ultimately send to the ParanoidAndroid servers for review. Create your topic branch:

    Code:
    $ repo start [COLOR="Red"]<branch name> <project name>[/COLOR]
    Note: This starts a new branch called '<branch name>' in the '<project name>' project. Replace <project name> with the name of your target repository instead.

    2) Now, you can cd to the project (directory) that contains the file(s) you want to edit:
    Code:
    $ cd ~/android/system/[COLOR="red"]path/to/project[/COLOR]

    Now you can make your changes. Make sure you do not edit any files before you run repo start, or your changes will happen on a different branch and will not be tracked correctly.


    3) After you make your changes, you can commit them just as you would normally:
    Code:
    $ git add -A
    $ git commit -a
    $ cd ~/android/system

    4) Now you can upload your changes to the ParanoidAndroid server:
    Code:
    $ repo upload [COLOR="red"]<project name>[/COLOR]

    That's it! Your change will be reviewed and may be accepted or rejected.



    ProTip: The first line of your commit message will become the Change's Title. Add a blank space after the Title and write the summary of changes there. Make sure that the change's title and summary width do not exceed 80 chars per line.




    # Submitting patch sets:

    -> It's a common case. Your patch has issues or errors, which are noted in the code review, so you will want to resolve them. Sometimes it's just tabs instead of spaces or typos in strings and variable names.

    -> Before you edit those files, type in
    Code:
    $ git branch -v
    to make sure you are on the correct branch.

    -> If you are not in the correct branch or in no branch at all, type in
    Code:
    $ git checkout [COLOR="red"][branchname][/COLOR]
    to switch to the correct branch.

    -> Now you can edit the files. After you made your changes, do the usual
    Code:
    $ git status
    and notice that git diff will only show you the changes you just made. Once you are satisfied, you can prepare the upload.

    -> Add the files that you've modified by using
    Code:
    $ git add -A
    .

    -> To Upload, type in
    Code:
    $ git commit --amend
    .
    This will open an editor with your initial commit message.

    -> You can also change the commit message if you want to, but make sure the last two lines stay as are. They contain the initial commit ID and a blank line. With this id, Gerrit will detect your upload as a patch set and not as a new patch.

    -> You can do

    Code:
    $ git log
    and
    Code:
    $ git status
    again.

    Notice how Git handles your initial commit and the commit using --amend as one patch. Same for git show. It will show you all the changes, your initial patch & the patch set you just committed, as one patch.

    -> Now you can submit you patch set to your initial patch with
    Code:
    $ repo upload [COLOR="red"]<project name>[/COLOR]


    ProTip: If this fails and you get two different reviews on gerrit, abandon the oldest one, you make reviewer life easier!.





    # How to know latest commit ID on github project:

    -> Open project, example, for frameworks:

    https://github.com/ParanoidAndroid/android_frameworks_base

    Youll see this, wich is latest commit ID

    commit-id.jpg





    ---Common issues---

    • Permission denied (publickey): Make sure you have ssh keys and your local git username matchs with gerrit username. Is everything correct but you still have issues?, try with "ssh-add" command, or changing your RSA key by a DSA key
    • no branches ready for upload: you must do the following steps
      Code:
      $ cd ~/android/system
      $ repo abandon [COLOR="red"]<branch> <project>[/COLOR]
      $ repo start [COLOR="red"]<branch> <project>[/COLOR]
      $ cd ~/android/system/[COLOR="red"]path/to/project[/COLOR]
      $ git reset --hard [COLOR="Red"]<latest-github-commit-id>[/COLOR]

      MAKE OR RESTORE YOUR CHANGES AND COMMIT

      Code:
      $ cd ~/android/system
      $ repo upload [COLOR="red"]<project>[/COLOR]

    14
    --Reserved 4--
    13
    --Reserved 5--