How To Build Rom From Compressed Sources - Miscellaneous Android Development

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

Related

[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

Problem building Resurrection Remix for Z5P

Hi, I want to make RR for our Z5 Premium; using the CTXz GUIDE and Resurrection one
Everything works great, 'til final building
I just mark the step in case i'm not doing it right
1. OpenJDK
2. Necessaries tools
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 maven schedtool
I type the whole line in terminal
3. Set up cache, then reboot
4. Git config' (Username + Email)
5. Creation of "Bin" folder into my /home/myname/ and changing permissions of it
6. Now I create "RR" in /home/myname/
7. I switch to this folder (cd ~/RR/)
8. repo init the RR sources
Code:
repo init -u [url]https://github.com/ResurrectionRemix/platform_manifest.git[/url] -b marshmallow
9. repo sync (Waaaaaiting)
10. Once it's done, I have to deal with Z5 files (I suppose this is the part where something goes wrong)
Code:
cd /.repo
Code:
git clone https://github.com/Sony-Kitakami/and..._manifests.git local_manifests
11. cd to go to /RR/ then
Code:
repo sync --force-sync
12.
Code:
source build/envsetup.sh
3.
Code:
lunch cm_satsuki-userdebug
14.
Code:
mka clobber && mka bacon
15. the rom seems in build (many lines of code)
At the end it wrote an error message, and in ~/RR/out/target/product/satsuki/
I only get 3 folders like
system (ridiculous size -> 28.7ko)
obj
root
& 2 .mk files
The problem comes from the step I add Sony files ? , I probably didn't make it right :/
Thanks in advance to anyone who will lose his time with me <3
I got Ubuntu 14.04LTS
Click to expand...
Click to collapse
,
java version "1.7.0_95"
OpenJDK Runtime Environment (IcedTea 2.6.4) (7u95-2.6.4-0ubuntu0.14.04.2)
OpenJDK 64-Bit Server VM (build 24.95-b01, mixed mode)
Click to expand...
Click to collapse
Set up the terminal so that it at least has 100,000 lines of backlog,
then from the start of entering
mka clobber && mka bacon
copy over the whole log output to e.g. geany
search for error or fail in Document
there must be more output and explaining what went wrong
I'm gonna do that
here it is

Stock kernel "source code" <lg x165g >

hi guys, 2 days ago lent me this phone to make root , I made a backup of the system :laugh: :good:
Kernel :v
source https://github.com/HB72K/android_kernel_lgx165_mt6582 :good:
System :good:
backup https://github.com/HB72K/rom_stock_lg_x165_telcel
how to compile kernel?
1. Requirements.
- Have 2GB + of RAM (I compiled with 4 GB).
-Have A Dual Core + processor (I compiled a QuadCore at 2.3GHz).
-Have At Least 10+ GB of available space on your hard disk.
-Have An account GitHub
-linux 64-bit (I use Xubuntu 14.04)
2. Install Dependencies.
- Open the Linux terminal and then put the following code and will enter.
sudo apt-get install git ccache automake lzop bison gperf build-essential zip curl zlib1g-dev zlib1g-dev:i386 g++-multilib python-networkx libxml2-utils bzip2 libbz2-dev libbz2-1.0 libghc-bzlib-dev squashfs-tools pngcrush schedtool dpkg-dev liblz4-tool make optipng
3. Preparation To Download The Source Code.
- Now let's lower the kernel source for that we in the terminal the following
command: git clone https://github.com/HB72K/android_kernel_lgx165_mt6582.git
git clone https://github.com/Christopher83/arm-cortex_a7-linux-gnueabihf-linaro_4.9.git
4. Build
Now, once you have downloaded All source code must be able to execute its first compilation, for that we put these commands standing at kernel directory on the terminal:
cd android_kernel_lgx165_mt6582
make ARCH=arm v10_defconfig
"cores of your computer + 1 .<in my case is 4 cores>" 4+1 = 5 make -j5
make -j5 ARCH=arm CROSS_COMPILE=~/arm-cortex_a7-linux-gnueabihf-linaro_4.9/bin/arm-cortex_a7-linux-gnueabihf-
It will be saved in the following path" home/USER/android_kernel_lgx165_mt6582/arch/arm/boot/" :laugh: :fingers-crossed: :good:
CONGRATULATIONS :laugh:
Tnx :good:
reserved
2 .reserved
Can I export my stock kernel source code using this method?
Sent from my Lava 821 using Tapatalk

Guide To Building Custom Pixel 4a Roms(move if needed)

This is a place holder for anyone that can assist in helping of building custom roms for our pixel 4a. Please note this will need Linux version on how to setup an environment for the build and how to build the roms,. Anyone please that can help add infor mation on how to do these as i know there are many guides but we need one specifically for our device to get development moving along. Please post on stock aosp roms, lineage roms , miui roms etc. i will also try to update as much as i can , hopefully this thread doesnt get moved.
This is the setup from google to setting up an environment to build android aosp
Establishing a Build Environment | Android Open Source Project
source.android.com
​Establishing a Build Environment​
Important:Platform development on MacOS isn't supported as of June 22, 2021.
This section describes how to set up your local work environment to build the Android source files. You must use Linux; building under either MacOS or Windows isn't supported.
For an overview of the entire code-review and code-update process, see Life of a Patch.
Note: All commands in this site are preceded by a dollar sign ($) to differentiate them from output or entries within files. Use the Click to copyfeature located at the top right of each command box to copy all lines without the dollar signs, or triple-click each line to copy it individually without the dollar sign.
Choosing a branch​Some requirements for the build environment are determined by the version of the source code that you plan to compile. For a full list of available branches, see Build Numbers. You can also choose to download and build the latest source code (called master), in which case you simply omit the branch specification when you initialize the repository.
After selecting a branch, follow the appropriate instructions below to set up your build environment.
Setting up a Linux build environment​These instructions apply to all branches, including master.
The Android build is routinely tested in house on Ubuntu LTS (14.04) and Debian testing. Most other distributions should have the required build tools available.
For Gingerbread (2.3.x) and higher versions, including the master branch, a 64-bit environment is required. Older versions can be compiled on 32-bit systems.
Note: See Requirements for the complete list of hardware and software requirements, then follow the detailed instructions for Ubuntu below.
Installing required packages (Ubuntu 18.04)​You need a 64-bit version of Ubuntu.
sudo apt-get install git-core gnupg flex bison build-essential zip curl zlib1g-dev gcc-multilib g++-multilib libc6-dev-i386 lib32ncurses5-dev x11proto-core-dev libx11-dev lib32z1-dev libgl1-mesa-dev libxml2-utils xsltproc unzip fontconfig
Installing required packages (Ubuntu 14.04)​You need a 64-bit version of Ubuntu (14.04 is recommended).
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 libgl1-mesa-dev libxml2-utils xsltproc unzip
Note: To use SELinux tools for policy analysis, also install the python-networkx package.Note:If you're using LDAP and want to run ART host tests, also install the libnss-sss:i386 package.
Installing required packages (Ubuntu 12.04)​You may use Ubuntu 12.04 to build older versions of Android. Version 12.04 isn't supported on master or recent releases.
sudo apt-get install git gnupg flex bison gperf build-essential zip curl libc6-dev libncurses5-dev:i386 x11proto-core-dev libx11-dev:i386 libreadline6-dev:i386 libgl1-mesa-glx:i386 libgl1-mesa-dev g++-multilib mingw32 tofrodos python-markdown libxml2-utils xsltproc zlib1g-dev:i386
sudo ln -s /usr/lib/i386-linux-gnu/mesa/libGL.so.1 /usr/lib/i386-linux-gnu/libGL.so
Installing required packages (Ubuntu 10.04-11.10)​Building on Ubuntu 10.04-11.10 is no longer supported, but may be useful for building older releases of AOSP.
sudo apt-get install git gnupg flex bison gperf build-essential zip curl zlib1g-dev libc6-dev lib32ncurses5-dev ia32-libs x11proto-core-dev libx11-dev lib32readline5-dev lib32z-dev libgl1-mesa-dev g++-multilib mingw32 tofrodos python-markdown libxml2-utils xsltproc
On Ubuntu 10.10:
sudo ln -s /usr/lib32/mesa/libGL.so.1 /usr/lib32/mesa/libGL.so
On Ubuntu 11.10:
sudo apt-get install libx11-dev:i386
Configuring USB access​Install a community-maintained default set of udev rules for all Android devices by following the instructions to Set up a device for development.
Using a separate output directory​By default, the output of each build is stored in the out/ subdirectory of the matching source tree.
On some machines with multiple storage devices, builds are faster when storing the source files and the output on separate volumes. For additional performance, the output can be stored on a file system optimized for speed instead of crash robustness, because all files can be regenerated if the file system is corrupted.
To set this up, export the OUT_DIR_COMMON_BASE variable to point to the location where your output directories will be stored.
export OUT_DIR_COMMON_BASE=<path-to-your-out-directory>
The output directory for each separate source tree is named after the directory holding the source tree. For instance, if you have source trees /source/master1 and /source/master2 and if OUT_DIR_COMMON_BASE is set to /output, the output directories are /output/master1 and /output/master2.
Avoid having multiple source trees stored in directories that have the same name, as the source trees would end up sharing an output directory, with unpredictable results. This is only supported on Jelly Bean (4.1) and higher, including the master branch.
Next: Download the source​Your build environment is good to go!
How to Build a Custom ROM from Android Open Source Project - Appuals.com
If you’re familiar with rooting your Android phone or downloading custom ROMs, such as the highly popular CyanogenMod or its successor Lineage OS, you may
appuals.com
​Downloading the Android Source​The AOSP is hosted on Git, so we’re going to use a tool called Repo to communicate with Git.
First we need to setup a /bin folder in your Home directory. Type the following commands into the Linux terminal:
$ mkdir ~/bin
$ PATH=~/bin:$PATH
Now we will download the Repo tool, so type into the Linux terminal:
$ curl https://storage.googleapis.com/git-repo-downloads/repo > ~/bin/repo
$ chmod a+x ~/bin/repo
After Repo is installed, we must now create an empty directory to hold your work files. So type this into the Linux terminal:
$ mkdir WORKING_DIRECTORY
$ cd WORKING_DIRECTORY
Now we’ll configure Git with your name and email address – use a Gmail address that you check regularly, otherwise you will not be able to use the Gerrit code-review tool.
$ git config –global user.name “Your Name”
$ git config –global user.email [email protected]
Now we’ll tell Repo to pull the latest master manifest of AOSP from Git:
$ repo init -u https://android.googlesource.com/platform/manifest
If done successfully, you’ll receive a message that Repo has been initialized in your working directory. You’ll also find a “.repo” directory inside the client directory. So now we’ll download the Android source tree with:
$ repo sync
Building the Android Source
This is where the hardware binaries mentioned at the beginning of this guide come into play. Let’s head over to the AOSP drivers page and download the Pixel XL binaries for Android 7.1.0 (NDE63P). You want to download both the vendor image and the hardware components. These come as compressed archives, so extract them to your desktop and run the self-extracting script from the root folder. Choose to install the binaries to the root of the WORKING_DIRECTORY we created earlier.
Now type into your Linux terminal:
$ make clobber
$ source build/envsetup.sh
Now we’ll choose the target to build, so type:
$ lunch aosp_marlin-userdebug
$ setpaths
$ make –j4
There, we have now “built” an Android ROM from source. So let’s test it in the emulator, by typing into the terminal:
$ emulator
So play around in the emulator a bit. As you can see, a purely vanilla Android experience is quite minimal, and this is why manufacturers customize the AOSP to their needs. So you could flash this ROM we just built to your device if you wanted, but without adding any enhancements, a purely vanilla Android experience would be a very boring thing indeed.

Categories

Resources