PDA

View Full Version : Compile AOSP From Source - Semi-Complete Guide (it worked for me!)



maderschramm
01-21-2011, 05:27 PM
Wrote this up while doing it, so it's by no means my best work, but devs should love screwing around with this stuff anyway. Please don't pm me asking me for help because I probably can't help you... :S sorry.

Expect this to take ~3 hours

This is for ubuntu 11.04 64 bit. If you have a different version upgrade. It might work, I don't know. If you have 32-bit you need 64, sorry.

Directions are from here:
Get Android Source Code | Android Open Source (http://source.android.com/source/download.html)
But I made them work for me.

I use vim, you should too. If you'd rather use gedit, simply replace [vim] with [gedit] in the commands.

All these commands are run in a terminal window. When you're supposed to type something, I have it listed with brackets - [] - everything else is descriptive. NEVER INCLUDE BRACKETS UNLESS SPECIFIED (which is never, just fyi)!!!

I'm no expert, but this worked for me, so it should for you too, these are simply the way I did it so don't expect many updates or a lot of support, I just did it as a favor.

Good luck!

Note: All commands are run in a terminal window - if you don't know what that is, learn how to use linux before proceeding.

------------------
Set Up Machine
------------------


[sudo apt-get install vim]
[sudo vim /etc/apt/sources.list]

(opens sources for ubuntu)




press "insert" to allow inputting into the file

scroll to bottom
press "enter" to get a new line

add:


deb http://us.archive.ubuntu.com/ubuntu/ jaunty multiverse
deb http://us.archive.ubuntu.com/ubuntu/ jaunty-updates multiverse



to bottom of list

press "escape" to quit input mode
type ":w" "enter" to save
type ":q" "enter" to quit


[sudo aptitude update]

(update repository list)






[sudo apt-get install git-core gnupg flex bison gperf build-essential zip curl sun-java5-jdk zlib1g-dev gcc-multilib g++-multilib libc6-dev-i386 lib32ncurses5-dev ia32-libs x11proto-core-dev libx11-dev lib32readline5-dev lib32z-dev]

(installs sh--)





[sudo update-java-alternatives -s java-1.5.0-sun]

(set java 1.5 default)






[sudo ln -s /usr/lib32/libX11.so.6 /usr/lib32/libX11.so]

(symlynk to workaround lack of packages for X11)




--------------------
Installing Repo
--------------------

you need to have a ~/bin/ file that is in your path. change to home dir



[cd ~]
[ls]


if you don't see a "bin" dir:



[mkdir bin]
[ls]


you should now see a "bin" dir

now type



[echo $PATH]


you should see "~/bin" somewhere in your path, if not:



[sudo vim /etc/profile]


press "insert" to switch to edit mode
scroll to bottom of the file
press enter to get to a new line
enter:



PATH="/usr/local/bin:/usr/local/sbin:/usr/bin:/usr/sbin:/bin:/sbin:/usr/bin/X11:/usr/games:~/bin"


press "esc" to get out of input mode
press ":" then "w" "enter" to save the file
press ":" then "q" "enter "to quit

run /etc/profile to make your changes



[. /etc/profile]

(note that there's a space character between "." and "/")




download the Repo and put it into /bin:



[curl http://android.git.kernel.org/rep > ~/bin/repo]


make it executable



[chmod a+x ~/bin/repo]


----------------------
Initializing Repo
----------------------

make a working directory somewhere on your computer, eg:



[mkdir mydroid]


change to the directory



[cd mydroid]


you can make it wherever you want however. Mine is:
"~/Documents/AOSP"

inside your directory, run repo init



[repo init -u git://android.git.kernel.org/platform/manifest.git]


this installs a master copy. if you want a different version, use the modifier -b, eg:

[repo init -u git://android.git.kernel.org/platform/manifest.git -b cupcake]

When prompted, configure Repo with your real name and email, make your email address your one that is associated with your google account if you plan to submit code

----------------------
Get ze Files!!!
----------------------



[repo sync]


now ve vait....a long time

----------------------
Verifying Git Tags
----------------------



[gpg --import]


paste the following into the terminal (ctrl + shift + v):

-----BEGIN PGP PUBLIC KEY BLOCK-----
Version: GnuPG v1.4.2.2 (GNU/Linux)

mQGiBEnnWD4RBACt9/h4v9xnnGDou13y3dvOx6/t43LPPIxeJ8eX9WB+8LLuROSV
lFhpHawsVAcFlmi7f7jdSRF+OvtZL9ShPKdLfwBJMNkU66/TZmPewS4m782ndtw7
8tR1cXb197Ob8kOfQB3A9yk2XZ4ei4ZC3i6wVdqHLRxABdncwu 5hOF9KXwCgkxMD
u4PVgChaAJzTYJ1EG+UYBIUEAJmfearb0qRAN7dEoff0FeXsEa UA6U90sEoVks0Z
wNj96SA8BL+a1OoEUUfpMhiHyLuQSftxisJxTh+2QclzDviDya TrkANjdYY7p2cq
/HMdOY7LJlHaqtXmZxXjjtw5Uc2QG8UY8aziU3IE9nTjSwCXe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XP/p6LiwNF99faDMTV3+2SAOGvytOX6KjKVzKOSsfJQ
hN0DlsIw8hqJc0WISQQYEQIACQUCSedYRAIbDAAKCRDorT+Bmr EOeCUOAJ9qmR0l
EXzeoxcdoafxqf6gZlJZlACgkWF7wi2YLW3Oa+jv2QSTlrx4KL M=
=Wi5D
-----END PGP PUBLIC KEY BLOCK-----to end input process, type



[ctrl + d]


Now you can validate anything by typing

[git tag -v (tagname)]
where (tagname) is defined by you

----------------
Build the Code
----------------

From within your working directory (eg mydroid), type:



[source build/envsetup.sh]
[lunch]

(you have some options here, press "enter" to select "full-eng")


[make]


I got an error telling me "Your version is: java version "1.5.0_19". The correct version is: 1.6."

Which means google lied, so now I set my java back to 1.6



[sudo apt-get install sun-java6-jdk]

(installs java 6 jdk)




and then re-ran the command to build



[make]


wait for awhile...

and you're done! congrats... maybe?

as I said, good luck!

edit: cleaned up the formatting a bit

Dorian
01-21-2011, 05:41 PM
Your initial "sudo-apt-get" from the repo is all 32-bit, so 32-bit versions of Ubuntu should run this just fine. :)

Nice writeup!

Droid-Xer
01-21-2011, 05:43 PM
Damn Mader! Makes me wanna get Ubuntu up and running just to play around with this...great write up!

maderschramm
01-21-2011, 06:38 PM
That's what I thought, but when I ran [make] at my work 9.10 32 bit I got an error stating that the later version (I assume gingerbread) can only be compiled on 64 bit. Theoretically you could compile froyo with -b froyo, but I cannot confirm or deny this.


Your initial "sudo-apt-get" from the repo is all 32-bit, so 32-bit versions of Ubuntu should run this just fine. :)

Nice writeup!



Sent from my DROIDX using Android.net App

maderschramm
01-21-2011, 06:54 PM
Thanks x-er! Do it! Linux pwns


Damn Mader! Makes me wanna get Ubuntu up and running just to play around with this...great write up!



Sent from my DROIDX using Android.net App

Droid-Xer
01-21-2011, 06:56 PM
I'll have to put my training wheels on! Lol

Dorian
01-21-2011, 07:19 PM
That's what I thought, but when I ran [make] at my work 9.10 32 bit I got an error stating that the later version (I assume gingerbread) can only be compiled on 64 bit. Theoretically you could compile froyo with -b froyo, but I cannot confirm or deny this.

Sent from my DROIDX using Android.net App

Interesting. I've been using Fedora. Ima have to give Ubuntu a go to see what it's like!

maderschramm
01-22-2011, 08:07 PM
It's super easy to use. Love it. Huge support community as well. The support and ease of use it what really wins me - plus I use it for work so I like to keep everything together. I was thinking of trying xubuntu but then realized I didn't really care and am just going to stick with what I know :p

Tell me what you think of the distro!

cush2push
01-24-2011, 02:47 AM
im using ubuntu 10.10 for my builds its a pretty sweet system takes a minute to get used to froyo requires 1.5 as primary you can use 1.6 for gingerbread just use
sudo update-alternatives --config java



sudo update-java-alternatives -s java-1.5.0-sun

to make java 1.5 default for froyo

davros
01-26-2011, 10:54 PM
yes gingerbread is a 64bit build only

1KDS
01-31-2011, 06:42 PM
Damn Mader! Makes me wanna get Ubuntu up and running just to play around with this...great write up!

I thought you had it running a while back :confused:

Droid-Xer
01-31-2011, 10:45 PM
Nope never got it going. Kept getting a permission error and I'm rarely on the pc for that long to figure it out. I've downloaded Ubuntu, burned it to a disc, tried, installing straight from PC and still get permission errors. I'll just do the lazy thing and order the disc.

Dorian
01-31-2011, 10:56 PM
Nope never got it going. Kept getting a permission error and I'm rarely on the pc for that long to figure it out. I've downloaded Ubuntu, burned it to a disc, tried, installing straight from PC and still get permission errors. I'll just do the lazy thing and order the disc.

Download it and burn it slow... like 4x. My burner seems to mess disks up when burnt faster.

cush2push
02-01-2011, 02:21 AM
Nope never got it going. Kept getting a permission error and I'm rarely on the pc for that long to figure it out. I've downloaded Ubuntu, burned it to a disc, tried, installing straight from PC and still get permission errors. I'll just do the lazy thing and order the disc.


i actually did the duel boot to get 10.4 then i dowmloaded 10.10 and used ubuntus startup disk creator to make the disk then swapped fully over to ubuntu and bye bye windows never looked back

Droid-Xer
02-01-2011, 02:50 AM
Ya I'll try the slow burn. It would get to about 70% completion and then say permissions error. It would give me a directory to look into, but that would run into a dead end as the directory it told me to look into wasn't there. I suppose I'll just purchase the actual Ubuntu disc and try a slow burn in the meantime.

cush2push
02-01-2011, 02:52 AM
Ya I'll try the slow burn. It would get to about 70% completion and then say permissions error. It would give me a directory to look into, but that would run into a dead end as the directory it told me to look into wasn't there. I suppose I'll just purchase the actual Ubuntu disc and try a slow burn in the meantime.

if you have to buy it you're losing your money it is a open source free item

Droid-Xer
02-01-2011, 02:57 AM
if you have to buy it you're losing your money it is a open source free item

Lol! Ya I know its open source freeware but I've tried a handful of times and no go. I figure the disc will be idiot proof for me. Its a windows 7 64-bit, I don't know if that makes a difference.

cush2push
02-01-2011, 03:01 AM
Lol! Ya I know its open source freeware but I've tried a handful of times and no go. I figure the disc will be idiot proof for me. Its a windows 7 64-bit, I don't know if that makes a difference.

i was running windows 7 64 bit but i didnt try to go straight ov to ubuntu i did the duel boot option at first to test it out duel boot all you have to do is download it and it does everything else for you might be worth a shot it will be 10.4 not 10.10 both good systems

Droid-Xer
02-01-2011, 03:06 AM
I tried that with 10.10 from here Download | Ubuntu (http://www.ubuntu.com/desktop/get-ubuntu/windows-installer) but that's where I had my problems. So you think I should try 10.4 and then upgrade?

cush2push
02-01-2011, 03:11 AM
I tried that with 10.10 from here Download | Ubuntu (http://www.ubuntu.com/desktop/get-ubuntu/windows-installer) but that's where I had my problems. So you think I should try 10.4 and then upgrade?

i would it worked for me 10.4 duel boot then did the 10.10 complete system and left windows and unfortunately all my theme files behind lol

Droid-Xer
02-01-2011, 03:19 AM
Nice! I have minimal knowledge in Linux but I just want to mess around with it and see what I can learn. I have moderate know how in Java so I'm not sure how that will help, but I'm just looking to explore something other than windows.

cush2push
02-01-2011, 03:41 AM
Nice! I have minimal knowledge in Linux but I just want to mess around with it and see what I can learn. I have moderate know how in Java so I'm not sure how that will help, but I'm just looking to explore something other than windows.

linux is pretty straight forward i dont ever want to go back to windows i use virtual box for my windows theme needs and thats about it othre than that linux is king imo

Droid-Xer
02-01-2011, 03:52 AM
Well I'll post back tomorrow if I can get it going. Thanks for the tips.

cush2push
02-01-2011, 04:28 AM
Well I'll post back tomorrow if I can get it going. Thanks for the tips.

anytime:android-dance:

RayBan
03-02-2011, 11:22 PM
nice write-up maderschramm! great work -- i'm gonna give this a go. it's about time to update my ubuntu on my mac :D (i know, i know...running mac AND ubuntu is like heresy to some people... on top of that, i have an android sticker on my mac (one on my car too!)...and people stare and ask "what gives?" lol)

RayBan
03-02-2011, 11:24 PM
Nice! I have minimal knowledge in Linux but I just want to mess around with it and see what I can learn. I have moderate know how in Java so I'm not sure how that will help, but I'm just looking to explore something other than windows.

prepare to be amazed... linux is the BEST. there's nothing like it. it makes my mac look like an eMachine.

furbearingmammal
03-02-2011, 11:29 PM
prepare to be amazed... linux is the BEST. there's nothing like it. it makes my mac look like an eMachine.

IF you can get it to work 100%. I enjoyed my Linux experiments, though. A Puppy Linux CD is one of the best emergency tools anyone can offer as a stop-gap solution to a virus-infected PC. It might not let you FIX the PC, but it'll let people get online.

Nice writeup, maderschramm! :)

RayBan
03-02-2011, 11:57 PM
IF you can get it to work 100%.

yeah...i dont like talking about the time that i formatted my 10.04 32-bit partition that was WORKING PERFECTLY so that i could install 10.10 64-bit ... only to realize that in-between i had updated my mac to 10.6 snow leopard...which conveniently locks the boot partition (pattern, much?)...suuucks. so now i have a fun road ahead of me to get it 10.10 64-bit installed properly so it boots without killing my primary mac efs boot partition at the same time... :android-displeased:

furbearingmammal
03-03-2011, 12:01 AM
But the Mac is better, right? :lousyputer_smilie::lousyputer_smilie::angel4:

Droid-Xer
03-03-2011, 12:05 AM
Finally got Ubuntu 10.10 dual booted alongside my Vista 32bit. Beyond sweetness! Still just messing around with and trying to find my way around.

SLAG IT!
03-14-2011, 05:29 PM
Thanks everyone I am going to check it out. Hope it is easy to learn.

SLAG IT!
03-20-2011, 06:08 PM
Where do I sign the kernel? Second... I have a ROM but I can not get my boot animation working. Any help would be appreciated.

cush2push
03-21-2011, 03:22 AM
Where do I sign the kernel? Second... I have a ROM but I can not get my boot animation working. Any help would be appreciated.


are you buildn a custom kernel as well? as for the boot animation in your compiled rom place it in system/media make sure its named bootanimation.zip

SLAG IT!
03-23-2011, 08:17 PM
yes, that is my goal. Thanks for the bootanimation tip. I did that and still did not work.. Is it size limited? I have one that works on my old G1... but cannot remember if it is limited to a certain Mb size.

RayBan
03-23-2011, 08:21 PM
Nah I had the "red rage" boot ani back in the day and it was like 15mb lol but it was crazy cool tho.

Is the permission set to 644 (rw-r-r--)?

Sent from my Droid using Android.net App

SLAG IT!
03-23-2011, 08:57 PM
I am not sure what I set it at. I know that I had one that worked on it. I wanted to swap it out with a new one that I have been working on, but all I got was a black screen. Why I thought I would ask here.

SLAG IT!
03-26-2011, 10:29 PM
I am having a hard time setting up this. I can get all the way up to where it says [sudo apt-get install git-core gnupg flex bison gperf build-essential zip curl sun-java5-jdk zlib1g-dev gcc-multilib g++-multilib libc6-dev-i386 lib32ncurses5-dev ia32-libs x11proto-core-dev libx11-dev lib32readline5-dev lib32z-dev]. It says libc6-dev-i386 not available and when I try and when I enter [sudo update-java-alternatives -s java-1.5.0-sun] it comes back with update-java-alternatives: directory does not exist: /usr/lib/jvm/java-1.5.0-sun.

cush2push
03-26-2011, 11:49 PM
I am having a hard time setting up this. I can get all the way up to where it says [sudo apt-get install git-core gnupg flex bison gperf build-essential zip curl sun-java5-jdk zlib1g-dev gcc-multilib g++-multilib libc6-dev-i386 lib32ncurses5-dev ia32-libs x11proto-core-dev libx11-dev lib32readline5-dev lib32z-dev]. It says libc6-dev-i386 not available and when I try and when I enter [sudo update-java-alternatives -s java-1.5.0-sun] it comes back with update-java-alternatives: directory does not exist: /usr/lib/jvm/java-1.5.0-sun.

sounds like java 5 isnt installed are you building froyo or gb?
if youre using gb java 6 is the onw you need what guide are you using ?

roboguy12
02-02-2012, 12:19 AM
I know earlier on you said you were running Ubuntu; I was just wondering if this also worked for Red Hat?