Donate
Dear Members, If you would like to see our site and development grow, please consider a small donation to our efforts. More donations means more devices supported which means more ROMs! Any and all donations go towards the site, development and much more! Thank you for your contributions! -BDH ======================= =======================
Top posters
BDH (171)
 
jl90x (137)
 
johnthehillbilly (95)
 
usmcamgrimm (70)
 
Nosnhoj (54)
 
CharmPeddler (29)
 
JaeKar99 (23)
 
lazer (23)
 
BDAZZG1 (17)
 
tomsgt123 (11)
 

Search
 
 

Display results as :
 


Rechercher Advanced Search

Statistics
We have 885 registered users
The newest registered user is Madhatter75

Our users have posted a total of 711 messages in 116 subjects

[How-To] Build / Port ROMs using source code (Various Devices)

 :: General :: How-To's

Go down

[How-To] Build / Port ROMs using source code (Various Devices)

Post by BDH on Sat Jun 08, 2013 7:30 am

First of all, let me just say a huge thanks to DDX and pcarenza for walking me through all these steps and also another huge thanks to pcarenza for letting me use his repos for this. Also a HUGE thanks to dhacker and hashcode0f for doing pretty much all the hard work on this stuff, for everyone else to enjoy!

So as you all know, I have been working with pcarenza to get some more knowledge on how to port ROMs. While I'm doing this for the Galaxy S4, it can easily be done with other devices.

My learning is still a work in progress but I wanted to share what I have so far.

This guide will assume that you are already running Ubuntu, or already have a Virtual Machine setup. This is NOT a guide for how to do that.

First thing we want to do is to get you a build environment going. For that, you're going to open a terminal in Ubuntu and enter the following lines, pressing "Enter" after each command:

First, you're going to get rid of OpenJava, it will not build Android.

Code:
sudo apt-get purge openjdk-\* icedtea-\* icedtea6-\*
sudo aptitude remove '~Pjava-runtime' '~Pjava-compiler'
Now you're going to install SunJava6

Code:
sudo add-apt-repository "deb http://archive.ubuntu.com/ubuntu hardy main multiverse"
sudo add-apt-repository "deb http://archive.ubuntu.com/ubuntu hardy-updates main multiverse"
sudo add-apt-repository "deb http://archive.canonical.com/ lucid partner"
sudo apt-get update
sudo apt-get install sun-java6-jdk
That will get you Java6 installed, Java6 is needed to build for Gingerbread and higher. Next we're going to install the required packages.

In Terminal again, enter this line, then press the "Enter" key:

Code:
sudo apt-get install git 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 tofrodos \
  python-markdown libxml2-utils xsltproc zlib1g-dev:i386
Now this line:

Code:
sudo ln -s /usr/lib/i386-linux-gnu/mesa/libGL.so.1 /usr/lib/i386-linux-gnu/libGL.so
Ok so here we are! You've gotten Java installed, you got your build environment all setup, now it's time to setup your directories and get to downloading source! First thing you're going to want to do is setup your working directory. For this we are going to enter these lines in Terminal:

Code:
mkdir ~/bin
PATH=~/bin:$PATH
Now we're going to download the repo tool and make sure it's executable:

Code:
curl https://dl-ssl.google.com/dl/googlesource/git-repo/repo > ~/bin/repo
chmod a+x ~/bin/repo
Next, in order to port most of the ROMs, your device needs to have a stable CM-10.1 or CM-10.2 build.

Once that part is done, head over to [You must be registered and logged in to see this link.]

Now you're going to need to poke around the CM source on github and find the necessary device, vendor and kernel repos for your device. This can easily be done by searching their github for repos with your device codename in them. (Example the VZW Galaxy S4's codename is jfltevzw)

Remember this guide is following with porting ROMs to the Galaxy S4. Knowing this, the following repos are the ones I would need to take note of:

Code:
android_device_samsung_qcom-common
android_device_samsung_msm8960-common
android_device_samsung_jf-common
android_kernel_samsung_jf
android_hardware_samsung
Now, please do not ask me what repos are for your device, I do not know and that would be something for you to figure out. An easy way to find them, if your device is officially or unofficially supported by CM is to build CM for it. After you do that, just go into your build folder, then navigate to /device/OEMhere/MODELhere/ (Example, mine would be /device/samsung/jfltevzw/) and find the "cm.dependencies" file. This will list all the repos needed to build any CM based ROM for your device.

After noting all the repos you need, now it's time to sync some source! First thing you need to do is go to the github page of the ROM you want to build/port. Look for a repo they have which is usually named "platform_maniest." Some of them are named differently and can be "android," "android_build," or even just "build."

What you're looking for is a "README" file. This file will give you the proper "repo init" code to sync their source.

In the next chapter, we will pick up on syncing source and making manifest edits.


Last edited by BDH on Sun Aug 18, 2013 10:10 am; edited 7 times in total

===============================================================================================





avatar
BDH
Admin
Admin

Posts : 171
Join date : 2013-06-03
Age : 37
Location : Hawaii

View user profile http://teamrage.4rumer.com

Back to top Go down

Re: [How-To] Build / Port ROMs using source code (Various Devices)

Post by BDH on Sat Jun 08, 2013 7:30 am

Ok so now you have the proper "repo init" line and you're about to sync their source. (Tip: Your build folder should be named similar to the source ROM you're trying to build. Example, my Carbon ROM build folder is named "carbon," in all lower case to save time on typing it).

***For the rest of this tutorial, we will base everything on Carbon. If you're not building Carbon, then just replace "carbon" with the name of the ROM you're building.***

So now you're going to go into your build folder by typing in this:

Code:
mkdir carbon
cd carbon
Now you're going to enter the "repo init" line you found in the README file. For example, mine would be:

Code:
repo init -u https://github.com/CarbonDev/android.git -b jb3 && repo sync -f
Please note that your "repo init" line WILL be different unless you're building Carbon.

The line above will automatically sync the repo as well. If yours does not, wait until you see in the command prompt that "repo has been initialized in xxxxx/xxxxxx/xxxx."

After that type the following:

Code:
repo sync
Now we wait. Depending on your internet connection and your RAM, this can take anywhere from 15 minutes, to 6 hours. Yes you read that right, 6 hours.

Once your repo is done syncing (you'll know when it's done). Now it's time to edit some files. In the next section we will discuss editing the manifest.xml


Last edited by BDH on Sat Sep 14, 2013 7:42 am; edited 2 times in total

===============================================================================================





avatar
BDH
Admin
Admin

Posts : 171
Join date : 2013-06-03
Age : 37
Location : Hawaii

View user profile http://teamrage.4rumer.com

Back to top Go down

Re: [How-To] Build / Port ROMs using source code (Various Devices)

Post by BDH on Sat Jun 08, 2013 7:30 am

Alright so you got all your source synced and you're ready to edit. What you're going to do now is go to your build folder and navigate to /.repo/manifests/default.xml

Open this file in a text editor or XML editor. This is where the fun begins.

With your default.xml open, you're going to input YOUR device repos into this manifest. How are you going to do that? Easy. For an easy explanation, go to this [You must be registered and logged in to see this link.] and skip to the section titled "Overriding the default Manifest: Local Manifest." The only part of this section you need is where it starts describing the syntax for making an XML file.

Ok so now that you've got your default.xml and all your repos for your device added. Go back to your command prompt and make sure you're in the root of the build folder by typing:

Code:
cd ~/carbon
And now you want to resync the repo that way you can pull your device specific repos into your build folder. You do this by again typing:

Code:
repo sync
Now when that is finished, it's time to build!

Still in your command prompt, type the following:

Code:
. build/envsetup.sh
^^ That period at the beginning is important, that period signifies the build folder. After typing that, you'll see some more code show up.

Now back in your command prompt again, type the following:

Code:
lunch
You'll see a list of device builds come up, select your device by entering the number to the left of your device. You'll see some more code, then you'll be able to enter text again. Back in your command prompt, type the following and final command:

Code:
make -j4 bacon
(-j4, the 4 represents the number of threads you would like to use to build. This number should be the number of cores you have, plus 1."

And that's it!!! Now you just wait for your build to complete!!

NOTE: If you got build errors and your build stopped. Google is your friend. Please do not post build errors here because I will not answer them. If I answered them, then there is no reason for you to learn anything. Smile

Have fun and enjoy building some ROMs!!!!!


Last edited by BDH on Sun Aug 18, 2013 8:52 am; edited 3 times in total

===============================================================================================





avatar
BDH
Admin
Admin

Posts : 171
Join date : 2013-06-03
Age : 37
Location : Hawaii

View user profile http://teamrage.4rumer.com

Back to top Go down

Re: [How-To] Build / Port ROMs using source code (Various Devices)

Post by BDH on Sat Aug 17, 2013 10:27 pm

Thread revamped Smile

===============================================================================================





avatar
BDH
Admin
Admin

Posts : 171
Join date : 2013-06-03
Age : 37
Location : Hawaii

View user profile http://teamrage.4rumer.com

Back to top Go down

Re: [How-To] Build / Port ROMs using source code (Various Devices)

Post by usmcamgrimm on Sun Aug 18, 2013 11:11 am

Thanks for the updated guide! Expect some good stuff soon!

===============================================================================================
[You must be registered and logged in to see this link.]
avatar
usmcamgrimm
Admin
Admin

Posts : 70
Join date : 2013-06-03
Age : 41
Location : Massillon, OH

View user profile

Back to top Go down

Re: [How-To] Build / Port ROMs using source code (Various Devices)

Post by Sponsored content


Sponsored content


Back to top Go down

Back to top


 :: General :: How-To's

 
Permissions in this forum:
You cannot reply to topics in this forum