[Guide] In-Depth Compiling using Ubuntu 12.10

Search This thread

dragonstalker

Senior Member
Jan 1, 2008
1,914
1,303
Fort Myers, Fla
DISCLAIMER: I am in no way responsible for you breaking your phone or your computer. You the reader/user/dev/compiler understand that you enter into this agreement freely with no expectations that everything will work 100% of the time.

This is in no way a means of stealing people away from Shrikes guide. If you do not have ubuntu installed as a complete os/ or do not intend to maked modifications to system files etc. Then please use the guide for compiling roms using a virtual box here (CM9 The complete noobs guide to building CM9 in a virtual machine)

Still with me. COOL. So you now have either a dual boot or a fully thrashed Linux machine. I will be using my Vaio VPCF114 box with Ubuntu 12.10 to make this guide. This is also compatible with 12.04 if you have not yet upgraded. I am not sure if the same goes for Redhat/Fedora or Backtrack 5. My work here is a compilation of years of doing research and compiling my own roms.

This guide is to help people that have little knowledge of linux get a base idea of where to start to make their own roms and kernels. Part 1 will be building your box and compiling a rom. Part 2 will be how to make and grab your Kernel.

First lets get Dropbox from here DROPBOX This is good for backing up your libs and sharing files with other Devs.


What you need:
1) A Windows computer, preferably with a CPU that supports 64-bit. Your pc/laptop does no need to have 64-bit windows on it, your CPU just needs to support the hardware. I think at this day and age, almost all devs have a 64-bit box. You will need this so you can make a dual boot box.
2) Plenty of memory. I recommend at least 4GB on the host computer. You can make it work on less, but more is better.
3) At least 60GB of free hard drive space during the install, but i'm sure you already know that and have gigs upon gigs of free space. If you do not know how much space you have, go to settings>details and it will tell you. Note: The source download is approximately 8.5GB in size. You will need over 30GB free to complete a single build, and up to 100GB (or more) for a full set of builds.
4) Lastly a good book, tab, second pc, whatever because this is not a quick process. And compiling roms literally takes hours.
5) Most importantly UBUNTU 12.10. If on the off hand you do not have it, you can pick it up at Ubuntu Central


OK YOU READY. LET'S GET CRACKING. First you need to set up Java on your box. Then grab a couple of programs you will need for editing files Go to your UBUNTU SOFTWARE CENTER. In the search bar in the top right type in Java. We will be installing Java 6 Runtimes.

Screenshotfrom2012-11-17095118.png



The Sun JDK is no longer in Ubuntu's main package repository. In order to download it, go here JAVA
If the link does not work, you want accept the license agreement and download jdk-6u35-linux-x64.bin
Once it done:

chmod a+x ~/Downloads/jdk-6u35-linux-x64.bin
sudo mv ~/Downloads/jdk-6u35-linux-x64.bin /usr/lib
cd /usr/lib
sudo ./jdk-6u35-linux-x64.bin


Now lets finish the install and make it default: (Remember to enter in the lines one at a time)

sudo mv jdk1.6.0_35/ jvm/
sudo rm jdk-6u35-linux-x64.bin
sudo update-alternatives --install /usr/bin/java java /usr/lib/jvm/jdk1.6.0_35/jre/bin/java 1
sudo update-alternatives --install /usr/bin/javac javac /usr/lib/jvm/jdk1.6.0_35/bin/javac 1
sudo update-alternatives --install /usr/bin/jar jar /usr/lib/jvm/jdk1.6.0_35/bin/jar 1
sudo update-alternatives --install /usr/bin/javadoc javadoc /usr/lib/jvm/jdk1.6.0_35/bin/javadoc 1


IF YOU HAVE MULTIPLE JAVA JDK'S INSTALLED FOR OTHER PROJECTS YOU WILL WANT TO MAKE 1.6 THE DEFAULT.

On each command you will have to select the version of java you want to use. This command is helpful if you also do other coding.

sudo update-alternatives --config java
sudo update-alternatives --config javac
sudo update-alternatives --config jar
sudo update-alternatives --config javadoc


Screenshotfrom2012-11-18090630.png


Java 6: for Gingerbread and newer

Java 5: for Froyo and older


Note: The lunch command in the build step will ensure that the Sun JDK is used instead of any previously installed JDK.


Now what we need:

We need to open up a terminal window and download packages.
Remember you will need to input your password after each line.

sudo add-apt-repository ppa:git-core/ppa
and
sudo apt-get update


(this will download all of the Quantal updates for universe and multiverse.


Next we want to install some Libs and Binaries. (You can copy and paste this into your terminal)

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 schedtool gcc-multilib g++-multilib pngcrush

(don't worry. some of the libs my fail. This happens as google changes their sources)

Now we need to tell the computer how to "REPO", this is where you will tell it to handle the Andorid sources via the Git command.

cd ~
mkdir -p bin
export PATH=${PATH}:~/bin


Once done you can use "echo $PATH" to see all of your path directories.

sudo apt-get install curl
curl https://dl-ssl.google.com/dl/googlesource/git-repo/repo > ~/bin/repo

(this will get you the repo script)

Now lets give it executable permissions by using chmod

chmod a+x ~/bin/repo


Now that we can repo

Screenshotfrom2012-11-17124944.png


Lets setup the Android SDK. (Get a beer/coffee/soda, this will take a second)

Go to http://developer.android.com/sdk/index.html And install the ADT bundle for Linux.

Install the SDK and Eclipse IDE

Unpack the ZIP file (named adt-bundle-linux.zip) and save it to an appropriate location, such as a "Development" directory in your home directory.
Open the adt-bundle-linux/eclipse/ directory and launch eclipse.
That's it! The IDE is already loaded with the Android Developer Tools plugin and the SDK is ready to go. To start developing, read Building Your First App on the developer site.

Screenshotfrom2012-11-17130844.png


Caution: Do not move any of the files or directories from the adt-bundle-linux directory. If you move the eclipse or sdk directory, ADT will not be able to locate the SDK and you'll need to manually update the ADT preferences.

Now to just add the tools to our $Path.

gedit .bashrc
Scroll to very bottom, under last fi input
export PATH=${PATH}:~/adt-bundle-linux/sdk/tools
export PATH=${PATH}:~/adt-bundle-linux/sdk/platform-tools


That was pretty painless.

Now lets start some cool stuff.

TestSigning

Click on your desktop menu bar and go into your home folder. Press Ctrl and h together on your keyboard to show hidden folders. Anything marked with a . in front of it is hidden, we are looking for a folder name .gnome2, go into it and look for nautilus-scripts. Once inside this folder, right click on a empty space and select create document and then empty file and name it sign. Open up that empty document and copy and paste this script from dumbfaq on xda

Screenshotfrom2012-11-17133544.png


Code:
#!/bin/bash

# Update the Loc var to where YOU stored the testsign.jar file !



SUCCESS=

Loc=~/android/source/



for arg

do

TMP=$(ls $arg | sed 's/\(.*\)\..*/\1/')

EXT=${arg##*.}



java -classpath "$Loc"testsign.jar testsign "$arg" "$arg"-signed 2> /tmp/signTmp

SUCCESS=$?

if [ $SUCCESS -eq 1 ]

then

zenity --info --title "Sign APK" --text "signing FAILED! \n`cat /tmp/signTmp`"

exit 1

fi



mv $TMP.$EXT-signed $TMP-signed.$EXT

done



zenity --info --title "Sign APK" --text "signing completed!"

Save and exit out and right click on our new script and select properties. select the permissions tab and look for a check box that says allow executing as a program. click on it and now we have a pretty little script that we can just right click on a update.zip file and sign with our test keys for flashing. You will also need the testsign.jar from the bottom of this guide.

Screenshotfrom2012-11-17135718.png


Now lets do a couple things so that we can get our Phones Vendor ID.

Type in your terminal

lsusb

While your phone isconnected to see our vendor id and you will something like this. Note that for the Rezound our vendor id is

Bus 002 Device 003: ID 0bb4:0ccd HTC (High Tech Computer Corp.)
In this case the Vendor Id is “18d1″ and the Product ID is “4e12″. Please keep in mind that the Vendor ID for HTC changed from “0bb4″ to “18d1″. The older HTC phones like the G1 have a Vendor ID of “0bb4″.

Screenshotfrom2012-11-17142025.png


Now that we have that, we can make our rules for for connecting to adb

sudo gedit /etc/udev/rules.d/51-android.rules

Paste

SUBSYSTEM=="usb", ATTRS{idVendor}=="0bb4", MODE="0666"
SUBSYSTEM=="usb", ATTRS{idVendor}=="0502", MODE="0666"
SUBSYSTEM=="usb", ATTRS{idVendor}=="12d1", MODE="0666"
SUBSYSTEM=="usb", ATTRS{idVendor}=="1004", MODE="0666"
SUBSYSTEM=="usb", ATTRS{idVendor}=="22b8", MODE="0666"
SUBSYSTEM=="usb", ATTRS{idVendor}=="04e8", MODE="0666"
SUBSYSTEM=="usb", ATTRS{idVendor}=="0fce", MODE="0666"
SUBSYSTEM=="usb", ATTRS{idVendor}=="0489", MODE="0666"
SUBSYSTEM==”usb”, ATTRS{idVendor}==”18d1″, SYMLINK+=”android_adb”, MODE=”0666″
SUBSYSTEM=="usb", ATTRS{idVendor}=="04e8", MODE="0666", GROUP="plugdev"

Save and exit

Screenshotfrom2012-11-17143243.png


Reboot your computer so that all of the changes we have made can Take effect.



OK. All setup and ready to start making a Rom with your name on it.

IF you are already running AOSP on your phone, you can back up you system now Do this by:

cd ~/
mkdir stock
cd stock
adb pull /system/ ~/stock/


This will dump your entire system directory into the stock folder. This is good so you always have a working system. Now zip the folder and tuck it away for safe keeping.


Now the MEAT AND POTATOES. Grabbing the Source. "CYANOGENMOD"

cd ~/
mkdir -p android/source
touch ~/.netrc
cd ~/android/source
sudo apt-get install git
sudo sysctl -w net.ipv4.tcp_window_scaling=0 (remvoes the overstack flow problem that causes some repo jobs to hang)
repo init -u git://github.com/Chad0989/android.git -b ics

(Note: If you want to compile a jellybean rom, just replace the ics with jellybean!)

Once you do this, it's going to ask you for your email. This is how you will log back into the repo in the future. So answer the questions correctly.

Screenshotfrom2012-11-17164243.png


Now we will sync the Repo and set it to run.

repo sync -j4

-j# (# means twice the amount of cores in your computer) means jobs. I have an i7 processor and a pretty decent internet connection, so i'm running max jobs at once for faster sync) Be patient. It's still going to take a while to clone the directory.

Screenshotfrom2012-11-18073101.png

Once done with the Sync we want to setup our device.

This is where we get the pre-built part of our rom.

First we will
./vendor/cm/get-prebuilts

Probably all that will be left directly after the repo will be the Terminal service for android.

Now we are about ready to compile our Rom:

cd ~/android/source
repo sync (it should only take a moment this time)
. build/envsetup.sh
make clobber


Screenshotfrom2012-11-18090951.png



Now you can compile your rom using the brunch command (This will take about 1 to 1 1/2 hours depending on your box)

brunch vigor

Now you can go to the output box and pick up your freshly made Rom.
 

Attachments

  • testsign.jar
    12.7 KB · Views: 79
Last edited:

dragonstalker

Senior Member
Jan 1, 2008
1,914
1,303
Fort Myers, Fla
Changed Repo from CyanogenMod to Chad0989 for easier Vigor integration.
21NOV12: Change Repo from Chad0989 to Dragonstalker github.

Change Repo from DragonStalker to Chad0989 github

Modified Testsign script to reflect changed ADT Tools location.
 
Last edited:
  • Like
Reactions: iHateWebOS

jon7701

Senior Member
Aug 4, 2012
653
198
First, looks interesting i might look into this when i boot into Ubuntu next time. :p
 

vonhinkle

Senior Member
Vedor ID

Quick question. I notice that you mention that "in this case the Vedor ID is 18d1" but in your screenshot it say 0bb4. You have some clarification after that and I'm not sure I understand it 100%. My rezound show the 0bb4 for vedor ID as well. I guess what I'm asking is if you could clarify the statement about the Vendor ID? Thanks, sorry if this is a dumb question.
 

dragonstalker

Senior Member
Jan 1, 2008
1,914
1,303
Fort Myers, Fla
Quick question. I notice that you mention that "in this case the Vedor ID is 18d1" but in your screenshot it say 0bb4. You have some clarification after that and I'm not sure I understand it 100%. My rezound show the 0bb4 for vedor ID as well. I guess what I'm asking is if you could clarify the statement about the Vendor ID? Thanks, sorry if this is a dumb question.

It shows it as 0bb4. But as for the drivers Ubuntu uses. The Vendor id for High Tech Computers is 18d1. I was using a stock rom to pull the vendor Id from and for some reason, HTC has never changed it on there.
 

dragonstalker

Senior Member
Jan 1, 2008
1,914
1,303
Fort Myers, Fla
Very nice guide. Extremely thorough which makes a great tutorial.

I teach networking to and development to the Army. I took the same ideology into this guide. Not just tell you how to do it, but explain why it works. I will, as thing change try to keep this updated, and keep up with Shrike as he learns new things. Thank Shrike for making me realize that we didn't have a guide for people that do run Ubuntu, and need to know how to set up.
 

drkow19

Senior Member
Apr 16, 2009
458
92
White Lake, Michigan
I'm compiling right now. The guide was good, but there were some extra steps I had to take to get this far. My Rezound is old, so my android.rules file needed the 0bb4 id (I got rid of the ATTR{idproduct} part). Also adb wasn't connecting when using filename 51-android.rules, so I used 70-android.rules and mode 0666 instead of 0600, then adb connected. I think the 70 was the fix, but mode 0666 I found from other, older guides on setting up adb, I don't know what change that makes but it's probably unnecessary. Finally, on compile I was getting errors like bison missing and other missing also. That big line with all the installs must have not worked for all the programs, so I just installed the missing ones individually per error message. There may have been other issues that I am forgetting but nothing too hard to figure out, of course I have worked a tiny bit with Ubuntu over the past 5 years.

Still compiling, so it seems to be working. I used Chad0989's repo, and jellybean! Thanks for the guide, if I have any problems I shall post them.
 
  • Like
Reactions: dragonstalker

dragonstalker

Senior Member
Jan 1, 2008
1,914
1,303
Fort Myers, Fla
I'm compiling right now. The guide was good, but there were some extra steps I had to take to get this far. My Rezound is old, so my android.rules file needed the 0bb4 id (I got rid of the ATTR{idproduct} part). Also adb wasn't connecting when using filename 51-android.rules, so I used 70-android.rules and mode 0666 instead of 0600, then adb connected. I think the 70 was the fix, but mode 0666 I found from other, older guides on setting up adb, I don't know what change that makes but it's probably unnecessary. Finally, on compile I was getting errors like bison missing and other missing also. That big line with all the installs must have not worked for all the programs, so I just installed the missing ones individually per error message. There may have been other issues that I am forgetting but nothing too hard to figure out, of course I have worked a tiny bit with Ubuntu over the past 5 years.

Still compiling, so it seems to be working. I used Chad0989's repo, and jellybean! Thanks for the guide, if I have any problems I shall post them.

Thanks for the headsup. Android.source.com said to change it to that. SO I will change it back.

As for the progs that did not install. Android Source pulls progs, i've just been to lazy to go over the tag and remove the ones that have been obsoleted. I will take care of that this weekend.
 
Last edited:

drkow19

Senior Member
Apr 16, 2009
458
92
White Lake, Michigan
Schweet! I compiled my own rom! Syncing took about 30 mins, compiling also 30 mins. I have a 4.4 ghz oc'd Core i5 with 8 gig 1866 ram. Now I need to learn some simple things, like how to rename the rom package, edit the installation text, add some tweaks, etc.

What gapps do you use for CM10? I downloaded this one http://wiki.cyanogenmod.org/wiki/Latest_Version/Google_Apps for CM10, but it doesn't list xdpi, and it failed flashing. So I used this one instead http://xdaforums.com/showthread.php?t=1965290 and it worked.

edit: google search seems to force close with the gapps I used.
 
Last edited:
  • Like
Reactions: dragonstalker

dragonstalker

Senior Member
Jan 1, 2008
1,914
1,303
Fort Myers, Fla
Schweet! I compiled my own rom! Syncing took about 30 mins, compiling also 30 mins. I have a 4.4 ghz oc'd Core i5 with 8 gig 1866 ram. Now I need to learn some simple things, like how to rename the rom package, edit the installation text, add some tweaks, etc.

What gapps do you use for CM10? I downloaded this one http://wiki.cyanogenmod.org/wiki/Latest_Version/Google_Apps for CM10, but it doesn't list xdpi, and it failed flashing. So I used this one instead http://xdaforums.com/showthread.php?t=1965290 and it worked.

edit: google search seems to force close with the gapps I used.

Note: There is a reason that me and Chad have asked not to compile CM10 roms. The code is not complete yet.

If you found gapps that work, then that's a major. Post to the thread where you found it and that it works. To rename a rom package, you can just right click>rename and name it what you want it. To rename it so it shows up inside the rom on the phone for details is different.

I would not advise it if you don't know what you are doing, but you have to edit the build.prop. As for tweaks. Depends on what tweaks you want to change. Android Developer site is where i get all my tweaks, and i get some from other devs. Glad you are joining the community.

Happy building and thanks for the contribution.
 

ktempleton

Senior Member
Oct 3, 2012
4,531
5,941
Lebanon
issues

Note: There is a reason that me and Chad have asked not to compile CM10 roms. The code is not complete yet.

If you found gapps that work, then that's a major. Post to the thread where you found it and that it works. To rename a rom package, you can just right click>rename and name it what you want it. To rename it so it shows up inside the rom on the phone for details is different.

I would not advise it if you don't know what you are doing, but you have to edit the build.prop. As for tweaks. Depends on what tweaks you want to change. Android Developer site is where i get all my tweaks, and i get some from other devs. Glad you are joining the community.

Happy building and thanks for the contribution.

hey guys ive been compiling on 12.04 still new to this but ive set up a new enviorment useing this guide with 12.10 im getting this error though

Import includes file: /home/ken/CM10/out/target/product/i577/obj/SHARED_LIBRARIES/audio.primary.msm8660_intermediates/import_includes
make: *** No rule to make target `/home/ken/CM10/out/target/product/i577/obj/lib/libaudioalsa.so', needed by `/home/ken/CM10/out/target/product/i577/obj/SHARED_LIBRARIES/audio.primary.msm8660_intermediates/LINKED/audio.primary.msm8660.so'. Stop.
make: *** Waiting for unfinished jobs....
target StaticLib: libc_nomalloc (/home/ken/CM10/out/target/product/i577/obj/STATIC_LIBRARIES/libc_nomalloc_intermediates/libc_nomalloc.a)


any help would be appreatiated thanks
 

drkow19

Senior Member
Apr 16, 2009
458
92
White Lake, Michigan
Note: There is a reason that me and Chad have asked not to compile CM10 roms. The code is not complete yet.

If you found gapps that work, then that's a major. Post to the thread where you found it and that it works. To rename a rom package, you can just right click>rename and name it what you want it. To rename it so it shows up inside the rom on the phone for details is different.

I would not advise it if you don't know what you are doing, but you have to edit the build.prop. As for tweaks. Depends on what tweaks you want to change. Android Developer site is where i get all my tweaks, and i get some from other devs. Glad you are joining the community.

Happy building and thanks for the contribution.

Roger that. I will definitely try to do some build.prop tweaks, and then move on from there. Thanks again for the guide! Meanwhile I am emailing Ubuntu about their re-installer option to erase and reinstall Ubuntu, which wipes out all partitions, not just the current Ubuntu partition as I figured would happen. It wiped my main NTFS partition with all my stuff, without even a warning! Currently using Active Partition Recovery, but I fear since I compiled CM on that whole harddrive that most of the contents were probably overwritten. :crying:
 

dragonstalker

Senior Member
Jan 1, 2008
1,914
1,303
Fort Myers, Fla
Roger that. I will definitely try to do some build.prop tweaks, and then move on from there. Thanks again for the guide! Meanwhile I am emailing Ubuntu about their re-installer option to erase and reinstall Ubuntu, which wipes out all partitions, not just the current Ubuntu partition as I figured would happen. It wiped my main NTFS partition with all my stuff, without even a warning! Currently using Active Partition Recovery, but I fear since I compiled CM on that whole harddrive that most of the contents were probably overwritten. :crying:

Never heard of that happening before. Let me know what you find out.
 

Top Liked Posts

  • There are no posts matching your filters.
  • 12
    DISCLAIMER: I am in no way responsible for you breaking your phone or your computer. You the reader/user/dev/compiler understand that you enter into this agreement freely with no expectations that everything will work 100% of the time.

    This is in no way a means of stealing people away from Shrikes guide. If you do not have ubuntu installed as a complete os/ or do not intend to maked modifications to system files etc. Then please use the guide for compiling roms using a virtual box here (CM9 The complete noobs guide to building CM9 in a virtual machine)

    Still with me. COOL. So you now have either a dual boot or a fully thrashed Linux machine. I will be using my Vaio VPCF114 box with Ubuntu 12.10 to make this guide. This is also compatible with 12.04 if you have not yet upgraded. I am not sure if the same goes for Redhat/Fedora or Backtrack 5. My work here is a compilation of years of doing research and compiling my own roms.

    This guide is to help people that have little knowledge of linux get a base idea of where to start to make their own roms and kernels. Part 1 will be building your box and compiling a rom. Part 2 will be how to make and grab your Kernel.

    First lets get Dropbox from here DROPBOX This is good for backing up your libs and sharing files with other Devs.


    What you need:
    1) A Windows computer, preferably with a CPU that supports 64-bit. Your pc/laptop does no need to have 64-bit windows on it, your CPU just needs to support the hardware. I think at this day and age, almost all devs have a 64-bit box. You will need this so you can make a dual boot box.
    2) Plenty of memory. I recommend at least 4GB on the host computer. You can make it work on less, but more is better.
    3) At least 60GB of free hard drive space during the install, but i'm sure you already know that and have gigs upon gigs of free space. If you do not know how much space you have, go to settings>details and it will tell you. Note: The source download is approximately 8.5GB in size. You will need over 30GB free to complete a single build, and up to 100GB (or more) for a full set of builds.
    4) Lastly a good book, tab, second pc, whatever because this is not a quick process. And compiling roms literally takes hours.
    5) Most importantly UBUNTU 12.10. If on the off hand you do not have it, you can pick it up at Ubuntu Central


    OK YOU READY. LET'S GET CRACKING. First you need to set up Java on your box. Then grab a couple of programs you will need for editing files Go to your UBUNTU SOFTWARE CENTER. In the search bar in the top right type in Java. We will be installing Java 6 Runtimes.

    Screenshotfrom2012-11-17095118.png



    The Sun JDK is no longer in Ubuntu's main package repository. In order to download it, go here JAVA
    If the link does not work, you want accept the license agreement and download jdk-6u35-linux-x64.bin
    Once it done:

    chmod a+x ~/Downloads/jdk-6u35-linux-x64.bin
    sudo mv ~/Downloads/jdk-6u35-linux-x64.bin /usr/lib
    cd /usr/lib
    sudo ./jdk-6u35-linux-x64.bin


    Now lets finish the install and make it default: (Remember to enter in the lines one at a time)

    sudo mv jdk1.6.0_35/ jvm/
    sudo rm jdk-6u35-linux-x64.bin
    sudo update-alternatives --install /usr/bin/java java /usr/lib/jvm/jdk1.6.0_35/jre/bin/java 1
    sudo update-alternatives --install /usr/bin/javac javac /usr/lib/jvm/jdk1.6.0_35/bin/javac 1
    sudo update-alternatives --install /usr/bin/jar jar /usr/lib/jvm/jdk1.6.0_35/bin/jar 1
    sudo update-alternatives --install /usr/bin/javadoc javadoc /usr/lib/jvm/jdk1.6.0_35/bin/javadoc 1


    IF YOU HAVE MULTIPLE JAVA JDK'S INSTALLED FOR OTHER PROJECTS YOU WILL WANT TO MAKE 1.6 THE DEFAULT.

    On each command you will have to select the version of java you want to use. This command is helpful if you also do other coding.

    sudo update-alternatives --config java
    sudo update-alternatives --config javac
    sudo update-alternatives --config jar
    sudo update-alternatives --config javadoc


    Screenshotfrom2012-11-18090630.png


    Java 6: for Gingerbread and newer

    Java 5: for Froyo and older


    Note: The lunch command in the build step will ensure that the Sun JDK is used instead of any previously installed JDK.


    Now what we need:

    We need to open up a terminal window and download packages.
    Remember you will need to input your password after each line.

    sudo add-apt-repository ppa:git-core/ppa
    and
    sudo apt-get update


    (this will download all of the Quantal updates for universe and multiverse.


    Next we want to install some Libs and Binaries. (You can copy and paste this into your terminal)

    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 schedtool gcc-multilib g++-multilib pngcrush

    (don't worry. some of the libs my fail. This happens as google changes their sources)

    Now we need to tell the computer how to "REPO", this is where you will tell it to handle the Andorid sources via the Git command.

    cd ~
    mkdir -p bin
    export PATH=${PATH}:~/bin


    Once done you can use "echo $PATH" to see all of your path directories.

    sudo apt-get install curl
    curl https://dl-ssl.google.com/dl/googlesource/git-repo/repo > ~/bin/repo

    (this will get you the repo script)

    Now lets give it executable permissions by using chmod

    chmod a+x ~/bin/repo


    Now that we can repo

    Screenshotfrom2012-11-17124944.png


    Lets setup the Android SDK. (Get a beer/coffee/soda, this will take a second)

    Go to http://developer.android.com/sdk/index.html And install the ADT bundle for Linux.

    Install the SDK and Eclipse IDE

    Unpack the ZIP file (named adt-bundle-linux.zip) and save it to an appropriate location, such as a "Development" directory in your home directory.
    Open the adt-bundle-linux/eclipse/ directory and launch eclipse.
    That's it! The IDE is already loaded with the Android Developer Tools plugin and the SDK is ready to go. To start developing, read Building Your First App on the developer site.

    Screenshotfrom2012-11-17130844.png


    Caution: Do not move any of the files or directories from the adt-bundle-linux directory. If you move the eclipse or sdk directory, ADT will not be able to locate the SDK and you'll need to manually update the ADT preferences.

    Now to just add the tools to our $Path.

    gedit .bashrc
    Scroll to very bottom, under last fi input
    export PATH=${PATH}:~/adt-bundle-linux/sdk/tools
    export PATH=${PATH}:~/adt-bundle-linux/sdk/platform-tools


    That was pretty painless.

    Now lets start some cool stuff.

    TestSigning

    Click on your desktop menu bar and go into your home folder. Press Ctrl and h together on your keyboard to show hidden folders. Anything marked with a . in front of it is hidden, we are looking for a folder name .gnome2, go into it and look for nautilus-scripts. Once inside this folder, right click on a empty space and select create document and then empty file and name it sign. Open up that empty document and copy and paste this script from dumbfaq on xda

    Screenshotfrom2012-11-17133544.png


    Code:
    #!/bin/bash
    
    # Update the Loc var to where YOU stored the testsign.jar file !
    
    
    
    SUCCESS=
    
    Loc=~/android/source/
    
    
    
    for arg
    
    do
    
    TMP=$(ls $arg | sed 's/\(.*\)\..*/\1/')
    
    EXT=${arg##*.}
    
    
    
    java -classpath "$Loc"testsign.jar testsign "$arg" "$arg"-signed 2> /tmp/signTmp
    
    SUCCESS=$?
    
    if [ $SUCCESS -eq 1 ]
    
    then
    
    zenity --info --title "Sign APK" --text "signing FAILED! \n`cat /tmp/signTmp`"
    
    exit 1
    
    fi
    
    
    
    mv $TMP.$EXT-signed $TMP-signed.$EXT
    
    done
    
    
    
    zenity --info --title "Sign APK" --text "signing completed!"

    Save and exit out and right click on our new script and select properties. select the permissions tab and look for a check box that says allow executing as a program. click on it and now we have a pretty little script that we can just right click on a update.zip file and sign with our test keys for flashing. You will also need the testsign.jar from the bottom of this guide.

    Screenshotfrom2012-11-17135718.png


    Now lets do a couple things so that we can get our Phones Vendor ID.

    Type in your terminal

    lsusb

    While your phone isconnected to see our vendor id and you will something like this. Note that for the Rezound our vendor id is

    Bus 002 Device 003: ID 0bb4:0ccd HTC (High Tech Computer Corp.)
    In this case the Vendor Id is “18d1″ and the Product ID is “4e12″. Please keep in mind that the Vendor ID for HTC changed from “0bb4″ to “18d1″. The older HTC phones like the G1 have a Vendor ID of “0bb4″.

    Screenshotfrom2012-11-17142025.png


    Now that we have that, we can make our rules for for connecting to adb

    sudo gedit /etc/udev/rules.d/51-android.rules

    Paste

    SUBSYSTEM=="usb", ATTRS{idVendor}=="0bb4", MODE="0666"
    SUBSYSTEM=="usb", ATTRS{idVendor}=="0502", MODE="0666"
    SUBSYSTEM=="usb", ATTRS{idVendor}=="12d1", MODE="0666"
    SUBSYSTEM=="usb", ATTRS{idVendor}=="1004", MODE="0666"
    SUBSYSTEM=="usb", ATTRS{idVendor}=="22b8", MODE="0666"
    SUBSYSTEM=="usb", ATTRS{idVendor}=="04e8", MODE="0666"
    SUBSYSTEM=="usb", ATTRS{idVendor}=="0fce", MODE="0666"
    SUBSYSTEM=="usb", ATTRS{idVendor}=="0489", MODE="0666"
    SUBSYSTEM==”usb”, ATTRS{idVendor}==”18d1″, SYMLINK+=”android_adb”, MODE=”0666″
    SUBSYSTEM=="usb", ATTRS{idVendor}=="04e8", MODE="0666", GROUP="plugdev"

    Save and exit

    Screenshotfrom2012-11-17143243.png


    Reboot your computer so that all of the changes we have made can Take effect.



    OK. All setup and ready to start making a Rom with your name on it.

    IF you are already running AOSP on your phone, you can back up you system now Do this by:

    cd ~/
    mkdir stock
    cd stock
    adb pull /system/ ~/stock/


    This will dump your entire system directory into the stock folder. This is good so you always have a working system. Now zip the folder and tuck it away for safe keeping.


    Now the MEAT AND POTATOES. Grabbing the Source. "CYANOGENMOD"

    cd ~/
    mkdir -p android/source
    touch ~/.netrc
    cd ~/android/source
    sudo apt-get install git
    sudo sysctl -w net.ipv4.tcp_window_scaling=0 (remvoes the overstack flow problem that causes some repo jobs to hang)
    repo init -u git://github.com/Chad0989/android.git -b ics

    (Note: If you want to compile a jellybean rom, just replace the ics with jellybean!)

    Once you do this, it's going to ask you for your email. This is how you will log back into the repo in the future. So answer the questions correctly.

    Screenshotfrom2012-11-17164243.png


    Now we will sync the Repo and set it to run.

    repo sync -j4

    -j# (# means twice the amount of cores in your computer) means jobs. I have an i7 processor and a pretty decent internet connection, so i'm running max jobs at once for faster sync) Be patient. It's still going to take a while to clone the directory.

    Screenshotfrom2012-11-18073101.png

    Once done with the Sync we want to setup our device.

    This is where we get the pre-built part of our rom.

    First we will
    ./vendor/cm/get-prebuilts

    Probably all that will be left directly after the repo will be the Terminal service for android.

    Now we are about ready to compile our Rom:

    cd ~/android/source
    repo sync (it should only take a moment this time)
    . build/envsetup.sh
    make clobber


    Screenshotfrom2012-11-18090951.png



    Now you can compile your rom using the brunch command (This will take about 1 to 1 1/2 hours depending on your box)

    brunch vigor

    Now you can go to the output box and pick up your freshly made Rom.
    3
    Reserved for Kernel
    2
    Ok the updated Guide is online. Please tell me if anything is not correct. I'm only Human. Working with Snuzzo for and Updated Kernel Optimization section and hopefully Chad with the Repo..




    More to Follow .............................
    2
    First, looks interesting i might look into this when i boot into Ubuntu next time. :p

    i wanted to show people how i do my own personal roms and kernels. With this setup, you can make roms for multiple devices and also use Eclipse to make apps if thats your bag baby.
    2
    Very nice guide. Extremely thorough which makes a great tutorial.

    I teach networking to and development to the Army. I took the same ideology into this guide. Not just tell you how to do it, but explain why it works. I will, as thing change try to keep this updated, and keep up with Shrike as he learns new things. Thank Shrike for making me realize that we didn't have a guide for people that do run Ubuntu, and need to know how to set up.