[GUIDE CM10] How to build your own CyanogenMod 10 ROM from sources for LG P990 O2x

Search This thread

Raum1807

Senior Member
Jul 11, 2012
241
726
Make your 'own' ROM today!

Revision History:
V1.5 2013.01.07 Update to newest Java 6 version: Java SE Development Kit 6 Update 38
V1.4 2012.11.20 ParanoidAndroid ROM building guide added, minor changes
V1.3 2012.11.10 New FAQ, Updates Java section, WIFI fix
V1.2 2012.11.05 Sync part updated
V1.1 2012.11.04 Typos fixed
V1.0 2012.11.03 Initial release

Thank you note: Thank you Ricardo Cerqueira for your work on the LG P990. Without you none of this would be possible. Thank you ethansp for your feedback and your input regarding the sync matter. Thank you TrymHansen and Ferrum Master for your input in respect of the JAVA topic. And thank you p.valenta for your contribution to the WIFI build fix.

Overview

0. Preparation
I. Installation of the required packages
II. Installing JAVA
III. The sources
IV. Building the ROM
V. Rebuilding with newest sources
VI. FAQ
VII. Building ParanoidAndroid ROM


0. Preparation

Things you need for building:

A computer
An internet connection
An open mind
Time
Patience


First of all you need a running up-to-date Ubuntu/Linux system. I am using Ubuntu 12.10 64-bit.

Use the terminal to make the steps. A terminal window can be opened by pressing Ctrl+Alt+T. Every single command for the terminal is marked with a $ sign. Just paste every command (without the $ sign) to your terminal window and there shouldn't be any problem.

IMPORTANT: INSTALL EVERYTHING AS A NORMAL USER. DON'T INSTALL AS ROOT!


I. Installation of the required packages (Ubuntu 12.10 64-bit)

Install packages:

Code:
$ sudo apt-get install git-core gnupg flex bison gperf build-essential \
  zip curl libc6-dev libncurses5-dev:i386 x11proto-core-dev \
  libx11-dev:i386 libreadline6-dev:i386 libgl1-mesa-glx:i386 \
  libgl1-mesa-dev g++-multilib mingw32 openjdk-6-jdk tofrodos \
  python-markdown libxml2-utils schedtool pngcrush xsltproc zlib1g-dev:i386
Set the links:

Code:
$ sudo ln -s /usr/lib/i386-linux-gnu/mesa/libGL.so.1 /usr/lib/i386-linux-gnu/libGL.so
II. Installing JAVA

You need a Java Development Kit for building CM10. Recommended is the SUN JDK 6. As of writing the most recent version is SUN JDK 6 Update 38.

1. Download the jdk-6u38-linux-i586.bin from the Oracle/Sun Java Download Area. If you are on 64-bit Ubuntu as I am, you should grab jdk-6u38-linux-x64.bin.

2. Make the bin file executable:

Code:
$ chmod +x jdk-6u38-linux-x64.bin
3. Extract the bin file:

Code:
$ ./jdk-6u38-linux-x64.bin
4. Move the extracted folder to this this location:

Code:
$ sudo mv jdk1.6.0_38 /usr/lib/jvm/./jdk-6u38-linux-x64.bin
5. Install the new Java source in system:

Code:
$ sudo update-alternatives --install /usr/bin/javac javac /usr/lib/jvm/jdk-6u38-linux-x64.bin/bin/javac 1
$ sudo update-alternatives --install /usr/bin/java java /usr/lib/jvm/jdk-6u38-linux-x64.bin/bin/java 1
$ sudo update-alternatives --install /usr/bin/javaws javaws /usr/lib/jvm/jdk-6u38-linux-x64.bin/bin/javaws 1
$ sudo update-alternatives --install /usr/bin/javadoc javadoc /usr/lib/jvm/jdk-6u38-linux-x64.bin/bin/javadoc 1
$ sudo update-alternatives --install /usr/bin/javah javah /usr/lib/jvm/jdk-6u38-linux-x64.bin/bin/javah 1
$ sudo update-alternatives --install /usr/bin/javap javap /usr/lib/jvm/jdk-6u38-linux-x64.bin/bin/javap 1
$ sudo update-alternatives --install /usr/bin/jar jar /usr/lib/jvm/jdk-6u38-linux-x64.bin/bin/jar 1
6. Select the default Java version for your system:

Code:
$ sudo update-alternatives --config javac
$ sudo update-alternatives --config java
$ sudo update-alternatives --config javaws
$ sudo update-alternatives --config javadoc
$ sudo update-alternatives --config javah
$ sudo update-alternatives --config javap
$ sudo update-alternatives --config jar
7. Check Java version:

Code:
$ java -version
8. Verify the symlinks. Javac, Java, Javaws, Javadoc, Javah, Javap and Jar should all point to the new Java location and version:

Code:
$ ls -la /etc/alternatives/java* && ls -la /etc/alternatives/jar
III. The sources

Install repo:

Repo is a tool that makes it quite easy to download and maintain the sources of Cyanogenmod.

Code:
$ mkdir ~/bin
$ PATH=~/bin:$PATH
$ cd ~/bin
$ curl https://dl-ssl.google.com/dl/googlesource/git-repo/repo > ~/bin/repo
$ chmod a+x ~/bin/repo
Create working directory:
Code:
$ mkdir ~/cm10
$ cd ~/cm10
Initialize Repo:
Code:
$ repo init -u git://github.com/CyanogenMod/android.git -b jellybean
and enter your credentials.

Download the sources:
Code:
$ repo sync
Wait until it's finished (takes a lot of time!)

If the process hangs use Ctrl+C to break out of it and resume the download with another
Code:
$ repo sync
Tip from ethansp: If you are running into a lot of syncing errors the reason might be that the 'repo sync' command is establishing four threads automatically. This might be too much. So try to change the command to run with one thread only by using
Code:
$ repo sync -j1
Initialize the environment

Code:
$ . build/envsetup.sh
Obtain the proprietary files:

Create a file with the name local_manifest.xml in the .repo directory. To see this directory, you have to press Ctrl-H in your file manager.

Create it with
Code:
gedit ~/cm10/.repo/local_manifest.xml
Paste the following lines to the editor
Code:
<manifest>
<project name="CyanogenMod/android_device_lge_p990" path="device/lge/p990" remote="github" revision="jellybean"/>
<project name="CyanogenMod/android_device_lge_star-common" path="device/lge/star-common" remote="github" revision="jellybean"/>
<project name="CyanogenMod/lge-kernel-star" path="kernel/lge/star" remote="github" revision="jellybean"/>
<project path="vendor/lge" name="TheMuppets/proprietary_vendor_lge.git" remote="github" revision="jellybean"/>
</manifest>
Save the file.
Run
Code:
$ repo sync
again to get the files needed.

Download the necessary prebuilts from cyanogenmod by running
Code:
$ ~/cm10/vendor/cm/get-prebuilts
And you are done!


IV. Building the ROM

Now build it:
Code:
$ brunch p990
And building process starts. Now have patience. Building takes around half an hour on fast systems and a lot more on older and slower machines.

When everything worked as it should you will find your new ROM-image in ~/cm10/out/target/product/p990

It is called cm-10-DATE-UNOFFICIAL-p990-zip. You can flash it via CWM as usual.

If you are having trouble with the WIFI not working with your newly flashed ROM, check the FAQ section C below for the solution.


V. Rebuilding with newest sources

Whenever you like to update your sources and build a new version you have to run these four simple commands:

Code:
$ cd ~/cm10
$ repo sync
$ . build/envsetup.sh
$ brunch p990
Building takes less time than it took for creating it the first build because it's only rebuilding new parts and using old parts that haven't changed.

Happy building!




VI. FAQ



A. How to tell how long it takes to build the ROM?

First, it depends on your hardware, second, whether it is your first build or a daily rebuild. To get a first number, you can use the “time” command and add the “brunch” command to it.
E.g.
Code:
time brunch p990
So the system will tell you how long it took to build the ROM. Then you know next time if it will be a short or long coffee break while waiting for your build to finish.


B. Is there a way to speed up the building process?


Actually, there are a lot of ways to speed up the process. Here are some of them:

1. Hardware:

When you build the first time it takes half an hour on fast machines and up to many hours on slower machines. What counts most is raw CPU power. Multi-core computers with a lot of fast RAM are recommended. The more cores the better. Memory-wise a setup with more than 8GB with aggressive but of course also stable timings is also adding to the building speed. A fast HDD or even SSD doesn't hurt either. When resourceful, you can use a system with multiple SSDs and gain more speed than single storage systems. But in most cases the CPU will be the biggest bottleneck. Check with tools, e.g. System Monitor in Ubuntu – and watch the resources tab to find out your bottleneck.

2. System-Software:

If you are using virtual machine software then try to optimize it. Look for “virtualization support” in the BIOS. Give it as much CPU power and memory as you can from your host system. Whenever it is possible it is recommended that you install the system directly, as the virtualization solution usually comes with a performance drop compared to a system installed and booted from directly.

3. The building software:

a. Out Directory
You can use a separate output directory for your builds, e.g. on a different hard drive with a fast file system.

Append
Code:
export OUT_DIR_COMMON_BASE=<path-to-your-out-directory>
to your .bashrc file.

b. Caching
You can setup Ccache, a system that acts as a compiler cache for all the parts of the building that are written in C. This is excellent if you rebuild often. But keep in mind that building the first time takes even longer when you have Ccache activated than building without it. So for first tests it is fine to build without Ccache enabled.

To enable Ccache add
Code:
export USE_CCACHE=1
to your .bashrc file
Optional: If you like to set the path, where the Ccache will be stored on your own, you have to add another line to the .bashrc
export CCACHE_DIR=<path-to-your-cache-directory>


Now run this command once to initialize the Ccache

Code:
prebuilts/misc/linux-x86/ccache/ccache -M 15G

C. I built the ROM successfully. I flashed it too, but the WiFi is not working anymore. What can I do?

The efforts of the CyanogenMod devs can be considered work in progress. And so it happens that features get broken while trying to fix others...

If you suffer from this then take the file 'wireless.ko'. You find the file below as an attachment. Push or copy it to '/system/lib/modules' and overwrite the file with the same name there. Change the rights to 644 or rw- r-- r-- It's the same as read/write by owner, read by group and read by other.

Without reboot, you can switch on the WiFi now. And you should be back in the game. Thanks to p.valenta for confirmation that it is working.


D. I checked the free space of the system partition. There isn't any. What can I do?

Without changing the size of the system partition not so much. But you can squeeze out a few MBs by removing some files from the created ROM image:

E.g. all the videos in /system/media/video can be deleted.
You can erase the /system/media/bootanimation.zip if you want.
Check /system/media/audio/, there you can delete some ringtones you are not using.

And if you know what you are doing, you can even get rid of some .apk files from '/system/app'.

For example LiveWallpapers.apk, VisualizationWallpapers.apk, CMWallpapers.apk, MagicSmokeWallpapers.apk, HoloSpiralWallpaper.apk are expendable.


E. I don't want to use Sun's/Oracle's Java Development Kit. Can I use another one instead?

Yes, you can. But using Sun's version is recommended by Google and CyanogenMod for building ROMs. So consider yourself warned. You can use the OpenJDK 6 that you will find already on your system if you installed the necessary packages as shown above. What you finally need to do is checking which Java version is active.

Code:
$ ls -la /etc/alternatives/java* && ls -la /etc/alternatives/jar
Select the default Java version for your system:

Code:
$ sudo update-alternatives --config javac
$ sudo update-alternatives --config java
$ sudo update-alternatives --config javaws
$ sudo update-alternatives --config javadoc
$ sudo update-alternatives --config javah
$ sudo update-alternatives --config javap
$ sudo update-alternatives --config jar
Each time choose the OpenJDK6 variant.

Verify the symlinks: Javac, Java, Javaws, Javadoc, Javah, Javap and Jar should all point to the new Java location:

Code:
$ ls -la /etc/alternatives/java* && ls -la /etc/alternatives/jar

When everything you see says 'OpenJDK6' then you can build your ROM with the usual commands.



VII. Build your own ParanoidAndroid ROM based on CM10 for LG P990

IMPORTANT! THIS IS A FOLLOW-UP GUIDE THAT REQUIRES A WORKING BUILDING ENVIRONMENT.

Preparation

You need a tested and fully working building environment (Ubuntu 12.04/12.10, Java 6, etc.). If you do not have one already, please follow this guide throughly first and build a normal CM10 ROM from sources as a test. If everything works as it should, then you can proceed with the following lines.

ParanoidAndroid Environment

Let's start.

Use the terminal to make the steps. A terminal window can be opened by pressing Ctrl+Alt+T. Every single command for the terminal is marked with a $ sign. Just paste every command (without the $ sign) to your terminal window and there shouldn't be any problem.

Create a directory named 'paranoid' in your home folder

Code:
$ mkdir ~/paranoid

Initialize the Repo in your newly created directory:

Code:
$ cd ~/paranoid
$ repo init -u git://github.com/ParanoidAndroid/android.git -b jellybean

Before downloading the files you need to edit a file. One line leads to sync errors and has to be deleted from the file. Edit 'default.xml' in /paranoid/.repo/manifests/

(Hint if you can't see the .repo directory: it's hidden, so to make it visible press Ctrl+H) or use this line

Code:
$ gedit ~/paranoid/.repo/manifests/default.xml

Search (Ctrl+F) for 'ParanoidPreferences' and remove the whole line. Save and close the 'default.xml' file.

We need to add some LGE (P990) specific repositories as well. You can either copy the 'local_manifest.xml' file (it's the same!) from your cm10-build-environment or create a new file in /paranoid/.repo/

To create a new file use

Code:
$ gedit ~/paranoid/.repo/local_manifest.xml

Insert the following lines

Code:
<manifest>
<project name="TheMuppets/proprietary_vendor_lge.git" path="vendor/lge" remote="github" revision="jellybean"/>
<project name="CyanogenMod/android_device_lge_p990" path="device/lge/p990" remote="github" revision="jellybean"/>
<project name="CyanogenMod/android_device_lge_star-common" path="device/lge/star-common" remote="github" revision="jellybean"/>
<project name="CyanogenMod/lge-kernel-star" path="kernel/lge/star" remote="github" revision="jellybean"/>
<project name="TheMuppets/proprietary_vendor_lge" path="vendor/lge" remote="github" revision="jellybean"/>
</manifest>

Save it.

Sync the repositories (takes time!)

Code:
$ repo sync

Take a looong coffee break.

A few files

After the successful sync process go to 'paranoid/vendor/pa/products/'.

Create a new file with the name 'pa_p990.mk'

Code:
$ gedit ~/paranoid/vendor/pa/products/pa_p990.mk

Insert these lines:
(lines changed, xhdpi to hdpi, thanks rugglez)

Code:
# Check for target product
ifeq (pa_p990,$(TARGET_PRODUCT))
 
# Define PA bootanimation size
PARANOID_BOOTANIMATION_NAME := HDPI
 
# OVERLAY_TARGET adds overlay asset source
OVERLAY_TARGET := pa_hdpi
 
# include ParanoidAndroid common configuration
include vendor/pa/config/pa_common.mk
 
# Inherit CM device configuration
$(call inherit-product, device/lge/p990/cm.mk)
 
PRODUCT_NAME := pa_p990
 
GET_VENDOR_PROPS := $(shell vendor/pa/tools/getvendorprops.py $(PRODUCT_NAME))
 
endif

Save it.


Open 'AndroidProducts.mk' in 'paranoid/vendor/pa/products/' with

Code:
$ gedit ~/paranoid/vendor/pa/products/AndroidProducts.mk

and add these lines to then end of the file:
Code:
ifeq (pa_p990,$(TARGET_PRODUCT))
    PRODUCT_MAKEFILES += $(LOCAL_DIR)/pa_p990.mk
endif
Save it.

Create a file called 'p990.proprietaries' in 'paranoid/vendor/pa/vendorprops/'

Code:
$ gedit ~/paranoid/vendor/pa/vendorprops/p990.proprietaries
Code:
[
    {
        "account":      "TheMuppets",
        "repository":   "proprietary_vendor_lge",
        "target_path":  "vendor/lge",
        "revision":     "jellybean"
    }
]
Save it.

Open 'vendorsetup.sh' in 'paranoid/vendor/pa/'

Code:
$ gedit ~/paranoid/vendor/pa/vendorsetup.sh

Add this line

Code:
add_lunch_combo pa_p990-userdebug

Save it.

Get CM Prebuilts

Now go to

Code:
$ ~/paranoid/vendor/cm/get-prebuilts


Building ParanoidAndroid

Ready to go! Build your ROM now with

Code:
$ cd ~/paranoid
$ ./rom-build.sh p990

The compiling takes around the same amount of time as when building CM10. Half an hour minimum, up to a few hours on slower systems. You will find your CWM flashable zip in 'paranoid/out/target/product/p990/'. It is called 'pa_p990-version-date-time.zip'

Rebuilding

Everytime you want to rebuild or build a new version, just change to the directory, resync the sources and start building:

Code:
$ cd ~/paranoid
$ repo sync
$ ./rom-build.sh p990

If you haven't enlarged your system partition yet, you have to delete some files or the ROM probably won't fit.

Deletable files


/system/media/: delete bootanimation.zip, saves 9.4 MB
/system/media/video/: delete all files, saves 6.4 MB
/system/media/audio/ringtones/: keep one or two, delete the rest, saves up to ~8 MB

You can even delete some system apps (.apk) from '/system/app/' like LiveWallpapers.apk, VisualizationWallpapers.apk, CMWallpapers.apk, MagicSmokeWallpapers.apk, HoloSpiralWallpaper.apk
 

Attachments

  • wireless.ko.zip
    92.1 KB · Views: 208
Last edited:

tetrahedonism

Senior Member
Sep 23, 2011
288
77
I would personally love it if people included instructions for other distros. Not everything uses apt-get. That's kind of just me being nitpicky, but I've compiled CM9 on Archlinux with substituting a few things.

Also, what happened to the month of letting RC shine?
 

owain94

Inactive Recognized Developer
Sep 21, 2010
3,538
6,041
29
The Hague
I would personally love it if people included instructions for other distros. Not everything uses apt-get. That's kind of just me being nitpicky, but I've compiled CM9 on Archlinux with substituting a few things.

Also, what happened to the month of letting RC shine?

Google their advice is to use ubuntu if you want to use a distros if your own choices you are probably advanced enough to change the instructions to your needs

And about Ricardo his month it is only a tut to compile it yourself you don't have to share it ;)

Sent from my Galaxy Nexus using XDA Premium HD app
 

tetrahedonism

Senior Member
Sep 23, 2011
288
77
Google their advice is to use ubuntu if you want to use a distros if your own choices you are probably advanced enough to change the instructions to your needs

And about Ricardo his month it is only a tut to compile it yourself you don't have to share it ;)

Sent from my Galaxy Nexus using XDA Premium HD app

I guess I could always post my own adapted instructions! Maybe some day. Ahah.
 

Ryukenden

Senior Member
Jan 19, 2011
409
171
As funny as it may seem to u, instructions to compile CM10 on different distro than Ubuntu would be highly appreciated. Not everyone uses Ubuntu (I do actually), so u may help someone trying to set it up on their distro...

Just my 2 cents....
 

slebit

Senior Member
Dec 3, 2010
2,537
1,564
Is it possible to compile on 32 bits system?

Sent from my LG-P990 using Tapatalk 2
 

ethansp

Member
Aug 20, 2008
41
12
Valencia
Hi, i'm trying to build following your guide.
I have a little problem with step 5.
When i put the line exactly like your
Code:
 $ sudo update-alternatives --install /usr/bin/javac javac /usr/lib/jvm/jdk-6u37-linux-x64.bin/bin/javac
I get fail, system told me they need prority in entire numeric. I get it work with this:
Code:
 $ sudo update-alternatives --install /usr/bin/javac javac /usr/lib/jvm/jdk-6u37-linux-x64.bin/bin/javac 1
Have to do the same with the other 2 commands.

Hope this help someone stucked.
Cheers,

eThAn
 

Raum1807

Senior Member
Jul 11, 2012
241
726
Hi, i'm trying to build following your guide.
I have a little problem with step 5.
When i put the line exactly like your
Code:
 $ sudo update-alternatives --install /usr/bin/javac javac /usr/lib/jvm/jdk-6u37-linux-x64.bin/bin/javac
I get fail, system told me they need prority in entire numeric. I get it work with this:
Code:
 $ sudo update-alternatives --install /usr/bin/javac javac /usr/lib/jvm/jdk-6u37-linux-x64.bin/bin/javac 1
Have to do the same with the other 2 commands.

Hope this help someone stucked.
Cheers,

eThAn

Thank you for pointing me to that error. Somehow the priority got lost while pasting. I corrected it.
 
  • Like
Reactions: ethansp

tonyp

Inactive Recognized Developer
Feb 3, 2011
5,019
34,902
Also, what happened to the month of letting RC shine?
As owain already said, we devs have decided to wait for 3-4 weeks before using his work and releasing it as an "own" ROM.
This does only affect releasing a ROM, not building it.
I will always encourage everone to build their own ROM for their own purpose, there's nothing wrong with that. And you will learn a lot :)
 
  • Like
Reactions: ethansp

Raum1807

Senior Member
Jul 11, 2012
241
726
Is it possible to compile on 32 bits system?

Sent from my LG-P990 using Tapatalk 2

No, 64 bits only

Sent from my LG-P990 using xda premium

You mean it's impossible to compile on Ubuntu 12.04 32-bit ?

If i've done my homework properly, yes

ICS and older are possible with 32bits though

Sent from my LG-P990 using xda premium

HerrKuk is right. If you try to compile it on a 32-bit system you will see a lot of errors. As JBQ stated here, a 64-bit OS is mandatory.
 
  • Like
Reactions: Litderose

TrymHansen

Senior Member
Jun 7, 2011
1,108
952
Good, thanks, was just wondering if I had to make a new build-system from scratch, I've re-used my old CM9-builder.
 

cmahendra

Inactive Recognized Contributor
Jan 20, 2012
3,843
4,890
Mumbai
As owain already said, we devs have decided to wait for 3-4 weeks before using his work and releasing it as an "own" ROM.
This does only affect releasing a ROM, not building it.
I will always encourage everone to build their own ROM for their own purpose, there's nothing wrong with that. And you will learn a lot :)

We all understand rest of the devs here are waiting for RC Shine, thats fine. But as these nightly builds are having too many annoying bugs liek slow battery charging, wifi-battery drain issue, screen wake issue, power button issue, which makes it impossible to even test, forget making it daily driver. In fact even some pals are not able to install it properly (4,5 builds). I dont understand why rest of the devs are not making fixes to these various issues in this nightlies. Other devs are expert who can understand this seperate issues and can make patches till a month, before actually making own custom roms.

Uptil now the fixes suggested by some members are either not working or even making it worse sometimes.

Devs, Please think again for your strong valuable expert fixes. How about a single file parmanent patch with all possible fixes? :) Will appreciate. Sorry if asking too much or out of protocol. I dont know much what you devs have decided long time back.
 
Last edited:

SREEPRAJAY

Retired Forum Moderator
Jul 9, 2010
4,567
5,985
CITY OF PARKS
Samsung Galaxy S23 Ultra
Was on the latest build from RC and on bb v20c and the ril which came with the build....wifi was working perfectly and I confirm without a big drain of battery....it was richly smooth

O2X with Magical ROM and supersonic kernels from my buddies
 

Top Liked Posts

  • There are no posts matching your filters.
  • 71
    Make your 'own' ROM today!

    Revision History:
    V1.5 2013.01.07 Update to newest Java 6 version: Java SE Development Kit 6 Update 38
    V1.4 2012.11.20 ParanoidAndroid ROM building guide added, minor changes
    V1.3 2012.11.10 New FAQ, Updates Java section, WIFI fix
    V1.2 2012.11.05 Sync part updated
    V1.1 2012.11.04 Typos fixed
    V1.0 2012.11.03 Initial release

    Thank you note: Thank you Ricardo Cerqueira for your work on the LG P990. Without you none of this would be possible. Thank you ethansp for your feedback and your input regarding the sync matter. Thank you TrymHansen and Ferrum Master for your input in respect of the JAVA topic. And thank you p.valenta for your contribution to the WIFI build fix.

    Overview

    0. Preparation
    I. Installation of the required packages
    II. Installing JAVA
    III. The sources
    IV. Building the ROM
    V. Rebuilding with newest sources
    VI. FAQ
    VII. Building ParanoidAndroid ROM


    0. Preparation

    Things you need for building:

    A computer
    An internet connection
    An open mind
    Time
    Patience


    First of all you need a running up-to-date Ubuntu/Linux system. I am using Ubuntu 12.10 64-bit.

    Use the terminal to make the steps. A terminal window can be opened by pressing Ctrl+Alt+T. Every single command for the terminal is marked with a $ sign. Just paste every command (without the $ sign) to your terminal window and there shouldn't be any problem.

    IMPORTANT: INSTALL EVERYTHING AS A NORMAL USER. DON'T INSTALL AS ROOT!


    I. Installation of the required packages (Ubuntu 12.10 64-bit)

    Install packages:

    Code:
    $ sudo apt-get install git-core gnupg flex bison gperf build-essential \
      zip curl libc6-dev libncurses5-dev:i386 x11proto-core-dev \
      libx11-dev:i386 libreadline6-dev:i386 libgl1-mesa-glx:i386 \
      libgl1-mesa-dev g++-multilib mingw32 openjdk-6-jdk tofrodos \
      python-markdown libxml2-utils schedtool pngcrush xsltproc zlib1g-dev:i386
    Set the links:

    Code:
    $ sudo ln -s /usr/lib/i386-linux-gnu/mesa/libGL.so.1 /usr/lib/i386-linux-gnu/libGL.so
    II. Installing JAVA

    You need a Java Development Kit for building CM10. Recommended is the SUN JDK 6. As of writing the most recent version is SUN JDK 6 Update 38.

    1. Download the jdk-6u38-linux-i586.bin from the Oracle/Sun Java Download Area. If you are on 64-bit Ubuntu as I am, you should grab jdk-6u38-linux-x64.bin.

    2. Make the bin file executable:

    Code:
    $ chmod +x jdk-6u38-linux-x64.bin
    3. Extract the bin file:

    Code:
    $ ./jdk-6u38-linux-x64.bin
    4. Move the extracted folder to this this location:

    Code:
    $ sudo mv jdk1.6.0_38 /usr/lib/jvm/./jdk-6u38-linux-x64.bin
    5. Install the new Java source in system:

    Code:
    $ sudo update-alternatives --install /usr/bin/javac javac /usr/lib/jvm/jdk-6u38-linux-x64.bin/bin/javac 1
    $ sudo update-alternatives --install /usr/bin/java java /usr/lib/jvm/jdk-6u38-linux-x64.bin/bin/java 1
    $ sudo update-alternatives --install /usr/bin/javaws javaws /usr/lib/jvm/jdk-6u38-linux-x64.bin/bin/javaws 1
    $ sudo update-alternatives --install /usr/bin/javadoc javadoc /usr/lib/jvm/jdk-6u38-linux-x64.bin/bin/javadoc 1
    $ sudo update-alternatives --install /usr/bin/javah javah /usr/lib/jvm/jdk-6u38-linux-x64.bin/bin/javah 1
    $ sudo update-alternatives --install /usr/bin/javap javap /usr/lib/jvm/jdk-6u38-linux-x64.bin/bin/javap 1
    $ sudo update-alternatives --install /usr/bin/jar jar /usr/lib/jvm/jdk-6u38-linux-x64.bin/bin/jar 1
    6. Select the default Java version for your system:

    Code:
    $ sudo update-alternatives --config javac
    $ sudo update-alternatives --config java
    $ sudo update-alternatives --config javaws
    $ sudo update-alternatives --config javadoc
    $ sudo update-alternatives --config javah
    $ sudo update-alternatives --config javap
    $ sudo update-alternatives --config jar
    7. Check Java version:

    Code:
    $ java -version
    8. Verify the symlinks. Javac, Java, Javaws, Javadoc, Javah, Javap and Jar should all point to the new Java location and version:

    Code:
    $ ls -la /etc/alternatives/java* && ls -la /etc/alternatives/jar
    III. The sources

    Install repo:

    Repo is a tool that makes it quite easy to download and maintain the sources of Cyanogenmod.

    Code:
    $ mkdir ~/bin
    $ PATH=~/bin:$PATH
    $ cd ~/bin
    $ curl https://dl-ssl.google.com/dl/googlesource/git-repo/repo > ~/bin/repo
    $ chmod a+x ~/bin/repo
    Create working directory:
    Code:
    $ mkdir ~/cm10
    $ cd ~/cm10
    Initialize Repo:
    Code:
    $ repo init -u git://github.com/CyanogenMod/android.git -b jellybean
    and enter your credentials.

    Download the sources:
    Code:
    $ repo sync
    Wait until it's finished (takes a lot of time!)

    If the process hangs use Ctrl+C to break out of it and resume the download with another
    Code:
    $ repo sync
    Tip from ethansp: If you are running into a lot of syncing errors the reason might be that the 'repo sync' command is establishing four threads automatically. This might be too much. So try to change the command to run with one thread only by using
    Code:
    $ repo sync -j1
    Initialize the environment

    Code:
    $ . build/envsetup.sh
    Obtain the proprietary files:

    Create a file with the name local_manifest.xml in the .repo directory. To see this directory, you have to press Ctrl-H in your file manager.

    Create it with
    Code:
    gedit ~/cm10/.repo/local_manifest.xml
    Paste the following lines to the editor
    Code:
    <manifest>
    <project name="CyanogenMod/android_device_lge_p990" path="device/lge/p990" remote="github" revision="jellybean"/>
    <project name="CyanogenMod/android_device_lge_star-common" path="device/lge/star-common" remote="github" revision="jellybean"/>
    <project name="CyanogenMod/lge-kernel-star" path="kernel/lge/star" remote="github" revision="jellybean"/>
    <project path="vendor/lge" name="TheMuppets/proprietary_vendor_lge.git" remote="github" revision="jellybean"/>
    </manifest>
    Save the file.
    Run
    Code:
    $ repo sync
    again to get the files needed.

    Download the necessary prebuilts from cyanogenmod by running
    Code:
    $ ~/cm10/vendor/cm/get-prebuilts
    And you are done!


    IV. Building the ROM

    Now build it:
    Code:
    $ brunch p990
    And building process starts. Now have patience. Building takes around half an hour on fast systems and a lot more on older and slower machines.

    When everything worked as it should you will find your new ROM-image in ~/cm10/out/target/product/p990

    It is called cm-10-DATE-UNOFFICIAL-p990-zip. You can flash it via CWM as usual.

    If you are having trouble with the WIFI not working with your newly flashed ROM, check the FAQ section C below for the solution.


    V. Rebuilding with newest sources

    Whenever you like to update your sources and build a new version you have to run these four simple commands:

    Code:
    $ cd ~/cm10
    $ repo sync
    $ . build/envsetup.sh
    $ brunch p990
    Building takes less time than it took for creating it the first build because it's only rebuilding new parts and using old parts that haven't changed.

    Happy building!




    VI. FAQ



    A. How to tell how long it takes to build the ROM?

    First, it depends on your hardware, second, whether it is your first build or a daily rebuild. To get a first number, you can use the “time” command and add the “brunch” command to it.
    E.g.
    Code:
    time brunch p990
    So the system will tell you how long it took to build the ROM. Then you know next time if it will be a short or long coffee break while waiting for your build to finish.


    B. Is there a way to speed up the building process?


    Actually, there are a lot of ways to speed up the process. Here are some of them:

    1. Hardware:

    When you build the first time it takes half an hour on fast machines and up to many hours on slower machines. What counts most is raw CPU power. Multi-core computers with a lot of fast RAM are recommended. The more cores the better. Memory-wise a setup with more than 8GB with aggressive but of course also stable timings is also adding to the building speed. A fast HDD or even SSD doesn't hurt either. When resourceful, you can use a system with multiple SSDs and gain more speed than single storage systems. But in most cases the CPU will be the biggest bottleneck. Check with tools, e.g. System Monitor in Ubuntu – and watch the resources tab to find out your bottleneck.

    2. System-Software:

    If you are using virtual machine software then try to optimize it. Look for “virtualization support” in the BIOS. Give it as much CPU power and memory as you can from your host system. Whenever it is possible it is recommended that you install the system directly, as the virtualization solution usually comes with a performance drop compared to a system installed and booted from directly.

    3. The building software:

    a. Out Directory
    You can use a separate output directory for your builds, e.g. on a different hard drive with a fast file system.

    Append
    Code:
    export OUT_DIR_COMMON_BASE=<path-to-your-out-directory>
    to your .bashrc file.

    b. Caching
    You can setup Ccache, a system that acts as a compiler cache for all the parts of the building that are written in C. This is excellent if you rebuild often. But keep in mind that building the first time takes even longer when you have Ccache activated than building without it. So for first tests it is fine to build without Ccache enabled.

    To enable Ccache add
    Code:
    export USE_CCACHE=1
    to your .bashrc file
    Optional: If you like to set the path, where the Ccache will be stored on your own, you have to add another line to the .bashrc
    export CCACHE_DIR=<path-to-your-cache-directory>


    Now run this command once to initialize the Ccache

    Code:
    prebuilts/misc/linux-x86/ccache/ccache -M 15G

    C. I built the ROM successfully. I flashed it too, but the WiFi is not working anymore. What can I do?

    The efforts of the CyanogenMod devs can be considered work in progress. And so it happens that features get broken while trying to fix others...

    If you suffer from this then take the file 'wireless.ko'. You find the file below as an attachment. Push or copy it to '/system/lib/modules' and overwrite the file with the same name there. Change the rights to 644 or rw- r-- r-- It's the same as read/write by owner, read by group and read by other.

    Without reboot, you can switch on the WiFi now. And you should be back in the game. Thanks to p.valenta for confirmation that it is working.


    D. I checked the free space of the system partition. There isn't any. What can I do?

    Without changing the size of the system partition not so much. But you can squeeze out a few MBs by removing some files from the created ROM image:

    E.g. all the videos in /system/media/video can be deleted.
    You can erase the /system/media/bootanimation.zip if you want.
    Check /system/media/audio/, there you can delete some ringtones you are not using.

    And if you know what you are doing, you can even get rid of some .apk files from '/system/app'.

    For example LiveWallpapers.apk, VisualizationWallpapers.apk, CMWallpapers.apk, MagicSmokeWallpapers.apk, HoloSpiralWallpaper.apk are expendable.


    E. I don't want to use Sun's/Oracle's Java Development Kit. Can I use another one instead?

    Yes, you can. But using Sun's version is recommended by Google and CyanogenMod for building ROMs. So consider yourself warned. You can use the OpenJDK 6 that you will find already on your system if you installed the necessary packages as shown above. What you finally need to do is checking which Java version is active.

    Code:
    $ ls -la /etc/alternatives/java* && ls -la /etc/alternatives/jar
    Select the default Java version for your system:

    Code:
    $ sudo update-alternatives --config javac
    $ sudo update-alternatives --config java
    $ sudo update-alternatives --config javaws
    $ sudo update-alternatives --config javadoc
    $ sudo update-alternatives --config javah
    $ sudo update-alternatives --config javap
    $ sudo update-alternatives --config jar
    Each time choose the OpenJDK6 variant.

    Verify the symlinks: Javac, Java, Javaws, Javadoc, Javah, Javap and Jar should all point to the new Java location:

    Code:
    $ ls -la /etc/alternatives/java* && ls -la /etc/alternatives/jar

    When everything you see says 'OpenJDK6' then you can build your ROM with the usual commands.



    VII. Build your own ParanoidAndroid ROM based on CM10 for LG P990

    IMPORTANT! THIS IS A FOLLOW-UP GUIDE THAT REQUIRES A WORKING BUILDING ENVIRONMENT.

    Preparation

    You need a tested and fully working building environment (Ubuntu 12.04/12.10, Java 6, etc.). If you do not have one already, please follow this guide throughly first and build a normal CM10 ROM from sources as a test. If everything works as it should, then you can proceed with the following lines.

    ParanoidAndroid Environment

    Let's start.

    Use the terminal to make the steps. A terminal window can be opened by pressing Ctrl+Alt+T. Every single command for the terminal is marked with a $ sign. Just paste every command (without the $ sign) to your terminal window and there shouldn't be any problem.

    Create a directory named 'paranoid' in your home folder

    Code:
    $ mkdir ~/paranoid

    Initialize the Repo in your newly created directory:

    Code:
    $ cd ~/paranoid
    $ repo init -u git://github.com/ParanoidAndroid/android.git -b jellybean

    Before downloading the files you need to edit a file. One line leads to sync errors and has to be deleted from the file. Edit 'default.xml' in /paranoid/.repo/manifests/

    (Hint if you can't see the .repo directory: it's hidden, so to make it visible press Ctrl+H) or use this line

    Code:
    $ gedit ~/paranoid/.repo/manifests/default.xml

    Search (Ctrl+F) for 'ParanoidPreferences' and remove the whole line. Save and close the 'default.xml' file.

    We need to add some LGE (P990) specific repositories as well. You can either copy the 'local_manifest.xml' file (it's the same!) from your cm10-build-environment or create a new file in /paranoid/.repo/

    To create a new file use

    Code:
    $ gedit ~/paranoid/.repo/local_manifest.xml

    Insert the following lines

    Code:
    <manifest>
    <project name="TheMuppets/proprietary_vendor_lge.git" path="vendor/lge" remote="github" revision="jellybean"/>
    <project name="CyanogenMod/android_device_lge_p990" path="device/lge/p990" remote="github" revision="jellybean"/>
    <project name="CyanogenMod/android_device_lge_star-common" path="device/lge/star-common" remote="github" revision="jellybean"/>
    <project name="CyanogenMod/lge-kernel-star" path="kernel/lge/star" remote="github" revision="jellybean"/>
    <project name="TheMuppets/proprietary_vendor_lge" path="vendor/lge" remote="github" revision="jellybean"/>
    </manifest>

    Save it.

    Sync the repositories (takes time!)

    Code:
    $ repo sync

    Take a looong coffee break.

    A few files

    After the successful sync process go to 'paranoid/vendor/pa/products/'.

    Create a new file with the name 'pa_p990.mk'

    Code:
    $ gedit ~/paranoid/vendor/pa/products/pa_p990.mk

    Insert these lines:
    (lines changed, xhdpi to hdpi, thanks rugglez)

    Code:
    # Check for target product
    ifeq (pa_p990,$(TARGET_PRODUCT))
     
    # Define PA bootanimation size
    PARANOID_BOOTANIMATION_NAME := HDPI
     
    # OVERLAY_TARGET adds overlay asset source
    OVERLAY_TARGET := pa_hdpi
     
    # include ParanoidAndroid common configuration
    include vendor/pa/config/pa_common.mk
     
    # Inherit CM device configuration
    $(call inherit-product, device/lge/p990/cm.mk)
     
    PRODUCT_NAME := pa_p990
     
    GET_VENDOR_PROPS := $(shell vendor/pa/tools/getvendorprops.py $(PRODUCT_NAME))
     
    endif

    Save it.


    Open 'AndroidProducts.mk' in 'paranoid/vendor/pa/products/' with

    Code:
    $ gedit ~/paranoid/vendor/pa/products/AndroidProducts.mk

    and add these lines to then end of the file:
    Code:
    ifeq (pa_p990,$(TARGET_PRODUCT))
        PRODUCT_MAKEFILES += $(LOCAL_DIR)/pa_p990.mk
    endif
    Save it.

    Create a file called 'p990.proprietaries' in 'paranoid/vendor/pa/vendorprops/'

    Code:
    $ gedit ~/paranoid/vendor/pa/vendorprops/p990.proprietaries
    Code:
    [
        {
            "account":      "TheMuppets",
            "repository":   "proprietary_vendor_lge",
            "target_path":  "vendor/lge",
            "revision":     "jellybean"
        }
    ]
    Save it.

    Open 'vendorsetup.sh' in 'paranoid/vendor/pa/'

    Code:
    $ gedit ~/paranoid/vendor/pa/vendorsetup.sh

    Add this line

    Code:
    add_lunch_combo pa_p990-userdebug

    Save it.

    Get CM Prebuilts

    Now go to

    Code:
    $ ~/paranoid/vendor/cm/get-prebuilts


    Building ParanoidAndroid

    Ready to go! Build your ROM now with

    Code:
    $ cd ~/paranoid
    $ ./rom-build.sh p990

    The compiling takes around the same amount of time as when building CM10. Half an hour minimum, up to a few hours on slower systems. You will find your CWM flashable zip in 'paranoid/out/target/product/p990/'. It is called 'pa_p990-version-date-time.zip'

    Rebuilding

    Everytime you want to rebuild or build a new version, just change to the directory, resync the sources and start building:

    Code:
    $ cd ~/paranoid
    $ repo sync
    $ ./rom-build.sh p990

    If you haven't enlarged your system partition yet, you have to delete some files or the ROM probably won't fit.

    Deletable files


    /system/media/: delete bootanimation.zip, saves 9.4 MB
    /system/media/video/: delete all files, saves 6.4 MB
    /system/media/audio/ringtones/: keep one or two, delete the rest, saves up to ~8 MB

    You can even delete some system apps (.apk) from '/system/app/' like LiveWallpapers.apk, VisualizationWallpapers.apk, CMWallpapers.apk, MagicSmokeWallpapers.apk, HoloSpiralWallpaper.apk
    9
    I would personally love it if people included instructions for other distros. Not everything uses apt-get. That's kind of just me being nitpicky, but I've compiled CM9 on Archlinux with substituting a few things.

    Also, what happened to the month of letting RC shine?

    Google their advice is to use ubuntu if you want to use a distros if your own choices you are probably advanced enough to change the instructions to your needs

    And about Ricardo his month it is only a tut to compile it yourself you don't have to share it ;)

    Sent from my Galaxy Nexus using XDA Premium HD app
    4
    I had never done something like this before. But it was actually pretty easy. This guide is really easy to understand. So thanks to @ Raum1807 for making this awesome guide.

    Sent from my HTC One X using Tapatalk 2

    To be honest building android is pretty easy
    The only thing about it that's sucks is setting up the environment...
    But luckily you'll only have to do that once

    Personally I started back on a old device I stopped quickly because the people there sucked pretty hard everybody was ungrateful
    I started again thanks to temasek he announced that he was about to stop kanging
    At that moment I thought I will continue his work on cm9

    And I was missing some options I would love to have
    And that's how Domination and DominationX 2.0 were born

    Sent from my Galaxy Nexus using XDA Premium HD app
    4
    Build your own ParanoidAndroid ROM based on CM10 for LG P990

    SInce I took some notes a while back when I was trying out ParanoidAndroid myself, I made a user-friendly version out of these notes.

    Here you go:


    Build your own ParanoidAndroid ROM based on CM10 for LG P990


    IMPORTANT! THIS IS A FOLLOW-UP GUIDE THAT REQUIRES A WORKING BUILDING ENVIRONMENT.

    Preparation

    You need a tested and fully working building environment (Ubuntu 12.04/12.10, Java 6, etc.). If you do not have one already, please follow this guide throughly first and build a normal CM10 ROM from sources as a test. If everything works as it should, then you can proceed with the following lines.

    ParanoidAndroid Environment

    Let's start.

    Use the terminal to make the steps. A terminal window can be opened by pressing Ctrl+Alt+T. Every single command for the terminal is marked with a $ sign. Just paste every command (without the $ sign) to your terminal window and there shouldn't be any problem.

    Create a directory named 'paranoid' in your home folder

    Code:
    $ mkdir ~/paranoid

    Initialize the Repo in your newly created directory:

    Code:
    $ cd ~/paranoid
    $ repo init -u git://github.com/ParanoidAndroid/android.git -b jellybean

    Before downloading the files you need to edit a file. One line leads to sync errors and has to be deleted from the file. Edit 'default.xml' in /paranoid/.repo/manifests/

    (Hint if you can't see the .repo directory: it's hidden, so to make it visible press Ctrl+H) or use this line

    Code:
    $ gedit ~/paranoid/.repo/manifests/default.xml

    Search (Ctrl+F) for 'ParanoidPreferences' and remove the whole line. Save and close the 'default.xml' file.

    We need to add some LGE (P990) specific repositories as well. You can either copy the 'local_manifest.xml' file (it's the same!) from your cm10-build-environment or create a new file in /paranoid/.repo/

    To create a new file use

    Code:
    $ gedit ~/paranoid/.repo/local_manifest.xml

    Insert the following lines

    Code:
    <manifest>
    <project name="TheMuppets/proprietary_vendor_lge.git" path="vendor/lge" remote="github" revision="jellybean"/>
    <project name="CyanogenMod/android_device_lge_p990" path="device/lge/p990" remote="github" revision="jellybean"/>
    <project name="CyanogenMod/android_device_lge_star-common" path="device/lge/star-common" remote="github" revision="jellybean"/>
    <project name="CyanogenMod/lge-kernel-star" path="kernel/lge/star" remote="github" revision="jellybean"/>
    <project name="TheMuppets/proprietary_vendor_lge" path="vendor/lge" remote="github" revision="jellybean"/>
    </manifest>

    Save it.

    Sync the repositories (takes time!)

    Code:
    $ repo sync

    Take a looong coffee break.

    Some files

    After the successful sync process go to 'paranoid/vendor/pa/products/'.

    Create a new file with the name 'pa_p990.mk'

    Code:
    $ gedit ~/paranoid/vendor/pa/products/pa_p990.mk

    Insert these lines:
    (lines changed, xhdpi to hdpi, thanks rugglez)

    Code:
    # Check for target product
    ifeq (pa_p990,$(TARGET_PRODUCT))
     
    # Define PA bootanimation size
    PARANOID_BOOTANIMATION_NAME := HDPI
     
    # OVERLAY_TARGET adds overlay asset source
    OVERLAY_TARGET := pa_hdpi
     
    # include ParanoidAndroid common configuration
    include vendor/pa/config/pa_common.mk
     
    # Inherit CM device configuration
    $(call inherit-product, device/lge/p990/cm.mk)
     
    PRODUCT_NAME := pa_p990
     
    GET_VENDOR_PROPS := $(shell vendor/pa/tools/getvendorprops.py $(PRODUCT_NAME))
     
    endif

    Save it.


    Open 'AndroidProducts.mk' in 'paranoid/vendor/pa/products/' with

    Code:
    $ gedit ~/paranoid/vendor/pa/products/AndroidProducts.mk

    and add these lines to then end of the file:
    Code:
    ifeq (pa_p990,$(TARGET_PRODUCT))
        PRODUCT_MAKEFILES += $(LOCAL_DIR)/pa_p990.mk
    endif
    Save it.

    Create a file called 'p990.proprietaries' in 'paranoid/vendor/pa/vendorprops/'

    Code:
    $ gedit ~/paranoid/vendor/pa/vendorprops/p990.proprietaries
    Code:
    [
        {
            "account":      "TheMuppets",
            "repository":   "proprietary_vendor_lge",
            "target_path":  "vendor/lge",
            "revision":     "jellybean"
        }
    ]
    Save it.

    Open 'vendorsetup.sh' in 'paranoid/vendor/pa/'

    Code:
    $ gedit ~/paranoid/vendor/pa/vendorsetup.sh

    Add this line

    Code:
    add_lunch_combo pa_p990-userdebug

    Save it.

    Get CM Prebuilts

    Now go to

    Code:
    $ ~/paranoid/vendor/cm/get-prebuilts


    Building ParanoidAndroid

    Ready to go! Build your ROM now with

    Code:
    $ cd ~/paranoid
    $ ./rom-build.sh p990

    The compiling takes around the same amount of time as when building CM10. Half an hour minimum, up to a few hours on slower systems. You will find your CWM flashable zip in 'paranoid/out/target/product/p990/'. It is called 'pa_p990-version-date-time.zip'

    Rebuilding

    Everytime you want to rebuild or build a new version, just change to the directory, resync the sources and start building:

    Code:
    $ cd ~/paranoid
    $ repo sync
    $ ./rom-build.sh p990

    If you haven't enlarged your system partition yet, you have to delete some files or the ROM probably won't fit.

    Deletable files


    /system/media/: delete bootanimation.zip, saves 9.4 MB
    /system/media/video/: delete all files, saves 6.4 MB
    /system/media/audio/ringtones/: keep one or two, delete the rest, saves up to ~8 MB

    You can even delete some system apps (.apk) from '/system/app/' like LiveWallpapers.apk, VisualizationWallpapers.apk, CMWallpapers.apk, MagicSmokeWallpapers.apk, HoloSpiralWallpaper.apk

    Feedback regarding improvements/error corrections welcome!
    3
    Finally I made my first build! After a couple of problems on the way, I finally made it! Thanks alot Raum for this great guide!

    Sent from my HTC One X using Tapatalk 2


    You are welcome!

    I made a rebuild today. But it is named "cm-10-20121113-UNOFFICIAL-p990.zip", despite that today it is 20121114. Why is that?

    Sent from my HTC One X using Tapatalk 2

    This is the case when your build is just a rebuild. It is using old parts that it has already created. It made, so to say, a rebuild on the base of your last full build: in your case that was on 20121113.

    To reflect the actual date and time and to get the new date also in the "about phone" window while running the system on your LG P990, just delete the build.prop file in "cm10/out/target/product/p990/system". Then rebuid and voilà: the new date is everywhere.

    EDIT: And Owain beat me to it! But you know, there is no shame in being beaten by Owain. Thanks man for your competent help everywhere!