[GUIDE][Ubuntu] Compiling Android from Source

mjs1015

Member
Apr 24, 2011
17
0
0
Visit site
Well, I did my build but the out folder had no 'zip'. I ended up with a few directories and a series of img files. Back to the drawing board...

What command did you enter in. It should be make -j"x" otapackage

Sent from my Galaxy Nexus using Android Central Forums
 
Last edited:

Nikodemus21

New member
Sep 25, 2011
1
0
0
Visit site
Before i begin to ask my question, awesome job man!!! anyway, I can't get the repo to go.

here's the code:

nick@DevDapp:~/NEXUS_DEV$ repo sync

... A new repo command ( 1.18) is available.
... You should upgrade soon:

cp /home/nick/NEXUS_DEV/.repo/repo/repo /home/nick/bin/repo

Fetching projects: 100% (329/329), done.
Syncing work tree: 32% (106/329) error: revision refs/tags/android-4.2.1_r1 in platform/external/libnfc-nci not found

I tried the repo sync -f command but same thing. thanks for listening. any would would be awesome
 

mjs1015

Member
Apr 24, 2011
17
0
0
Visit site
Before i begin to ask my question, awesome job man!!! anyway, I can't get the repo to go.

here's the code:

nick@DevDapp:~/NEXUS_DEV$ repo sync

... A new repo command ( 1.18) is available.
... You should upgrade soon:

cp /home/nick/NEXUS_DEV/.repo/repo/repo /home/nick/bin/repo

Fetching projects: 100% (329/329), done.
Syncing work tree: 32% (106/329) error: revision refs/tags/android-4.2.1_r1 in platform/external/libnfc-nci not found

I tried the repo sync -f command but same thing. thanks for listening. any would would be awesome

I would start fresh. Delete you repo and start again.

Sent from my Galaxy Nexus using Android Central Forums
 

dhemke17

New member
Jan 6, 2012
2
0
0
Visit site
I have successfully made it through the compile process. Excellent guide. Now I have a question. Has anybody had issues with the AOSP build not booting? Mine will not show a boot animation at all. I have run ddms to see what I could see and phone will not boot past system and sticks on a bootloop with the error in system/bin/sh. Any ideas??
 

Paul627g

AC Moderator All-Star
Moderator
Nov 25, 2010
15,963
2,752
0
Visit site
I have successfully made it through the compile process. Excellent guide. Now I have a question. Has anybody had issues with the AOSP build not booting? Mine will not show a boot animation at all. I have run ddms to see what I could see and phone will not boot past system and sticks on a bootloop with the error in system/bin/sh. Any ideas??
Did you download and install the proprietary files into your build environment?

I think I made this same mistake once, it compiled, flashed but wouldn't boot...
 

dhemke17

New member
Jan 6, 2012
2
0
0
Visit site
I did...I dont know if anything happened is my problem. I went through, did the whole "I ACCEPT" thing for every file for the toro build, and nothing showed up like I figured it would even terminal said "files extracted successfully"

EDIT: Changed permissions on file...seemed to actually extract something....

EDIT 2: Compiling again with all the proprietary files. Hoping for a bootable base!
 
Last edited:

Neutrino

Well-known member
Oct 2, 2009
67
0
0
Visit site
Re: [GUIDE] Compiling Android from Source for the Galaxy Nexus

I will be putting in common questions/problems once they arise. For now, please reference the credited guides for any immediate support, or simply post up in here for help :).

Fixes/Tricks

Java6/JDK Issues:

Java6 sometimes does not play nice, even with the AOSP-given commands to get it. Here are some resources that may help you out in resolving any Java issues, may it be installation or making sure OpenJava works.

[TIP]For installing the JDK ==>

For any read/version errors (thanks khalid!) ==>

A version error looks like this:

[/TIP]

"Make"/find: 'src' Errors

To solve this, you can try updating your dependencies, or you can try this fix. You'll want to install this patch. Also see this post. Thanks ancorare and ewinkley!



Compiling CyanogenMod

Thanks to 2defmouze for the hat tip!
GUI CyanogenMod Compiler Tool for Ubuntu | OMG! Ubuntu!

[NOTE]I'd like to give credit where it's due, and that's mainly these following five resources--Android Open Source Project, XDA Developer dastin1015, NPRussell, futurecrue, and droseum20. Thanks to all of these great guides and devs![/NOTE]

I am a complete Ubuntu newbie. How do I go about installing this patch in Ubuntu?
 

Neutrino

Well-known member
Oct 2, 2009
67
0
0
Visit site
Re: [GUIDE] Compiling Android from Source for the Galaxy Nexus

I have navigated successfully through this guide down to the build stage. When make -j is completed, I don't end up with a .zip or .img file in my out folder.
 

2defmouze

Well-known member
Jul 9, 2011
3,945
1,552
0
Visit site
I am a complete Ubuntu newbie. How do I go about installing this patch in Ubuntu?

Not clear from what you quoted.. Which patch?

I have navigated successfully through this guide down to the build stage. When make -j is completed, I don't end up with a .zip or .img file in my out folder.

You are sure it completed, without any errors? How long did it take, and how many cores is your processor using/how many does it have/what number did you use as the variable in the make j command?

Sent from my Nexus 4 using Tapatalk 2
 

Neutrino

Well-known member
Oct 2, 2009
67
0
0
Visit site
Stumbled across this after a Google search of the make error: xda-developers - View Single Post - [Tutorial] Compile JB on Ubuntu

Applied this patch: https://github.com/CyanogenMod/andr...mmit/c8b97210aa31c9b80b5fd136d8617ebe4e731e09

And it compiled perfectly! Just downloaded Jelly Belly's 7-14 GApps, gonna get to flashing and see if it worked.

Again, huge thanks to dmmarck for this killer writeup, and Andrew Ruffolo for the make clobber pointer, lol. :)

Still learning the ropes with Ubuntu. How do you apply this patch from terminal?
 

mjs1015

Member
Apr 24, 2011
17
0
0
Visit site
Still learning the ropes with Ubuntu. How do you apply this patch from terminal?

You don't apply in terminal. Go into the folder that to repo synced to then navigate to here
guava/src/com/google/common/collect/Maps.java
Once there delete the lines with a minus next to them and add the lines with the plus next to them from the patch link then save.
Sent from my Galaxy Nexus using Android Central Forums
 

Neutrino

Well-known member
Oct 2, 2009
67
0
0
Visit site
I was in the same boat last week. Here's what I did (roughly -- I don't have my build machine in front of me right now). Hope it helps.

I performed a full build and then wrote a script that checks each blob listed under device/samsung/toro/proprietary-blobs.txt with what was output by the build under system/out. That identified six missing files:
Code:
/system/app/CellBroadcastReceiver.apk
/system/bin/fRom
/system/vendor/etc/sirfgps.conf
/system/vendor/firmware/ducati-m3.bin
/system/vendor/firmware/libpn544_fw.so
/system/vendor/lib/hw/gps.omap4.so

Then the hunt began for these files... it's up to you to find them.

CellBroadcastReceiver.apk: I haven't had a chance to look into this one, so it's still missing. However, it is also missing from the other toro ROMs I've seen. My build seems to run fine without it.
fRom: is present under vendor/samsung/toro/proprietary/ but was being copied to the wrong location by the Android.mk file, so I corrected that.
sirfgps.conf: GPS. Get from toro 4.0.4 ROM.
ducati-m3.bin: Camera. Get from maguro 4.1 ROM.
libpn544_fw.so: NFC. Get from maguro 4.1 ROM.
gps.omap4.so: GPS. Get from toro 4.0.4 ROM.

Once you find the blobs you will need to create makefiles for them. Luckily, AOSP contains the skeleton makefiles for these under device/samsung/toro/self-extractors/. Create the necessary directories under vendor/ and copy these makefiles there along with blobs. I believe one of the makefiles under vendor/samsung/toro already looks for these makefiles and includes them if present.

Once you have everything setup it's time to make clobber and run another build. Re-check the files listed in proprietary-blobs.txt and ensure you have at least the 5/6 that I mentioned. If you're satisfied with the results, try flashing it.

Good luck.


This is really good info. I had no problems findng the blobs on my stock/rooted GN. I made subdirectories in the vendor folder correspondng to each blob. The next part i am really unsure of. I copied and pasted the comtents of the self-extractor folder into each blob folder. I then made clobber, and proceded with building. This doesnt seem right to me after we has to accept the other binaries. I dont have a clue how to modify the Android.mk file or create a new mk file for each of the new blob directories. Can someone help or point me in the right direction?
 

jjhiza

Member
Dec 29, 2010
13
0
0
Visit site
Fantastic guide! This has been very helpful in getting me over the first time fears of setting things up.

I've compiled a full_toro_userdebug build, and it flashes, but won't boot. I pass the Google splash screen like normal, but then things just hang on a black screen (there's no bootanimation.zip present in my zip at all). I seem to have things set up properly, and the only "error" I'm getting is a "No file_contexts" warning. I'm wondering if anyone has any thoughts on the matter... Any/all help would be much appreciated. :)
 

Neutrino

Well-known member
Oct 2, 2009
67
0
0
Visit site
Fantastic guide! This has been very helpful in getting me over the first time fears of setting things up.

I've compiled a full_toro_userdebug build, and it flashes, but won't boot. I pass the Google splash screen like normal, but then things just hang on a black screen (there's no bootanimation.zip present in my zip at all). I seem to have things set up properly, and the only "error" I'm getting is a "No file_contexts" warning. I'm wondering if anyone has any thoughts on the matter... Any/all help would be much appreciated. :)

I had that same problem today. Spent 3 hours compiling only to realize I forgot to extract the Samsung CDMA/LTE proprietary. That resulted in a BSOD after the Google logo finished. Funny thing was I could access the device via adb and reboot the boot loader. There's a really good discussion on page 8 of this thread regarding the binaries. You need to extract several binaries from the stock ROM and add to the build.

Today, January 4, 2012: the day I compiled and installed my first (of many to come) AOSP ROM on my VZW GN. Now, if someone could share the Nexus 4 binaries, I could apply this guide to that device as well. :)
 

Neutrino

Well-known member
Oct 2, 2009
67
0
0
Visit site
I seem to have everything working with the exception of GPS. I used the 4.1.1 stock ROM for extracting the sirfgps and gps.omap4 files. Are these not compatible with 4.2.1 builds? The thread here states to place the files in the vendor/csr/toro/proprietary folders. The skeleton .mk files seem to suggest the same thing. I found a blog,Fix for Camera & GPS on the Galaxy Nexus with Android AOSP Jelly Bean - Anders.com, which suggests placing these files and some others as well in the vendor/samsung/toro folders.

For those who have successfully followed the placement of the binary files in this thread, what other tweaks need be done to get gps working?
 

jjhiza

Member
Dec 29, 2010
13
0
0
Visit site
I had that same problem today. Spent 3 hours compiling only to realize I forgot to extract the Samsung CDMA/LTE proprietary. That resulted in a BSOD after the Google logo finished. Funny thing was I could access the device via adb and reboot the boot loader. There's a really good discussion on page 8 of this thread regarding the binaries. You need to extract several binaries from the stock ROM and add to the build.

Today, January 4, 2012: the day I compiled and installed my first (of many to come) AOSP ROM on my VZW GN. Now, if someone could share the Nexus 4 binaries, I could apply this guide to that device as well. :)

Thank you very much! I'll have some time tomorrow afternoon to sit down and take a look at the binaries.

I had a build I thought was good today, but I forgot to remove the recovery folder...ten guesses what happened... I nuked TWRP, and could only boot into the bootloader. I was out all day, so I had to wait hours to get home and fastboot TWRP back onto the phone, to restore my backup. Fun... Lol :p

Hopefully, I'll be able to get those binaries taken care of, and finally get a build going tomorrow. Then it's onto theming it and adding a couple of choice scripts I'd like to include. Thank you again for pointing me in the right direction. :):thumbup:
 
Last edited:

jjhiza

Member
Dec 29, 2010
13
0
0
Visit site
Hey guys, before I go any farther with trying to get a build together, I'd like to verify which branch I synced with. I believe I did my repo sync with the 4.2.1_r1 tag (which is what I want), and not the master branch, but I can't be sure. I've been through my file system, and can't figure it out... Is there a command line I can enter, that will give me the info I'm looking for?

And on the off chance that I've synced with the master branch, how would I go about deleting those files, so I can sync with 4.2.1_r1, and not have to worry about having 100GB of repo files on my HDD?

Thank you to everyone for all the help. I'm new to both ROM building, and Linux (command line)... Please bear with me. :eek:
 

PR0XiMA

New member
Jan 10, 2013
2
0
0
Visit site
Hey! Nice guide. I got a little problem, i have compiled a 4.2 ROM for my Nexus 7 and i flashed trough TWRP but i have a little problem... After i flashed it, i only got a black screen... Why? :(
 

jjhiza

Member
Dec 29, 2010
13
0
0
Visit site
Hey guys! I finally got all my issues worked out, and have compiled a 4.2.1 build that flashes, boots, has root, and all...THANK YOU for this guide!!! :D The only issue I'm having at the moment is that radios are not included in the source, which leaves me with no signal of any kind. I have the radios, and I could flash them, but I'd rather build them into the ROM...Is there any way I can do this? If so, what is the path that I should drop the "radio-cdma.img, radio.img, and radio.img.p" files into (.../vendor/samsung by chance)? Thank you again for all the help, and thanks in advance for any feedback!

Update: issue resolved! :)
jabunu7e.jpg
 
Last edited:

Forum statistics

Threads
943,150
Messages
6,917,533
Members
3,158,848
Latest member
kerokekerol