Learn How to Create an Old School Dialer

XDA is not only a great source for custom ROMs, kernels, and various modifications for numerous … more

USB Desktop Charger Roundup – XDA TV

Sometimes you learn one way to do something, and that’s the way you do it forever. You never … more

Samsung Galaxy Grand Duos Receives Early CM12 Port

Samsung Galaxy Grand is a dual-SIM phone with a 5 screen that was announced two years ago. … more

Google Adds New Features to Drive, Sheets, Slides and Docs

In the last few months, Google has been working very hard to adapt all its apps to … more

Welcome to XDA

Search to go directly to your device's forum

Register an account

Unlock full posting privileges

Ask a question

No registration required
Post Reply

[Guide][Ref][Z][BYO] Project Developer - AIO TUTORIAL

OP rebelos

15th January 2014, 05:47 PM   |  #1  
rebelos's Avatar
OP Senior Member
Flag #slimusers - join Slim on IRC
Thanks Meter: 4,840
 
1,876 posts
Join Date:Joined: Nov 2012
More
Project Developer

Welcome

This is a guide for all those who want to build for their Xperia Z Device but do not neccesasarily have the knowledge or experience.


This is an unofficial guide for the building of custom ROMs and other mods for the Xperia Z. This is a work in progress, with additions being made as often as possible. This thread has already grown with the help of the devs established in this forum. BMP777 began this project a year ago when I was using a Samsung GS II Skyrocket. BMP777 started another alike thread called PR II in the LGOG forum a while back as well. I have since moved on to a ONE, but both threads remain to this day. and Started by Me on Xperia Arc The point is this: everyone who uses this site has a desire for modding, customizing, and/or otherwise altering their device. Unfortunately, many have no idea how to go about doing these things for themselves. As such, there is a lot of dissatisfaction among developers about receiving constant demands, suggestions, and requests for updates. This thread is meant to give those who want to step up and build for themselves the means to do so. It is an ever-changing thread, with all assistance welcomed.

READ ME:

On one hand, it should go without saying that if you have no knowledge and/or experience with building, java, C++, and various other tools, you probably shouldn't begin here. At the same time, it is possible to learn to build, provided you can read, follow directions, and aren't too lazy to RESEARCH.

OH YEAH, and you better have patience. This isn't easy. It will be work. The quickest way to get flamed is to show yourself to be lazy. If you think that with a couple clicks, you can have your own flashy ROM, forget it. But, if you do want to learn, this is a good place to get started. I have no ego about this; I started the same way and just want to help everyone learn to build their own ROM. But, everyone will struggle to get to a successful point, and lazy, unmotivated people just irritate those who have had to learn from scratch too. Tutorials will be posted for any new thing learned and built as time and space allow. ALL ARE WELCOME AND ALL QUESTIONS ARE TOO. But, seriously, if it's a really ridiculous one, I/we reserve the right to screw with you about it.

ALWAYS REMEMBER:




Thread Disclaimer:
The instructions and extras posted here are to be used at your own risk. I am working hard to provide good, workable tutorials that will make successful building much easier. Nevertheless, I am not responsible if you lose your files, brick your device, or inadvertently cause a nuclear war. If you are seeking absolute perfection, RUN NOW WHILE YOU STILL CAN!!


Thread Navigation :

# 2 > Setting Up Build enviorment
# 3 > Building instructions & How To Build Using Linaro Toolchain
# 4 > Kernel building and CCACHE
# 5 > reserved for future




XDA:DevDB Information
Project Developer, a Tool/Utility for the Sony Xperia Z

Contributors
officiallysonyrebel, car vs driver , BMP777, @Saki3d , @FXP , @kali , @codeworkx , @cdesai

Version Information
Status: Testing

Created 2013-11-29
Last Updated 2013-12-03
Last edited by rebelos; 15th January 2014 at 06:20 PM.
The Following 3 Users Say Thank You to rebelos For This Useful Post: [ View ]
15th January 2014, 05:48 PM   |  #2  
rebelos's Avatar
OP Senior Member
Flag #slimusers - join Slim on IRC
Thanks Meter: 4,840
 
1,876 posts
Join Date:Joined: Nov 2012
More
Build Enviorment Set up :

This is a combination of the steps offered in the threads 'Compile JB on Ubuntu' and TeamChopsticks CyanogenMod.

Special thanks to dastin1015 and TeamChopsticks.

Tip: Allocate at least 75 gigs of space for the building of ONE ROM. If you install ccache, you will want 90. A complete build directory can use as much as 100 gigs, so make sure you have plenty of room. One of the ways to fail out a build is too use all of your partition before acquiring all the necessary files.

Here are the steps from those 2 tutorials in correct order:

0.1 ))
Install Gedit

Code:
# gedit
sudo apt-get install gedit

1) You need the following:

-JDK 6 if you wish to build Jellybean.


Code:
$ sudo apt-get oracle-java7-installer
-Python 2.4 -- 2.7, which you can download from python.org.
Or:


Code:
$ sudo apt-get install python
-Git 1.7 or newer. You can find it at git-scm.com.
Or:


Code:
$ sudo apt-get install git-core
-Android SDK:

Download the SDK here: http://developer.android.com/sdk/index.html
Extract the SDK and place it in your home directory.
I renamed my SDK to android-sdk to make it easier to navigate to this tutorial assumes you've done that as well.
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:



Code:
# Android tools
export PATH=${PATH}:~/android-sdk/tools
export PATH=${PATH}:~/android-sdk/platform-tools
export PATH=${PATH}:~/bin

Find your .profile file and add this at the bottom of the file:



Code:
PATH="$HOME/android-sdk/tools:$HOME/android-sdk/platform-tools:$PATH"
You have now successfully installed the Android SDK.
To check for updates issue this into your terminal:

Code:
$ android

2) Install required packages. 64-bit (recommended)



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 lib32readline-gplv2-dev lib32z-dev 
  libgl1-mesa-dev g++-multilib mingw32 tofrodos python-markdown 
  libxml2-utils lzop schedtool

On newer versions of Ubuntu such as 11.10 you may need to do the following:


Code:
$ sudo ln -s /usr/lib/i386-linux-gnu/libX11.so.6 /usr/lib/i386-linux-gnu/libX11.so

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-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

3) Configure your USB.



Code:
$ gksudo gedit /etc/udev/rules.d/51-android.rules

Inside of this blank text file insert:


Code:
#Acer
SUBSYSTEM=="usb", ATTR{idVendor}=="0502", MODE="0666"

#ASUS
SUBSYSTEM=="usb", ATTR{idVendor}=="0b05", MODE="0666"

#Dell
SUBSYSTEM=="usb", ATTR{idVendor}=="413c", MODE="0666"

#Foxconn
SUBSYSTEM=="usb", ATTR{idVendor}=="0489", MODE="0666"

#Garmin-Asus
SUBSYSTEM=="usb", ATTR{idVendor}=="091E", MODE="0666"

#Google
SUBSYSTEM=="usb", ATTR{idVendor}=="18d1", MODE="0666"

#HTC
SUBSYSTEM=="usb", ATTR{idVendor}=="0bb4", MODE="0666"

#Huawei
SUBSYSTEM=="usb", ATTR{idVendor}=="12d1", MODE="0666"

#K-Touch
SUBSYSTEM=="usb", ATTR{idVendor}=="24e3", MODE="0666"

#KT Tech
SUBSYSTEM=="usb", ATTR{idVendor}=="2116", MODE="0666"

#Kyocera
SUBSYSTEM=="usb", ATTR{idVendor}=="0482", MODE="0666"

#Lenevo
SUBSYSTEM=="usb", ATTR{idVendor}=="17EF", MODE="0666"

#LG
SUBSYSTEM=="usb", ATTR{idVendor}=="1004", MODE="0666"

#Motorola
SUBSYSTEM=="usb", ATTR{idVendor}=="22b8", MODE="0666"

#NEC
SUBSYSTEM=="usb", ATTR{idVendor}=="0409", MODE="0666"

#Nook
SUBSYSTEM=="usb", ATTR{idVendor}=="2080", MODE="0666"

#Nvidia
SUBSYSTEM=="usb", ATTR{idVendor}=="0955", MODE="0666"

#OTGV
SUBSYSTEM=="usb", ATTR{idVendor}=="2257", MODE="0666"

#Pantech
SUBSYSTEM=="usb", ATTR{idVendor}=="10A9", MODE="0666"

#Philips
SUBSYSTEM=="usb", ATTR{idVendor}=="0471", MODE="0666"

#PMC-Sierra
SUBSYSTEM=="usb", ATTR{idVendor}=="04da", MODE="0666"

#Qualcomm
SUBSYSTEM=="usb", ATTR{idVendor}=="05c6", MODE="0666"

#SK Telesys
SUBSYSTEM=="usb", ATTR{idVendor}=="1f53", MODE="0666"

#Samsung
SUBSYSTEM=="usb", ATTR{idVendor}=="04e8", MODE="0666"

#Sharp
SUBSYSTEM=="usb", ATTR{idVendor}=="04dd", MODE="0666"

#Sony Ericsson
SUBSYSTEM=="usb", ATTR{idVendor}=="0fce", MODE="0666"

#Toshiba
SUBSYSTEM=="usb", ATTR{idVendor}=="0930", MODE="0666"

#ZTE
SUBSYSTEM=="usb", ATTR{idVendor}=="19D2", MODE="0666"

4) Save the file and close it and then issue this command:


Code:
$ sudo chmod a+r /etc/udev/rules.d/51-android.rules

5) Install the repo:


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

Create your work directory:

Code:
mkdir ~/"your directory name here"     For example: mkdir ~/cm10
cd ~/cm10

Setup local manifest:

Code:
mkdir .repo/local_manifests
touch .repo/local_manifests/sony.xml
gedit .repo/local_manifests/sony.xml
Last edited by rebelos; 15th January 2014 at 05:52 PM.
The Following User Says Thank You to rebelos For This Useful Post: [ View ]
15th January 2014, 05:48 PM   |  #3  
rebelos's Avatar
OP Senior Member
Flag #slimusers - join Slim on IRC
Thanks Meter: 4,840
 
1,876 posts
Join Date:Joined: Nov 2012
More
Necessary Files for Xperia Z :

Tip :For Building any Rom for Xperia Z u need these specific device files

1 . first is "sony.xml"

Code:
<?xml version="1.0" encoding="UTF-8"?>
<manifest>

<project path="device/sony/fusion3-common" name="CyanogenMod/android_device_sony_fusion3-common" remote="github" revision="cm-11.0" />
<project path="device/sony/qcom-common" name="CyanogenMod/android_device_sony_qcom-common" remote="github" revision="cm-11.0" />
<project path="device/sony/yuga" name="CyanogenMod/android_device_sony_yuga" remote="github" revision="cm-11.0" />
<project path="vendor/sony" name="CyanogenMod/proprietary_vendor_sony" remote="github" revision="cm-11.0" />
<project path="kernel/sony/apq8064" name="CyanogenMod/android_kernel_sony_apq8064" remote="github" revision="cm-11.0" />
<project path="hardware/sony/DASH" name="CyanogenMod/android_hardware_sony_DASH" remote="github" revision="cm-11.0" />

</manifest>
Last edited by rebelos; 15th January 2014 at 06:04 PM.
15th January 2014, 05:48 PM   |  #4  
rebelos's Avatar
OP Senior Member
Flag #slimusers - join Slim on IRC
Thanks Meter: 4,840
 
1,876 posts
Join Date:Joined: Nov 2012
More
Building Instructions : For CyanogenMod :: AOKP :: Carbon roms :: Beanstalk

Unofficial





To get started with Android/CyanogenMod, you'll need to get familiar with Git and Repo.

To initialize your local repository using the CyanogenMod trees, use a command like this:

first create folder named " cm "
Code:
mkdir cm
enter into cm
Code:
cd ~/cm
For CM - 11.0 kitkat 4.4.x
Code:
repo init -u git://github.com/CyanogenMod/android.git -b cm-11.0
Then to sync up:

Code:
repo sync
Please see the CyanogenMod Wiki for building instructions.

For more information on this Github Organization and how it is structured, please read the wiki article.

Create and edit semc.xml in .repo:

Code:
gedit .repo/local_manifests/sony.xml
Add this to the semc.xml:

For CM 11.0 KitKat 4.4.x

copy paste semc.xml for kikat 4.4 from above
then
Code:
repo sync
Code:
. build/envsetup.sh (notice the period and space)
vendor/cm/get-prebuilts
then

Code:
brunch yuga






Special thanks to scott.hart.bti for his hard work -

From terminal
1. type
Code:
cd
.
This will bring you to your root folder.

2. type
Code:
mkdir beanstalk
.
This will create a folder named beanstalk.

3. type
Code:
cd beanstalk
.
This will take you to the beanstalk directory created from previous step

4. type
Code:
repo init -u git://github.com/scotthartbti/android.git -b kk44
.
This will setup the folders to be synced.

5. For Beanstalk KitKat 4.4.x

copy paste sony.xml for kikat 4.4 from above
then
Code:
repo sync
apply patches for 4.4

9. Outside of terminal, navigate to beanstalk/vendor/cm. Double click on the get-prebuilts file and select run in terminal. This will fetch necessary files needed to build and place them where they need to be.

10. Type
Code:
. build/envsetup.sh && brunch yuga
11. Previous step will start building beanstalk for your device. The process takes anywhere from 1 - 3 hours depending on your computer.

12. Once completed, it will say package complete and you will have a beanstalk named zip file in your out folder.


Unofficial



Special thanks to spleef and ktempleman for laying this out

This set of instructions is unverified. If you build successfully or have build issues, please post here so we can confirm or fix what isn't working




First:

Code:
mkdir aokp
then

Code:
cd aokp
then

Code:
repo init -u https://github.com/AOKP/platform_manifest.git -b kitkat
after it does its thing

Code:
mkdir .repo/local_manifests
touch .repo/local_manifests/sony.xml
gedit .repo/local_manifests/sony.xml
copy paste semc.xml for kikat 4.4 from above

save and exit then


Code:
repo sync
after everything syncs

Code:
gedit vendor/aokp/vendorsetup.sh
and add this to the bottom:

Code:
add_lunch_combo aokp_yuga-userdebug
save and exit.. then


Code:
. build/envsetup.sh
Code:
brunch yuga



For more on AOKP building, try here: http://aokp.co/learn/so-you-want-to-...jb-ubuntu-1204

And Here: https://github.com/AOKP


Unofficial





Getting Started

To get started with the Carbon-Dev sources, you'll need to get familiar with Git and Repo.

Create the Directories

You will need to set up some directories in your build environment.

To create them run:

Code:
mkdir -p ~/carbon
Install the Repository

You may need to reboot for these changes to take effect. Now enter the following to initialize the repository:

Code:
cd ~/carbon
Repositories:

Before you continue --> run this in the terminal

Code:
repo init -u https://github.com/CarbonDev/android.git -b kk
after it does its thing

Code:
mkdir .repo/local_manifests
touch .repo/local_manifests/sony.xml
gedit .repo/local_manifests/sony.xml
copy paste sony.xml for kikat 4.4 from above

save and exit then


Code:
repo sync
after everything syncs

Code:
gedit vendor/carbon/vendorsetup.sh
and add this to the bottom:

Code:
add_lunch_combo carbon_yuga-userdebug
save and exit.. then


Code:
. build/envsetup.sh
Code:
brunch yuga





To get started with AORP, you'll need to get familiar with Git and Repo.

To initialize your local repository using the AORP trees, use a command like this:

first create folder named " AORP "
Code:
mkdir AORP
enter into AORP
Code:
cd ~/AORP
For kitkat 4.4.x
Code:
repo init -u git://github.com/AORP/android.git -b kk
Then to sync up:

Code:
repo sync
Please see the CyanogenMod Wiki for building instructions.

For more information on this Github Organization and how it is structured, please read the wiki article.

Create and edit sony.xml in .repo:

Code:
gedit .repo/local_manifests/semc.xml
Add this to the semc.xml:

For KitKat 4.4.x

copy paste sony.xml for kikat 4.4 from above

then
Code:
repo sync
Code:
. build/envsetup.sh (notice the period and space)
vendor/cm/get-prebuilts
then

Code:
brunch yuga





Next Tutorial is Strictly Not for beginners





Building with Linaro 4.8 toolchain

Go into Terminal and navigate to the root folder of your source tree, then:

Code:
prebuilts/gcc/linux-x86/arm/
Run:

Code:
wget http://releases.linaro.org/13.06/components/toolchain/gcc-linaro/4.8/gcc-linaro-4.8-2013.06.tar.bz2
Run:

Code:
bunzip2 *.tar.bz2
Run:

Code:
tar -xvf *.tar
Using your file manager, navigate to the root folder of your source tree again.

Navigate To "/build", in your root folder.

Run:

Code:
gksudo gedit envsetup.sh
change the line in bold, to look exactly like this one:

Code:
case $ARCH in
        x86) toolchaindir=x86/i686-linux-android-4.6/bin
            ;;
        arm) toolchaindir=arm/gcc-linaro-4.8-2013.06  <--------
            ;;
        mips) toolchaindir=mips/mipsel-linux-android-4.6/bin
            ;;
        *)
            echo "Can't find toolchain for unknown architecture: $ARCH"
            toolchaindir=xxxxxxxxx
            ;;
esac
Exit out and open new. Initialize and build. That's it! Makes you wonder why you never did it before, right?

Not so fast. You may have build issues, you may not. I had a few lengthy sets of errors in gsm calltracker and another .java file that was solved by using Meld and making it look exactly like a successful build's file. More as I learn.......


Thanks to infected_ for this tut; his post can be found here: [/COLOR]

http://forum.xda-developers.com/show...3&postcount=12









This is a work in progress. Many more pieces of information will be added and this is meant to be an ever-changing thread. If you see something that is outdated or incorrect, please let me know ASAP, so I can make the correction. Also, make sure that any info offered can be and has been confirmed as functional.










Thanks to:

CyanogenMod
scott.hart.bti
Team Carbon
david279
MallardDuck
ktempleton
AdhvanIt
matthew0776
spleef
M4570D0N
car vs driver
mikeioannina
BMP777
Last edited by rebelos; 15th January 2014 at 06:11 PM.
15th January 2014, 05:49 PM   |  #5  
rebelos's Avatar
OP Senior Member
Flag #slimusers - join Slim on IRC
Thanks Meter: 4,840
 
1,876 posts
Join Date:Joined: Nov 2012
More
Kernel Building and Ccache

Building your first kernel
:


This is a set of steps to get you building your first kernel. Special thanks to thewadegeek for putting this tutorial together. His thread can be found here: http://forum.xda-developers.com/show....php?t=1748297


Step 1. Build Environment

A. Install Ubuntu 12.04(Not holding your hand here, if you can't do this you shouldn't be messing with kernels)

B. Required packages: git-core, gnupg, flex, bison, gperf, libsdl-dev, libesd0-dev, libwxgtk2.6-dev, build-essential, zip, curl, libncurses5-dev, zlib1g-dev, ia32-libs, lib32z1-dev, lib32ncurses5-dev, gcc-multilib, g++-multilib, and Adb.

C. Open a terminal

D. Type
Code:
mkdir android
E. Type
Code:
cd android
G.Type
Code:
mkdir kernel

Step 2. Your Source

A. Open your Terminal Prompt

B. Type
Code:
cd android/kernel
C. Type
Code:
git clone git://github.com/DooMLoRD/android_prebuilt_toolchains.git toolchains
D. Now comes the tricky part, you need to have some-type of source for your kernel. Check the following two sites for your device as appropriate. Once you have it download it is extracted/cloned into a folder in your kernel directory.

http://developer.sonymobile.com/wpor...ads/opensource

Step 3. Modifications

This is the part people are curious about, they want to make modifications to the kernel to make it "special". Start all these from the root directory of your kernel source.

Mod 1. Applying a patch

A. Download the patch you wish to apply, in this case this one should work.

B. Save that file as "kernelPatch" in your kernel directory.

C. Open a Terminal

D. Move into the root directory of the kernel you wish to patch.

E. Type
Code:
patch -p1 < ../kernelPatch

Mod 2. Adding a Governor Alone

A. Open "drivers/cpufreq/Kconfig"

B. Add the following lines in appropriate spot amongst the other govenor's

Code:
config CPU_FREQ_DEFAULT_GOV_SMARTASS
            bool "smartass"
            select CPU_FREQ_GOV_SMARTASS
            select CPU_FREQ_GOV_PERFORMANCE
            help
              Use the CPUFreq governor 'smartass' as default.
Code:
config CPU_FREQ_GOV_SMARTASS
           tristate "'smartass' cpufreq governor"
           depends on CPU_FREQ
           help
             smartass' - a "smart" optimized governor!
             If in doubt, say N.
C. Open "drivers/cpufreq/Makefile"

D. Add the following line in the appropriate spot.

Code:
 obj-$(CONFIG_CPU_FREQ_GOV_SMARTASS)     += cpufreq_smartass.o
E. Create a file called "drivers/cpufreq/cpufreq_smartass.c"

F. Put the following code in that file.

http://pastebin.com/f0Bk9kVZ

G. open "include/linux/cpufreq.h"

H. Under the "Cpufreq Default" section add

Code:
#elif defined(CONFIG_CPU_FREQ_DEFAULT_GOV_SMARTASS)
extern struct cpufreq_governor cpufreq_gov_smartass;
#define CPUFREQ_DEFAULT_GOVERNOR (&cpufreq_gov_smartass)
Ok there is a governor added, do the exact same steps for any other one's you would like to add.


Step 4. Getting a Config file

Option A. Pulling a config file from a kernel.

A. Hook up a device that is using a kernel similar to one you are using as your base.

B. Open a terminal

C. Change to your root kernel directory

D. Type
Code:
adb pull /proc/config.gz
E. Type
Code:
gunzip config.gz
F. Type
Code:
mv config arch/arm/configs/<your_config_name>_defconfig

Option B. Using the manufacturers config.

Unfortunately as stated above, not all kernels support the "/proc/config.gz" method. You can typically find a manufacturer's configuration file in "arch/arm/configs". I believe the one for my HTC Flyer was called "flyer_hc_defconfig", so look for a layout similar to that one. Also read the README to get a better idea of how to modify it. I would personally make a copy of it called "<your_config_name>_defconfig" and use that as my base.

Step 5. Building

Time to start the real "build" section of this tutorial.

Part A. Pre-build Steps

A. Open terminal and change to the root of your kernel directory

B. Type
Code:
export ARCH=arm
C. Type
Code:
export CROSS_COMPILE=~/android/kernel/toolchains/arm-eabi-linaro-4.6.2/bin/arm-eabi-
Part B. The First Build

A. Type
Code:
make <your_config_name>_defconfig
B. Type
Code:
make menuconfig
and make the required changes to use any modules you added or similar changes.

C. Type
Code:
make -j<maximum number of jobs>
Part C. Re-Builds

A. Type
Code:
make clean
B. Type
Code:
make oldconfig
C. Type
Code:
make -j<maximum number of jobs>
Part D. Building Modules

You have two options:

A. Type
Code:
make modules
B. Type
Code:
make path/to/your/module.ko
The above steps explained:

Part A.(These steps are required every time you close your terminal and re-open it to build again.)

A. Ok shouldn’t need to explain this.

B. This command sets your target architecture.

C. Defines the path to the toolchain we are going to use to compile our kernel. You can change this to point towards whatever toolchain you have downloaded or feel like using, the way it is currently configured it will use the Linaro toolchain that we downloaded above.

Part B.(These only need to be run the first time you build a kernel.)

A. Load's your configuration file from earlier.

B. Open up a menu to configure your kernel. It will use the config file you loaded in the previous step as a base.

C. Viola start the build. I typically allow 1 job per core, so on my quad core machine I put "make -j4". Just raising that number will not make your build faster, your processor needs to be able to support the number of jobs you are assigning it.

Part C. (Use the command's when you are building any-time outside of the first)

A. This command gets rid of any old/outdated binaries or modules you compiled before, and let's start fresh. I like to run it every I build unless my changes are really small and localized.

B. A very awesome command, it parses through what has changed and only prompts you about new options.

C. See the explanation for the above "Part C.".

Part D.(Use these for just building kernel modules.)

A. This will re-build all modules.

B. Will rebuild just the module you need. Very useful when you need to rebuild a WiFi module.


Step 6. Now what

Ok we have now started our build and we are waiting for it to finish, so there are two possible outcomes:

Outcome A. Build Succeeds

W00t!! You have a kernel built by your self from source. There are a couple things you need in-order to use this kernel on your device any ".ko" modules and the zImage binary. If you pay attention to the output of your compiler then you will see the location of those objects. However the following commands will make your life a bit easier(Thanks Recognized Developer Hacre):

A. Open a terminal

B. Change to your root kernel directory

C. Type
Code:
mkdir ../<your_kernel>_output
D. Type
Code:
cp arch/arm/boot/zImage ../<your_kernel>_output/zImage
E. Type
Code:
find . -name "*.ko" -exec cp {} ../<your_kernel>_output \;
The above steps explained:

A-C. Self-Explanatory

D. Move our kernel binary into our output folder

E. This handy bit of magic finds all ".ko" modules and also copies them into your output file.

You will also need to assemble a kernel image containing a initramfs for your device, along with the kernel binary and such. That however is beyond the scope of this tutorial. To get started though try searching the following phrases.

Code:
building android kernel image
xda build kernel image
xda unpack boot.img
Outcome B. Build Fails

Oh dear. It failed. Well guess what...this is going to happen..a LOT. Get used to it, and get used to googling and experimenting with different solutions. The following are some tips that will help you with debugging your issues.

Running a "Clean" build

A. Backup your config file - Type
Code:
cp .config ../backupConfig
B. Re-run the build process using just your defconfig from earlier.

Limiting Output(Thanks Hacre.)

A. Another good tip is to run "make -j1" to get the error, as it will limit the amount of text you need to scroll through.[/COLOR]
[/CENTER]









CCACHE


Here is a brief tutorial on the installation of Ccache, which can shorten build times drastically :

If you have room on your build system you can speed
your builds up considerably by using ccache. ccache is a compiler
cache. It speeds up re-compilation of C/C++ code by caching
previous compiles and detecting when the same compile is
being done again.

Install it with apt-get:
Code:
sudo apt-get install ccache
Set environment vars for Android use:
(I put these exports in my .bashrc)

Code:
export USE_CCACHE=1
export NDK_CCACHE=ccache
Set a cache size of 10G for optimal results:

Code:
ccache -M 10G
Check the status of your cache with the command:

Code:
ccache -s 
Returns:

Code:

cache directory                 /home/jocala/.ccache
cache hit                         106673
cache miss                         18379
called for link                     3758
preprocessor error                     5
not a C/C++ file                    4425
unsupported compiler option          678
no input file                       4565
files in cache                     36758
cache size                           3.2 Gbytes
max cache size                      10.0 Gbytes
Last edited by rebelos; 15th January 2014 at 06:13 PM.
15th January 2014, 05:49 PM   |  #6  
rebelos's Avatar
OP Senior Member
Flag #slimusers - join Slim on IRC
Thanks Meter: 4,840
 
1,876 posts
Join Date:Joined: Nov 2012
More
Really Useful things


Here are some relevant topics/tutorials/sites:

Download | Ubuntu - www.ubuntu.com/download

Official Ubuntu Documentation: Help for all versions. - https://help.ubuntu.com/

How To Windows Dual Boot: - https://help.ubuntu.com/community/WindowsDualBoot

How To Use The Terminal: Commandline stuff. - https://help.ubuntu.com/community/UsingTheTerminal/

[HOW TO] Beginners Guide to Android ROM Development - http://forum.xda-developers.com/show....php?t=1272270 (courtesy of isidromxz)

[Tutorial] Compile JB on Ubuntu - http://forum.xda-developers.com/show....php?t=1762641 (courtesy of dastin1015)

[CM10] [PPA] Cyanogenmod Compiler v0.6 - http://forum.xda-developers.com/show....php?t=1789190 (courtesy of lithid-cm)

[Wiki] How to: Gerrit - http://wiki.cyanogenmod.com/wiki/Howto:_Gerrit

[Wiki] How to: Git - http://wiki.cyanogenmod.com/wiki/Howto:_Git

[Wiki] How to: Connect to device with SSH - http://wiki.cyanogenmod.com/wiki/How...evice_with_SSH

Here is an easy-to-use page on common Linux commands: - http://www.pixelbeat.org/cmdline.html

Linux Newbie Guide : - http://www.unixguide.net/linux/linuxshortcuts.shtml

Also, Team Chopsticks has a good page with some useful tips as well, located here:

http://www.teamchopsticks.org/p/contributing.html (thanks to bdusmc for the tip)

Here is a link to LIFEHACKER's command line tutorials. Very good stuff!! : http://lifehacker.com/5743814/become...ving-shortcuts

CyanogenMod git : - https://github.com/CyanogenMod

LegacyXperia git : - https://github.com/LegacyXperia

Original Beanstalk thread : - http://forum.xda-developers.com/show....php?t=2091900

Beanstalk git : - https://github.com/scotthartbti?tab=repositories

The Muppets git : - https://github.com/TheMuppets


[/FONT]
[/CENTER]
Last edited by rebelos; 15th January 2014 at 06:14 PM.
15th January 2014, 05:49 PM   |  #7  
rebelos's Avatar
OP Senior Member
Flag #slimusers - join Slim on IRC
Thanks Meter: 4,840
 
1,876 posts
Join Date:Joined: Nov 2012
More
Build Your Own ROM "Like a Boss" Share it!
Last edited by rebelos; 15th January 2014 at 06:15 PM.
15th January 2014, 05:50 PM   |  #8  
rebelos's Avatar
OP Senior Member
Flag #slimusers - join Slim on IRC
Thanks Meter: 4,840
 
1,876 posts
Join Date:Joined: Nov 2012
More
lets roll the clock

Post Reply Subscribe to Thread
Previous Thread Next Thread
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes