What's new
DroidForums.net | Android Forum & News

This is a sample guest message. Register a free account today to become a member! Once signed in, you'll be able to participate on this site by adding your own topics and posts, as well as connect with other members through your own private inbox!

[How to] Build your own Custom ROM!

droseum20

Member
Before we start, just thought I would mention that "$" symbolizes a new line of code. Most of this information can be found on Building the System | Android Open Source

1) Make sure you have Ubuntu 10.04 installed on your computer.

2) Download the newest Android SDK for Linux here: http://developer.android.com/sdk/index.html

3) Extract the insides into /<username>/android/sdk/ (create these directories)

4) Open up a Terminal. Type:
Code:
  $ cd android/sdk/tools 

  $ ./android

5) The Android SDK Manager will now pop up, make sure you have platform-tools and Android 4.0.3 checked. Then click Install '#' packages. Make sure to Accept All then select "Install". After a few minutes, it will finish and you can close the window.

6) Go back into Terminal. Type:
Code:
 $ cd

 $ sudo gedit .bashrc (make sure to give it your password)

7) A new window will pop-up with words you will not understand. Just make sure to scroll all the way to the bottom on a blank line and enter this: export PATH=${PATH}:~/android/sdk/platform-tools | Save and close the file.

8) Now, time to install the Java 6 JDK. Open Terminal and type everything as follows:
Code:
 $ sudo add-apt-repository "deb [U]http://archive.canonical.com[/U][URL="http://archive.canonical.com/"]/[/URL] lucid partner"

 $ sudo apt-get update

 $ sudo apt-get install sun-java6-jdk

9) This next code will install a lot of stuff that is critical to building Android. In Terminal copy and paste all of this and then simply hit enter:
Code:
 $ sudo apt-get install git-core gnupg flex bison gperf build-essential \
zip curl zlib1g-dev libc6-dev lib32ncurses5-dev ia32-libs \
x11proto-core-dev libx11-dev lib32readline5-dev lib32z-dev \
libgl1-mesa-dev g++-multilib mingw32 tofrodos python-markdown \
libxml2-utils xsltproc

10) For this next part, we will be configuring USB Access for your Android device. Open Terminal and type:
Code:
 $ gksu nautilus (enter your password if asked)

11) This will open up File Browser with root abilities. Find the directory /etc/udev/rules.d/ | Create a new file called 51-android.rules and open it. It will be blank so copy and paste this:

# adb protocol on passion (Nexus One)
SUBSYSTEM=="usb", ATTR{idVendor}=="18d1", ATTR{idProduct}=="4e12", MODE="0600", OWNER="<username>"
# fastboot protocol on passion (Nexus One)
SUBSYSTEM=="usb", ATTR{idVendor}=="0bb4", ATTR{idProduct}=="0fff", MODE="0600", OWNER="<username>"
# adb protocol on crespo/crespo4g (Nexus S)
SUBSYSTEM=="usb", ATTR{idVendor}=="18d1", ATTR{idProduct}=="4e22", MODE="0600", OWNER="<username>"
# fastboot protocol on crespo/crespo4g (Nexus S)
SUBSYSTEM=="usb", ATTR{idVendor}=="18d1", ATTR{idProduct}=="4e20", MODE="0600", OWNER="<username>"
# adb protocol on stingray/wingray (Xoom)
SUBSYSTEM=="usb", ATTR{idVendor}=="22b8", ATTR{idProduct}=="70a9", MODE="0600", OWNER="<username>"
# fastboot protocol on stingray/wingray (Xoom)
SUBSYSTEM=="usb", ATTR{idVendor}=="18d1", ATTR{idProduct}=="708c", MODE="0600", OWNER="<username>"
# adb protocol on maguro/toro (Galaxy Nexus)
SUBSYSTEM=="usb", ATTR{idVendor}=="04e8", ATTR{idProduct}=="6860", MODE="0600", OWNER="<username>"
# fastboot protocol on maguro/toro (Galaxy Nexus)
SUBSYSTEM=="usb", ATTR{idVendor}=="18d1", ATTR{idProduct}=="4e30", MODE="0600", OWNER="<username>"
# adb protocol on panda (PandaBoard)
SUBSYSTEM=="usb", ATTR{idVendor}=="0451", ATTR{idProduct}=="d101", MODE="0600", OWNER="<username>"
# fastboot protocol on panda (PandaBoard)
SUBSYSTEM=="usb", ATTR{idVendor}=="0451", ATTR{idProduct}=="d022", MODE="0600", OWNER="<username>"
12) Still in the file, go to Search --> Replace. In "Search for" enter <username> (yes, include the <>). For "Replace with" enter your computer's username (the one you set up Ubuntu with). Click "Replace All" then save and exit the file.

13) Open Terminal once again and type:
Code:
 $ cd

 $ mkdir bin

 $ sudo gedit .bashrc

14) In the file that pops up, scroll to the bottom and enter the following on a blank line: export PATH=${PATH}:~/bin | Save and exit the file.

15) Back in the Terminal window, type:
Code:
 $ cd bin

 $ curl [URL]https://dl-ssl.google.com/dl/googlesource/git-repo/repo[/URL] > ~/bin/repo

 $ chmod a+x ~/bin/repo

16) You just installed the repo command into the bin folder we created recently. Now we need to use that command to access the android source code. Back in the same Terminal window, type:
Code:
 $ cd ~/android

 $ mkdir source

 $ cd source

 $ repo init -u [URL]https://android.googlesource.com/platform/manifest[/URL] -b android-4.0.3_r1
17) After running the last command, it should prompt you to type in your name and e-mail address. Please enter in your REAL Gmail's name and e-mail address.

18) This next step will take possibly anywhere from 1-4 hours depending on your computer. In your Terminal window, type:
Code:
 $ cd

 $ cd android/source

 $ repo sync

19) After the "repo sync" finishes, in the same Terminal window, you will want to verify the Git Tags by typing:
Code:
 $ gpg --import (nothing will happen, that's okay)
20) Copy and paste this into Terminal then click CTRL+D to enter:
-----BEGIN PGP PUBLIC KEY BLOCK-----
Version: GnuPG v1.4.2.2 (GNU/Linux)

mQGiBEnnWD4RBACt9/h4v9xnnGDou13y3dvOx6/t43LPPIxeJ8eX9WB+8LLuROSV
lFhpHawsVAcFlmi7f7jdSRF+OvtZL9ShPKdLfwBJMNkU66/TZmPewS4m782ndtw7
8tR1cXb197Ob8kOfQB3A9yk2XZ4ei4ZC3i6wVdqHLRxABdncwu5hOF9KXwCgkxMD
u4PVgChaAJzTYJ1EG+UYBIUEAJmfearb0qRAN7dEoff0FeXsEaUA6U90sEoVks0Z
wNj96SA8BL+a1OoEUUfpMhiHyLuQSftxisJxTh+2QclzDviDyaTrkANjdYY7p2cq
/HMdOY7LJlHaqtXmZxXjjtw5Uc2QG8UY8aziU3IE9nTjSwCXeJnuyvoizl9/I1S5
jU5SA/9WwIps4SC84ielIXiGWEqq6i6/sk4I9q1YemZF2XVVKnmI1F4iCMtNKsR4
MGSa1gA8s4iQbsKNWPgp7M3a51JCVCu6l/8zTpA+uUGapw4tWCp4o0dpIvDPBEa9
b/aF/ygcR8mh5hgUfpF9IpXdknOsbKCvM9lSSfRciETykZc4wrRCVGhlIEFuZHJv
aWQgT3BlbiBTb3VyY2UgUHJvamVjdCA8aW5pdGlhbC1jb250cmlidXRpb25AYW5k
cm9pZC5jb20+iGAEExECACAFAknnWD4CGwMGCwkIBwMCBBUCCAMEFgIDAQIeAQIX
gAAKCRDorT+BmrEOeNr+AJ42Xy6tEW7r3KzrJxnRX8mij9z8tgCdFfQYiHpYngkI
2t09Ed+9Bm4gmEO5Ag0ESedYRBAIAKVW1JcMBWvV/0Bo9WiByJ9WJ5swMN36/vAl
QN4mWRhfzDOk/Rosdb0csAO/l8Kz0gKQPOfObtyYjvI8JMC3rmi+LIvSUT9806Up
hisyEmmHv6U8gUb/xHLIanXGxwhYzjgeuAXVCsv+EvoPIHbY4L/KvP5x+oCJIDbk
C2b1TvVk9PryzmE4BPIQL/NtgR1oLWm/uWR9zRUFtBnE411aMAN3qnAHBBMZzKMX
LWBGWE0znfRrnczI5p49i2YZJAjyX1P2WzmScK49CV82dzLo71MnrF6fj+Udtb5+
OgTg7Cow+8PRaTkJEW5Y2JIZpnRUq0CYxAmHYX79EMKHDSThf/8AAwUIAJPWsB/M
pK+KMs/s3r6nJrnYLTfdZhtmQXimpoDMJg1zxmL8UfNUKiQZ6esoAWtDgpqt7Y7s
KZ8laHRARonte394hidZzM5nb6hQvpPjt2OlPRsyqVxw4c/KsjADtAuKW9/d8phb
N8bTyOJo856qg4oOEzKG9eeF7oaZTYBy33BTL0408sEBxiMior6b8LrZrAhkqDjA
vUXRwm/fFKgpsOysxC6xi553CxBUCH2omNV6Ka1LNMwzSp9ILz8jEGqmUtkBszwo
G1S8fXgE0Lq3cdDM/GJ4QXP/p6LiwNF99faDMTV3+2SAOGvytOX6KjKVzKOSsfJQ
hN0DlsIw8hqJc0WISQQYEQIACQUCSedYRAIbDAAKCRDorT+BmrEOeCUOAJ9qmR0l
EXzeoxcdoafxqf6gZlJZlACgkWF7wi2YLW3Oa+jv2QSTlrx4KLM=
=Wi5D
-----END PGP PUBLIC KEY BLOCK-----

21) Go to Binaries for Nexus Phones and Flagship Devices - Google Support for Nexus Phones and Flagship Devices - Google Code and download the proper Nexus binaries, for Verizon you want to locate "Galaxy Nexus (CDMA/LTE)" and download the Graphics Component. After it finishes, open the imgtech-toro-iml74k.tgz and you will see a .sh file. Copy it and paste it into /android/source/. Do not put it in any other folders.

22) Locate "extract-imgtec-toro.sh" in the directory just listed and double click it. Select "Run in Terminal". Keep clicking enter until you get to the end of the License. Then type I ACCEPT and enter. You just created a new folder inside of the Android source called "vendor".

23) In your File Browser window, locate /android/source/device/samsung/toro. In "toro", you should see a file called extract-files.sh. Open this file with gedit. When it opens up, go to Search --> Replace. In "Search for" enter adb pull | In "Replace with" enter ./adb pull | Select "Replace All" then save and exit the file.

24) Back in the File Browser, locate /android/sdk/platform-tools. You should see a file called "adb". Right click it, select copy, then back into /android/source/device/samsung/toro right click and paste "adb". At this point, you will want to plug in your device and make sure USB Debugging is enabled.

25) Open a Terminal window and type:
Code:
$ cd ~/android/source/device/samsung/toro

$ ./adb devices (it should now show your device is attached)

$ ./extract-files.sh
26) The last command we just entered extracted files such as CDMA/LTE radios from your phone and stuck them into the source. YOU CAN NOT BE ON A CUSTOM ROM OR THIS WILL NOT WORK. PLEASE BE ON ANDROID 4.0.2 OTA ROOTED (if you are on a custom ROM and don't feel like reverting to stock... please read the second post in this thread explaining a different way to do it)! We are now at the point where we can compile the final product.

27) In Terminal, type:
Code:
 $ cd ~/android/source

 $ lunch (it will now give you options, find "full_toro-userdebug" and type the number next to it and hit enter)

 $ make -j4 otapackage

28) The last command we just ran can take up to 5 hours, depending on the speed of your computer. If you have a quad-core, I recommend running make -j8 otapackage. It will take less time. After it completes, we will give it root access, and disable the automatic flashing back to stock recovery.

29) Congratulations! You just compiled your first ROM. Now we must make last minute edits to ensure success. To see your final product, locate /android/source/out/target/product/toro. There should be one .zip file in the directory. Copy and paste it to your Desktop.

30) We will now add root access. To do so, first go here to download Superuser.apk and the su binary I put together in a zip file: Galaxy Nexus Root by droseum20.zip | After downloading, open up the .zip until you see two folders, app and bin. Open "app" and you will see "Superuser.apk". Then, open your compiled ROM from your desktop. Go to System --> app. copy and paste Superuser.apk from one .zip to the other. Now go to System --> bin in both .zips. Take "su" and drag and drop it into the "bin" folder in your compiled ROM. Now it should have full root access.

31) When compiling a ROM, it will automatically stick the stock recovery in there and we want to keep ClockworkMod, so we will do as follows. First. you will want to delete the recovery folder that is in your ROM. Next, from your ROM go to /META-INF/com/google/android/ and open updater-script. From here, not only we will delete flashing the OG recovery, we will also add some next text when any users flash our ROM.

32) Now that you have the updater-script opened, Go to Search --> Search. Type in search for recovery. It will bring you to a line that says, "package_extract_dir("recovery", "/system")". Completely delete this line. If you want to give the users who flash your ROM some nice text while it is in the boring process of flashing, keep reading to 33. If you don't care and just want to finish this long process, skip to 34 (I advise reading 33 though).

33) Still in the updater-script file, scroll all the way to the top. Make a new, blank, top line. Type ui_print("and then whatever you want. At the end of each line, you must include"); If you are confused, here is an example: ui_print("This is an example"); Now, if you want to make almost a design by using multiple lines, you can do that as well.

34) After you save and exit the updater-script file, you may move on to this. Here I will show you how to either have Google Apps built into your ROM, or have Google Apps and your ROM flash separately. For this section, I give full credit to @Kejar31, the creator of GummyNex. Download his Google Apps from this ROM thread over at RootzWiki: [ROM][AOSP][4.0.3][CDMA] GummyNex 0.5.0 - 01/10/12 - RootzWiki After downloading, it will come out in a .zip package. Simply drag and drop it to your desktop.

35) Now, you have Google Apps downloaded, but not baked inside of your ROM. To do this, we will open the GAPPS.zip file. Simply drag and drop the data folder from his GAPPS package into your ROM (not in any folder). Now, drag and drop the signed folder from one to the other. In the GAPPS pacakge, go to System, then app. Copy and paste all of them into the /System/app/ folder in your ROM. Then open the System --> etc from GAPPS and your /System/etc/. Open permissions on both, then copy and paste all the permissions from GAPPS into your ROM. Now copy and paste all the contents from /systesm/framework/ to your ROM. Open, /System/lib/ on both and once again copy and paste the contents from GAPPS into your ROM. Lastly, go to /System/Vendor/ and copy and paste the folder inside vendor (called pitpatt) into /System/vendor/ in your ROM.

36) Okay, now you are ready to flash the ROM onto your phone to make sure all goes well. Simply transfer the full_toro-ota-eng.<username>.zip onto your phone however you usuaully would. Flash clockworkmod recovery if you already have not, wipe data/factory reset, wipe cache, then dalvik cache, install from zip on sd card, find the ROM and click "Yes" to install. Reboot your phone and make sure everything worked as expected! Run into a problem? Just read the second post or contact me via Google Talk ([email protected]).
 
THE HELP POST!

Having trouble with Google Apps? Maybe having duplicates of Gallery, Calender, or something else? Read #1. Superuser permissions not working? Read #2. What's up with the bootanimation? I miss the IceCreamSandwich one! Well, just read #3. On a custom ROM and don't want to revert back to stock? Easy, just read #4!

#1: So this is rather simple. First, we will open the ROM and delete any multiples. Go to /System/App/ and delete CalendarGoogle.apk and GalleryGoogle.apk. No idea why they are doubled, but it happened to me too. Also, delete Tag.apk and just keep TagGoogle.apk. It is as easy at that.

#2: Well, my su binary wouldn't work when installing the ROM, what do I do!? Well just download su.zip from here: http://download.clockworkmod.com/test/su.zip and flash it in ClockWorkMod Recovery. That's it.

#3: If you REALLY REALLY REALLY hate the completely stock Android bootanimation, and want your original Galaxy Nexus animation back, you can do this. Simply take the bootanimation.zip from a ROM with the bootanimation you like and put it in /system/media. That is also where you find the ROM's bootanimation you want to take. Stick it in there and you are done.

#4: Okay, since this one will be rather long compared to others, it will be formatted different in steps using abc...
a) So your on step 25, and you don't want to go back to stock. Thanks to @koush, we can fix this.
b) Open File Browser
c) Find /android/source/vendor/samsung
d) Open Terminal and cd to the location listed above
e) Run "git clone https://github.com/koush/proprietary_vendor_samsung/tree/ics/toro.git toro"
f) Now, move onto step 26. You are done.

I will add more help as people get them. For now, these are the only fixes I think you will need.
 
Need some help on root. I'd already compiled from source. No root. Ive tried to flash the su.zip which does flash su and superuser but I still get permission denied. I'm on an insecured boot.img as well... any ideas?

Oh btw I did compile full toro user debug

Sent from my Galaxy Nexus using Tapatalk
 
Need some help on root. I'd already compiled from source. No root. Ive tried to flash the su.zip which does flash su and superuser but I still get permission denied. I'm on an insecured boot.img as well... any ideas?

Oh btw I did compile full toro user debug

Sent from my Galaxy Nexus using Tapatalk

Delete Superuser.apk and su from bin. After that, check xbin to see if su is floating around in there. if so, delete it too. Then boot clockworkmod recovery and flash this: Superuser-3.0.7-efgh-signed.zip
 
Failed to flash... error 0 . I'll take another wack at it when I've got my computer with me. I feel like im missing something in my source which is causing the issue... did you have to modify any of the source to gain root? Or just build and drop su and superuser in place?

Sent from my Galaxy Nexus using Tapatalk
 
Failed to flash... error 0 . I'll take another wack at it when I've got my computer with me. I feel like im missing something in my source which is causing the issue... did you have to modify any of the source to gain root? Or just build and drop su and superuser in place?

Sent from my Galaxy Nexus using Tapatalk

I did not modify source, but that may be a good idea. I have a ton of methods I can help you with. Can you contact me on GTalk?
 
Just found this, after being nearly done downloading the source. Perfect timing. Thanks a ton for the thread, going to let the downloads finish and work on this tomorrow!
 

#4: Okay, since this one will be rather long compared to others, it will be formatted different in steps using abc...
a) So your on step 25, and you don't want to go back to stock. Thanks to @koush, we can fix this.
b) Open File Browser
c) Find /android/source/vendor/samsung
d) Open Terminal and cd to the location listed above
e) Run "git clone https://github.com/koush/proprietary_vendor_samsung/tree/ics/toro.git toro"
f) Now, move onto step 26. You are done.

I am working on this step here as my device is already rooted and ROMd and would prefer not to have to go back to stock.

I am on step E running git clone https://github.com/koush/proprietary_vendor_samsung/tree/ics/toro.git toro and I am receiving the following error:
Initialized empty Git repository in /home/benkramer/android/vendor/samsung/toro/.git/
fatal: https://github.com/koush/proprietary_vendor_samsung/tree/ics/toro.git/info/refs not found: did you run git update-server-info on the server?

I assume this is an easy fix of cloning a different link, but I am not sure exactly how to find this link. I notice if I follow that link in a browser I see there is a directory named "toro" so I tried https://github.com/koush/proprietary_vendor_samsung/tree/toro/toro.git however that did not work either so I think perhaps the directories may have changed?

Any help would be appreciated, as I do not have much experience using git and am not sure!

UPDATE 1: Ok, so I ended up noticing at the top of the page when taking that link in a web browser it had the link "https://github.com/koush/proprietary_vendor_samsung.git" so I tried a git clone on that link in a separate folder to test it out. I believe I received within all of that, the toro folder I need. So, I am going to try continuin just copying and pasting that folder to the vendor/samsung where I believe it should be.

UPDATE 2: That seemed to work just fine doing it the way I did, however, it would probably have been easier to get JUST the toro rather than his entire ICS tree (or whatever it is exactly that I got). Either way, compiled (only took about 1.5hrs on my machine!) and followed the last few steps with SU and GApps and am about to install it on my phone to test. SO EXCITED!
 
Last edited:
I am working on this step here as my device is already rooted and ROMd and would prefer not to have to go back to stock.

I am on step E running git clone https://github.com/koush/proprietary_vendor_samsung/tree/ics/toro.git toro and I am receiving the following error:
Initialized empty Git repository in /home/benkramer/android/vendor/samsung/toro/.git/
fatal: https://github.com/koush/proprietary_vendor_samsung/tree/ics/toro.git/info/refs not found: did you run git update-server-info on the server?

I assume this is an easy fix of cloning a different link, but I am not sure exactly how to find this link. I notice if I follow that link in a browser I see there is a directory named "toro" so I tried https://github.com/koush/proprietary_vendor_samsung/tree/toro/toro.git however that did not work either so I think perhaps the directories may have changed?

Any help would be appreciated, as I do not have much experience using git and am not sure!

UPDATE 1: Ok, so I ended up noticing at the top of the page when taking that link in a web browser it had the link "https://github.com/koush/proprietary_vendor_samsung.git" so I tried a git clone on that link in a separate folder to test it out. I believe I received within all of that, the toro folder I need. So, I am going to try continuin just copying and pasting that folder to the vendor/samsung where I believe it should be.

UPDATE 2: That seemed to work just fine doing it the way I did, however, it would probably have been easier to get JUST the toro rather than his entire ICS tree (or whatever it is exactly that I got). Either way, compiled (only took about 1.5hrs on my machine!) and followed the last few steps with SU and GApps and am about to install it on my phone to test. SO EXCITED!




Hey BMKDROID,

Did this work out for you? I am getting the same error. Im curious if just grabbing the whole tree and moving the toro folder over to vendor/samsung worked fine. Let me know.
 
kinda hoping someone still pays attenion to this i screwed up doing this part $ cd

$ sudo gedit .bashrc (make sure to give it your password) i scrolled all the way down and i put that path in the wrong place and now i cant find it to correct it pls help im a noob at this

Edit: figured it out but now I'm having issues with creating a folder for android/sdk

Edit: figured it all out
 
Last edited:
Back
Top