[Noob Friendly] How to build CM 12.1 for Flamingo - Sony Xperia E3

Hello guys,
Soo there was thread made by Vynikal but its some kind of dead and outdated for cm 12.1, i managed to make everything work on my pc and want to help everyone who has problems with building CM12.1 for Flamingo.
ATTENTION!:I or xda-dev are not responsible for any damage to your device,eyes or life, made by hapiness of having cm12.1 built
Requirements:
-Ubuntu 64bit: Tuto
-Stable internet connection, no mobile connection(its not stable enough)
-About 100GB of disk space(if you screw something up you will have some in reserve)
-All fastboot,flashboot and adb drivers installed
-Beefy pc
Lets begin:​We will start with preparations
Lets install JDK.
Code:
sudo apt-get update
then:
Code:
sudo apt-get install openjdk-7-jdk
Now you will need to install build packages, they are needed for building CyanogenMod.
Type this in terminal:
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 openjdk-7-jdk openjdk-7-jre pngcrush schedtool squashfs-tools xsltproc zip zlib1g-dev g++-multilib gcc-multilib lib32ncurses5-dev lib32readline-gplv2-dev lib32z1-dev
You will also need USB access for extracting blobs.
Code:
sudo nautilus
This will open file manager as root.
Now you must go through several steps:
1.Click Computer in the left tray of file manager - you will see some folders like: etc
2.Open Folders etc/udev/rules.d/
3.Create new document and name it: 51-android.rules
4.You can close file manager now.
If you done that 4 steps now we can continue. lets fill up that file.
Copy paste that command to console:
Code:
wget -S -O - http://source.android.com/source/51-android.rules | sed "s/<username>/$USER/" | sudo tee >/dev/null /etc/udev/rules.d/51-android.rules; sudo udevadm control --reload-rules
and change <username> to your ubuntu username. in my case it will look like this:
Code:
wget -S -O - http://source.android.com/source/51-android.rules | sed "s/dominik/$USER/" | sudo tee >/dev/null /etc/udev/rules.d/51-android.rules; sudo udevadm control --reload-rules
Now we need to create some directories:
Code:
mkdir -p ~/bin
mkdir -p ~/android/system
Last thing before loong downloading - repo command:
In terminal type:
Code:
curl https://storage.googleapis.com/git-repo-downloads/repo > ~/bin/repo
chmod a+x ~/bin/repo
Now you will need to open .bashrc with gedit its in home (you will see it if you enable Show hidden files or CTRL+H)
add that at the end of file:
Code:
export PATH=~/bin:$PATH
Now open .profile with gedit same as .bashrc its in default direction
paste this code to that file:
Code:
# set PATH so it includes user's private bin if it exists
if [ -d "$HOME/bin" ] ; then
PATH="$HOME/bin:$PATH"
fi
Initializing the repo:​Type in terminal:
Code:
cd ~/android/system
repo init -u git://github.com/CyanogenMod/android.git -b cm-12.1
Finally add local_manifest directory and copy-paste file included in attachment(thanks almighty Vynikal)
Code:
Code:
mkdir -p ~/android/system/.repo/local_manifests
And dont-click-the-red-button like command:
Code:
repo sync
And one more command to repair some duplicates in sepolicy
Code:
cd external/sepolicy
git revert 79ff523ac99b339914ccaa754e068072d64da542
Now i have Good and Bad news:
Good: we've done with the preparations.
Bad: this is not the end :silly:
Exporting blobs:​Its kinda tricky now, you will need hiper super duper stock rom and USB debugging toggled on + you need to connect your device to ubuntu, just go to devices/usb and chose your phone (its up in the vm tray)
First make sure that you allowed usb debugging(that window that will pop up in phone)
Once again open .profile and copy-paste this:
Code:
if [ -d "<path-to-sdk>/platform-tools" ] ; then
PATH="<path-to-sdk>/platform-tools:$PATH"
fi
And run that command in terminal to install adb and fastboot drivers.
Code:
sudo apt-get install android-tools-adb android-tools-fastboot
Now enter that commands in terminal:
Code:
cd ~/android/system/device/sony/flamingo
./extract-files.sh
Setting up and preparing our files to building
Code:
cd ~/android/system
. build/envsetup.sh
breakfast flamingo
Build
Code:
brunch flamingo
============================================+#@#+============================================
Thanks to:
[email protected] for creating his tuto for cm12 and manifests
-visi0nary He helped me the most with several problems that we will fix in next post
-Others that i forgot sorry and send me PM (will add you)
pc:
i5 4460
2x g.skill ripjawsx cl7 1600mhz 4gb
took about 2h with ccache

Troubleshooting​Any problems? just post logs and wait for response.
When i was building that CM i had some problems with paths like i said in first post it gave me something like this
Code:
find: `dummy': No such file or directory
find: `../../../../../../external/hamcrest/src': No such file or directory
find: `../../../../../../external/junit/src/org': No such file or directory
find: `../../../../../../external/hamcrest/src': No such file or directory
make: Entering directory `/home/dominik/android/system'
build/core/copy_headers.mk:15: warning: overriding commands for target `/home/dominik/android/system/out/target/product/flamingo/obj/include/qcom/display/copybit.h'
build/core/copy_headers.mk:15: warning: ignoring old commands for target `/home/dominik/android/system/out/target/product/flamingo/obj/include/qcom/display/copybit.h'
build/core/copy_headers.mk:15: warning: overriding commands for target `/home/dominik/android/system/out/target/product/flamingo/obj/include/qcom/display/copybit_priv.h'
build/core/copy_headers.mk:15: warning: ignoring old commands for target `/home/dominik/android/system/out/target/product/flamingo/obj/include/qcom/display/copybit_priv.h'
build/core/Makefile:46: warning: overriding commands for target `/home/dominik/android/system/out/target/product/flamingo/system/bin/wcnss_service'
build/core/base_rules.mk:550: warning: ignoring old commands for target `/home/dominik/android/system/out/target/product/flamingo/system/bin/wcnss_service'
PRODUCT_COPY_FILES vendor/sony/msm8226-common/proprietary/vendor/etc/audio_effects.conf:system/vendor/etc/audio_effects.conf ignored.
No private recovery resources for TARGET_DEVICE flamingo
make -C kernel/sony/msm8974 O=/home/dominik/android/system/out/target/product/flamingo/obj/KERNEL_OBJ ARCH=arm CROSS_COMPILE="/home/dominik/android/system/prebuilts/misc/linux-x86/ccache/ccache arm-eabi-" VARIANT_DEFCONFIG= SELINUX_DEFCONFIG= aosp_yukon_flamingo_defconfig
make[1]: Entering directory `/home/dominik/android/system/kernel/sony/msm8974'
target SharedLib: libm (/home/dominik/android/system/out/target/product/flamingo/obj/SHARED_LIBRARIES/libm_intermediates/LINKED/libm.so)
[B][COLOR="Red"]target SharedLib: libstdc++ (/home/dominik/android/system/out/target/product/flamingo/obj/SHARED_LIBRARIES/libstdc++_intermediates/LINKED/libstdc++.so)
/home/dominik/android/system/out/target/product/flamingo/obj/ETC/file_contexts_intermediates/file_contexts: Multiple different specifications for /sys/devices/virtual/graphics/fb0/rgb (ubject_r:livedisplay_sysfs:s0 and ubject_r:sysfs_display:s0).
Error loading context file from /home/dominik/android/system/out/target/product/flamingo/obj/ETC/file_contexts_intermediates/file_contexts[/COLOR][/B]
make: *** [/home/dominik/android/system/out/target/product/flamingo/obj/ETC/file_contexts_intermediates/file_contexts] Error 4
make: *** Deleting file `/home/dominik/android/system/out/target/product/flamingo/obj/ETC/file_contexts_intermediates/file_contexts'
make: *** Waiting for unfinished jobs....
GEN /home/dominik/android/system/out/target/product/flamingo/obj/KERNEL_OBJ/Makefile
#
# configuration written to .config
#
make[1]: Leaving directory `/home/dominik/android/system/kernel/sony/msm8974'
make: Leaving directory `/home/dominik/android/system'
#### make failed to build some targets (02:17 (mm:ss)) ####
i marked that place. visi0nary told me that 2 files has same paths that interfere each other and doesnt allow to continue with build. soo we found solution, but idk if its my fault or its some typo or other kind of mistake
Fix:
1. Go to android/system/device/sony/msm8226-common/sepolicy
2. Open file_contexts in gedit and add # before last line
it should look like this:
Code:
# Trim Area daemon
/dev/socket/tad u:object_r:tad_socket:s0
# CPU governor controls
/dev/socket/mpdecision(/.*)? u:object_r:mpctl_socket:s0
/dev/socket/mpctl u:object_r:mpctl_socket:s0
/dev/pn547 u:object_r:nfc_device:s0
/dev/block/platform/msm_sdcc\.1/by-name/modemst1 u:object_r:modem_efs_partition_device:s0
/dev/block/platform/msm_sdcc\.1/by-name/modemst2 u:object_r:modem_efs_partition_device:s0
/dev/block/platform/msm_sdcc\.1/by-name/fsg u:object_r:modem_efs_partition_device:s0
/dev/block/platform/msm_sdcc\.1/by-name/TA u:object_r:trim_area_partition_device:s0
/data/system/default_values u:object_r:mpctl_data_file:s0
/system/bin/sct_service u:object_r:sct_exec:s0
/system/bin/tad_static u:object_r:tad_exec:s0
/system/bin/ta_qmi_service u:object_r:ta_qmi_exec:s0
/system/bin/thermanager u:object_r:thermanager_exec:s0
#/sys/devices/virtual/graphics/fb0/rgb -- u:object_r:sysfs_display:s0
for actual moment cm 12.1 dont work at all

Woah, it's been a long time since I stopped visiting this forum.
Your tut is kinda good, but I can't tell if something has changed in the past.
Actually those blobs you are extracting should be located in this repo, which is also downloaded through local_manifests, so maybe extracting them again is useless.
Bad luck, this device feels abandoned since the begining.
But hey, does it boot? If yes, progress has been made :cyclops:

Vynikal said:
Woah, it's been a long time since I stopped visiting this forum.
Your tut is kinda good, but I can't tell if something has changed in the past.
Actually those blobs you are extracting should be located in this repo, which is also downloaded through local_manifests, so maybe extracting them again is useless.
Bad luck, this device feels abandoned since the begining.
But hey, does it boot? If yes, progress has been made :cyclops:
Click to expand...
Click to collapse
nope dont boot at all at any build
and yeah they should be downloaded with it but somehow when i was compiling it there was error that prevented from building it, after extracting that blobs(something might be missing) everyhing went ok
ps. sorry that i used your thread without permission

MasterDomino said:
nope dont boot at all at any build
and yeah they should be downloaded with it but somehow when i was compiling it there was error that prevented from building it, after extracting that blobs(something might be missing) everyhing went ok
ps. sorry that i used your thread without permission
Click to expand...
Click to collapse
No worries, I have no plans on this forum. My E3 is broken, beaten and scarred. And with Firefox OS installed.
I was always wondering why the hell no CM12 build boots. I guess I won't know anytime soon.

Vynikal said:
No worries, I have no plans on this forum. My E3 is broken, beaten and scarred. And with Firefox OS installed.
I was always wondering why the hell no CM12 build boots. I guess I won't know anytime soon.
Click to expand...
Click to collapse
me and visi0nary found out it's propably fstab because adb not even toggles, its propably problem with mounting :/

Is this will work for all varian?

useone07 said:
Is this will work for all varian?
Click to expand...
Click to collapse
propably not because it doesnt work for my wariant(selinux or fstab problem ) cm 12 works perfectly but on D2203, idk about other wariants.

Related

How-to compile a fresh Android!

Hi all.
In this thread I'd like to collect all the information I've found scattered in various threads in order to compile Android system and kernel, directly from GIT repo.
Hoping this help who wants to try to compile Froyo from the GIT repo but really doesn't know where to start!!!
All credits for this infos, obviously, doesn't go to me but to all the great persons I've found in this forum, helping me with a lot of informations: Dzo, l1q1d, Kalt_Kaffe, Incubus and many others.
If something of the things written below is not correct... first of all forgive me! I'm only a newbie trying to do something useful for others like me!!! Then please... help me to correct the mistakes!!!
And then, please, forgive my really bad english! Any correction is appreciated!
DISCLAIMER: even if this steps have been personally tested by me everything u'll decide to do u'll do at ur own risk. The flashing procedure may brick your device.
I've implanted all the compiling environment in a virtual machine with the latest Ubuntu (10.04).
NOTE ABOUT VIRTUAL MACHINE: if you are using a virtual machine it's important that you setup it with at least 1,5GB or RAM. With less RAM than this your Android will not compile.
All you need to obtain a fresh Android System is only a lot of time (and patience) and at least 10GB of free disk space.
10GB is the very minimum disk space you need. If you decide to try in a virtual machine I suggest to create a virtual disk at least 20GB.
1) Install needed software
As in the latest Ubuntu version the repositories have the "sun-java6-jdk", with which you cannot compile Android, you have to install the previous Java version from the Jaunty repo. To do this edit, with your favourite text editor and using "sudo", the "etc/apt/sources.list" file adding the following two lines:
Code:
deb http://us.archive.ubuntu.com/ubuntu/ jaunty multiverse
deb http://us.archive.ubuntu.com/ubuntu/ jaunty-updates multiverse
and then, from a terminal, run the following commands:
Code:
sudo apt-get update
sudo apt-get install sun-java5-jdk
After this you can delete/comment the two lines added above in the sources.list file.
Then, according to the instruction described here, install the needed software with the following command:
Code:
$ sudo apt-get install git-core gnupg flex bison gperf libsdl-dev libesd0-dev libwxgtk2.6-dev build-essential zip curl libncurses5-dev zlib1g-dev valgrind
2) Installing repo and configuring the environment
After the installation of the needed software follow this steps to create the right environment for ur compilation. I assume to work in my "/home/virtual" directory. If d'u like to work in another directory simply replace this path with yours in the commands.
Code:
$ mkdir bin
$ PATH=$PATH:/home/virtual/bin/
$ curl http://android.git.kernel.org/repo > /home/virtual/bin/repo
$ chmod a+x /home/virtual/bin/repo
$ mkdir mydroid
$ cd mydroid
3) Downloading, syncing and compiling the source
Now that you are in the destination directory (I've called it "mydroid" but obviously you can call it with every name you want) you've to init and syncing your repo with the one on the server.
The "init" step have to be executed only the first time. Then you can start directly from the "sync" command.
The following steps may need a looooooot of time (about 3 hours in my virtual machine) so you can have one (or two maybe!!!) coffee in the further coffee bar in your city!!!
Anyway let's go:
Code:
$ repo init -u git://androidhtc.git.sourceforge.net/gitroot/androidhtc/manifest -b froyo
$ repo sync
$ . build/envsetup.sh
$ lunch full_vogue-userdebug
$ make
With these commands you'll obtain a system with all languages in it.
You'll find the "system" folder under "out/target/product/vogue". Simply tar it and you're in!!!
4) Compiling the kernel
If you only want to compile the kernel you have to follow this steps (from your repo dir - "mydroid" in my case)
Code:
$ cd kernel
Open, with your favourite text editor, the file "Makefile" and change the CROSS_COMPILE line like the following:
Code:
CROSS_COMPILE=../prebuilt/linux-x86/toolchain/arm-eabi-4.4.0/bin/arm-eabi-
then run the following commands:
Code:
make vogue_defconfig
make
After the compilation you'll find the "zImage" file into "kernel/arch/arm/boot/" and use it like you want (I.E. I compile it with NBHCreator in order to flash it into my Polaris).
That's all, folks!!!
Enjoy!
Initializing project gps ...
fatal: The remote end hung up unexpectedly
error: Cannot fetch gps
way not?
did it finish or did it get stuck and there is more to fetch?

[GUIDE]BUILD CM10.1 FROM SOURCE| AIRFLUIP EDITION [Mac + Linux]

GITHUB servers are up!
So I finally thought that I should make a guide to build from source as I feel like the one on the wiki is a bit outdated and isn't very clear.
I will cover both instructions for how to build for Ubuntu 13.04 (64 bit only), and OS X 10.8.x(PLEASE KEEP AT LEAST 35GB Free)
LINUX SPECIFIC INSTRUCTIONS
Please open a terminal window NOW. If you can't do this, don't build android. Please be vigilant in following in-terminal directions, such as pressing enter if it's asking you to do so or confirm something, and using sudo before a command will invoke a password prompt also if entering a new command, please wait until the command exits out to the bash prompt (asking for a new command)
First, let's get rid of the wrong java assuming it's already installed, Android will "REFUSE" to build properly with the wrong java.
Code:
sudo apt-get purge openjdk-\* icedtea-\* icedtea6-\*
Now let's install the correct java,
Code:
sudo add-apt-repository ppa:webupd8team/java && sudo apt-get update && sudo apt-get install oracle-java6-installer && java -version
It should end with this
java version "1.6.0_37"
Java(TM) SE Runtime Environment (build 1.6.0_37-b06)
Java HotSpot(TM) 64-Bit Server VM (build 20.12-b01, mixed mode)
or something like it.
Now let's set up for making bacon!
Enter this in order to get dependencies for building android, please note that this is about 100-150 megs and will take a few minutes/10ish minutes depending on your computer and internet connection.
Code:
sudo apt-get install git-core gnupg flex bison gperf build-essential zip curl zlib1g-dev zlib1g-dev:i386 libc6-dev lib32ncurses5-dev ia32-libs x11proto-core-dev libx11-dev:i386 libreadline6-dev:i386 lib32z-dev libgl1-mesa-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
then,
Code:
sudo ln -s /usr/lib/i386-linux-gnu/mesa/libGL.so.1 /usr/lib/i386-linux-gnu/libGL.so
Repo is required for sucking sources from the cloud, so let's get it
Code:
mkdir ~/bin && curl https://dl-ssl.google.com/dl/googlesource/git-repo/repo > ~/bin/repo && chmod a+x ~/bin/repo
Now let's add this repo thing to our path
Code:
sudo nano ~/.bashrc
at the bottom of the file,add this
Code:
export PATH=~/bin:$PATH
now press Ctrl-O followed by Ctrl-X
restart bash by entering
Code:
source ~/.bashrc
now find a directory to build android in. Personally, I use /home/username/android
so for now let's place it in there
Code:
mkdir ~/android && cd ~/android && mkdir cm && cd cm
SYNC TIME!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!x10^infinity!
Code:
repo init -u git://github.com/CyanogenMod/android.git -b cm-10.1 && mkdir -p .repo/local_manifests && curl https://raw.github.com/teamuserdebug/page/manifests/manifests/cm10.1-aries.xml > .repo/local_manifests/local_manifest.xml && repo sync
make sure you acknowledge name, color, email etc, or you'll be sitting around and wasting time. this can take anywhere from 1 hr to 1 week depending on your internet connection, personally takes me 3-5 hrs.
go grab a starbucks and come back, you'll need it.
after it's done, make sure you are still in your cm directory.
IT'S BUILDING TIME
OPTIONAL: If you have some free space sitting around eg, 70-100 gigs for building android,
it's time to setup CCACHE, this speeds up future builds by "A LOT"
first edit .bashrc
Code:
sudo nano ~/.bashrc
add these lines at the bottom
Code:
export CCACHE_DIR=/home/-username-/.ccache
(Note, replace "-username-" with your computer username, without the dashes.
Code:
export USE_CCACHE=1
press Ctrl-O followed by Ctrl-X
enter
Code:
[CODE]source ~/.bashrc
[/CODE]
now enable ccache by entering
Code:
prebuilts/misc/linux-x86/ccache/ccache -M50
or
Code:
./prebuilts/misc/linux-x86/ccache/ccache -M50
if the first one doesn't work
BUILD TIME:
enter these
Code:
cd ~/android/cm
Code:
vendor/cm/get-prebuilts
Code:
. build/envsetup.sh
Code:
lunch cm_galaxys4gmtd-userdebug
Code:
mka clobber
Code:
mka bacon
It will be in ~/android/cm/out/products/target/galaxys4gmtd/cm-unofficial-something-something-signed.zip or something like that.
Make sure you don't pick the wrong zip file, because there are 2 or 3 in there.
OS X 10.8.x SPECIFIC INSTRUCTIONS
Please open a terminal window NOW. If you can't do this, don't build android. Please be vigilant in following in-terminal directions, such as pressing enter if it's asking you to do so or confirm something, and using sudo before a command will invoke a password prompt also if entering a new command, please wait until the command exits out to the bash prompt (asking for a new command)
First, let's install java if it's not already installed
Code:
java
Now, we MUST install X-Code otherwise we won't even be able to lunch.
1. Open the App Store
2. Find X-Code,(it's free) and install it [this is a 1+ GB download, and install]
3.Open X-Code and go to preferences. There you find a 'Downloads' tab. Open it and install “Command line tools” It will take a few minutes to download and install
Now let's set up for making bacon!
Download and install MacPorts, not Homebrew, since MacPorts is faster.
You can get the mountain lion pkg installer here
After it is installed, close and open terminal.
edit your bash profile
Code:
sudo nano ~/.bash_profile
add
Code:
export BUILD_MAC_SDK_EXPERIMENTAL=1
somewhere at the bottom
Press Ctrl-X, then y, then "enter/return" Note: Yes, the control key is used, not the command key, so don't be confused
Install dependencies to make bacon
Code:
POSIXLY_CORRECT=1 sudo port install git-core coreutils findutils gsed gnupg pngcrush repo
then
Code:
sudo ln -s /opt/local/bin/gfind /opt/local/bin/find && ln -s /opt/local/bin/gsed /opt/local/bin/sed
run
Code:
pngcrush
in terminal to make sure that things are properly in your path
THEY SHOULD BE since MacPorts edits your .bash_profile for you.
Now, we need a case-sensitive folder so we will need to make a sparseimage which you will have to mount every time you want to do something with your android builds.(like a DMG), but for now, this command will attach it for you. It will be on your desktop
Code:
hdiutil create -type SPARSE -fs "Case-sensitive Journaled HFS+" -size 60g -volname "android" -attach ~/Desktop/Android
Make the cm folder
Code:
cd /Volumes/Android && mkdir cm && cd cm
SYNC TIME!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!x10^infinity!
Code:
repo init -u git://github.com/CyanogenMod/android.git -b cm-10.1 && mkdir -p .repo/local_manifests && curl https://raw.github.com/teamuserdebug/page/manifests/manifests/cm10.1-aries.xml > .repo/local_manifests/local_manifest.xml && repo sync
make sure you acknowledge name, color, email etc, or you'll be sitting around and wasting time. this can take anywhere from 1 hr to 1 week depending on your internet connection, personally takes me 3-5 hrs.
go grab a starbucks and come back, you'll need it.
after it's done, make sure you are still in your cm directory.
Before we build, we have to fix an elf.h error
Code:
cp /Volumes/android/cm/external/elfutils/libelf/elf.h /usr/local/include
IT'S BUILDING TIME
OPTIONAL: If you have some free space sitting around eg, 70-100 gigs for building android,
it's time to setup CCACHE, this speeds up future builds by "A LOT"
install a ccache which is usable by mac
Code:
sudo port install ccache
edit your bash profile to use ccache.
Code:
sudo nano ~/.bash_profile
find the line that says
Code:
export PATH=/opt/local/bin:/opt/local/sbin:$PATH
and edit it to say
Code:
export PATH=/opt/local/libexec/ccache:/opt/local/bin:/opt/local/sbin:$PATH
press Ctrl-X, then y, then "enter/return"
then exit and reopen terminal
now configure ccache's memory
Code:
ccache -M50
BUILD TIME:
enter these
Code:
cd ~/android/cm
Code:
vendor/cm/get-prebuilts
Code:
. build/envsetup.sh
Code:
lunch cm_galaxys4gmtd-userdebug
Code:
mka clobber
Code:
mka bacon
It will be in /Volumes/android/cm/out/products/target/galaxys4gmtd/cm-unofficial-something-something-signed.zip or something like that.
Make sure you don't pick the wrong zip file, because there are 2 or 3 in there
nice, didn't take long to get it stickied either.
sent from within pure darkness
I know right!
Also, I have edited it for the mac version as well.
Now you guys can build on both mac and linux!!!!!!!!!!!!
Also, I will post when github stuffs are back up.
Thx. is this coming from a straight Unbuntu say setup without having to install a bunch of crap? I had that BBQLinux installed which is supposed to be for building android but it didn't have apt installed, so then tried yum to install that, and it didn't have that. lol. Just going to install Ubuntu on a VM and try your directions from a new install.
yes
but obviously you need to have wifi
airfluip1 said:
yes
but obviously you need to have wifi
Click to expand...
Click to collapse
Why do I need wifi?
i mean internet.
airfluip1 said:
i mean internet.
Click to expand...
Click to collapse
O ya, I got tonnes of that. lol. Thanks for the guide though. I've tried a few times to get a build environment going and it always goes wacky or I don't get something right.
i think that they are up now.
airfluip1 said:
i think that they are up now.
Click to expand...
Click to collapse
don't know, I'm getting fetch errors, url can't found, 404 and then when it's done, it craps out and says can't sync, too many fetch errors. Is this the servers still being down?
Maybe
Sent from my SGH-T959V using xda premium
airfluip, you might have been better off creating a local_manifest.xml file (though those are deprecated and now you can just create a manifest file called, for example, airfluip1_aokp.xml).
You're going to have to keep up with the platform_manifest changes and will have to resolve merge conflicts if the AOKP team decides to make some major changes (not unlikely).
You can actually add the changes you made to the manifest.xml into a custom manifest xml file similar to what we did with team acid's CM9/AOKP repos.
maybe, but I thought it was easier. I'll change it in a week or two.
Just thought I'd throw in that BBQLinux is arch based and for building android and linuxBBQ is NOT the same thing, it's probably the worst distro to start from to build android. In case someone else decides to go there.
airfluip1 said:
maybe, but I thought it was easier. I'll change it in a week or two.
Click to expand...
Click to collapse
Just as a way to make syncing source faster, you can also remove the device/kernel trees for other devices that aren't the SGS4G so that we can just download what's necessary for building for our phone.
yeah, I know. I'll do that later as well. I just don't have much time for a few weeks.
I got a rom compiled with your sources airfluip. I haven't flash tested yet.
I did run into problems with the SGS4GParts package so I had to remove it from galaxys4gmtd.mk, other than that the rom compiled fine. I'll help you look into the error later.
Thanks for the guide, easy to follow
EDIT
By the way, are you using TWRP in these builds, or is it CWM?
Code:
______ _____ __ __ _____
/\ _ \/\ __`\/\ \/\ \ /\ _ `\
\ \ \L\ \ \ \/\ \ \ \/'/'\ \ \L\ \
\ \ __ \ \ \ \ \ \ , < \ \ ,__/
\ \ \/\ \ \ \_\ \ \ \\`\ \ \ \/
\ \_\ \_\ \_____\ \_\ \_\\ \_\
\/_/\/_/\/_____/\/_/\/_/ \/_/
===========-Package complete-===========
zip: /home/fb/android/jb_aokp/work/out/target/product/galaxys4gmtd/aokp_galaxys4gmtd_unofficial_2013-05-14.zip
md5: c8fcc3417bab626ca6d018b88450ab42
size: 150M
========================================
It must have been something that I edited.
I am using CWm.
I don't like twrp very much.
It's always something....
I'm not sure if something changed since you made this tutorial but I can't seem to get this to build.
My first attempt resulted in the SGS4GParts error like FB mentioned. Which seems to have something to do with the TVOut setting.
Each attempt at rebuilding I seem to get different errors.
I also get this when building starts...normal?
Code:
find: `../../vendor/unbundled_google/libs/gcm/gcm-client/src': No such file or directory
find: `../../vendor/unbundled_google/libs/gcm/gcm-server/src': No such file or directory
find: `../../vendor/unbundled_google/libs/gcm/gcm-client/src': No such file or directory
find: `../../vendor/unbundled_google/libs/gcm/gcm-server/src': No such file or directory
find: `src': No such file or directory
Edit: Is there a way to grab a log of the entire build output? Is it saved to a file somewhere?
LOL I am building right now.
The src error is normal
AND IF THERE IS A BUILD ERROR, POST A LOG IN PASTEBIN.
ALSO, THERE SHOULDN'T BE ANY BUILD ERRORS RIGHT NOW AS LONG as you
Code:
repo sync
before you do a new build.
Also you should run
Code:
make clobber && mka bacon
everytime.

[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

Categories

Resources