• After 15+ years, we've made a big change: Android Forums is now Early Bird Club. Learn more here.

Root Yet another "How-to" build, MTDEV style

dsmryder

Android Expert
May 28, 2011
2,418
502
NE Florida
As I sence a resergance in the desire to build ROMs from source, I decided to remake the HOW-TO. This is taken from the MTDEV website set up by g60madman. (Thanx Bra)

Developing can be adicting! It can also give you bags under your eyes, put an arch in your back, and give you carple tunnle syndrom. You have been warned!

Everything I put, in this post, into code boxes can be coppied and pasted. If I put it in a "notepad box" I am being more general and you will need to read what I am trying to get across. I can explain on later posts.
Some things to understand, if I use a dollar sign ($) it is run from the terminal as a normal user. If I use a pound sign (#) it is run from the root account.

First of all, all of my work is done on Ubuntu 10.04 64-bit desktop edition with a multi core and processor workstation with 8GB of RAM. It can be done on other versions of Linux, but I don't do it and will have trouble with helping you. I hope I don't need to help anybody setting the OS side of things.

After you set up the OS, you will need to prepare the system. Go to System->Administration->Software Sources. On the “Other Software” tab, check the box next to http://archive.canonical.com/ ubuntu lucid partner and close.

Now we can install the software to build and compile and whatnot.
Open a terminal. (ctrl + alt + t) and you will get a propt($).

We'll start with git. Git is a system for managing source codes that can work well in a bunch of way... anyway, we'll get to that.

Code:
sudo add-apt-repository ppa:git-core/ppa
This adds the repository so you can install it
Code:
sudo apt-get update
You will need to enter your passwod from time to time.
Now that your repositories have been updated, you can proceed with installing the required packages.
Code:
sudo apt-get install git gnupg flex bison gperf build-essential
sudo apt-get install curl zlib1g-dev libc6-dev lib32ncurses5-dev ia32-libs
sudo apt-get install pax11proto-core-dev libx11-dev lib32z-dev
sudo apt-get install libgl1-mesa-dev g++-multilib mingw32 tofrodos 
sudo apt-get install python-markdown libxml2-utils xsltproc
sudo apt-get install zip lib32readline5-dev
Then you will need to install Java 6 JDK
Code:
sudo apt-get install python-software-properties
sudo add-apt-repository ppa:ferramroberto/java
sudo apt-get update
sudo apt-get install sun-java6-jdk sun-java6-plugin
sudo apt-get install schedtool
Now you need to download the source for what you want to build.
First you will need to install "repo". It's a script that does a ton of work for you.
For that you need to make a directory for it under your account. I would highly recommend not working out of your ROOT account. It's very bad practice. Your propt should still be something like this[HIGH]user@computername~(current path)$[/HIGH]
the tilda (~) represents your home directory. Basicly /home/(user).
So make the directory
Code:
mkdir ~/bin
Then add the path to your variables
Code:
PATH=~/bin:$PATH
Sometimes this won't stick and you will need to modify your bash (the terminal you are working under) initiator script, .bashrc (the period os sopposed to be there). It's hidden from the gnome visability so if you are looking for it you will need to unhide it with (crtl + h). So at the bottom add [HIGH]export PATH=$PATH:/home/(user)/bin[/HIGH]
After setting that up
Code:
curl [URL="https://dl-ssl.google.com/dl/googlesource/git-repo/repo"][COLOR=#0066cc]https://dl-ssl.google.com/dl/googlesource/git-repo/repo[/COLOR][/URL] > ~/bin/repo
chmod a+x ~/bin/repo
Now you have all of the tools. The next part depends on what you want to work with. I'll use CM7 as an example. Make a "working directory" and change to it
Code:
mkdir cm7
cd cm7
Initialize the directory
Code:
repo init -u [URL="https://github.com/MTDEV-CM7/cm7.git"][COLOR=#0066cc]https://github.com/MTDEV-CM7/cm7.git[/COLOR][/URL] -b cm7
For CM7
Code:
repo init -u git://github.com/MTCM9/android.git -b ics
For CM9
And then download all that source code
Code:
repo sync
That part will take quite a while. I recommend doing it and going to bed.
When you wake up in the morning you should have no errors and will be able to build right away.
Code:
. build/envsetup.sh && brunch triumph -j'grep 'processor' /proc/cpuinfo | wc -l'
This sets up the enviroment and gets it running.
The "-j" part splits up the build into jobs for the system to run semi-simultaneously. The rest of that looks to see how many logicle processors you have and thus how many jobs the computer can run.

So there you have it. That should get things going. I hope people will ask lots of questions and we can hopefully move things along in 2013.

I don't know about you guys, but I like the monitor on my main rig, so I use Teamviewer to connect either with one of my computers or on my phone (Deving at work, WHAT!)

Enjoy!
 
dsmryder,

You may want to check out my updated environment setup, it has some extra stuff which allows the build to be optimized, and also a new version of git. So you will want to delete your bin folder in your home directory after updating it.

EnvironmentSetup - htc-evov4g - Setting up your Ubuntu 10.04 environment - Virgin Mobile HTC Evo V 4G Devlopment - Google Project Hosting

You also should be able to log into the MTDEV Wiki as I added you and the rest of Team MTDEV to update it. That includes you MikeRL
 
  • Like
Reactions: dsmryder
Upvote 0
That's weird, I don't type anythin else other than "y". I leave it as a lower case and everything. In fact I just did it yesterday and it worked. Ken2Chill, are you using Ubuntu 10.04?

And I'm downloading the source now.

And I'm building it now
Yes... I'm dual booting it with windows 8. BTW my native Ethernet isn't working. Im tethering
 
Upvote 0
The native ethernet may have a driver that's not open source or too new. Have you ran a search on it? The relaibility of cell data connections will almost ensure you will have errors and major headachs.

I've read on "dd wrt" but it seems that Ubuntu isnt even reading the router. ( it "Seems" like it, im fairly new to Linux and I'm using "network tools" to check it.) and im not ready to brick my routor it seems pretty difficult. oh and if you would like to check out my set-up and possibly help me troubleshoot, we can set up some kind of remote view. I know that you don't have much time on your hands...
 
Upvote 0
Hey DSM I already have openJDK 7. Will this work for all Java compilation/running needs?

I don't think so. If you go to the developement website, they specify Java 1.6. If you are working with FroYo and earlier, 1.5. Also, they keep a revision of the old (1.5 and 1.6) in some repos and have you setup access to them.

I know b_random14 was trying to use openJDK, though what version I don't know. I know he had some trouble with it. Maybe if he passes by he can comment on it.
 
Upvote 0
I decided to just get another HDD from the magical basement of magic and loaded it up with 10.04. BTW dsm, your huge install command did not work right. It only installed the first three packages. I had to install them all individually, but it did work after that. Also, where are the CM9 and CM10 repos? When I searched on Github all I found was an MTDEV CM10 repo that 404'ed when I tried to add it and a TON of CM9 kernels from both MTDEV and Mantera.

EDIT: NVM on the CM10, I got that working. I still cannot find the cm9 repo though.
 
Upvote 0
I decided to just get another HDD from the magical basement of magic and loaded it up with 10.04. BTW dsm, your huge install command did not work right. It only installed the first three packages. I had to install them all individually, but it did work after that. Also, where are the CM9 and CM10 repos? When I searched on Github all I found was an MTDEV CM10 repo that 404'ed when I tried to add it and a TON of CM9 kernels from both MTDEV and Mantera.

EDIT: NVM on the CM10, I got that working. I still cannot find the cm9 repo though.

I'll have to dig up the CM9 repo link. I know g60 deleted the one I was a part of, but I can redo it if nessacery.
 
Upvote 0
I decided to just get another HDD from the magical basement of magic and loaded it up with 10.04. BTW dsm, your huge install command did not work right. It only installed the first three packages. I had to install them all individually, but it did work after that. Also, where are the CM9 and CM10 repos? When I searched on Github all I found was an MTDEV CM10 repo that 404'ed when I tried to add it and a TON of CM9 kernels from both MTDEV and Mantera.

EDIT: NVM on the CM10, I got that working. I still cannot find the cm9 repo though.
Here you go

repo init -u git://github.com/MTCM9/android.git -b ics
 
Upvote 0
Thank you! Sweet. What exactly should I do now that I have my repos synced? Where do I even start? So many folders lol.

The first thing I would do is just build a ROM with the code that's there. That way you know it works and have a base to start on. Also, do you know how to use git? If not look at my git and github questions thread.

Once you have an idea that you want to work with, just make a new branch and code away.
 
Upvote 0

BEST TECH IN 2023

We've been tracking upcoming products and ranking the best tech since 2007. Thanks for trusting our opinion: we get rewarded through affiliate links that earn us a commission and we invite you to learn more about us.

Smartphones