(GUIDE)compiling kernel from source - Android Software/Hacking General [Developers Only]

if you are new to kernel projects then this guide is for you]
im using s5312 source as an example
REQUIREMENTS
* Get ubuntu from here. x64 bit is better in developments http://www.ubuntu.com/download/desktop
* ubuntu 10.1 or later ---> tutorial for installing http://www.youtube.com/watch?v=tDDRFiwHujg
* toolchain arm-eabi-4.6 ---> https://github.com/knzy/arm-eabi-4.6 but you can choose your own supported version (or) variant of toolchains
* time and some unix knowledge
* installing java ---> https://www.digitalocean.com/community/tutorials/how-to-install-java-on-ubuntu-with-apt-get (or) installing offline http://www.wikihow.com/Install-Oracle-Java-on-Ubuntu-Linux
OPEN TERMINAL HERE OPTION
Code:
sudo apt-get install nautilus-open-terminal
Code:
nautilus -q
TO INSTALL JAVA
Code:
sudo add-apt-repository ppa:webupd8team/java
Code:
sudo apt-get update
Code:
sudo apt-get install oracle-java6-installer
Code:
sudo apt-get install oracle-java6-set-default
PROCEDURE
1.MAKE SURE YOU INSTALLED ALL PACKAGES AND SETTED UBUNTU FOR COMPILING
if not ---->
Code:
sudo apt-get install git-core gnupg flex bison gperf build-essential \zip curl zlib1g-dev libc6-dev lib32ncurses5-dev libncurses5-dev x11proto-core-dev \libx11-dev libreadline6-dev lib32readline-gplv2-dev lib32z-dev libgl1-mesa-dev g++-multilib mingw32 tofrodos python python-markdown \libxml2-utils xsltproc pngcrush gcc-multilib lib32z1 schedtool
HOW TO INSTALL ----> for example
open terminal ctrl + alt + t -----> type commandcopy paste whole texts from sudo.....schedtool
TO INSTALL GIT
Code:
sudo apt-get install git
TO INSTALL REPO AND OTHER TOOLS
Code:
sudo apt-get install phablet-tools
LINKING A FILE
Code:
ln -s /usr/lib/i386-linux-gnu/libX11.so.6 /usr/lib/i386-linux-gnu/libX11.so
2.DOWNLOADING SOURCE
samsung ----> http://opensource.samsung.com
sony ----> http://developer.sonymobile.com/knowledge-base/open-source/
LG ----> http://www.lg.com/global/support/opensource/index
HTC ----> http://htcsource.com/
3.TOOLCHAIN
arm-eabi-4.6 --> https://github.com/knzy/arm-eabi-4.6
4.SETTING UP DIRECTORY
* Open a terminal
* Type
Code:
mkdir s5312
* Type
Code:
cd s5312
* Type
Code:
mkdir kernel
* Type
Code:
mkdir toolchains
-------> remove (") while typing
EXTRACT SOURCE IN ----> home/s5312/kernel -->here<---
EXTRACT TOOLCHAIN IN ----> home/s5312/toolchains -->here<---
5. AFTER DOING THE ABOVE OPEN Makefile IN home/s5312/kernel
AND EDIT LIKE MINE---> https://www.dropbox.com/s/wbsb0pr908s3up5/Screenshot%20from%202014-07-06%2008%3A41%3A45.png
6. RUNNING DEFCONFIG FOR FIRST TIME
for example --->
Code:
make bcm21654_rhea_ss_corsica_rev00_defconfig
---->dont use defconfig for second time<---- it needed for first time for enabling the stock features
you can find the stock defconfig in arch/arm//config if not then open ----> KERNEL_README.txt which came along with source
7.ADDING FEATURES
REFER here ---> http://xda-university.com/as-a-developer/adding-features-to-your-kernel
after adding enable in menuconfig by typing in terminal ---> make menuconfig
AFTER refering see go here
*adding governors ---> https://github.com/k2wl/evolution_i9082/commit/0a2476bf7110afce36b3709b46c1ae2a9ffa709f
*adding IO/scheduler--->
-sio https://github.com/NoelMacwan/SXDNickiDS/commit/9e3310bb8cc4330d159ff40e43cda19e3ba62cd1
-fiops https://github.com/NoelMacwan/SXDNickiDS/commit/5f83e803873fb570f9c058f2d33565edeccabce9
-vr https://github.com/NoelMacwan/SXDNickiDS/commit/5f15277f722ce91f09a0b1be59a3e936df8affb5
-zen https://github.com/NoelMacwan/SXDNickiDS/commit/c47ccf11c3021d63396b404219610875e757c2a5
-sio plus https://github.com/NoelMacwan/SXDNickiDS/commit/46584177e0c0760283a42828b3cfd39c804f3d10
*adding drivers ----->
for example powersuspend and autosleep
*adding ------> https://github.com/k2wl/evolution_i9082/commit/529da6e51b306558acabca8f5d15019ffec6f955
*error fix -------> https://github.com/k2wl/evolution_i9082/commit/8aeb30a34a385dbaddbbf9b63658737753d5eb34
if you need more go here --->
https://github.com/karthick111/Hyper_CM11
------>REST YOU HAVE TO SEARCH<------
8.COMPILING
for compiling type "make" or if you have a dualcore or many type accorting to "make -j4" -j4 means compiling source with 4 cores for faster compile
after all now grabbing zimage from -----> arch/arm/boot/--->zimage<---
9.PACKING zimage TO boot.img
* https://github.com/dsixda/Android-Kitchen/tagsdownload andoid kitchen
* extract it to home directory
* type
Code:
cd kitchen
* type
Code:
./menu
* extract "boot.img" you can get it from stock ROM
* then replace with the "zimage" which u got from compiling
10.AFTER MAKING YOUR KERNEL SUCCESSFULLY [optional]
push the source on github or any compliants if you post the kenel in xda forum, You need to have the kernel source
-------> learning about git http://git-scm.com/book
(OR)
-------> PDF http://extincthacker.blogspot.in/2014/07/pro-git.html
important-----> after first build if you want to make another build run "make clean" -----> this command will refresh the source for next compilation
COMMAND USED
* make xxxx_defconfig --------> this command will run the defconfig which will enable stock features
* make menuconfig --------> this command will open a graphical interface which will show the features of source and to enable or disable
* make -j3 (or) -j2 (or) make --------> this command will used when you are finished
* make clean --------> this command will clean the compiled to non compile for another use
* make mrproper ---------> this command will clean every configs
ENJOY
CREDITS
* k2wl
* noel macwan

Reserved

nice guide. and helpful for me.

Nice guide!! Thanks!!

Nice guide bro.... Keep going

Is this updated to lollipop?

nyc guide
Will this work for SC6820 (Spreadtrum) Chipset?
trying now
Thanks

help me bro
karthick mostwanted said:
if you are new to kernel projects then this guide is for you]
Click to expand...
Click to collapse
just tried ur guide but this error occured during installing the required packages
see the screenshots

pritish sahoo said:
just tried ur guide but this error occured during installing the required packages
see the screenshots
Click to expand...
Click to collapse
The error related to your PC not with the guide search any alternate way of installing phablet tools

karthick mostwanted said:
The error related to your PC not with the guide search any alternate way of installing phablet tools
Click to expand...
Click to collapse
thats my pc problem
well i m using ubuntu in Virtual Box & m new to Ubuntu
i have installed Java in Ubuntu but after that that error coming
no idea what to do, any suggetion?

pritish sahoo said:
thats my pc problem
well i m using ubuntu in Virtual Box & m new to Ubuntu
i have installed Java in Ubuntu but after that that error coming
no idea what to do, any suggetion?
Click to expand...
Click to collapse
Apt-cache search phablet-tools

Yes but not with MTK

Related

[GUIDE][DEV] Compile any source built rom for your device [ULTRA NOOB FRIENDLY]

I know there are many other guides avalable regarding this, But I tried to focus on the small points also that many guides overlook
that's why I have this for you. Do let know if I have missed something or more details have to be included in case still there is a difficulty in compiling
This thread on Madteam Forums: http://madteam.co/forum/development...lt-rom-for-your-device-(ultra-noob-friendly)/
So lets start with simple things
Basic FAQ:
Q: What is a Source built rom?
A: Source Built Roms are roms that are compiled from source on a Linux Platform! They are not themed manually.
Q: How do we build these type of roms?
A: Setup Linux and then follow this guide.
Click to expand...
Click to collapse
This post/guide is divided into 4 parts:
1. Setting up build environment
2. Machine specifications etc.
3. Device Tree and source basics
4. Syncing Source and Building
PART 1: Setting up build environment​
Type sudo su and then your password to get rid of Admin Permissions
#Installing Python
STEP 1: Open terminal (CTRL + ALT + T)
Then execute the following commands in terminal one by one
Code:
sudo apt-get install build-essential gcc
cd Downloads
wget http://www.python.org/ftp/python/2.5.6/Python-2.5.6.tgz
tar -xvzf Python-2.5.6.tgz
cd Python-2.5.6
./configure --prefix=/usr/local/python2.5
make
sudo make install
sudo ln -s /usr/local/python2.5/bin/python /usr/bin/python2.5
Now Python is configured
#Installing JDK
As far as I know PPA which was the earlier method of installing JDK etc. doesn't exist's anymore, So I used another way!
Step 1: Open Terminal (CTRL + ALT + T)
STEP 2: Now we need to download the JDK 6 Binary by executing this command in terminal
Code:
wget --no-check-certificate --no-cookies --header "Cookie: gpw_e24=http%3A%2F%2Fwww.oracle.com" "http://download.oracle.com/otn-pub/java/jdk/6u45-b06/jdk-6u45-linux-x64.bin"
STEP 3: Then we need to run the binary and move it to a shared location:
Code:
chmod +x jdk-6u45-linux-x64.bin
sudo ./jdk-6u45-linux-x64.bin
sudo mv jdk1.6.0_45 /usr/lib/jvm/
STEP 4: Now you have to install all binaries and give them highest priority, This will also overwrite the previous version of Java Binaries in your computer
Code:
sudo update-alternatives --install /usr/bin/java java /usr/lib/jvm/jdk1.6.0_45/bin/java 1
sudo update-alternatives --install /usr/bin/javac javac /usr/lib/jvm/jdk1.6.0_45/bin/javac 1
sudo update-alternatives --install /usr/bin/javaws javaws /usr/lib/jvm/jdk1.6.0_45/bin/javaws 1
sudo update-alternatives --install /usr/bin/jar jar /usr/lib/jvm/jdk1.6.0_45/bin/jar 1
sudo update-alternatives --install /usr/bin/javadoc javadoc /usr/lib/jvm/jdk1.6.0_45/bin/javadoc 1
STEP 5: Now check if JDK 1.6 is selected on this:
Code:
sudo update-alternatives --config java
sudo update-alternatives --config javac
sudo update-alternatives --config javaws
sudo update-alternatives --config jar
sudo update-alternatives --config javadoc
Now JDK is configured! To check if it is done
Execute this is Terminal
Code:
java -version
Output will be similar to this
Code:
java version "1.6.0_45"
Java(TM) SE Runtime Environment (build 1.6.0_45-b06)
Java HotSpot(TM) 64-Bit Server VM (build 20.45-b01, mixed mode)
#Installing GNU Make
Code:
cd Downloads
wget -o make.tar.gz http://ftp.gnu.org/gnu/make/make-3.81.tar.gz
tar -xvzf make-3.81.tar.gz
cd make-3.82
./configure
sudo make install
These commands are for Make 1.81 if you want to install Make 1.82 Execute these
Code:
cd
wget -o make.tar.gz http://ftp.gnu.org/gnu/make/make-3.82.tar.gz
tar -xvzf make-3.82.tar.gz
cd make-3.82
./configure
sudo make install
Now GNU make is configures
#Installing Android SDK
STEP ONE: Download the SDK from http://developer.android.com/sdk/index.html and extract it in a folder called "sdk" in the Downloads folder
STEP TWO: Now, Execute these commands in terminal
Code:
cd ~/Downloads/sdk/tools/
./android sdk
SDK is configured now :victory:
#Installing required packages:
STEP 1: Open Terminal
Now execute these commands:
Code:
apt-get install git-core gnupg flex bison gperf build-essential \
zip curl zlib1g-dev libc6-dev libncurses5-dev x11proto-core-dev \
libx11-dev libreadline6-dev libgl1-mesa-dev tofrodos python-markdown \
libxml2-utils xsltproc pngcrush gcc-multilib lib32z1 schedtool
Good, Now you have successfully setup linux build environment!​
PART 2: Machine specifications and other misc. stuff​
Basic Computer Specs:
2Ghz Dual Core Processor
2GB Minimum ram
50GB File Space (For only one rom source)
*PLEASE NOTE*: This is the basic specification, It really depends on the condition of your ram and cpu!
If you want to use other apps while compilation you should make a 5GB minimum swap partition!
If ram is more than 4GB ram then you don't swap partition!
PART 3: DEVICE TREE AND SOURCE BASICS​
Basic source folders:
/packages - Proprietary rom applications
/framework - Framework (Overall rom UI and stuff)
/device - Device config
/vendor - Vendor Tree and other vendor files
/hardware - Hardware drivers
Q: What is BoardConfig.mk?
A: It's the file where you setup path's to files like toolchain etc. and enable/disable stuff, its very easy to understand. You can find it in your device's tree
Q: Where is build.prop in source?
A. Build.prop is available in the source in the form of system.prop in the device tree!
Q: How to remove ringtones, video editor, CM wallpapers from bulid?
A: Go to device/releasetools/extras.txt and Delete anything you don't want in your build
PART 4: Syncing Source and Building​
# Installing Repo Package
Code:
mkdir ~/bin
curl https://dl-ssl.google.com/dl/googlesource/git-repo/repo > ~/bin/repo
chmod a+x ~/bin/repo
STEP 2: Now it is recommended to reboot your computer (No need of sudo su after reboot)
STEP 3: Now make directory:
Code:
mkdir -p ~/rom/android/system
STEP 4: Go into directory and set path for Repo Package
Code:
cd ~/rom/android/system
PATH=~/bin:$PATH
STEP 5: NOW ITS TIME FOR SYNCING:
Their are different sources for different roms:
Some are listed bellow:
MIUI - www.github.com/micode/
Rootbox - www.github.com/Root-Box/
rasbeanjelly - www.github.com/rascarlo/
Xylon AOSP - www.github.com/xyaosp/
PAC-Man - www.github.com/PAC-Man/
CyanogenMod - www.github.com/Cyanogenmod/
CarbonROM - www.github.com/carbondev/
SaberMOD - www.github.com/SaberMOD/
AOKP - www.github.com/AOKP/
From the above collection some are Gingerbread some are ICS and some are JB 4.1/4.2 you have to visit these links via browser and see which source is which and follow the commands given at android.git/platform_manifest.git
Click to expand...
Click to collapse
For CM10.1 source execute this:
Code:
repo init -u git://github.com/CyanogenMod/android.git -b cm10.1
For syncing CM10 source execute:
Code:
repo init -u git://github.com/CyanogenMod/android.git -b jellybean
You have to find for the rest!!
PS: You don't have to execute all the repo init commands written above
Now to sync execute this after the the repo init command
Code:
repo sync
Once it finishes without breaking all the folders will appear in rom/android/system folder
now execute this:
Code:
mkdir -p ~/rom/android/system/device/<ManufacturerName>/<DeviceCodeName>
and extract the device config/tree here
for me its samsung/totoro (galaxy Y, Don't mind )
then do the following:
Code:
mkdir -p ~/rom/android/system/vendor/<ManufacturerName>/<DeviceCodename>
Its the same as for the device folder
Now for compiling:
Code:
. build/envsetup.sh
lunch cm_<DeviceCodename>-eng
brunch cm_<DeviceCodename>-eng
Your build will be located at /rom/android/system/out as <RomName>-date/month/year-UNOFFICIAL-<DeviceCodeName>.zip
HAPPY COMPILING ​
Credits:
MadTeam (motafoca, whitexp etc.) for MADTeam Forums and many help
Team Broadcom CM (bieltv.3, SpaceCaker, Psychogame etc.) for giving my device a quite stable cm.. I learnt to compile because of them! Cheers
BeerGang
mithun46
abhisahara
galaxyfreak
cybojenix
Sniper Killer for supporting me a lot! Thanks dude
prototype-U for Supporting..
Others who supported me
IF YOU LIKE MY GUIDE, DO RATE THIS THREAD A FIVE STAR!
THOSE WHO ARE FACING ERRORS, DO POST YOUR PROBLEM at speed_bot's Source Building Help Thread ​
Good good !! Nicely compiled
abhisahara said:
Good good !! Nicely compiled
Click to expand...
Click to collapse
Thanks
I'll update this guide whenever I get time
Good work on this, I found it quite clear keep up the good work!
Sent from my GT-I9505 using Tapatalk 4 Beta
nicely copied
Aniruddh Chandratre said:
nicely copied
Click to expand...
Click to collapse
Just read what I said at the begging of the thread!
If you are too lazy then:
I know there are many other guides avalable regarding this, But I tried to focus on the small points also that many guides overlook
that's why I have this for you. Do let know if I have missed something or more details have to be included in case still there is a difficulty in compiling
Click to expand...
Click to collapse
And yes, I took reference from others guide... I do give credits!
Have you ever compiled it(successfully) yourself?
Sent from my HTC Desire X using xda app-developers app
prototype-U said:
Have you ever compiled it(successfully) yourself?
Sent from my HTC Desire X using xda app-developers app
Click to expand...
Click to collapse
Yes.. I did..
Thanks for your support
Arnav.G said:
Yes.. I did..
Thanks for your support
Click to expand...
Click to collapse
Where is it?
Sent from my HTC Desire X using xda app-developers app
prototype-U said:
Where is it?
Sent from my HTC Desire X using xda app-developers app
Click to expand...
Click to collapse
It will come...
Please don't spam the thread now! I know you are a RC and you know the rules but still.. Please
http://xda-university.com/as-a-developer/getting-started-building-android-from-source
Nice simplifications...
Noob friendly? Lol! Did you test it on yourself!
When I run the binaries on jdk
I get errors on the 2nd command-Syntax error
Why >
Fang Leone said:
When I run the binaries on jdk
I get errors on the 2nd command-Syntax error
Why >
Click to expand...
Click to collapse
Can you please explain your problem in a little more details?
"This Story Ends Where It Began" - Octavarium (Dream Theater)
Sent from my GT-I9505
Great Guide!!
This is very kind of you to make this helpful thread. It really helped me alot after setting up my new build environment. I ran into an error on you post that you may want to correct, other than that, great work! Here is the typo
"cd Downloads
wget -o make.tar.gz http://ftp.gnu.org/gnu/make/make-3.81.tar.gz
tar -xvzf make-3.81.tar.gz<--this is correct.
cd make-3.82<---it changes here.
./configure
sudo make install"
Hello guys!
I have an error at brunch:
Code:
host Java: guavalib (/home/richard/android/system/out/host/common/obj/JAVA_LIBRARIES/guavalib_intermediates/classes)
logtags: /home/richard/android/system/out/target/common/obj/JAVA_LIBRARIES/framework_intermediates/src/core/java/android/content/EventLogTags.java <= frameworks/base/core/java/android/content/EventLogTags.logtags
logtags: /home/richard/android/system/out/target/common/obj/JAVA_LIBRARIES/framework_intermediates/src/core/java/android/speech/tts/EventLogTags.java <= frameworks/base/core/java/android/speech/tts/EventLogTags.logtags
logtags: /home/richard/android/system/out/target/common/obj/JAVA_LIBRARIES/framework_intermediates/src/core/java/android/webkit/EventLogTags.java <= frameworks/base/core/java/android/webkit/EventLogTags.logtags
[B]make: *** No rule to make target `/home/richard/android/system/out/host/linux-x86/bin/dx', needed by `/home/richard/android/system/out/target/common/obj/APPS/Apollo_intermediates/proguard.classes-with-local.dex'. Stop.[/B]
make: *** Waiting for unfinished jobs....
logtags: /home/richard/android/system/out/target/common/obj/JAVA_LIBRARIES/telephony-common_intermediates/src/src/java/com/android/internal/telephony/EventLogTags.java <= frameworks/opt/telephony/src/java/com/android/internal/telephony/EventLogTags.logtags
Note: Some input files use or override a deprecated API.
Note: Recompile with -Xlint:deprecation for details.
Anyone knows what's causing it? It couldn't be the roomservice.xml in local_manifest as I used the one which another person successfully built CM with. I also repo sync'ed a few times already. I tried make clobber and built again, but nothing :crying:
I am building PACMAN ROM (4.3) now by the way.
All help is appreciated (with a thank!)
Greedings everyone
For some time now i am trying to download and compile CyanongenMod Sources for my Device. I Install VirtualBox + Linux Mint + all the needed stuff. Then i do the repo init and everything looks ok but when i do the repo sync it always throw me a error fetch stop because of sync errors. Ive done it a lot of time with no luck. Also i tried the repo sync -f which finaly finishes fetching things but stops at getting the project tree. Can anyone help me? :/ its really frustrating
vale amicis said:
I know there are many other guides avalable regarding this, But I tried to focus on the small points also that many guides overlook
that's why I have this for you. Do let know if I have missed something or more details have to be included in case still there is a difficulty in compiling
This thread on Madteam Forums: http://madteam.co/forum/development...lt-rom-for-your-device-(ultra-noob-friendly)/
So lets start with simple things
Basic FAQ:
This post/guide is divided into 4 parts:
1. Setting up build environment
2. Machine specifications etc.
3. Device Tree and source basics
4. Syncing Source and Building
PART 1: Setting up build environment​
Type sudo su and then your password to get rid of Admin Permissions
#Installing Python
STEP 1: Open terminal (CTRL + ALT + T)
Then execute the following commands in terminal one by one
Code:
sudo apt-get install build-essential gcc
cd Downloads
wget http://www.python.org/ftp/python/2.5.6/Python-2.5.6.tgz
tar -xvzf Python-2.5.6.tgz
cd Python-2.5.6
./configure --prefix=/usr/local/python2.5
make
sudo make install
sudo ln -s /usr/local/python2.5/bin/python /usr/bin/python2.5
Now Python is configured
#Installing JDK
As far as I know PPA which was the earlier method of installing JDK etc. doesn't exist's anymore, So I used another way!
Step 1: Open Terminal (CTRL + ALT + T)
STEP 2: Now we need to download the JDK 6 Binary by executing this command in terminal
Code:
wget --no-check-certificate --no-cookies --header "Cookie: gpw_e24=http%3A%2F%2Fwww.oracle.com" "http://download.oracle.com/otn-pub/java/jdk/6u45-b06/jdk-6u45-linux-x64.bin"
STEP 3: Then we need to run the binary and move it to a shared location:
Code:
chmod +x jdk-6u45-linux-x64.bin
sudo ./jdk-6u45-linux-x64.bin
sudo mv jdk1.6.0_45 /usr/lib/jvm/
STEP 4: Now you have to install all binaries and give them highest priority, This will also overwrite the previous version of Java Binaries in your computer
Code:
sudo update-alternatives --install /usr/bin/java java /usr/lib/jvm/jdk1.6.0_45/bin/java 1
sudo update-alternatives --install /usr/bin/javac javac /usr/lib/jvm/jdk1.6.0_45/bin/javac 1
sudo update-alternatives --install /usr/bin/javaws javaws /usr/lib/jvm/jdk1.6.0_45/bin/javaws 1
sudo update-alternatives --install /usr/bin/jar jar /usr/lib/jvm/jdk1.6.0_45/bin/jar 1
sudo update-alternatives --install /usr/bin/javadoc javadoc /usr/lib/jvm/jdk1.6.0_45/bin/javadoc 1
STEP 5: Now check if JDK 1.6 is selected on this:
Code:
sudo update-alternatives --config java
sudo update-alternatives --config javac
sudo update-alternatives --config javaws
sudo update-alternatives --config jar
sudo update-alternatives --config javadoc
Now JDK is configured! To check if it is done
Execute this is Terminal
Code:
java -version
Output will be similar to this
Code:
java version "1.6.0_45"
Java(TM) SE Runtime Environment (build 1.6.0_45-b06)
Java HotSpot(TM) 64-Bit Server VM (build 20.45-b01, mixed mode)
#Installing GNU Make
Code:
cd Downloads
wget -o make.tar.gz http://ftp.gnu.org/gnu/make/make-3.81.tar.gz
tar -xvzf make-3.81.tar.gz
cd make-3.82
./configure
sudo make install
These commands are for Make 1.81 if you want to install Make 1.82 Execute these
Code:
cd
wget -o make.tar.gz http://ftp.gnu.org/gnu/make/make-3.82.tar.gz
tar -xvzf make-3.82.tar.gz
cd make-3.82
./configure
sudo make install
Now GNU make is configures
#Installing Android SDK
STEP ONE: Download the SDK from http://developer.android.com/sdk/index.html and extract it in a folder called "sdk" in the Downloads folder
STEP TWO: Now, Execute these commands in terminal
Code:
cd ~/Downloads/sdk/tools/
./android sdk
SDK is configured now :victory:
#Installing required packages:
STEP 1: Open Terminal
Now execute these commands:
Code:
apt-get install git-core gnupg flex bison gperf build-essential \
zip curl zlib1g-dev libc6-dev libncurses5-dev x11proto-core-dev \
libx11-dev libreadline6-dev libgl1-mesa-dev tofrodos python-markdown \
libxml2-utils xsltproc pngcrush gcc-multilib lib32z1 schedtool
Good, Now you have successfully setup linux build environment!​
PART 2: Machine specifications and other misc. stuff​
Basic Computer Specs:
2Ghz Dual Core Processor
2GB Minimum ram
50GB File Space (For only one rom source)
*PLEASE NOTE*: This is the basic specification, It really depends on the condition of your ram and cpu!
If you want to use other apps while compilation you should make a 5GB minimum swap partition!
If ram is more than 4GB ram then you don't swap partition!
PART 3: DEVICE TREE AND SOURCE BASICS​
Basic source folders:
/packages - Proprietary rom applications
/framework - Framework (Overall rom UI and stuff)
/device - Device config
/vendor - Vendor Tree and other vendor files
/hardware - Hardware drivers
Q: What is BoardConfig.mk?
A: It's the file where you setup path's to files like toolchain etc. and enable/disable stuff, its very easy to understand. You can find it in your device's tree
Q: Where is build.prop in source?
A. Build.prop is available in the source in the form of system.prop in the device tree!
Q: How to remove ringtones, video editor, CM wallpapers from bulid?
A: Go to device/releasetools/extras.txt and Delete anything you don't want in your build
PART 4: Syncing Source and Building​
# Installing Repo Package
Code:
mkdir ~/bin
curl https://dl-ssl.google.com/dl/googlesource/git-repo/repo > ~/bin/repo
chmod a+x ~/bin/repo
STEP 2: Now it is recommended to reboot your computer (No need of sudo su after reboot)
STEP 3: Now make directory:
Code:
mkdir -p ~/rom/android/system
STEP 4: Go into directory and set path for Repo Package
Code:
cd ~/rom/android/system
PATH=~/bin:$PATH
STEP 5: NOW ITS TIME FOR SYNCING:
For CM10.1 source execute this:
Code:
repo init -u git://github.com/CyanogenMod/android.git -b cm10.1
For syncing CM10 source execute:
Code:
repo init -u git://github.com/CyanogenMod/android.git -b jellybean
You have to find for the rest!!
PS: You don't have to execute all the repo init commands written above
Now to sync execute this after the the repo init command
Code:
repo sync
Once it finishes without breaking all the folders will appear in rom/android/system folder
now execute this:
Code:
mkdir -p ~/rom/android/system/device/<ManufacturerName>/<DeviceCodeName>
and extract the device config/tree here
for me its samsung/totoro (galaxy Y, Don't mind )
then do the following:
Code:
mkdir -p ~/rom/android/system/vendor/<ManufacturerName>/<DeviceCodename>
Its the same as for the device folder
Now for compiling:
Code:
. build/envsetup.sh
lunch cm_<DeviceCodename>-eng
brunch cm_<DeviceCodename>-eng
Your build will be located at /rom/android/system/out as <RomName>-date/month/year-UNOFFICIAL-<DeviceCodeName>.zip
HAPPY COMPILING ​
Click to expand...
Click to collapse
I had two things to ask
1)Was installing android-sdk needed
2)If device not yet had a cm build or device tree how to get them

[GUIDE] How to compile kernel EASIEST WAY + add features + useful tools

Hi guys!
I wrote this guide because after a few month of kernel development i found useful tools and tricks than helped me a lot and speeded up my work and i want to share with you this knowledge.
Setup computer and download sources​
Code:
Minumum reqirement:
* C knowledge
* Ubuntu 12.04 (13.10 if you want use Kdevelop + linux kernel plugin)
* Internet connection, possibly fast and unlimited
* the boot.img of the ROM you want to support with your kernel (AOSP, SENSE etc etc...)
* [URL="http://forum.xda-developers.com/showthread.php?t=2519416"]zImage switcher[/URL]
Install required package:
Linux 12.04;
Code:
sudo apt-get install -y build-essential kernel-package libncurses5-dev bzip2 bin86 libqt3-headers libqt3-mt-dev wget libncurses5 git-core nautilus-open-terminal
linux 13.10:
Code:
sudo apt-get install -y build-essential kernel-package libncurses5-dev bzip2 bin86 qt4-dev-tools wget libncurses5 git-core nautilus-open-terminal
and restart your PC.
Download Source:
Go to /home/<username>, create a new folder called "kernel", and enter in that folder.
right click somewhere in "kernel" folder and select "open terminal here" (CooL AH?)
and run
Code:
git clone <kernel-source-code-for-your-device-repository>
for example for HTC One S will be
Code:
git clone https://github.com/CyanogenMod/android_kernel_htc_msm8960.git
Download the toolchain
There are a lot of toolchain, stock, linaro optimized, based on gcc 4.7, based on gcc 4.8 the choice is yours! in this tutorial we use google gcc 4.7 toolchain.
Go to /home/<username>, create a new folder called "toolchains", and enter in that folder.
right click -> open terminal here
Code:
git clone https://android.googlesource.com/platform/prebuilts/gcc/linux-x86/arm/arm-eabi-4.7
Build the kernel​
Build the kernel:
in this part we will work in "/home/<username>/kernels/<kernel-folder>" folder, i'll call it <root>
go to "<root>/arch/arm/configs" and copy "<you-device-name>_defconfig" to <root>
rename <you-device-name>_defconfig to ".config"
open a terminal window in <root>
type:
Code:
make ARCH=arm CROSS_COMPILE=/home/<username>/toolchains/arm-eabi-4.7/bin/arm-eabi- > compileLog
and the compilation will start.
Some explanation:
"ARCH=arm" tells to compiler what arch the kernel is made for
"CROSS_COMPILE=xxxxxx" tells to "make" the compiler to use
"> compileLog" saves all the messages in a file called compileLog, it's easier to read than terminal window
Click to expand...
Click to collapse
Pack the kernel to boot.img:
Unpack zImage switcher somewhere, i'll call that folder <ZimgSw>.
copy in the same folder of "repack.sh" file the stock boot.img and yout zImage, you can find it in <root>/arch/arm/boot.
run the script
Code:
./repack.sh
now in <ZimgSw> there's a new file called newBoot.img, that's your kernel!
to find the modules (*.ko files) open a teminal windows to <root> and type
Code:
find ./ -name "*.ko" -exec cp {} <absolute/path/destination/folder> \;
now you have the boot.img and the modules, download a custom kernel and use the flashable zip to make your flashable zip, just replace the modules and the boot.img!
Add features​Add features to kernel:
"Woah! i'd like to add intellimand governor to my kernel"
First you need to find a git repository that contains intellimand governor, than the commit that added the governor.
for example https://github.com/rmbq/android_kernel_htc_msm8960/commit/6c87d0e0b3c82ffff8c0704dfde7369872f5602f
Open a terminal window in <root>
type:
Code:
git remote add rmbq https://github.com/rmbq/android_kernel_htc_msm8960.git -b cm-10.2
git fetch rmbq
git cherry-pick 6c87d0e0b3c82ffff8c0704dfde7369872f5602f
Explanations:
Code:
git remote add rmbq https://github.com/rmbq/android_kernel_htc_msm8960.git -b cm-10.2
add a link to https://github.com/rmbq/android_kernel_htc_msm8960.git branch cm-10.2 and called it "rmbq"
Code:
git fetch rmbq
download all the commit history to your PC without modify your sources
Code:
git cherry-pick 6c87d0e0b3c82ffff8c0704dfde7369872f5602f
apply the commit 6c87d0e0b3c82ffff8c0704dfde7369872f5602f to your source
Click to expand...
Click to collapse
in termial window type:
Code:
make ARCH=arm xconfig
will open a new window where you can configure your kernel's features
press ctrl+f (find) and serach for "intellimand" and tick the checkbox. save clicking the floppy disk in upper left corner.
the modified configuration file will be saved in ".config"
now we can build the kernel again, but first type
Code:
make ARCH=arm clean CROSS_COMPILE=/home/<username>/toolchains/prebuilts_gcc_linux-x86_arm_arm-linux-androideabi-4.8/bin/arm-linux-androideabi-
this will remove all the compiled files of previous build.
View git commits history​you can easly view all the commits in your repo:
open a terminal window in <root> and type
Code:
gitk
will open a GUI where you can see all the commits, what files were modified for each commit, the author of the commit.
you can also revert commits.
There are other GUI for git, i also like "gitg"
Hacking the kernel
suggested by @pirlano​for easy work on kernel sources, add features & co. you can use kdevelop + linux kernel plugin, here is a guide
http://www.gnurou.org/code/kdevelop-kernel
and a video guide:
http://video.linux.com/videos/kernel-browsing-and-hacking-using-kdevelop
NOTE: for linux kernel plugin ubuntu 13.10 is required
if something is not working or it's not clear or you have useful tips just tell me and i'll update the guide
Nice! I usually use kdevelop + linux kernel plugin, so i have a fast IDE and i can save compilation config, fix warning and errors on the fly, and use git from a gui, it's a good solution for me
pirlano said:
Nice! I usually use kdevelop + linux kernel plugin, so i have a fast IDE and i can save compilation config, fix warning and errors on the fly, and use git from a gui, it's a good solution for me
Click to expand...
Click to collapse
cool! if you want/have time write a small tutorial for your method and i'll add to OP
EDIT: meanwhile i added this guide http://www.gnurou.org/code/kdevelop-kernel
rmbq said:
cool! if you want/have time write a small tutorial for your method and i'll add to OP
EDIT: meanwhile i added this guide http://www.gnurou.org/code/kdevelop-kernel
Click to expand...
Click to collapse
And video guide from a nVidia tegra developer
http://video.linux.com/videos/kernel-browsing-and-hacking-using-kdevelop
Hi rmbq,
many thanks for your tutorial! I really appreciate it as I already made some first steps with compiling Roms. Now I'll try to make a kernel
Sent from my One S using XDA Premium 4 mobile app
UPDATE:
added git GUI section
Thanks for this tutorial. Maybe I will finally sit down to making my own kernel someday. If I can do it for linux why can't I for android.
@rmbq
I get an error when i run the command
sudo apt-get install -y build-essential kernel-package libncurses5-dev bzip2 bin86 libqt3-headers libqt3-mt-dev wget libncurses5 git-core nautilus-open-terminal
Click to expand...
Click to collapse
Error
$ sudo apt-get install -y build-essential kernel-package libncurses5-dev bzip2 bin86 libqt3-headers libqt3-mt-dev wget libncurses5 git-core nautilus-open-terminal
Reading package lists... Done
Building dependency tree
Reading state information... Done
E: Unable to locate package libqt3-headers
E: Unable to locate package libqt3-mt-dev
Click to expand...
Click to collapse
This is my first time trying to build a kernel, How do i fix it?
Edit:
Im running Ubuntu 13.10
phanitej said:
@rmbq
I get an error when i run the command
Error
This is my first time trying to build a kernel, How do i fix it?
Edit:
Im running Ubuntu 13.10
Click to expand...
Click to collapse
Hi!
instead
Code:
sudo apt-get install -y build-essential kernel-package libncurses5-dev bzip2 bin86 libqt3-headers libqt3-mt-dev wget libncurses5 git-core nautilus-open-terminal
can you try to run
Code:
sudo apt-get install -y build-essential kernel-package libncurses5-dev bzip2 bin86 qt4-dev-tools wget libncurses5 git-core nautilus-open-terminal
and see if "make xconfig" (qt is required only for this command) is working? i haven't got ubuntu 13.10 so i can't test
rmbq said:
Hi!
instead
Code:
sudo apt-get install -y build-essential kernel-package libncurses5-dev bzip2 bin86 libqt3-headers libqt3-mt-dev wget libncurses5 git-core nautilus-open-terminal
can you try to run
Code:
sudo apt-get install -y build-essential kernel-package libncurses5-dev bzip2 bin86 qt4-dev-tools wget libncurses5 git-core nautilus-open-terminal
and see if "make xconfig" (qt is required only for this command) is working? i haven't got ubuntu 13.10 so i can't test
Click to expand...
Click to collapse
Tried the command. Did not get any errors. But after downloading source i dont see the kernel folder insde the kernel. What am i doing wrong?
Im trying to build a hammerhead kernel so used the below link
git clone https://android.googlesource.com/kernel/msm.git
Click to expand...
Click to collapse
phanitej said:
Tried the command. Did not get any errors. But after downloading source i dont see the kernel folder insde the kernel. What am i doing wrong?
Im trying to build a hammerhead kernel so used the below link
Click to expand...
Click to collapse
because "master" branch (the default branch) is empty.
open a terminal in <root> and type
Code:
git checkout android-msm-hammerhead-3.4-kk-r1
and you will switch from master branch to android-msm-hammerhead-3.4-kk-r1 branch, i think it's the more updated branch for hammerhead. now you should see all the folders and files of your kernel
rmbq said:
because "master" branch (the default branch) is empty.
open a terminal in <root> and type
Code:
git checkout android-msm-hammerhead-3.4-kk-r1
and you will switch from master branch to android-msm-hammerhead-3.4-kk-r1 branch, i think it's the more updated branch for hammerhead. now you should see all the folders and files of your kernel
Click to expand...
Click to collapse
First of all, a big thanks to your patience for helping me out.
The above command did show up files. I then went to root and tried to use make
make ARCH=arm CROSS_COMPILE=/home/phanitej/toolchain/prebuilts_gcc_linux-x86_arm_arm-linux-androideabi-4.8/bin/arm-linux-androideabi- > compileLog
Click to expand...
Click to collapse
It gives an error. I made sure the path is correct.
make[2]: *** [silentoldconfig] Error 1
make[1]: *** [silentoldconfig] Error 2
make: *** No rule to make target `include/config/auto.conf', needed by `include/config/kernel.release'. Stop.
phanitej said:
First of all, a big thanks to your patience for helping me out.
The above command did show up files. I then went to root and tried to use make
It gives an error. I made sure the path is correct.
make[2]: *** [silentoldconfig] Error 1
make[1]: *** [silentoldconfig] Error 2
make: *** No rule to make target `include/config/auto.conf', needed by `include/config/kernel.release'. Stop.
Click to expand...
Click to collapse
did you do these steps?
go to "<root>/arch/arm/configs" and copy "<you-device-name>_defconfig" to <root>
rename <you-device-name>_defconfig to ".config"
if yes try to (in <root>):
Code:
make ARCH=arm xconfig
save clickn' the floppy
Code:
make ARCH=arm CROSS_COMPILE=/home/<username>/toolchains/prebuilts_gcc_linux-x86_arm_arm-linux-androideabi-4.8/bin/arm-linux-androideabi- > compileLog
P.S. to post code / script / terminal commands use CODE tag instead QUOTE
rmbq said:
did you do these steps?
go to "<root>/arch/arm/configs" and copy "<you-device-name>_defconfig" to <root>
rename <you-device-name>_defconfig to ".config"
if yes try to (in <root>):
Code:
make ARCH=arm xconfig
save clickn' the floppy
Code:
make ARCH=arm CROSS_COMPILE=/home/<username>/toolchains/prebuilts_gcc_linux-x86_arm_arm-linux-androideabi-4.8/bin/arm-linux-androideabi- > compileLog
P.S. to post code / script / terminal commands use CODE tag instead QUOTE
Click to expand...
Click to collapse
Thanks for the tip Will use code tag from now on for codes.
After running
Code:
make ARCH=arm xconfig
I got the kernel config window. Saved it without modifying anything. THen ran the other command. Gives error. Checked the log and found few errors.
phanitej said:
Thanks for the tip Will use code tag from now on for codes.
After running
Code:
make ARCH=arm xconfig
I got the kernel config window. Saved it without modifying anything. THen ran the other command. Gives error. Checked the log and found few errors.
Click to expand...
Click to collapse
probably your new .config has got wrong configuration, try to delete .config in <root> (if you don't see it press ctrl+h)
and do again
go to "<root>/arch/arm/configs" and copy "<you-device-name>_defconfig" to <root>
rename <you-device-name>_defconfig to ".config"
this time run the make command without make xconfig
rmbq said:
probably your new .config has got wrong configuration, try to delete .config in <root> (if you don't see it press ctrl+h)
and do again
go to "<root>/arch/arm/configs" and copy "<you-device-name>_defconfig" to <root>
rename <you-device-name>_defconfig to ".config"
this time run the make command without make xconfig
Click to expand...
Click to collapse
Still got error
make[1]: *** [init/main.o] Error 1
make: *** [init] Error 2
Just to make sure im doing it right.
I copied hammerhead_defconfig to <root> and renamed it to .config
Then ran the make command without make xconfig i.e
Code:
make ARCH=arm CROSS_COMPILE=/home/phanitej/toolchain/prebuilts_gcc_linux-x86_arm_arm-linux-androideabi-4.8/bin/arm-linux-androideabi- > compileLog
phanitej said:
Still got error
make[1]: *** [init/main.o] Error 1
make: *** [init] Error 2
Just to make sure im doing it right.
I copied hammerhead_defconfig to <root> and renamed it to .config
Then ran the make command without make xconfig i.e
Code:
make ARCH=arm CROSS_COMPILE=/home/phanitej/toolchain/prebuilts_gcc_linux-x86_arm_arm-linux-androideabi-4.8/bin/arm-linux-androideabi- > compileLog
Click to expand...
Click to collapse
can you try to:
open <root>/Makefile
go to line 375 (it's "-fno-delete-null-pointer-checks") and replace this line with "-fno-delete-null-pointer-checks -march=armv7-a"
save and try to compile again
rmbq said:
can you try to:
open <root>/Makefile
go to line 375 (it's "-fno-delete-null-pointer-checks") and replace this line with "-fno-delete-null-pointer-checks -march=armv7-a"
save and try to compile again
Click to expand...
Click to collapse
Edited that, still no go
What am i doing wrong?
phanitej said:
Edited that, still no go
What am i doing wrong?
Click to expand...
Click to collapse
and if you change toolchain?
try to download this http://releases.linaro.org/13.11/co...ndroid-toolchain-eabi-4.8-2013.11-x86.tar.bz2
unpack it in toolchain folder and run make with new CROSS_COMPILE path
CROSS_COMPILE=/home/phanitej/toolchain/new folder/bin/new files name
to know the "new files name" go to
/home/phanitej/toolchain/prebuilts_gcc_linux-x86_arm_arm-linux-androideabi-4.8/bin
you can see all files are starting with "arm-linux-androideabi-" that's why the command is
Code:
CROSS_COMPILE=/home/phanitej/toolchain/prebuilts_gcc_linux-x86_arm_arm-linux-androideabi-4.8/bin/[COLOR="Red"]arm-linux-androideabi-[/COLOR]
make the same thing with the new toolchain
EDIT: shuold be
Code:
CROSS_COMPILE=/home/phanitej/toolchain/[COLOR="Red"]android-toolchain-eabi[/COLOR]/bin/[COLOR="Red"]arm-eabi-[/COLOR]
EDIT2: if still not working try to modify line 357 of <root>/Makefile from
CFLAGS_KERNEL =
to
CFLAGS_KERNEL = -mtune=cortex-a15 -mfpu=neon-vfpv4

[How To] Setup ABE For Compiling Android Roms From Source (CM11) UPDATED 11/1/14

Setup ABE (Android Build Environment To Compile Roms) ​
For this you tutorial you need to be running Ubuntu 13.10 64-Bit (32-Bit Will Not Work).
Does Not Matter if you are running this in a virtual machine or not. (Will work on Both)
Also I will also be showing a Guide to Syncing CM11 Repo and TamsuiCM11 Repo.
Instructions (Read Carefully):
First, let's set up the correct JDK.
Many of you probably have some kind of wrong Java installed unless you're starting with a fresh Ubuntu base, and even then maybe.
Let's get rid of that. Copy and paste this into a Terminal window:
Code:
sudo apt-get purge openjdk-\* icedtea-\* icedtea6-\*
Follow the instructions to remove OpenJDK. If you must keep it, it's possible. But I'm not going to tell you how to do it here. I don't want any chance of confusion or mistake.
Now copy and paste the following into the Terminal:
Code:
sudo add-apt-repository ppa:webupd8team/java
This will add the correct PPA to your system for updated builds of Java 6 JDK that are compatible with 13.10. No more unrecognized Java version errors! And it will update automatically with the rest of your system.
Next, we actually need to install the package. More copy-paste:
Code:
sudo apt-get update && sudo apt-get install oracle-java6-installer
Ok, back to a fresh Terminal prompt. Time for installing the guts to build stuff in Ubuntu:
Code:
sudo apt-get install git-core lzop ccache gnupg flex bison gperf build-essential zip curl zlib1g-dev zlib1g-dev:i386 libc6-dev lib32ncurses5 lib32z1 lib32bz2-1.0 lib32ncurses5-dev x11proto-core-dev libx11-dev:i386 libreadline6-dev:i386 lib32z-dev libgl1-mesa-glx:i386 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.8-dev python gcc g++ cpp gcc-4.8 g++-4.8
When that is done installing, run the following command in your Terminal window:
Code:
sudo ln -s /usr/lib/i386-linux-gnu/mesa/libGL.so.1 /usr/lib/i386-linux-gnu/libGL.so
That's it on the package side of things.
You guessed it, time for more Terminal. This really is the easiest way, seriously. And it's totally worth it when you're basking in the glory of a bunch of people on XDA.
The binary for a program called "repo" will let you talk to git servers and download all that precious source code. That second part after the && allows it to be executable:
Code:
mkdir ~/bin && curl http://commondatastorage.googleapis.com/git-repo-downloads/repo > ~/bin/repo && chmod a+x ~/bin/repo
Use your favorite text editor to open ~/.bashrc
I like nano:
Code:
sudo nano ~/.bashrc
At the very bottom, add the following line:
Code:
export PATH=~/bin:$PATH
Save it. In nano that would be Ctrl-O and then Enter. Then Ctrl-X to exit back to a prompt. Restart bash:
Code:
source ~/.bashrc
In the terminal, navigate to where you would like to store the Android source code. The directions below will make it in your home folder, but if you have limited space, you may want to create it somewhere else. Faster is better, i.e. SSD would be best, USB external is basically unusable. Here we go:
Code:
mkdir ~/cm11
cd ~/cm11
We will configure your information, your name and email address, In terminal type:
Code:
git config --global user.name your name
git config --global user.email your email
Now you're going to initialize the repo. Here's where you decide the flavor of Android you want to build for, ie AOKP, CyanogenMod, AOSP etc. The following, for the purposes of this tutorial, will initialize for Stable CM11:
Code:
repo init -u git://github.com/CyanogenMod/android.git -b stable/cm-11.0
Almost there. Last step, but it's a doozy. You're going to get the source. Prepare yourself, mere mortal. 10+ GB of downloading await you. Don't worry, it's automated. Go to sleep. Eat something. Perhaps you have heard of this new thing the kids are doing called "going outside"? Yeah, I didn't think so. Me neither. The final terminal command, to be run from your android directory:
Code:
repo sync
----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
After that is done its time to Sync TamsuiCM11 Repo:
Go into your file browser and to your username then your cm11 folder, once there press Ctrl+H on your keyboard. Go into the folder .repo and make a folder called:
Code:
local_manifests
Once done exit out of the repo folder and press Ctrl+H on your keyboard once again.
Now its time you configure the local manifest, this will download all necessary files for the devices in this forum.
Type this in terminal:
Code:
. build/envsetup.sh
[B]breakfast jlo[/B] (For Xperia J) [B]tapioca[/B] (For Xperia Tipo) [B]mesona[/B] (For Xperia Miro) [B]nanhu_ds[/B] (For Xperia E)
gedit ~/cm11/.repo/local_manifests/local_manifest.xml
Now go to this link: https://github.com/TamsuiCM11/local_manifest/blob/master/tamsui.xml
Copy everything in the file into the open window of gedit hit save and close.
Go back to Terminal and type:
Code:
repo sync
This will download all necessary files, once done type the following into terminal:
Code:
cd ~/cm11/vendor/cm
. get-prebuilts
croot
Finally type:
Code:
[B]brunch jlo[/B] (For Xperia J) [B]tapioca[/B] (For Xperia Tipo) [B]mesona[/B] (For Xperia Miro) [B]nanhu_ds[/B] (For Xperia E
It will begin to build, if you run into any errors, do some research before creating tons of threads.
THANK ME IF I HELPED!
Thanks a lot for the how to. I'm just "syncing" (don't know if this is how it is said, just entered the command that downloads 10Gb) and it is doing the job! Don't know why this has only 5 "thanks", I found it very useful!!
JUST ONE QUESTION!! If I type breakfast tapioca it gives me "no such file or directory" error. If I type "tapioca_ss" it gives me no problems. Is it right?
Thanks
phn1993 said:
Thanks a lot for the how to. I'm just "syncing" (don't know if this is how it is said, just entered the command that downloads 10Gb) and it is doing the job! Don't know why this has only 5 "thanks", I found it very useful!!
JUST ONE QUESTION!! If I type breakfast tapioca it gives me "no such file or directory" error. If I type "tapioca_ss" it gives me no problems. Is it right?
Thanks
Click to expand...
Click to collapse
In your home folder, look in cm11/devices. If there's a folder called tapioca_ss, then you need to use tapioca_ss. If there's a folder called tapioca, then you need to use tapioca.
Yes, this guide is very useful, but unfortunately, you can only thank a post once (I did)!
NSDCars5 said:
In your home folder, look in cm11/devices. If there's a folder called tapioca_ss, then you need to use tapioca_ss. If there's a folder called tapioca, then you need to use tapioca.
Yes, this guide is very useful, but unfortunately, you can only thank a post once (I did)!
Click to expand...
Click to collapse
Yes, I noticed!! Thanks!!
One last question (new it's true lol): I get "make" errors (ERROR 1) when compiling audio drivers. I don't know why, but I'm trying to repeat the how to as root!
phn1993 said:
Yes, I noticed!! Thanks!!
One last question (new it's true lol): I get "make" errors (ERROR 1) when compiling audio drivers. I don't know why, but I'm trying to repeat the how to as root!
Click to expand...
Click to collapse
I don't think you should do this as root; I've seen some guides that say doing so might deter the building process.
And you're welcome.
NSDCars5 said:
I don't think you should do this as root; I've seen some guides that say doing so might deter the building process.
And you're welcome.
Click to expand...
Click to collapse
I finally decided to repeat all the guide! I think I've just found the problem!! Thanks again

[Guide][Q&A][How To Build SOKP From Source][ Build SOKP for any open source** device]

[Guide][Q&A][How To Build SOKP From Source][ Build SOKP for any open source** device]
Building SOKP from source for Any Device !!!​
Some Important Links Of SOKP
Official Web Page
Features of SOKP
Change-Logs of SOKP
Source Code
Credits:
@Stephen for his guide written to build cm for Shamu.
Part-1 Preparation : Setting up Build Environment & Downloading SOKP Source*
This guide will walk you through, how to build SOKP for any other device source. To complete this, you will need a PC with either virtual box setup and Ubuntu or duel boot Windows and Ubuntu or else system with ubuntu installed as standalone OS. I recommend Ubuntu 14.04LTS version of Ubuntu for this purpose .
Recommended configuration of PC required for build Process:
Processor : Intel I5
Ram * * * : Min 8GB
Hard Disk : 250 GB
OS * * * *: Ubuntu 14.04 LTS
A Decent net connection with unlimited Data Plan and min of 1Mbps speed .[Dont try this in 512Kbps net connection]
I won't go into too much detail on how to setup Ubuntu on your PC. For this guide, you do need to know the basic commands and how to use Ubuntu.
Some use-full links :
A list of basic Ubuntu commands
Ubuntu: A Beginner’s Guide
Virtual Box
Ubuntu ISO
Disclaimer:
I am not responsible for any damage done to your device, thermal nuclear war etc.
Please use at your own risk. Your warranty may be affected if you install a custom rom.
I am also not responsible if you go over your payment plan when downloading the source code.
It is large over 25gb+ so be careful *!!!!
So assuming you have Ubuntu 14.* set up, you will need to now set up your build environment
First on their guide it talks about installing the SDK tools. You do not need these to build the ROM. You only really need ADB commands. I installed fastboot as well.
Install ADB command
Code:
sudo apt-get install android-tools-adb
Install Fastboot command
Code:
sudo apt-get install android-tools-fastboot
Install Java
Code:
sudo apt-get install openjdk-7-jdk
Setting up the build Environment:
Code:
sudo apt-get install bison build-essential curl flex git gnupg gperf libesd0-dev liblz4-tool libncurses5-dev libsdl1.2-dev libwxgtk2.8-dev libxml2 libxml2-utils lzop pngcrush schedtool squashfs-tools xsltproc zip zlib1g-dev*
git gnupg ccache lzop flex bison gperf build-essential zip curl libc6-dev lib32ncurses5-dev x11proto-core-dev lib32z1-dev g++-multilib tofrodos python-markdown libxml2-utils xsltproc libreadline6-dev lib32readline-gplv2-dev libncurses5-dev bzip2 libbz2-dev libbz2-1.0 libghc-bzlib-dev squashfs-tools pngcrush schedtool dpkg-dev phablet-tools pngquant*
If you have a 64bit PC install the following:*
Code:
g++-multilib gcc-multilib lib32ncurses5-dev lib32readline-gplv2-dev lib32z1-dev
Setting your build directory - This can be any folder you want. for my example I will use sokp as my root folder. Remember that Ubuntu is case sensitive when switching folders.*
Code:
mkdir -p ~/sokp
Install Repo
Code:
mkdir ~/bin && curl http://commondatastorage.googleapis.com/git-repo-downloads/repo > ~/bin/repo && chmod a+x ~/bin/repo
Now for the good bit! We are about to download the source for SOKP *Warning: The download is large and will take a long time to download. *I believe the download is 25gb+ in size, so you will have to take this into consideration. Note: I will not be held responsible if you go over your payment plan with your service provider.
Identify Yourself to the Repo*
Code:
git config --global user.email "[email protected]"*
git config --global user.name "yourpreferredusername"
Initialize the SOKP source repository
Code:
cd ~/sokp - this is your root folder
repo init -u repo init -u git://github.com/SOKP/platform_manifest.git -b sokp-l5.1
Download the source code
Code:
repo sync
or
Code:
repo sync -f
If repo sync errors and stops during download, don't worry you can simply run the command again and it will pick up were it left off.When you have completed the download run it again, to make sure it completes with out any errors. This way you know you have downloaded the full source code.*
Backup your home directory[optional]
Also at this point, what I do is make a backup using the inbuilt backup software in ubuntu. This backs up my entire home directory to a secondary hard drive I have set up in my PC. This way if I have any issues and need to start from scratch, I can simply delete my android directory, then restore from backup.*
This will Finish your Preparation Part .
STEP 2: Adding device support to SOKP:​
Now, Lets add the device specific trees:
Add your own device tree in the local manifest. Here in sokp we use sokp_manifest.xml
For this, create a new file .repo/local_manifests/sokp_manifest.xml, & use something in similar terms:
Code:
<?xml version="1.0" encoding="UTF-8"?>
<manifest>
* <project name="device_samsun_trltexx" path="device/samsung/trltexx" remote="github" revision="sokp-l5.1" />
</manifest>
CAUTION: Your device tree, kernel source, vendor props etc WILL be different. Search & find out where your device specific sources are located.
After adding this do a
Code:
repo sync
so that device related trees are downloaded
After Downloading the device tree you need to add some files in order to compile SOKP. The files which are needed to add and modified are mentioned bellow.
1)sokp.mk*
Create a file called sokp.mk in device tree and add all informations related to your device as mentioned bellow.[I have taken Note-4[trltexx] as example so relpace it by your device. ]
The General templet of sokp.mk is follows*
Code:
#
# Copyright (C) 2015 The Sonic Open Kang 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.
#
$(call inherit-product, device/samsung/trltexx/full_trltexx.mk)
# Enhanced NFC
$(call inherit-product, vendor/sokp/config/nfc_enhanced.mk)
# Inherit common SOKP phone.
$(call inherit-product, vendor/sokp/config/common_full_phone.mk)
PRODUCT_DEVICE := trltexx
PRODUCT_NAME := sokp_trltexx
Example*
2)sokp.dependencies*
This file will contain details of all discrepancy trees which required[kernel, vendor, etc] to compile the SOKP. This file will fetch required trees when build process starts so this must be filled with proper remote and branch details.
Create a file called sokp.dependencies *in device tree and add all informations trees which is needed by *your device as mentioned bellow
A Example of sokp.dependencies the contents of this file will change from device to device how ever templet is common.
Code:
[
* {
* * "repository": "device_samsung_trlte-common",
* * "target_path": "device/samsung/trlte-common",
"branch": * * *"sokp-l5.1"
* },
* {
* * "repository": "device_qcom_common",
* * "target_path": "device/qcom/common",
"branch": * * *"sokp-l5.1"
* },
* {
* * "repository": "device_samsung_qcom-common",
* * "target_path": "device/samsung/qcom-common",
"branch": * * *"sokp-l5.1"
* },
* {
* * "repository": "kernel_samsung_trlte",
* * "target_path": "kernel/samsung/trlte",
"branch": * * *"sokp-l5.1"
* },
* {
* * "repository": *"proprietary_vendor_samsung",
* * "target_path": "vendor/samsung",
* * "branch": * * *"sokp-l5.1"
* }
]
Here we take trltexx as device and added its kernel ,vendor and hardware dependencies in file which will fetch when you starts build process.*
So you need to mention trees of kernel, device common, vendor , and hardware in above file with proper branch name and remote .
Example
3)vendorsetup.sh
Create a vendorsetup.sh in your device tree and fill it with your device details as mentioned bellow
Code:
add_lunch_combo sokp_trltexx-eng
Example
4)BoardConfig.mk
TWRP Flags:
Since we use TWRP as boot able recovery in SOKP you need to add some flags related to TWRP in BoardConfig.mk in your device tree.
Add screen resolution of your device also here in BoardConfig.mk
Setting SELinux Permissive:
SOKP needs a SELinux Permissive state. so we should add this to BOARD_KERNEL_CMDLINE in BoardConfig.mk
Code:
androidboot.selinux=permissive
Example
5)Adding your device in Vendor SOKP :
Open the file sokp.devices in directory vendor/sokp/ of your source and your device name in sokp.devices file*
Example
STEP-3: Building SOKP​
By assuming you have completed step-1 and step-2 successfully lets go to final step of building SOKP
In order to Build SOKP you need to navigate to source folder via terminal which you have download in step-1 ie sokp*
Now Excute following commands in terminal to start build process
Code:
cd (source folder )
*
ie (source folder ) is sokp here in this guide*
&*
Code:
. build/envsetup.sh
After initiating build process execute bellow mentioned command to start build
Code:
brunch (device)]
*
ie (device) is trltexx in this guide ..you need to input your device name *in place (device) when you are building sokp for *your required device.
If all the 3 steps are done correctly now the building should start .
initially it will look for dependency *in sokp.dependencies and it will fetch device dependent hardware, vendor ,kernel tress as we mentioned in part-2.
If you face any build related issues feel free to create a post here we are most happy to help you in order to complete you build .
MISC*
Turn on caching to speed up build
You can speed up subsequent builds by adding: the following command to your to your .bashrc file To do this close your terminal window and then reopen and type ./.bashrc - A text editor will open. Add this line to the bottom of the page.
Code:
export USE_CCACHE=1
Close the text editor and save the file
Then in the command window type the following. SOKP recommend 50GB, but you can change to what ever you want.
Code:
prebuilts/misc/linux-x86/ccache/ccache -M 50G
one more in case
Thanks a lot for this amazing guide @Adi Shakthi aka AudioGod bro.

How To Build Rom From Compressed Sources

Hey,Guys I'm Here To Tell All How To Build A Rom From The Compressed Source.
First Of All I'm Thanking To For Compressed Sources.
@MSF Jarvis @DigiGoon @regalstreak
Pre-Requirements-->>
•Windows 7/8/8.1
•Java JDK
•VirtualBox Or VMWare
•Ubuntu [I'm Recommended For Ubuntu 14.04]
Setting Up Linux-->>
•Install VirtualBox In Your PC.
•Click On New Button.
•Type The Name,What Type Of Os You Are Installing & And The Version.
[In This Case We Are Installing Ubuntu 14.04.So In Type Option Choose "Linux And In Version Option Choose "Ubuntu"]
•Now You Have To Set The Amount Of RAM For Run Ubuntu.You Have Give The Half Amount RAM For Ubuntu And Half To Windows.[Example:You Have 10GB Of RAM Then Give The Ubuntu To 5GB Or 4.5 GB Of RAM.].Then Click Next Button.
•Now You Have To Create A Virtual Drive. So Select "Create A Virtual Hard Drive Now" Option.Now Click On Create.
•Now Select The "VMDK".Now Click Create Option.
•Then A New Daialog Will Come.Select "Dynamically Allocated".Then Click Next.
•Now Select Where U Want To Install Ubuntu And Enter The Amount Of HDD Space To Allocate For Ubuntu. [I Am Recommended To Set It Above 150 GB].Then Click On "Create" Option.
•Now Go To Settings,Then System And Click On "Processor".Set CPU.
•Go To Acceleration Tab.Tick The Both Option.Click On "OK" Option.
•Now Go To Storage In Settings.Select "Controller:IDE".There Click On A "CD" Image With "+" Icon.
•A Small Box Will Come.Click on "Choose Disk".And Select Your Ubuntu 14.04 ISO File.Click On OK.
•Now Go To "Motherboard" Tab In Settings/System And Tick Boot Option To "Hard Disk".Click On OK.
•Alright.Now Click In "Start" Option To Boot Ubuntu.
•Now Follow Instructions And Setup With Your Details".
•Yaahoo!.You Have Now Set Up The Ubuntu 14.04 In PC.
Setting Up Building Enviroment!
1.Installing Java JDK-->>
•For Building KitKat Rom We Need Java 6.Install It By Below Command In Terminal-->
Code:
sudo apt-get install oracle-java6-installer
•For Building Lollipop And Marshmallow Roms.Install Java 7 By This Following Command In Terminal-->>
Code:
sudo apt-get install openjdk-7-jdk
•To Check Java Is Installed-->>
Code:
java -version
2.Installing Required Packages-->>
•Enter The Following Command In Terminal-->>
Code:
sudo apt-get install git-core gnupg flex bison gperf build-essential \
zip curl zlib1g-dev gcc-multilib g++-multilib libc6-dev-i386 \
lib32ncurses5-dev x11proto-core-dev libx11-dev lib32z-dev ccache \
libgl1-mesa-dev libxml2-utils xsltproc unzip
Or
Code:
sudo apt-get install git-core gnupg ccache lzop flex bison gperf build-essential zip curl zlib1g-dev zlib1g-dev:i386 libc6-dev lib32ncurses5 lib32z1 lib32bz2-1.0 lib32ncurses5-dev x11proto-core-dev libx11-dev:i386 libreadline6-dev:i386 lib32z-dev libgl1-mesa-glx:i386 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.8-dev python
Alright We Have Installed Required Pakages To Build Rom.
Building Rom For A Particular Device!
For Example I'm Taking Samsung Galaxy Star GT-S5282,CodeName-->"Mint2g" And Taking CM13 To Build.
Extracting The Rom Source That You Had Downloaded-->>
•First Of All Download The Rom Compressed Source Which Rom You Want To Build For Your Device.
•After Download Cd To Where You Downloaded The File.For Me Its In Home/CM13.
•So For Me I Type-->>
Code:
Cd /home/CM13
•Now Type This Command To Extract The Downloaded Source-->>
▪If Your File Is In "tar.xz" Format Then Type This Command In Terminal-->>
Code:
tar -xvJf [Your File Name].tar.xz
Example:My Downloaded CM13 Compressed Source Name Is "CM-cm.13.0-no-repo-20160727.tar.xz".
So You Need To Type Like This-->>
Code:
tar -xvJf CM-cm-13.0-no-repo-20160727.tar.xz
▪If Your File Is In "tar.gz" Format Then Type This Command In Terminal-->>
Code:
tar -xvzf [Your File Name].tar.gz
Now The Source Will Be Extract!This Process Will Take Some Time.
Building Rom
•Go To The "Extracted Folder/device".
•And Then Create A Folder "samsung".[I'm Doing For Samsung Device So I'm Ceeated Folder Named "samsung".If U Making For Other Device.Then Create A Folder With Your Device's Company Name]
•Now Open The Folder[Extracted Folder/device/samsung].Then Right Click And Open The Terminal Here.
•You Have To Clone Your Device Tree.To Do It Type This Following Command-->>
Code:
git clone device_tree_URL -b branch_name
Explaination-->> Change "device_tree_device" With You Device Tree URL And "branch name" With The Rom You're Building.
For Me It Look Like This-->>
Code:
git clone https://github.com/TeamButter/android_device_samsung_mint.git -b cm-13.0
•Now Go To "Extracted Folder/vendor".
•Create A Folder Named "samsung".
•Open The Folder[Extracted Folder/vendor/samsung]
•You Have To Clone Your Vendor Tree Here.To Do That Right Click In The Folder And Open Terminal.
•Type This Following Command-->>
Code:
git clone device_vendor_tree_URL -b branch_name
Explaination-->> Change "device_vendor_tree_URL" With You Vendor Tree URL And "branch name" With The Rom You're Building.
For Me It Looks Like This-->>
Code:
git clone https://github.com/TeamButter/android_vendor_samsung_mint.git -b cm-13.0
•Now Go To Extracted Folder.
•Create A Folder Named "Kernel" Then Open This Kernel Folder And Create One More Folder Named "samsung".
•Open This Folder[Extracted Folder/Kernel/samsung]
•Right Click And Open Terminal.
•You Have To Clone Kernel Tree Here.Do To It,Type This Command-->>
Code:
git clone device_kernel_tree_URL -b branch_name
Explaination-->> Change "device_kernel_tree_URL" With You Kernel Tree URL And "branch name" With The Rom Branch You're Building.
For Me It Looks Like This-->>
Code:
git clone https://github.com/TeamButter/android_kernel_samsung_mint.git -b cm-13.0
All Done!
•Now Go To Extracted Folder.
•Right Click And Open Terminal.
•Type This Following Command-->>
Code:
source build/envsetup.sh
•Then Type This Command-->>
Code:
lunch
•And Then Type-->>
Code:
cm_codename_of_your_device_userdebug
Explanation-->>Change "codename_of_your_device" with your device codename.
•Now Type This Command-->>
Code:
mka clobber
•Finally Type This Command-->>
Code:
mka bacon
Yahhooo!You Built CM13 For Your Device.You Can Found The Flashable Zip In Home/Extracted Folder/OUT/target/product/yourdevicecodename.
Don't Forget To Hit The Thanks Button If I Helped You!
reserved 3
one more
for future
@Albe96, credits also for @regalstreak, before I dropped in with my server and the automation, he was the one slogging his butt and assembling all links. Even that automation was his idea.
Edit: And please don't use bold unnecessarily on your thread, makes it look cheapskate. Just my two cents
And set the size to 3 for good reading. Works best with guides
Just 1/2 of my cent
regalstreak
regalstreak said:
And set the size to 3 for good reading. Works best with guides
Just 1/2 of my cent
regalstreak
Click to expand...
Click to collapse
MSF Jarvis said:
@Albe96, credits also for @regalstreak, before I dropped in with my server and the automation, he was the one slogging his butt and assembling all links. Even that automation was his idea.
Edit: And please don't use bold unnecessarily on your thread, makes it look cheapskate. Just my two cents
Click to expand...
Click to collapse
added regalstreak [emoji6]
@Albe96 can I use stock boot.img in place of kernel source pls reply..
I don't have kernel source. .
Sent from my Samsung Galaxy Note 3 using XDA Labs
Yeshas Prabhakar said:
@Albe96 can I use stock boot.img in place of kernel source pls reply..
Click to expand...
Click to collapse
No!And use compressed .repo source to build a rom.don't use non-repo one.You should get error.After downloading the .repo source of the rom which you gonna build use @jackeagle's guide to build rom from source.
Yeshas Prabhakar said:
@Albe96 can I use stock boot.img in place of kernel source pls reply..
I don't have kernel source. .
Click to expand...
Click to collapse
Use any boot image unpacking tool (I recommend osm0sis' Android Image Kitchen) to unpack the boot.img and obtain boot.img-zImage from it. Rename to zImage and place it in your device tree and add
Code:
TARGET_PREBUILT_KERNEL := device/<vendor>/<codename>/zImage
To your BoardConfig.mk
Sent from my YUNIQUE using XDA Labs
MSF Jarvis said:
Use any boot image unpacking tool (I recommend osm0sis' Android Image Kitchen) to unpack the boot.img and obtain boot.img-zImage from it. Rename to zImage and place it in your device tree and add
Code:
TARGET_PREBUILT_KERNEL := device/<vendor>/<codename>/zImage
To your BoardConfig.mk
Sent from my YUNIQUE using XDA Labs
Click to expand...
Click to collapse
Thanks man.. You are the life saver... But tell me one thing that can I use the stock boot.img?? I have read somewhere that we need permissive kernel but the boot.img contains an enforcing kernel. And if not then what modifications should I do to make it work?? Well I am on an exynos device.. (galaxy j2 SM-J200G) Codename: j2lte

Categories

Resources