Compile your own version of CM7 (possibly 9 and 10 too!) the easy way! - myTouch 4G General

Compiling CM7 on the HTC Glacier (T-Mobile MyTouch 4g)
​
I was trying to learn how to compile CM7 from source on my Glacier as practice for when my new Nexus 4 arrives next month. I originally followed a guide by Sykopompos but it's severely out of date (and didn't work off the bat for me). I figured I'd turn this into a how-to to help anyone out with this. I'm assuming that with the proper blobs you can also use this to compile CM9 and CM10 (I will be testing this in the next few days).
Disclaimer: if you FUBUR your PC, I am not responsible, you do this at your own risk. ​You SHOULDN'T be able to mess up your PC if you go the VirtualBox route, however there is always a risk of bricking your device. (Although I'd assume if things went tits up you could just reflash a PD15IMG.zip and you'd just need to re-root your device.)
I used Ubuntu 10.04 LTS for this, feel try to with another version (I'd be weary past 11.10 as 12.04 and beyond aren't officially supported by AOSP.) I'll highlight any problem areas you need to be careful of.
This is based off of my experience compiling from source. I may be taking the long way around things, but it works. I am gearing this to the people new to android development (I've just recently gotten into it myself). I will be giving you things you need to copy and paste (for the most part) to make it easier.
This will cover setting up and compiling the source for a working rom, and the basics of custom kernel creation.
You MUST use 64-bit Ubuntu for gingerbread and later!
You can either install Ubuntu on a dedicated partition (Wubi doesn't give you enough space though, just FYI) or use VirtualBox(). If you go the VirtualBox route, you need to install the extension pack (Located on the same page as the download) for later steps to work.
Here are my recommendations (I used the VirtualBox route):
Disk space: 100gb is a good amount. Between downloading the source and my first build, I'm using 24.6gb (according to windows).
Ram: I gave the VM 4gb of my 8gb ram. You can use more or less, but I'd think that if you have less than 4gb of ram allocated, use a 8-12gb swap file just in case (you may not need it, I built with no problems with 4gb of ram and no swap)
Processor: I have a new Ivy Bridge processor that supports virtualization (If you have a K designation Core series (IE Core i5-2500K you don't support virtualization and your build will be... much slower). I gave VirtualBox 3 of my 4 cores, feel free to adjust as necessary (just leave at least one for your main system)
At this point, I'm trusting that you've successfully installed Ubuntu 10.04 64-bit LTS along with the VirtualBox additions (if you went the VirtualBox route). Make sure to run sudo apt-get update . (don't upgrade to 12.04 if it asks)
Thanks to Dragonswithin for updating me about OpenJDK working.
Installing Necessary packages
​
There are two packages that need to be handled differently from just a simple apt-get install. The first is git-core (the version in the repositories are extremely old and refuse to work correctly with this). The second is Sun-jdk6
First, do the following to add the source for the correct version of git-core.
Code:
sudo add-apt-repository ppa:git-core/ppa
sudo apt-get update
Enter your password when prompted.
{
"lightbox_close": "Close",
"lightbox_next": "Next",
"lightbox_previous": "Previous",
"lightbox_error": "The requested content cannot be loaded. Please try again later.",
"lightbox_start_slideshow": "Start slideshow",
"lightbox_stop_slideshow": "Stop slideshow",
"lightbox_full_screen": "Full screen",
"lightbox_thumbnails": "Thumbnails",
"lightbox_download": "Download",
"lightbox_share": "Share",
"lightbox_zoom": "Zoom",
"lightbox_new_window": "New window",
"lightbox_toggle_sidebar": "Toggle sidebar"
}
Install the following
Code:
sudo apt-get install git-core gnupg flex bison gperf libsdl-dev libesd0-dev libwxgtk2.6-dev build-essential zip curl libncurses5-dev zlib1g-dev gitg qt3-dev-tools libqt3-mt-dev eclipse valgrind zlib1g-dev gcc-multilib g++-multilib libc6-dev-i386 gedit lib32ncurses5-dev ia32-libs x11proto-core-dev libx11-dev lib32readline5-dev lib32z-dev gitg pngcrush wput openjdk-6-jre
Hit enter when it asks if you want to proceed
Provided everything went smoothly above, you now have all the correct packages installed!

Next step: REPO​
Repo is the script provided by Google that makes it easier to deal with Android source via Git (at least what I gather from it).
The following is the code to get it setup.
Code:
cd ~
mkdir -p bin
export PATH=${PATH}:~/bin
curl https://dl-ssl.google.com/dl/googlesource/git-repo/repo > ~/bin/repo
chmod a+x ~/bin/repo
doing cd ~/ is an easy way to bring you back to your home folder (IE /home/matada/)
mkdir creates a folder named bin in which we store the repo script.
Export PATH allows us to easily call repo by itself instead of having to use /home/matada/bin/repo
finally, chmod +a gives us everyone access to the repo file, while +x makes it executable (like a .exe or .msi file on windows). Congrats, Two things down!
Setting up the Android SDK​
As of this writing you can go one of two ways. Either manually download the SDK and select Linux(i386), extract it then move it to your home folder (/home/username/) and rename it androidsdk. Or you can just copy and paste the following (this works as of the current release of the SDK, I will try and remember to keep this updated, but I can't promise much)
Code:
cd ~/Downloads
wget http://dl.google.com/android/android-sdk_r21-linux.tgz
tar -xvzf android-sdk_r21-linux.tgz
mv android-sdk-linux ~/androidsdk
That's the SDK downloaded, now to install the packages we need in it.
Code:
~/androidsdk/tools/android
Select under tools:
Android SDK Tools (should be installed by default)
Android SDK Platform-Tools
(I'm not sure if the following is required or not, I did it to be on the safe side). Scroll down to Android 2.3.3 (API 10) and select
SDK Platform
Samples for SDK
and Google APIs
Hit install 4 packages, accept the terms and let it download and install (might take a little while based on your network speed) Once that is complete exit out.
The last step for the SDK is to add the following to your .bashrc (add the three lines to the top of the text)
Code:
gedit .bashrc
Then add:
#AndroidDev PATH
export PATH=${PATH}:~/androidsdk/tools
export PATH=${PATH}:~/androidsdk/platform-tools
Restart your system (the VM or your full linux install)
Congrats! Now ADB should be setup correctly, now for a quick test. Plug your phone into your PC. If you're using the VirtualBox way, go up to devices → USB devices and select T-Mobile MyTouch 4g.
Reopen your terminal and type in lsusb and you should see the following pop up:
Next enter
Code:
sudo gedit /etc/udev/rules.d/51-android.rules
and paste in the following:
SUBSYSTEM=="usb", ATTRS{idVendor}=="0bb4", MODE="0666"
SUBSYSTEM=="usb", ATTRS{idVendor}=="0502", MODE="0666"
SUBSYSTEM=="usb", ATTRS{idVendor}=="12d1", MODE="0666"
SUBSYSTEM=="usb", ATTRS{idVendor}=="1004", MODE="0666"
SUBSYSTEM=="usb", ATTRS{idVendor}=="22b8", MODE="0666"
SUBSYSTEM=="usb", ATTRS{idVendor}=="04e8", MODE="0666"
SUBSYSTEM=="usb", ATTRS{idVendor}=="0fce", MODE="0666"
SUBSYSTEM=="usb", ATTRS{idVendor}=="0489", MODE="0666"
SUBSYSTEM==”usb”, ATTRS{idVendor}==”18d1″, SYMLINK+=”android_adb”, MODE=”0666″
SUBSYSTEM=="usb", ATTRS{idVendor}=="04e8", MODE="0666", GROUP="plugdev"
Then Save and exit
Now is as good of a time as any to keep a backup of your /system/ partition (and a good way to see if your androidSDK is setup correctly)
First enable development on your phone. For gingerbread it’s under the applications -> development -> then press Android Development.
Code:
cd ~/
mkdir stock
cd stock
adb pull /system/ ~/stock/
When it's complete:
Congrats, if that worked correctly the system setup is done! Time to download the source code!
Downloading the Source
​
the Cyanogenmod source is pretty large (my VM was using 15gb by the time it was finished, with another 1gb for the kernel source), so don’t use this if you tether your internet or you’ll be dead before you even start.
Here we go! (At this point you can build for Jellybean or ICS (just replace gingerbread with either jellybean or ICS (or ICS-Release)
Code:
cd ~/
mkdir -p android/source
cd ~/android/source
repo init -u git://github.com/CyanogenMod/android.git -b gingerbread
It’s going to ask for your name and e-mail (you can just hit enter twice to skip it), and then hit Y, enter and then Y and then enter again at the color selection. Your folder is now setup.
You MAY have to (out of the four times I’ve done this part I’ve had it happen once) manually specify your e-mail and name. If so:
Code:
git config --global user.email “[email protected]”
git config --global user.name “your name”
(it will error out saying “unable to auto-detect e-mail address" if this is the case)
Repo is the file we downloaded from Google earlier, it now sets up the source folder to clone the CyanogenMod repository, which we’re about to do now.
Code:
repo sync -j2
This starts the download from the CyanogenMod repository. This totally depends on your internet, and may take from 30-minutes to 12 hours. It’s around 5gb to download. At this point go get something to eat / drink, browse XDA Developers or Reddit and we’ll be back when it’s finished. (I happened to watch tonight’s episode of Walking Dead as a nice break )

And X amount of time later We’re back! (it was about an hour and a half for my connection)
Now to get into the nitty gritty of making it work for our Glacier. Unfortunately CM has taken out the easy button for Gingerbread so we need to do things by hand. No big deal, I’ll explain everything here.
The steps SHOULD be the same no matter if you do Gingerbread or ICS or even Jellybean, just adjust as needed (the repositories I include have Jellybean and ICS included)
First step, Include the Glacier in the vendorsetup for when we compile
Code:
gedit ~/android/source/vendor/cyanogen/vendorsetup.sh
Add in:
add_lunch_combo cyanogen_glacier-eng
Save and exit
Next we need to tell git where to find the files we need for the glacier. Again, change gingerbread to ICS or Jellybean (I don’t know the correct setting for the Kernel though) if you want to compile sometihng else.
This next step you’re going to have to do manually as it resides in a hidden folder.
Open your home folder then navigate to ~/android/system/ then hit Control+H to show hidden folders. Find .repo and when in the folder right click, create document -> empty File and name it local_manifest.xml (case sensitive) right click and open with gedit and:
Add in
Code:
<?xml version="1.0" encoding="UTF-8"?>
<manifest>
<project name="CyanogenMod/android_device_htc_glacier" path="device/htc/glacier" revision="gingerbread" />
<project name="TheMuppets/proprietary_vendor_htc" path="vendor/htc" revision="gingerbread" />
<project name="CyanogenMod/htc-kernel-msm7x30" path="device/htc/kernel-msm7x30" revision="android-msm-2.6.35" />
</manifest>
Save and quit
Final modification that needs to be done
Code:
gedit ~/android/source/device/htc/glacier/glacier.mk
Line 33: change
“device/htc/vision/ueventd.vision.rc:root/ueventd.glacier.rc”
to
Code:
“device/htc/glacier/ueventd.glacier.rc:root/ueventd.glacier.rc”
(check the screenshot if you need help)
Save and quit
Next do repo sync again
Code:
cd ~/android/source/
repo sync
Next it’s time to get RomManager. You’re in the home stretch of compiling CM7. Only a few more steps!
Code:
cd ~/android/source/vendor/cyanogen
bash get-rommanager
Guess what, Time to compile! If you managed to get this far congratulations! (side note I wish I had a guide to get me this far!)
Alright. last few lines of code and you should be home free.
Code:
source /build/envsetup.sh
lunch cyanogen_glacier-eng
make clean
make bacon -j*
Before make bacon
*(If you want to speed the compile up, you can set -j to however many cores you have available to the VM or on your processor (I gave VirtualBox 3) so I would use -j3. If you only have a single core just omit the -j)
If you compiled successfully you should have a nice shiny cm7.zip sitting on your PC that’s ready to flash! If you just want to compile your own version of CM you’re done! Copy the resulting zip to your sdcard, and flash it in Clockworkmod or RomManager! The directory where the file is located will be displayed when the compile finishes successfully. Now! Stay tuned if you want your own kernel too!
Finished!
Remember to flash the correct gapps for your phone!

Making a custom Kernel
​
Ok, you made it this far, why not go for the full monty right? I don’t know much about making custom kernels (short of making them compile). Here’s a guide I found on a quick search. it rehashes part of what I’ve said here. (Although I didn’t use that source to make this guide. (Look below for my sources)
I’ll keep giving you the step by step here (I’m just going to skip the explanations of what stuff does), just incase you’re still not comfortable being let loose yet.
Code:
cd ~/android
mkdir kernel
cd kernel
git clone git://github.com/CyanogenMod/htc-kernel-msm7x30.git
cd htc-kernel-msm7x30
export CROSS_COMPILE=~/android/source//prebuilt/linux-x86/toolchain/arm-eabi-4.4.0/bin/arm-eabi-
export ARCH=arm
make xconfig
At this point you should eventually have a window pop up that looks like:
all you have to do is go to file load and navigate to ~/android/source/kernel/htc-kernel-msm7x30/arch/arm/configs and select “cyanogen_msm7230_defconfig” and hit load. then save and exit. You can tinker around with stuff BUT you can easily make your device freeze at the mytouch logo (you’d need to figure out what went wrong then reflash the kernel (or the rom when you kernel to work correctly).
Last step for compiling. (so anticlimatic)
make -j (if you set -j to something when you compiled CM7 feel free to use it again, if you didn’t omit the -j) Hit enter and you should wind up with a custom kernel and wifi module.
I ignored the wifi module since the same version was already in the sources on CM7. you will need to add it for CM9 and CM10).
The kernel is located at ~/android/source/kernel/htc-kernel-msm7x30/arch/arm/boot/ and wifi is located at ~/android/source/kernel/htc-kernel-msm7x30/drivers/net/wireless/bcm4329/
BE SURE TO BACK UP THE ORIGINALS (either copy them out to a safe spot, or rename them!)
you can either fastboot the kernel (I don’t know how to do it correctly yet so I will skip adding it for now) or put in the CM7 source at /android/system/device/htc/msm7x30-common/msm7230/
Rename zImage to kernel.
Wifi will also go to ~/android/system/device/htc/msm7x30-common/msm7230
In the end it should look like:
at this point do the following to recompile with the new kernel (and possibly wifi)
Code:
source ./build/envsetup.sh
lunch cyanogen_glacier-eng
make clean
make bacon -j (you know what to do now)
When it completes successfully, copy it to your SD card and flash it same as before and you’re set.
[URL=http://i.imgur.com/mfTxyh][IMG]http://i.imgur.com/mfTxyh.png[/IMG][/URL]
And finally (my rom works perfectly and is pretty quick. I'm impressed and satisfied)
[img]http://i.imgur.com/oMblE.png[/img]

I hope this will help someone, as it was a good learning experience for me.
The sources I used were:
Guide to Compiling Posted by Sykopompos . This gave some of the specifics of what I needed to do for the glacier (not all of it sadly)
Compiling from source GSM HTC Desire build page (Out of date but was a good launching off point.)
I owe a lot to the #cyanogenmod-dev IRC channel on Freenode. More specifically to the user Asturel who put up with my constant questions for getting it to work. (Just because he helped me doesn't mean he'll help y'all)
If you need any help feel free to post here, or PM me.
You can also DM me on twitter @zoeyalbini if you need some immediate assistance.
You can also find me (and a lot of other great developers) over on #cyanogenmod-dev if you want to connect with other devs. They seem to accept me fine!
And worst comes to worse you can e-mail me at matada89 (AT) gmail
Thanks for reading!

Thanks for the time you spent creating this guide.
Sent from my LG E960

GEEEEZZZZZ!!How long did it take you to post all of this!talking about filling up a thread from the start!!HAHA JK thanks for the info!alot to read,but probably worth it !again thanx..

[email protected] said:
GEEEEZZZZZ!!How long did it take you to post all of this!talking about filling up a thread from the start!!HAHA JK thanks for the info!alot to read,but probably worth it !again thanx..
Click to expand...
Click to collapse
To figure out everything to do this took about 6 hours. Writing the guide took about four hours. Checking line by line and getting pics (I compiled the rom using only the things I had written) . Posting it here took like 3 hours only because of the 10 post requirement. And doing pictures.. and formatting and other stuff. I'm not done yet (going to Try and compile both CM9 and CM10 following this guide. I'm in bed now as it's 5am.
Sent from my HTC Glacier using xda premium

Alright, since I'm an eager beaver (Or stupid as hell). I'm going to try and compile CM9 and CM10 and see what (if anything drastic) needs to be changed. Will report with a how-to later if it works.
Update: I Seem (almost done compiling) to have CM9 setup correctly, but haven't quite figured out making the Kernel.. Progress. Also, I may have something BIG to release on Christmas.... I'm excited!
Edit: CM9 compiled correctly and it currently working on first boot (Optimizing applications) Cool!

Great guide but most of it won't work on cm9 and definitely not cm10. Great effort though

THEindian said:
Great guide but most of it won't work on cm9 and definitely not cm10. Great effort though
Click to expand...
Click to collapse
Yeah I'm seeing that. I'll figure something out, might have to do a separate tutorial for 9 and 10. Hit a snag right now with a bootloop.

matada said:
Yeah I'm seeing that. I'll figure something out, might have to do a separate tutorial for 9 and 10. Hit a snag right now with a bootloop.
Click to expand...
Click to collapse
I'll be looking forward to the CM10 tutorial, when i was trying to compile it, i had to mash a bunch of guides together, then i realized that my computer wasn't strong enough to build android lol
---------- Post added at 05:33 PM ---------- Previous post was at 05:30 PM ----------
also, this should definetly be in the Android Development section, definetly worthy of the attention

THEindian said:
I'll be looking forward to the CM10 tutorial, when i was trying to compile it, i had to mash a bunch of guides together, then i realized that my computer wasn't strong enough to build android lol
---------- Post added at 05:33 PM ---------- Previous post was at 05:30 PM ----------
also, this should definetly be in the Android Development section, definetly worthy of the attention
Click to expand...
Click to collapse
I discussed the move with The Archangel and it was stated guides no longer go in the Development Sections. I'll live.
I have the source downloaded, but I'm having kernel errors. I tell it what to compile kernel wise, it still fails. I tried compiling separately and it fails too >.< I'd go take a break and play some Warcraft, but the servers are down for at least another 2 hours.

matada said:
I discussed the move with The Archangel and it was stated guides no longer go in the Development Sections. I'll live.
I have the source downloaded, but I'm having kernel errors. I tell it what to compile kernel wise, it still fails. I tried compiling separately and it fails too >.< I'd go take a break and play some Warcraft, but the servers are down for at least another 2 hours.
Click to expand...
Click to collapse
Ran into that. I didn't overcome that...

thanks so much for these guides. among the most clearly stated guides that i've come accross.
thanks again!!!
Sent from my HTC Glacier using xda premium

THEindian said:
Ran into that. I didn't overcome that...
Click to expand...
Click to collapse
I got it to compile with the Dirty kernel (Used in the old AwesomeICS rom), but it boot looped with audioflinger errors (Was missing libalsa.so (some audio file I forget the name and I'm at work right now),
I'm going to start again on Saturday, hopefully make some headroom.

So I don't have much of a clue what I'm doing but I got to this step
Final modification that needs to be done
Code:
gedit ~/android/source/device/htc/glacier/glacier.mk
Line 33: change
And all I get is a blank file. In fact I don't even have a glacier folder only a 7x30-recovery, common, msm7x30-common, and passion-common. Can anyone tell me what step I messed up?
EDIT:
Did a repo sync and the files showed up.

I can't even figure out how to get the JDK. Nomatter what guide I try I run into this:
There is only one alternative in link group java: /usr/lib/jvm/jdk1.6.0_37/bin/java
Nothing to configure.

lortay78 said:
I can't even figure out how to get the JDK. Nomatter what guide I try I run into this:
There is only one alternative in link group java: /usr/lib/jvm/jdk1.6.0_37/bin/java
Nothing to configure.
Click to expand...
Click to collapse
I may be wrong but I don't think that is an error. You only have jdk 1.6 installed so it is telling you that you have no other options to pick from. As 1.6 is the version you need you don't need to change the default.

lortay78 said:
I can't even figure out how to get the JDK. Nomatter what guide I try I run into this:
There is only one alternative in link group java: /usr/lib/jvm/jdk1.6.0_37/bin/java
Nothing to configure.
Click to expand...
Click to collapse
That's fine. continue on. I need to edit the first post to state if you have that, you're totally OK. I Just happened to have openJDK installed when I did it (hence why it shows up in screenshots)

Related

Android SDK source code

I wish to have the source code of Android SDK to get a better idea of how certain features/aspects work especially the ones that are not well documented . i really dont wish to get into all the trouble of setting up a CVS especially after looking at the steps here (http://source.android.com/download).
So anyone kind enough willing to send me a zipped one ? i want it the latest 1.5 SDK.
Thanks in advance for helping me out.
gonna have to be the one that tells you this, and i mean no disrespect by what i say
if you are too lazy to set something up in order to do something then you probably shouldn't be doing it. people are willing to help you get it set up, but you are gonna have to do it yourself unless you find some extremely kind soul to get it for you. personally i would like to recompile the cource code for cupcake to make my own build(include my favorite apps) but i don't feel like setting it up so i know i am SOL
No one will help you until you can learn to help yourself. We're not here to do your work for you. You can google just as well as we can. So get up and get it for yourself.
If you just want to download a couple of files, or you only want to be looking at files, you can do it easily without installing git on your computer by using the gitweb interface:
http://android.git.kernel.org/
Do you have eyes? Can you read?
Installing Repo
Repo is a tool that makes it easier to work with Git in the context of Android. For more information about Repo, see Using Repo and Git.
To install, initialize, and configure Repo, follow these steps:
1. Make sure you have a ~/bin directory in your home directory, and check to be sure that this bin directory is in your path:
$ cd ~
$ mkdir bin
$ echo $PATH
2. Download the repo script and make sure it is executable:
$ curl http://android.git.kernel.org/repo >~/bin/repo
$ chmod a+x ~/bin/repo
Initializing a Repo client
1. Create an empty directory to hold your working files:
$ mkdir mydroid
$ cd mydroid
2. Run repo init to bring down the latest version of Repo with all its most recent bug fixes. You must specify a URL for the manifest:
$ repo init -u git://android.git.kernel.org/platform/manifest.git
* If you would like to check out a branch other than "master", specify it with -b, like:
$ repo init -u git://android.git.kernel.org/platform/manifest.git -b cupcake
3. When prompted, configure Repo with your real name and email address. If you plan to submit code, use an email address that is associated with a Google account.
A successful initialization will end with a message such as
repo initialized in /mydroid
Your client directory should now contain a .repo directory where files such as the manifest will be kept.
What will my name and email be used for?
To use the Gerrit code-review tool, you will need an email address that is connected with a registered Google account (which does not have to be a Gmail address). Make sure this is a live address at which you can receive messages. The real name that you provide here will show up in attributions for your code submissions.
What is a manifest file?
The Android source files are divided among a number of different repositories. A manifest file contains a mapping of where the files from these repositories will be placed within your working directory when you synchronize your files.
Getting the files
To pull down files to your working directory from the repositories as specified in the default manifest, run
$ repo sync
For more about repo sync and other Repo commands, see Using Repo and Git.
The Android source files will be located in your working directory under their project names.
Click to expand...
Click to collapse
Condensed. Type the following:
$ curl http://android.git.kernel.org/repo >~/bin/repo
$ chmod a+x ~/bin/repo
$ mkdir mydroid
$ cd mydroid
$ repo init -u git://android.git.kernel.org/platform/manifest.git
$ repo sync
Click to expand...
Click to collapse
Now exactly how hard is it to do that?
hanged_man said:
I wish to have the source code of Android SDK to get a better idea of how certain features/aspects work especially the ones that are not well documented . i really dont wish to get into all the trouble of setting up a CVS especially after looking at the steps here (http://source.android.com/download).
So anyone kind enough willing to send me a zipped one ? i want it the latest 1.5 SDK.
Thanks in advance for helping me out.
Click to expand...
Click to collapse
@jashsu
Thanks, ive used the git browser a lot but i wish to have the source in my IDE for quicker and easier navigation.
@everyone who replied to me
All of you has misunderstood me, im not being lazy or anything, it's just that google has provided steps for linux and mac users and im a windows user.
Im not asking for anyone to do it for me, i should have been clear in my request, does anyone have it ? im pretty sure that lots of developers has done it before and willing to aid me on this one. Come on people, i expected you to be a bit more welcoming than this.
On windows you have a couple of options. You could just setup a linux VM and follow the process above quite easily. That is what I do. You can even copy the sources back to your windows host if you prefer that. Or you can give it a try by installing cygwin on windows. You might be able to at least checkout the sources. I haven't tried the cygwin setup so I can't be 100% sure if it works.
... OR, you can quit being a ***** and install a proper OS. Or at least install GIT, which comes with BASH and can run the script in exactly the same manner.
lbcoder said:
... OR, you can quit being a ***** and install a proper OS. Or at least install GIT, which comes with BASH and can run the script in exactly the same manner.
Click to expand...
Click to collapse
lol true that
lbcoder said:
... OR, you can quit being a ***** and install a proper OS. Or at least install GIT, which comes with BASH and can run the script in exactly the same manner.
Click to expand...
Click to collapse
ohhh you got me there. Your imaginary girlfriend is probably proud of you after beating me with that genius phrase.
Now people, installing linux on my machine or running it on a vm then following all these instructions and using these tools is a long tedious process that will take lot of time, it's just a source code for god's sake and not launching a spaceship, i was hoping for a gentleman to help me on this (who already has the source the code checked out) and willing to send it to me. that's all.
Thanks everyone for your time.
here's what i see, you joined this forum in hopes of just getting spoonfed, we don't like to spoon feed. setting up a VM takes about an hour including install time of the OS on the VM and setting up linux on your machine takes about 45 minutes. linux is a much better operating system ESPECIALLY if you want to develop for android because android is UNIX based and uses UNIX commands. it's not that hard to get the source code yourself, hell you could even just get a linux live cd and use that to get the source code, then just copy it to your windows drive.
this thread needs to be locked because this person is disrespecting everyone on these forums by asking us to do the work for him.
All you need is Git, no new os or anything. There is a Git client for Windows. Download that, then:
open command prompt.
cd to whereever you want to download the data to
git clone git://android.git.kernel.org + project path.
Sit back and wait.
zer0day said:
All you need is Git, no new os or anything. There is a Git client for Windows. Download that, then:
open command prompt.
cd to whereever you want to download the data to
git clone git://android.git.kernel.org + project path.
Sit back and wait.
Click to expand...
Click to collapse
Yup 0day is right.
By the way, while I would agree that Linux is the best platform to work on Android, I think overly antagonistic comments like "... OR, you can quit being a ***** and install a proper OS." do more harm than benefit for the FOSS movement. Just my $0.02

[GUIDE] Get Android 2.2 source for n00bs

I did this in Ubuntu 10.4 linux that i installed on a 14gig partition of my laptop.
You can do this in VMware or make a partition of your HDD and download wubi.exe to install linux on your partition... its easier than installing windows. You can use this to help develop if you know anything, or as i have done, used it to get the uncompiled .9.png's to edit for themeing, bypassing the draw9patch step cause the guides are already there ready to go through eclipse IDE.
INSTALL ALL LINUX UPDATES THAT WILL POPUP WITH AUTO-UPDATER BEFORE GETTING SOURCE.
on to the good stuff.... open up the terminal and run the following commands
Code:
sudo nano /etc/apt/sources.list
Then add the following to the bottom by scrolling down with your arrow keys and pasting by right clicking, CTRL-V WONT WORK.

Code:
deb http://cz.archive.ubuntu.com/ubuntu jaunty-updates main multiverse
Hit CTRL O and ENTER to save and CTRL X to return to the command line. Now lets get the repo packages cached onto your box using the following command.
Code:
sudo apt-get update
install Java 5 SDK and all the other little packages needed to build Android with this command.
32-bit x86
Code:
sudo apt-get install git-core gnupg sun-java5-jdk flex bison gperf libsdl-dev libesd0-dev libwxgtk2.6-dev build-essential zip curl libncurses5-dev zlib1g-dev valgrind
64-bit x86
Code:
sudo apt-get install git-core gnupg flex bison gperf build-essential zip curl sun-java5-jdk zlib1g-dev gcc-multilib g++-multilib libc6-dev-i386 lib32ncurses5-dev ia32-libs x11proto-core-dev libx11-dev lib32readline5-dev lib32z-dev
Code:
sudo update-java-alternatives -s java-1.5.0-sun
Code:
sudo ln -s /usr/lib32/libX11.so.6 /usr/lib32/libX11.so
moving on
INSTALLING REPO
You can install repo tool any place in your path. We choose a bin directory in our home folder:
Code:
$cd ~
$mkdir bin
$export PATH=$PATH:~/bin
$curl https://android.git.kernel.org/repo >~/bin/repo
$chmod a+x ~/bin/repo
DOWNLOADING ANDROID SOURCE CODE:
Create an empty directory to hold your working files:
Code:
$mkdir mydroid
$cd mydroid
# Run repo init to bring down the latest version of Android with all its most recent bug fixes. You must specify a URL for the manifest:
Code:
$repo init -u git://android.git.kernel.org/platform/manifest.git
NOTE: using -b option we can choose which android version to install:
Code:
$repo init -u git://android.git.kernel.org/platform/manifest.git -b froyo
To pull down files to your working directory from the repositories as specified in the default manifest, run
Code:
$repo sync
NOTE: mydroid directory size grows up to 3.6G.
BUILDING ANDROID
Simply on top of your android directory execute make command:
Code:
$cd mydroid
$make
After some time it will finish.
We get the installed file list in this file:
out/target/product/generic/installed-files.txt
Also some images are created in the same directory: (system.img userdata.img ramdisk.img)
mydroid$ ls out/target/product/generic/
android-info.txt data obj ramdisk.img symbols system.img
clean_steps.mk installed-files.txt previous_build_config.mk root system userdata.img
We have built android source code but now we want to test it:
run the Android Emulator, which comes within the Android SDK
http://developer.android.com/guide/developing/tools/emulator.html
Download Android SDK
http://developer.android.com/sdk/index.html
Install Android SDK
http://developer.android.com/sdk/installing.html
ill post the location of the framework-res.apk drawables and stock app apks to edit for those of you interested in theming.
I appreciate the effort but isn't this almost the same from android central by gbhil?
Sent from my HERO200
Wouldnt know. Die hard xda member. Im sure im not the only one that checks this site only. Im just trying to do my part. We need devs and themers with creative ideas. This is the one of the first few steps toward those interested in learning.
Sent from my Hero CDMA using XDA App
Thank You!!!!!!!
WELL DONE SIR!!!!! Thank you for posting a good repo link for froyo!!!!!
riggsandroid said:
I appreciate the effort but isn't this almost the same from android central by gbhil?
Sent from my HERO200
Click to expand...
Click to collapse
Isn't android central a different website?
myth_mn said:
Isn't android central a different website?
Click to expand...
Click to collapse
Yes, I was thinking if he took it from there to give credit. But the effort is appreciated and not trying to start a problem.
Sent from my HERO200
Made this because of all the errors i ran into and gathered all my sources of research of linux commands like changing your $PATH and installing java after my machine wouldnt find it in the repository, or not being able to get repo installed. Im just trying to help. I would have sourced gbhil if i took it from there. And this isnt a college essay, work cited pages arent necessary, its a courtesy out of respect. Besides... my sources where from blogs and most didnt have anything to do with android. Just throwin that out there. ©
epitaphromance said:
Made this because of all the errors i ran into and gathered all my sources of research of linux commands like changing your $PATH and installing java after my machine wouldnt find it in the repository, or not being able to get repo installed. Im just trying to help. I would have sourced gbhil if i took it from there. And this isnt a college essay, work cited pages arent necessary, its a courtesy out of respect. Besides... my sources where from blogs and most didnt have anything to do with android. Just throwin that out there. ©
Click to expand...
Click to collapse
no problem. i appreciate the work, I'm gonna give it a shot at some piont when I get some time to install ubuntu.
not doubting you didn't do the work, it was only fresh in my mind because i literally looked at it yesterday. thanks again for the info gathering.
Welcome
Sent from my Hero CDMA using XDA App
Just hope your patient between builds... or at least the first build unless you have a real killer machine. Tried it on my laptop (1.8ghz dual core amd)... 2hrs and had to ctrl+c cause I had to go to bed...
Just wanted to say that this also works on linux mint kde 8 (also known as user friendly linux) it is taking forever though as posted good write-up. oh by the f ubuntu. just saying
Hello,
Not sure if you follow this thread or not anymore but I get an error I was hoping someone could help me with? When I run the last "make" commange I get this error:
Checking build tools versions...
************************************************************
You are attempting to build with the incorrect version
of java.
Your version is: java version "1.6.0_20".
The correct version is: 1.5.
Please follow the machine setup instructions at
http://source.android.com/download
************************************************************
build/core/main.mk:117: *** stop. Stop.
Any ideas?
Thanks
jschill31 said:
Hello,
Not sure if you follow this thread or not anymore but I get an error I was hoping someone could help me with? When I run the last "make" commange I get this error:
Checking build tools versions...
************************************************************
You are attempting to build with the incorrect version
of java.
Your version is: java version "1.6.0_20".
The correct version is: 1.5.
Please follow the machine setup instructions at
http://source.android.com/download
************************************************************
build/core/main.mk:117: *** stop. Stop.
Any ideas?
Thanks
Click to expand...
Click to collapse
Assuming you've installed an openjdk-6-jdk package, you can override the normal build restriction of Java 5 by editing the file build/core/main.mk and changing the Java version test to match against "1.6" instead of "1.5". You'll need to do it in two places, once for java and once for javac. I never had to do this to build Cyanogenmod, but you may need to for AOSP.
Decad3nce said:
Assuming you've installed an openjdk-6-jdk package, you can override the normal build restriction of Java 5 by editing the file build/core/main.mk and changing the Java version test to match against "1.6" instead of "1.5". You'll need to do it in two places, once for java and once for javac. I never had to do this to build Cyanogenmod, but you may need to for AOSP.
Click to expand...
Click to collapse
Decad3nce, thanks for posting so fast. The funny thing is I figured it out within 5 minutes of posting but got sucked in to finalizing my source code that I am now just getting back to the post. There are several here in this forum that really help out and you are one of them. I am just now getting brave enough to start cooking but catch on fast. Can't wait to see what you, nfinite and beezy do to the wildfire port!

Linux kernel building how-to

I got this dang phone because I was told it was compatible with GSM networks and of course I was such a noob then. LOL, since then though I have taught myself a great deal in a short amount of time with endless nights searching all corners of the internet for links, hints, secrets and of course roms and kernels.
I dont care about a rom at this point I want and need a custom kernel for this phone I have no OS but when I run RUU it works fine-ish. I solve each problem as they come up but I am getting so tired of all the nonsense I have to do to this phone.
Unfortunately unless circumstances change I am stuck with it because I have had some major life changes and I cant afford another phone like I am on a romin and egg diet poor.
If someone could just cook up a kernel for this dang phone I will be forever grateful. I will test, logcat whatever u want to make it easier for u just help please this.:fingers-crossed::fingers-crossed:
Device: K2PLCCL pvt ship s-off RL
CID-11111111
Hboot 2.21
Radio 1.12.00.1029
OpenDSP-v10.2.0268.0401
eMMC1024 mb
Fant0m3 said:
I got this dang phone because I was told it was compatible with GSM networks and of course I was such a noob then. LOL, since then though I have taught myself a great deal in a short amount of time with endless nights searching all corners of the internet for links, hints, secrets and of course roms and kernels.
I dont care about a rom at this point I want and need a custom kernel for this phone I have no OS but when I run RUU it works fine-ish. I solve each problem as they come up but I am getting so tired of all the nonsense I have to do to this phone.
Unfortunately unless circumstances change I am stuck with it because I have had some major life changes and I cant afford another phone like I am on a romin and egg diet poor.
If someone could just cook up a kernel for this dang phone I will be forever grateful. I will test, logcat whatever u want to make it easier for u just help please this.:fingers-crossed::fingers-crossed:
Device: K2PLCCL pvt ship s-off RL
CID-11111111
Hboot 2.21
Radio 1.12.00.1029
OpenDSP-v10.2.0268.0401
eMMC1024 mb
Click to expand...
Click to collapse
I can help you through a PM on how to set your computer up properly so you can build a kernel yourself. Can begin building it without modifications then when ready, start adding some patches which in most cases is merely just copying and pasting assuming the patch is compatible.
It really isn't difficult.
You need linux installed firstly if running windows.
Sent from my C525c using Tapatalk
U ROCK!!!!!
Modding.MyMind Won't be from me lol. Just found out this morning that I am going to be a father.
Sent from my C525c using Tapatalk
Congrats man I have a bundle of kids love them all my newest one is 3months....:good:
So u helping me would be amazing. You are using the word not hard about k2plc. Anything and everything about this phone is difficult except the hardware....lol. So I did some real heavy research today about my errors on flashing, why things won't go to my device and why I keep getting mount errors. It's the kernel as we all know, but I don't think it will be as such a daunting task to create one I mean once I know what I am doing.
Brief rundown I was bait and switched into this phone long story there. I have recently had a string of bad luck so I'm strapped to find a new one. Everything that I know I've learned over the last two months with a ton of trial and errors many bricks conquered and many triumphs achieved.
With that said I do get lost a bit on terminology and stuff. But I unlocked bootloader installed adb both wired and wireless.
Super cid phone 2twice two different ways lol. Last one stuck cause I turned off the ota odex. Flashed three roms all with the same problem no data and no mms. So some patients may be in order.
Also about linux I thought it was I am just not SElinux I downloaded this
arm-eabi-4.6-d73a051b1fd1d98f5c2463354fb67898f0090bdb.tar and this just recently and ran them as well. Am I suppesed to run them to phone or computer...the Java commands confuse me like crazy right now as I am still new.
Now back to what I researched. I found this file it talks all about SElinux and how it effects your kernel. Cant we just in some way disable those two or three scripts that is blocking from converting and flashing roms, boots. and zips.
selinuxproject.org/~jmorris/lss2011_slides/caseforseandroid.pdg
PM me modding and I will give you my email...I check that more often.
I've learned that our Kernel is SElinux blocked and u have to know and use proper toolchain to bypass this. sorry cant post links yet
@Fant0m3, I'm pretty sure your device is not using selinux. You can confirm just by opening up es file explorer on your device and selecting, "/", which from their you will see "file_context" amongst others. Our kernel source comes with selinux in it, but selinux is not enabled through the defconfig file from the source. You would have to modify that file, build your kernel, flash/install kernel, then at that point you would have selinux support. However, I seriously doubt your kernel is using selinux.
In addition, do not flash any Rom to your device unless the Rom is specific to your device. You can't just use roms from other devices. It does not work that way. If it did, then there would be no need for the HTC One SV, the HTC One M8, the Samsung Galaxy, etc, etc. There would just be one android phone like you see with the iPhone, however, this is obviously not the case.
The toolchain is required to build your kernel from source. And 4.6 is exactly the one you properly need to build your kernel.
Anyways, hope some of this was helpful/useful insight.
Edit: Open a terminal (ctrl + alt + t). First install the necessary packages; copy paste the code below and hit enter. This will set up your linux system for proper development, like building a kernel for example.
Code:
sudo apt-get update && sudo apt-get install git-core gnupg flex bison gperf libsdl1.2-dev libesd0-dev libwxgtk2.8-dev squashfs-tools build-essential zip curl libncurses5-dev zlib1g-dev openjdk-6-jre openjdk-6-jdk pngcrush schedtool libxml2 libxml2-utils xsltproc lzop libc6-dev schedtool g++-multilib lib32z1-dev lib32ncurses5-dev lib32readline-gplv2-dev gcc-multilib
Sent from my C525c using Tapatalk
@ ModdingMyMind
Okay lol I was half asleep writing that last night.
When I am in recovery mode, I run TWRP 2.7.0.1 and when I bring up the logcat it say Kernel lacks support for reading SElinux. When I was reading that article, which it will not allow me to link yet otherwise I would, it was saying that the kernel was built with linux support but was built with SElinux support.
Either way not that big of deal. I am willing wanting to learn how to build a kernel and hopefully more as I learn and continue to learn
I flashed those other roms before I realized that I shouldn't run them on this phone. But I was under the impression that we can and thats part of the reason we root our phones is to run AOSP roms. The reason we cant with this phone is because there isnt an kernel built to read such open sources. Also and AOSP rom to my understanding is basically just replacing all your visual effects and removing the stock one. Basically the same thing like GOlauncher or NextLauncher does but its better cause u eliminate the processes from your stock rom so it doesnt bog your system down. I could and can be wrong I am a lot with this new found interest in Android applications.
so what is that code you posted. Please forgive me I am a noob and dont get the lingo and kinda need layman's terms for things and explanations. I learn very quick though so explaining the process once should more than suffice. I am only recently divulging into the forums cause I am more comfortable with my abilities and refrained from sounding like a complete NOOB.
Ubuntu?
Okay I have def heard the name did not know and was a bit confused on what it was. Now I know <---- told u NOOB who learns on his own lol. I am downloading now but I already have a program I think that does the same thing "phantomjs" and no relation to my name I have used my online name for 20 years lol.
Now does this program do the same thing and should I even install ubuntu.
What is the best way to designate which device to download stuff to I find this has been coming up lately usually people just say download this...blah blah blah. But never designate the best path or device to use for the download. NOOB remember. I usually figure it out but adds more time to my process as I then have to research something else. I am getting the hang of it though.
Also is there an application out there that will designate what system will run what applications and download them into the corresponding folder to either be transferred to the proper corresponding folder i.e.:
Microsoft applications go to microsoft folder.
Linux goes to a Linux folder or a fold you created for linux apps.
Android goes to a android folder.
Mac goes to some apple folder if u choose to work on Iphones and such.
If not this seems like a very oversighted program that could easily be created/tested/deployed and would be very useful to keep your computer clean.
Excuse me but my mind works a billion times a minute and this is why I want to divulge myself in this stuff because there is never an end to the useful things that could be created.
Why I am on that again why the play store more interactive to your mobile device it seems just a few scripts and build files and they could diagnose what phone is being used and only show and promote to u which applications are compatible with said phone...excuse me for rambling
:silly::cyclops:
To build from source such as a kernel for example it is highly recommended you install a linux distro. I personally use Ubuntu myself.
Your TWRP says their is no SElinux support from the kernel because the kernel used to build the twrp you are currently using was not built with SElinux support itself. The kernel source has to be modified in order to add SElinux support and therefore TWRP to show that there is SElinux support detected. I know, because I had to do this for my TWRP build .
I'm at work so I have only skimmed through some of your posts. Haven't read it all which is why my response is currently short.
Sent from my C525c using Tapatalk
Modderator
Just wanted to say to the moderator that I believe this conversation should be moved i.e. posted in its own thread for linux kernel building I am sure I am not the only noobish person looking for help in doing or building a kernel.
Alright, I'm back. In regards to AOSP. It won't just simply work for any device even if the kernel is modified for proper support. AOSP is a large open source project. Just like CM, OmniRom, etc. The source has to be download, then you must put together a device tree which is basically a bunch of ".mk" files along with things which are needed specifically for your device. Would go in grave detail about this, but that is a tutorial in itself. Nevertheless, once all that has bee setup, you proceed to build the Rom then install to your device and proceed to work out any bugs (which there will be bugs).
I do not use windows. I use linux. Linux is required in order to build/develop kernels, Roms, etc. If you are using windows then you must either split your system for dual booting between windows and linux or you must run a virtual program that will allow for linux to operate on your computer while also running windows at the same time. I HIGHLY RECOMMEND you remove windows and do a clean install of linux if you plan to develop.
Sent from my C525c using Tapatalk
---------- Post added at 10:19 PM ---------- Previous post was at 09:42 PM ----------
To build a kernel, it must be done on linux. You need an arm toolchain. For our kernel source, arm-eabi-4.6 is recommended. To use a different toolchain other than that would require you to make some changes to the kernel source to prevent build errors.
You have to export the path to your toolchain.
Here is a script I use when building my kernel. Study it and it should be helpful for you.
PHP:
#!/bin/bash
#######################################
# Remove prebuilt kernel from last build
#rm ~/cm11/kernel/htc/k2_cl/output/kernel/zImage
if [ -e zImage ]; then
rm zImage
fi
#######################################
#######################################
# Remove logs from last build
rm kernelcompile.log
rm modulecompile.log
#######################################
############################################################
# Set Default Path's here!
TOP_DIR=$PWD
# KERNEL_PATH is the folder where your kernel source is located.
KERNEL_PATH="/home/moddingmymind/cm11/kernel/htc/k2_cl"
# STRIP is the strip brinary from the toolchain to strip unneeded symbols after the build is finished to help reduce size.
STRIP="/home/moddingmymind/arm-eabi-4.6/bin/arm-eabi-strip"
# OUTPUT is the folder where I place my finish builds.
OUTPUT="/home/moddingmymind/cm11/kernel/htc/k2_cl/output"
# Set toolchain path here! This will be the directory to your current toolchain.
TOOLCHAIN="/home/moddingmymind/arm-eabi-4.6/bin/arm-eabi-"
############################################################
#######################################
# KBUILD_BUILD_VERSION will set the name of the final build.
export KBUILD_BUILD_VERSION="JesusFreak"
# KERNELDIR is the path to the folder where your kernel source is located at.
export KERNELDIR=$KERNEL_PATH
#######################################
#echo "Cleaning latest build"
# make is a simple command needed to build makefiles.
# ARCH is simply telling it what type of architecture the machine is.
# CROSS_COMPILE is merely pointing the building process to the actual toolchain needed to make this work.
# The following is simply determining how many processors your computer currently has and applies that to "-j#" where "#" is your total processors. This reflects the speed of your build.
make ARCH=arm CROSS_COMPILE=$TOOLCHAIN -j`grep 'processor' /proc/cpuinfo | wc -l` mrproper
# Making our .config
#Sources will always have a defconfig file. For the kernel, you MUST make your .config file specific to your device or your build WILL fail.
make k2_cl_defconfig
# Make our menuconfig before proceeding with the build.
# This will bring up a window where you can make neceassary changes to your kernel source through a gui implementation prior to building your source.
make menuconfig
# Make Kernel using proper number of processors and store verbose in log file for review.
make -j`grep 'processor' /proc/cpuinfo | wc -l` zImage ARCH=arm CROSS_COMPILE=$TOOLCHAIN >> kernelcompile.log 2>&1 || exit 1
# Make Modules using proper number of processors and store verbose in log file for review
make -j`grep 'processor' /proc/cpuinfo | wc -l` modules ARCH=arm CROSS_COMPILE=$TOOLCHAIN >> modulecompile.log 2>&1 || exit 1
# make ARCH=arm CROSS_COMPILE=$TOOLCHAIN -j4 modules >> modulecompile.log
# Copying kernel modules after making install of modules
sudo make modules_install
mkdir $OUTPUT/tempo;
cp -r '/lib/modules/3.4.10.JesusFreak/kernel' $OUTPUT/tempo/;
sudo rm -rf '/lib/modules/3.4.10.JesusFreak';
find $OUTPUT/tempo/kernel/ -name '*.ko' -exec cp -av {} $OUTPUT/modules/ \;
rm -rf $OUTPUT/tempo;
# Strip modules
cd $OUTPUT/modules
$STRIP --strip-unneeded *.ko
# Copy Kernel Image
rm -f $OUTPUT/$KBUILD_BUILD_VERSION.zip
cp -f $KERNEL_PATH/arch/arm/boot/zImage $OUTPUT/prebuilt/zImage
# CREATE A ZIP which is prebuilt for flashing in the recovery to install and use.
cd $OUTPUT
zip -r $KBUILD_BUILD_VERSION.zip *
# Remove builds after the zip is completed.
rm -f $OUTPUT/prebuilt/zImage
rm -f $OUTPUT/modules/*.ko
Sent from my C525c using Tapatalk
okay sweet
Okay so it seems I should have known this information before even making it this far with my phone lol...
So Ubuntu is not like a emulator I run over windows it is yet another more developer friendly system software correct? If it's true then it would be easier running and familurizing myself with the linux systems and it's applications. I'm dead serious on working towards development. It's finally something to ease the busy mind.
Could u point me in the right direction to what kinda hardware would be best suited for this type work. My business model is almost finished but I need research on the proper systems and costs for the personal business loan that I will be applying for. I'm currently just using dual laptops and a phone.
Yes the one SV. As much as this phone has troubled me it has almost helped in a way because of the frustrations that go along with it.
I am also at work so my grammer is probably horrid as I am on my phone.
Thanks for the patients and lessons this stuff is definitely not for those easily detered.
Hardware isn't a big to do issue when building a kernel. However, it is usually recommended to have a SDD vice HDD. This will run much faster and smoother while handling your sources. It is also suggested to have at least 6 gigs of ram or more. However, I use my laptop which currently only holds 2 gigs of ram and roughly 200 gigs for storage on my computer. In other words, my laptop is very weak, but I can still develop with it without any problems. Just have to be cautious of the laptops temperature to insure I don't kill it lol.
You can go to Ubuntu website. They have the system you can download to install on your computer. They also have a very detailed instruction on how to remove windows properly and how to install ubuntu properly. Make sure you save important stuff as needed because wants you remove windows everything will be lost.
Sent from my C525c using Tapatalk
Sorry
I went a bit MIA for a bit my work schedule, plus my ex wife and everything with my minions got me scattered I am still interested and working on wanting to go down this path and maybe further as I expand my knowledge. I will hopefully soon find some time to jump back in but I will most likely be stuck till this weekend without diving into this project. I do have another laptop that I plan to use for linux and will get it all set up and try to follow steps to with Ubuntu and u @moddingMyMind. Hopefully soon we can get this done. lol.....I was wondering if we could create a more generic one for other to download and flash into their system as well if not its cool I will just stick with mine.
Nah, a generic one won't happen. At best, you could make your patches for your source, then apply those patches to their sources. Build all of them, then create a flashable zip which will systematically determine which device is which as to allow itself to properly determine which kernel it should write to the device as well as to which proper partition. Wouldn't be that hard to put something like that together though.
I'm currently busy myself. I was successful at compiling GraphicsMagick for my device and am currently writing a shell script which will pick up all images from a twrp theme, determine their original sizes one by one, then determine their new sizes and finally making the changes to properly resize each image for it's ending porting results. It's almost done. I just need to figure out a script for handling the ui.xml so I can be complete with my project and thus be able to port TWRP themes in just minutes vices HOURS and even days in some cases if I am taking my sweet time.
Sent from my C525c using Tapatalk
That's awesome I'm still afraid to try a theme for teepee lol that is my life line as of late.
I was thinking though is there an app for your file system that will clean up any repeated files like let's say music or busybox applets and so on and so on. This would save me tons of time and storage space..... I think I may need a how to for dummies book lol... Just when I feel I have it figured out basically then I discover something new Smh...
BTW good luck I can test dummy things if needed as well
Sent from my HTC One SV using XDA Free mobile app
Fant0m3 said:
That's awesome I'm still afraid to try a theme for teepee lol that is my life line as of late.
I was thinking though is there an app for your file system that will clean up any repeated files like let's say music or busybox applets and so on and so on. This would save me tons of time and storage space..... I think I may need a how to for dummies book lol... Just when I feel I have it figured out basically then I discover something new Smh...
BTW good luck I can test dummy things if needed as well
Sent from my HTC One SV using XDA Free mobile app
Click to expand...
Click to collapse
A little trick to saving space with busybox on your phone.... Don't install it with symlinks which creates all those applets. Instead, just grap an app from the play store if you want which will supposedly install busybox and rename the app from .apk to .apk.zip. Extract the contents and you will find the busybox binary. Place the binary in /system/bin and give the binary permissions of either 755 or 777. Then to use busybox applets just type busybox for a list of commands. To use busybox for example would be like this:
busybox mv -f /sdcard/name.txt /sdcard/newname.txt
mv is an applet from busybox which will move files and stuff. But you can also use it to rename files which is what I demonstrated. Much more proficient than having a bunch of applets filling up your folder. However, be cautious when taking this route and using other peoples scripts. Most people, to include myself, will write scripts which may use busybox applets but will not call the applet with 'busybox'. So, if the applet is not symlinked to busybox then you may come across problems with the script. Easy fix though. Just open up the script and find all commands which are calling on busybox applets and just add 'busybox' before it, then save.
Sent from my C525c using Tapatalk
Again I have a dumb question but I'm lost with git hub and the git emulator. I followed a guide for compiling a kernel and I did what it asked but this seems routine any monkey can plug in data I wanna know how to actually download the toolchain and run it. Or is there like a dummies guide to what does what and how it works I have to be missing just simple steps
Sent from HTC One SV
k2plc----cricket version
deodexed-mod pack 5
unlocked-super cid-soff
Open up the terminal on your linux system.
Type and enter,
Code:
git clone https://android.googlesource.com/platform/prebuilts/gcc/linux-x86/arm/arm-eabi-4.6
When you enter that, it will clone the toolchain for 4.6 to whatever directory you are currently in, so now sure you change directories if you wish to have the toolchain cloned (downloaded) to a specific location.
Sent from my C525c using Tapatalk
---------- Post added at 07:22 AM ---------- Previous post was at 07:19 AM ----------
To direct the toolchain to your systems path so you can call on it then type and enter:
Code:
export PATH=$(pwd)/prebuilts/gcc/linux-x86/arm/arm-eabi-4.6/bin:$PATH
Sent from my C525c using Tapatalk
---------- Post added at 07:25 AM ---------- Previous post was at 07:22 AM ----------
To build your kernel,
Code:
export ARCH=arm
export SUBARCH=arm
export CROSS_COMPILE=arm-eabi-
cd path/to/kernel/source
make k2_plc_cl_defconfig
make zImage
make modules
Now, go experiment lol.
Sent from my C525c using Tapatalk
---------- Post added at 07:28 AM ---------- Previous post was at 07:25 AM ----------
The kernel binary is output as: `arch/arm/boot/zImage
To see where the modules are built go and look at the "buildme.sh" script I use for my kernel and it will show you the directory to grab them. They will be needed or else your WiFi won't work if you install your newly built kernel.
Sent from my C525c using Tapatalk
1045
Don't know if i'm late to the party ,so to get things straight .Is anyone still willing to work on this i'm interested too.

[GUIDE] Building Pure Nexus

Introduction
Hello everyone, this is a guide to get you up and running with your own build of Pure Nexus for the Nexus 5X. In this thread, you will learn how to get your computer set up to build and the commands you will need to run. Please read the entire guide and the FAQ. Additionally, this is a developer's thread, there should be no off topic discussion.
Compilation Guide
This is available on my Github, where it may be a little more up to date.
0. Getting started
In this guide, I will go over how to build Pure Nexus on your Linux machine. This particular tutorial will focus on Ubuntu 16.04 as that is what I use (Mint 18 is also good) but this should work with any version of Linux; it does need to be 64-bit however. I will leave the installation of that up to you, Google is a wonderful resource. If you don't have a good computer but still want to build, check out this thread on XDA: http://forum.xda-developers.com/chef-central/android/guide-how-to-build-rom-google-cloud-t3360430
1. Set up your environment
1. Automatically
Code:
sudo apt-get install git-core
git clone https://github.com/akhilnarang/scripts
cd scripts
ls
bash <script-name>
<script-name> should be one of the scripts in the folder for your particular architecture.
2. Manually
1. Install Java 8
Code:
sudo apt-get update
sudo apt-get install openjdk-8-jdk
sudo apt-get install openjdk-8-jre
2. Install other build tools
Code:
sudo apt-get install git-core gnupg flex bison gperf build-essential zip curl zlib1g-dev gcc-multilib g++-multilib libc6-dev-i386 lib32ncurses5-dev x11proto-core-dev libx11-dev lib32z-dev ccache libgl1-mesa-dev libxml2-utils xsltproc unzip
2. Configure repo and git
If you have any problems with the below commands, try running as root:
Code:
sudo -s
Git is an open source version control system which is incredibly robust for tracking changes across repositories. Repo is Google's tool for working with Git in the context of Android. More reading if you are interested: https://source.android.com/source/developing.html
Run these commands to get repo working (only do this if you did the manual set up method above:
Code:
mkdir ~/bin
PATH=~/bin:$PATH
curl https://storage.googleapis.com/git-repo-downloads/repo > ~/bin/repo
chmod a+x ~/bin/repo
Run these commands to get git working:
Code:
git config --global user.name "Your Name"
git config --global user.email "[email protected]"
3. Download the source
First, before downloading the source, create a folder for the source and move into it.
Code:
mkdir ~/<foldername> (eg. mkdir ~/PN or ~/PureNexus)
cd ~/<foldername>
Then, we need to grab the manifest and sync down the repositories. Here are the commands to do this for Pure Nexus for Nougat (make sure you are in the source folder you made above):
Code:
repo init -u https://github.com/PureNexusProject/manifest.git -b n
repo sync --force-sync
Here is the process generally for other ROMs:
When you go to build a ROM, you must download its source. All, if not most, ROMs will have their source code available on Github. To properly download the source, follow these steps:
Go to your ROM's Github (e.g. http://github.com/PureNexusProject)
Search for a manifest (usually called manifest or android_manifest).
Go into the repo and make sure you are in the right branch (located right under the Commits tab).
Go into the README and search for a repo init command. If one exists, copy and paste it into the terminal and hit enter.
If one does not exist, you can make one with this formula:
Code:
repo init -u <url_of_manifest_repo>.git -b <branch_you_want_to_build>
For example:
Code:
repo init -u http://github.com/PureNexusProject/manifest.git -b n
After the repo has been initialized, run this command to download the source:
Code:
repo sync --force-sync
This process can take a while depending on your internet connection.
4. Build it!
At this point, it'd be a good idea to set up ccache. ccache is a compiler cache, it stores previously compiled files in a directory and pulls from that instead of recompiling if nothing has changed. This speeds up compilation a LOT. If you want to use it, follow the below steps:
Open up your .bashrc file in your home directory using a text editor or nano and append this to the end of it:
Code:
export USE_CCACHE=1
Then type:
Code:
source ~/.bashrc
After that, run one of the below command (replacing the # with how many GBs of ccache you want, 50 is recommended)
Use this one if you used the manual method of set up in section 1:
Code:
prebuilts/misc/linux-x86/ccache/ccache -M #G
Use this one if you used the automatic method of set up in section 1:
Code:
ccache -M #G
After that, it's time to build!
Code:
. build/envsetup.sh
breakfast bullhead
mka bacon
After that, your computer will build the flashable zip file and if you see something that says make completed, you've done it!
Any time that you want to rebuild, type the following commands:
Code:
repo sync --force-sync
. build/envsetup.sh
breakfast bullhead
mka clobber
mka bacon
I also have a script to do this on my Github here
Frequently Asked Questions
1.1 Q: I got an error, what do I do??
1.1 A: Well to start, if it is anything with Ninja, I would go ahead and disable it. You can add this to your .bashrc file:
Code:
export USE_NINJA=false
Then type this
Code:
source ~/.bashrc
. build/envsetup.sh
breakfast bullhead
mka clobber
mka bacon
If it is saying you ran out of memory, follow this post.
If it isn't Ninja related, check out @AzraelsKiss's post here, where he has documented a few common issues. If none of those apply, post here with a detailed list of what you have done and we will do our best to help you.
1.2 Q: Can you guys share your personal builds?
1.2 A: No, personal builds are just that: personal. Beans releases whenever he feels that the release is ready for the masses and if a bunch of personal builds are floating around, that tarnishes the Pure Nexus name. We are more than happy to help get you up and running but we will not be sharing our builds. Thanks for understanding!
this wont work on Windows, right?
RonnellTapawan said:
this wont work on Windows, right?
Click to expand...
Click to collapse
I have heard people try to use Bash for Windows but I don't think it will work. Linux or bust.
nathanchance said:
I have heard people try to use Bash for Windows but I don't think it will work. Linux or bust.
Click to expand...
Click to collapse
I tried on bash for windows but it can't build android roms
Dude you should seriously get a XDA medallion or some sort of metal for all you do all over XDA. I see you everywhere. Thanks for building for us and also for this write up. :good: @ nathan
SM210 said:
Dude you should seriously get a XDA medallion or some sort of metal for all you do all over XDA. I see you everywhere. Thanks for building for us and also for this write up. :good: @ nathan
Click to expand...
Click to collapse
Talk to my superiors :silly: thanks for the kind words
Edited.......
Sent from my Nexus 5X using Tapatalk
myawan said:
Anybody wanna share home made build?
Sent from my Nexus 5X using Tapatalk
Click to expand...
Click to collapse
If you read at the end of the OP, it says:
"1.2 Q: Can you guys share your personal builds?
1.2 A: No, personal builds are just that: personal. Beans releases whenever he feels that the release is ready for the masses and if a bunch of personal builds are floating around, that tarnishes the Pure Nexus name. We are more than happy to help get you up and running but we will not be sharing our builds. Thanks for understanding!"
Reason being, because if we start compiling these and handing it out like it's no ones business, we're going to run Pure Nexus into the ground and people will start uploading them on AFH and it'll be one big mess. My guess is, this is just a courtesy by the original poster to those of us who can't wait.
My two cents.:laugh::highfive:
i'm on it!!!!! thank you very much!!! download is taking forever ugh
Building it right now! Thanks
I think this would work in Cygwin. I used to compile stuff for the PS3 way back. I'd have a lot of reading to do if I wanted to build this for my phone.
Which gapps to use with this?
Open Gapps micro are working fine.
Gesendet von meinem Nexus 5X mit Tapatalk
So WE can't share our build either? Or what, i didn't get it.
CreasingMass Dev said:
So WE can't share our build either? Or what, i didn't get it.
Click to expand...
Click to collapse
Don't distribute personal builds. Flash them yourself and that is it.
4 hours of download :crying:
OOH MAN!!!!!! no more space in my device!!! how can i resume that???
Code:
Checking out files: 100% (1717/1717), done.
error: unable to write file current/platforms/android-21/arch-x86_64/usr/lib/libz.a
error: unable to write file current/platforms/android-21/arch-x86_64/usr/lib/libz.so
fatal: cannot create directory at 'current/platforms/android-21/arch-x86_64/usr/lib64': Spazio esaurito sul device
Traceback (most recent call last):
File "/home/matteo/Scaricati/PureNexus/.repo/repo/main.py", line 531, in <module>
_Main(sys.argv[1:])
File "/home/matteo/Scaricati/PureNexus/.repo/repo/main.py", line 507, in _Main
result = repo._Run(argv) or 0
File "/home/matteo/Scaricati/PureNexus/.repo/repo/main.py", line 180, in _Run
result = cmd.Execute(copts, cargs)
File "/home/matteo/Scaricati/PureNexus/.repo/repo/subcmds/sync.py", line 769, in Execute
project.Sync_LocalHalf(syncbuf, force_sync=opt.force_sync)
File "/home/matteo/Scaricati/PureNexus/.repo/repo/project.py", line 1325, in Sync_LocalHalf
self._InitWorkTree(force_sync=force_sync)
File "/home/matteo/Scaricati/PureNexus/.repo/repo/project.py", line 2482, in _InitWorkTree
raise GitError("cannot initialize work tree")
error.GitError: cannot initialize work tree
can i move the PureNexus folder in an external drive and resume??? please
MatteXperiaU said:
4 hours of download :crying:
OOH MAN!!!!!! no more space in my device!!! how can i resume that???
can i move the PureNexus folder in an external drive and resume??? please
Click to expand...
Click to collapse
You can try. Your build times will be much slower though.
Sent from my Nexus 6P using XDA Labs
nathanchance said:
You can try. Your build times will be much slower though.
Sent from my Nexus 6P using XDA Labs
Click to expand...
Click to collapse
i have another partition in the same HD (300GB).. i can use that :fingers-crossed:
which command i need to resume?
sorry for the questions man, you're too kind
TPMJB said:
I think this would work in Cygwin. I used to compile stuff for the PS3 way back. I'd have a lot of reading to do if I wanted to build this for my phone.
Click to expand...
Click to collapse
No promises...
http://www.howtogeek.com/249966/how-to-install-and-use-the-linux-bash-shell-on-windows-10/
Out of curiosity, realistically how much disk space would be required to download everything and compile with a 50GB cache? I got everything downloaded and the compile ran but threw some warnings (most of which may have been benign). When the compile terminated with an error, I had about 40MB left on my Linux Mint 18 partition so I assume it ran out of space I started with about 70GB free space
I deleted everything and decided to try again if and when I have a larger partition to play with..... I am currently dual booting on a Windows machine and didn't think to allocate that much space to Mint.
Paul

A noob tries his hand at ROM development for the MiA1 tissot

The problem with reading the articles on XDA is that eventually you want to try out some of the things described in these pages. I am no exception. After reading the superb article https://forum.xda-developers.com/mi-a1/how-to/guide-build-rom-source-tissot-t3754723 I decided to try my hand at developing the ROM for the Xiaomi MiA1. This is my daily driver and that in itself was a strong reason for motivation.
I tried replicating the steps given in the article on my Dell Inspiron and immediately ran into issues. The basic requirements mentioned are a linux or Mac computer. So to start with I formatted my laptop. Removed windows 10 and installed Ubuntu's latest 18.04 LTS.
I believed I had the next set of requirements for custom ROM development which were
• A basic understanding of Linux based OS specifically Ubuntu.
• Ability to type and use the command line. Write or copy paste commands in the Ubuntu konsole.
• A basic understanding of programming concepts, read and update XML files, understand error messages.
• Fast internet access.
• Steady electricity supply.
• Lots and lots of patience.
This still did not solve my problem. The build would crash repeatedly. Then I read the https://source.android.com/setup/. A whole new set of requirement came up. The article said that ideally the build system should exceed these conditions
• 64 bit environment
• 100 GB of free hard disk space
• 16 GB RAM / swap space.
At home my son was about to buy a new PC and this made his old PC available. I upgrade the RAM and added a new hard disk. Now my hardware configuration was as under :
• Intel i5 processor
• 16 GB RAM
• 1 TB hard disk.
With a new hard disk I had to create a boot-able USB drive. This I achieved with Rufus. My old laptop which again had its Windows 10 installation was used to install Rufus based on the instructions i got from https://rufus.akeo.ie/
The latest version of Ubuntu I downloaded from https://www.ubuntu.com/download/desktop
Setting Ubuntu from scratch for someone used to the world of windows is not exactly easy. I found the tutorial at https://tutorials.ubuntu.com/tutorial/tutorial-install-ubuntu-desktop#0 extremely helpful.
I wrote down the steps I took in reaching the final goal of a Lineage ROM for my Mi A1.
Step 1: Setup Ubuntu - already completed
I chose the default settings as recommended in the setup.
Step 2: Installation of Java Development Kit
Once Ubuntu was up and running I opened a konsole window and typed the following commands
PHP:
sudo apt-get update
sudo apt-get install openjdk-8-jdk
Ubuntu did all the installing as I looked on.
Step 3: Installing required packages
PHP:
sudo apt-get install git-core gnupg flex bison gperf build-essential zip curl zlib1g-dev gcc-multilib g++-multilib libc6-dev-i386 lib32ncurses5-dev x11proto-core-dev libx11-dev lib32z-dev libgl1-mesa-dev libxml2-utils xsltproc unzip
Step 4: Configure your smart phone access
I next installed the tools required to access the phone. This access would be required to later flash the phone or access its internals with ADB.
PHP:
sudo apt-get install android-tools-adb
sudo apt-get install fastboot
Step 5: To creating the work directories i typed the following commands. I was following the instructions from the above two articles alternately.
PHP:
mkdir -p ~/bin
mkdir -p ~//lineage
Step 6: Installing repo
I was informed that the Android source tree is located in a Git repository which is hosted by Google. The Git repository includes metadata for the Android source. Repo is a tool that makes it easier to work with Git .
PHP:
curl [url]https://storage.googleapis.com/git-repo-downloads/repo[/url] > ~/bin/repo
Once the repo was downloaded I had to make it executable
PHP:
chmod a+x ~/bin/repo
Step 7: The next step was to initialize the lineage source
This required to change to the directory created in step number 5 above. As someone coming from the world of windows I preferred to use the GUI and open the lineage folder created by using the mouse click. There right click brings up the option of ' Open in Terminal' . Those who prefer to type commands can use the below command
PHP:
cd ~//lineage
Once I had made sure that I was in the newly created lineage folder I moved ahead.
Step 8: Now i was required to configure my Git user
PHP:
git config --global user.name "Your Name"
git config --global user.email "[email protected]"
I replaced the text within the " " with my creadentials, which I had created on https://github.com/
Step 9: Now we moved on to initializing the repo
PHP:
repo init -u [url]https://github.com/LineageOS/android.git[/url] -b lineage-15.1
A successful initialization showed a message stating that Repo is initialized in your working directory. The lineage directory now contain a .repo folder. To check hidden folder I used control + H key.
Step 8: Download the source code
This is the step where you will realize the importance of having a fast internet connection. The source code size is about 30 – 35 GB. I have a 10 mbps line and at times the download speed shoots up to 20- 25 mbps!!!* Yet it takes me anything from 4 – 10 hours to download the entire code!
My suggestion is check the time when your local ISP download speeds are at its best. For me it is during the night. I set the download up at night and go to sleep!
The command to get the source code is :
PHP:
repo sync -c -f --force-sync --no-clone-bundle --no-tags --optimized-fetch –prune
Optional Step 8 a: Making a backup of your source code
I copied the entire folder and kept a copy on an external device. This is just in case there is any need for me to format my hard disk. While copying I do not copy the .Repo and .Cache folders on to my backup. To check hidden folders press control + H keys.
Step 9: Get the source code for your specific device.
This is where I was stuck numerous times. As I understood the code which was downloaded is generic in nature. For your particular device you would need to get files which are specific to your device.
The source for all these files is github. You are targeting three sets of folders – Device, Kernel and vendor.
The git clone commands given below are for the tissot or Xiaomi MiA1 phone. Similarly other phones have their locations on GitHub from where you can get files specific to them.
PHP:
git clone [url]https://github.com/TheScarastic/andr...msm8953-common[/url] -b lineage-15.1 device/xiaomi/msm8953
git clone [url]https://github.com/TheScarastic/andr..._xiaomi_tissot[/url] -b lineage-15.1 device/xiaomi/tissot
git clone [url]https://github.com/TheScarastic/prop..._vendor_xiaomi[/url] -b lineage-15.1 vendor/xiaomi
git clone [url]https://github.com/Tissot-Developmen..._xiaomi_tissot[/url] -b 8.1 kernel/xiaomi/msm8953
Step 10: Modify Caching to speed up the build process.
PHP:
export CCACHE_DIR=./.ccache
ccache -C
export USE_CCACHE=1
export CCACHE_COMPRESS=1
prebuilts/misc/linux-x86/ccache/ccache -M 50G
Step 11: Configure JACK
JACK is the java compiler and can cause crashes – believe me! A simple fix is this command which you type next
PHP:
export _JACK_VM_ARGS="-Dfile.encoding=UTF-8 -XX:+TieredCompilation -Xmx4G"
Step 12: Cleaning up the build folder
PHP:
make clean
Step 13: Initializing the build
PHP:
source build/envsetup.sh
Step 14: Starting the build
PHP:
croot
brunch tissot
Watching the build on the screen is an interesting phase. It can get a bit tedious. In my case it took about 3 hours to complete the build. There were numerous errors that were thrown up. Files were declared as missing. After a couple of failures I realized I could search for them and then paste the file in the appropriate folders.
The one good thing about the build errors is googling for them usually gets you the right help. There would definitely be someone in some part of the world who would have run into a similar issue.
Finally after a 3 hour wait I got my zip file which when i flashed through TWRP on my MiA1. The sheer joy of having a ROM you created on your phone is indeed beyond words. It took me about a week of sitting for about ten to fifteen hours to get the various combination right, but believe me when I tell you the results are worth it.
My thanks to arunassain https://forum.xda-developers.com/member.php?u=6768248 from whose article I was able to understand the basics. He helped me with responses to my queries when I was stuck.
I further picked up from the excellent articles under the title Establishing a build Environment at https://source.android.com/setup/build/initializing
A great video that helped me was available on the topic How to build your own custom Android ROM at https://www.androidauthority.com/build-custom-android-rom-720453/
To check out the ROM's built for the MiA1 please click here
Now coming to the question if I have understood everything that is to learn about ROM development, well the answer is no. This was just the first build by a noob of a ROM which somehow worked. I have been using the ROM on my daily driver for the past one day and it is working perfectly. Having said that I still need to understand more of what happens behind the scenes in this wonder world of Custom ROM development.
Don't tell me you thought that you could build a rom on x86 processor/OS
Give him a break, he admitted that he is new to this building ROM world, I can understand that some people can think that if a proc is powerful enough they can use it to build no matter if it's a x64 or x86.
Thanks for you story mate! And don't hesitate to ask dev on telegrams or G+ to explain you some what you don't understand :good: I'm pretty sure that would love to finally have someone like you, who is truly interested in this whole world

Categories

Resources