[GUIDE]Building any ROM from source for HTC One S aka ville!

2,418 posts
Thanks Meter: 2,304
 
By phoenixita, Senior Member on 23rd December 2013, 02:12 PM
Post Reply Email Thread
Do you know about a ROM that it's not builded for our beloved One S? Do you want to port it for our device? This easy guide will help you.

Requirements:


  1. A One S.
  2. A relatively recent computer (Linux, OS X, or Windows) w/a reasonable amount of RAM and about 35 GB of free storage. The less RAM you have, the longer the build will take. Using SSDs results in faster builds than traditional hard drives.
  3. A micro USB cable.
  4. A decent Internet connection & reliable electricity
  5. Some familiarity with basic Android operation and terminology. It would help if you’ve installed custom roms on other devices and are familiar with what a recovery image such as ClockworkMod is, for example. It may also be useful to know some basic command line concepts such as cd for “change directory”, the concept of directory hierarchies, that in Linux they are separated by /, etc.

HERE IS THE GUIDE.

Installing Build Packages
Open the terminal and type: (for 64-bit&32-bit)
Code:
sudo apt-get install bison build-essential curl flex git-core gnupg gperf libesd0-dev libncurses5-dev libsdl1.2-dev libwxgtk2.8-dev libxml2 libxml2-utils lzop openjdk-6-jdk openjdk-6-jre pngcrush schedtool squashfs-tools xsltproc zip zlib1g-dev
In addition to the above, for 64-bit systems:
Code:
sudo apt-get install g++-multilib gcc-multilib lib32ncurses5-dev lib32readline-gplv2-dev lib32z1-dev
Creating Directories
In order to start building ROMs you'll need to create some directories
Code:
mkdir -p ~/bin
mkdir -p ~/yourworkingdirectory
Installing the REPO command
Enter the following to download the "repo" binary:
Code:
curl http://commondatastorage.googleapis.com/git-repo-downloads/repo > ~/bin/repo
Now lets give this the proper permissions to make it runnable:
Code:
chmod a+x ~/bin/repo
Put the ~/bin directory in your path of execution
Make sure that the ~/bin directory you just created is in your path of execution so that you can easily run the repo command even when you're not in ~/bin.
Code:
export PATH=${PATH}:~/bin
Initialize the source repository
Code:
cd yourworkingdirectory
Now you'll need the repo init related to the rom you'd like to build. Here i will insert some of the I used. Anyway to find this you can go the rom's github and search for the manifest (android or platform-manifest).Just choose the right branch.
Code:
repo init -u git://github.com/CyanogenMod/android.git -b cm-11.0
repo init -u git://github.com/LiquidSmooth/android.git -b kitkat
repo init -u git://github.com/SlimRoms/platform_manifest.git -b kk4.4-caf
Download the source code
This will download all the source code to your computer.Prepare to wait a long time while the source code downloads.
Code:
repo sync
Download device,kernel and vendor tree for Liquid
We will use CM ones. Thanks a lot.
Basically we need to add some projects to the download list. To do this we'll need a local_manifest.
Go in the .repo folder in your working directory(it's an hidden folder press ctrl+h). Create a new folder called "local manifests" then double click on it. Now you'll have to create a roomservice.xml file for the most of the ROMs and a slim_manifest.xml for SlimRoms, it's the same thing just the name it's different.
Open this file and paste this inside:
Code:
<?xml version="1.0" encoding="UTF-8"?>
<manifest>
<remote  name="github"
           fetch="git://github.com/" />
<project name="CyanogenMod/android_device_htc_ville" path="device/htc/ville" remote="github" revision="cm-11.0" />
  <project name="CyanogenMod/android_device_htc_s4-common" path="device/htc/s4-common" 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_msm8960" path="kernel/htc/msm8960" remote="github" revision="cm-11.0" />
 <project name="TheMuppets/proprietary_vendor_htc" path="vendor/htc" remote="github" revision="cm-11.0" />
</manifest>
Now give another:
Code:
repo sync
and wait.

Do some modifications to the .mk files
Since we are using CM device tree we need to modify them for the choosen ROM.
Go into the device folder(device/htc/ville) and do some modifications. I will explain you what i mean using LiquidSmooth as example.
1) Create a new file called vendorsetup.sh . Open it and inside you'll have to write a script to add it to the lunch list.
Code:
add_lunch_combo liquid_ville-userdebug
You can choose if you want an userdebug version of the rom or an eng one just by writing eng instead of userdebug.
2) Now rename cm.mk into liquid.mk(for other ROMs this file should be renamed in a different way. Use an existing device tree to see the correct naming.)
3) Open the .mk file. You'll find something like this:
Code:
# Release name
PRODUCT_RELEASE_NAME := ville

# Boot animation
TARGET_SCREEN_HEIGHT := 960
TARGET_SCREEN_WIDTH := 540

# Inherit some common CM stuff.
$(call inherit-product, vendor/cm/config/common_full_phone.mk)

# Inherit device configuration
$(call inherit-product, device/htc/ville/device_ville.mk)

# Device naming
PRODUCT_DEVICE := ville
PRODUCT_NAME := cm_ville
PRODUCT_BRAND := htc
PRODUCT_MODEL := One S
PRODUCT_MANUFACTURER := HTC

# Set build fingerprint / ID / Product Name ect.
PRODUCT_BUILD_PROP_OVERRIDES += PRODUCT_NAME=htc_ville BUILD_FINGERPRINT=htc_europe/ville/ville:4.1.1/JRO03C/128506.8:user/release-keys PRIVATE_BUILD
You need to modify some things to make it buildable:
Code:
# Inherit some common CM stuff.
$(call inherit-product, vendor/cm/config/common_full_phone.mk)
becomes:
Code:
# Inherit some common LiquidSmooth stuff.
$(call inherit-product, vendor/liquid/config/common_phone.mk)
To understand the changes you'll have to go in the vendor folder searching the rom specific vendor and open the config folder to see what .mk file you need.You need to use your brain to understand what you should write instead of cm every ROM has different naming conventions.
This:
Code:
PRODUCT_NAME := cm_ville
becomes:
Code:
PRODUCT_NAME := liquid_ville
4) Now rename cm.dependencies in liquid.dependencies(SlimRoms does not require this step for unsupported devices.)

Start the build
Code:
source build/envsetup.sh
If you created the vendorsetup.sh in the right way you will read the ville folder.
Code:
lunch
Now you have to choose the number near the ville in the list of the supported devices.
If you have done all in the correct way in your terminal you'll see a page like this:
Click image for larger version

Name:	Schermata del 2013-12-23 15:08:01.jpg
Views:	1071
Size:	143.2 KB
ID:	2470228

Build
After lunching you have to start the build using the right command:
For liquid:
Code:
time mka liquid
For others:
Code:
make bacon
make
brunch devicename
Wait some time till the build ends hopefully with no errors.


Now You could think that i forgot you hboot 2.16 users.But this is not true. This is a cherry-pick that let you build every rom for 2.16 hboot.
Code:
cd device/htc/ville
git fetch http://review.cyanogenmod.org/CyanogenMod/android_device_htc_ville refs/changes/47/53647/9 && git cherry-pick FETCH_HEAD
Since you have no 4.4 recovery you'll need this other step:
Code:
Flashable via  normal TWRP
add this line
SKIP_SET_METADATA := true
in device/htc/s4-common/BoardConfigCommon.mk
cherry-pick i think.
Code:
cd workingdirectory/build
git fetch http://review.cyanogenmod.org/CyanogenMod/android_build refs/changes/59/53559/6 && git cherry-pick FETCH_HEAD


Credits: http://wiki.cyanogenmod.org/w/Build_for_ville
and all the experience i got in this 2 months of building.
The Following 25 Users Say Thank You to phoenixita For This Useful Post: [ View ] Gift phoenixita Ad-Free
23rd December 2013, 02:13 PM |#2  
phoenixita's Avatar
OP Senior Member
Flag Civitavecchia
Thanks Meter: 2,304
 
Donate to Me
More
For most ROMS you'll have some overlays errors.
Just go in the overlay folder linked in the error and open config.xml. Just delete the lines in the error or search in the folder history the commit that you have to revert.
To revert a commit:
Code:
cd intheinteressedfolder
git revert thenumberofthecommit
Here is a screenshot of the what the number/name of the commit is:
Click image for larger version

Name:	Schermata del 2013-12-23 15:20:05.png
Views:	665
Size:	158.5 KB
ID:	2470242
The Following 6 Users Say Thank You to phoenixita For This Useful Post: [ View ] Gift phoenixita Ad-Free
23rd December 2013, 03:11 PM |#3  
Hai96's Avatar
Senior Member
Thanks Meter: 310
 
More
it might be a stupid question: so i dont need any programing skills?
23rd December 2013, 03:14 PM |#4  
phoenixita's Avatar
OP Senior Member
Flag Civitavecchia
Thanks Meter: 2,304
 
Donate to Me
More
Quote:
Originally Posted by Hai96

it might be a stupid question: so i dont need any programing skills?

For building from source nope :P
The Following User Says Thank You to phoenixita For This Useful Post: [ View ] Gift phoenixita Ad-Free
23rd December 2013, 03:18 PM |#5  
Hai96's Avatar
Senior Member
Thanks Meter: 310
 
More
Quote:
Originally Posted by phoenixita

For building from source nope :P

Ok, then I will test your Guide
23rd December 2013, 03:20 PM |#6  
phoenixita's Avatar
OP Senior Member
Flag Civitavecchia
Thanks Meter: 2,304
 
Donate to Me
More
Quote:
Originally Posted by Hai96

Ok, then I will test your Guide

Added some lines in purple for 2.16 users.
The Following 3 Users Say Thank You to phoenixita For This Useful Post: [ View ] Gift phoenixita Ad-Free
23rd December 2013, 09:35 PM |#7  
Hai96's Avatar
Senior Member
Thanks Meter: 310
 
More
@phoenixita Iam stucking at the point of doing modifications to the mk. files, i dont have a ville folder in my device folder...

Click image for larger version

Name:	Bildschirmfoto vom 2013-12-23 23:13:49.jpg
Views:	339
Size:	155.9 KB
ID:	2471072
The Following User Says Thank You to Hai96 For This Useful Post: [ View ] Gift Hai96 Ad-Free
23rd December 2013, 11:09 PM |#8  
phoenixita's Avatar
OP Senior Member
Flag Civitavecchia
Thanks Meter: 2,304
 
Donate to Me
More
Quote:
Originally Posted by Hai96

@phoenixita Iam stucking at the point of doing modifications to the mk. files, i dont have a ville folder in my device folder...

Attachment 2471072

Download device,kernel and vendor tree for Liquid
We will use CM ones. Thanks a lot.
Basically we need to add some projects to the download list. To do this we'll need a local_manifest.
Go in the .repo folder in your working directory(it's an hidden folder press ctrl+h). Create a new folder called "local manifests" then double click on it. Now you'll have to create a roomservice.xml file for the most of the ROMs and a slim_manifest.xml for SlimRoms, it's the same thing just the name it's different.
Open this file and paste this inside:
Code:
<?xml version="1.0" encoding="UTF-8"?>
<manifest>
<remote name="github"
fetch="git://github.com/" />
<project name="CyanogenMod/android_device_htc_ville" path="device/htc/ville" remote="github" revision="cm-11.0" />
<project name="CyanogenMod/android_device_htc_s4-common" path="device/htc/s4-common" 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_msm8960" path="kernel/htc/msm8960" remote="github" revision="cm-11.0" />
<project name="TheMuppets/proprietary_vendor_htc" path="vendor/htc" remote="github" revision="cm-11.0" />
</manifest>
Now give another:
Code:
repo sync
and wait.
The Following User Says Thank You to phoenixita For This Useful Post: [ View ] Gift phoenixita Ad-Free
24th December 2013, 12:03 AM |#9  
Hai96's Avatar
Senior Member
Thanks Meter: 310
 
More
@phoenixita I had followed your guide and now I have the 3.0 liquid smooth build and it boots.
But the build process was very slow, my computer needed 4 hours to build this. Does it need only at the first building process so long or it's my computer ?
If I want to build paranoid android, what do I need to change?
24th December 2013, 08:59 PM |#10  
phoenixita's Avatar
OP Senior Member
Flag Civitavecchia
Thanks Meter: 2,304
 
Donate to Me
More
Quote:
Originally Posted by Hai96

@phoenixita I had followed your guide and now I have the 3.0 liquid smooth build and it boots.
But the build process was very slow, my computer needed 4 hours to build this. Does it need only at the first building process so long or it's my computer ?
If I want to build paranoid android, what do I need to change?

Paranoid android it's a different thing anyway rmbq has written a guide for porting PA.
4 hours it's okay...
The Following User Says Thank You to phoenixita For This Useful Post: [ View ] Gift phoenixita Ad-Free
24th December 2013, 10:16 PM |#11  
Hai96's Avatar
Senior Member
Thanks Meter: 310
 
More
i have another question :P

When I want to build AOKP,Slim Rom,... I need to create for every Rom a new working directory and download Repositorys,or?
Post Reply Subscribe to Thread

Tags
development

Guest Quick Reply (no urls or BBcode)
Message:
Previous Thread Next Thread
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes