Quantcast
Channel: xda-developers - Android Software and Hacking General [Developers Only]
Viewing all articles
Browse latest Browse all 3614

[Guide]How to download/compile specific ROM parts

$
0
0
This is a tutorial about how to download and compile specific parts in aosp based roms (such as CM10)
Written for AOSP noobs like me a year ago.

Note: I wrote this tutorial actually for my blog, as a beginners repo/compile tut, but why not share here ;)

Introduction:
Downloading rom sources is done with the tool “repo”, this is the most awesome downloader in existence. Not only it looks very cool, it also reaches top speed at all times. But it’s only for linux (which is good since when you are busy with aosp roms you should be on linux)
Why is it awesome? Since you decide yourself how many jobs (aka connections) you make with the server. This means you always will get top speed, there is probably no faster download method available on the Internet (except for speedtests, but they don’t count). Next to the downloading of specific parts it’s of course also handy to know how to actually compile them.


Download:
The easiest way of fetching for example a batch of AOSP apps is like this:

1. Choose the desired tag you want to use, in the example I will use android-4.2.2_r1

2. Now make a dir somewhere:

Code:

    - mkdir ~/aosp-apps
    - cd ~/aosp-apps

3. Download repo when not installed yet:
Code:

    - curl https://dl-ssl.google.com/dl/googlesource/git-repo/repo > ~/bin/repo
    - chmod a+x ~/bin/repo

4. Enter the line that will download the initial manifest.

for AOSP:
Code:

    - repo init -u https://android.googlesource.com/platform/manifest -b android-4.2.2_r1
Enter your name and email address and wait until it completes

for CM
Code:

    - repo init -u https://github.com/Cyanogenmod/android -b cm-10.1

5. Go in the hidden “.repo” dir and change the manifest

Code:

    - cd .repo
    - gedit manifest.xml (if you don’t have decent text editor such as “gedit”, install it! “sudo apt-get install gedit”

)

For example when you only want to download the apps, just remove all lines that are not app related. simple as that:

Code:

<?xml version=”1.0″ encoding=”UTF-8″?>
    <manifest>

    <remote  name=”aosp”
    fetch=”..” />
    <default revision=”refs/tags/android-4.2.2_r1″
    remote=”aosp”
    sync-j=”4″ />

    <project path=”packages/apps/BasicSmsReceiver” name=”platform/packages/apps/BasicSmsReceiver” />
    <project path=”packages/apps/Bluetooth” name=”platform/packages/apps/Bluetooth” />
    <project path=”packages/apps/Browser” name=”platform/packages/apps/Browser” />
    <project path=”packages/apps/Calculator” name=”platform/packages/apps/Calculator” />
    <project path=”packages/apps/Calendar” name=”platform/packages/apps/Calendar” />
    <project path=”packages/apps/Camera” name=”platform/packages/apps/Camera” />
    <project path=”packages/apps/CellBroadcastReceiver” name=”platform/packages/apps/CellBroadcastReceiver” />
    <project path=”packages/apps/CertInstaller” name=”platform/packages/apps/CertInstaller” />
    <project path=”packages/apps/Contacts” name=”platform/packages/apps/Contacts” />
    <project path=”packages/apps/DeskClock” name=”platform/packages/apps/DeskClock” />
    <project path=”packages/apps/Email” name=”platform/packages/apps/Email” />
    <project path=”packages/apps/Exchange” name=”platform/packages/apps/Exchange” />
    <project path=”packages/apps/Gallery” name=”platform/packages/apps/Gallery” />
    <project path=”packages/apps/Gallery2″ name=”platform/packages/apps/Gallery2″ />
    <project path=”packages/apps/HTMLViewer” name=”platform/packages/apps/HTMLViewer” />
    <project path=”packages/apps/KeyChain” name=”platform/packages/apps/KeyChain” />
    <project path=”packages/apps/Launcher2″ name=”platform/packages/apps/Launcher2″ />
    <project path=”packages/apps/LegacyCamera” name=”platform/packages/apps/LegacyCamera” />
    <project path=”packages/apps/Mms” name=”platform/packages/apps/Mms” />
    <project path=”packages/apps/Music” name=”platform/packages/apps/Music” />
    <project path=”packages/apps/MusicFX” name=”platform/packages/apps/MusicFX” />
    <project path=”packages/apps/Nfc” name=”platform/packages/apps/Nfc” />
    <project path=”packages/apps/PackageInstaller” name=”platform/packages/apps/PackageInstaller” />
    <project path=”packages/apps/Phone” name=”platform/packages/apps/Phone” />
    <project path=”packages/apps/Protips” name=”platform/packages/apps/Protips” />
    <project path=”packages/apps/Provision” name=”platform/packages/apps/Provision” />
    <project path=”packages/apps/QuickSearchBox” name=”platform/packages/apps/QuickSearchBox” />
    <project path=”packages/apps/Settings” name=”platform/packages/apps/Settings” />
    <project path=”packages/apps/SoundRecorder” name=”platform/packages/apps/SoundRecorder” />
    <project path=”packages/apps/SpareParts” name=”platform/packages/apps/SpareParts” />
    <project path=”packages/apps/SpeechRecorder” name=”platform/packages/apps/SpeechRecorder” />
    <project path=”packages/apps/Stk” name=”platform/packages/apps/Stk” />
    <project path=”packages/apps/Tag” name=”platform/packages/apps/Tag” />
    <project path=”packages/apps/VideoEditor” name=”platform/packages/apps/VideoEditor” />
    <project path=”packages/apps/VoiceDialer” name=”platform/packages/apps/VoiceDialer” />
    </manifest>

When done, save it and go a dir back in the terminal

Code:

    - cd ..
6. Download the packages

Code:

    - repo sync -j16 (-j16 stands for 16 jobs max. This is for around a 100mbit line)
(With my 60mb/s connection I get max speed 7.2mb/s at -j8)

The packages will be download as quickly as possible to your harddrive now.



Compile:
To compile the obtained packages separately you will need a AOSP environment (or CM/AOKP etc). When you have a succesfull environment which is able to compile for your device you may enter:

Code:

    - source build/envsetup.sh
    - lunch (now choose your device, for example, full_ariesve-userdebug)
    - now you’re theoretically ready to compile

to compile an app on the easiest way:

Code:

    - make Appname -j8
where “Appname” is the name of the folder placed in packages/apps/..
This also counts for “SystemUI” which is not in that folder.

Code:

    - make Calculator -j8 (for example)
And the -j param again stands for the number of jobs, remember that this is compiling and not downloading, so the “standard rule” with this is, number of cores of your CPU + 1.
Which makes a regular quad core (-j5) but makes a i7 CPU with Hyper threading (-j9). When using -j16 for example there could be moments that your cpu will be overloaded so much that your mouse will lag all over the place.
(Linux forces the cpu to perform higher then it actually should, resulting in a very strange fan sound in my case)

When having trouble, when it stops or just nags about some useless stuff.
You should try using the “-k” param, this tells the make command to keep going when a non-critical error occurs.

Code:

    - make Calculator -k -j8
When having issues with the local module tags, you should enter this:

Code:

    - make Calculator -k LOCAL_MODULE_TAGS=optional -j8
To compile other parts you also need to enter the folder name, here are some examples from /frameworks/base

Code:

    - make policy (the power menu and lockscreen)
    - make framework (the initial framework files)
    - make framework-res (the initial framework resources)
    - make services (the services.jar file)

or more examples:

Code:

    - make sdk (builds the android sdk)
    - make modules (builds all modules)
    - make installclean (removes all staging directories, such as out/target/product/boardname/system)
    - make clean (removes the whole /out directory)

:silly:

Viewing all articles
Browse latest Browse all 3614

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>