Mourta

Building Vanir with Mourta

Recommended Posts

A simple way to build Vanir using my sources so you can change optimizations, settings or add to the project.

You'll need a Linux version that is capable of building Android (it has to be 64bit), i recommend and use Ubuntu 16.04.

Setting up your build environment:

First of all, let's ensure you have the correct version of Java by removing whatever version you have:

sudo apt-get remove openjdk-* icedtea-* icedtea6-*

Then we'll install the correct version of java:

sudo add-apt-repository ppa:openjdk-r/ppa
sudo apt-get update && sudo apt-get install openjdk-7-jdk

Now get the rest of the tools we need to build it:

sudo apt-get install git ccache automake lzop bison gperf build-essential zip curl zlib1g-dev zlib1g-dev:i386 g++-multilib python-networkx libxml2-utils bzip2 libbz2-dev libbz2-1.0 libghc-bzlib-dev squashfs-tools pngcrush schedtool dpkg-dev liblz4-tool make optipng maven

Now let's get the tool we'll use to download all of the code:

mkdir ~/bin && curl http://commondatastorage.googleapis.com/git-repo-downloads/repo > ~/bin/repo && chmod a+x ~/bin/repo

Next up, let's ensure we can use "repo" and enable "ccache" by adding the following to ~/.bashrc:

echo export PATH=~/bin:$PATH >> ~/.bashrc && echo export USE_CCACHE=1 >> ~/.bashrc

Ensure that ~/.bashrc is read to activate the new variables:

source ~/.bashrc

 

Get the code:

First make a directory to store the code in:

mkdir -p ~/Source/Vanir

Change to that directory:

cd ~/Source/Vanir

Now set up the repository:

repo init -u git://github.com/VanirAOSP/platform_manifest.git -b m6

Get the code, this is over 50GB to download:

repo sync

Now get my stuff:

curl -L -o .repo/local_manifests/roomservice.xml -O -L https://bitbucket.org/mourta/build-mourta-vanir/raw/005e513dfda3e9e04347edd3aeb2822a7f793a95/roomservice.xml && curl -L -o build-mourta.sh -O -L https://bitbucket.org/mourta/build-mourta-vanir/raw/005e513dfda3e9e04347edd3aeb2822a7f793a95/build-mourta.sh

Sync it up again with my repos:

repo sync

Vanir needs to have vanir.mk under vendor/vanir/products/vanir_p880.mk to lunch properly so let's copy it to there:

cp device/lge/p880/vanir.mk vendor/vanir/products/vanir_p880.mk

Now build it, depending on your hardware this may take anywhere from 1 hour to 9 hours.

./build-mourta.sh

 

You'll find your ROM in ~/Source/Vanir/out/target/product/p880/ when it's done.

 

Happy building.

 

Share this post


Link to post
Share on other sites
7 hours ago, NothingSerious said:

More like time consuming tbh.

Yeah, the hard work lies in making everything work together, after that it's just a waiting game.

Share this post


Link to post
Share on other sites
8 hours ago, gugu6897 said:

50Gb emoji46.pngemoji28.png. Nicely explained tutorial. I will try it later and give feedback.

You'll need another 50GB to build it and preferably another 10GB for ccache.

You'll only download that much once though, after that it's a few MB's that get downloaded every time you run ./build-mourta.sh

Share this post


Link to post
Share on other sites
You'll need another 50GB to build it and preferably another 10GB for ccache.

You'll only download that much once though, after that it's a few MB's that get downloaded every time you run ./build-mourta.sh

I got it. I will try to clean up 110Gb for VirtualBox xD. If I can and my internet cooperate I will try to do something.

Share this post


Link to post
Share on other sites
16 minutes ago, gugu6897 said:

I got it. I will try to clean up 110Gb for VirtualBox xD. If I can and my internet cooperate I will try to do something.

Nonono don't you dare use a Virtual Machine for this kind of stuff, it will just take forever to build.

Share this post


Link to post
Share on other sites
On 2016-08-02 at 9:16 PM, NothingSerious said:

Nonono don't you dare use a Virtual Machine for this kind of stuff, it will just take forever to build.

Depends on what hardware he's sporting. With enough memory and a decent CPU it may only take 3-6 hours. ;)

Of course, you'll need about 20 or so cores to achieve a result under 6 hours and with most hardware it will take 12-15 hours.

Just install Linux, you can install it as an application right there in windows and run it on a loop file on your windows partition that will expand with the amount of stuff you use in Linux.

Edited by Mourta

Share this post


Link to post
Share on other sites

I tried to build this a lot of times. Since I am on Arch Linux, I had to change the first line of the repo executable, since on Arch it uses by default python 3 which, it seems, is not compatible. 
The file common_phones.mk in ~/Source/Vanir/vendor/vanir/config/ does not exist and it gave me an error about it. I think that file is called cmsdk_common.mk instead, so I renamed it.
Anyway, everything works well except for some "unable to reach host bla bla bla" while syncing the repo, but it does not complain and it seems repo is able to download and sync everything.

When I hit 

./build-mourta.sh

I get an error about a patch that fails, as follows:

[ frameworks/opt/telephony ]
Applying: Implement UICC TLV Data decoding.
error: patch failed: src/java/com/android/internal/telephony/uicc/IccFileHandler.java:359
error: src/java/com/android/internal/telephony/uicc/IccFileHandler.java: patch does not apply
error: src/java/com/android/internal/telephony/uicc/UiccTlvData.java: already exists in index
Patch failed at 0001 Implement UICC TLV Data decoding.
The copy of the patch that failed is found in: .git/rebase-apply/patch
When you have resolved this problem, run "git am --continue".
If you prefer to skip this patch, run "git am --skip" instead.
To restore the original branch and stop patching, run "git am --abort".

It continues, apparently this error does not influence the building process, but after a while I get:

Notice file: external/conscrypt/NOTICE -- /home/michael/Source/Vanir/out/host/linux-x86/obj/NOTICE_FILES/src//bin/conscrypt_generate_constants.txt
Notice file: external/boringssl/NOTICE -- /home/michael/Source/Vanir/out/host/linux-x86/obj/NOTICE_FILES/src//lib64/libcrypto-host.so.txt
Traceback (most recent call last):
  File "build/tools/merge-event-log-tags.py", line 99, in <module>
    tagfile = event_log_tags.TagFile(fn)
  File "/home/michael/Source/Vanir/build/tools/event_log_tags.py", line 70, in __init__
    parts = re.split(r"\s+", line, 2)
  File "/usr/lib/python3.5/re.py", line 203, in split
    return _compile(pattern, flags).split(string, maxsplit)
TypeError: cannot use a string pattern on a bytes-like object
make: *** [build/core/Makefile:458: /home/michael/Source/Vanir/out/target/common/obj/all-event-log-tags.txt] Error 1
make: *** Waiting for unfinished jobs....
Notice file: external/boringssl/NOTICE -- /home/michael/Source/Vanir/out/host/linux-x86/obj/NOTICE_FILES/src//lib64/libssl-host.so.txt
Note: Some input files use or override a deprecated API.
Note: Recompile with -Xlint:deprecation for details.
Note: Some input files use unchecked or unsafe operations.
Note: Recompile with -Xlint:unchecked for details.

#### make failed to build some targets (44 seconds) ####

It seems to be an error related to some misused function.
Thank you in advance for any help.
 

Share this post


Link to post
Share on other sites
I tried to build this a lot of times. Since I am on Arch Linux, I had to change the first line of the repo executable, since on Arch it uses by default python 3 which, it seems, is not compatible. 

The file common_phones.mk in ~/Source/Vanir/vendor/vanir/config/ does not exist and it gave me an error about it. I think that file is called cmsdk_common.mk instead, so I renamed it.

Anyway, everything works well except for some "unable to reach host bla bla bla" while syncing the repo, but it does not complain and it seems repo is able to download and sync everything.

When I hit 

./build-mourta.sh

I get an error about a patch that fails, as follows:

[ frameworks/opt/telephony ]Applying: Implement UICC TLV Data decoding.error: patch failed: src/java/com/android/internal/telephony/uicc/IccFileHandler.java:359error: src/java/com/android/internal/telephony/uicc/IccFileHandler.java: patch does not applyerror: src/java/com/android/internal/telephony/uicc/UiccTlvData.java: already exists in indexPatch failed at 0001 Implement UICC TLV Data decoding.The copy of the patch that failed is found in: .git/rebase-apply/patchWhen you have resolved this problem, run "git am --continue".If you prefer to skip this patch, run "git am --skip" instead.To restore the original branch and stop patching, run "git am --abort".

It continues, apparently this error does not influence the building process, but after a while I get:

Notice file: external/conscrypt/NOTICE -- /home/michael/Source/Vanir/out/host/linux-x86/obj/NOTICE_FILES/src//bin/conscrypt_generate_constants.txtNotice file: external/boringssl/NOTICE -- /home/michael/Source/Vanir/out/host/linux-x86/obj/NOTICE_FILES/src//lib64/libcrypto-host.so.txtTraceback (most recent call last):  File "build/tools/merge-event-log-tags.py", line 99, in     tagfile = event_log_tags.TagFile(fn)  File "/home/michael/Source/Vanir/build/tools/event_log_tags.py", line 70, in __init__    parts = re.split(r"\s+", line, 2)  File "/usr/lib/python3.5/re.py", line 203, in split    return _compile(pattern, flags).split(string, maxsplit)TypeError: cannot use a string pattern on a bytes-like objectmake: *** [build/core/Makefile:458: /home/michael/Source/Vanir/out/target/common/obj/all-event-log-tags.txt] Error 1make: *** Waiting for unfinished jobs....Notice file: external/boringssl/NOTICE -- /home/michael/Source/Vanir/out/host/linux-x86/obj/NOTICE_FILES/src//lib64/libssl-host.so.txtNote: Some input files use or override a deprecated API.Note: Recompile with -Xlint:deprecation for details.Note: Some input files use unchecked or unsafe operations.Note: Recompile with -Xlint:unchecked for details.#### make failed to build some targets (44 seconds) ####

It seems to be an error related to some misused function.

Thank you in advance for any help.

 

Remove device/lge/p880/patches/frameworks_opt_telephony. These patches are already in the Vanor Repo now.

Then just run the build again.

Share this post


Link to post
Share on other sites

Repos updated, don't forget to sync before you build, we're now using open source security services which means no more adaptations from user.

 

Yeah, you read that right, no more of the bullshit, you compile it and you're done, you want to make changes then be a dev, test your changes and push them upstream, it's the only way to fix it.

Share this post


Link to post
Share on other sites

I was finally able to compile this, yeah! :)

On Arch, I also had to install rsync and ncurses5-compat-libs.

Some useful info (valid for me at least):
- Build time: 1 hour 33 minutes
- RAM: 8 GB
- CPU: Intel Core i5-3570k (4 cores @ 3.40GHz)
- Total space needed is a little less than 75 GB

 

Edited by Alogim

Share this post


Link to post
Share on other sites
I was finally able to compile this, yeah! :)

On Arch, I also had to install rsync and ncurses5-compat-libs.

Some useful info (valid for me at least):

- Build time: 1 hour 33 minutes

- RAM: 8 GB

- CPU: Intel Core i5-3570k (4 cores @ 3.40GHz)

- Total space needed is a little less than 75 GB

 

The space needed varies and as ccache fillls up it grows while compile time decreases.

Good for you. You can now build pretty much any ROM you want to with minor fixes to the device tree and patches.

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now


MoDaCo is part of the MoDaCo.network, © Paul O'Brien 2002-2016. MoDaCo uses IntelliTxt technology.