Guide: How To Build AOSP 4.4.3 From Source With Linux Mint 16 - Nexus 5 KTU84M

Search This thread

jv.batista

Senior Member
Jan 25, 2011
908
181
36
Faro, Portugal
Google Pixel 8 Pro
By start from scratch I mean you just do all the steps in the guide on the fresh virtual machine install. The only time you don't need to do all the steps is if you've done a build and need to do a second build like I did for my Nexus 7 after my Nexus 5 or when the repos update to a new version after you've done a build already. In post #13 it says what to do if you're doing a second build. If it's your first build or a new install of linux or a new virtual box install of linux do all the steps right from the beginning of the guide. Hope that clarifies things. :p

P.S. Should be pretty fast with your virtual machine but it takes me close to an hour to download the source from the repo then another hour to actually build AOSP with a 6 core 12 thread I7 3930k and 32 gigs of ram. :rolleyes:

P.P.S. Sorry for the late night responses, I get home from work around 11 p.m. EST and like to game and stuff a bit before I do other things. Really busy at work, not much time to check here very often. :(

It builded ok with the vm :highfive:.

When I said start from scratch I was referring to a fresh vm install. the repo sync took something like one hour and the build I have no idea 'cause i left it during the night :p I started the build around 1AM and when I woke up @ 7 it was already finished :p(I passed out around the 1.5h mark).

Do you have an ssd on your machine? I think that could make a very big difference in the building times with that hardware... I'm running the vm on a i7 2630QM (just using 4 cores on the vm settings) and with 6gb of ram(had to bring it down from 8 'cause the first time I ran out of ram :eek:)

Today starts the process of modding the build but first I have to figure out if the source is on github and if it's not i need to send it before i start modifying the thing...

Thanks for the help

ps: and I don't have the code on git. something else went wrong when I took a snapshot of my vm. it is taking up 50gb of space. also, can you detail a little bit more the git part, assuming that everyone has an account and repo already done? how do we sync the local files with git, how to add the repository, etc

thanks again
 
Last edited:

KedarWolf

Senior Member
Apr 27, 2012
295
157
It builded ok with the vm :highfive:.

When I said start from scratch I was referring to a fresh vm install. the repo sync took something like one hour and the build I have no idea 'cause i left it during the night :p I started the build around 1AM and when I woke up @ 7 it was already finished :p(I passed out around the 1.5h mark).

Do you have an ssd on your machine? I think that could make a very big difference in the building times with that hardware... I'm running the vm on a i7 2630QM (just using 4 cores on the vm settings) and with 6gb of ram(had to bring it down from 8 'cause the first time I ran out of ram :eek:)

Today starts the process of modding the build but first I have to figure out if the source is on github and if it's not i need to send it before i start modifying the thing...

Thanks for the help

ps: and I don't have the code on git. something else went wrong when I took a snapshot of my vm. it is taking up 50gb of space. also, can you detail a little bit more the git part, assuming that everyone has an account and repo already done? how do we sync the local files with git, how to add the repository, etc

thanks again

I've never used GitHub so I'm not sure how it works. Sorry. :(
 

bariz143

Senior Member
Dec 11, 2009
2,229
413
Samsung Galaxy Z Fold 5
Problem solved with the time issue. Long story short :)

Now when the build works good it time to include superuser or supersu in the build and not flashed seperatly.

Someone know how to do that?
 

janres155

Senior Member
Feb 14, 2013
502
208
Hi @KedarWolf

I tried downloading the repo but it taking so long for me. My AOSP folder already have 14.9 GB of files and it is still syncing with the repo.
Could you please confirm the whole size of the branch KVT49L?

I only have a I5 laptop so I had to use -j12.

Regards,
Janres
 

KedarWolf

Senior Member
Apr 27, 2012
295
157
Hi @KedarWolf

I tried downloading the repo but it taking so long for me. My AOSP folder already have 14.9 GB of files and it is still syncing with the repo.
Could you please confirm the whole size of the branch KVT49L?

I only have a I5 laptop so I had to use -j12.

Regards,
Janres

When I get home from work around 11:00 p.m. EST I'll check my AOSP folder and let you know how big it is. I have an I7 3930k and an 80 mb/sec internet connection and it still takes me close to an hour to download the repo and and another hour to build the ROM. :rolleyes:
 

KedarWolf

Senior Member
Apr 27, 2012
295
157
Could someone tell me what i have to change to build SlimKAT rom using this guide?



https://github.com/SlimRoms/platform_manifest

Change the repo command to: repo init -u git://github.com/SlimRoms/platform_manifest.git -b kk4.4 and the rest should be the same I believe. :D

Oh wait, you don't do the binaries part I think, but I'm not 100% sure. You can try without the binaries, see if the ROM works okay, if it doesn't, try with the binaries. SlimKats is AOSP based, just not sure if they include the Google binaries in the build or you add them like in my guide.
 
Last edited:

KedarWolf

Senior Member
Apr 27, 2012
295
157
Problem solved with the time issue. Long story short :)

Now when the build works good it time to include superuser or supersu in the build and not flashed seperatly.

Someone know how to do that?

Guide is updated for the new AOSP 4.4.3. Not sure if it fixes the date problem but thought I'd let you know.
 
  • Like
Reactions: bariz143
Jan 25, 2012
48
14
Problem solved with the time issue. Long story short :)

Now when the build works good it time to include superuser or supersu in the build and not flashed seperatly.

Someone know how to do that?

I would also like to know how to do this. Do I just add the apk to the build or do I need to add the su binary to the rom somewhere?
 

DiamondBond

Senior Member
Jul 6, 2012
3,918
3,666
Limassol
Thanks for this great guide, so far only guide that has got me up to the part of building, about to start building now! :D

Heres a pic of the completed Sync... 21GB seemed a little light but it grew in size (hehe... :3) and finally reached 24GB and then i closed the properties, xD

qCFgRS3.png
 

qutuz

Member
Jun 7, 2013
17
3
ubuntu 14.04
got same problem make: *** [out/host/linux-x86/obj/EXECUTABLES/checkpolicy_intermediates/policy_parse.cpp] Broken pipe
 
Last edited:

maddoggin

Senior Member
Jul 6, 2010
2,820
3,055
corpus christ
i didnt see in the tutorial to install usb drivers or fastboot for nexus 5 is that not needed? installing the sdk/platform/tools can you access them from anywhere using terminal or do you have to open terminal in sdk/platform/tools? i had linux mate 15 on dual boot with windows but just installed mint 17 and erased windows so having to reinitialize my environment. thanks for the tutorial
 
Last edited:

X-15

Member
Mar 3, 2014
11
4
i didnt see in the tutorial to install usb drivers or fastboot for nexus 5 is that not needed? installing the sdk/platform/tools can you access them from anywhere using terminal or do you have to open terminal in sdk/platform/tools? i had linux mate 15 on dual boot with windows but just installed mint 17 and erased windows so having to reinitialize my environment. thanks for the tutorial

You can just build adb and fastboot with "make fastboot adb", shouldn't have to do anything with installing drivers IIRC.
 

Ahimsa310

Member
Dec 5, 2014
43
25
Woodbury
So i did this with Linix 17 and aosp 4.4.4

I also did make otapackage instead of just make.

I got a zip, but it wont flash with twrp 2.8.1.0

I get "error executing updater binary"

I tried unmounting system and that didn't work. I tried using a different roms meta inf folder and that didn't work either?

Any help?
 

Ahimsa310

Member
Dec 5, 2014
43
25
Woodbury
So i did this with Linix 17 and aosp 4.4.4

I also did make otapackage instead of just make.

I got a zip, but it wont flash with twrp 2.8.1.0

I get "error executing updater binary"

I tried unmounting system and that didn't work. I tried using a different roms meta inf folder and that didn't work either?

Any help?

Anyone?
 

Top Liked Posts

  • There are no posts matching your filters.
  • 22
    Guide: How To Build AOSP 4.4.3 From Source With Linux Mint 16 - Nexus 5 KTU84M

    Important Note: Do not use Linux Mint 16 KDE to do this guide. Removing the old Java will seriously mess up your desktop and programs menu. This guide has been tested with Linux Mint 16 Cinnamon and Linux Mint 16 Mate.

    Link to PA Gapps: http://xdaforums.com/showthread.php?t=2397942

    Link To SuperSu: http://download.chainfire.eu/supersu

    Link to zip of completely unaltered build of AOSP 4.4.3. https://drive.google.com/file/d/0ByOOg6Qw8gHZMXBWVDRyVmVuRWc/edit?usp=sharing

    I started this guide as I could not find a step by step detailed guide to build a stock AOSP from source with Linux Mint 16.

    All the steps should work in Ubuntu but I haven't tried so not 100% sure of that.

    All this assumes your phone is already unlocked.

    Here goes:

    Important note: Anything that is bolded text other then section titles are command line entries that are done in Terminal in Linux Mint. I thought it would be simpler to do it this way then say 'in Terminal' for every entry.

    First we need to remove Icedtea Java or OpenJDK.
    In Terminal: sudo apt-get purge openjdk-\* icedtea-\* icedtea6-\*
    Then in Terminal: sudo add-apt-repository ppa:webupd8team/java
    Next: sudo apt-get update && sudo apt-get install oracle-java6-installer

    Be sure to accept the licence agreement to install java when it prompts you.

    Next: sudo apt-get install git-core gnupg flex bison gperf build-essential zip curl zlib1g-dev zlib1g-dev:i386 libc6-dev lib32ncurses5-dev ia32-libs x11proto-core-dev libx11-dev:i386 libreadline6-dev:i386 lib32z-dev libgl1-mesa-glx:i386 libgl1-mesa-dev g++-multilib mingw32 tofrodos python-markdown libxml2-utils xsltproc readline-common libreadline6-dev libreadline6 lib32readline-gplv2-dev libncurses5-dev lib32readline5 lib32readline6 libreadline-dev libreadline6-dev:i386 libreadline6:i386 bzip2 libbz2-dev libbz2-1.0 libghc-bzlib-dev lib32bz2-dev libsdl1.2-dev libesd0-dev squashfs-tools pngcrush schedtool libwxgtk2.8-dev python

    Follow this with: sudo apt-get install -f
    This should fix any dependency errors.

    Now: sudo ln -s /usr/lib/i386-linux-gnu/mesa/libGL.so.1 /usr/lib/i386-linux-gnu/libGL.so

    Next download the SDK Tools For Linux x64 from this link. https://developer.android.com/sdk/index.html
    Then: cd ~/Downloads
    And: tar -xvf android-sdk_r22.6.2-linux.tgz
    or tab the latest 'android-sdk_xxx.tgz file it they update it and it is a newer version then the one I downloaded to do this.
    You can rename the android.sdk_xxx.tgz folder you extracted to SDK.
    Then: cd ~/Downloads/SDK/tools
    Next: ./android sdk
    It will show you the tools that can be installed, just install the highest version API of 'Platform Tools' and 'Tools' for the latest android version '4.4.x' it shows.

    Make sure you install the repo tool, in Terminal: mkdir ~/bin
    Then: curl https://dl-ssl.google.com/dl/googlesource/git-repo/repo > ~/bin/repo
    And: curl http://commondatastorage.googleapis.com/git-repo-downloads/repo > ~/bin/repo
    Now: sudo chmod a+x ~/bin/repo

    Now sudo nano ~/.bashrc
    Add this to the bottom of the text: export PATH=~/bin:$PATH
    Then hit Ctrl-O and enter, it should say it saved the file followed by Ctrl-X to exit.
    Then restart bash: source ~/.bashrc

    Now lets Initialize the Repository for GIT configuration
    First : git config --global user.name {Your Name}
    Then: git config --global user.email {Your@Email}
    If you have not registered with the GitHub website just doing these two steps works fine.

    If you have registered with the GitHub website create a file called .netrc in your home directory, add your GitHub password to it with no spaces on the first line and change the permissions to '600' or you will have to continually authenticate when building the source.
    In Terminal:nano ~/.netrc
    Then add just your GitHub password (like I said you only need to do this if you have registered with GitHub).
    Then 'Ctrl-O' and enter and it'll say it saved it, then 'Ctrl-X' to exit nano.
    And: chmod 0600 ~/.netrc

    Now: mkdir ~/AOSP
    Then: cd ~/AOSP

    Now you get the source code etc: repo init -u https://android.googlesource.com/platform/manifest -b android-4.4.3_r1.1
    Followed by: repo sync -j12
    Use repo sync -j12 for a quad core CPU or Intel I5 or if you have say an quad core I7 with 8 threads you can use repo sync -j24 to speed things up etc.
    I have a I7 3930k with 12 threads so I used repo sync -j36. This gives you three threads per logical CPU and speeds things along quite well.

    It may take several hours for the sync to finish.

    After the sync finishes go to https://developers.google.com/android/nexus/drivers#hammerheadktu84m and download the KTU84Mdrivers (binaries) for the Nexus 5.

    If you have closed the Terminal after the sync remember to first do this when you reopen it: cd ~/AOSP
    when you open Terminal again before doing the cp and tar commands.

    In Terminal: cp ~/Downloads/broadcom-hammerhead-ktu84m-175c1204.tgz ~/AOSP
    Then: cp ~/Downloads/lge-hammerhead-ktu84m-716c9c42.tgz ~/AOSP
    And: cp ~/Downloads/qcom-hammerhead-ktu84m-06019566.tgz ~/AOSP

    In Terminal: tar -xvf broadcom-hammerhead-ktu84m-175c1204.tgz
    And: tar -xvf lge-hammerhead-ktu84m-716c9c42.tgz
    then: tar -xvf qcom-hammerhead-ktu84m-06019566.tgz

    They should be the file names of the binaries for KTU84M that you are extracting but if for any reason the file names are different use the Tab key and tab the correct names in after 'tar -xvf'.
    If the names ARE different I'd really check to make sure you downloaded the correct hammerhead binaries.

    Now also in Terminal: ./extract-broadcom-hammerhead.sh
    Then: ./extract-lge-hammerhead.sh
    And: ./extract-qcom-hammerhead.sh

    Hint: It will show you a really long licence agreement for each binary that you scroll by hitting the Enter key that takes forever to scroll one line at a time, it has 8 sections and several subsections. Hold the Enter key until you just get past Part 8, section D of the licence and stop there. Now hit enter a few more time one key stroke at a time until you finish Part 8 section E and see the 'Type 'I ACCEPT' to agree to the licence.' and type I ACCEPT If you just scroll by holding the Enter key all the way to the bottom of the licence you'll get an error you never accepted the licence. Then close Terminal.

    Building the Sources

    Now open Terminal: cd ~/AOSP
    Then: . ./build/envsetup.sh
    Now to select the type of device we give the following command: lunch
    Choose: 9. aosp_hammerhead-userdebug
    by entering '9' or whatever number aosp_hammerhead is after your enter the 'lunch' command (it was number 9 on mine).

    Now: make -j12 for a quad core cpu or I5 or make -j24 for an I7 etc.

    With your phone connected to your USB cable and the PC: adb root
    Then: adb reboot bootloader
    And: cd out/target/product/hammerhead
    Lastly: fastboot -w flashall

    If you get an error on the 'adb' and 'fastboot' commands do these first:
    sudo apt-get install android-tools-adb
    And: sudo apt-get install android-tools-fastboot

    If you get an error when you fastboot -w flashall to do with a '-p' flag needed or 'android-info.txt' is missing it means you forgot to to the 'lunch' command before building the source. Go back to the 'Building The Sources' section.


    If you already have a custom recovery installed like TWRP and would rather build a zip file to install with the recovery rather Then flash it in adb instead of make -j12 do: make -j12 otapackage
    In the /home/"yourusername"/AOSP/out/target/product/hammerhead you have an aosp_hammerhead-ota-eng.___.zip file to flash in your custom recovery.
    You will need to wipe/reset data in recovery before flashing it and re-install all your apps etc.

    Installing Custom Recovery, Rooting and Google Apps

    If you want to install a custom recovery download TWRP http://techerrata.com/browse/twrp2/hammerhead
    Rename the file in Downloads to recovery.img
    Then in Terminal with your phone connected by USB to your PC: adb root
    And: adb reboot bootloader
    Then: cd ~/Downloads
    And: fastboot flash recovery recovery.img

    Use the volume buttons on your phone to scroll onto "Restart Bootloader" and hit the powerbutton to select it. After the bootloader reloads, use the volume buttons to scroll to "Recovery Mode" and hit power button again to select it. You should then be in your custom recovery.

    If for any reason you get a red android and no recovery just boot into fastboot mode again and reinstall the recovery.img.

    And finally, to root your phone download SuperSu http://download.chainfire.eu/supersu and install the supersu.zip in recovery mode.

    Download PA GAPPS from here http://xdaforums.com/showthread.php?t=2397942 if you want the zip to install Google Apps in recovery.

    You now have your own rooted vanilla AOSP you compiled yourself, congrats! :D

    P.S. Very likely a good idea wipe/reset data in recovery and start with a clean install, you'll need to install all your programs and stuff anyways I'm sure.

    P.P.S. I also installed the Xposed Framwork apk from this link http://xdaforums.com/xposed/framework-xposed-rom-modding-modifying-t1574401/post24267797 so I could install the Advanced Reboot Menu and some other useful mods.
    2
    Problem Fixed!

    When I extracted the binaries, I didn't do it in aosp so no vendor folder was created meaning no binaries were included in the ROM.

    Huge thanks to @RobbieL811 for helping me out. @dankoman as well. Slim team is the nicest group of guys. They both took a lot of time out of a couple of days trying to help me figure this out.
    1
    Thank you for that. But its just a patch to fix. How come its broken if it comes from google repo ? :S
    i compiled CM11 and no time issues there.

    Not sure, I've had no trouble that way. :(
    1
    Guide Updated

    Hi man great tutorial.

    I followed your tutorial exactly and it compiles very good and everything works great with flashing it to device to.

    I start the rom and everything is working but then if i reboot i get wrong date and time for 20sec and it goes back to current time and date.
    but i get like 10 notifications from all my google apps and it very anoying. and google now dont work till it gets synced.

    i thougt it was my build that had issues but i flashed your rom that you had compiled and it has the same issues.

    Did y have that issue?

    The guide has been updated to the KTV49L build which has several bug fixes from the old build. I'm not sure if the date issue has been fixed but if you want to try to build AOSP again just letting you know it is an option.
    1
    Thanks alot my friend. Just did as you said. And i can see in settings that it KVT build but the time issue is still there. I dont get it at all.
    im pissed.

    its like building a car and the wipers don't work.:(

    Sorry, only fix I know is the patch in the link I provided earlier. I have read of other people with the AOSP build have that issue, it's in that link. I don't why it never affected me, might be the settings I use for Time/Date but I've had zero issues that way. :(