[Guide] Build your own Kernel for Galaxy W - Samsung Galaxy W I8150

Hello guys!
Because the GT-i9001 (Galaxy S Plus) has a Kernel Building Tutorial, I decided to make one for the i8150 as these 2 devices are very similar.
This tutorial is based on this one by our Recognized Contributor, Xistance: /showthread.php?t=1966751. So all the credit goes to him!
First of all, you will need Ubuntu(it may work on other distros too, but Ubuntu is the most easy one to set up) these versions were tested:
14.04 - (this is were I build ROM's and Kernels)
13.10
12.10
12.04
10.04
Ok, so lets get started!
PART 1 - Installing Required Programs, Packages and Toolchains:
Android SDK
Download the SDK here: http://developer.android.com/sdk/index.html
Extract the SDK and place it in your home directory.
I rename the SDK to android-sdk to make it easier to navigate to.
Go to your home folder, press Ctrl+H to show hidden files, and open up your .bashrc file.
Add these lines at the bottom of the file(Change path according to your SDK dir):
Code:
# Android tools
export PATH=${PATH}:~/android-sdk/tools
export PATH=${PATH}:~/android-sdk/platform-tools
export PATH=${PATH}:~/bin
Install required packages:
Open the Terminal and type:
Code:
sudo apt-get install git-core gnupg flex bison gperf build-essential \
zip curl libc6-dev libncurses5-dev:i386 lib32ncurses5-dev x11proto-core-dev \
libx11-dev:i386 libreadline6-dev:i386 libgl1-mesa-glx:i386 \
libgl1-mesa-dev g++-multilib mingw32 openjdk-6-jdk tofrodos \
python-markdown libxml2-utils xsltproc zlib1g-dev:i386
sudo ln -s /usr/lib/i386-linux-gnu/mesa/libGL.so.1 /usr/lib/i386-linux-gnu/libGL.so
Getting the Toolchain:
Open the terminal and type
Code:
mkdir android && cd android
mkdir kernel && cd kernel
Now clone this repo by DooMLoRD, these are precompiled toolchains, essential for compiling: (You can use any other linaro toolchains you want)
Code:
git clone git://github.com/DooMLoRD/android_prebuilt_toolchains.git toolchains
Make sure you have the toolchain folder in the Android folder as well as in the Kernel folder.
PART 2 - Getting the source, and making modifications:
Now we need to git clone the kernel source, this time I will use arco's github source:
Code:
cd android/kernel
git clone git://github.com/arco/samsung-kernel-msm7x30 -b ics-2.6
After -b you must specify the branch you want to clone, in this example, I used the ICS 2.6 branch.
After the repo is cloned you can modify/add features to kernel.
Examples in the second post.
PART 3 - Building the Kernel:
cd to your kernel directory:
Code:
cd android/kernel/samsung-kernel-msm7x30
Ok, now we need to set our target architecture and set the path to the toolchain we would like to use.
In this example, I will use the 4.6.2 toolchain downloaded above:
Code:
export ARCH=arm
export CROSS_COMPILE=~/android/kernel/toolchains/arm-eabi-linaro-4.6.2/bin/arm-eabi-
Now we need to load our configuration file, also, setting the board we would like to use, in this case, it is Ancora Board:
Code:
make ancora_defconfig
Than, we need to load menuconfing in order to apply the changes we made to the kernel (Governors, I/O schedulers, OC and so on)
Code:
make menuconfig
*Activating CPU Governors can be made under "CPU Power Management" Tab
*Activating I/O Schedulers can be made under "Enable block layer" tab
*OC can be activated under "System Type" tab
Now, the building will start after this command:
Code:
make -jx
x(max number of jobs per core)= number of CPU cores + 1 (for a QuadCore CPU there will be make -j5)
The building should take 5 to 10 minutes depending on your CPU.
PART 4 - Exporting the zImage and the modules
If the kernel compiled successfully you should see something like: zImage is ready.
Now, we need to export the zImage and the compiled modules into a folder:
Code:
A. Open a terminal
B. Change to your root kernel directory
C. Type "mkdir ../_output"
D. Type "cp arch/arm/boot/zImage ../_output/zImage"
E. Type "find . -name "*.ko" -exec cp {} ../_output \;"
Credits for this goes to Recognized Developer Hacre
PART 5 - Making the boot.img
Ok, this part is optional and it depends on your knowledge level.
The most easiest way to make the boot.img is using dsixda's Android Kitchen.
I recommend using this version from GT-i9001 forum as it is the same as for i8150: /showthread.php?t=1399468.
For this example, we built a zImage based on arco's sources for 2.6 kernel so we will need his ROM base.
Download the kitchen, and put the ROM (flashable ZIP) into the "original-update" folder.
Then, open up the kitchen (menu.sh) and press 1 (Set up working folder from ROM).
Choose your ROM and then press enter. After this we would like to go to 0 - Advanced Options and then 12 - Tools For Boot.img.
Here we need to press w to extract the content of the boot.img from the working directory.
Than, replace the zImage from BOOT-EXTRACTED with your zImage.
Also, you can put the compiled modules (.ko) inside /lib/modules in the RAMDISK folder
Now go back to the terminal and press b to build back your boot.img (which will be located in working folder)
PART 6 - Flashing the boot.img and Making Flashable ZIP
The compiled boot.img can be flashed to the device using adb like this: (If you don't know what adb is or how to use it, please search on Google/XDA for tutorials)
Code:
adb push boot.img /sdcard/boot.img
adb shell
su
dd if=/sdcard/boot.img of=/dev/block/mmcblk0p8
reboot
Commands explained:
adb push = it pushes the compiled boot.img to the internal sd card of the phone.
dd if = READ FROM FILE
dd of = WRITE TO FILE
mmcblk0p8 = the partition where the Kernel Image goes.
After that, we need to manually push the modules into /system/lib/modules on our phone. This can be done through adb like this:
Code:
adb push dhd.ko system/lib/modules/dhd.ko
This example is for dhd.ko module, which is required for WiFi.
For flashable ZIP, take one from another kernel and replace the boot.img.
Credits:
Xistance
broodplank
Hacre
DooMLoRD
Madridii (for helping to test the kernel on Galaxy W)
hotheabilly (for helping to test the kernel on Galaxy W)

Adding Governors, I/O schedulers and more.
This one great tut by broodplank should explain everything about Governors and I/O Schedulers in very tiny details: http://xda-university.com/as-a-developer/adding-features-to-your-kernel
Don't forget to activate every feature you added, in makeconfig menu, before building the kernel

Reserved - Just in case

Woow
My nickname is mentioned in the firsh post..
Thank you for this guide
We need guide on windows os
Sent from my GT-I8150 using xda premium

Madridii said:
Woow
My nickname is mentioned in the firsh post..
Thank you for this guide
We need guide on windows os
Sent from my GT-I8150 using xda premium
Click to expand...
Click to collapse
Well, I don't own this device and you tested my compiled kernel and confirmed that it works, so you deserve credit...
I never actually builded anything on Windows OS, Cygwin is required for that, and that is a program I'm not yet familiarized with.
Sent from my GT-I9001 using xda app-developers app

Madridii said:
Woow
My nickname is mentioned in the firsh post..
Thank you for this guide
We need guide on windows os
Sent from my GT-I8150 using xda premium
Click to expand...
Click to collapse
The easiest way is to just dual boot Ubuntu or Mint. Well, if you can't really do that you can use a VM to build it as well.
Anyway, great job on the tutorial educk!

Xistance said:
The easiest way is to just dual boot Ubuntu or Mint. Well, if you can't really do that you can use a VM to build it as well.
Anyway, great job on the tutorial educk!
Click to expand...
Click to collapse
Thank you!
But if it wasn't for you, broodplank, diablo, skywalker01 and many other great devs on our forum who helped me, I would have never found out these awesome things.
Your tutorial was like a starting point for me, it opened my way into the Android World, it was my first step into "development".
I hope I can help other people with this guide, just like you helped me with yours!
Sent from my GT-I9001 using xda app-developers app

First time i tried to make my kernel, I had errors because i didn't have some packages. (Was using Ubuntu 12.10)
Add that you need 12.04 LTS to Successfully build it After installed the LTS version, you could update it to 12.10.....The packages will still be there

Thank you guys
I will try to learn about Ubuntu to have 10% of your experience..
Thank you again
Sent from my GT-I8150 using xda premium

i guess SDK is not needed if you are building kernel. i build it without having sdk on my ubuntu
and for the make -j options it's easier to use -j26. use -j1 to debug any compile error
very useful guide :good:
Sent from my GT-I8150

hadidjapri said:
i guess SDK is not needed if you are building kernel. i build it without having sdk on my ubuntu
and for the make -j options it's easier to use -j26. use -j1 to debug any compile error
very useful guide :good:
Sent from my GT-I8150
Click to expand...
Click to collapse
Yeah, you don't need the SDK. I included it in my guide because I find it very useful to have.
About the -j options, I sometimes use -j150 and sometimes -j8. Why? Because sometimes I feel like using my PC while building. Also, don't ask for my specs, for kernel building it doesn't matter.

Woah my name on the OP thanks educk!
Sent from my GT-P1000 using Tapatalk 2

hadidjapri said:
i guess SDK is not needed if you are building kernel. i build it without having sdk on my ubuntu
and for the make -j options it's easier to use -j26. use -j1 to debug any compile error
very useful guide :good:
Sent from my GT-I8150
Click to expand...
Click to collapse
Yes, you are right! SDK is not needed for the kernel building, I added it because it is required for ADB.
Update: I added a method of flashing the boot.img and my github commit where I added CPU Governors (SmartAss v2, Smoothass, InteractiveX and more) and I/O Schedulers (SIO and VR). More updates soon.
Regards,
Erik
Sent from my GT-I9001 using xda app-developers app

Hello all
I am trying to compile arco's sources but ı have problem.
when ı entry make -j2
make -j2
make: /home/batur/android/kernel/toolchains/arm-eabi-linaro-4.6.2/bin/arm-eabi-gcc: command not found
scripts/kconfig/conf --silentoldconfig Kconfig
make: /home/batur/android/kernel/toolchains/arm-eabi-linaro-4.6.2/bin/arm-eabi-gcc: command not found
CHK include/linux/version.h
/home/batur/android/kernel/samsung-kernel-msm7x30/scripts/gcc-version.sh: satır 25: /home/batur/android/kernel/toolchains/arm-eabi-linaro-4.6.2/bin/arm-eabi-gcc: No such file or directory
/home/batur/android/kernel/samsung-kernel-msm7x30/scripts/gcc-version.sh: satır 26: /home/batur/android/kernel/toolchains/arm-eabi-linaro-4.6.2/bin/arm-eabi-gcc: No such file or directory
CHK include/generated/utsrelease.h
make[1]: `include/generated/mach-types.h' güncel
CC scripts/mod/empty.o
/bin/sh: 1: /home/batur/android/kernel/toolchains/arm-eabi-linaro-4.6.2/bin/arm-eabi-gcc: not found
CC kernel/bounds.s
make[2]: *** [scripts/mod/empty.o] error 127
/bin/sh: 1: /home/batur/android/kernel/toolchains/arm-eabi-linaro-4.6.2/bin/arm-eabi-gcc: not found
make[1]: make[1]: *** [kernel/bounds.s] error 127
*** [scripts/mod] error 2
make: *** [prepare0] error 2
make: *** Waiting for unfinished jobs ....
make: *** [scripts] error 2
[email protected]:~/android/kernel/samsung-kernel-msm7x30$
Thanks
Sorry for my bad english

Batur97 said:
Hello all
I am trying to compile arco's sources but ı have problem.
when ı entry make -j2
make -j2
make: /home/batur/android/kernel/toolchains/arm-eabi-linaro-4.6.2/bin/arm-eabi-gcc: command not found
scripts/kconfig/conf --silentoldconfig Kconfig
make: /home/batur/android/kernel/toolchains/arm-eabi-linaro-4.6.2/bin/arm-eabi-gcc: command not found
CHK include/linux/version.h
/home/batur/android/kernel/samsung-kernel-msm7x30/scripts/gcc-version.sh: satır 25: /home/batur/android/kernel/toolchains/arm-eabi-linaro-4.6.2/bin/arm-eabi-gcc: No such file or directory
/home/batur/android/kernel/samsung-kernel-msm7x30/scripts/gcc-version.sh: satır 26: /home/batur/android/kernel/toolchains/arm-eabi-linaro-4.6.2/bin/arm-eabi-gcc: No such file or directory
CHK include/generated/utsrelease.h
make[1]: `include/generated/mach-types.h' güncel
CC scripts/mod/empty.o
/bin/sh: 1: /home/batur/android/kernel/toolchains/arm-eabi-linaro-4.6.2/bin/arm-eabi-gcc: not found
CC kernel/bounds.s
make[2]: *** [scripts/mod/empty.o] error 127
/bin/sh: 1: /home/batur/android/kernel/toolchains/arm-eabi-linaro-4.6.2/bin/arm-eabi-gcc: not found
make[1]: make[1]: *** [kernel/bounds.s] error 127
*** [scripts/mod] error 2
make: *** [prepare0] error 2
make: *** Waiting for unfinished jobs ....
make: *** [scripts] error 2
[email protected]:~/android/kernel/samsung-kernel-msm7x30$
Thanks
Sorry for my bad english
Click to expand...
Click to collapse
try:
Code:
export ARCH=arm
export CROSS_COMPILE=~/android/kernel/toolchains/arm-eabi-linaro-4.6.2/bin/arm-eabi-
make ancora_defconfig
before make -j2...
also, make sure the path /android/kernel/toolchains/arm-eabi-linaro-4.6.2 exists and you have you'r toolchain in there...

This guide may be useful, but what about Fedora/RPM-based users?
Debian-based users can use the usual method (Educk has made a guide for install it, just check your repo if they have it) but for Fedora user? Maybe this method will work. I was a user of Fedora but since Debian wheezy (although it is RC1, unstable) I moved on.
Maybe this method for RPM-based (Fedora, Red Hat, CentOS, openSUSE)
Code:
$ su
# yum install git-core gnupg flex bison gperf build-essential \
zip curl libc6-dev libncurses5-dev:i386 lib32ncurses5-dev x11proto-core-dev \
libx11-dev:i386 libreadline6-dev:i386 libgl1-mesa-glx:i386 \
libgl1-mesa-dev g++-multilib mingw32 openjdk-6-jdk tofrodos \
python-markdown libxml2-utils xsltproc zlib1g-dev:i386
# ln -s /usr/lib/i386-linux-gnu/mesa/libGL.so.1 /usr/lib/i386-linux-gnu/libGL.so
This maybe useful, but if you RPM-based users didn't find those packages, then maybe Google is your best partner.

R: [Guide] Build your own Kernel for Galaxy W
How can I add UV in the kernel?
Sent from my GT-I8150 using xda app-developers app

lorenzo82 said:
How can I add UV in the kernel?
Sent from my GT-I8150 using xda app-developers app
Click to expand...
Click to collapse
You can modify it from the arch/arm/mach-msm/acpuclock-7x30.c file.

Is this core 'make -jx' x for telephone or pc because my pc is per of 2 core but my phone is 1 core
thanks for your helping

Batur97 said:
Is this core 'make -jx' x for telephone or pc because my pc is per of 2 core but my phone is 1 core
thanks for your helping
Click to expand...
Click to collapse
PC of course.

Related

[TUTORIAL]Setting up and compiling CM9/CM10 from source

Since I’ve seen many questions on how to build cyanogenmod 9 (CM9) from source for the Galaxy Nexus, but there isn’t a proper guide, I will attempt to write a small how-to. There already is a very good guide how to build ICS from source, but there are a few extra things you’ll have to do for CM9. I hope it will be useful, and if not, well, at least I’ve tried
LATEST UPDATE: August 20th - also added CM10
SETTING UP THE BUILD ENVIRONMENT
I highly recommend Ubuntu 12.04 64 bit for development or Linux Mint 13. It is possible to build on different linux distro’s, but I cannot cover all exceptions. (If you don’t have linux installed or are afraid to set up a dual boot, it is possible to build in a virtual environment –e.g. virtualbox-. Building in a virtual environment however, can be very slow. Also, 64 bit is recommended.)
Make sure java is installed! At the end of this post, I have written a small guide how to install java.
Set up adb and create proper udev rules
I will not write these steps down, but rather point you to some very nice and easy guides. It would be best to do this first, however, it is not completely necessary if you just want to build a fully functioning rom.
1) set up adb (follow this excellent guide)
2) set up udev rules which allow you to start adb without having to use sudo (follow this terrific tutorial)
Installing all necessary packages and set up repo (source)
Open a terminal and copy the following code:
Code:
sudo apt-get install git-core gnupg flex bison gperf build-essential \
zip curl libc6-dev libncurses5-dev:i386 x11proto-core-dev \
libx11-dev:i386 libreadline6-dev:i386 libgl1-mesa-dev:i386 \
g++-multilib mingw32 openjdk-6-jdk tofrodos python-markdown \
libxml2-utils xsltproc zlib1g-dev:i386
WARNING: run the following commands as user (NOT as root) unless stated otherwise (e.g., when it explicitly shows ‘sudo’ before a command)!!!
Next, you’ll have to install repo to download the source. First we’re going to create a bin folder (1) in our home directory and include it in our path (2). Also, download the repo script (3) and make it executable (4). All from the command line:
Code:
mkdir ~/bin
PATH=~/bin:$PATH
curl https://dl-ssl.google.com/dl/googlesource/git-repo/repo > ~/bin/repo
chmod a+x ~/bin/repo
Okay, we’re done with the first part. So far it’s been similar to building pure AOSP.For CM, there will be some additional things you’ll have to do.
DOWNLOADING THE CM SOURCE
Create a directory (CM9 -or CM10-) for your working files:
Code:
mkdir CM9
cd CM9
and then initialize the main CM repo (For CM10, just replace ics with jellybean):
Code:
repo init -u git://github.com/CyanogenMod/android.git -b ics
Good, now you’re ready to download the source. This can take a couple of hours!! Run the following command from the terminal (Run the following commands in the terminal from the root of the directory that contains the source, e.g., ~/CM9/):
Code:
repo sync
Okay, the majority of the files needed to build CM are now on your computer. However, device specific files are needed. To get them, issue the following command in your terminal:
Code:
source build/envsetup.sh
lunch
After the lunch command, choose your device. If you have a GSM version, choose cm_maguro, if you have the CDMA version, choose cm_toro. Additional files needed for your device are being downloaded right now.
Before you can actually build the rom, you’ll need to run two more commands to get some proprietary files.
1) Open a terminal and go to CM9/vendor/cm/. Run the following command:
Code:
./get-prebuilts
This will download term.apk and rommanager.apk. You will need these files otherwise you’ll get an error while building.
2) Now we need to grab some files from your phone. Make sure you have a working build cyanogenmod version (just install a nightly) on your phone. Make sure adb is setup properly (see beginning of this post)!
Connect your phone to the pc. Open a terminal and go to CM9/device/samsung/(Maguro OR Toro)/. Run the following command:
Code:
sh extract-files.sh
BUILDING CM9/CM10
The building part is very easy. It just requires two simple commands:
Code:
source build/envsetup.sh
brunch
After the brunch command, choose your device. Again, if you have a GSM version, choose cm_maguro, if you have the CDMA version, choose cm_toro. Depending on your computer, hopefully you’ll have a fully functioning CM9 or CM10 in 30minutes-2hours (or even longer) . You can find the rom in: /out/target/product/(Maguro OR Toro)/
Next time you build, first clean your working directory. Enter the following command in the terminal:
Code:
make clobber
This will completely remove your output directory!
To update the source, before each build just run:
Code:
repo sync
ADDITIONAL INFO
Install Java
Installing java is very easy in Ubuntu 12.04. Java 6 is recommended. To install it in Ubuntu 12.04 or Linux Mint 13, download the most recent Java 6 SDK from HERE. To install, open a terminal and run the following commands:
Code:
$ chmod +x jdk-6u34-linux-x64.bin
$ sudo ./jdk-6u34-linux-x64.bin
$ sudo mv jdk1.6.0_34 /usr/lib/jvm/
$sudo update-alternatives --install /usr/bin/java java /usr/lib/jvm/jdk1.6.0_34/bin/java 1
$ sudo update-alternatives --install /usr/bin/javac javac /usr/lib/jvm/jdk1.6.0_34/bin/javac 1
$ sudo update-alternatives --install /usr/bin/javaws javaws /usr/lib/jvm/jdk1.6.0_34/bin/javaws 1
$ sudo update-alternatives --config java
$ sudo update-alternatives --config javac
$ sudo update-alternatives --config javaws
NOTE: after each 'update-alternative'-command, choose the correct (new) java version!
To check if you have the correct java version, type in a terminal:
Code:
java –version
I also added JAVA_HOME to my path; I don’t know if it is still necessary, but it doesn’t hurt either. First, check where java is located. In a terminal type:
Code:
which java
In my case the output shows /usr/bin/java, but it could be located somewhere else. Write down the path minus '/java'. Then open /home/USERNAME/.bashrc and add the following line to the bottom of the file:
Code:
export JAVA_HOME=/usr/bin
Of course replace /usr/bin with your path. Then save and close, and in a terminal run:
Code:
source ~/.bashrc
Odexed version
Some people like their rom to be odexed. There are multiple ways to achieve this (special thanks to Planet X for helping me with this):
1)Instead of ‘brunch’ do the following (if you are building for toro, replace maguro with toro):
Code:
source /build/envsetup.sh
lunch cm_maguro-user
make –j4
(Note:
taken from source.android.com: GNU make can handle parallel tasks with a -jN argument, and it's common to use a number of tasks N that's between 1 and 2 times the number of hardware threads on the computer being used for the build. E.g. on a dual-E5520 machine (2 CPUs, 4 cores per CPU, 2 threads per core), the fastest builds are made with commands between make -j16 and make -j32.)
2)If you want to build an odexed version every time and just want to use the brunch command, do the following:
-Open build/core/main.mk
-Comment out (place a # at the beginning of the line) lines 240, 241, 245, and 246. Thus, replace:
ifneq (true,$(DISABLE_DEXPREOPT))
ifeq ($(user_variant),user)
Ifeq ($(HOST_OS),linux)
WITH_DEXPREOPT := true
Endif
endif
endif
Click to expand...
Click to collapse
# ifneq (true,$(DISABLE_DEXPREOPT))
# ifeq ($(user_variant),user)
Ifeq ($(HOST_OS),linux)
WITH_DEXPREOPT := true
Endif
# endif
# endif
Click to expand...
Click to collapse
Now you can use the brunch command to build an odexed version with insecure boot image.
Hopefully this guide will benefit some people, if not, it kept me busy for a while. Enjoy building!!
(btw, I'm not a native english speaker, so excuse me if I made errors in grammar )
Wow great work. These tutorials keep getting better making it so easy to compile your own rom!
So what does that "brunch" command actually do?
Is it just a script that does the make otapackage commands and stuff?
Infra said:
So what does that "brunch" command actually do?
Is it just a script that does the make otapackage commands and stuff?
Click to expand...
Click to collapse
Indeed! Brunch is actually a combination of 'lunch' and 'make'. Using the 'lunch-part' you choose your build (in our case the maguro or toro). Next, the 'make-part' actually gets things going. The nice thing using brunch is that it automatically detects the maximum number of threads it can use so that it will run at maximum speed.
Finally set my computer up to compile CM9 last night for the first time and after a few tries I finally got it going. The only problem is that I am now getting an error very close to this one.
http://forum.xda-developers.com/showpost.php?p=25452343&postcount=3093
That poster says that it has been happening for a few days now. Is this a known issue with compiling CM9 or is this just user error? I have tried twice compiling now and have had no luck. Is it working for anyone else?
---------- Post added at 02:05 PM ---------- Previous post was at 01:19 PM ----------
Here is the exact error that Im getting. I tried it again today just to see if it anything had changed.
make[1]: *** [sub-make] Error 2
make[1]: Leaving directory `/home/mark/CM9/kernel/samsung/tuna'
make: *** [TARGET_KERNEL_BINARIES] Error 2
make: *** Waiting for unfinished jobs....
Thanks for this guide. I just built my first CM9 kang. Getting ready to flash it. Now to find a guide on what I can and can't change and recompile or do I just remove stuff and use 7-zip to zip it back up?
housry23 said:
Thanks for this guide. I just built my first CM9 kang. Getting ready to flash it. Now to find a guide on what I can and can't change and recompile or do I just remove stuff and use 7-zip to zip it back up?
Click to expand...
Click to collapse
Glad to hear you succeeded building your first kang. I don't really understand what you want to do next? If you want to remove stuff from the zip, you can. I for instance always remove stk.apk. But you can also modify the build files so that only things you want will be built. You can play around with the source code and things like that. Anyway, most of the answers you will find using google. I also very much like the development board on Rootzwiki; people are really helpful and friendly there. So if you have any specific questions, i recommend that forum as well!
mbroeders said:
Glad to hear you succeeded building your first kang. I don't really understand what you want to do next? If you want to remove stuff from the zip, you can. I for instance always remove stk.apk. But you can also modify the build files so that only things you want will be built. You can play around with the source code and things like that. Anyway, most of the answers you will find using google. I also very much like the development board on Rootzwiki; people are really helpful and friendly there. So if you have any specific questions, i recommend that forum as well!
Click to expand...
Click to collapse
Okay thanks. I was asking just what you answered. I want to be able to remove and/or add stuff to the zip for starters. I found the answer through Google, but I do appreciate you taking the time to answer. I'll definitely be visiting the Rootzwiki dev board. Thanks for the suggestion.
I have successfully compiled cm9 from source but have never tried to cherry pick or Kang anything yet. Could you quickly explain how you cherry pick with cm9?
Sent from my Galaxy Nexus using Tapatalk 2
SupWiz17 said:
I have successfully compiled cm9 from source but have never tried to cherry pick or Kang anything yet. Could you quickly explain how you cherry pick with cm9?
Sent from my Galaxy Nexus using Tapatalk 2
Click to expand...
Click to collapse
Check out this link it may be helpful
http://rootzwiki.com/index.php?/topic/13189-[TUTORIAL]-Everything-you-ever-wanted-to-know-about-GIT#entry322735
Sent from my GT-S5360 using Tapatalk 2
That's a very useful link, thanks! In addition, if you want to cherry pick commits that haven't been merged yet -specific CM commits, such as navbar customization-, have a look here: http://review.cyanogenmod.com/#/q/branch:ics,n,z
Now let's say you see something interesting that you want to add. Then look at that commit and you'll see a 'download' command, such as "git fetch http://review.cyanogenmod.com/CyanogenMod/android_frameworks_base refs/changes/06/13306/15 && git checkout FETCH_HEAD". Just run that command and if everything works, you have succesfully cherry picked a commit. -of course, because these are not yet merged, there is the chance that no everything will work as it should-
There are also some GUI programs to manage git. I'm just about to try gitgui by all accounts it is very good.
Sent from my GT-S5360 using Tapatalk 2
Maybe it is a noobish question, but does this line:
Code:
curl https://dl-ssl.google.com/dl/googlesource/git-repo/repo > /bin/repo
miss a ~?
Code:
curl https://dl-ssl.google.com/dl/googlesource/git-repo/repo > ~/bin/repo
UncleDan said:
Maybe it is a noobish question, but does this line:
Code:
curl https://dl-ssl.google.com/dl/googlesource/git-repo/repo > /bin/repo
miss a ~?
Code:
curl https://dl-ssl.google.com/dl/googlesource/git-repo/repo > ~/bin/repo
Click to expand...
Click to collapse
Not noobish at all! You're absolutely right. It's not necessary when you're already in your home folder, but to be sure I've changed it in the guide. Thanks for letting me know!
Sticky!!!!!
Thanks dude
Sent from my Galaxy Nexus using Tapatalk 2
im sorry for noobish...at this step
1) Create an empty file in ~/CM9/.repo
in home i have dir CM9 but its empty...i havent a folder call .repo
java its installed and adb work perfectly
this is my terminal output:
% Total % Received % Xferd Average Speed Time Time Time Current
Dload Upload Total Spent Left Speed
100 20774 100 20774 0 0 35679 0 --:--:-- --:--:-- --:--:-- 56604
[email protected]:~$ chmod a+x ~/bin/repo
[email protected]:~$ cd CM9
[email protected]:~/CM9$ repo init -u git://github.com/CyanogenMod/android.git -b ics
Your Name [loris]: loris
Your Email : my email
Your identity is: loris
is this correct [y/N]? y
repo initialized in /home/llo/CM9
[email protected]:~/CM9$
and nothing...
SOLVED
Hey mate any idea why my camera never works after a build... I know I'm missing something but I'm not sure what. I have all the proprietary files for my maguro etc but I just can't get camera to work... everytime
Sent from my Galaxy Nexus using Tapatalk 2
CdTDroiD said:
Hey mate any idea why my camera never works after a build... I know I'm missing something but I'm not sure what. I have all the proprietary files for my maguro etc but I just can't get camera to work... everytime
Sent from my Galaxy Nexus using Tapatalk 2
Click to expand...
Click to collapse
And you flash gapps everytime?
Sent from my GT-I9300 using Tapatalk 2
Infra said:
And you flash gapps everytime?
Sent from my GT-I9300 using Tapatalk 2
Click to expand...
Click to collapse
Sorted it out was just missing a few important files under /system/vendor thanks
Sent from my Galaxy Nexus using Tapatalk 2
CdTDroiD said:
Sorted it out was just missing a few important files under /system/vendor thanks
Sent from my Galaxy Nexus using Tapatalk 2
Click to expand...
Click to collapse
Glad it worked out! Seems there have been a few changes lately, so I will add some more info soon.
Sent from my SGS3

Building cm9 for the Kindle Fire

BUILDING CM9 FROM SOURCE FOR THE KINDLE-FIRE
This is a guide to help with building a rom from Hashcodes source for the kindle fire.
I am no Dev so please go easy, and if you see any mistakes let me know and I will amend them, It took me a week of reading and asking numerous questions (to proper :angelev's:angel with lot's of mistakes to build my first rom.
Below is what worked for me in the end, (but from what I have learnt, every setup is different).
I'm posting this guide hoping it may help in someway, but please read and research as much as possible before starting
Please follow this guide at your own risk.
Please don't blame me if anything in this thread messes with your system.
I tried lot's of things and in the end I installed a new ubuntu 11.10 x64bit on a external 500gb hdd, (the nice thing now is that all my building etc is all done on a external hdd so I can not mess up my pc AGAIN
I tried 32 bit (but java didn't like that)
I tried ubuntu 12.04 (which is what I dual boot on my laptop)
and the one that worked for the following info was ubuntu 11.10 x64bit.
So here goes.
First you need the following installed.
sun-java6-jdk
android sdk (adb etc) (setup as normal for the kindle fire).
eclipse classic.
Then you set up extra build-essentials
Install the Build Packages
sudo apt-get install*git-core gnupg flex bison gperf libsdl1.2-dev libesd0-dev libwxgtk2.6-dev squashfs-tools build-essential zip curl libncurses5-dev zlib1g-dev sun-java6-jdk pngcrush schedtool
sudo apt-get install*g++-multilib lib32z1-dev lib32ncurses5-dev lib32readline5-dev gcc-4.3-multilib g++-4.3-multilib
Install the repo
mkdir -p $HOME/bin
curl https://dl-ssl.google.com/dl/googlesource/git-repo/repo > $HOME/bin/repo
Then add the following to your path (e.g. in $HOME/.bashrc)
export PATH=$HOME/bin:$PATH
Then onto the build setup.
mkdir -p $HOME/otter/cm9
cd $HOME/otter/cm9
repo init -u https://github.com/CyanogenMod/android.git -b ics
download the local_manifest to .repo
curl -L -o .repo/local_manifest.xml -O -L https://raw.github.com/KFire-Android/android_local_manifest/ics/local_manifest.xml
at this point you should have a folder called otter inside your home folder and inside this a folder called cm9.
If you show hidden folders in cm9 you should also find a folder called .repo, inside you should have your local manifest, open with a text editor (ie. gedit) and make sure it looks like this.
(hashcodes manifest as of 07/03/2012)
**
****
****
****
****
****
****
****
**
Then sync your repo
repo sync -j4 (duel core)
(this can take a while (mine took 6 hours) (I have a laptop with dual core but only 1.3ghz).
this script uses ccache which will make subsequent builds at least two times faster.
Code:
#!/bin/bash
if [ -z "$1" ]; then
echo "usage: build.sh "
exit 1
fi
device=$1
# ensure ccache is in the path
export PATH="$PATH:$PWD/prebuilt/$(uname|awk '{print tolower($0)}')-x86/ccache"
setup()
{
USE_CCACHE=1
CCACHE=ccache
CCACHE_BASEDIR="$PWD"
CCACHE_DIR="$PWD/.ccache"
#export CCACHE_COMPRESS=1
export USE_CCACHE CCACHE_DIR CCACHE_BASEDIR
if [ ! "$(ccache -s|grep -E 'max cache size'|awk '{print $4}')" = "10.0" ]; then
ccache -M 10G
fi
source build/envsetup.sh
#lunch cm_$1-userdebug
}
setup $device
LOGFILE=build_${device}_$(date +%Y%m%d_%H%M).log
START=$(date +%s)
#make -j`cat /proc/cpuinfo| grep processor | wc -l` bacon 2>&1 | tee $LOGFILE
brunch $device 2>&1 | tee $LOGFILE
END=$(date +%s)
ELAPSED=$((END - START))
E_MIN=$((ELAPSED / 60))
E_SEC=$((ELAPSED - E_MIN * 60))
printf "Time to compile: " >> $LOGFILE
[ $E_MIN != 0 ] && printf "%d min(s) " $E_MIN >> $LOGFILE
printf "%d sec(s)\n" $E_SEC >> $LOGFILE
grep "Time to compile" $LOGFILE
copy/paste the text in a file called $HOME/build.sh, make it executable (chmod 775 build.sh). The script also saves the build output to a file called build_otter_.log.
then onto the build.
cd vendor/cm
./get-prebuilts
cd ../../
then onto buiding
source build/envsetup.sh
then this is the build command
brunch otter (this starts build)
Enjoy
To start over and wipe "out" folder
(from within /otter/cm9)
make clobber
or
rm -rf out/target
build.sh otter
(this can take awhile (mine took another 6 hours)
I had a few things missing and at various times throughout the setup/build I had to download some missing libs. etc (I was prompted all the way through, it would tell me I had so & so file missing and I just used the software centre to dl the missing files).
By all means ask me questions but don't be offended if I answer back “sorry I don't know” as I've already mentioned I am learning myself.
Cheers
Steve
:good:Thanks to Twa_priv & Hashcode with helping me with my rom and this guide:good:
If there are any mistakes/updates to change/modify please let me know.
PLEASE PRESS THE THANKS BUTTON IF YOU FOUND THIS THREAD HELPFULL AND HAPPY ROM BUILDING
helpful links (if you want to add a different guide let me know)
Ubuntu usb install
[B]http://www.ubuntu.com/download/help/create-a-usb-stick-on-ubuntu[/B]
Ubuntu iso
[B]http://releases.ubuntu.com/11.10/[/B]
another build guide (ubuntu 12.04) Thank SBlood86 for this one https://github.com/KFire-Android/and..._manifest/wiki
I can only find the Ubuntu 12.4 on their website, I am running windows 7. If it's not too much can you put links to where the software is downloaded from. Thanks Lovejoy.
TahrirSquare said:
I can only find the Ubuntu 12.4 on their website, I am running windows 7. If it's not too much can you put links to where the software is downloaded from. Thanks Lovejoy.
Click to expand...
Click to collapse
http://lmgtfy.com/?q=ubuntu+11.10+download
Links added ^^^^^^^^^^^^^^^
I think you should add downloading the repo script:
mkdir -p $HOME/bin
curl https://dl-ssl.google.com/dl/googlesource/git-repo/repo > $HOME/bin/repo
Then add the following to your path (e.g. in $HOME/.bashrc)
export PATH=$HOME/bin:$PATH
twa_priv said:
http://lmgtfy.com/?q=ubuntu+11.10+download
Click to expand...
Click to collapse
Wow what was that, First time I see such a link. cool. Thanks
Thanks Twa_priv (info added to op)
(would not get very far without that
what does this bit do? cd ../../
You should add the build.sh script in there that twa-priv provided us with when we made our builds
Other than that looks great
Sent from my Amazon Kindle Fire using xda app-developers app
lovejoy777 said:
Thanks Twa_priv (info added to op)
(would not get very far without that
what does this bit do? cd ../../
Click to expand...
Click to collapse
This gets you back to the base directory so that "source build/envsetup.sh" works.
all above notes added to op
Thanks guy's
Incidentally the build instructions for Ubuntu 12.04 are here...
https://github.com/KFire-Android/android_local_manifest/wiki
I never put the instructions for older versions on there because they were on the Google and CM pages... Either way, very nice write up
SBlood can I put your guide in the op as well
Sent from my Galaxy Nexus using xda premium
lovejoy777 said:
SBlood can I put your guide in the op as well
Sent from my Galaxy Nexus using xda premium
Click to expand...
Click to collapse
Go for it; if you'd like to see anything added to the wiki shoot me an email.
Please change editor to gedit not gimp
Thanks
thanks, oops
Sent from my Galaxy Nexus using xda premium
Just wondering, does it have to be Sun JDK 6? Will it work with Sun JDK 7 or OpenJDK?
I did a clean install of Ubuntu and the PPA I used to download JDK 6 doesn't work anymore
Only JDK 6 .
Envoyé depuis mon GT-I9000 avec Tapatalk
Trojan38 said:
Only JDK 6 .
Envoyé depuis mon GT-I9000 avec Tapatalk
Click to expand...
Click to collapse
Dang ok. Now I have to figure out how to install JDK 6. lol :silly:
Sorry I can't thank you. I ran out of thanks
---------- Post added at 07:02 PM ---------- Previous post was at 06:21 PM ----------
It's not letting me install JDK 6 at all. What do I do...?
EDIT: Found a way to install. Thanks for the help. http://www.devsniper.com/ubuntu-12-04-install-sun-jdk-6-7/
veeman did you not have it before?
Sent from my Galaxy Nexus using xda premium

[Guide] How to compile and install CM10 for Samsung i9000

This guide is an adaptation/update of the following guides to CM10:
http://wiki.cyanogenmod.com/wiki/Samsung_Galaxy_S:_Compile_CyanogenMod_(Linux)
http://forum.xda-developers.com/showthread.php?t=1505006
http://forum.xda-developers.com/showthread.php?t=1533711
DISCLAMER
Although the procedures in this guide were tested on 2012-08-03 and produced a working build on the i9000, I take no responsibility for any consequences derived from their use.
Thanks:
stbenz
rycus86
kasper_h
gmhafiz
Requirements:
Linux - Ubuntu 12.04 - 64bit (AFAIK, a 64 bit host is needed to compile JB)
An i9000 with cm10 already installed - Get the latest nightly here: http://get.cm/?device=galaxysmtd
About 14GB of storage for the repository plus about 15GB for building
If you're using Windows or another OS, grab Virtual Box and install Ubuntu on a VM. It makes a nice development environment.
(Give the VM enough resources - A few cores and 2-4GB of RAM)
Building in other Linux distributions?
Here are some contibutions from fellow members:
Arch Linux: Replace steps 1 to 3 with gmhafiz's instructions
________________________________________________________________________________________________________
1 - Install Ubuntu Packages
1.1 - In terminal:
Code:
sudo apt-get install git-core gnupg flex bison python rar original-awk gawk p7zip-full gperf libsdl1.2-dev libesd0-dev libwxgtk2.6-dev squashfs-tools build-essential zip curl libncurses5-dev zlib1g-dev pngcrush schedtool
sudo apt-get install libc6-dev x11proto-core-dev libx11-dev libgl1-mesa-dev mingw32 tofrodos python-markdown libxml2-utils
sudo apt-get install g++-multilib lib32z1-dev ia32-libs lib32ncurses5-dev lib32readline-gplv2-dev gcc-multilib g++-multilib xsltproc
2 - Install JAVA
NOTE: Must be JDK 1.6 - Don't use other versions.
2.1 - Download Java JDK for Linux 64-bit from Java site: (http://www.oracle.com/technetwork/java/javase/downloads/index.html)
Correct file will be something like: jdk-6u##-linux-x64.bin , where ## is the version number and will change with updates.​
2.2 - Move jdk-6u##-linux-x64.bin to your home directory
2.3 - Remove any other java packages from system:
Code:
sudo apt-get purge openjdk-\* icedtea-\* icedtea6-\*
2.4 - Install Java JDK:
Code:
sudo mkdir -p /opt/java/64/
sudo cp jdk-6u##-linux-x64.bin /opt/java/64
sudo su -
cd /opt/java/64
chmod +x jdk-6u##-linux-x64.bin
./jdk-6u##-linux-x64.bin
exit
2.5 - Add JDK PATH to .bashrc:
Code:
vi ~/.bashrc
Add these lines to .bashrc:​
Code:
# Java PATHs
export JAVA_HOME=/opt/java/64/jdk1.6.0_##
export PATH=$PATH:$JAVA_HOME/bin
3 - Install Android SDK
3.1 - Setup directories:
Code:
cd ~
mkdir android
cd android
mkdir sdk
3.2 - Download Android SDK from http://developer.android.com/sdk/index.html
3.3 - Extract SDK contents to ~/android/sdk
3.4 - Add Android SDK Path:
Code:
vi ~/.bashrc
Enter the Following:​
Code:
#Android PATH
export PATH=$PATH:~/android/sdk
export PATH=$PATH:~/android/sdk/platform-tools
export PATH=$PATH:~/android/sdk/tools
3.5 - Add Extra Path For Device:
Code:
sudo vi /etc/udev/rules.d/99-android.rules
Enter this:​
Code:
#Samsung
SUBSYSTEM==usb, SYSFS{idVendor}==04e8, MODE=0666
SUBSYSTEM=="usb", ATTRS{idVendor}=="####:####", SYMLINK+="android_adb", MODE="0666" GROUP="plugdev"
TEST=="/var/run/ConsoleKit/database", \
RUN+="udev-acl --action=$env{action} --device=$env{DEVNAME}"
Save/close file and run:​
Code:
sudo chmod +x /etc/udev/rules.d/99-android.rules
3.6 - Close and open new terminal.
3.7 - Install Android SDK Tools
Code:
android
Check Android SDK Tools and Android SDK platform-tools and Install them​
4 - Install Repository
4.1 - Download Repo:
Code:
mkdir -p ~/bin
mkdir -p ~/android/system
curl https://dl-ssl.google.com/dl/googlesource/git-repo/repo > ~/bin/repo
chmod a+x ~/bin/repo
4.2 - Add Repo Path:
Code:
vi ~/.bashrc
Enter the following:​
Code:
export PATH=$PATH:~/bin
4.3 - Close and open new terminal.
4.4 - Initialize Repository & Sync:
Code:
cd ~/android/system/
repo init -u git://github.com/CyanogenMod/android.git -b jellybean
repo sync -j16
NOTE: If you have trouble syncing due to connection issues, try repo sync -j1. It's slower but some ISPs have issues with -j16
Want to make sure you didn't get any connection errors and have the complete repository? Just run the repo sync command again. It can't give you ANY errors.​Go get a beer. And another. And another...​
4.5 - Get Device Specific Repos:
Code:
. build/envsetup.sh && breakfast galaxysmtd
Get more beer...​
4.6 - Extract files from phone:
NOTE: You need to have cm10 installed on the phone.
Connect phone to pc and in terminal type:​
Code:
adb root
cd ~/android/system/device/samsung/galaxysmtd/
./extract-files.sh
4.7 - Download Extra Files:
Code:
~/android/system/vendor/cm/get-prebuilts
4.8 - Add Toolchain PATH:
Code:
vi ~/.bashrc
Enter the following:​
Code:
#Android Toolchain PATH
export ARCH=arm
export CCOMPILE=$CROSS_COMPILE
export CROSS_COMPILE=arm-eabi-
export PATH=$PATH:/home/YOUR-USERNAME/android/system/prebuilt/linux-x86/toolchain/arm-eabi-4.4.3/bin
4.9 - Close and open new terminal.
5 - Building Android
Code:
cd ~/android/system
. build/envsetup.sh && brunch galaxysmtd
Go get a beer. And another. And another...​
6 - Install on Phone
6.1 - Copy your .zip file from ~/android/system/out/target/product/galaxysmtd/cm-10-XXXXXXXXX-UNOFFICIAL-galaxysmtd.zip to the root of the SD card.
6.2 - Optional: Download Google Apps for Jelly Bean from http://goo.im/gapps and place it on the root of the SD card.
6.3 - Flash both of these .zip files from recovery.
Call your mother. She misses you.​
...and that's it.
________________________________________________________________________________________________________
How to update?
Code:
cd ~/android/system
repo sync -j16
make installclean
find ./out/ -name 'build.prop' | xargs rm
find ./out/ -name 'cm_galaxysmtd-target_files-eng.*.zip' | xargs rm
NOTE: If you have trouble syncing due to connection issues, try repo sync -j1. It's slower but some ISPs have issues with -j16​
...get beer, build and install.
Want to go "Steve Jobs" on the Android build? (Warning: Will take a gazillion years to re-build everything again)
Run:
Code:
make clobber
________________________________________________________________________________________________________
Want to customize the kernel?
Look here: [Guide] How to customize the CM10 i9000 kernel
.
will try this soon... thankx
Can you also write a small paragraph where you explain how compile a single application like Mms, Phone...
Thank you
a0a0 said:
Can you also write a small paragraph where you explain how compile a single application like Mms, Phone...
Thank you
Click to expand...
Click to collapse
You get all the application apks in the produced build.
From there you can extract any single one you want...
Sent from my GT-I9000 using Tapatalk 2
Yes but if i will try a small change in a code i must compile every time all the rom
a0a0 said:
Yes but if i will try a small change in a code i must compile every time all the rom
Click to expand...
Click to collapse
Not really.
Only changed files are compiled (and affected dependencies)
Sent from my GT-I9000 using Tapatalk 2
With mmm you can build single apk files, see the cm9 compile thread for details...
Verstuurd van mijn GT-I9000
Thanks man
Verstuurd van mijn GT-I9000
Requirements:
Linux - Ubuntu 12.04...
Click to expand...
Click to collapse
Does it have to be Ubuntu, provided I can find all listed packages for CentOS, for example?
Also, do you recommend the desktop or the server version?
elitevet said:
Does it have to be Ubuntu, provided I can find all listed packages for CentOS, for example?
Also, do you recommend the desktop or the server version?
Click to expand...
Click to collapse
Doesn't have to be Ubuntu, as long as you can find the equivalent packages.
It can be the desktop or server version, as long as you have X in it.
The android SDK setup uses a GUI. (but perhaps there's a way to run it from the CLI)
Sent from my GT-I9000 using Tapatalk 2
Thanks!
Already built it from the info from the CM9 thread, but this is always welcome
and very useful! Great +++++
Is step 4.5 (Setup Manifest) really required? Can't test it at the moment, but I know, it isn't required for building CM9 anymore, despite it is mentioned in the guide for building CM9. As I understand it, its a relict from when the Galaxy S specific sources weren't yet merged to the CyanogenMod repository.
stbenz said:
Is step 4.5 (Setup Manifest) really required? Can't test it at the moment, but I know, it isn't required for building CM9 anymore, despite it is mentioned in the guide for building CM9. As I understand it, its a relict from when the Galaxy S specific sources weren't yet merged to the CyanogenMod repository.
Click to expand...
Click to collapse
It's not needed.
Gesendet von meinem GT-I9000 mit Tapatalk 2
stbenz said:
Is step 4.5 (Setup Manifest) really required? Can't test it at the moment, but I know, it isn't required for building CM9 anymore, despite it is mentioned in the guide for building CM9. As I understand it, its a relict from when the Galaxy S specific sources weren't yet merged to the CyanogenMod repository.
Click to expand...
Click to collapse
The local manifest is still needed to download the device specific files & kernel source (also for CM9).
The thing not needed for CM9 after some time was using the teamhacksung buildscript.
---------- Post added at 05:27 PM ---------- Previous post was at 05:27 PM ----------
DerTeufel1980 said:
It's not needed.
Gesendet von meinem GT-I9000 mit Tapatalk 2
Click to expand...
Click to collapse
Sure? I don't see the device-files in the default.xml manifest file...
DerTeufel1980 said:
It's not needed.
Gesendet von meinem GT-I9000 mit Tapatalk 2
Click to expand...
Click to collapse
It shouldn't be, if it is like that, but I didn't get those sources until I added the manifest.
Perhaps a quirk, but that's how it worked.
The thing is, I had to put in the guide, as it was the way it worked, starting from a fresh, completely clean system.
Sent from my GT-I9000 using Tapatalk 2
Thanks again!
I was looking for something like this for quite a while now. Now I can finally compile my own builds
I compiled a build using this exact method 2 days ago, flashed the build to the phone and it went into constant pre-recovery bootloops. I had to flash GB with Odin to get back.
One thing was that I compile on a seperate box at home and transferred the file using scp. Maybe that corrupted, so I'm gonna try again tomorrow.
Could it be possible that the codebase itself was broken when I compiled? :-/
Did anybody have anythign similar? :S
K****iz_Indian said:
Could it be possible that the codebase itself was broken when I compiled? :-/
Did anybody have anythign similar? :S
Click to expand...
Click to collapse
Don't think so. The repo is not left with a broken code base.
The thing is, sometimes users get into the boot loop state even when installing the (un)official cm10 builds, so other factors cause them.
Sent from my GT-I9000 using Tapatalk 2
Could anyone refer me to a good guide about commit picking, please?
elitevet said:
Could anyone refer me to a good guide about commit picking, please?
Click to expand...
Click to collapse
http://forum.xda-developers.com/showpost.php?p=23715982&postcount=64

[Tutorial] How to compile your first Nexus Kernel

If you see mistakes please contact me. If you think something can be shorter, easier, feel free to suggest.
I have spent a lot of time figuring this out. Not to mention making this guide.
I DO NOT RESPOND TO PRIVATE MESSAGES. EVERYTHING YOU NEED IS IN HERE.
If this guide helped you feel free to donate.
There is more to come, using different toolchains, important files, adding overclocking etc.
Setting up the environment & building the kernel for the first time
Ubuntu 12.04 64-Bit
Linux Mint 13 64-Bit
Compiling Jelly Bean AOSP ROMs with these 2 is possible WITHOUT ADDITIONAL WORK.
If you want to use virtualization software, do NOT use Virtualbox. You can run into networking issues and so on. I suggest using VMWare Player instead, which is available for free on http://www.vmware.com
Installing latest updates & reboot.
$ sudo apt-get update
$ sudo apt-get dist-upgrade
$ sudo reboot
Click to expand...
Click to collapse
Now we will download and install the latest Java 6 JDK from here. Look for Java 6 SE Update 33 or a later update version. Don't download Java 7 JDK. I am downloading the file below for this guide.
Linux x64 68.69 MB jdk-6u33-linux-x64.bin
Click to expand...
Click to collapse
This guide assumes you have downloaded the file in the folder
~/Downloads
Click to expand...
Click to collapse
$ cd ~/Downloads
$ sudo chmod +x jdk-6u33-linux-x64.bin
$ ./jdk-6u33-linux-x64.bin
$ sudo mkdir /usr/lib/jvm
$ sudo mv jdk1.6.0_33 /usr/lib/jvm/jdk1.6.0_33
$ sudo update-alternatives --install /usr/bin/javac javac /usr/lib/jvm/jdk1.6.0_33/bin/javac 1
$ sudo update-alternatives --install /usr/bin/java java /usr/lib/jvm/jdk1.6.0_33/bin/java 1
$ sudo update-alternatives --install /usr/bin/javaws javaws /usr/lib/jvm/jdk1.6.0_33/bin/javaws 1
$ sudo update-alternatives --install /usr/bin/jar jar /usr/lib/jvm/jdk1.6.0_33/bin/jar 1
$ sudo update-alternatives --install /usr/bin/javadoc javadoc /usr/lib/jvm/jdk1.6.0_33/bin/javadoc 1
$ sudo update-alternatives --config javac
$ sudo update-alternatives --config java
$ sudo update-alternatives --config javaws
$ sudo update-alternatives --config jar
$ sudo update-alternatives --config javadoc
$ java --version
$ ls -la /etc/alternatives/java*
Click to expand...
Click to collapse
Now reboot is optional but welcome. Let's play safe.
$ sudo reboot
Click to expand...
Click to collapse
Install all required packages to play with Android.
Ubuntu 12.04
$ sudo apt-get update
$ sudo apt-get install git-core gnupg flex bison gperf build-essential zip curl libc6-dev libncurses5-dev:i386 x11proto-core-dev libx11-dev:i386 libreadline6-dev:i386 libgl1-mesa-glx:i386 libgl1-mesa-dev g++-multilib mingw32 openjdk-6-jdk tofrodos python-markdown libxml2-utils xsltproc zlib1g-dev:i386 git
$ sudo ln -s /usr/lib/i386-linux-gnu/mesa/libGL.so.1 /usr/lib/i386-linux-gnu/libGL.so
$ sudo reboot
Click to expand...
Click to collapse
Configure USB ports.
$ sudo gedit /etc/udev/rules.d/51-android.rules
Click to expand...
Click to collapse
This file should get the contents:
# adb protocol on passion (Nexus One)
SUBSYSTEM=="usb", ATTR{idVendor}=="18d1", ATTR{idProduct}=="4e12", MODE="0600", OWNER="<username>"
# fastboot protocol on passion (Nexus One)
SUBSYSTEM=="usb", ATTR{idVendor}=="0bb4", ATTR{idProduct}=="0fff", MODE="0600", OWNER="<username>"
# adb protocol on crespo/crespo4g (Nexus S)
SUBSYSTEM=="usb", ATTR{idVendor}=="18d1", ATTR{idProduct}=="4e22", MODE="0600", OWNER="<username>"
# fastboot protocol on crespo/crespo4g (Nexus S)
SUBSYSTEM=="usb", ATTR{idVendor}=="18d1", ATTR{idProduct}=="4e20", MODE="0600", OWNER="<username>"
# adb protocol on stingray/wingray (Xoom)
SUBSYSTEM=="usb", ATTR{idVendor}=="22b8", ATTR{idProduct}=="70a9", MODE="0600", OWNER="<username>"
# fastboot protocol on stingray/wingray (Xoom)
SUBSYSTEM=="usb", ATTR{idVendor}=="18d1", ATTR{idProduct}=="708c", MODE="0600", OWNER="<username>"
# adb protocol on maguro/toro (Galaxy Nexus)
SUBSYSTEM=="usb", ATTR{idVendor}=="04e8", ATTR{idProduct}=="6860", MODE="0600", OWNER="<username>"
# fastboot protocol on maguro/toro (Galaxy Nexus)
SUBSYSTEM=="usb", ATTR{idVendor}=="18d1", ATTR{idProduct}=="4e30", MODE="0600", OWNER="<username>"
# adb protocol on panda (PandaBoard)
SUBSYSTEM=="usb", ATTR{idVendor}=="0451", ATTR{idProduct}=="d101", MODE="0600", OWNER="<username>"
# fastboot protocol on panda (PandaBoard)
SUBSYSTEM=="usb", ATTR{idVendor}=="0451", ATTR{idProduct}=="d022", MODE="0600", OWNER="<username>"
# usbboot protocol on panda (PandaBoard)
SUBSYSTEM=="usb", ATTR{idVendor}=="0451", ATTR{idProduct}=="d00f", MODE="0600", OWNER="<username>"
# usbboot protocol on panda (PandaBoard ES)
SUBSYSTEM=="usb", ATTR{idVendor}=="0451", ATTR{idProduct}=="d010", MODE="0600", OWNER="<username>"
Click to expand...
Click to collapse
Don't forget to replace the red marked text with your username from Ubuntu or Linux Mint.
When building a kernel, you only need to start from here. Pick the appropriate branch from the git manually. My example below shows how to download the required files to build a Jelly Bean kernel. What I did was visiting the git repository each time and picked the appropriate branch.
https://android.googlesource.com/device/samsung/maguro
$ mkdir ~/Documents/kernel
$ cd ~/Documents/kernel
$ git clone https://android.googlesource.com/device/samsung/maguro -b jb-release
Click to expand...
Click to collapse
Again pick the right branch from https://android.googlesource.com/kernel/omap.git
$ cd maguro
$ git clone https://android.googlesource.com/kernel/omap.git -b android-omap-tuna-3.0-jb-pre1
Click to expand...
Click to collapse
Ensure the toolchain is in your path.
Default, Easy solution
$ git clone https://android.googlesource.com/platform/prebuilt -b jb-release
$ export PATH=$(pwd)/prebuilt/linux-x86/toolchain/arm-eabi-4.4.3/bin:$PATH
Click to expand...
Click to collapse
$(pwd) is a variable holding the current working directory.
Bandwidth-friendly solution
You can also download the toolchain to another directory. Bit first write down the directory you are working at.
mkdir ~/Documents/toolchain
cd ~/Documents/toolchain
$ git clone https://android.googlesource.com/platform/prebuilt -b jb-release
export PATH=~/Documents/toolchain/prebuilt/linux-x86/toolchain/arm-eabi-4.4.3/bin:$PATH
Click to expand...
Click to collapse
Instead of specifying the location of the toolchain with a relative path, we must specify the absolute path here.
Now we go back to where we were working.
cd ~/Documents/kernel/maguro
Click to expand...
Click to collapse
I hope you understand why I mentioned the bandwidth-friendly solution. With little insight you could have come up with it yourself.
Now let's build the kernel
$ cd omap
$ export ARCH=arm
$ export SUBARCH=arm
$ export CROSS_COMPILE=arm-eabi-
$ make tuna_defconfig
$ make
Click to expand...
Click to collapse
[*]Now you need to put it in a flashable zip.
Possible issues, things to avoid, FAQ
- Avoid downloading the kernel sources to directories which might require root/superuser access. This is one of the reasons I downloaded all sources to '~/Documents'. This will save a lot of time messing with chmod or chown commands.
- What is 'tuna', shouldn't this be maguro? No, actually not. Tuna is the board name, while maguro is the codename of the Nexus. Something you might want to remember when building kernels.
Interesting files and locations
<kernel_directory>/samsung/arch/arm/mach-s5pv210/cpu-freq.c
Overclocking
Voltages
Links to mods, source code, ...
Only do these when you are in the omap directory
Getting access to Ezekeel's work
git remote add ezekeel https://github.com/Ezekeel/GLaDOS-nexus-prime.git
git fetch ezekeel
Click to expand...
Click to collapse
If you want to change the text marked in red make sure to change the other one as well. You can think of this as a nickname for the remote repository.
Example of cherry-picking CUSTOM VOLTAGE
1. Go here: https://github.com/Ezekeel/GLaDOS-nexus-prime/commits/customvoltage_JB
2. Copy the SHA of the commit
3.
git cherry-pick 05ab84fa9bc1fa86e5a99c54266873e433ff15e2
Click to expand...
Click to collapse
template
git cherry-pick <SHA>
Click to expand...
Click to collapse
When encountering conflicts, you are on your own. I figured most of this out on my own. So if I can do it you can too.
Getting access to Francisco Franco's work
git remote add franco https://github.com/franciscofranco/Tuna_JB_pre1.git
git fetch franco
Click to expand...
Click to collapse
Getting access to http://www.kernel.org
git remote add kerneldotorg git://git.kernel.org/pub/scm/linux/kernel/git/stable/linux-stable.git
git fetch kerneldotorg
Click to expand...
Click to collapse
red 2 days ago yours guide linked in sig.you sad that with ubuntu 12.10 aosp rom are impossible to compile,it's fine only for kernel and for aosp rom should use version 10.xx.now instead you say 12.xx is good for kernel and rom compiling,but from JB and so on.(Compiling AOSP ROMs with these 2 is possible. Only Jelly Bean and later though will compile without additional work)
after that,i think (after reading yours words)that until iCS 12.xx doesn't compile and from jb a so on 12.xx works good?i'm right or i I misunderstood?i'm totally noob on this things,compiled my fist rom 15 days ago,begin with JB but compiled already in mint mate 13,mint cynnamon 13,ubuntu 10.10 and 12.04\10.
very thanks for this guide man,it's very usefull and having already the environment setted it's very fast also.followed instruction in yours sig days ago and with no luck.now i retry with this!on mint 13 cynnamon 64bit now.regards cherrypicking...what you wrote is all we have to known for or is a base?
rated 5 stars and thanked.like this 3ads aims to help everyone begin do things yourselves on android
Good tutorial. Thanks for taking the time to write this.
How many gigs do I need to compile the kernel? I only have a 120gb ssd and 75gb free.
Sent from my Galaxy Nexus using Tapatalk 2
you are safe..
Serious_Beans said:
How many gigs do I need to compile the kernel? I only have a 120gb ssd and 75gb free.
Sent from my Galaxy Nexus using Tapatalk 2
Click to expand...
Click to collapse
They are enough
For kernel compiling we don't need any version of java
Inviato dal mio Galaxy Nexus con Tapatalk 2
sert00 said:
red 2 days ago yours guide linked in sig.you sad that with ubuntu 12.10 aosp rom are impossible to compile,it's fine only for kernel and for aosp rom should use version 10.xx.now instead you say 12.xx is good for kernel and rom compiling,but from JB and so on.(Compiling AOSP ROMs with these 2 is possible. Only Jelly Bean and later though will compile without additional work)
after that,i think (after reading yours words)that until iCS 12.xx doesn't compile and from jb a so on 12.xx works good?i'm right or i I misunderstood?i'm totally noob on this things,compiled my fist rom 15 days ago,begin with JB but compiled already in mint mate 13,mint cynnamon 13,ubuntu 10.10 and 12.04\10.
very thanks for this guide man,it's very usefull and having already the environment setted it's very fast also.followed instruction in yours sig days ago and with no luck.now i retry with this!on mint 13 cynnamon 64bit now.regards cherrypicking...what you wrote is all we have to known for or is a base?
rated 5 stars and thanked.like this 3ads aims to help everyone begin do things yourselves on android
Click to expand...
Click to collapse
ICS didn't compile here on Ubuntu 12.04. I believe I needed to do some additional work. ICS was also released before Ubuntu 12.04 was released. Jelly Bean will compile just fine.
The only thing that was difficult to figure out was how to setup the Java 6 JDK properly which I had to figure out by trial and error.
The cherry-picking is handy when you want to 'steal' someone else his work. Let's say 99% of the developers do this all the time here on XDA. I wanted to explain how to cherry-picking because it's useful to know. I spent a long time getting here.
Serious_Beans said:
How many gigs do I need to compile the kernel? I only have a 120gb ssd and 75gb free.
Sent from my Galaxy Nexus using Tapatalk 2
Click to expand...
Click to collapse
I think 4-5GB if you download everything. If you only download the Jelly Bean things by only downloading the branch you need you will use about maybe 1GB I am not sure. Try it out.
Download the toolchain to a separate directory. This will save lots of bandwidth in the future.
Good job on this guide. I learnt this ages ago though
Sent from my Galaxy Nexus using xda premium
i'm interesting about linaro but i don't know how set it up,can you say something about this?
Sent from my Galaxy Nexus
dxdiag32 said:
i'm interesting about linaro but i don't know how set it up,can you say something about this?
Sent from my Galaxy Nexus
Click to expand...
Click to collapse
Linaro is easy.
Google to download the linaro toolchain from their website. And then it's a bit trial and error to fill in:
CROSS_COMPILE line
it's not arm-eabi- anymore buy gnu-arm-eabi or something similar. It has to do with the directory structure or the filenames.
If you get a compile error about vfp or something you must correct this in a make file.
Take a look in francisco franco's github account or AIR Kernel. They have commit which describe what they did if they ran into compile errors. Normally you won't have to change anything I think.
Thanks OP. Maybe when I'm free I'll give this a try. I always wanted to try to make a stock kernel + colour tweaks + trinity contrast + 384 GPU for my own use. As this is considered I am "stealing" work, I wouldn't bother uploading this kernel I have compiled stock AOSP 4.0.4 (referring a guide) for the galaxy nexus. Except I didn't test out the rom as I didn't own a nexus back then.
Sent from my Galaxy Nexus using Tapatalk 2
thanks OP, but why apt-get install openjdk after manually install JDK 6? it is nothing about kernel compile but fail on the whole aosp compile.
Sent from my Galaxy Nexus
Thanks a lot for this tuto.
I'm trying to compile GlaDos kernel with Ubuntu 12.10 and i have this error :
Code:
[email protected]:~/android/kernel/GLaDOS-nexus-prime$ make
CHK include/linux/version.h
CHK include/generated/utsrelease.h
make[1]: « include/generated/mach-types.h » est à jour.
CC kernel/bounds.s
cc1: error: unrecognized command line option "-mno-unaligned-access"
kernel/bounds.c:1: warning: switch -mcpu=cortex-a9 conflicts with -march= switch
make[1]: *** [kernel/bounds.s] Erreur 1
make: *** [prepare0] Erreur 2
Do you have an idea where it may come from ?
What is the version of your toolchain?
Sent from my Galaxy Nexus using xda app-developers app
anarkia1976 said:
What is the version of your toolchain?
Sent from my Galaxy Nexus using xda app-developers app
Click to expand...
Click to collapse
I took the one in the 1st post :
Code:
git clone https://android.googlesource.com/platform/prebuilt -b jb-release
It's arm-eabi-4.4.3
I tried with Ubuntu 12.04 to be exactly in the same conditions as described in the 1st post but I have exactly the same error...
That is really weird... Any ideas ?
Remove from makefile this:
-mno-unaligned-access
Otherwise you can use new toolchain from my github:
https://github.com/anarkia1976/AK-linaro
anarkia1976 said:
Remove from makefile this:
-mno-unaligned-access
Otherwise you can use new toolchain from my github:
https://github.com/anarkia1976/AK-linaro
Click to expand...
Click to collapse
Thanks anarkia1976 !
I've been able to compile with the last version of your toolchain. :good:
No problem .. if I can help it is a pleasure.
anarkia1976 said:
No problem .. if I can help it is a pleasure.
Click to expand...
Click to collapse
I noticed JZO54K has a crashing camera bug. I checked several times, redownloaded everything on different devices being maguro and grouper.
Has anyone managed to build CM10 or AOSP on Ubuntu 12.10 ? When installing the same packages I notice everything crashes. It's unclear if it's actually the packages or Google Chrome. I suspect one of the packages being the culprit.
I am going one by one through the packages in Ubuntu 12.10. Those willing to help me let me know. just install each package one by one.

Compiling CM9 Guide.

Thought I'd share this - and I need to help a friend with this
CallMeVentus said:
Alright, now you've built AOSP and CM7 and you love it, what next?
Ice Cream Sandwich *insert holy choir here*
Requirements (they are much more different now):
A computer that's capable of 64-bit
A dual-core processor of a speed of at least 2.2Ghz (Intel Xeon/Core i7 recommended)
Either Ubuntu 10.04 LTS 64-bit (later versions have experimental support) but if you're using a later version that's fine.
Or Mac OSX 10.6
At least 8GB of RAM and 10~GB swap maybe? (Otherwise you could have 4Gb of RAM and ~20GB swap this time)
At least a 70GB partition for Ubuntu (to make sure there is space for compiling + installing required stuff)
Well, here are the steps to build it:
Instructions (Taken from http://source.android.com/source/initializing.html & http://wiki.cyanogenmod.com/wiki/Android_SDK_Emulator:_Compile_CyanogenMod_(Linux)):
---------ONLY FOR UBUNTU 10.10--12.04---------
Chapter 1: Initializing a Build Environment
This section describes how to set up your local work environment, how to use Repo to get the Android files, and how to build the files on your machine. To build the Android source files, you will need to use Linux or Mac OS. Building under Windows is not currently supported.
Note: The source download is approximately 6GB in size. You will need 25GB free to complete a single build, and up to 90GB (or more) for a full set of builds.
Section 1 (Linux/Ubuntu): Setting up a Linux build environment
The Android build is routinely tested in house on recent versions of Ubuntu LTS (10.04), but most distributions should have the required build tools available. Reports of successes or failures on other distributions are welcome.
Note: It is also possible to build Android in a virtual machine. If you are running Linux in a virtual machine, you will need at least 16GB of RAM/swap and 30GB or more of disk space in order to build the Android tree.
In general you will need:
Python 2.5 -- 2.7.
GNU Make 3.81 -- 3.82.
JDK 6 if you wish to build Gingerbread or newer; JDK 5 for Froyo or older.
Git 1.7 or newer.
Detailed instructions for Ubuntu 10.04+ follow.
Step 1: Installing the JDK
The Sun JDK is no longer in Ubuntu's main package repository. In order to download it, you need to add the appropriate repository and indicate to the system which JDK should be used.
To download Java 6, do this:
Code:
$ sudo add-apt-repository "deb http://archive.canonical.com/ lucid partner"
$ sudo apt-get update
$ sudo apt-get install sun-java6-jdk
Note: The lunch command in the build step will ensure that the Sun JDK is used instead of any previously installed JDK.
Alternatively you can follow eoghan2t7's instructions:
Or bs828's instructions:
Step 2: Installing required packages (Ubuntu 10.04 -- 11.10)
You will need a 64-bit version of Ubuntu. Ubuntu 10.04 is recommended. Building using a newer version of Ubuntu is currently only experimentally supported and is not guaranteed to work on Git branches other than master (http://github.com/android).
To install the required packages, do this:
Code:
$ sudo apt-get install git-core gnupg flex bison gperf build-essential \
zip curl zlib1g-dev libc6-dev lib32ncurses5-dev ia32-libs \
x11proto-core-dev libx11-dev lib32readline5-dev lib32z-dev \
libgl1-mesa-dev g++-multilib mingw32 tofrodos python-markdown \
libxml2-utils xsltproc
---------ONLY FOR UBUNTU 10.10--11.10---------
For Ubuntu 10.10 users, do this as well:
Code:
$ sudo ln -s /usr/lib32/mesa/libGL.so.1 /usr/lib32/mesa/libGL.so
Note: This is used to avoid a compile error with libGL later on.
For Ubuntu 11.10 users, do this:
Code:
$ sudo apt-get install libx11-dev:i386
---------END FOR UBUNTU 10.10--11.10---------
----------ONLY FOR UBUNTU 12.04----------
Step 2: Installing required packages (Ubuntu 12.04)
Building on Ubuntu 12.04 is currently only experimentally supported and is not guaranteed to work on branches other than master.
To install the required packages, do this:
Code:
$ sudo apt-get install git-core gnupg flex bison gperf build-essential \
zip curl libc6-dev libncurses5-dev:i386 x11proto-core-dev \
libx11-dev:i386 libreadline6-dev:i386 libgl1-mesa-dev:i386 \
g++-multilib mingw32 openjdk-6-jdk tofrodos python-markdown \
libxml2-utils xsltproc zlib1g-dev:i386
---------END FOR UBUNTU 10.10--12.04---------
I won't do MacOSX for ICS, mainly because it has a very unstable success chance of compilation.
Your build environment is good to go! Proceed to
Chapter 2: Downloading the Source Tree
Section 1: Repo
Repo is a tool that makes it easier to work with Git in the context of Android.
It is also a tool that allows you to download source files from Android easily.
Step 1: Installing Repo
To install, initialize, and configure Repo, follow these steps:
Make sure you have a bin/ directory in your home directory, and that it is included in your path:
Code:
$ mkdir ~/bin
$ PATH=~/bin:$PATH
Download the Repo script and ensure it is executable:
Code:
$ curl https://dl-ssl.google.com/dl/googlesource/git-repo/repo > ~/bin/repo
$ chmod a+x ~/bin/repo
For version 1.15, the SHA-1 checksum for repo is 8eb56d98b36d615c3efec51868e87bebe757feb1
For version 1.16, the SHA-1 checksum for repo is f3bfa7fd2d0a44aa40579bb0242cc20df37b5e17
Step 2: Initializing a Repo client
After installing Repo, set up your client to access the android source repository:
Create an empty directory to hold your working files. If you're using MacOS, this has to be on a case-sensitive filesystem. Give it any name you like:
Code:
$ mkdir I_HATE_STEVE
$ cd I_HATE_STEVE
Run repo init to bring down the latest version of Repo with all its most recent bug fixes. You must specify a URL for the manifest, which specifies where the various repositories included in the Android source will be placed within your working directory.
For AOSP:
Code:
$ repo init -u https://android.googlesource.com/platform/manifest -b android-4.1.1_r1
or
Code:
$ repo init -u https://android.googlesource.com/platform/manifest -b android-4.1.1_r2
or
Code:
$ repo init -u https://android.googlesource.com/platform/manifest -b android-4.1.1_r3
or even
Code:
$ repo init -u https://android.googlesource.com/platform/manifest -b ics-plus-aosp
For CM9:
Code:
$ repo init -u git://github.com/CyanogenMod/android.git -b ics
When prompted, please configure Repo with your real name and email address. To use the Gerrit code-review tool, you will need an email address that is connected with a registered Google account. Make sure this is a live address at which you can receive messages. The name that you provide here will show up in attributions for your code submissions.
A successful initialization will end with a message stating that Repo is initialized in your working directory. Your client directory should now contain a .repo directory where files such as the manifest will be kept.
Step 3: Getting the files
To pull down files to your working directory from the repositories as specified in the default manifest, run
Code:
$ repo sync
The Android source files will be located in your working directory under their project names. The initial sync operation will take an hour or more to complete, depending on your Internet bandwidth.
Note: If you initialize your repo on your root area for all projects, the time for downloading will decrease
If you haven't set up ccache now, now is a good time to set it up.
Chapter 2.5 (AOSP only): Downloading the various device specific configurations from GitHub
Now that you have a full copy of AOSP, you will realise that inside your working directory/device you will only see only a few device configurations. That's because AOSP only supports those devices and you will need to manually download other devices for use with AOSP.
You will have to find the device configs yourself as I do not know where every device config in the world is.
Chapter 3: Building the System
The basic sequence of build commands is as follows:
Step 1: Initialize
Initialize the environment with the envsetup.sh script. Note that replacing "source" with a single dot saves a few characters, and the short form is more commonly used in documentation.
Either:
Code:
$ source build/envsetup.sh
or
Code:
$ . build/envsetup.sh
Step 2: Choose a target
Choose which target to build with lunch. The exact configuration can be passed as an argument, e.g.
Code:
$ lunch full-eng
The example above refers to a complete build for the emulator, with all debugging enabled.
If run with no arguments lunch will prompt you to choose a target from the menu.
Step 3: Build the Code
Build everything with make. GNU make can handle parallel tasks with a -jN argument, and it's common to use a number of tasks N that's between 1 and 2 times the number of hardware threads on the computer being used for the build. E.g. on a dual-E5520 machine (2 CPUs, 4 cores per CPU, 2 threads per core), the fastest builds are made with commands between make -j16 and make -j32.
If you are using a dual-core computer do either of these:
Code:
make -j2
or
Code:
make -j4
It is usually recommended that you make the -jN amount twice the number of cores your processor has.
Therefore if you have a quad-core processor do this:
Code:
make -j4
or
Code:
make -j8
There are different ways to run make:
Code:
$ make clean
or
Code:
$ make clobber
Cleans the compile directory and deletes all compiled files.
Code:
$ make update-api
Makes part of the framework, usually used to update the API.
Code:
make otapackage
Makes a flashable .zip file, as otapackage = Over The Air package.
Code:
make (app name, like framework-res)
Makes the specified app and the .apk will be compiled in the output directory.
Once you finish make, you are done! Congratulations!
Chapter 4: Troubleshooting Common Build Errors
Sometimes, things don't go as planned such as unexpected build errors. Here are some solutions to common problems:
Section 1: Wrong Java Version
If you are attempting to build froyo or earlier with Java 1.6, or gingerbread or later with Java 1.5, make will abort with a message such as
Code:
************************************************************
You are attempting to build with the incorrect version
of java.
Your version is: WRONG_VERSION.
The correct version is: RIGHT_VERSION.
Please follow the machine setup instructions at
https://source.android.com/source/download.html
************************************************************
This may be caused by:
failing to install the correct JDK as specified on the Initializing chapter. Building Android requires Sun JDK 5 or 6 depending on which release you are building.
another JDK that you previously installed appearing in your path. You can remove the offending JDK from your path with:
Code:
$ export PATH=${PATH/\/path\/to\/jdk\/dir:/}
Section 2: Python Version 3
Repo is built on particular functionality from Python 2.x and is unfortunately incompatible with Python 3. In order to use repo, please install Python 2.x:
Code:
$ apt-get install python
Optional Step: Setting up ccache
You can optionally tell the build to use the ccache compilation tool. Ccache acts as a compiler cache that can be used to speed-up rebuilds. This works very well if you do "make clean" often, or if you frequently switch between different build products.
Put the following in your .bashrc or equivalent.
Code:
$ export USE_CCACHE=1
By default the cache will be stored in ~/.ccache. If your home directory is on NFS or some other non-local filesystem, you will want to specify the directory in your .bashrc as well.
Code:
$ export CCACHE_DIR=
The suggested cache size is 50-100GB. You will need to run the following command once you have downloaded the source code, if you use CCache.
Code:
$ prebuilt/linux-x86/ccache/ccache -M 50G
Optional Step: 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 filesystem optimized for speed instead of crash robustness, since all files can be re-generated in case of filesystem corruption.
To set this up, export the OUT_DIR_COMMON_BASE variable to point to the location where your output directories will be stored.
Code:
export OUT_DIR_COMMON_BASE=
The output directory for each separate source tree will be named after the directory holding the source tree.
For instance, if you have source trees as /source/master1 and /source/master2 and OUT_DIR_COMMON_BASE is set to /output, the output directories will be /output/master1 and /output/master2.
It's important in that case to not have multiple source trees stored in directories that have the same name, as those would end up sharing an output directory, with unpredictable results.
This is only supported on branches newer than 4.0.x (IceCreamSandwich).
Click to expand...
Click to collapse

Categories

Resources