[myTouch 4G General] matada:
Next step: REPO​

Repo is the script provided by Google that makes it easier to deal with Android source via Git (at least what I gather from it).

The following is the code to get it setup.

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

doing cd ~/ is an easy way to bring you back to your home folder (IE /home/matada/)

mkdir creates a folder named bin in which we store the repo script.

Export PATH allows us to easily call repo by itself instead of having to use /home/matada/bin/repo

finally, chmod +a gives us everyone access to the repo file, while +x makes it executable (like a .exe or .msi file on windows). Congrats, Two things down!

Setting up the Android SDK​

As of this writing you can go one of two ways. Either manually download the SDK and select Linux(i386), extract it then move it to your home folder (/home/username/) and rename it androidsdk. Or you can just copy and paste the following (this works as of the current release of the SDK, I will try and remember to keep this updated, but I can't promise much)

cd ~/Downloads
wget http://dl.google.com/android/android-sdk_r21-linux.tgz
tar -xvzf android-sdk_r21-linux.tgz
mv android-sdk-linux ~/androidsdk

That's the SDK downloaded, now to install the packages we need in it.

~/androidsdk/tools/android

Select under tools:

Android SDK Tools (should be installed by default)

Android SDK Platform-Tools

(I'm not sure if the following is required or not, I did it to be on the safe side). Scroll down to Android 2.3.3 (API 10) and select

SDK Platform

Samples for SDK

and Google APIs

Hit install 4 packages, accept the terms and let it download and install (might take a little while based on your network speed) Once that is complete exit out.

The last step for the SDK is to add the following to your .bashrc (add the three lines to the top of the text)

gedit .bashrc
Then add:
#AndroidDev PATH
export PATH=${PATH}:~/androidsdk/tools
export PATH=${PATH}:~/androidsdk/platform-tools

Restart your system (the VM or your full linux install)

Congrats! Now ADB should be setup correctly, now for a quick test. Plug your phone into your PC. If you're using the VirtualBox way, go up to devices → USB devices and select T-Mobile MyTouch 4g.

Reopen your terminal and type in lsusb and you should see the following pop up:

Next enter

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

and paste in the following:

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"

Then Save and exit

Now is as good of a time as any to keep a backup of your /system/ partition (and a good way to see if your androidSDK is setup correctly)

First enable development on your phone. For gingerbread it’s under the applications -> development -> then press Android Development.

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

When it's complete:

Congrats, if that worked correctly the system setup is done! Time to download the source code!

Downloading the Source

​

the Cyanogenmod source is pretty large (my VM was using 15gb by the time it was finished, with another 1gb for the kernel source), so don’t use this if you tether your internet or you’ll be dead before you even start.

Here we go! (At this point you can build for Jellybean or ICS (just replace gingerbread with either jellybean or ICS (or ICS-Release)

cd ~/
mkdir -p android/source
cd ~/android/source
repo init -u git://github.com/CyanogenMod/android.git -b gingerbread

It’s going to ask for your name and e-mail (you can just hit enter twice to skip it), and then hit Y, enter and then Y and then enter again at the color selection. Your folder is now setup.

You MAY have to (out of the four times I’ve done this part I’ve had it happen once) manually specify your e-mail and name. If so:

git config --global user.email “you@your-email.com”
git config --global user.name “your name”

(it will error out saying “unable to auto-detect e-mail address" if this is the case)

Repo is the file we downloaded from Google earlier, it now sets up the source folder to clone the CyanogenMod repository, which we’re about to do now.

repo sync -j2

This starts the download from the CyanogenMod repository. This totally depends on your internet, and may take from 30-minutes to 12 hours. It’s around 5gb to download. At this point go get something to eat / drink, browse XDA Developers or Reddit and we’ll be back when it’s finished. (I happened to watch tonight’s episode of Walking Dead as a nice break :D )