[TUT] Build your own AOSP Rom

Discussion in 'Android Hacks and Help' started by jdkoreclipse, Nov 27, 2010.

  1. jdkoreclipse
    Offline

    jdkoreclipse New Member

    Joined:
    Sep 2, 2010
    Messages:
    82
    Likes Received:
    0
    Trophy Points:
    0
    This is for the HTC Incredible, see post below for the Droid1

    First off, i want to say that this is information taken from various sources, the most predominant being start [CVPCS Android Wiki] and Get Android Source Code | Android Open Source . The only thing i contributed to this guide was that i condensed it a bit and customized it specifically for the incredible, although the only thing that differs from the incredible to other devices it the vendor setup.

    WARNING: This is NOT FOR NOOBS. If you havent had much experience with working with the Android System, you should not even think about using this guide.

    This is a guide for building AOSP on Ubuntu Lucid Lynx (10.04). If you have Mac, i cant help you much. If you have Windows, i strongly reccommend that if you havent already done so, download Ubuntu onto a CDROM and run wubi.exe to trial ubuntu.

    THERE WILL NEVER BE A GUIDE FOR BUILDING ON WINDOWS!!!!!!!!!

    Ok, so now that all that stuff is over, heres your guide:

    First, we want to install java5. Java6, the newest java is NOT supported due to @Override incompatibilities

    Code: sudo apt-get install git-core gnupg sun-java5-jdk flex bison gperf libsdl-dev libesd0-dev libwxgtk2.6-dev build-essential zip curl libncurses5-dev zlib1g-dev

    You might also want Valgrind, a tool that will help you find memory leaks, stack corruption, array bounds overflows, etc.

    Code: sudo apt-get install valgrind

    Set the system to use the right version of java by default:

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

    Now to install the repo

    Code: cd ~/
    mkdir bin
    echo $PATH

    Download thereposcript and make sure it is executable:

    Code: curl http://android.git.kernel.org/repo >~/bin/repo chmod
    a+x ~/bin/repo

    Create an empty directory to hold your working files:

    Code: mkdir mydroid
    cd mydroid

    Run "repo init" to bring down the latest version of Repo with all its most recent bug fixes. You must specify a URL for the manifest:


    Code: repo init -u git://android.git.kernel.org/platform/manifest.git -b gingerbread

    When prompted, configure Repo with your real name and email address. If you plan to submit code, use an email address that is associated with a Google account .
    A successful initialization will end with a message such as repo initialized in /mydroid

    Now to download all the files you need.

    To pull down files to your working directory from the repositories as specified in the default manifest, run

    Code: repo sync

    NOTE: The repo sync does tend to take a little long, after all it is 2.1 gigs of files

    Now to verify the git tags. Doing this wont affect the build, but it doesnt hurt.

    In your command prompt, type:

    Code: gpg --import

    and paste this LONG key into the empty space:

    Code:
    -----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-----

    And press ctrl d to exit the gpg mode and verify the git tags.

    Now to setup the vendor overlay:

    Code:
    cd ~/mydroid/system/device
    cd htc
    mkdir inc
    cd inc
    git clone http://github.com/Cyanogenmod/android_device_htc_inc/tree/gingerbread.git inc

    Code: cd ~/android/system/device/htc/inc
    ./extract-files.sh

    NOTE: ADB Must be in your path. You also have to edit the extractfiles.sh so that it reads ./adb pull and not adb pull (add nix boxes)

    Now to build the build:

    Code: cd ~/mydroid/system
    . build/envsetup.sh
    lunch generic_inc-userdebug
    make -j`grep 'processor' /proc/cpuinfo | wc -l` otapackage

    Troubleshooting:

    Ok, lets say you get an error. most likely its librpc. What you have to do is

    Code: make clean
    make librpc

    Also, you may have to edit some files, add in some proprietaries, so whatch those errors carefully! (also, you may get an error about recovrty not being made...all you have to do is replace the word "mahimahi" in the file to "inc")


    If the build fails because of java, enter this:

    Code: export ANDROID_JAVA_HOME=$JAVA_HOME
    export $PATH

    Adding SU:
    This is a bit of a workaround for now, but this is how i did it:
    1) Drag and drop superuser.apk from an existing rom and prop it into system/app of your AOSP rom
    2) DRag and drop the su binary from an existing rom and drop it into your AOSP rom (in system/bin)

    Disabling Recovery:
    go to the root of the rom (in the part where it says "system, Boot.img, META-Inf, recovery-prerec") and delete meta-inf, recovery-prerec. Add in the Meta-INF from HERE (http://bit.ly/gBO1N1), and viola, an AOSP rom with root is born!
  2. jdkoreclipse
    Offline

    jdkoreclipse New Member

    Joined:
    Sep 2, 2010
    Messages:
    82
    Likes Received:
    0
    Trophy Points:
    0
    This is a tutorial for the Droid1, for the HTC Incredible, See Above!

    First off, i want to say that this is information taken from various sources, the most predominant being start [CVPCS Android Wiki] and Get Android Source Code | Android Open Source . The only thing i contributed to this guide was that i condensed it a bit and customized it specifically for the incredible, although the only thing that differs from the incredible to other devices it the vendor setup.

    WARNING: This is NOT FOR NOOBS. If you havent had much experience with working with the Android System, you should not even think about using this guide.

    This is a guide for building AOSP on Ubuntu Lucid Lynx (10.04). If you have Mac, i cant help you much. If you have Windows, i strongly reccommend that if you havent already done so, download Ubuntu onto a CDROM and run wubi.exe to trial ubuntu.

    THERE WILL NEVER BE A GUIDE FOR BUILDING ON WINDOWS!!!!!!!!!

    Ok, so now that all that stuff is over, heres your guide:

    First, we want to install java5. Java6, the newest java is NOT supported due to @Override incompatibilities

    Code: sudo apt-get install git-core gnupg sun-java5-jdk flex bison gperf libsdl-dev libesd0-dev libwxgtk2.6-dev build-essential zip curl libncurses5-dev zlib1g-dev

    You might also want Valgrind, a tool that will help you find memory leaks, stack corruption, array bounds overflows, etc.

    Code: sudo apt-get install valgrind

    Set the system to use the right version of java by default:

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

    Now to install the repo

    Code: cd ~/
    mkdir bin
    echo $PATH

    Download thereposcript and make sure it is executable:

    Code: curl http://android.git.kernel.org/repo >~/bin/repo chmod
    a+x ~/bin/repo

    Create an empty directory to hold your working files:

    Code: mkdir mydroid
    cd mydroid

    Run "repo init" to bring down the latest version of Repo with all its most recent bug fixes. You must specify a URL for the manifest:


    Code: repo init -u git://android.git.kernel.org/platform/manifest.git -b gingerbread

    When prompted, configure Repo with your real name and email address. If you plan to submit code, use an email address that is associated with a Google account .
    A successful initialization will end with a message such as repo initialized in /mydroid

    Now to download all the files you need.

    To pull down files to your working directory from the repositories as specified in the default manifest, run

    Code: repo sync

    NOTE: The repo sync does tend to take a little long, after all it is 2.1 gigs of files

    Now to verify the git tags. Doing this wont affect the build, but it doesnt hurt.

    In your command prompt, type:

    Code: gpg --import

    and paste this LONG key into the empty space:

    Code:
    -----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
    M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IACQUCSedYRAIbDAAKCRDorT+BmrEOeCUOAJ9qmR0l
    EXzeoxcdoafxqf6gZlJZlACgkWF7wi2YLW3Oa+jv2QSTlrx4KLM=
    =Wi5D
    -----END PGP PUBLIC KEY BLOCK-----

    And press ctrl d to exit the gpg mode and verify the git tags.

    Now to setup the vendor overlay:

    Code:
    cd ~/mydroid/system/device

    mkdir motorola
    cd motorola
    mkdir sholes
    cd sholes
    git clone http://github.com/Cyanogenmod/android_device_motorola_sholes/tree/gingerbread.git sholes

    Code: cd ~/android/system/device/motorola/sholes
    ./extract-files.sh

    NOTE: ADB Must be in your path. You also have to edit the extractfiles.sh so that it reads ./adb pull and not adb pull (add nix boxes)

    Now to build the build:

    Code: cd ~/mydroid/system
    . build/envsetup.sh
    lunch generic_sholes-userdebug
    make -j`grep 'processor' /proc/cpuinfo | wc -l` otapackage

    Troubleshooting:

    Ok, lets say you get an error. most likely its librpc. What you have to do is

    Code: make clean
    make librpc

    Also, you may have to edit some files, add in some proprietaries, so whatch those errors carefully! (also, you may get an error about recovrty not being made...all you have to do is replace the word "mahimahi" in the file to "sholes")


    If the build fails because of java, enter this:

    Code: export ANDROID_JAVA_HOME=$JAVA_HOME
    export $PATH

    Adding SU:
    This is a bit of a workaround for now, but this is how i did it:
    1) Drag and drop superuser.apk from an existing rom and prop it into system/app of your AOSP rom
    2) DRag and drop the su binary from an existing rom and drop it into your AOSP rom (in system/bin)

    Disabling Recovery:
    go to the root of the rom (in the part where it says "system, Boot.img, META-Inf, recovery-prerec") and delete meta-inf, recovery-prerec. Add in the Meta-INF from HERE (http://bit.ly/gBO1N1), and viola, an AOSP rom with root is born!
  3. pc747
    Offline

    pc747 DF Administrator Staff Member Rescue Squad

    Joined:
    Dec 23, 2009
    Messages:
    17,513
    Likes Received:
    1,050
    Trophy Points:
    113
    good write up would like to move to hack section and stick with your permission.
  4. jdkoreclipse
    Offline

    jdkoreclipse New Member

    Joined:
    Sep 2, 2010
    Messages:
    82
    Likes Received:
    0
    Trophy Points:
    0
    Please do that...thanks

    Sent from my ADR6300 using Tapatalk
  5. Tanknspank
    Offline

    Tanknspank Beta Team Premium Member

    Joined:
    Jan 13, 2010
    Messages:
    3,506
    Likes Received:
    0
    Trophy Points:
    0
    Location:
    North Carolina
    I would look into adding how to add superuser, su, disabling recovery, and how to make an otapackage. Just a few things it seems to be missing right now. Also, cleaning up the post and making it a bit more organized would help out a lot.

    But, right now, you have a very nice base for a guide! Continue to work on it, and I'm sure it will turn out VERY nice!
  6. jdkoreclipse
    Offline

    jdkoreclipse New Member

    Joined:
    Sep 2, 2010
    Messages:
    82
    Likes Received:
    0
    Trophy Points:
    0
    Added in some more info...btw this is a tutorial for the Droid Incredible, but the only difference is the vendor setup, so please take note of that.

    EDIT: Made a Droid1 version in the second post! For all you droid1 owners, you now have a tutorial too.
  7. htc(hot-taco-cheese)
    Offline

    htc(hot-taco-cheese) Premium Member Theme Developer Premium Member

    Joined:
    Jul 5, 2010
    Messages:
    46
    Likes Received:
    0
    Trophy Points:
    0
    Thankyou! I will have to change my java
  8. jdkoreclipse
    Offline

    jdkoreclipse New Member

    Joined:
    Sep 2, 2010
    Messages:
    82
    Likes Received:
    0
    Trophy Points:
    0
    Your welcome:)

    Java6 is only for CyanogenMod...java5 for everything else.

    Sent from my ADR6300 using Tapatalk
  9. Tanknspank
    Offline

    Tanknspank Beta Team Premium Member

    Joined:
    Jan 13, 2010
    Messages:
    3,506
    Likes Received:
    0
    Trophy Points:
    0
    Location:
    North Carolina
    it's as simple as changing 2 lines from 1.5 to 1.6 to get it to use java6. that's what I did :p
  10. jdkoreclipse
    Offline

    jdkoreclipse New Member

    Joined:
    Sep 2, 2010
    Messages:
    82
    Likes Received:
    0
    Trophy Points:
    0
    Exactly...i d0 that all the time when i switch to building aosp from CyanogenMod


    Sent from my ADR6300 using Tapatalk
  11. Tanknspank
    Offline

    Tanknspank Beta Team Premium Member

    Joined:
    Jan 13, 2010
    Messages:
    3,506
    Likes Received:
    0
    Trophy Points:
    0
    Location:
    North Carolina
    well what I was saying is that with changing those two lines, my aosp build builds fine.
  12. jdkoreclipse
    Offline

    jdkoreclipse New Member

    Joined:
    Sep 2, 2010
    Messages:
    82
    Likes Received:
    0
    Trophy Points:
    0
    So does mine


    Sent from my ADR6300 using Tapatalk
  13. htc(hot-taco-cheese)
    Offline

    htc(hot-taco-cheese) Premium Member Theme Developer Premium Member

    Joined:
    Jul 5, 2010
    Messages:
    46
    Likes Received:
    0
    Trophy Points:
    0
    ok thanks! I use java6 for some online courses that i am taking. Good to hear that is isn't too difficult to switch from one to the other.

    I will start this after I finish my holiday/winter themes.
  14. Tanknspank
    Offline

    Tanknspank Beta Team Premium Member

    Joined:
    Jan 13, 2010
    Messages:
    3,506
    Likes Received:
    0
    Trophy Points:
    0
    Location:
    North Carolina
    I will post up what the file and lines are for you to change after I eat. Easy as changing a 1.5 to a 1.6.

    Sent from my Full Android using Tapatalk
  15. jdkoreclipse
    Offline

    jdkoreclipse New Member

    Joined:
    Sep 2, 2010
    Messages:
    82
    Likes Received:
    0
    Trophy Points:
    0
    all you have to do is renaqme the "java alternatives" line and the sun java line correct?,
  16. maderschramm
    Offline

    maderschramm Member

    Joined:
    Jul 2, 2010
    Messages:
    672
    Likes Received:
    0
    Trophy Points:
    16
    Location:
    Madison, WI
    link is broken :(
    https://github.com/koush/android_device_motorola_sholes.git
    also had trouble in this section:
    Code:
    mkdir mydroid 
              cd mydroid
    
    Run "repo init" to bring down the latest version of Repo with all its  most recent bug fixes. You must specify a URL for the manifest:
    
    
    Code:  repo init -u git://android.git.kernel.org/platform/manifest.git -b froyo
    had to move back a directory to ~/bin even after updating my PATH, else it said the command was not found.

    Also you should include instructions on how to install java5-jdk on 10.04
    gave me a little bit of trouble (~30 mins worth)

    You also need to type ./repo after chmodding it.

    There's also no /bin/<mydroid>/system/device directory. The dirs I have listed after the repo sync in /bin/<mydroid>/system are: bluetooth core extras netd vold wlan



    Worst comes to worst I can still stumble through it by making dirs and running everything from ~/bin but the broken link is the end of the road for your tutorial at this time. :( help please? I'd like to learn how to do this
  17. jdkoreclipse
    Offline

    jdkoreclipse New Member

    Joined:
    Sep 2, 2010
    Messages:
    82
    Likes Received:
    0
    Trophy Points:
    0
    I'll fix
    Sent from my HTC Incredible using DroidForums App
  18. neubanks89
    Offline

    neubanks89 New Member

    Joined:
    Dec 16, 2009
    Messages:
    130
    Likes Received:
    0
    Trophy Points:
    0
    can you post a how-to on getting adb to work on ubuntu or maybe how we could extract the files for the vendor settup on an os that adb actually works on.

    EDIT: so i ended up changing the extract-files script to cp files from a the rom I installed on my phone by passing adb all together. I have it building now
  19. neubanks89
    Offline

    neubanks89 New Member

    Joined:
    Dec 16, 2009
    Messages:
    130
    Likes Received:
    0
    Trophy Points:
    0
    I got the rom compiled and it installs/loads perfectly however there is no data, 3G or wifi. wifi sees SSID's but nothing actually happens. Anyone got an idea?
  20. thinkmega
    Offline

    thinkmega New Member

    Joined:
    Jun 10, 2010
    Messages:
    285
    Likes Received:
    0
    Trophy Points:
    0
    Thanks for the write up! Very insightful.

    Here is my question: what should I do if I just want to compile the kernel itself (D1)? Is the kernel a subset of the entire android code? How to find out which portion of it belong to the kernel?

    Thanks.

Search tags for this page
android.mk:1: *** missing separator. stop.
,
build aosp for htc
,
build aosp for other devices
,
create aosp rom
,
how to build an aosp rom from source
,

how to build aosp rom

,
how to build custom rom from aosp
,
how to build rom from github
,
how to edit aosp
,
how to make a aosp rom
,
mk-@tut.by
,
unable to locate package libwxgtk2.6-dev