This is a guide I will be writing to help those interested in building their own ROMs from CyanogenMod source. This tutorial will assume that the default build will be with Gingerbread. Commands are similar for Froyo, for those that still wish to build on that platform. I will try to be as detailed as possible, without confusing those that are new to the source-building side of things. This will be updated as I get more info from other devs, or as I come across tweaks and other things that many of you might find helpful.
This is being adapted from SnkBitten's guide. I will be changing it quite a bit, but just so everyone is aware, this is the guide I used to get started, and it was the best guide ever. Im just updating the commands, and filenames to whats current, so as to keep everyone from getting a headache!
Installing Linux Mint 12
I had been using Ubuntu 10.10 for the longest time, and when I was recommended to Linux Mint 12 by another user, I installed it out of curiousity, and was very pleased with the new layout, look, and options. I would suggest that you install this version. You will be more than satisfied with it. I will be using Mint 12 as my chief OS when building, and will be referenced in my examples.
You can obtain Linux Mint 12 here:
Linux Mint 12 (Lisa)
Be sure to download the appropriate 32 or 64 bit version, depending on your computers capabilities. Make sure you download the full featured standard version, as it will contain just about everything you need after the initial install.
RECOMMENDED
I would suggest that you do NOT install "inside" Windows. Create a new partition to install Linux into (seperate from Windows). This will speed up file access a bit, and keep the two systems from messing with each other. When installed this way, you will be using the Linux GRUB bootloader to choose between Windows and Linux on startup. If you setup this way, if one system goes down, the other is still bootable with a small bootloader change, so it could save your butt!
Also, I have allotted 210GB to my Linux system partition. I'm starting to fill that up pretty quick, but I would make sure that your system partition size for Linux is no less than 150GB, just to be on the safe side. Source takes up quite a bit, and you might want to make backup copies of your source folders, so you dont butch your work, and lose EVERYTHING!
Installing the Android SDK
Start by download the latest SDK for Linux from here:
Android SDK | Android Developers
and just save it to the default "Downloads" directory
Current version: r16
Once it's downloaded, open a new terminal and type:
Next we need to include ~/android/sdk/tools and a couple other paths in our system path, so from the terminal type:Code:cd ~ mkdir android tar -zxvf ~/Downloads/android-sdk_r16-linux.tgz mv android-sdk-linux ~/android/sdk
and add the following to the bottom of the document that opens:Code:sudo gedit .bashrc
and save and exit.export PATH=${PATH}:~/android/sdk/platform-tools
export PATH=${PATH}:~/android/sdk/tools
export PATH=${PATH}:~/android/bin
export PATH=${PATH}:~/bin
We need to add a device rule to allow our computer and ADB to communicate with our phone.
In the terminal type:
and then copy the following in to the file, save and exit.Code:sudo gedit /etc/udev/rules.d/51-android.rules
Next we need to add Java 6.SUBSYSTEM=="usb", SYSFS{idVendor}=="0502", MODE="0666"
SUBSYSTEM=="usb", SYSFS{idVendor}=="413c", MODE="0666"
SUBSYSTEM=="usb", SYSFS{idVendor}=="0489", MODE="0666"
SUBSYSTEM=="usb", SYSFS{idVendor}=="091E", MODE="0666"
SUBSYSTEM=="usb", SYSFS{idVendor}=="0bb4", MODE="0666"
SUBSYSTEM=="usb", SYSFS{idVendor}=="12d1", MODE="0666"
SUBSYSTEM=="usb", SYSFS{idVendor}=="0482", MODE="0666"
SUBSYSTEM=="usb", SYSFS{idVendor}=="1004", MODE="0666"
SUBSYSTEM=="usb", SYSFS{idVendor}=="22b8", MODE="0666"
SUBSYSTEM=="usb", SYSFS{idVendor}=="0955", MODE="0666"
SUBSYSTEM=="usb", SYSFS{idVendor}=="10A9", MODE="0666"
SUBSYSTEM=="usb", SYSFS{idVendor}=="04e8", MODE="0666"
SUBSYSTEM=="usb", SYSFS{idVendor}=="04dd", MODE="0666"
SUBSYSTEM=="usb", SYSFS{idVendor}=="0fce", MODE="0666"
SUBSYSTEM=="usb", SYSFS{idVendor}=="19D2", MODE="0666"
In the terminal type:
and add the following two lines at the bottom of the opened file, save and exit.Code:sudo gedit /etc/apt/sources.list
Once back in terminal, type:
When the java install screen pops up, follow the prompts to install it.Code:sudo apt-get update sudo apt-get install sun-java6-jdk
When it's finished, continue by typing the following in terminal:
(if it returns "nothing to configure" that's fine)Code:sudo update-alternatives --config java
When that is done, we want to remove the lines we added to the sources.list file earlier.
In the terminal:
and delete the bottom two lines you added:Code:sudo gedit /etc/apt/sources.list
Save and exit.
Now we need to install all the dependencies needed to do the builds.
I added in PNGCrush and SchedTool as the CM build environment needs them.
Depending on which OS you have installed, chooose 32 or 64 bit.
in the terminal:
(for 32 bit)
(for 64 bit)Code:sudo apt-get install git-core gnupg flex bison gperf libsdl-dev libesd0-dev libwxgtk2.6-dev build-essential zip curl libncurses5-dev zlib1g-dev pngcrush schedtool
Code:sudo apt-get install git-core gnupg flex bison gperf libsdl-dev libesd0-dev libwxgtk2.6-dev build-essential zip curl libncurses5-dev zlib1g-dev valgrind lib32readline-gplv2-dev gcc-multilib g++-multilib libc6-dev-i386 lib32ncurses5-dev ia32-libs x11proto-core-dev libx11-dev lib32z-dev pngcrush schedtool
Getting the source
Next up REPO (and GIT) is installed.
in terminal...
Close all existing Terminal windows and open up a new one.Code:cd ~ mkdir bin
In the new terminal:
Next we will initialize an empty folder with a specific branch that you want to build for.Code:curl https://dl-ssl.google.com/dl/googlesource/git-repo/repo > ~/bin/repo chmod a+x ~/bin/repo
In this case, we are using a folder called /system/. I personally have several different
folders, gingerbread, themed, and ics.
The /android/ folder is where all your source will be, divided into different folders if you wish.
Here is what my layout looks like, so you get an idea (yeah, I have some custom icons):
Obvsiously, if you want to build for Froyo just put "froyo" at the end instead. "gingerbread" for gingerbread, and "ics" for Ice Cream Sandwhich.Code:cd ~ cd android mkdir system cd ~/android/system repo init -u git://github.com/CyanogenMod/android.git -b gingerbread
You will get asked to enter your Name and Email Address. Answer yes or no and eventually
you will get repo initialized... if you were successful. Now you are going to pull the actual source.
In the same terminal window (should be at "~/android/system/" if your following this guide), type:
This will take quite a while, depending on your connection. To give you an idea, this is how muchCode:repo sync
space my stock gingerbread branch takes up:
This is just the hidden repo folder where all the data is pulled to first. A copy of that data is then
put visibly into your /system/ directory where you will actually do your work. DONT do anything to
the hidden repo folder!
4.5GB of that data will be copied into your /system/ directory, which you will modify and build with.
So, after the sync, and the right files are copied over to your main directory, you will end up with a
total of just over 16.1GB.
Next we will need to verify the GIT tags..
In terminal, type:
Nothing will appear to be happening, thats ok. Paste the following into the terminal window and then pressCode:gpg --import
CTRL+D to save. This will return you back to the terminal command prompt.
Now you have to get a "device setup" for each phone you want to build for. In this example, I will use sholes (the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UFtBnE411aMAN3qnAHBBMZzKMX
LWBGWE0znfRrnczI5p49i2YZJAjyX1P2WzmScK49CV82dzLo71 MnrF6fj+Udtb5+
OgTg7Cow+8PRaTkJEW5Y2JIZpnRUq0CYxAmHYX79EMKHDSThf/8AAwUIAJPWsB/M
pK+KMs/s3r6nJrnYLTfdZhtmQXimpoDMJg1zxmL8UfNUKiQZ6esoAWtDg pqt7Y7s
KZ8laHRARonte394hidZzM5nb6hQvpPjt2OlPRsyqVxw4c/KsjADtAuKW9/d8phb
N8bTyOJo856qg4oOEzKG9eeF7oaZTYBy33BTL0408sEBxiMior 6b8LrZrAhkqDjA
vUXRwm/fFKgpsOysxC6xi553CxBUCH2omNV6Ka1LNMwzSp9ILz8jEGqmU tkBszwo
G1S8fXgE0Lq3cdDM/GJ4QXP/p6LiwNF99faDMTV3+2SAOGvytOX6KjKVzKOSsfJQ
hN0DlsIw8hqJc0WISQQYEQIACQUCSedYRAIbDAAKCRDorT+Bmr EOeCUOAJ9qmR0l
EXzeoxcdoafxqf6gZlJZlACgkWF7wi2YLW3Oa+jv2QSTlrx4KL M=
=Wi5D
-----END PGP PUBLIC KEY BLOCK-----
The device setup for most phones is already included in the CyanogenMod source that you spend all that time downloading. However, since support for the Droid 1 was dropped by CyanogenMod a while back, I will give you a link to a standard device setup for it. This is actually a copy of my device setup in my source that I actively build with. I will also give you a link to the vendor setup folder I have, in case you have issues getting the proprietary files yourself.
Normally, in order to get the files needed for your vendor setup, you will have to execute some files in the device folder, which will create a new folder in "vendor" with the appropriate phone name, and will contain your proprietary files, which will be extracted. Thats next.
Sholes device setup:
DOWNLOAD HERE
Sholes vendor setup:
DOWNLOAD HERE
If your going to pull your own proprietary files from a phone you have in your hand, you first, have to enable ADB. Generally that option is under Settings - Applications - Development
Check USB Debugging
Plug in your phone to your computer with the USB cable, and in terminal, type:
If everything is working, you should see something similar to this:Code:adb devices
If your device can NOT be detected, then you will see this:$ adb devices
List of devices attached
04038F0C02015011 device
$
If you dont see your device listed, make sure you followed the step a bit above this where you had to add lines to 51-android.rules.$ adb devices
List of devices attached
$
To pull the proprietary files, you will need to execute setup-makefiles.sh in your device setup folder. To do that, go into your device setup folder, right click in an open area in the folder, and click "Open in Terminal". Now type:
There is a space between the period and the word "setup", in case some of you get confused.Code:. setup-makefiles.sh
Once that is done, stay in the same terminal, and type:
Now here, you may get a couple errors about some files not being found. Thats ok, its not perfect. Just write down which files it told you it couldn't find, if any, and manually extract them from a stock ROM (FRG83G preferred for sholes), and put the files in /vendor/motorola/sholes/proprietary/Code:. extract-files.sh
Thats it for the device setup!
If you decided to download the zips I provided earlier, here is what you do with them.
The sholes-device-setup.zip contents should be extracted to device/motorola/
The sholes-vendor-setup.zip contents should be extracted to vendor/motorola/
Downloading SDK Components
Ok, this part is REQUIRED to build. Im going to recommend that you download all the components for all API levels, just to save yourself some headache if you decide you want to build for something higher later on. To do this, go to:
/home/noah/android/sdk/tools/
and double-click on "android", and select "Run in Terminal"
What opens up will be the Android SDK Manager, pictured below. The screenshot shows your what components you will want to download. I only gave the API 15 level open, so you know which components in each API level you need to download at the minimum. Under Tools you will of course need Android SDK Platform-tools, and for each API level, you will want the SDK Platform and Google API's. There is an Extras section not pictured, at the bottom of the list. It contains the Google USB Drivers. For Linux, you dont need them, as it will say not compatible anyway.
Allow everything to download and install, and your done with that part. You can exit the SDK Manager.
OK, now that the hard part is out of the way, we can make a test build! Lets get right to it!
Building Source
OK, assuming you dont have a terminal window open yet, navigate to your system director for your source, which would be something like "~/android/system/", and right-click and select "Open in Terminal". Then you can proceed to type in the following (build command for sholes (Droid 1)) to start the build process!
When the build is finished, if successful, you will see something similar to:Code:. build/envsetup.sh && brunch sholes
![]()


LinkBack URL
About LinkBacks





Reply With Quote

