[GUIDE][Ubuntu] Compiling Android from Source

dhworph

Active member
Dec 29, 2011
35
1
8
Visit site
jjhiza, where did you put the radios? Can you elaborate?

I've got AOSP building right now (just the "master" version which I assume is 4.2.1 for toro). I didn't go throught the proprietary driver step since they already appear to be in the source tree. I also didn't verify git tags or do ccache.

I was able to get java6 installed through some ppa repository.
 

jjhiza

Member
Dec 29, 2010
13
0
0
Visit site
jjhiza, where did you put the radios? Can you elaborate?

I've got AOSP building right now (just the "master" version which I assume is 4.2.1 for toro). I didn't go throught the proprietary driver step since they already appear to be in the source tree. I also didn't verify git tags or do ccache.

I was able to get java6 installed through some ppa repository.

As soon as I get home tomorrow, I'll post all the information for you. I built from the 4.2.1_r1 branch, which does have drivers, but not the proper binaries for CDMA/LTE, GPS, NFC, etc. I'm not sure exactly how the Master branch operates, but my build booted with the incorrect binaries... I just had no signal. The patched ones I found work perfectly though.

I did verify git, but didn't go the ccache route, because I don't plan on building for anything besides Toro for a while.

Java was a pain for me... I had to purge the version that comes with Mint 14, and install version 6 fresh. I'm new to Linux, so figuring out how to do that took me a little while.

Stay tuned though... Like I said, I'll get you the binaries info tomorrow. :)
 

dhworph

Active member
Dec 29, 2011
35
1
8
Visit site
I just downloaded the 4.2 binaries from google's building for devices page. And they seemed to extract correctly to /vendor folder. I used "make clobber" to delete my previous build, setup ccache (with a few headaches, but got it working it seems -- google's directions are not very transparent). And initiated another build... this time with "make -j9 otapackage" hoping that it will make a flashable zip...
 

dhworph

Active member
Dec 29, 2011
35
1
8
Visit site
Just noticed this on google "known issues" page:

========================================
Camera, GPS and NFC don't work on Galaxy Nexus.
Symptom:
Camera, GPS and NFC don't work on Galaxy Nexus. As an example, the Camera application crashes as soon as it's launched.

Cause: Those hardware peripherals require proprietary libraries that aren't available in the Android Open Source Project.

Fix: None.
========================================

Are the binaries offered on google driver download page enough to fix this? I didn't see camera or GPS listed there, but NFC is.

EDIT: just found this blog post with some seemingly good info about camera and GPS. I figured that maybe I could take all the missing files out of an AOKP 4.2 build or a Cyanogenmod 10.1 nightly, since they are both 4.2 based.

My AOSP build had fRom and libpn544_fw.so, but was missing CellBroadcastReceiverVZW.apk, sirfgps.conf, ducati-m3.bin, and /gps.omap4.so. I found them in the AOKP mr1 build-2. I don't know if its kosher to pull the files for my own build and say I did so in this forum, so please correct me if I am breaking any rules.

Also, there were some VZW files in the AOKP rom that were missing from my build: VerizonSSO.apk, VZWAPNLib.apk, and VZWAPNService.apk missing from /system/app/. I'm not sure if those are needed for the phone to function on the Verizon network or not though... Maybe I can just drop all those in the correct locations in my AOSP diy-build otapackage...

EDIT 2: hm... the cyanogenmod nightly doesn't have VerizonSSO.apk or CellBroadcastReceiverVZW.apk... maybe unnecessary... but then why are they included elsewhere?

EDIT 3: The ducati-m3.bin and /gps.omap4.so files are slightly different between AOKP and Cyanogenmod... the former is a few bytes larger in the AOKP and the latter is 4KB larger in AOKP. kinda weird. The 'last modified' dates on them were exactly 21 hours apart, which is either due to time zone differences... or possibly different builds by the OEM devs? probably none of this really matters, but maybe useful info to have here.

EDIT 4: the ducati-m3.bin file is in my aosp source tree; sirfgps.conf and gps.omap4.sa are not. WHen I tried edited android.mk and device-partial.mk as described here by Anders, I got an error: "no rule to make target /vender/samsung/toro/proprietary/ducati-m3.bin". And the build stopped. I also tried changing LOCAL_MODULE_OWNER names from samsung to "ti" and "csr" as I saw that on another webpage. No luck, build still stopped.

So I undid the .mk file changes, but left sirfgps.conf in the /vendor/samsung/toro/proprietary folder of WORKING_DIRECTORY. However, I think it probably won't be incorporated into the build. I guess adding them in the end manually is the only way to go?

Is there anyone who knows how to build AOSP 4.2 for toro (without having to manually add anything to the output build) and have it all working, camera, gps, and all?
 
Last edited:

dhworph

Active member
Dec 29, 2011
35
1
8
Visit site
Ok, I think I've found a potential solution. Using clues form this post by JBQ.

The thing to do is to compile the code and ignore problems with adding proprietary binaries. Then once the code is compiled, you can put the binaries in the proper place in the "out" build directory and then make an otapackage from that. The ota package will include them and be signed and all that goodness.

There also seems to be a way to generate the ota without the recovery too, I'll work on that later.

I guess if you don't want to generate an otapackage, you can just use fastboot flashall after putting the binaries in the appropriate locations in "out" build directory.
 

Arpita Biswas

New member
Feb 11, 2013
1
0
0
Visit site
Heya guys ,

I am a newbie w.r.t to creating a custom ROM. I followed the amazing set of instructions here , on Ubuntu 12.04 , android branch : android-4.1.1_r6.1 (and not the master) , jdk : 1.6.0 and with proprietary binaries, for Nexus - grouper. However , during the build , I came across this error :

UNEXPECTED TOP-LEVEL EXCEPTION:
com.android.dx.util.ExceptionWithContext: Index: 1, Size: 2
at com.android.dx.util.ExceptionWithContext.withContext(ExceptionWithContext.java:46)
at com.android.dx.dex.cf.CfTranslator.processMethods(CfTranslator.java:344)
at com.android.dx.dex.cf.CfTranslator.translate0(CfTranslator.java:134)
at com.android.dx.dex.cf.CfTranslator.translate(CfTranslator.java:87)
at com.android.dx.command.dexer.Main.processClass(Main.java:483)
at com.android.dx.command.dexer.Main.processFileBytes(Main.java:455)
at com.android.dx.command.dexer.Main.access$400(Main.java:67)
at com.android.dx.command.dexer.Main$1.processFileBytes(Main.java:394)
at com.android.dx.cf.direct.ClassPathOpener.processArchive(ClassPathOpener.java:245)
at com.android.dx.cf.direct.ClassPathOpener.processOne(ClassPathOpener.java:131)
at com.android.dx.cf.direct.ClassPathOpener.process(ClassPathOpener.java:109)
at com.android.dx.command.dexer.Main.processOne(Main.java:418)
at com.android.dx.command.dexer.Main.processAllFiles(Main.java:329)
at com.android.dx.command.dexer.Main.run(Main.java:206)
at com.android.dx.command.dexer.Main.main(Main.java:174)
at com.android.dx.command.Main.main(Main.java:91)
Caused by: java.lang.IndexOutOfBoundsException: Index: 1, Size: 2
at java.util.ArrayList.RangeCheck(ArrayList.java:547)
at java.util.ArrayList.remove(ArrayList.java:387)
at com.android.dx.ssa.Dominators.compress(Dominators.java:136)
at com.android.dx.ssa.Dominators.eval(Dominators.java:160)
at com.android.dx.ssa.Dominators.run(Dominators.java:207)
at com.android.dx.ssa.Dominators.make(Dominators.java:90)
at com.android.dx.ssa.DomFront.run(DomFront.java:90)
at com.android.dx.ssa.SsaConverter.placePhiFunctions(SsaConverter.java:298)
at com.android.dx.ssa.SsaConverter.convertToSsaMethod(SsaConverter.java:52)
at com.android.dx.ssa.Optimizer.optimize(Optimizer.java:99)
at com.android.dx.ssa.Optimizer.optimize(Optimizer.java:73)
at com.android.dx.dex.cf.CfTranslator.processMethods(CfTranslator.java:273)
... 14 more
...while processing rxGetMonoStereoMode ()I
...while processing com/ti/fm/IFmRadio$Stub$Proxy.class

1 error; aborting
make: *** [out/target/common/obj/JAVA_LIBRARIES/fmradioif_intermediates/noproguard.classes-with-local.dex] Error 1
make: *** Waiting for unfinished jobs....


Can someone please help me out with what could be the issue ? Is it the fact that I compiled an earlier branch when on 12.04 it supports only master ? Or is it something else completely ?

Thanks a ton in advance! :)
 

dhworph

Active member
Dec 29, 2011
35
1
8
Visit site
I just tried to install my build of 4.2.1_r1.2 and it failed.... set_perm (status 7) error

Here was my process:
1. Compile AOSP branch 4.2.1_r1.2
2. Delete recovery folder from the ota
3. resign it with signapk.

I've gotten this error from two of my builds, the other was from master branch. Kinda wierd... maybe I have no choice but to not delete the recovery folder?

Edit: ok, the second time my phone got totally f****d! I was a bit lost since my phone no longer seemed to have a filesystem, so I flashed the factory 4.1.1 image using a GNex toolkit, rerooted and restored a nandroid.

I think part of the problem was caused by this line in tersion of the camerahe updater-script:
Code:
format("ext4", "EMMC", "/dev/block/platform/omap/omap_hsmmc.0/by-name/userdata", "0", "/data");
It makes sense that would wipe my sdcard clean. And after deleting the recovery folder from my aosp zip, I realized I should probably have deleted the recovery parts of the updater-script:
Code:
package_extract_dir("recovery", "/system");

set_perm(0, 0, 0544, "/system/etc/install-recovery.sh");

I'm thinking about trying to flash it again, but I'm worried that the permissions for the proprietary vendor files I added won't be set correctly. I'm not sure if I have to edit the updater script for those (sirfgps.conf, ducati-m3.bin, and gps.omap4.so). You know I'm into this when I can recall those file names by heart... lol. :p

Also, I'm not exactly sure what to do about "file-contexts", and I'm pretty sure I don't have to worry about "update-binary"... but maybe... :confused:


Edit: Ok finally got a 4.2.1_r1.2 build to flash, however, the photosphere camera isn't working, although gps is. I am pretty sure I have all the needed files (there were 3 to add). Also, root doesn't work even though the su binary is present... and I did full_toro-userdebug. weird... however, I just flashed a root zip to get root back. And I flashed a version of the camera (gallerygoogle flashable zip) that was floating around on the net. wiped cache and dalvik and the photosphere camera seems to work now. not sure if the problem was with the lib files, or the apks... but got it working. I'm going to drive this for a few days to live out my AOSP glory... lol... :-$:D
 
Last edited:

Chex313

Well-known member
Oct 7, 2011
1,197
169
63
Visit site
Nice amount of info here! I always wondered what else I could do with my Ubuntu 4P 32 core server board...Other then fold proteins.

What kind of HD space does one need? More then 128 GB SSD?

Congrats to all who compiled their own builds. I can see what kind of patience and work went into it.:cool:
 

dhworph

Active member
Dec 29, 2011
35
1
8
Visit site
I have Ubuntu 12.04 running in virtualbox on windows 7 x64. 128GB virtual hard drive allocated to ubuntu out of 750GB total hard drive. I compile with -j9 (quad core cpu with 8-16 threads), and it takes an hour. Also I have 10GB RAM out of 16 total allocated to ubuntu virtual machine.

Edit: One AOSP build is about 17GB (JB branches), the entire synced source code can vary in size... its about 35-50GB for me including one build.
 
Last edited:

rauma

New member
Feb 23, 2013
3
0
0
Visit site
Hi, I'm using Pantech Sky Vega S ( It's similar to HTC Incredible S about CPU chipset, GPU, screen resolution (480x800) and dimension (4.0 inch)).
This phone appears to be not supported anymore, and I want to build my own rom for this.
My question is:
Can I build my rom for this phone by following this guide? ( I have followed some guides from xda and still stucking with bunches of errors).
Thanks so much.
 

DevonL

New member
Feb 26, 2013
1
0
0
Visit site
So I'm trying to build this for the Galaxy Nexus toro and it's simply not showing toro for any of the options.

When running source build/envsetup.sh I'm not even seeing it there:
~/JB_SOURCE$ source build/envsetup.sh
including device/asus/grouper/vendorsetup.sh
including device/generic/armv7-a-neon/vendorsetup.sh
including device/generic/armv7-a/vendorsetup.sh
including device/moto/wingray/vendorsetup.sh
including device/samsung/crespo/vendorsetup.sh
including device/samsung/maguro/vendorsetup.sh
including device/ti/panda/vendorsetup.sh
including sdk/bash_completion/adb.bash
Any help is appreciated!
 

dhworph

Active member
Dec 29, 2011
35
1
8
Visit site
So I'm trying to build this for the Galaxy Nexus toro and it's simply not showing toro for any of the options.

When running source build/envsetup.sh I'm not even seeing it there:
~/JB_SOURCE$ source build/envsetup.sh
including device/asus/grouper/vendorsetup.sh
including device/generic/armv7-a-neon/vendorsetup.sh
including device/generic/armv7-a/vendorsetup.sh
including device/moto/wingray/vendorsetup.sh
including device/samsung/crespo/vendorsetup.sh
including device/samsung/maguro/vendorsetup.sh
including device/ti/panda/vendorsetup.sh
including sdk/bash_completion/adb.bash
Any help is appreciated!

depending on what AOSP branches you have synced with, you might not see toro as available, but it is actually there, you just can't select it from the lunch menu. Just do: "lunch full_toro-userdebug" and it should allow you to select toro that way.
 

Grizzly420

Active member
Apr 26, 2010
33
1
0
Visit site
Need a little help I downloaded source all is good there. Synced a couple of times no issues, built twice with no error that caused the build to stop anyway. Loads well 4.2.2 with updated binaries. Everything seems to work will except camera. Gallery works but camera FC, and I tryed Muzzy's gallery apk but didn't work so its not a gapps issue. I Can post a pastebin of the build if necessary. Thanks in advanced.
 

dhworph

Active member
Dec 29, 2011
35
1
8
Visit site
Need a little help I downloaded source all is good there. Synced a couple of times no issues, built twice with no error that caused the build to stop anyway. Loads well 4.2.2 with updated binaries. Everything seems to work will except camera. Gallery works but camera FC, and I tryed Muzzy's gallery apk but didn't work so its not a gapps issue. I Can post a pastebin of the build if necessary. Thanks in advanced.

It is expected for the camera and gps to not work when building AOSP from source (see my post above). I haven't built 4.2.2, so maybe it is different, but when building 4.2.1, there were 3 missing binary files: sirfgps.conf, ducati-m3.bin, and gps.omap4.so. I would compare your AOSP rom to a stock flashable rom or a custom rom to see what files you are missing and then start googling around to see what those files do. Also, note that some G-Apps packages floating around, that are supposed to be flashed with custom roms, often have some files you might need or find useful. For example, face unlock app and binaries ("pitt patt" vendor folder - i think), and also various camera apps (they will usually overwrite whatever camera app was included with your AOSP rom).

Hope this helps.
 

Grizzly420

Active member
Apr 26, 2010
33
1
0
Visit site
You are exactly right I found GPS didn't work. Thank you so much for some direction that's all I needed. When I figure it out I will post it. Also my build was running extremely well Bluetooth was great WiFi was good and super smooth.
 

spitefulmonkey

New member
Mar 26, 2013
1
0
0
Visit site
First off, thank you for this wonderful thread. I am trying to get setup to build for a developers board I purchased. Samsung's Exynos 5 Arndale Board. I got my host system setup using Ubuntu 12.10 and your guide to get things installed with the exception of using Insignal's git://git.insignal.co.kr/samsung/exynos/android/manifest.git for the Arndale source and Samsung's proprietary as well as Insignal's proprietary for drivers. One thing I need to do, but don't seem to have luck at is getting my toolchain installed as stated on their wiki which is toolchain GCC Version 4.4.1 (Sourcery G++ Lite 2009q3

I have been trying unsuccessfully for days to get this built and try my board out, and I'd be very appreciative of any help from any of you having more experience with all this then I. Their wiki is WiKi - ArndaleBoard.org

I'm sure it is quite similar but just need help getting one successful build so that I can continue on my own haha. Anyways, again thank you for the great tut and hopefully one of you has time to lend a hand.

*EDIT* Hopefully I'm not crucified for asking in a GNex thread, but this seemed like such a knowledgeable thread on the build process.
 

skx0liukangx00

New member
May 6, 2011
2
0
0
Visit site
This is one of - if not best guide I've found and used to get through this process and I really appreciate it!
I have hit one minor snag however and I am not quite sure of how to fix it.

Copied from my terminal:

chriswolf@ubuntu:~$ sudo apt-get install git-core gnupg flex bison gperf build-essential zip curl libc6-dev libncurses5-dev:i386 x11proto-core-dev libx11-dev:i386 libreadline6-dev:i386 libgl1-mesa-glx:i386 libgl1-mesa-dev g++-multilib mingw32 openjdk-6-jdk tofrodos python-markdown libxml2-utils xsltproc zlib1g-dev:i386
[sudo] password for chriswolf:
Reading package lists... Done
Building dependency tree
Reading state information... Done
zip is already the newest version.
zip set to manually installed.
gnupg is already the newest version.
build-essential is already the newest version.
libc6-dev is already the newest version.
libc6-dev set to manually installed.
Some packages could not be installed. This may mean that you have
requested an impossible situation or if you are using the unstable
distribution that some required packages have not yet been created
or been moved out of Incoming.
The following information may help to resolve the situation:

The following packages have unmet dependencies:
libgl1-mesa-glx:i386 : Depends: libglapi-mesa:i386 (= 8.0.4-0ubuntu0.4)
Recommends: libgl1-mesa-dri:i386 (>= 7.2)
E: Unable to correct problems, you have held broken packages.


Could anyone help me out?

Thank you
 

dhworph

Active member
Dec 29, 2011
35
1
8
Visit site
This is one of - if not best guide I've found and used to get through this process and I really appreciate it!
I have hit one minor snag however and I am not quite sure of how to fix it.

Copied from my terminal:

chriswolf@ubuntu:~$ sudo apt-get install git-core gnupg flex bison gperf build-essential zip curl libc6-dev libncurses5-dev:i386 x11proto-core-dev libx11-dev:i386 libreadline6-dev:i386 libgl1-mesa-glx:i386 libgl1-mesa-dev g++-multilib mingw32 openjdk-6-jdk tofrodos python-markdown libxml2-utils xsltproc zlib1g-dev:i386
[sudo] password for chriswolf:
Reading package lists... Done
Building dependency tree
Reading state information... Done
zip is already the newest version.
zip set to manually installed.
gnupg is already the newest version.
build-essential is already the newest version.
libc6-dev is already the newest version.
libc6-dev set to manually installed.
Some packages could not be installed. This may mean that you have
requested an impossible situation or if you are using the unstable
distribution that some required packages have not yet been created
or been moved out of Incoming.
The following information may help to resolve the situation:

The following packages have unmet dependencies:
libgl1-mesa-glx:i386 : Depends: libglapi-mesa:i386 (= 8.0.4-0ubuntu0.4)
Recommends: libgl1-mesa-dri:i386 (>= 7.2)
E: Unable to correct problems, you have held broken packages.


Could anyone help me out?

Thank you

What is your linux OS? Are you using it in a virtual machine?

First, you might want to try manually uninstalling (through package manager gui or via command line) all of the packages listed there that you were trying to install there. Then, try the install command again. I'm no expert, but just an idea. Also, there is a clue in your error message... check the versions you have installed of libglapi-mesa:i386 (= 8.0.4-0ubuntu0.4) and libgl1-mesa-dri:i386 (>= 7.2). Maybe try upgrading those packages or uninstalling/re-installing them.
 

phoenix_911

New member
Apr 2, 2013
1
0
0
Visit site
This is one of - if not best guide I've found and used to get through this process and I really appreciate it!
I have hit one minor snag however and I am not quite sure of how to fix it.

Copied from my terminal:

chriswolf@ubuntu:~$ sudo apt-get install git-core gnupg flex bison gperf build-essential zip curl libc6-dev libncurses5-dev:i386 x11proto-core-dev libx11-dev:i386 libreadline6-dev:i386 libgl1-mesa-glx:i386 libgl1-mesa-dev g++-multilib mingw32 openjdk-6-jdk tofrodos python-markdown libxml2-utils xsltproc zlib1g-dev:i386
[sudo] password for chriswolf:
Reading package lists... Done
Building dependency tree
Reading state information... Done
zip is already the newest version.
zip set to manually installed.
gnupg is already the newest version.
build-essential is already the newest version.
libc6-dev is already the newest version.
libc6-dev set to manually installed.
Some packages could not be installed. This may mean that you have
requested an impossible situation or if you are using the unstable
distribution that some required packages have not yet been created
or been moved out of Incoming.
The following information may help to resolve the situation:

The following packages have unmet dependencies:
libgl1-mesa-glx:i386 : Depends: libglapi-mesa:i386 (= 8.0.4-0ubuntu0.4)
Recommends: libgl1-mesa-dri:i386 (>= 7.2)
E: Unable to correct problems, you have held broken packages.


Could anyone help me out?

Thank you

Just download and install packages from software center
.. In your case libgil1

Sent from my A15 using Tapatalk 2
 

skx0liukangx00

New member
May 6, 2011
2
0
0
Visit site
I am running a wubi install of 64 bit Ubuntu 12.04LTS, no VM here!
I used the guide for this that can be found on source.android.com and it had some of those packages i.e.: Python, GNU, Git - all listed near the start of the guide so I installed those along with the JDK6 first. Whether that caused the issue .. I don't know. I just realized that this command was just to install all of that in one go. So I could try to uninstall them and re-install them but I'll wait.

As for the package dependency: 'libgl1-mesa-glx:i386' - it said it depended on libglapi-mesa:i386 // it also recommended 'libgl1-mesa-dri:i386'. I downloaded both packages and tried to install with GDebi and Software Center and they both came up with these error messages:
'libgl1-mesa-dri_8.0.4-0ubuntu0.4_amd64.deb' breaks existing package 'libgl1-mesa-dri-lts-quantal'conflict: libgl1-mesa-dri

'libglapi-mesa_8.0.4-0ubuntu0.4_amd64.deb' breaks existing package 'libglapi-mesa-lts-quantal' conflict: libglapi-mesa
I went into command and typed: sudo apt-get install libglapi-mesa:i386
Got this right away:
The following extra packages will be installed:
gcc-4.6-base:i386 libc6:i386 libgcc1:i386 libgl1-mesa-glx libglapi-mesa
xserver-xorg-core xserver-xorg-input-evdev
Suggested packages:
glibc-doc:i386 locales:i386 xfonts-100dpi xfonts-75dpi
The following packages will be REMOVED:
libgl1-mesa-dri-lts-quantal libgl1-mesa-glx-lts-quantal
libglapi-mesa-lts-quantal libxatracker1-lts-quantal ubuntu-desktop
along with a lot of x-server-xorg packages.

I then re-ran the original command listed in my post above.. the install command for all of those packages.. and it zoomed away and installed some more of what was needed I take it.

So I fixed it then? haha I am new to linux but if I just fixed my problem then I am happy.. I am making progress in the ways of Linux.

Thank you dhworph, your post made me think about it for a while and that ^ is what I came up with.
 

Trending Posts

Forum statistics

Threads
943,011
Messages
6,916,882
Members
3,158,773
Latest member
Chelsea rae