[Sprint HTC One (M7)] BMP7777:
[GUIDE-HOW TO] Project Rookie III - ROM Building steps, tricks and tips for M7SPR [4.4] [WIP]

Welcome

This is a guide for all those who want to build for their Sprint HTC ONE 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 HTC ONE (M7SPR or M7WLS). 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 started another alike thread called PR II in the LGOG forum a while back as well. I have since moved on to a ONE, but both threads remain to this day. 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; I started the same way and just 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.

ALWAYS REMEMBER:

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 - Build fixes and tips are in post #2 - All relevant tutorials are in post #3 - Kernel building, CCACHE, and other steps and tips are 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 or KitKat.

[COLOR="Black"]$ sudo add-apt-repository ppa:webupd8team/java
sudo apt-get update
sudo apt-get install oracle-java6-installer
[/COLOR]

and:

-Python 2.4 -- 2.7, which you can download from python.org.

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

and:

-Git 1.7 or newer. You can find it at git-scm.com.

[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 ~/cm11[/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 git://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="CyanogenMod/android_device_htc_m7-common" path="device/htc/m7-common" remote="github" revision="cm-11.0" />
<project name="CyanogenMod/android_device_htc_m7spr" path="device/htc/m7spr" remote="github" revision="cm-11.0" />
<project name="CyanogenMod/android_device_htc_msm8960-common" path="device/htc/msm8960-common" remote="github" revision="cm-11.0" />
<project name="CyanogenMod/android_kernel_htc_m7" path="kernel/htc/m7" remote="github" revision="cm-11.0" />
<project name="TheMuppets/proprietary_vendor_htc" path="vendor/htc" 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_m7spr-userdebug[/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 kk44[/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. Within your .repo folder(control+H in your root build files), create a 'local manifests' folder. Within that folder, create a 'local_manifest.xml' doc.

7. Open that new, blank XML doc with Text Editor and paste in your local_manifest code:

[COLOR="Black"]
<manifest>
<project name="CyanogenMod/android_device_htc_m7-common" path="device/htc/m7-common" remote="github" revision="cm-11.0" />
<project name="CyanogenMod/android_device_htc_m7spr" path="device/htc/m7spr" remote="github" revision="cm-11.0" />
<project name="CyanogenMod/android_device_htc_msm8960-common" path="device/htc/msm8960-common" remote="github" revision="cm-11.0" />
<project name="CyanogenMod/android_kernel_htc_m7" path="kernel/htc/m7" remote="github" revision="cm-11.0" />
<project name="TheMuppets/proprietary_vendor_htc" path="vendor/htc" remote="github" revision="cm-11.0" />
</manifest>[/COLOR]

8. Save and exit

9. 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.

10. Type

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

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

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

Unverified

Unofficial

Special thanks to MallardDuck for sharing this information

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

First Make your Pac directory and initilize the repo with the following commands:

[COLOR="Black"]mkdir pacrom && cd pacrom[/COLOR]

[COLOR="black"]repo init -u git://github.com/PAC-man/pacman.git -b pac-4.4[/COLOR]

Then to sync up:

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

Wait, but once you're done waiting feel free to move on...

Once properly synced the next step is to sync device files and to compile; which with PAC is all one step.

Simply,

[COLOR="black"]./build-pac -j# m7spr[/COLOR]

Where # is the number of cores you have.

This command will thriger the pac build scrpt that will then download the needed device trees and begin compiling.

Unverified

Unofficial

Special thanks to spleef and ktempleman for laying this out

This set of instructions is unverified. If you build successfully or have build issues, please post here so we can confirm or fix what isn't working

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 kk[/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"]
<manifest>
<project name="CyanogenMod/android_device_htc_m7-common" path="device/htc/m7-common" remote="github" revision="cm-11.0" />
<project name="CyanogenMod/android_device_htc_m7spr" path="device/htc/m7spr" remote="github" revision="cm-11.0" />
<project name="CyanogenMod/android_device_htc_msm8960-common" path="device/htc/msm8960-common" remote="github" revision="cm-11.0" />
<project name="CyanogenMod/android_kernel_htc_m7" path="kernel/htc/m7" remote="github" revision="cm-11.0" />
<project name="TheMuppets/proprietary_vendor_htc" path="vendor/htc" remote="github" revision="cm-11.0" />
</manifest>
[/COLOR]

save and exit 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_m7spr-userdebug[/COLOR]

save and exit.. then

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

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

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

For more on AOKP building, try here: http://aokp.co/learn/so-you-want-to-build-aokp-jb-ubuntu-1204

And Here: https://github.com/AOKP

Unofficial

Getting Started

To get started with the Carbon-Dev sources, you'll need to get familiar with Git and Repo.

Create the Directories

You will need to set up some directories in your build environment.

To create them run:

[COLOR="black"]mkdir -p ~/bin[/COLOR]

[COLOR="black"]mkdir -p ~/carbon[/COLOR]

Install the Repository

Enter the following to download make executable the "repo" binary:

[COLOR="black"]curl https://dl-ssl.google.com/dl/googlesource/git-repo/repo > ~/bin/repo[/COLOR]

[COLOR="black"]chmod a+x ~/bin/repo[/COLOR]

You may need to reboot for these changes to take effect. Now enter the following to initialize the repository:

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

Repositories:

Before you continue --> run this in the terminal

[COLOR="black"]repo init -u https://github.com/CarbonDev/android.git -b kk && repo sync -f[/COLOR]

PLEASE NOTE THAT YOU MUST USE THE -f flag when repo syncing/initializing if you want to sync with our default -j4 setup as android.googlesource seems to like to reject your requests if you set your -jflag too high. if you wish to avoid this issue run it repo sync -j1 otherwise -f (force) is reccomended so it will resync the repos it gets error codes on. Thank you and have a nice day.

Building the System

Initialize the environment with the envsetup.sh script. Note that replacing "source" with a single dot saves a few characters, and the short form is more commonly used in documentation.

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

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

Enter the number of the build you want to start and press enter

Build the Code:

[COLOR="black"]make carbon -j7 = Run Squisher/Run Opticharger[/COLOR]

[COLOR="Black"]make otapackage -j7 = No Squisher/No Opticharger[/COLOR]

Unofficial

Getting Started

From terminal

1. type

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

.

This will bring you to your root folder.

2. type

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

.

This will create a folder named beanstalk.

3. type

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

.

This will take you to the cfx directory created from previous step.

4. Then: - From the CFX git, found here: https://github.com/codefireXperiment/android_manifest

Init core trees without any device/kernel/vendor :

[COLOR="Black"]$ repo init -u git://github.com/codefireXperiment/android_manifest.git -b kk-devel[/COLOR]

Init repo with all devices, kernels and vendors supported by codefireXperiment :

[COLOR="black"]$ repo init -u git://github.com/codefireXperiment/android_manifest.git -b kk-devel -g all,kernel,device,vendor[/COLOR]

Init repo only for a particular device :

[COLOR="black"]$ repo init -u git://github.com/codefireXperiment/android_manifest.git -b kk-devel -g all,-notdefault,<devicename>,<vendorname>[/COLOR]

for example, to init only trees needed to build mako :

[COLOR="black"]$ repo init -u git://github.com/codefireXperiment/android_manifest.git -b kk-devel -g all,-notdefault,mako,lge[/COLOR]

Init repo for multiple devices :

[COLOR="black"]$ repo init -u git://github.com/codefireXperiment/android_manifest.git -b kk-devel -g all,-notdefault,<devicename1>,<devicename2>,<devicename3>,<vendorname1>,<vendorname2>,<vendorname3>[/COLOR]

for example, to init trees needed to build mako and grouper :

[COLOR="black"]$ repo init -u git://github.com/codefireXperiment/android_manifest.git -b kk-devel -g all,-notdefault,mako,grouper,lge,asus[/COLOR]

Then to sync up:

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

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

5. Within your .repo folder(control+H in your root build files), create a 'local manifests' folder. Within that folder, create a 'local_manifest.xml' doc.

6. Open that new, blank XML doc with Text Editor and paste in your local_manifest code:

[COLOR="Black"]
<manifest>
<project name="CyanogenMod/android_device_htc_m7-common" path="device/htc/m7-common" remote="github" revision="cm-11.0" />
<project name="CyanogenMod/android_device_htc_m7spr" path="device/htc/m7spr" remote="github" revision="cm-11.0" />
<project name="CyanogenMod/android_device_htc_msm8960-common" path="device/htc/msm8960-common" remote="github" revision="cm-11.0" />
<project name="CyanogenMod/android_kernel_htc_m7" path="kernel/htc/m7" remote="github" revision="cm-11.0" />
<project name="TheMuppets/proprietary_vendor_htc" path="vendor/htc" remote="github" revision="cm-11.0" />
</manifest>[/COLOR]

7. Save and exit

8. Sync again....

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

9. Issue build commands:

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

[COLOR="black"]lunch full_m7spr-codefirex && mka bacon[/COLOR]

Unofficial

Special thanks to gimmeitorilltell for laying this out

Getting Started

From terminal

type

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

.

This will bring you to your root folder.

type

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

.

This will create a folder named mokee.

type

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

.

This will take you to the mokee directory created from previous step.

Then, to sync up the sources:

[COLOR="Black"]repo init -u git://github.com/MoKee/android.git -b kk_mkt[/COLOR]

and:

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

After source finishes, type

[COLOR="black"]vendor/mk/get-prebuilts[/COLOR]

- this is a quick download here.

Now it's time for your device tree; if the device is not supported yet by mokee then you'll need to do something like this to make your repo pull in your device trees.

Create an xml file, it can be named "anything.xml" so long as it is a ".xml".

[COLOR="black"]<?xml version="1.0" encoding="UTF-8"?>
<manifest>
<remote name="github" fetch="git://github.com" />
<project name="TheMuppets/proprietary_vendor_htc" path="vendor/htc" remote="github" revision="cm-11.0" />
</manifest>[/COLOR]

This .xml needs to placed in your .repo folder ina folder of its own called <local_manifests>.

NOTICE the remote name to fetch "github"? That's the special fetch we need for mokee - DON'T forget the rest of your device tree if mokee does not support it. Below is an example of what mokee does support & you'll see that we don't need the github url for our manifest to fetch these trees:

[COLOR="black"]<?xml version="1.0" encoding="UTF-8"?>
<manifest>
<project name="MoKee/android_device_htc_msm8960-common" path="device/htc/msm8960-common" remote="mokee" revision="kk_mkt" />
<project name="MoKee/android_device_htc_m7-common" path="device/htc/m7-common" remote="mokee" revision="kk_mkt" />
<project name="MoKee/android_vendor_htc_m7-common" path="vendor/htc/m7-common" remote="mokee" revision="kk_mkt" />
<project name="MoKee/android_vendor_htc_m7spr" path="vendor/htc/m7spr" remote="mokee" revision="kk_mkt" />
<project name="MoKee/android_kernel_htc_m7" path="kernel/htc/m7" remote="mokee" revision="kk_mkt" />
</manifest>[/COLOR]

After getting everything setup you want to set the output of your rom. Find the "mk" file in the root of your source. You WILL need to open your source folder with "root" perms to change the "mk" file. Go to line 67 & delete the "#" before this writing "OUT_DIR=/mokee/out/target/product/$DEVICE" .

[COLOR="black"]# if you set another OUT_DIR,set this before use.

#OUT_DIR=/mokee/out/target/product/$DEVICE
if [ "mk$OUT_DIR" == "mk" ][/COLOR]

You want to type in "repo sync" again to grab the device trees, once this finishes you're ready to start compiling.

Type

[COLOR="black"]. build/envsetup.sh && breakfast <device name> && ./mk <device name>[/COLOR]

without the quotations, of course you'll want to put your devices name in that you wish to build for.

This is a work in progress. Many more pieces of information will be added and this is meant to be an ever-changing thread. If you see something that is outdated or incorrect, please let me know ASAP, so I can make the correction. Also, make sure that any info offered can be and has been confirmed as functional.

Thanks to:

CyanogenMod

scott.hart.bti

Team Carbon

david279

MallardDuck

ktempleton

AdhvanIt

matthew0776

spleef

M4570D0N

car vs driver

gimmeitorilltell

​

XDA:DevDB Information

Project Rookie III, Tool/Utility for the HTC One

Contributors

BMP7777

Version Information

Status: Testing

Created 2014-05-30

Last Updated 2014-05-30