Build CM7 from source | Developer's area
Getting the source and building it is actually fairly straight-forward. For this guide, I'm going to assume that you're using Ubuntu 10.10 or higher. I'm using 11.10, but I'm pretty sure most of this is still applicable to Maverick (10.10). Also, the steps following getting the build-deps on Ubuntu should be usable in any other Linux distro (Fedora, openSUSE, etc.). You'll just have to find the proper way to getting the environment set-up on that distro.
I've adapted this guide from the Cyanogen wiki to fit specifically for the Motorola Triumph. Essentially, I've modified their repo manifest to add my Triumph repo as well. By using these instructions, you have the same thing that I've been working on in my Github: https://github.com/ikarosdev
NOTE: I'd like this thread to stay on track. Remember, this is a guide about building Android. I'm assuming you know your way around Linux distributions. However, I do encourage any help on getting things working with CM7.
Part I - Prepare your Build Environment
Let's go ahead and prepare our comps for building.
Go ahead and open up your terminal. You'll need to add a partner repository from Maverick in order to get sun-java6. I don't think openjdk is compatible.
We've enabled the repo, but we need to update our package lists.
Now, we'll need to install our build dependencies. There are build-deps only applicable to the 64-bit (x86_64) systems. However, both 32-bit and 64-bit share common build-deps.
For 32-bit & 64-bit:
64-bit only:
NOTE: According to the original guide gcc and g++ multilib is not necessary. However, I always install them anyways.
Now, we can create directories for the build:
Now, we need to download the program "repo" and make it executable:
Make it executable:
NOTE: You'll need to logout for this to take effect.
Now, we initialize the repository and grab the source:
NOTE: Due to the large size, this make take several hours depending on your connection.
Go ahead and open up your terminal. You'll need to add a partner repository from Maverick in order to get sun-java6. I don't think openjdk is compatible.
Code:
sudo add-apt-repository "deb http://archive.canonical.com/ maverick partner"
We've enabled the repo, but we need to update our package lists.
Code:
sudo apt-get update
Now, we'll need to install our build dependencies. There are build-deps only applicable to the 64-bit (x86_64) systems. However, both 32-bit and 64-bit share common build-deps.
For 32-bit & 64-bit:
Code:
sudo apt-get install git-core gnupg flex bison gperf libsdl1.2-dev libesd0-dev libwxgtk2.6-dev squashfs-tools build-essential zip curl libncurses5-dev zlib1g-dev sun-java6-jdk pngcrush schedtool
Code:
sudo apt-get install g++-multilib lib32z1-dev lib32ncurses5-dev lib32readline5-dev gcc-4.4-multilib g++-4.4-multilib
Now, we can create directories for the build:
Code:
mkdir -p ~/android/system && mkdir -p ~/bin
Code:
curl https://dl-ssl.google.com/dl/googlesource/git-repo/repo > ~/bin/repo
Code:
chmod a+x ~/bin/repo
Now, we initialize the repository and grab the source:
Code:
cd ~/android/system
Code:
repo init -u [URL="git://github.com/CyanogenMod/android.git"]git://github.com/ikarosdev/android.git[/URL] -b gingerbread
Code:
repo sync -j16
Part II - Pull proprietary files from device
Still with me? Alright, after staring at repo pulling all those files, guess what? You get to pull more files! However, this part only takes a few seconds.
First, you'll need to get ADB set-up. Thankfully, the CM-wiki has a nice how-to on doing so. Follow these instructions and then come back: Howto: Install the Android SDK - CyanogenMod Wiki
NOTE: You'll need to enable USB Debugging on the Triumph. You can achieve this by going to Settings --> Applications --> Development and lastly, enable "USB Debugging."
Okay, let's navigate to our device directory and pull the files. Make sure the device is plugged into the comp.
NOTE: This is a work in progress. There are some files that still need to be pulled. However, at the moment, CM7 will still build "correctly" regardless.
First, you'll need to get ADB set-up. Thankfully, the CM-wiki has a nice how-to on doing so. Follow these instructions and then come back: Howto: Install the Android SDK - CyanogenMod Wiki
NOTE: You'll need to enable USB Debugging on the Triumph. You can achieve this by going to Settings --> Applications --> Development and lastly, enable "USB Debugging."
Okay, let's navigate to our device directory and pull the files. Make sure the device is plugged into the comp.
Code:
cd ~/android/system/device/motorola/triumph
Code:
sh ./extract-files.sh
Part III - Configure and Build
Build ClockworkMod Recovery
Now, we're getting to the fun part. First, we need to get ROM-Manager. CM7 will fail to build without it.
Get back to the home folder:
Now, run this:
Once that finishes, we can finally build CM7:
NOTE: This makes sure that everything is up-to-date. While this is recommended, it is not required. However, sometimes there are changes to the source that will be missed if you do not do this.
This will take some time. Depending on how fast your comp is, this could take several hours. For me, on a dual-core system, it takes about an hour. After it is done, you'll find a zip generated in:
And that's all there is to it.
Get back to the home folder:
Code:
cd
Code:
~/android/system/vendor/cyanogen/get-rommanager
Code:
cd ~/android/system
Code:
repo sync -j16
Code:
. build/envsetup.sh && brunch triumph
Code:
~/android/system/out/target/product/triumph/update.cm-XXXXX-signed.zip
Build ClockworkMod Recovery
Now, that I've fixed my CWM port specifically for the Triumph, I'll show you guys how to build that as well.
Make sure the build directory is clean:
NOTE: make clean isn't technically necessary
Now, we'll get the build prepped for building a recovery:
And lastly, we'll build a recovery image:
That's it! You'll find a generated recovery.img file in:
Follow the usual steps to get CWM on our phones.
Make sure the build directory is clean:
Code:
make clean && make clobber
Now, we'll get the build prepped for building a recovery:
Code:
. build/envsetup.sh && lunch cyanogen_triumph-eng
Code:
make -j4 recoveryimage
Code:
~/android/system/out/target/product/triumph/recovery.img