[Guide][Ref][M] [Build Your Own] Project Developer - AIO TUTORIAL

Search This thread
R

rebelos

Guest
Project Developer

Welcome

This is a guide for all those who want to build for their Xperia M 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 M. 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:

Just_Google_It_by_doctor_a.gif



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

rebelos

Guest
Necessary Files for Xperia M :

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>

<!-- Nicki bits -->
<project path="device/sony/nicki" name="CyanogenMod/android_device_sony_nicki" remote="github" revision="cm-11.0" />
<project path="kernel/sony/msm8x27" name="CyanogenMod/android_kernel_sony_msm8x27" remote="github" revision="cm-11.0" />

<!-- common sony bits -->
<project path="device/sony/qcom-common" name="CyanogenMod/device_sony_qcom-common" remote="github" revision="cm-11.0" />
<project path="device/sony/common" name="CyanogenMod/device_sony_common" remote="github" revision="cm-11.0" />
<project path="hardware/sony/DASH" name="CyanogenMod/android_hardware_sony_DASH" remote="github" revision="cm-11.0" />

<!-- sony vendor bits -->
<project path="vendor/sony" name="TheMuppets/proprietary_vendor_sony" remote="github" revision="cm-11.0" />

</manifest>
 
Last edited:
R

rebelos

Guest
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:
[COLOR="Black"]$ sudo apt-get oracle-java7-installer
-Python 2.4 -- 2.7, which you can download from python.org.[/COLOR]

Or:


Code:
[COLOR="black"]$ sudo apt-get install python
-Git 1.7 or newer. You can find it at git-scm.com.[/COLOR]

Or:


Code:
[COLOR="black"]$ sudo apt-get install git-core[/COLOR]

-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:
[COLOR="black"]# Android tools
export PATH=${PATH}:~/android-sdk/tools
export PATH=${PATH}:~/android-sdk/platform-tools
export PATH=${PATH}:~/bin[/COLOR]


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



Code:
[COLOR="black"]PATH="$HOME/android-sdk/tools:$HOME/android-sdk/platform-tools:$PATH"
You have now successfully installed the Android SDK.[/COLOR]

To check for updates issue this into your terminal:

Code:
[COLOR="black"]$ android[/COLOR]


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



Code:
[COLOR="black"]$ 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[/COLOR]


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


Code:
[COLOR="black"]$ sudo ln -s /usr/lib/i386-linux-gnu/libX11.so.6 /usr/lib/i386-linux-gnu/libX11.so[/COLOR]


Code:
[COLOR="black"]$ 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[/COLOR]


3) Configure your USB.



Code:
[COLOR="black"]$ gksudo gedit /etc/udev/rules.d/51-android.rules[/COLOR]


Inside of this blank text file insert:


Code:
[COLOR="black"]#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"[/COLOR]


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


Code:
[COLOR="black"]$ sudo chmod a+r /etc/udev/rules.d/51-android.rules[/COLOR]


5) Install the repo:


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


Create your work directory:

Code:
[COLOR="black"]mkdir ~/"your directory name here"     For example: mkdir ~/cm10
cd ~/cm10[/COLOR]


Setup local manifest:

Code:
[COLOR="Black"]mkdir .repo/local_manifests
touch .repo/local_manifests/sony.xml
gedit .repo/local_manifests/sony.xml[/COLOR]
 
Last edited:
R

rebelos

Guest
Building Instructions : For CyanogenMod :: AOKP :: Carbon roms :: Beanstalk

Unofficial

26dca__cyanogenmod-10.2.jpg




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:
[COLOR="black"]repo init -u git://github.com/CyanogenMod/android.git -b cm-11.0[/COLOR]

Then to sync up:

Code:
[COLOR="black"]repo sync[/COLOR]

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:
[COLOR="black"]gedit .repo/local_manifests/sony.xml[/COLOR]

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:
[COLOR="Black"]repo sync[/COLOR]

Code:
[COLOR="black"]. build/envsetup.sh (notice the period and space)
vendor/cm/get-prebuilts
[/COLOR]

then

Code:
brunch c1905






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

From terminal
1. type
Code:
[COLOR="black"]cd[/COLOR]
.
This will bring you to your root folder.

2. type
Code:
[COLOR="black"]mkdir beanstalk[/COLOR]
.
This will create a folder named beanstalk.

3. type
Code:
[COLOR="black"]cd beanstalk[/COLOR]
.
This will take you to the beanstalk directory created from previous step

4. type
Code:
[COLOR="black"]repo init -u git://github.com/scotthartbti/android.git -b kk44[/COLOR]
.
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:
[COLOR="Black"]repo sync[/COLOR]

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:
[COLOR="Black"]. build/envsetup.sh && brunch c1905 [/COLOR]

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

AOKP.jpg


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:
[COLOR="Black"]mkdir aokp[/COLOR]

then

Code:
[COLOR="black"]cd aokp[/COLOR]

then

Code:
[COLOR="black"]repo init -u https://github.com/AOKP/platform_manifest.git -b kitkat[/COLOR]

after it does its thing

Code:
[COLOR="black"]mkdir .repo/local_manifests
touch .repo/local_manifests/sony.xml
gedit .repo/local_manifests/sony.xml[/COLOR]

copy paste semc.xml for kikat 4.4 from above

save and exit then


Code:
[COLOR="black"]repo sync[/COLOR]

after everything syncs

Code:
[COLOR="black"]gedit vendor/aokp/vendorsetup.sh[/COLOR]

and add this to the bottom:

Code:
[COLOR="black"]add_lunch_combo aokp_c1905 -userdebug[/COLOR]

save and exit.. then


Code:
[COLOR="black"]. build/envsetup.sh[/COLOR]

Code:
[COLOR="black"]brunch c1905 [/COLOR]




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

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


Unofficial

XzinYIT.png




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:
[COLOR="black"]mkdir -p ~/carbon[/COLOR]

Install the Repository

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

Code:
[COLOR="black"]cd ~/carbon[/COLOR]

Repositories:

Before you continue --> run this in the terminal

Code:
[COLOR="black"]repo init -u https://github.com/CarbonDev/android.git -b kk[/COLOR]

after it does its thing

Code:
[COLOR="black"]mkdir .repo/local_manifests
touch .repo/local_manifests/sony.xml
gedit .repo/local_manifests/sony.xml[/COLOR]

copy paste sony.xml for kikat 4.4 from above

save and exit then


Code:
[COLOR="black"]repo sync[/COLOR]

after everything syncs

Code:
[COLOR="black"]gedit vendor/carbon/vendorsetup.sh[/COLOR]

and add this to the bottom:

Code:
[COLOR="black"]add_lunch_combo carbon_c1905 -userdebug[/COLOR]

save and exit.. then


Code:
[COLOR="black"]. build/envsetup.sh[/COLOR]

Code:
[COLOR="black"]brunch c1905 [/COLOR]




txri.png


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:
[COLOR="black"]repo init -u git://github.com/AORP/android.git -b kk[/COLOR]

Then to sync up:

Code:
[COLOR="black"]repo sync[/COLOR]

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:
[COLOR="black"]gedit .repo/local_manifests/semc.xml[/COLOR]

Add this to the semc.xml:

For KitKat 4.4.x

copy paste sony.xml for kikat 4.4 from above

then
Code:
[COLOR="Black"]repo sync[/COLOR]

Code:
[COLOR="black"]. build/envsetup.sh (notice the period and space)
vendor/cm/get-prebuilts
[/COLOR]

then

Code:
brunch c1905





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:
[COLOR="Black"]prebuilts/gcc/linux-x86/arm/[/COLOR]

Run:

Code:
[COLOR="black"]wget http://releases.linaro.org/13.06/components/toolchain/gcc-linaro/4.8/gcc-linaro-4.8-2013.06.tar.bz2[/COLOR]

Run:

Code:
[COLOR="black"]bunzip2 *.tar.bz2[/COLOR]

Run:

Code:
[COLOR="black"]tar -xvf *.tar[/COLOR]

Using your file manager, navigate to the root folder of your source tree again.

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

Run:

Code:
[COLOR="black"]gksudo gedit envsetup.sh[/COLOR]

change the line in bold, to look exactly like this one:

Code:
[COLOR="black"]case $ARCH in
        x86) toolchaindir=x86/i686-linux-android-4.6/bin
            ;;
        [B]arm) toolchaindir=arm/gcc-linaro-4.8-2013.06[/B]  [COLOR="Red"]<--------[/COLOR]
            ;;
        mips) toolchaindir=mips/mipsel-linux-android-4.6/bin
            ;;
        *)
            echo "Can't find toolchain for unknown architecture: $ARCH"
            toolchaindir=xxxxxxxxx
            ;;
esac
[/COLOR]

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://xdaforums.com/showpost.php?p=42976693&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
PecanCM
BMP777
 
Last edited:
R

rebelos

Guest
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://xdaforums.com/showthread.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:
[COLOR="black"]mkdir android[/COLOR]

E. Type
Code:
[COLOR="black"]cd android[/COLOR]

G.Type
Code:
[COLOR="black"]mkdir kernel[/COLOR]


Step 2. Your Source

A. Open your Terminal Prompt

B. Type
Code:
[COLOR="black"]cd android/kernel[/COLOR]

C. Type
Code:
[COLOR="black"]git clone git://github.com/DooMLoRD/android_prebuilt_toolchains.git toolchains[/COLOR]

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:
[COLOR="black"]patch -p1 < ../kernelPatch[/COLOR]


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:
[COLOR="Black"]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.
[/COLOR]

Code:
[COLOR="Black"]config CPU_FREQ_GOV_SMARTASS
           tristate "'smartass' cpufreq governor"
           depends on CPU_FREQ
           help
             smartass' - a "smart" optimized governor!
             If in doubt, say N.[/COLOR]

C. Open "drivers/cpufreq/Makefile"

D. Add the following line in the appropriate spot.

Code:
[COLOR="Black"] obj-$(CONFIG_CPU_FREQ_GOV_SMARTASS)     += cpufreq_smartass.o[/COLOR]

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:
[COLOR="Black"]#elif defined(CONFIG_CPU_FREQ_DEFAULT_GOV_SMARTASS)
extern struct cpufreq_governor cpufreq_gov_smartass;
#define CPUFREQ_DEFAULT_GOVERNOR (&cpufreq_gov_smartass)[/COLOR]

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:
[COLOR="black"]adb pull /proc/config.gz[/COLOR]

E. Type
Code:
[COLOR="black"]gunzip config.gz[/COLOR]

F. Type
Code:
[COLOR="black"]mv config arch/arm/configs/<your_config_name>_defconfig[/COLOR]


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:
[COLOR="black"]export ARCH=arm[/COLOR]

C. Type
Code:
[COLOR="black"]export CROSS_COMPILE=~/android/kernel/toolchains/arm-eabi-linaro-4.6.2/bin/arm-eabi-[/COLOR]

Part B. The First Build

A. Type
Code:
[COLOR="black"]make <your_config_name>_defconfig[/COLOR]

B. Type
Code:
[COLOR="black"]make menuconfig[/COLOR]
and make the required changes to use any modules you added or similar changes.

C. Type
Code:
[COLOR="black"]make -j<maximum number of jobs>[/COLOR]

Part C. Re-Builds

A. Type
Code:
[COLOR="black"]make clean[/COLOR]

B. Type
Code:
[COLOR="black"]make oldconfig[/COLOR]

C. Type
Code:
[COLOR="black"]make -j<maximum number of jobs>[/COLOR]

Part D. Building Modules

You have two options:

A. Type
Code:
[COLOR="black"]make modules[/COLOR]

B. Type
Code:
[COLOR="black"]make path/to/your/module.ko[/COLOR]

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:
[COLOR="black"]mkdir ../<your_kernel>_output[/COLOR]

D. Type
Code:
[COLOR="black"]cp arch/arm/boot/zImage ../<your_kernel>_output/zImage[/COLOR]

E. Type
Code:
[COLOR="black"]find . -name "*.ko" -exec cp {} ../<your_kernel>_output \;[/COLOR]

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:
[COLOR="Black"]building android kernel image
xda build kernel image
xda unpack boot.img[/COLOR]

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:
[COLOR="black"]cp .config ../backupConfig[/COLOR]

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:
[COLOR="Black"]sudo apt-get install ccache[/COLOR]

Set environment vars for Android use:
(I put these exports in my .bashrc)

Code:
[COLOR="Black"]export USE_CCACHE=1
export NDK_CCACHE=ccache[/COLOR]

Set a cache size of 10G for optimal results:

Code:
[COLOR="black"]ccache -M 10G[/COLOR]

Check the status of your cache with the command:

Code:
[COLOR="black"]ccache -s [/COLOR]

Returns:

Code:
[COLOR="black"]
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[/COLOR]
 
Last edited:
R

rebelos

Guest
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://xdaforums.com/showthread.php?t=1272270 (courtesy of isidromxz)

[Tutorial] Compile JB on Ubuntu - http://xdaforums.com/showthread.php?t=1762641 (courtesy of dastin1015)

[CM10] [PPA] Cyanogenmod Compiler v0.6 - http://xdaforums.com/showthread.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/Howto:_Connect_to_Device_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-a-command-line-ninja-with-these-time+saving-shortcuts

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

PecanCM git : - https://github.com/RonGokhale

Original Beanstalk thread : - http://xdaforums.com/showthread.php?t=2091900

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

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

ansebovi

Senior Member
Necessary Files for Xperia M :

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/qcom-common" name="CyanogenMod/android_device_sony_qcom-common" remote="github" revision="cm-11.0" />
<project path="device/sony/common" name="CyanogenMod/android_device_sony_common" remote="github" revision="cm-11.0" />
<project path="device/sony/c1905" name="RonGokhale/android_device_sony_c1905" remote="github" revision="cm-11.0" />
<project path="vendor/sony" name="RonGokhale/proprietary_vendor_sony" remote="github" revision="cm-11.0" />
<project path="kernel/sony/nicki" name="RonGokhale/android_Kernel_sony_nicki" remote="github" revision="cm-11.0" />
<project path="hardware/sony/DASH" name="CyanogenMod/android_hardware_sony_DASH" remote="github" revision="cm-11.0" />

</manifest>

bro small mistake
use this <project path="vendor/sony/c1905" name="RonGokhale/android_vendor_sony_c1905" remote="github" revision="cm-11.0" />
not <project path="vendor/sony" name="RonGokhale/proprietary_vendor_sony" remote="github" revision="cm-11.0" />
and i think u should add this
<project path="vendor/sony" name="TheMuppets/proprietary_vendor_sony" remote="github" revision="cm-11.0" />

am i ri8 or wrong?
bcoz there is no RonGokhale/proprietary_vendor_sony

and frameworks/av patch to fix camera hal loading : https://gist.github.com/RonGokhale/8129635
how to add this patch...
 
Last edited:
R

rebelos

Guest
bro small mistake
use this <project path="vendor/sony/c1905" name="RonGokhale/android_vendor_sony_c1905" remote="github" revision="cm-11.0" />
not <project path="vendor/sony" name="RonGokhale/proprietary_vendor_sony" remote="github" revision="cm-11.0" />
and i think u should add this
<project path="vendor/sony" name="TheMuppets/proprietary_vendor_sony" remote="github" revision="cm-11.0" />

am i ri8 or wrong?
bcoz there is no RonGokhale/proprietary_vendor_sony

and frameworks/av patch to fix camera hal loading : https://gist.github.com/RonGokhale/8129635
how to add this patch...

fixed it thanks using ron's version jus forgot a derp

to use diff patch u need to download patch file and
patch -p1 < name.diff
 

Minions_Army

Senior Member
Nov 7, 2012
767
290
【Gru Laboratories】
nive tutorial...
i have xm dual... can u make guide to port rom like aokp cm etc to duall sim?

n spec pc to build rom
like 64bit/32bit
ram 4gb up
Internet connection
and how many bandwith needed?


:)
many thanks
 
R

rebelos

Guest
nive tutorial...
i have xm dual... can u make guide to port rom like aokp cm etc to duall sim?

n spec pc to build rom
like 64bit/32bit
ram 4gb up
Internet connection
and how many bandwith needed?


:)
many thanks

dunno but cm 10 with dual sim support can be ported easily "u must know what u are doing first "
and

64 bit
4 gb (atleast)
trust me u donot want to do it on a 512 kbps connection
 

icoolguy1995

Senior Member
Jun 22, 2012
2,188
1,502
HARDA
I am facing some weird errors while building carbon.
first of all it says carbon.mk not found but when i rename cm.mk to carbon.mk its says videopackage2.mk not found any help here?
 
R

rebelos

Guest
I am facing some weird errors while building carbon.
first of all it says carbon.mk not found but when i rename cm.mk to carbon.mk its says videopackage2.mk not found any help here?

yes.. u need to properly edit device specific sources see
these commits here

https://github.com/CarbonDev/androi...mmit/61f7484bf7067262b3432a0a5bc585d8c5cc16dd
https://github.com/CarbonDev/androi...mmit/18ee3c6389088ed87a8febb328cb15f185fd0f4e

it will give u idea.. regarding building carbon


Edit:- Btw can u test slimroms for me i have a slimkat weekly 3.6 build available for XM if it boots i will add XM to Slim Official weeklies
 
Last edited:

cybojenix

Retired Forum Mod / Retired Recognized Developer
Apr 7, 2012
801
1,864
yes.. u need to properly edit device specific sources see
these commits here

https://github.com/CarbonDev/androi...mmit/61f7484bf7067262b3432a0a5bc585d8c5cc16dd
https://github.com/CarbonDev/androi...mmit/18ee3c6389088ed87a8febb328cb15f185fd0f4e

it will give u idea.. regarding building carbon


Edit:- Btw can u test slimroms for me i have a slimkat weekly 3.6 build available for XM if it boots i will add XM to Slim Official weeklies

If you don't personally have the device, then it isn't getting official Slim