[Sprint LG Optimus G] BMP7777:
Welcome

This is a guide for all those who want to build for their LGOG but do not neccesasarily have the knowledge or experience.

This is an unofficial guide for the building of custom ROMs and other mods for the Sprint LG Optimus G (LS970). This is a work in progress, with additions being made as often as possible. This thread has already grown with the help of the devs established in this forum. I began this project a year ago when I was using a Samsung GS II Skyrocket. I have moved on to a new device, but the thread remains to this day, maintained by a good friend of mine, Car vs Driver. The point is this: everyone who uses this site has a desire for modding, customizing, and/or otherwise altering their device. Unfortunately, many have no idea how to go about doing these things for themselves. As such, there is a lot of dissatisfaction among developers about receiving constant demands, suggestions, and requests for updates. This thread is meant to give those who want to step up and build for themselves the means to do so. It is an ever-changing thread, with all assistance welcomed.

READ ME:

On one hand, it should go without saying that if you have no knowledge and/or experience with building, java, C++, and various other tools, you probably shouldn't begin here. At the same time, it is possible to learn to build, provided you can read, follow directions, and aren't too lazy to RESEARCH.

OH YEAH, and you better have patience. This isn't easy. It will be work. The quickest way to get flamed is to show yourself to be lazy. If you think that with a couple clicks, you can have your own flashy ROM, forget it. But, if you do want to learn, this is a good place to get started. I have no ego about this, and I want to help everyone learn to build their own ROM. But, everyone will struggle to get to a successful point, and lazy, unmotivated people just irritate those who have had to learn from scratch too. Tutorials will be posted for any new thing learned and built as time and space allow. ALL ARE WELCOME AND ALL QUESTIONS ARE TOO. But, seriously, if it's a really ridiculous one, I/we reserve the right to screw with you about it.

Thread Disclaimer:

The instructions and extras posted here are to be used at your own risk. I am working hard to provide good, workable tutorials that will make successful building much easier. Nevertheless, I am not responsible if you lose your files, brick your device, or inadvertently cause a nuclear war. If you are seeking absolute perfection, RUN NOW WHILE YOU STILL CAN!!

Building instructions are in post #1 - Extras are in post #2 - All relevant tutorials are in post #3 - Porting guide is in Post #4

GETTING STARTED

Setting up your environment :

This is a combination of the steps offered in the threads 'Compile JB on Ubuntu' and TeamChopsticks CyanogenMod.

Special thanks to dastin1015 and TeamChopsticks.

Tip: Allocate at least 75 gigs of space for the building of ONE ROM. If you install ccache, you will want 90. A complete build directory can use as much as 100 gigs, so make sure you have plenty of room. One of the ways to fail out a build is too use all of your partition before acquiring all the necessary files.

Here are the steps from those 2 tutorials in correct order:

1) You need the following:

-JDK 6 if you wish to build Jellybean.

[COLOR="Black"]$ sudo apt-get install openjdk-6-jdk
-Python 2.4 -- 2.7, which you can download from python.org.[/COLOR]

Or:

[COLOR="black"]$ sudo apt-get install python
-Git 1.7 or newer. You can find it at git-scm.com.[/COLOR]

Or:

[COLOR="black"]$ sudo apt-get install git-core[/COLOR]

-Android SDK:

Download the SDK here: http://developer.android.com/sdk/index.html

Extract the SDK and place it in your home directory.

I renamed my SDK to android-sdk to make it easier to navigate to – this tutorial assumes you've done that as well.

Go to your home folder, press Ctrl+H to show hidden files, and open up your .bashrc file.

Add these lines at the bottom of the file:

[COLOR="black"]# Android tools
export PATH=${PATH}:~/android-sdk/tools
export PATH=${PATH}:~/android-sdk/platform-tools
export PATH=${PATH}:~/bin[/COLOR]

Find your .profile file and add this at the bottom of the file:

[COLOR="black"]PATH="$HOME/android-sdk/tools:$HOME/android-sdk/platform-tools:$PATH"
You have now successfully installed the Android SDK.[/COLOR]

To check for updates issue this into your terminal:

[COLOR="black"]$ android[/COLOR]

2) Install required packages. 64-bit (recommended)

[COLOR="black"]$ sudo apt-get install git-core gnupg flex bison gperf build-essential \
zip curl zlib1g-dev libc6-dev lib32ncurses5-dev ia32-libs \
x11proto-core-dev libx11-dev lib32readline-gplv2-dev lib32z-dev \
libgl1-mesa-dev g++-multilib mingw32 tofrodos python-markdown \
libxml2-utils lzop schedtool[/COLOR]

On newer versions of Ubuntu such as 11.10 you may need to do the following:

[COLOR="black"]$ sudo ln -s /usr/lib/i386-linux-gnu/libX11.so.6 /usr/lib/i386-linux-gnu/libX11.so[/COLOR]

[COLOR="black"]$ 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 xsltproc zlib1g-dev:i386
$ sudo ln -s /usr/lib/i386-linux-gnu/mesa/libGL.so.1 /usr/lib/i386-linux-gnu/libGL.so[/COLOR]

3) Configure your USB.

[COLOR="black"]$ gksudo gedit /etc/udev/rules.d/51-android.rules[/COLOR]

Inside of this blank text file insert:

[COLOR="black"]#Acer
SUBSYSTEM=="usb", ATTR{idVendor}=="0502", MODE="0666"

#ASUS
SUBSYSTEM=="usb", ATTR{idVendor}=="0b05", MODE="0666"

#Dell
SUBSYSTEM=="usb", ATTR{idVendor}=="413c", MODE="0666"

#Foxconn
SUBSYSTEM=="usb", ATTR{idVendor}=="0489", MODE="0666"

#Garmin-Asus
SUBSYSTEM=="usb", ATTR{idVendor}=="091E", MODE="0666"

#Google
SUBSYSTEM=="usb", ATTR{idVendor}=="18d1", MODE="0666"

#HTC
SUBSYSTEM=="usb", ATTR{idVendor}=="0bb4", MODE="0666"

#Huawei
SUBSYSTEM=="usb", ATTR{idVendor}=="12d1", MODE="0666"

#K-Touch
SUBSYSTEM=="usb", ATTR{idVendor}=="24e3", MODE="0666"

#KT Tech
SUBSYSTEM=="usb", ATTR{idVendor}=="2116", MODE="0666"

#Kyocera
SUBSYSTEM=="usb", ATTR{idVendor}=="0482", MODE="0666"

#Lenevo
SUBSYSTEM=="usb", ATTR{idVendor}=="17EF", MODE="0666"

#LG
SUBSYSTEM=="usb", ATTR{idVendor}=="1004", MODE="0666"

#Motorola
SUBSYSTEM=="usb", ATTR{idVendor}=="22b8", MODE="0666"

#NEC
SUBSYSTEM=="usb", ATTR{idVendor}=="0409", MODE="0666"

#Nook
SUBSYSTEM=="usb", ATTR{idVendor}=="2080", MODE="0666"

#Nvidia
SUBSYSTEM=="usb", ATTR{idVendor}=="0955", MODE="0666"

#OTGV
SUBSYSTEM=="usb", ATTR{idVendor}=="2257", MODE="0666"

#Pantech
SUBSYSTEM=="usb", ATTR{idVendor}=="10A9", MODE="0666"

#Philips
SUBSYSTEM=="usb", ATTR{idVendor}=="0471", MODE="0666"

#PMC-Sierra
SUBSYSTEM=="usb", ATTR{idVendor}=="04da", MODE="0666"

#Qualcomm
SUBSYSTEM=="usb", ATTR{idVendor}=="05c6", MODE="0666"

#SK Telesys
SUBSYSTEM=="usb", ATTR{idVendor}=="1f53", MODE="0666"

#Samsung
SUBSYSTEM=="usb", ATTR{idVendor}=="04e8", MODE="0666"

#Sharp
SUBSYSTEM=="usb", ATTR{idVendor}=="04dd", MODE="0666"

#Sony Ericsson
SUBSYSTEM=="usb", ATTR{idVendor}=="0fce", MODE="0666"

#Toshiba
SUBSYSTEM=="usb", ATTR{idVendor}=="0930", MODE="0666"

#ZTE
SUBSYSTEM=="usb", ATTR{idVendor}=="19D2", MODE="0666"[/COLOR]

4) Save the file and close it and then issue this command:

[COLOR="black"]$ sudo chmod a+r /etc/udev/rules.d/51-android.rules[/COLOR]

5) Install the repo:

[COLOR="black"]$ mkdir ~/bin
$ PATH=~/bin:$PATH
$ curl https://dl-ssl.google.com/dl/googlesource/git-repo/repo > ~/bin/repo
$ chmod a+x ~/bin/repo[/COLOR]

Create your work directory:

[COLOR="black"]mkdir ~/"your directory name here" For example: mkdir ~/cm11
cd ~/cm10[/COLOR]

Setup local manifest:

[COLOR="Black"]mkdir .repo/local_manifests
touch .repo/local_manifests/local_manifest.xml
nano .repo/local_manifests/local_manifest.xml[/COLOR]

A local manifest is your chance to remove/add packages to the repo before you sync.

This is what you need for your build environment. From here, the various types of ROM styles can be built with a few additions and commands.

Unofficial

To get started with Android/CyanogenMod, you'll need to get familiar with Git and Repo.

To initialize your local repository using the CyanogenMod trees, use a command like this:

[COLOR="black"]repo init -u https://github.com/CyanogenMod/android.git -b cm-11.0[/COLOR]

Then to sync up:

[COLOR="black"]repo sync[/COLOR]

Please see the CyanogenMod Wiki for building instructions.

For more information on this Github Organization and how it is structured, please read the wiki article.

Create and edit roomservice.xml in .repo:

[COLOR="black"]gedit /.repo/local_manifests/roomservice.xml[/COLOR]

Add this to the roomservice.xml:

[COLOR="Black"]
<manifest>
<project name="TeamLGOG/android_vendor_lge_gee" path="vendor/lge/gee" remote="github" revision="cm-11.0"/>
<project name="TeamLGOG/android_device_lge_gee-common" path="device/lge/gee-common" remote="github" revision="cm-11.0"/>
<project name="TeamLGOG/android_device_lge_geehrc4g_spr_us" path="device/lge/geehrc4g_spr_us" remote="github" revision="cm-11.0"/>
<project name="TeamLGOG/lge-kernel-geem" path="kernel/lge/geem" remote="github" revision="cm-11.0"/>
</manifest>[/COLOR]

then

[COLOR="Black"]repo sync[/COLOR]

[COLOR="black"]. build/envsetup.sh (notice the period and space)
vendor/cm/get-prebuilts
repo sync -j16[/COLOR]

then

[COLOR="Black"]CM_EXTRAVERSION=mycustombuild CM_SNAPSHOT=1 brunch cm_geehrc4g_spr_us-userdebug[/COLOR]

Unofficial

Special thanks to spleef and sharkboy0901 for putting this together -

First you must initialize a repository with RootBox sources:

[COLOR="black"]repo init -u git://github.com/Root-Box/platform_manifest.git -b jb-mr1[/COLOR]

then

[COLOR="black"]repo sync[/COLOR]

*This might take a few hours depending on your internet connection. *If you want to build for Android 4.1.2: Sync with -b jb-4.1.2

then add in your local_manifest to rootbox/.repo ( yeah i know usually is in its own local_manifest folder but for some reason it doesn't work like that for rootbox )

after it syncs you will have to manually edit several files in vendor/rootbox

in rootbox/vendor/rootbox:

you will need to add gee folder to rootbox/vendor/rootbox/overlay which should include the same overlay files found in your device overlay folder (ie.. frameworks and packages folders)

so create new folder call it gee inside it copy/paste the contents of rootbox/device/lge/geehrc4g_spr_us/overlay

now for next step

then you will need to add in some changes to rootbox/vendor/rootbox/products

in rootbox/vendor/rootbox/products

so once in rootbox/vendor/rootbox/products open up your androidproducts.mk and add this in to it either at the bottom or can be placed inline within the alphabet either way is fine...save and close it

so now we need to create a geehrc4g_spr_us.mk...

so create a new document called geerhc4g_spr_us.mk then open it and add these lines:

[COLOR="black"]# Inherit AOSP device configuration for geehrc4g_spr_us.
$(call inherit-product, device/lge/geehrc4g_spr_us/full_geehrc4g_spr_us.mk)

# Inherit CDMA common stuff.
$(call inherit-product, vendor/rootbox/configs/cdma.mk)

# Inherit RootBox common bits
$(call inherit-product, vendor/rootbox/configs/common.mk)

# geehrc4g_spr_us Overlays
PRODUCT_PACKAGE_OVERLAYS += vendor/rootbox/overlay/gee

# PA OVERLAY_TARGET
OVERLAY_TARGET := pa_xhdpi

# Setup device specific product configuration.
PRODUCT_NAME := rootbox_geehrc4g_spr_us
PRODUCT_BRAND := LGE
PRODUCT_MODEL := LG-LS970
PRODUCT_MANUFACTURER := LGE

#Set build fingerprint / ID / Prduct Name ect.
PRODUCT_BUILD_PROP_OVERRIDES += PRODUCT_NAME=geehrc4g_spr_us BUILD_FINGERPRINT=lge/geehrc4g_spr_us/geehrc4g:4.1.2/JZO54K/LS970ZVB.1360739022:user/release-keys PRIVATE_BUILD_DESC="geehrc4g_spr_us-user 4.1.2 JZO54K LS970ZVB.1360739022 release-keys"

# Copy Bootanimation
PRODUCT_COPY_FILES += \
vendor/rootbox/prebuilt/bootanimation/bootanimation_1280_768.zip:system/media/bootanimation.zip[/COLOR]

Save and close

So now next part

Go to rootbox/vendor/rootbox and click on the vendorsetup.sh and open it up and add in this line to either the bottom or inline with the alphabet either way is fine

[COLOR="Black"]add_lunch_combo rootbox_geehrc4g_spr_us-userdebug[/COLOR]

Save and close

After that is done make sure your everything else in your rootbox/device/lge/geehrc4g_spr_us .mk files match up to each other (ie.make sure everything says geehrc4g_spr_us and not geehrc4g

......not sure if this will be optional or not for you wouldnt build for me without doing it ....you can go from here and use the build script or continue on and try the kernel edits i had to make

Now you will have to manualy edit some files in rootbox/kernel/lge/geem ( or gee_mako depending on if your building the tlgog kernel or the bitbucket one )

these are the links for the fixes:

copy the lines that im linking in the exact location to look exactly like the the files in the links

[COLOR="black"]https://github.com/trailblazerz/lge-kernel-mako/commit/9e3dda2874eca3d8553e5cc74d79db23490a3dd7[/COLOR]

[COLOR="black"]https://github.com/trailblazerz/lge-kernel-mako/commit/ba5160c3f3f40d87321cc473003f64f6be5c4a31[/COLOR]

[COLOR="black"]https://github.com/trailblazerz/lge-kernel-mako/commit/72bbc15e45c778d4f2206c4309e25aaa5a98939c[/COLOR]

[COLOR="black"]https://github.com/trailblazerz/lge-kernel-mako/commit/9e87b59f33780894f02a1c56921c7d7d7ce0cb15[/COLOR]

[COLOR="black"]https://github.com/trailblazerz/lge-kernel-mako/commit/88b963032cf49c9628dafff76ec67f01f6255bdf[/COLOR]

[COLOR="black"]https://github.com/trailblazerz/lge-kernel-mako/commit/544788c2ef479ea9c333427720b61b8ee1411665[/COLOR]

Unofficial

Special thanks to scott.hart.bti for his hard work -

From terminal

1. type

[COLOR="black"]cd[/COLOR]

.

This will bring you to your root folder.

2. type

[COLOR="black"]mkdir beanstalk[/COLOR]

.

This will create a folder named beanstalk.

3. type

[COLOR="black"]cd beanstalk[/COLOR]

.

This will take you to the beanstalk directory created from previous step

4. type

[COLOR="black"]repo init -u git://github.com/scotthartbti/android.git -b cm-10.1[/COLOR]

.

This will setup the folders to be synced.

5. type

[COLOR="black"]repo sync[/COLOR]

.

This will sync the folders to your beanstalk directory. Note - This will take some time depending on internet connection. Be patient!

6. After the repo sync finally finishes, all you need to do is add your device, kernel, vendor specific files for the device you are building for. (You must know what these are, dont bother asking me if your not sure.)

7. Make sure all your device specific files are setup as if you were going to build for CM.

8. Outside of terminal, navigate to beanstalk/vendor/cm. Double click on the get-prebuilts file and select run in terminal. This will fetch necessary files needed to build and place them where they need to be.

9. Type

[COLOR="Black"]. build/envsetup.sh && brunch geehrc4g_spr_us[/COLOR]

10. Previous step will start building beanstalk for your device. The process takes anywhere from 1 - 3 hours depending on your computer.

11. Once completed, it will say package complete and you will have a beanstalk named zip file in your out folder.

Unofficial

Special thanks to spleef for laying this out -

First:

[COLOR="Black"]mkdir aokp[/COLOR]

then

[COLOR="black"]cd aokp[/COLOR]

then

[COLOR="black"]repo init -u https://github.com/AOKP/platform_manifest.git -b jb-mr1[/COLOR]

after it does its thing

[COLOR="black"]mkdir .repo/local_manifests
touch .repo/local_manifests/local_manifest.xml
nano .repo/local_manifests/local_manifest.xml[/COLOR]

then add these lines to the aokp local manifest:

[COLOR="black"]

[/COLOR]

save and exit then

[COLOR="black"]. ./platform_manifest/manual_add_kernel_manifest.sh[/COLOR]

which adds the kernel lists

then

[COLOR="black"]repo sync[/COLOR]

after everything syncs

[COLOR="black"]nano vendor/aokp/vendorsetup.sh[/COLOR]

and add this to the bottom:

[COLOR="black"]add_lunch_combo aokp_geehrc4g_spr_us-userdebug[/COLOR]

save and exit.. then i

[COLOR="black"]touch vendor/aokp/products/geehrc4g_spr_us.mk[/COLOR]

[COLOR="black"]nano vendor/aokp/products/geehrc4g_spr_us.mk[/COLOR]

then add in these lines:

[COLOR="black"]# Inherit AOSP device configuration for geehrc4g_spr_us
$(call inherit-product, device/lge/geehrc4g_spr_us/full_geehrc4g_spr_us.mk)

# Inherit AOKP common bits
$(call inherit-product, vendor/aokp/configs/common.mk)

# Inherit CDMA common stuff
$(call inherit-product, vendor/aokp/configs/cdma.mk)

# Setup device specific product configuration
PRODUCT_NAME := aokp_geehrc4g_spr_us
PRODUCT_BRAND := google
PRODUCT_DEVICE := geehrc4g_spr_us
PRODUCT_MODEL := Optimus G
PRODUCT_MANUFACTURER := LGE[/COLOR]

save and exit.. then

[COLOR="black"]nano vendor/aokp/products/AndroidProducts.mk[/COLOR]

and add this

[COLOR="black"]$(LOCAL_DIR)/geehrc4g_spr_us.mk \[/COLOR]

save and exit ( making sure it lines up correct like the rest of the lines in the file before saving )

then

[COLOR="black"]. build/envsetup.sh[/COLOR]

[COLOR="black"]lunch[/COLOR]

[COLOR="black"]make otapackage[/COLOR]

Building with Linaro 4.8 toolchain

Go into Terminal and navigate to the root folder of your source tree, then:

[COLOR="Black"]prebuilts/gcc/linux-x86/arm/[/COLOR]

Run:

[COLOR="black"]wget http://releases.linaro.org/13.06/components/toolchain/gcc-linaro/4.8/gcc-linaro-4.8-2013.06.tar.bz2[/COLOR]

Run:

[COLOR="black"]bunzip2 *.tar.bz2[/COLOR]

Run:

[COLOR="black"]tar -xvf *.tar[/COLOR]

Using your file manager, navigate to the root folder of your source tree again.

Navigate To "/build", in your root folder.

Run:

[COLOR="black"]gksudo gedit envsetup.sh[/COLOR]

change the line in bold, to look exactly like this one:

[COLOR="black"]case $ARCH in
x86) toolchaindir=x86/i686-linux-android-4.6/bin
;;
[B]arm) toolchaindir=arm/gcc-linaro-4.8-2013.06[/B] [COLOR="Red"]<--------[/COLOR]
;;
mips) toolchaindir=mips/mipsel-linux-android-4.6/bin
;;
*)
echo "Can't find toolchain for unknown architecture: $ARCH"
toolchaindir=xxxxxxxxx
;;
esac
[/COLOR]

Exit out and open new. Initialize and build. That's it! Makes you wonder why you never did it before, right?

Not so fast. You may have build issues, you may not. I had a few lengthy sets of errors in gsm calltracker and another .java file that was solved by using Meld and making it look exactly like a successful build's file. More as I learn.......

Thanks to infected_ for this tut; his post can be found here:

http://xdaforums.com/showpost.php?p=42976693&postcount=12

Camera tweaks, patches, and apks:

As we all know, the camera is the one stain on an otherwise nearly perfect device. I am asked constantly about new ways to get better functionality out of this cam, and rightly so. I will include a section here with all relevant 'fixes' and update as I can.....

Camera fix tweak

- http://xdaforums.com/showthread.php?t=2393667

Cam fix for JB

- http://xdaforums.com/showthread.php?p=37965814

Moto X camera apk.

-

Camera: http://d-h.st/66D

Gallery: http://d-h.st/7Na

Thread: http://xdaforums.com/showthread.php?t=2380199

4.3 Camera apk.

- http://db.tt/66HWiwVs

Thread: http://xdaforums.com/showthread.php?t=2343621

Focal Camera apk.

- https://copy.com/XUqyOvUwKecD

Thread: http://xdaforums.com/showthread.php?p=44093525

These are just the ones that I have time to hunt down right now. Post here any alternatives or PM me with them.

Thanks to:

CyanogenMod

TeamLGOG

Shelnutt2

Rlasalle15

scott.hart.bti

xboxfanj

Crwolv

spleef

Haze028

AdhvanIt

AdriVelazquez

car vs driver

M4570D0N

sharkboy0901

[/COLOR]

​