[Guide] In-Depth Compiling using Ubuntu 12.10 - HTC Rezound

DISCLAIMER: I am in no way responsible for you breaking your phone or your computer. You the reader/user/dev/compiler understand that you enter into this agreement freely with no expectations that everything will work 100% of the time.
This is in no way a means of stealing people away from Shrikes guide. If you do not have ubuntu installed as a complete os/ or do not intend to maked modifications to system files etc. Then please use the guide for compiling roms using a virtual box here (CM9 The complete noobs guide to building CM9 in a virtual machine)
Still with me. COOL. So you now have either a dual boot or a fully thrashed Linux machine. I will be using my Vaio VPCF114 box with Ubuntu 12.10 to make this guide. This is also compatible with 12.04 if you have not yet upgraded. I am not sure if the same goes for Redhat/Fedora or Backtrack 5. My work here is a compilation of years of doing research and compiling my own roms.
This guide is to help people that have little knowledge of linux get a base idea of where to start to make their own roms and kernels. Part 1 will be building your box and compiling a rom. Part 2 will be how to make and grab your Kernel.
First lets get Dropbox from here DROPBOX This is good for backing up your libs and sharing files with other Devs.
What you need:
1) A Windows computer, preferably with a CPU that supports 64-bit. Your pc/laptop does no need to have 64-bit windows on it, your CPU just needs to support the hardware. I think at this day and age, almost all devs have a 64-bit box. You will need this so you can make a dual boot box.
2) Plenty of memory. I recommend at least 4GB on the host computer. You can make it work on less, but more is better.
3) At least 60GB of free hard drive space during the install, but i'm sure you already know that and have gigs upon gigs of free space. If you do not know how much space you have, go to settings>details and it will tell you. Note: The source download is approximately 8.5GB in size. You will need over 30GB free to complete a single build, and up to 100GB (or more) for a full set of builds.
4) Lastly a good book, tab, second pc, whatever because this is not a quick process. And compiling roms literally takes hours.
5) Most importantly UBUNTU 12.10. If on the off hand you do not have it, you can pick it up at Ubuntu Central
OK YOU READY. LET'S GET CRACKING. First you need to set up Java on your box. Then grab a couple of programs you will need for editing files Go to your UBUNTU SOFTWARE CENTER. In the search bar in the top right type in Java. We will be installing Java 6 Runtimes.
{
"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"
}
The Sun JDK is no longer in Ubuntu's main package repository. In order to download it, go here JAVA
If the link does not work, you want accept the license agreement and download jdk-6u35-linux-x64.bin
Once it done:
chmod a+x ~/Downloads/jdk-6u35-linux-x64.bin
sudo mv ~/Downloads/jdk-6u35-linux-x64.bin /usr/lib
cd /usr/lib
sudo ./jdk-6u35-linux-x64.bin
Now lets finish the install and make it default: (Remember to enter in the lines one at a time)
sudo mv jdk1.6.0_35/ jvm/
sudo rm jdk-6u35-linux-x64.bin
sudo update-alternatives --install /usr/bin/java java /usr/lib/jvm/jdk1.6.0_35/jre/bin/java 1
sudo update-alternatives --install /usr/bin/javac javac /usr/lib/jvm/jdk1.6.0_35/bin/javac 1
sudo update-alternatives --install /usr/bin/jar jar /usr/lib/jvm/jdk1.6.0_35/bin/jar 1
sudo update-alternatives --install /usr/bin/javadoc javadoc /usr/lib/jvm/jdk1.6.0_35/bin/javadoc 1
IF YOU HAVE MULTIPLE JAVA JDK'S INSTALLED FOR OTHER PROJECTS YOU WILL WANT TO MAKE 1.6 THE DEFAULT.
On each command you will have to select the version of java you want to use. This command is helpful if you also do other coding.
sudo update-alternatives --config java
sudo update-alternatives --config javac
sudo update-alternatives --config jar
sudo update-alternatives --config javadoc
Java 6: for Gingerbread and newer
Java 5: for Froyo and older
Note: The lunch command in the build step will ensure that the Sun JDK is used instead of any previously installed JDK.
Now what we need:
We need to open up a terminal window and download packages.
Remember you will need to input your password after each line.
sudo add-apt-repository ppa:git-core/ppa
and
sudo apt-get update
(this will download all of the Quantal updates for universe and multiverse.
Next we want to install some Libs and Binaries. (You can copy and paste this into your terminal)
sudo apt-get install git-core gnupg flex bison gperf build-essential zip curl libc6-dev libncurses5-dev:i386 x11proto-core-dev libx11-dev:i386 libreadline6-dev:i386 libgl1-mesa-glx:i386 libgl1-mesa-dev g++-multilib mingw32 openjdk-6-jdk tofrodos python-markdown libxml2-utils xsltproc zlib1g-dev:i386 schedtool gcc-multilib g++-multilib pngcrush
(don't worry. some of the libs my fail. This happens as google changes their sources)
Now we need to tell the computer how to "REPO", this is where you will tell it to handle the Andorid sources via the Git command.
cd ~
mkdir -p bin
export PATH=${PATH}:~/bin
Once done you can use "echo $PATH" to see all of your path directories.
sudo apt-get install curl
curl https://dl-ssl.google.com/dl/googlesource/git-repo/repo > ~/bin/repo
(this will get you the repo script)
Now lets give it executable permissions by using chmod
chmod a+x ~/bin/repo
Now that we can repo
Lets setup the Android SDK. (Get a beer/coffee/soda, this will take a second)
Go to http://developer.android.com/sdk/index.html And install the ADT bundle for Linux.
Install the SDK and Eclipse IDE
Unpack the ZIP file (named adt-bundle-linux.zip) and save it to an appropriate location, such as a "Development" directory in your home directory.
Open the adt-bundle-linux/eclipse/ directory and launch eclipse.
That's it! The IDE is already loaded with the Android Developer Tools plugin and the SDK is ready to go. To start developing, read Building Your First App on the developer site.
Caution: Do not move any of the files or directories from the adt-bundle-linux directory. If you move the eclipse or sdk directory, ADT will not be able to locate the SDK and you'll need to manually update the ADT preferences.
Now to just add the tools to our $Path.
gedit .bashrc
Scroll to very bottom, under last fi input
export PATH=${PATH}:~/adt-bundle-linux/sdk/tools
export PATH=${PATH}:~/adt-bundle-linux/sdk/platform-tools
That was pretty painless.
Now lets start some cool stuff.
TestSigning
Click on your desktop menu bar and go into your home folder. Press Ctrl and h together on your keyboard to show hidden folders. Anything marked with a . in front of it is hidden, we are looking for a folder name .gnome2, go into it and look for nautilus-scripts. Once inside this folder, right click on a empty space and select create document and then empty file and name it sign. Open up that empty document and copy and paste this script from dumbfaq on xda
Code:
#!/bin/bash
# Update the Loc var to where YOU stored the testsign.jar file !
SUCCESS=
Loc=~/android/source/
for arg
do
TMP=$(ls $arg | sed 's/\(.*\)\..*/\1/')
EXT=${arg##*.}
java -classpath "$Loc"testsign.jar testsign "$arg" "$arg"-signed 2> /tmp/signTmp
SUCCESS=$?
if [ $SUCCESS -eq 1 ]
then
zenity --info --title "Sign APK" --text "signing FAILED! \n`cat /tmp/signTmp`"
exit 1
fi
mv $TMP.$EXT-signed $TMP-signed.$EXT
done
zenity --info --title "Sign APK" --text "signing completed!"
Save and exit out and right click on our new script and select properties. select the permissions tab and look for a check box that says allow executing as a program. click on it and now we have a pretty little script that we can just right click on a update.zip file and sign with our test keys for flashing. You will also need the testsign.jar from the bottom of this guide.
Now lets do a couple things so that we can get our Phones Vendor ID.
Type in your terminal
lsusb
While your phone isconnected to see our vendor id and you will something like this. Note that for the Rezound our vendor id is
Bus 002 Device 003: ID 0bb4:0ccd HTC (High Tech Computer Corp.)
In this case the Vendor Id is “18d1″ and the Product ID is “4e12″. Please keep in mind that the Vendor ID for HTC changed from “0bb4″ to “18d1″. The older HTC phones like the G1 have a Vendor ID of “0bb4″.
Now that we have that, we can make our rules for for connecting to adb
sudo gedit /etc/udev/rules.d/51-android.rules
Paste
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"
Save and exit
Reboot your computer so that all of the changes we have made can Take effect.
OK. All setup and ready to start making a Rom with your name on it.
IF you are already running AOSP on your phone, you can back up you system now Do this by:
cd ~/
mkdir stock
cd stock
adb pull /system/ ~/stock/
This will dump your entire system directory into the stock folder. This is good so you always have a working system. Now zip the folder and tuck it away for safe keeping.
Now the MEAT AND POTATOES. Grabbing the Source. "CYANOGENMOD"
cd ~/
mkdir -p android/source
touch ~/.netrc
cd ~/android/source
sudo apt-get install git
sudo sysctl -w net.ipv4.tcp_window_scaling=0 (remvoes the overstack flow problem that causes some repo jobs to hang)
repo init -u git://github.com/Chad0989/android.git -b ics
(Note: If you want to compile a jellybean rom, just replace the ics with jellybean!)
Once you do this, it's going to ask you for your email. This is how you will log back into the repo in the future. So answer the questions correctly.
Now we will sync the Repo and set it to run.
repo sync -j4
-j# (# means twice the amount of cores in your computer) means jobs. I have an i7 processor and a pretty decent internet connection, so i'm running max jobs at once for faster sync) Be patient. It's still going to take a while to clone the directory.
Once done with the Sync we want to setup our device.
This is where we get the pre-built part of our rom.
First we will
./vendor/cm/get-prebuilts
Probably all that will be left directly after the repo will be the Terminal service for android.
Now we are about ready to compile our Rom:
cd ~/android/source
repo sync (it should only take a moment this time)
. build/envsetup.sh
make clobber
Now you can compile your rom using the brunch command (This will take about 1 to 1 1/2 hours depending on your box)
brunch vigor
Now you can go to the output box and pick up your freshly made Rom.

Reserved for Kernel

Changed Repo from CyanogenMod to Chad0989 for easier Vigor integration.
21NOV12: Change Repo from Chad0989 to Dragonstalker github.
Change Repo from DragonStalker to Chad0989 github
Modified Testsign script to reflect changed ADT Tools location.

First, looks interesting i might look into this when i boot into Ubuntu next time.

jon7701 said:
First, looks interesting i might look into this when i boot into Ubuntu next time.
Click to expand...
Click to collapse
i wanted to show people how i do my own personal roms and kernels. With this setup, you can make roms for multiple devices and also use Eclipse to make apps if thats your bag baby.

dragonstalker said:
i wanted to show people how i do my own personal roms and kernels. With this setup, you can make roms for multiple devices and also use Eclipse to make apps if thats your bag baby.
Click to expand...
Click to collapse
Nice, if i can figure out a little more about how to dev and stuff maybe ill make my own rom one day.

Wow. So going to do this right now. Thanks for your effort on this.
Sent from my ADR6425LVW using xda premium

I can't wait for the final act! I am going to try this so I can get my hands on some jelly beans.

Vedor ID
Quick question. I notice that you mention that "in this case the Vedor ID is 18d1" but in your screenshot it say 0bb4. You have some clarification after that and I'm not sure I understand it 100%. My rezound show the 0bb4 for vedor ID as well. I guess what I'm asking is if you could clarify the statement about the Vendor ID? Thanks, sorry if this is a dumb question.

Very nice guide. Extremely thorough which makes a great tutorial.

vonhinkle said:
Quick question. I notice that you mention that "in this case the Vedor ID is 18d1" but in your screenshot it say 0bb4. You have some clarification after that and I'm not sure I understand it 100%. My rezound show the 0bb4 for vedor ID as well. I guess what I'm asking is if you could clarify the statement about the Vendor ID? Thanks, sorry if this is a dumb question.
Click to expand...
Click to collapse
It shows it as 0bb4. But as for the drivers Ubuntu uses. The Vendor id for High Tech Computers is 18d1. I was using a stock rom to pull the vendor Id from and for some reason, HTC has never changed it on there.

GrayTheWolf said:
Very nice guide. Extremely thorough which makes a great tutorial.
Click to expand...
Click to collapse
I teach networking to and development to the Army. I took the same ideology into this guide. Not just tell you how to do it, but explain why it works. I will, as thing change try to keep this updated, and keep up with Shrike as he learns new things. Thank Shrike for making me realize that we didn't have a guide for people that do run Ubuntu, and need to know how to set up.

Ok the updated Guide is online. Please tell me if anything is not correct. I'm only Human. Working with Snuzzo for and Updated Kernel Optimization section and hopefully Chad with the Repo..
More to Follow .............................

I'm compiling right now. The guide was good, but there were some extra steps I had to take to get this far. My Rezound is old, so my android.rules file needed the 0bb4 id (I got rid of the ATTR{idproduct} part). Also adb wasn't connecting when using filename 51-android.rules, so I used 70-android.rules and mode 0666 instead of 0600, then adb connected. I think the 70 was the fix, but mode 0666 I found from other, older guides on setting up adb, I don't know what change that makes but it's probably unnecessary. Finally, on compile I was getting errors like bison missing and other missing also. That big line with all the installs must have not worked for all the programs, so I just installed the missing ones individually per error message. There may have been other issues that I am forgetting but nothing too hard to figure out, of course I have worked a tiny bit with Ubuntu over the past 5 years.
Still compiling, so it seems to be working. I used Chad0989's repo, and jellybean! Thanks for the guide, if I have any problems I shall post them.

drkow19 said:
I'm compiling right now. The guide was good, but there were some extra steps I had to take to get this far. My Rezound is old, so my android.rules file needed the 0bb4 id (I got rid of the ATTR{idproduct} part). Also adb wasn't connecting when using filename 51-android.rules, so I used 70-android.rules and mode 0666 instead of 0600, then adb connected. I think the 70 was the fix, but mode 0666 I found from other, older guides on setting up adb, I don't know what change that makes but it's probably unnecessary. Finally, on compile I was getting errors like bison missing and other missing also. That big line with all the installs must have not worked for all the programs, so I just installed the missing ones individually per error message. There may have been other issues that I am forgetting but nothing too hard to figure out, of course I have worked a tiny bit with Ubuntu over the past 5 years.
Still compiling, so it seems to be working. I used Chad0989's repo, and jellybean! Thanks for the guide, if I have any problems I shall post them.
Click to expand...
Click to collapse
Thanks for the headsup. Android.source.com said to change it to that. SO I will change it back.
As for the progs that did not install. Android Source pulls progs, i've just been to lazy to go over the tag and remove the ones that have been obsoleted. I will take care of that this weekend.

Schweet! I compiled my own rom! Syncing took about 30 mins, compiling also 30 mins. I have a 4.4 ghz oc'd Core i5 with 8 gig 1866 ram. Now I need to learn some simple things, like how to rename the rom package, edit the installation text, add some tweaks, etc.
What gapps do you use for CM10? I downloaded this one http://wiki.cyanogenmod.org/wiki/Latest_Version/Google_Apps for CM10, but it doesn't list xdpi, and it failed flashing. So I used this one instead http://forum.xda-developers.com/showthread.php?t=1965290 and it worked.
edit: google search seems to force close with the gapps I used.

drkow19 said:
Schweet! I compiled my own rom! Syncing took about 30 mins, compiling also 30 mins. I have a 4.4 ghz oc'd Core i5 with 8 gig 1866 ram. Now I need to learn some simple things, like how to rename the rom package, edit the installation text, add some tweaks, etc.
What gapps do you use for CM10? I downloaded this one http://wiki.cyanogenmod.org/wiki/Latest_Version/Google_Apps for CM10, but it doesn't list xdpi, and it failed flashing. So I used this one instead http://forum.xda-developers.com/showthread.php?t=1965290 and it worked.
edit: google search seems to force close with the gapps I used.
Click to expand...
Click to collapse
Note: There is a reason that me and Chad have asked not to compile CM10 roms. The code is not complete yet.
If you found gapps that work, then that's a major. Post to the thread where you found it and that it works. To rename a rom package, you can just right click>rename and name it what you want it. To rename it so it shows up inside the rom on the phone for details is different.
I would not advise it if you don't know what you are doing, but you have to edit the build.prop. As for tweaks. Depends on what tweaks you want to change. Android Developer site is where i get all my tweaks, and i get some from other devs. Glad you are joining the community.
Happy building and thanks for the contribution.

issues
dragonstalker said:
Note: There is a reason that me and Chad have asked not to compile CM10 roms. The code is not complete yet.
If you found gapps that work, then that's a major. Post to the thread where you found it and that it works. To rename a rom package, you can just right click>rename and name it what you want it. To rename it so it shows up inside the rom on the phone for details is different.
I would not advise it if you don't know what you are doing, but you have to edit the build.prop. As for tweaks. Depends on what tweaks you want to change. Android Developer site is where i get all my tweaks, and i get some from other devs. Glad you are joining the community.
Happy building and thanks for the contribution.
Click to expand...
Click to collapse
hey guys ive been compiling on 12.04 still new to this but ive set up a new enviorment useing this guide with 12.10 im getting this error though
Import includes file: /home/ken/CM10/out/target/product/i577/obj/SHARED_LIBRARIES/audio.primary.msm8660_intermediates/import_includes
make: *** No rule to make target `/home/ken/CM10/out/target/product/i577/obj/lib/libaudioalsa.so', needed by `/home/ken/CM10/out/target/product/i577/obj/SHARED_LIBRARIES/audio.primary.msm8660_intermediates/LINKED/audio.primary.msm8660.so'. Stop.
make: *** Waiting for unfinished jobs....
target StaticLib: libc_nomalloc (/home/ken/CM10/out/target/product/i577/obj/STATIC_LIBRARIES/libc_nomalloc_intermediates/libc_nomalloc.a)
any help would be appreatiated thanks

dragonstalker said:
Note: There is a reason that me and Chad have asked not to compile CM10 roms. The code is not complete yet.
If you found gapps that work, then that's a major. Post to the thread where you found it and that it works. To rename a rom package, you can just right click>rename and name it what you want it. To rename it so it shows up inside the rom on the phone for details is different.
I would not advise it if you don't know what you are doing, but you have to edit the build.prop. As for tweaks. Depends on what tweaks you want to change. Android Developer site is where i get all my tweaks, and i get some from other devs. Glad you are joining the community.
Happy building and thanks for the contribution.
Click to expand...
Click to collapse
Roger that. I will definitely try to do some build.prop tweaks, and then move on from there. Thanks again for the guide! Meanwhile I am emailing Ubuntu about their re-installer option to erase and reinstall Ubuntu, which wipes out all partitions, not just the current Ubuntu partition as I figured would happen. It wiped my main NTFS partition with all my stuff, without even a warning! Currently using Active Partition Recovery, but I fear since I compiled CM on that whole harddrive that most of the contents were probably overwritten. :crying:

drkow19 said:
Roger that. I will definitely try to do some build.prop tweaks, and then move on from there. Thanks again for the guide! Meanwhile I am emailing Ubuntu about their re-installer option to erase and reinstall Ubuntu, which wipes out all partitions, not just the current Ubuntu partition as I figured would happen. It wiped my main NTFS partition with all my stuff, without even a warning! Currently using Active Partition Recovery, but I fear since I compiled CM on that whole harddrive that most of the contents were probably overwritten. :crying:
Click to expand...
Click to collapse
Never heard of that happening before. Let me know what you find out.

Related

Create your Linux environment to build YOUR Android

Hello all,
if you are like me, you love to do things by yourself and see how it works. In this thread I'll show you how to create your Linux environment in order to create and compile your own roms - any version (1.5, 2.3, etc etc). I had soooooo many problems to make it work, so here is THE thread
BE CAREFUL : this thread is ONLY to set up the OS. The Android you will compile will not be compatible with your x10 as it needs to be "edited" for our phones. It basically shows you how to get ready
Note : parts 1 and 2 explain how to set up Ubuntu into a virtual machine in Virtualbox. If you don't virtualize Linux, if your Ubuntu is already installed, etc etc you can directly go to 3. It's just here to explain how to install Ubuntu.
This tutorial works of course for any "hard installation" of Ubuntu (I mean not in a Virtual machine) and in any virtualizing software (Virtualbox, VMWare, etc etc). I've dropped the Virtualbox tutorial because the software is free
1. Requirements
2. Set up Ubuntu 64 bit (Virtualbox)
3. Set up Android Source dependencies
4. Set up Android Source
5. Regular use
1. Requirements
A working computer, capable of virtualization (if you don't want to wipe your Windows or your MacOS X !) and with Internet connection
Few Gb on your hard drive (10Gb minimum ! Recomended : 15-30Gb)
As much RAM as possible (Minimum 1024Mb), and as powerful CPU as possible (Core2Solo, Core2Duo, ...)
A bit a time
2. Set up Ubuntu 64 bit
Download and install the latest Oracle VM Virtualbox for Windows
Download latest 64-bit Ubuntu Linux (as .iso package) - you can store the file wherever you want.
(Optional) Download the VirtualBox v4 extension, this will allow you to support improvements like USB2.0... Install : once VirtualBox will be installed, File>Preferences>Extensions>Add... If you get an error (Error 1), try to put the file in a "very simple" location (like C:\) and reinstall.
Once you've set up Virtualbox, run it. Click on "New", then follow the wizard.
Make sure you set the following :
Operating System : Linux
Version : Ubuntu (64 bit)
RAM : 512Mb (you can adjust more, but avoid use lower than 512Mb - I use 2Gb)
Create a new hard drive : set it variable size or fixed sized, but you'll need at last 15Gb to get all the files. To feel confortable, I use 30Gb (variable)
The computer is created, now run it. It will say there's no OS. Click on Devices > CD/DVD > More CD/DVD... Here is you virtual player. Click on Add, and select the Ubuntu .ISO file you downloaded. Then, choose it in the list, and click Choose. Now, you can restart the virtual machine by clicking Machine > Restart.
The computer should restart from the virtual CD, so install it to your virtual hard drive - regular install, same as if you were installing it on a physical HDD.
Once it's installed, do not forget to kick the .iso file from the virtual player for you not to start always on the CD
3. Set up Android Source dependencies
In Ubuntu, do right-click on the upper bar (where are Applications, Shortcuts...), and click Edit Menus. Then, go to System > Administration and tick Software Sources. We need to do this because Sun is highly restrictive on access to Java setup files...
Close that, then click on System > Administration > Software Sources.
Enable all sources, then on the second tab, tick the two Canonical sources (the most important ones, as these sources allow to install Java !)
Close the window and allow to refresh the sources (if you don't, next steps won't work).
Go and read the official Android Source page. That's what we're going to do.
Run a terminal, and copy/paste this : (this is a corrected setup, it should work like a charm -- please tell if it's not)
Code:
sudo apt-get install git-core gnupg flex bison gperf build-essential zip curl sun-java6-jdk zlib1g-dev gcc-multilib g++-multilib libc6-dev-i386 lib32ncurses5-dev ia32-libs x11proto-core-dev libx11-dev lib32readline5-dev lib32z-dev
After setup complete, make sure Java works, by typing
Code:
java
and
Code:
javac
This should return help on both commands. If one of these doesn't work (ie. "command not found"), your environment is not configured properly.
4. Set up Android Source
Create a dir called "bin" in your user dir.
Code:
cd ~
mkdir bin
echo $PATH
Then, type this :
Code:
curl http://android.git.kernel.org/repo >~/bin/repo
chmod a+x ~/bin/repo
Next step is to create a folder where we'll store Android sources we work on. You can place it and name it as you wish, let's call it "android" and place it on the user folder.
Code:
mkdir android
cd android
Then, run this command :
Code:
repo init -u git://android.git.kernel.org/platform/manifest.git
If it returns "command not found", restart Ubuntu !
Enter username and email, although I'm not sure it's useful for our use -custom roms-.
Now, let's get the files ! Type
Code:
repo sync
and wait... Wait... Wait... Lots of commands, of "Resolving deltas", "Receiving", etc etc. It can be very long (depends of your Internet speed), just wait...
Finally, let's register the public key and finalize setup process. Type
Code:
gpg --import
And the cursor will down a line and nothing will appear. Stuck ? Broken ? Woooops ? Not at all ! Program is waiting for you to type the key, which is sooooooo big. So, copy and paste all this :
Code:
-----BEGIN PGP PUBLIC KEY BLOCK-----
Version: GnuPG v1.4.2.2 (GNU/Linux)
mQGiBEnnWD4RBACt9/h4v9xnnGDou13y3dvOx6/t43LPPIxeJ8eX9WB+8LLuROSV
lFhpHawsVAcFlmi7f7jdSRF+OvtZL9ShPKdLfwBJMNkU66/TZmPewS4m782ndtw7
8tR1cXb197Ob8kOfQB3A9yk2XZ4ei4ZC3i6wVdqHLRxABdncwu5hOF9KXwCgkxMD
u4PVgChaAJzTYJ1EG+UYBIUEAJmfearb0qRAN7dEoff0FeXsEaUA6U90sEoVks0Z
wNj96SA8BL+a1OoEUUfpMhiHyLuQSftxisJxTh+2QclzDviDyaTrkANjdYY7p2cq
/HMdOY7LJlHaqtXmZxXjjtw5Uc2QG8UY8aziU3IE9nTjSwCXeJnuyvoizl9/I1S5
jU5SA/9WwIps4SC84ielIXiGWEqq6i6/sk4I9q1YemZF2XVVKnmI1F4iCMtNKsR4
MGSa1gA8s4iQbsKNWPgp7M3a51JCVCu6l/8zTpA+uUGapw4tWCp4o0dpIvDPBEa9
b/aF/ygcR8mh5hgUfpF9IpXdknOsbKCvM9lSSfRciETykZc4wrRCVGhlIEFuZHJv
aWQgT3BlbiBTb3VyY2UgUHJvamVjdCA8aW5pdGlhbC1jb250cmlidXRpb25AYW5k
cm9pZC5jb20+iGAEExECACAFAknnWD4CGwMGCwkIBwMCBBUCCAMEFgIDAQIeAQIX
gAAKCRDorT+BmrEOeNr+AJ42Xy6tEW7r3KzrJxnRX8mij9z8tgCdFfQYiHpYngkI
2t09Ed+9Bm4gmEO5Ag0ESedYRBAIAKVW1JcMBWvV/0Bo9WiByJ9WJ5swMN36/vAl
QN4mWRhfzDOk/Rosdb0csAO/l8Kz0gKQPOfObtyYjvI8JMC3rmi+LIvSUT9806Up
hisyEmmHv6U8gUb/xHLIanXGxwhYzjgeuAXVCsv+EvoPIHbY4L/KvP5x+oCJIDbk
C2b1TvVk9PryzmE4BPIQL/NtgR1oLWm/uWR9zRUFtBnE411aMAN3qnAHBBMZzKMX
LWBGWE0znfRrnczI5p49i2YZJAjyX1P2WzmScK49CV82dzLo71MnrF6fj+Udtb5+
OgTg7Cow+8PRaTkJEW5Y2JIZpnRUq0CYxAmHYX79EMKHDSThf/8AAwUIAJPWsB/M
pK+KMs/s3r6nJrnYLTfdZhtmQXimpoDMJg1zxmL8UfNUKiQZ6esoAWtDgpqt7Y7s
KZ8laHRARonte394hidZzM5nb6hQvpPjt2OlPRsyqVxw4c/KsjADtAuKW9/d8phb
N8bTyOJo856qg4oOEzKG9eeF7oaZTYBy33BTL0408sEBxiMior6b8LrZrAhkqDjA
vUXRwm/fFKgpsOysxC6xi553CxBUCH2omNV6Ka1LNMwzSp9ILz8jEGqmUtkBszwo
G1S8fXgE0Lq3cdDM/GJ4QXP/p6LiwNF99faDMTV3+2SAOGvytOX6KjKVzKOSsfJQ
hN0DlsIw8hqJc0WISQQYEQIACQUCSedYRAIbDAAKCRDorT+BmrEOeCUOAJ9qmR0l
EXzeoxcdoafxqf6gZlJZlACgkWF7wi2YLW3Oa+jv2QSTlrx4KLM=
=Wi5D
-----END PGP PUBLIC KEY BLOCK-----
Once pasted, hit CTRL+D, this will make the program to register the key, and will display the key has processed.
Everything is now done, you have all the sources and you are ready to create your own roms. You can edit files simply by double-click, or use any software you want.
If you want to compile, simply run a terminal, go to your folder (remember it is cd android (MS-DOS-like command), where android is the folder you defined above) then type
Code:
make
. After a long time (depends on how much RAM you assigned to the machine, 512Mbits is slow), you will generate IMG files.
5. Regular use
If you want to get the latest source files (ie you have 2.1 files and want 2.2.1 files), simply run a terminal, go to your working folder and type
Code:
repo sync
. This should do the trick (correct me if I'm wrong)
Compiling sources takes hours to process, and you may want to kill the compile or pause it. You can then abuse of these keyboard shortcuts (common to Ubuntu OS) :
Code:
CTRL+C
will kill the process. Use it carefully, as it instantly kills it with no prompt.
Code:
RIGHT CTRL+P
is a Virtualbox command. Il will pause the whole Ubuntu (and also your process), and makes the screen ugly/gray (it just stuck the screen on Virtualbox v4.x). This is helpful when you run a Virtual machine, as you can pause the OS and make your computer to sleep/hibernate (or save an image - do NOT turn off your computer, as it will turn off the Virtual machine also !). Out of sleep, you can type again RIGHT CTRL+P to make the process to continue.
** Please note it might be risky to flash your phone with the stock rom you compiled (I mean with no modification), as this is not intended to work on X10
** Please note this install is for AOSP and NOT for Android SDK (you can install it with ease).
What's the difference ?
Android Open Source Project (AOSP) allows you to get the source code of the Android Operating System, in order to improve/change it, and create your personalized Android operating system
Android SDK allow you only to create and edit apps for Android Operating System.
Please note that compiling takes hours to process ! (3 hours or more)
** For any question, deeper info : please FIRST read official documentation. Easy to use, you'll get all info ! **​
man...did you ever stop?!
THANKS FOR INFO. If you can explain how to make system images for our X10 then we can use the dual boot option to make gingerbread or froyo roms for dual boot using Zhidu chargemon file.
I am not clear on making and android system image for the x10. can we extract a system image from a running rom? that way I could make a system image of black freedom and we can all dualboot it instead of installing it.
rendeiro2005 said:
man...did you ever stop?!
Click to expand...
Click to collapse
Lol I can't stop
@SuperUserMovado : I'd love to know, unfortunately I am like you - I don't know how to do this. I'm gonna get several info there and there and try to do some stuff
Regarding Zd's Dual, please note it is not compatible with his xRecovery, which makes things a bit boring when you want to easily install a custom rom AND benefit of Dual Boot.
Dual boot by the way is an excellent idea, but it has limitations (of course), like no SD card mount and few other things because it run from SD card and not from NAND.
EDIT : here is a good start : http://source.android.com/porting/index.html
I have just started playing with this and have compiled one aosp rom from source. I think it can be extracted from a running rom but I'm not sure how yet. On the other hand it looks like the source is available on the se dev website. I'm having trouble downloading it... not sure yet if its on my end or theirs.
Here's the error if someone could help me out: (Ubuntu 64bit)
Archive: /tmp/X10_X10mini_X10_minipro_X8_2.0.A.0.504.tar.gz-4.zip
[/tmp/X10_X10mini_X10_minipro_X8_2.0.A.0.504.tar.gz-4.zip]
End-of-central-directory signature not found. Either this file is not
a zipfile, or it constitutes one disk of a multi-part archive. In the
latter case the central directory and zipfile comment will be found on
the last disk(s) of this archive.
zipinfo: cannot find zipfile directory in one of /tmp/X10_X10mini_X10_minipro_X8_2.0.A.0.504.tar.gz-4.zip or
/tmp/X10_X10mini_X10_minipro_X8_2.0.A.0.504.tar.gz-4.zip.zip, and cannot find /tmp/X10_X10mini_X10_minipro_X8_2.0.A.0.504.tar.gz-4.zip.ZIP, period.
Check this site out as well. The whole site is really helpful. I'm in the process of compiling a captivate rom with some slight changes and i hope it works.
Edit: Btw if you get the error repo not found, type this into the command line
code:
echo 'export PATH=$PATH:$HOME/bin' >> ~/.bashrc
then close the terminal, reopen another one and it should work
@superusermovado
I'm pretty sure you use unyaffs for the system.img and split_bootimg.ph for the boot.img.
That's how to decompile an update.zip.
From there you recompile as usual. I'm not going to post the instructions because they are all over the net.
Hint: Andy rubins tweet lol
gavriel18 said:
I have just started playing with this and have compiled one aosp rom from source. I think it can be extracted from a running rom but I'm not sure how yet. On the other hand it looks like the source is available on the se dev website. I'm having trouble downloading it... not sure yet if its on my end or theirs.
Here's the error if someone could help me out: (Ubuntu 64bit)
Archive: /tmp/X10_X10mini_X10_minipro_X8_2.0.A.0.504.tar.gz-4.zip
[/tmp/X10_X10mini_X10_minipro_X8_2.0.A.0.504.tar.gz-4.zip]
End-of-central-directory signature not found. Either this file is not
a zipfile, or it constitutes one disk of a multi-part archive. In the
latter case the central directory and zipfile comment will be found on
the last disk(s) of this archive.
zipinfo: cannot find zipfile directory in one of /tmp/X10_X10mini_X10_minipro_X8_2.0.A.0.504.tar.gz-4.zip or
/tmp/X10_X10mini_X10_minipro_X8_2.0.A.0.504.tar.gz-4.zip.zip, and cannot find /tmp/X10_X10mini_X10_minipro_X8_2.0.A.0.504.tar.gz-4.zip.ZIP, period.
Check this site out as well. The whole site is really helpful. I'm in the process of compiling a captivate rom with some slight changes and i hope it works.
Edit: Btw if you get the error repo not found, type this into the command line
code:
echo 'export PATH=$PATH:$HOME/bin' >> ~/.bashrc
then close the terminal, reopen another one and it should work
Click to expand...
Click to collapse
Thanks for info
About this package, what's the content ?? The easiest way is to download from XDA the generic global rom, it's the same -- with no bug
Perceval from Hyrule said:
Thanks for info
About this package, what's the content ?? The easiest way is to download from XDA the generic global rom, it's the same -- with no bug
Click to expand...
Click to collapse
Huh? The generic ROM is compiled. The one we are talking about here is source-code. I thought you should know since you started this topic on how to setup a build environment. Im not intirely sure what the download from from SE is but it looks like the source-code from all the changes and additions SE made to the bare system. So there's the kernel source and some other stuff that I don't know the purpose of.
Sent from my SNES using Mario Paint
LouNGeRR said:
Huh? The generic ROM is compiled. The one we are talking about here is source-code. I thought you should know since you started this topic on how to setup a build environment. Im not intirely sure what the download from from SE is but it looks like the source-code from all the changes and additions SE made to the bare system. So there's the kernel source and some other stuff that I don't know the purpose of.
Sent from my SNES using Mario Paint
Click to expand...
Click to collapse
A compiled rom is not a problem
I was asking what was the content within the rom, and as you said - i supposed too - it is the original + all SE garbage.
Very interesting to get some apps back on AOSP (some like the *Scape, i do like predictive input from SE, gains a lot of time)
To answer then, the SE kit should contain everything of what SE adds : RachaelUI, all their apps (the *Scape), modules (keyboard, apis...), etc etc and all files to link these components to the kernel. And make our phones as fast as a monster truck. Not as fast as AOSP (Formula 1 !!!!!)
Don't forget the most important part, the package contains the SE kernel.
Sent from my SNES using Mario Paint
After using, struggling more like with Ubuntu and VMware, the main issue being I couldn't figure out getting VMware tools running so copy and pasting was hit and miss, I tried the Cygwin method instead which works much better for me on Windows 7 Ultimate x64.
XperiaX10iUser said:
After using, struggling more like with Ubuntu and VMware, the main issue being I couldn't figure out getting VMware tools running so copy and pasting was hit and miss, I tried the Cygwin method instead which works much better for me on Windows 7 Ultimate x64.
Click to expand...
Click to collapse
VMWare is much more difficult to run than VirtualBox. But course you can try and compile Android from Windows
But I definitely can't tell you if the kitchen method will work for XPERIA.
Perceval from Hyrule said:
VMWare is much more difficult to run than VirtualBox. But course you can try and compile Android from Windows
Click to expand...
Click to collapse
I've put VB on too, but thought I'd try the Cygwin method, which as I've said works for me, and is better imo, at least for what I need.
Perceval from Hyrule said:
But I definitely can't tell you if the kitchen method will work for XPERIA.
Click to expand...
Click to collapse
I can, and it does.
XperiaX10iUser said:
I've put VB on too, but thought I'd try the Cygwin method, which as I've said works for me, and is better imo, at least for what I need.
I can, and it does.
Click to expand...
Click to collapse
Thanks for info then
Hey guys, did someone do the same install as me ? (Windows 7 x64 host // Ubuntu 10.10 x64 guest).
I've never been able to make USB to work, kinda weird... Because when you compile Android, you'd like to send it to your phone *warning !*
Perceval from Hyrule said:
Hey guys, did someone do the same install as me ? (Windows 7 x64 host // Ubuntu 10.10 x64 guest).
I've never been able to make USB to work, kinda weird... Because when you compile Android, you'd like to send it to your phone *warning !*
Click to expand...
Click to collapse
That's why I went the Cygwin route, much less hassle imo.
XperiaX10iUser said:
That's why I went the Cygwin route, much less hassle imo.
Click to expand...
Click to collapse
I would say it depends. Linux environment is much cooler to work with source files (no boring "NOOO Windows can't find how to open this weird non-Windows file. What to do ? 1.Delete 2.Crash Windows 3.Phone Ballmer to make a tender offer)
Is compiling long with Cyg ? From AOSP, it takes me up to 3 hours with my (well RAM-ed, well CPU-ed) Virtual Machine.

[GUIDE][CM10.1]The complete noobs guide to building CM10.1 in a virtual machine

So you want to build CyanogenMod and don't know where to start?​
I wanted to make a step-by-step guide for installing and configuring everything necessary for building CM9 in a virtual machine (VM) on a Windows machine. There's a scattered information in the forums on most of this, but I wanted to bring it together and share what worked best for me for any newbies who want to try to get their feet wet with AOSP development, or who would just like to be able to have their own up to date builds from source.
Huge thanks go out to dmeadows013 and antp121. It was their guides I started with when doing this myself, and without them, I don't think I would have even known where to begin. Their guides are at http://forum.xda-developers.com/showthread.php?t=1810297 and http://forum.xda-developers.com/showpost.php?p=31530111&postcount=12
This guide is designed to allow people with no Linux or development experience to get up and running as quickly as possible. Though no prior knowledge should be required, I highly recommend that you pay attention to what you are doing, and research or ask about anything you have questions about so that you'll understand the process. I've divided this into multiple parts to make it easier to do in stages.
What you need:
1) A Windows computer, preferably with a CPU that supports hardware virtualization. Most relatively modern processors do, so if you've bought your computer in the last 4 or 5 years, it's probably fine. Without this, you won't be able to run 64-bit or multiple processor VM's. Your Windows OS doesn't have to be 64-bit, your CPU just needs to support hardware virtualization. I won't say that this will not work on a 32-bit VM, but I've never tried it, so I can't support it if it doesn't. If you want to try, just replace all of the references to 64-bit in this guide with 32-bit.
2) Plenty of memory. I recommend at least 4GB on the host computer. You can make it work on less, but more is better.
3) At least 60GB of free hard drive space during the install, at least 50GB of which will be used permanently.
4) Plenty of time on your hands. You don't want to be rushed while you're doing this the first time.
Preliminaries:
1) Go to https://www.virtualbox.org/wiki/Downloads and download the latest version of VirtualBox for Windows hosts. The current version as of this writing is 4.2.
2) From the same website, download the latest version of the Virtual Box Extension Pack.
3) Go to http://www.ubuntu.com/download/desktop and download the 64-bit version of Ubuntu Desktop 12.04.1 LTS. This version will be supported for at least two years and will provide a stable OS base for at least that length of time.
Install and configure VirtualBox:
1) Run the VirtualBox installer executable you downloaded in the preliminaries section. Choose the default options at every prompt.
2) During the installation, the software will ask you for permission to install drivers. Choose install when it asks.
3) When the installation is complete, uncheck the box to start the application, then click Finish.
4) Run the VirtualBox Extension Pack installer that you downloaded in the preliminaries, and click Install and Agree.
5) From the VirtualBox Manager, click New
6) Name your machine whatever you wish (Android Build Box, for example), select Linux as the type, and Ubuntu (64-bit) as the version. Click Next
7) Give the machine as much memory as you can spare and click Next. I've found myself to need at least 1536MB (1.5GB) as a minimum to build with. More memory will result in a faster build time. If you intend to give the machine more than one processor, you need to give it more memory as well.
8) On the Hard drive prompt, click Create
9) Choose VDI and click Next
10) Choose Dynamically allocated and click Next
11) Give the drive at least 50GB of space and click Create. As always, more is better. 50GB will give you enough room to work on a single copy of CM9 with a little breathing room. You need more if you want to work on multiple copies.
12) Choose your VM and click Settings
13) Click the Advanced tab in General settings. Set Shared Clipboard to Bidirectional. This will allow you to copy and paste between the virtual machine and your Windows host.
14) If you wish to give your VM access to more than one processor, click on System, then choose the Processor tab. Select the number of processors you wish your VM to use.
15) Click OK. Your VM is now configured.
Install Ubuntu 12.04.1:
1) In the VirtualBox Manager, choose your VM and click Settings.
2) Click Storage.
3) Click Empty, underneath the IDE Controller entry.
4) On the far right, under Attributes, click the small CD icon and click "Choose a virtual CD/DVD disk file..."
5) Choose the file ubuntu-12.04.1-desktop-amd64.iso that you downloaded earlier
6) Click OK
7) Make sure your VM is selected, and click Start.
8) As it boots, confirm the messages that appear, click "Do not show this message again" if desired.
9) After a few minutes, the VM will boot to a selection screen. Choose Install Ubuntu.
10) Click Download updates while installing and Install this third party software. Click Continue.
11) Leave Erase disk and install Ubuntu checked, then click Continue. This will only erase the virtual drive.
12) Click Install Now.
13) Choose your time zone and click Continue.
14) Choose your keyboard layout and click Continue.
15) Set up your username, password, and a machine name. REMEMBER THIS PASSWORD. You will need it, even if you enable Log in automatically. Click Continue.
16) Now sit back and relax. The installation will take a while.
17) When installation is complete, click Restart Now
18) When prompted, press Enter
19) The VM will reboot into your new Ubuntu installation.
A note about your new VM installation of Ubuntu: This is just like any other computer and should be treated as such. It needs to be properly shut down to prevent disk corruption. To shut down the system, click the gear icon in the upper right and choose Shut down. You should also keep the system properly updated, because when it is running, it is just as accessible to the Internet as any other computer on your network, so keep the security updates installed as you are notified.
Update Ubuntu 12.04.1 and install Guest Additions:
1) Log into your system with the user you created during installation. Ignore any warnings you may get about new drivers being available. We will take care of that in a bit.
2) Click the top icon of the sidebar (Dash Home), type update, and click Update Manager.
3) Click Install Updates
4) When prompted, enter your user password.
5) When updating is complete, click Restart Now
6) After restart, log back in.
7) In the VM Window menu, click Devices, then click Install Guest Additions...
8) Click Run and enter your password when prompted.
9) After process completes, reboot by clicking the gear in the upper right corner, clicking Shut Down, and clicking Restart.
Configure your build environment
1) Log into your Ubutntu system, open Firefox from the sidebar and go to http://www.oracle.com/technetwork/java/javase/downloads/jdk6u35-downloads-1836443.html
2) Click agree and download jdk-6u35-linux-x64.bin
3) Click on Dash Home, type terminal, and open the Terminal app.
4) Right click on Terminal in the sidebar and select Lock to Launcher.
5) Retrieve the build tools:
Code:
sudo apt-get install git-core 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 openjdk-6-jdk tofrodos python-markdown libxml2-utils xsltproc zlib1g-dev:i386 schedtool gcc-multilib g++-multilib pngcrush g++ gcc dpkg-dev
6) Unpack Java by typing the following commands in terminal:
Code:
chmod a+x ~/Downloads/jdk-6u35-linux-x64.bin
sudo mv ~/Downloads/jdk-6u35-linux-x64.bin /usr/lib
cd /usr/lib
sudo ./jdk-6u35-linux-x64.bin
7) Install Java by executing the following commands:
Code:
sudo mv jdk1.6.0_35/ jvm/
sudo rm jdk-6u35-linux-x64.bin
sudo update-alternatives --install /usr/bin/java java /usr/lib/jvm/jdk1.6.0_35/jre/bin/java 1
sudo update-alternatives --install /usr/bin/javac javac /usr/lib/jvm/jdk1.6.0_35/bin/javac 1
sudo update-alternatives --install /usr/bin/jar jar /usr/lib/jvm/jdk1.6.0_35/bin/jar 1
sudo update-alternatives --install /usr/bin/javadoc javadoc /usr/lib/jvm/jdk1.6.0_35/bin/javadoc 1
8) Make Java 1.6 the default by typing the following commands individually, and selecing the jdk1.6.0_35 line in each (typically number 2):
Code:
sudo update-alternatives --config java
sudo update-alternatives --config javac
sudo update-alternatives --config jar
sudo update-alternatives --config javadoc
Create the build directories and retrieve the code:
1) Log into your Ubuntu system and open a terminal window
2) Create your build directories:
Code:
mkdir ~/android ~/android/bin ~/android/cm-10.1
3) Open your profile config:
Code:
gedit ~/.bashrc
4) Insert the following into the end of your profile:
Code:
ANDROID_JAVA_HOME=/usr/lib/jvm/jdk1.6.0_35
export ANDROID_JAVA_HOME
PATH=~/android/bin:$PATH
export PATH
5) To reload your profile, exit your terminal window and open a new one.
6) Download the repo binary:
Code:
curl https://dl-ssl.google.com/dl/googlesource/git-repo/repo > ~/android/bin/repo
chmod a+x ~/android/bin/repo
7) Initialize and sync the repo (download the code). This will typically take a couple of hours the first time you run it:
Code:
cd ~/android/cm-10.1
repo init -u git://github.com/Chad0989/android.git -b cm-10.1
repo sync
8) Retrieve the prebuilts:
Code:
./vendor/cm/get-prebuilts
Build CM10.1
1) Now, all that's left is to build. If you want to get the latest code, run another repo sync (included here). It only retreives changes, so it should only take a few minutes from now on. Ignore warnings and let it build. As long as it doesn't crash, you're fine. It can take anywhere from an hour to half a day, depending on the resources you gave the VM:
Code:
cd ~/android/cm-10.1
repo sync
. build/envsetup.sh
make clobber
brunch vigor
2) Go get your freshly baked CM10.1 from ~/android/cm-10.1/out/target/product/vigor.
I hope this is useful for someone. This guide is the result of several days of learning on my part, and several hours of writing. If there is anything that doesn't work, let me know. I will probably be cleaning it up a bit in the near future, and I may add an FAQ and/or glossary if it appears that one is needed. I'll also attempt to keep it updated with the newest versions of the tools. Thanks for reading, and have fun building.
Special thanks to:
dmeadows013 and antp121 - For providing the guides that got me started. I couldn't have done any of this without you.
chad0989 - For AOSP on the Rezound.
IAmTheOneTheyCallNeo - For answering my stupid questions and inspiring me to get more involved
Snuzzo - For answering more stupid questions and giving more inspiration
synisterwolf - For being generally awesome and putting up with me in chat
puhleez - Who's environment issues inspired me to make this guide​
Alternate instructions for setting up Debian:
After some discussions in the thread, I decided to switch to Debian for my build environment, because I hate Unity, and I've always liked Debian better anyway for a work system. I still recommend Ubuntu for most people, as it is the most noob friendly Linux build out there. If you're going to use Debian, or most of the other builds, you need a better understanding of the security model and an expectation that it's going to take a little more front end setup (that isn't covered here). However, if you want to use Debian, the instructions to configure the build environment are mostly the same. The only difference is the retrieval of the build tools. Debian names their 32-bit packages differently, so it changes to this:
Code:
sudo apt-get install git-core gnupg flex bison gperf build-essential zip curl libc6-dev lib32ncurses5-dev x11proto-core-dev lib32libreadline6-dev libgl1-mesa-dev g++-multilib mingw32 openjdk-6-jdk tofrodos python-markdown libxml2-utils xsltproc lib32z1-dev schedtool gcc-multilib g++-multilib pngcrush
Alternate instructions for building PAC-man:
The guide will be the same until the point where you initialize the repo (Create the build directories and retrieve the code, step 7). Instead of those steps, do the following:
Code:
mkdir ~/android/pac
cd ~/android/pac
repo init -u git://github.com/PAC-man/android.git -b cm-10.1
repo sync
There is no need to retrieve the prebuilts or set up the environment for PAC. The build script will do everything. To build, just do this:
Code:
cd ~/android/pac
repo sync
make clobber
./build-pac.sh vigor
Since this is a multi-device repo, the initial build will take a little longer, because the script will retrieve the missing pieces for vigor, and replace some things that are little different for us than the standard, but the build itself should be around the same time as a stock CM10.1 build.
This is pretty sweet. Thanks for this. When im bored at work next week I def give this a go.
Ive been wanting to try this but I don't think my little dual core laptop is up to it lol. Thanks for the write up
Sent from my ADR6425LVW using Tapatalk 2
Thank you. Now I can refer people to this page. I have never done it in a virtual box.
This is awesome Shrike. It will help encourage people to get into building roms that wouldn't have otherwise run across it. Things like this help to continue the android hobby and lifestyle that so many of us enjoy.
If anyone here is interested in setting up a VPS on our server so they can build roms on a virtual build box even if they don't have a powerful computer, just let me know.
Thank you so much. Too many people bothering me on gtalk about this.
This is an awesome guide. Definitely need start getting invovled with developing for Android. It would be cool we could get a guide on how to do this with the linaro tool chain also.
Great work and thanks for contributing
awesome going to read this later. thanks for the guide.
Wow man. I can' t thank you enough for spending the time to put this together. I struggled with getting it to work and after many attempts just gave up. I'll definitely be trying again, maybe this afternoon.
Thanks again!!
Thank you for this. I am working through the procedure now. Other than the location of the jvm in the initial install everything is looking good (details will follow when I confirm it wasn't an ID10T error on my part).
---------- Post added at 04:16 PM ---------- Previous post was at 04:11 PM ----------
merashallan said:
Thank you for this. I am working through the procedure now. Other than the location of the jvm in the initial install everything is looking good (details will follow when I confirm it wasn't an ID10T error on my part).
Click to expand...
Click to collapse
I figured out the problem. If you install the Oracle java before you install all the additional packages there will not be a directory named /usr/lib/jvm as the openjdk has not yet been installed. This also means you have to repeat step 7 after step 8 since there are no alternatives to Oracle java before step 7.
I think if you perform step 8 before step 5 the procedure will work.
Anyways it's looking like a good guide so far as it's saving me lots of time figuring out what I need.
doing my repo sync right meow.
merashallan said:
Thank you for this. I am working through the procedure now. Other than the location of the jvm in the initial install everything is looking good (details will follow when I confirm it wasn't an ID10T error on my part).
---------- Post added at 04:16 PM ---------- Previous post was at 04:11 PM ----------
I figured out the problem. If you install the Oracle java before you install all the additional packages there will not be a directory named /usr/lib/jvm as the openjdk has not yet been installed. This also means you have to repeat step 7 after step 8 since there are no alternatives to Oracle java before step 7.
I think if you perform step 8 before step 5 the procedure will work.
Anyways it's looking like a good guide so far as it's saving me lots of time figuring out what I need.
Click to expand...
Click to collapse
Thanks for the feedback. I've incorporated it in the the document.
This is awesome. I've always wondered how to go about compiling and such, but didn't want to bug any of the developers. This is definitely a start into developing! Thank you
Deleted
When you repo sync, where is the data supposed to go? in the root of HOME or in ANDROID/CM9? Mine went into the root of HOME.
h4ckers said:
When you repo sync, where is the data supposed to go? in the root of HOME or in ANDROID/CM9? Mine went into the root of HOME.
Click to expand...
Click to collapse
It should go to ~/android/cm9. There was a typo in step 7 of the build directory setup. Sorry about that. Fixed now.
nice job man
shrike1978 said:
It should go to ~/android/cm9. There was a typo in step 7 of the build directory setup. Sorry about that. Fixed now.
Click to expand...
Click to collapse
I noticed that. I copied everything to where it needs to go. Did this command again to make sure I had all the changes:
Code:
cd ~/android/cm9
repo sync
Still went to the root of HOME. Strange. After building a test, I will see what else I can do to fix my issue. Thanks for the guide and by chance do you know where to pull AOKP and MIUI? I saw Dmeadows' git but didn't know what to pull.
h4ckers said:
I noticed that. I copied everything to where it needs to go. Did this command again to make sure I had all the changes:
Code:
cd ~/android/cm9
repo sync
Still went to the root of HOME. Strange. After building a test, I will see what else I can do to fix my issue. Thanks for the guide and by chance do you know where to pull AOKP and MIUI? I saw Dmeadows' git but didn't know what to pull.
Click to expand...
Click to collapse
I haven't tried to build either yet, so I haven't the foggiest where to start. TBH, I'm not a particularly big fan of either, so I've never really looked into it. However, the build environment should be sane to build them if you can figure out where to get them and what code you need to merge.

[GUIDE] How To Compile TWRP Recovery for QVGA And Other Unsupported Devices.

How To Compile TWRP Recovery For QVGA And Other Unsupported Devices​
Guys a humble request don't spam this thread. If you face any error reply to this thread or PM me i will help and after you build it please don't post your bugs here this thread is only for compiling and not for resolving bugs in your build. I can only help with the errors you face during compilation because i faced a lot .
I thank XDA members cybojenix, kD as i got an idea of how to make guides from them
I would also thank Dees_troy for the sources.
I have worked hard in creating this guide so when you release your build please give proper credits .
Click to expand...
Click to collapse
Minimum Requirements:-
1. RAM:- 4GB
2. HDD Space:- More than 18GB required for CM7 source code (I am going to use CM7 for this guide as CM9 is not yet supported for many devices).
3. Processor:- Equal to Core 2 Duo or Anything above it.
4. Internet Speed:- Minimum of 2 Mbps as we will be downloading files of large size.
5. Patience:- A lots of it needed to get success
Click to expand...
Click to collapse
Ok Lets Start With Step 1:- Setting Up Your Computer For Development.
Getting Linux​
Please note your PC/Laptop must satisfy the minimum requirements to continue. If it doesn't contact any person who is developing for your device to develop this.
Click to expand...
Click to collapse
For compiling you need Linux the most common and free Linux available for development is Ubuntu. Go ahead choose your version and download it.
If you wish to use Ubuntu 10.04 64-Bit for Development use this link
http://releases.ubuntu.com/lucid/ubuntu-10.04.4-desktop-amd64.iso
Click to expand...
Click to collapse
If you wish to use Ubuntu 10.10 64-Bit for Development use this link
http://releases.ubuntu.com/maverick/ubuntu-10.10-desktop-amd64.iso
Click to expand...
Click to collapse
If you wish to use Ubuntu 11.04 64-Bit for Development use this link
http://releases.ubuntu.com/natty/ubuntu-11.04-desktop-amd64.iso
Click to expand...
Click to collapse
If you wish to use Ubuntu 11.10 64-Bit for Development use this link
http://releases.ubuntu.com/oneiric/ubuntu-11.10-desktop-amd64.iso
Click to expand...
Click to collapse
If you wish to use Ubuntu 12.04 64-Bit for Development use this link
http://releases.ubuntu.com/precise/ubuntu-12.04-desktop-amd64.iso
Click to expand...
Click to collapse
After downloading install it in a Virtual Machine or dual boot it alongside another OS you are using now. If you are using a Virtual Machine make sure you allocate more than 50GB of HDD space.
So far so good now that you have Linux installed :victory: you can proceed to the next step of setting up which is followed in the second post.
Setting Up Your Laptop/PC For Development.​
Note:- You may be asked for a password when using sudo command.
Click to expand...
Click to collapse
Installing Python-2.7.5:-
First and foremost is installing Python. For those who are wondering what Python is well here is the answer Python is a language like C,C++,Java which primarily centers around Linux.
1. Open Terminal by hitting Ctrl+Alt+T.
2. Type or copy paste these codes into terminal (I prefer typing though )
Code:
sudo apt-get install build-essential gcc
cd Downloads
wget http://www.python.org/ftp/python/2.7.5/Python-2.7.5.tgz
tar -xvzf Python-2.7.5.tgz
cd Python-2.7.5
./configure --prefix=/usr/local/python2.7
make
sudo make install
sudo ln -s /usr/local/python2.7/bin/python /usr/bin/python2.7
3. Python is now installed to make sure type this code in terminal
Code:
python
and it should produce an output like this
Code:
Python 2.7.2+ (default, Jul 20 2012, 22:15:08)
[GCC 4.6.1] on linux2
Type "help", "copyright", "credits" or " lincense" for more information.
>>>
4. If it shows something like that you are good to go.
5. Press Ctrl+D, close the terminal and proceed to install Java 6 JDK.
Installing Java 6 JDK:-
I have to thank cybojenix and kD for this part as it is theirs and i didn't write this part .
Click to expand...
Click to collapse
If you are using Ubuntu 12.04 follow these commands others skip this set of commands.
1. Download Java 6 JDK from here.
2. After Downloading copy that to the Downloads folder.
3. Open Terminal.
4. Type these commands one by one in the terminal
Code:
cd Downloads
chmod +x jdk-6u34-linux-x64.bin
sudo ./jdk-6u34-linux-x64.bin
sudo mv jdk1.6.0_34 /usr/lib/jvm/
sudo update-alternatives --install /usr/bin/java java /usr/lib/jvm/jdk1.6.0_34/bin/java 1
sudo update-alternatives --install /usr/bin/javac javac /usr/lib/jvm/jdk1.6.0_34/bin/javac 1
sudo update-alternatives --install /usr/bin/javaws javaws /usr/lib/jvm/jdk1.6.0_34/bin/javaws 1
sudo update-alternatives --config java
sudo update-alternatives --config javac
sudo update-alternatives --config javaws
If you are not using Ubuntu 12.04 follow these commands:-
1. Open terminal
2. Type these commands one by one in the Terminal.
Code:
sudo add-apt-repository ppa:ferramroberto/java
sudo apt-get update
sudo apt-get install sun-java6-jre sun-java6-bin sun-java6-jdk
If you had done those steps correctly then you must now have Java installed.
To check and make sure it is installed type this command in terminal.
Code:
java -version
and the output should be
Code:
java version "1.6.0_34"
Java(TM) SE Runtime Environment (build 1.6.0_34-b04)
Java HotSpot(TM) 64-Bit Server VM (build 20.9-b04, mixed mode)
If the output was some thing similar you are now ready to install GNU Make.
Close the Terminal and proceed.
Installing GNU Make 3.81
Note:- Any other version of make either lower or higher won't work for compiling TWRP.
Click to expand...
Click to collapse
1. Open Terminal
2. Type these codes in terminal.
Code:
wget -o make.tar.gz http://ftp.gnu.org/gnu/make/make-3.81.tar.gz
tar -xvzf make-3.81.tar.gz
cd make-3.81
./configure
sudo make install
3. That's it now you got make installed.
To check and make sure that Make is installed type this command in Terminal.
Code:
make -v
and it shoud give the output
Code:
GNU Make 3.81
Copyright (C) 2006 Free Software Foundation, Inc.
This is free software; see the source for copying conditions.
There is NO warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
This Program built for x86_64-unknown-linux-gnu
If it was something smiliar to that you can close the terminal and proceed to the next step.
Ok now we got the big guns rolling it's now time for small guns without whom we can't compile yes I mean't the dependencies.
Open Terminal and apply these commands:-
Code:
sudo apt-get install git-core gnupg flex bison gperf build-essential zip curl zlib1g-dev libc6-dev lib32ncurses5-dev ia32-libs x11proto-core-dev libx11-dev lib32readline5-dev lib32z-dev libgl1-mesa-dev g++-multilib mingw32 tofrodos python-markdown libxml2-utils xsltproc gedit git schedtool
export USE_CCACHE=1
If you are using Ubuntu 10.10 apply this:-
Code:
sudo ln -s /usr/lib32/mesa/libGL.so.1 /usr/lib32/mesa/libGL.so
If you are using Ubuntu 11.04 apply this:-
Code:
sudo ln -s /usr/lib32/mesa/libGL.so.1 /usr/lib32/mesa/libGL.so
sudo apt-get install libx11-dev:i386
If you are using Ubuntu 12.04 apply this:-
Code:
sudo ln -s /usr/lib32/mesa/libGL.so.1 /usr/lib32/mesa/libGL.so
sudo apt-get install libx11-dev:i386
sudo apt-get install libncurses5-dev:i386 libx11-dev:i386 libreadline6-dev:i386 libgl1-mesa-glx:i386 zlib1g-dev:i386
sudo ln -s /usr/lib/i386-linux-gnu/mesa/libGL.so.1 /usr/lib/i386-linux-gnu/libGL.so
Good now you will have dependencies installed.
It is now time for SDK and ADB which will be continued in the next post.
Installing SDK and ABD​
Installing SDK:-
1. Download Android SDK from here.
2. Extract it to your home folder.
3. Rename the folder to sdk.
4. Open the Terminal and type these commands
Code:
cd sdk/tools
./android sdk
5. A window should popup and there will will be a list of Packages.
6. Install Android SDK Tools and Android SDK Platform-Tools.
Checking ADB:-
Since you installed Android SDK Tools and Android SDK Platform-Tools ADB must now be checked and configured.
1. Enable USB Debugging in your device and connect your phone to computer.
2. Now execute these commands in Terminal
Code:
cd sdk/platform-tools
./adb devices
It should give the output as
Code:
List of devices attached 0123456789ABCDEF device-name (Note the number-letter combination may vary)
If it does give like that skip Adding Permissions.
Or if it gives the output as
Code:
List of devices attached ????????????????? no permissions
Don't worry we have add permission to your device that's it.
Adding Permissions:-
1. Open Terminal
2. Execute this command.
Code:
sudo gedit /etc/udev/rules.d/51-android.rules
3. It should open text editor
4. Paste this line
Code:
SUBSYSTEM=="usb", ATTR{idVendor}=="xxxx", MODE="0666"
5. Replace Vendor ID with your Vendor id given in the list.
For e.g if your vendor is Acer you will replace "xxxx" with "0502"
Here is a list of Vendor ID's
Code:
Acer - 0502
ASUS - 0b05
Dell - 413c
Foxconn - 0489
Fujitsu - 04c5
Fujitsu Toshiba - 04c5
Garmin-Asus - 091e
Google - 18d1
Hisense - 109b
HTC - 0bb4
Huawei - 12d1
K-Touch - 24e3
KT Tech - 2116
Kyocera - 0482
Lenovo -17ef
LG - 1004
Motorola - 22b8
MTK - 0e8d
NEC - 0409
Nook - 2080
Nvidia - 0955
OTGV - 2257
Pantech - 10a9
Pegatron - 1d4d
Philips - 0471
PMC-Sierra - 04da
Qualcomm - 05c6
SK Telesys - 1f53
Samsung - 04e8
Sharp - 04dd
Sony - 054c
Sony Ericsson - 0fce
Teleepoch - 2340
Toshiba - 0930
ZTE - 19d2
6. Save and close the editor.
7. Execute this command in Terminal.
Code:
sudo gedit /etc/udev/rules.d/99-android.rules
8. Again paste this line
Code:
SUBSYSTEM=="usb", ATTR{idVendor}=="xxxx", MODE="0666"
Replace "xxxx" with Vendor ID.
9. Save it and close the file.
10. Execute these commands one by one in the Terminal
Code:
sudo chmod a+r /etc/udev/rules.d/99-android.rules
sudo chmod a+r /etc/udev/rules.d/51-android.rules
Now RESTART your Ubuntu and type these codes in the Terminal.
Code:
cd sdk
./adb devices
You must not get the output with ???????????????? no permission still if you get it please reply below I will help.
Now we need to edit .bashrc so that we can access adb from anywhere
Execute these codes in the Terminal.
Code:
cd
sudo gedit .bashrc
It should open text editor copy paste this line at the end.
Code:
export PATH=${PATH}:~/sdk/tools
export PATH=${PATH}:~/sdk/platform-tools
Save it and close it.
Now in terminal type adb devices it should give output List of devices attached.
That's it you got Ubuntu, Python, Java 6 JDK, GNU Make-3.81, SDK and ADB ready.
Now you are ready to start development go on to the next step to download source code.
Intializing Repo And Download Source Code
Step 2:- Initializing Repository And Downloading Source Code​
Initializing Repository​
First step is to download the Repo which is essential to download the source code.
1. Open Terminal
2. Execute these commands one by one in Terminal
Code:
mkdir ~/bin
PATH=~/bin:$PATH
sudo apt-get install curl
curl https://dl-ssl.google.com/dl/googlesource/git-repo/repo > ~/bin/repo
chmod a+x ~/bin/repo
Downloading Source Code​
After you have initialized the repo you are set to download the source code.
1. Open Terminal
2. Execute these commands one by one in Terminal
Code:
mkdir source
cd source
repo init -u git://github.com/Cyanogenmod/android.git -b gingerbread
sudo sysctl -w net.ipv4.tcp_window_scaling=0
repo sync -jx (Replace x with a number this number corresponds to number simultaneous download you want for e.g if you give 5 it will download 5 files at once so go on increase to whatever you like but be reasonable :D)
The Source Code is around 15GB - 17GB so have patience and more importantly HDD space.
Click to expand...
Click to collapse
.
The download will take hours if you are on slow connection like it will be a 2 days is 512kbps connection so if you are planning to develop please have a good internet connection with a reasonable fast speed. Every developer recommends more than 1Mbps and sometimes 4Mbps.
After downloading is finished go to source folder you must have many folders inside them. Also make a backup of the source folder just in case as we will modifying it so if something goes wrong you don't have to re-download it all again.
Go to the next step to start the actual development.
Modding Files And Stuff
Step 3:- Modding Files And Folders To Make Your Device Supportable.​
First up is to compile a build of ClockworkMod.
Building ClockworkMod:-
1. Open Terminal
2. Type these commands one by one in Terminal
Code:
. build/envsetup.sh
lunch (it should show you list of devices select your device with their serial number select your device by typing the serial number)
make clean
make -j4 recoveryimage
If you didn't receive an error you are ready to compile TWRP for your device.
If you do receive and error reply to the post I will help you.
Modifying Files And Folder:-
The original Dees_Troy's build folder isn't gonna work as your device resolution doesn't support it. So I have patched the build folder with some extra libs added to prelink map and patched recovery folder with gui changes for smooth compilation.
If you have experience with using git you can clone the repo or you can download it directly from github.
Click to expand...
Click to collapse
If you are going to clone execute these commands in terminal. (Thanks to cybojenix for this so that there will no manual copying).
Code:
cd source
rm -rf build/
rm -rf bootable/recovery/
git clone git://github.com/chainhacker/TWRP_Build -b 2.3 build
git clone git://github.com/chainhacker/TWRP_Recovery -b 2.3 bootable/recovery
If you are going to download directly use the following link make sure you are downloading 2.3 branch and extract it.
Here is the link for the patched build folder------>TWRP_Build
Here is the link for the patched recovery folder------>TWRP_Recovery
After you have done downloading from the above two files.
Replace the contents of source/build folder with the patched one.
Similarly replace the contents of source/bootable/recovery folder with the patched one.
I have 240x320 resolution already in the patched ones but if your device is not 240x320 and also not supported by TWRP download a theme made by other members which has your device's resolution or create a theme. I didn't create the theme though I resized the images and made changes in ui.xml. If you are interested in theming follow the official TWRP theming guide in their website.
If you did find a theme or created it rename the theme folder to your device resolution folder for e.g. If your device resolution is 320x240 you would rename the folder as 320x240.
Copy the theme folder into source/bootable/recovery/gui/devices.
That's it finished the basic requirements next up is configuring BoardConfig.mk.
Editing BoardConfig.mk:-
1. Navigate to source/device/your_vendor/your_device.
your_vendor:- Vendor of your device e.g for me it is lge.
your_device:- Your device name.
Click to expand...
Click to collapse
2. Find BoardConfig.mk and open it in a text editor.
3. Come to the last and add these line
Code:
#twrp
DEVICE_RESOLUTION:= [I]your_device_resolution[/I] (e.g If your resolution is 240x320 type it)
RECOVERY_GRAPHICS_USE_LINELENGTH := true
2. Save it and close it.
Yay you have finished everything only thing left out is compiling which is carried out in the next post.
Psssst.......
After you have compiled your first successful build here are few other things that you could add to BoardConfig.mk
Note:- You can add this after finishing first successful build of recovery till then avoid these.
Click to expand...
Click to collapse
Code:
RECOVERY_SDCARD_ON_DATA := true -- this enables proper handling of /data/media on devices that have this folder for storage (most Honeycomb and devices that originally shipped with ICS like Galaxy Nexus)
BOARD_HAS_NO_REAL_SDCARD := true -- disables things like sdcard partitioning
TW_INCLUDE_DUMLOCK := true -- includes HTC Dumlock for devices that need it
TARGET_RECOVERY_GUI := true -- uses gui format instead of ui.xml
TARGET_RECOVERY_PIXEL_FORMAT := "RGB_565" -- to change the colour
TARGET_USE_CUSTOM_LUN_FILE_PATH :=/sys/devices/platform/usb_mass_storage/lun0/file
TW_CUSTOM_POWER_BUTTON := 107 -- to get a power button on the home screen of recovery
TW_EXTERNAL_STORAGE_PATH := "/sdcard" -- default external storage path
TW_EXTERNAL_STORAGE_MOUNT_POINT := "sdcard" -- default external mount point
TW_FLASH_FROM_STORAGE := true -- enables you to flash zips form the sdcard (You don't neeed o add this it is activated by default)
TW_HAS_DOWNLOAD_MODE := false -- to enable download or more precisely enabling usb mass storage
TW_HAS_NO_RECOVERY_PARTITION := true -- do this only if you device has no partion to recovery
TW_INCLUDE_CRYPTO := false
TW_INCLUDE_JB_CRYPTO := false
TW_NEVER_UNMOUNT_SYSTEM := true -- always keeps the system mounted
TW_NO_BATT_PERCENT := false -- shows battery percentage
TW_NO_REBOOT_BOOTLOADER := true --- disables rebooting into bootloader
TW_NO_USB_STORAGE := false -- disabled usb storage
TW_SDEXT_NO_EXT4 := false
Compiling Recovery
Step 4:- Compiling Recovery​
Finally you have come to the final part of the guide which is compiling recovery.
1. Open Terminal.
2. Execute these commands in Terminal
Code:
. build/envsetup.sh
lunch (Again select your device)
make -j4 recoveryimage
.
That's it when it is finished grab recovery.img from:
out/target/product/your_product_name/recovery.img
Flash it in your device test it fix the bugs and release it.
Wait if you don't want flash and just see how it looks so that you can flash another recovery if it is not working do these
I am not resposible if your device gets bricked in fastboot mode but mostly it won't happen though
Click to expand...
Click to collapse
1. Copy the recovery.img to sdk/platform-tools
2. Boot your device into fastboot mode.
3. Open Terminal
4. Execute these commands one by one in Terminal
Code:
fastboot devices (wait for your device to show up int terminal)
fastboot boot recovery.img
You can test out all the features except flash zip, backup and restore.
Victory :victory: you have successfully compiled TWRP recovery for your device go ahead have fun and enjoy.
If you really like my work express your gratitude by pressing the Thanks button. See you soon in another thread :victory: :laugh: :fingers-crossed:
Click to expand...
Click to collapse
Reserved
reserved just in case :fingers-crossed:
Contributions
You can Contribute to this guide by suggesting improvements and stuff are welcome PM about the contribution and i will add by giving credits to the person contributed
Does it make any difference if I want to compile it for an ARMV6 device?
Gesendet von meinem Skate mit Tapatalk 4 Beta
Joe4899 said:
Does it make any difference if I want to compile it for an ARMV6 device?
Gesendet von meinem Skate mit Tapatalk 4 Beta
Click to expand...
Click to collapse
Nope it won't make any difference it is just the same even if your device is ARMv6 or ARMv7. Make sure your device is supported by CM
Chain Hacker said:
Nope it won't make any difference it is just the same even if your device is ARMv6 or ARMv7. Make sure your device is supported by CM
Click to expand...
Click to collapse
i'm wondering if it will work for Tegra's device
666satyr666 said:
i'm wondering if it will work for Tegra's device
Click to expand...
Click to collapse
Yes it will work go ahead give it a shot :good:
So that's me again :laugh: Wanted to compile TWRP 2.6.0.0 for cm10.1 so I have set up everything so far but get an error when I try to compile
build/core/base_rules.mk:130: *** external/fuse/lib: MODULE.TARGET.STATIC_LIBRARIES.libfuse already defined by bootable/recovery/fuse.
Click to expand...
Click to collapse
Seems to be really stupid, so far I understand is the libfuse defined twice in recovery and base_rules.mk so think (thought ) it's an easy part - just to remove this libfuse from one of them... But I can't find something with "libfuse", "static libraries" or anything like that in base_rules.mk
Joe4899 said:
So that's me again :laugh: Wanted to compile TWRP 2.6.0.0 for cm10.1 so I have set up everything so far but get an error when I try to compile
Seems to be really stupid, so far I understand is the libfuse defined twice in recovery and base_rules.mk so think (thought ) it's an easy part - just to remove this libfuse from one of them... But I can't find something with "libfuse", "static libraries" or anything like that in base_rules.mk
Click to expand...
Click to collapse
I have never tried compiling 2.6.0.0 because Dees_Troy is evaluating my theme for my device such that it gets official support so if you are ready to use CM7 and TWRP 2.3.3.0 you can follow my guide and i can help you with the errors but any other version please ask Dees_Troy for the solution.
How I compile twrp if my phone is not officially/unofficially supported?is it possible?
Sended from my ascend g330 using tapatalk 4 [VIP]
andrea210701 said:
How I compile twrp if my phone is not officially/unofficially supported?is it possible?
Sended from my ascend g330 using tapatalk 4 [VIP]
Click to expand...
Click to collapse
It is possible after successful build with no bugs you can contact Dees_Troy for evaluation and get official support.
Sent from my LG-P350 using Tapatalk 2
Error detected
Hi, Chain Hacker.
Does it matter how to write address after "git://"?
I mean this:
Code:
[B]repo init -u git://github.com/Cyanogenmod/android.git -b gingerbread[/B]
Should it be like this:
Code:
[B]repo init -u git://github.com/Cyanogen[COLOR="Red"]M[/COLOR]od/android.git -b gingerbread[/B]
By the way, it's a very good manual for those who are just starting to understand how to compile
maximik1980 said:
Hi, Chain Hacker.
Does it matter how to write address after "git://"?
I mean this:
Code:
[B]repo init -u git://github.com/Cyanogenmod/android.git -b gingerbread[/B]
Should it be like this:
Code:
[B]repo init -u git://github.com/Cyanogen[COLOR="Red"]M[/COLOR]od/android.git -b gingerbread[/B]
By the way, it's a very good manual for those who are just starting to understand how to compile
Click to expand...
Click to collapse
No i doesnt matter at all the only thing that is case sensitive are the words after cyanogenmod as they must be written as it is so it is your wish whether you are gonna write Cyanogenmod or CyanogenMod and by the way thanks for the complement
Sent from my LG-P350 using Tapatalk 2
TWRP Recovery size...
Hi again...
I've managed to compile a TWRP-Recovery 2.6.0.1 based on CM9 for my Huawei Ascend Y101 (8186).
But I had to change recovery partition size in BoardConfig.mk (originally it was BOARD_RECOVERYIMAGE_PARTITION_SIZE := 0x00500000, I changed it to 0x00600000), because without these changes it wasn't possible to build a recovery.img ("recovery.img is too large... etc.")
When I flashed it on my device, the TWRP recovery started and worked perfectly, but I wasn't able to boot my device. But it's not a problem for me, I understand why it wasn't able to boot very good.
The question is the following: is it possible to decrease somehow the source files' sizes of TWRP recovery (maybe images, don't know...) in order to compile the recovery.img that would be less than 4.85 MB (actually it's size is 5*095*424, it's more than my recovery partition....... )
By the way, the size of a CWM-recovery (cm9) that I've compiled is 4*489*216, so it fits like a glove :good: and works fine...
Thanks in advance. I understand that you compiled a TWPR recovery based on CM7, but I don't see much differences...
maximik1980 said:
Hi again...
I've managed to compile a TWRP-Recovery 2.6.0.1 based on CM9 for my Huawei Ascend Y101 (8186).
But I had to change recovery partition size in BoardConfig.mk (originally it was BOARD_RECOVERYIMAGE_PARTITION_SIZE := 0x00500000, I changed it to 0x00600000), because without these changes it wasn't possible to build a recovery.img ("recovery.img is too large... etc.")
When I flashed it on my device, the TWRP recovery started and worked perfectly, but I wasn't able to boot my device. But it's not a problem for me, I understand why it wasn't able to boot very good.
The question is the following: is it possible to decrease somehow the source files' sizes of TWRP recovery (maybe images, don't know...) in order to compile the recovery.img that would be less than 4.85 MB (actually it's size is 5*095*424, it's more than my recovery partition....... )
By the way, the size of a CWM-recovery (cm9) that I've compiled is 4*489*216, so it fits like a glove :good: and works fine...
Thanks in advance. I understand that you compiled a TWPR recovery based on CM7, but I don't see much differences...
Click to expand...
Click to collapse
The difference is no on the source dude so relax. You have to modify your kernel and change the compression method to lzma. Contact Dees_Troy for this because i dont know how to change it. You can chat with him through IRC.

[HOW-TO] extract kernel from source, compile, and insert on GPE (510)

How to extract the boot image from your tablet, set up adb, compile a new kernel with cool options, and put it back on your device!
UPDATED for Lolipop 12-4-14
This is a complete guide from start to finish, copy and paste style. If you own a gpe510, or any other AOSP device and a computer running Debian Linux, you can do all of this.
If all you want is the modified kernel, download from here:
Sleekai Kernel For The LG GPad 8.3 V510(GPE)
​
I am hoping people will add to this with new ideas and patches in order to make the GPE a better device. I see the potential for all sorts of neat stuff.
This guide assumes a basic knowledge of linux operating systems. I am using a Debian 64 bit (wheezy stable) to compile my kernel. I have used many, many hours of the day to figure this out properly, with specific thanks going to Pete of Pete's Blog for his image tools.
But first, lets keep this simple. As usual, you are on your own if you brick your device, though I don't see how you could if you are paying attention!
There are dependencies for building your own kernel, and you will definitely want to use a 64 bit system as a 32 bit will not work properly for kitkat.
Here are all of the packages you will need, and they will draw in further dependencies when you install, but these are it! So, here we go:
Open a terminal, su to root and:
Code:
dpkg --add-architecture i386
##This will allow for the use of some 32 bit librarys that we will need for both adb and the kernel compile. Then:
Code:
apt-get update ; apt-get install libc6:i386 libncurses5:i386 libstdc++6:i386 libc6-i686:i386 lzop liblzo2-dev libgpm2:i386 git-core git gnupg flex bison gperf libsdl1.2-dev libesd0-dev build-essential zip curl gedit libncurses5-dev zlib1g-dev fakeroot lib32z1-dev lib32ncurses5-dev gcc-multilib g++-multilib
Next, you will need to install adb and have your permissions set up.
In order to do this you will need to go into the developer options on your device to enable debugging on your tablet. Go to settings/about tablet/build number, and tap on build number several times to unlock the developer options.
then:
You will need to create new udev rules for your device in/etc/udev/rules.d on your computer.
Use "lsusb" in your terminal to find the manufactures code of your device. it will show up as a nexus 4, or Google device.
You will need to create a file in your computer in /etc/udev/rules.d/99-android.rules.
You can use gedit if you like:
Code:
gedit /etc/udev/rules.d/99-android.rules
Put the following inside and save, changing the manufactures code as necessary to fit your device, and change “your-login” to your login name on your computer.
Code:
# Google Nexus devices
SUBSYSTEM=="usb", ATTR{idVendor}=="18d1", MODE="0666", OWNER="your-login" # Google Nexus devices
18d1 is the manufacturers code.
You will then want to restart udev on your computer:
Code:
service udev restart
you will now have permissions to access your android device from user space.
Now to download adb and get started. You should probably not use adb from the Debian repositories, as it may be an older version. the V510 is using kitkat android and needs the latest build of adb to work properly. It is a good idea to get rid of any old adb files on your computer first. The code below will do just that.
Code:
apt-get purge android-tools-adb android-tools-fastboot
Now download the latest adb bundle from here:
http://developer.android.com/sdk/index.html
Move it into a new directory,
*note -the version number may be different.
Code:
mkdir ~/adb
Code:
cd ~/adb
Code:
unzip adt-bundle-linux-x86_64-20131030.zip
su to root and Move the bundle to /opt:
Code:
mv adt-bundle-linux-x86_64-20131030 /opt/android-sdk-linux-x86_64-20131030
Other google products reside in /opt, this should too. This takes a minute or so on slow machines.
Next we need to link adb to /usr/bin
Code:
ln -s /opt/android-sdk-linux-x86_64-20131030/sdk/platform-tools/adb /usr/bin
Code:
ln -s /opt/android-sdk-linux-x86_64-20131030/sdk/platform-tools/fastboot /usr/bin
We are ready to begin working on the device! first start the adb server and look for your device.
Code:
adb start-server
Code:
adb devices
You will then need to confirm the connection on your tablet screen to allow access from your computer.
Okay, wev'e got this first part set up. it's time to begin working on a kernel!
Lets get started.
I want to extract and build my zimage in $userspace, so open a terminal from /home and:
Code:
mkdir ~/android
Download the source package LG-V510(G-Pad 8.3 Google Play Edition)_Android_KK_V510_11c from here :
https://www.lg.com/global/support/opensource/opensourceList?types=ALL&search=lgv510
and open it to find three folders, including a kernel folder. Move the kernel folder to ~/android and then:
Code:
cd ~/android
Download the current eabi-4.6 Google tool chain to ~/android to cross compile your android kernel:
Code:
git clone https://android.googlesource.com/platform/prebuilts/gcc/linux-x86/arm/arm-eabi-4.8
When it completes, enter ~/android/kernel and get ready to compile a new kernel from the source code.
Code:
cd ~/android/kernel
Do the following each time you compile another kernel. This insures the correct path.
Code:
export PATH=$PATH:~/android/arm-eabi-4.8/bin
Code:
arm-eabi-gcc --version
you should get:
Code:
arm-eabi-gcc (GCC) 4.6.x-google 20120106 (prerelease)
Copyright (C) 2011 Free Software Foundation, Inc.
This is free software; see the source for copying conditions. There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
Continue on! we are not done yet!
Code:
export ARCH=arm
Code:
export SUBARCH=arm
Code:
export CROSS_COMPILE=arm-eabi-
Code:
export KERNEL_DEFCONFIG=palman_defconfig
Code:
make clean
Code:
make palman_defconfig
Doing the above prepares your kernel build environment, while the following code opens a interface to configure the kernel. You can simplify this later however you wish.
But for now,
Code:
make menuconfig
At this point make whatever changes you wish to the config file. for a list of the changes I have made, and that are in the kernel available to download, look in the sleekai kernel thread. (At start of thread, or in my signature).
After saving your changes,
Code:
make
Or conversely
Code:
make -o2
which will optimize the make. I recommend using simply "make" first, as the other may not properly show errors should any occur.
and go make a pot of coffee, and probably drink the whole pot! This will take a while.
At the end you will see that the "zimage is ready"
If you have errors, then you probably have dependency problems. If not, Yay! You compiled your first kernel, but we are not done yet!
The zimage you just produced is stored in /kernel/arch/arm/boot/zImage
To put both the zimage and any modules into a separate folder inside of ~/android so as to make extracting them easier:
Code:
mkdir ~/android/kernel_output
Code:
cp ~/android/kernel/arch/arm/boot/zImage ~/android/kernel_output/zImage
Code:
find ~/android/kernel -name "*.ko" -exec cp {} ~/android/kernel_output/ \;
The above code will find all the modules for your kernel. We don't need them for this tutorial, but it still is mighty handy!
Extract your boot image (boot.emmc.win) for the ramdisk You may also download the stock.zip from the sleekai kernel thread
Now make a backup to transfer to your computer.
Reboot to recovery on your tablet. I'm using TWRP. If you are using something else it should be just as easy.
Code:
adb reboot recovery
Only tick the boot
make a backup to your sd card. I changed the name to boot.bac to keep it simple
reboot
make sure the backup of boot is present using a file explorer. I am using ES File explorer.
On your computer, pull the file using adb
Code:
adb start-server
Code:
adb devices
Code:
adb pull /storage/sdcard1/TWRP/BACKUPS/LG0000606708987/boot.bac /home/sleek
sleek is my user name, replace with yours or use tilde.
What we are after is the "boot.emmc.win" file. We will only need this and the zImage to compile a new boot image and run it on your tablet.
The tools to extract the kernel and ramdisk from the boot.emmc.win you will need the following boot image tools installed on your computer.
So, again, lets keep this simple. All the tools are forked to my github for ease of use.
So lets install the tools! Ready?
As Root:
Code:
mkdir /usr/src/android
Code:
mkdir /usr/src/android/boot
Code:
cd /usr/src/android/
Code:
git clone https://github.com/sleekmason/bootimg-tools.git
Code:
cd bootimg-tools/libmincrypt/
Code:
gcc -c *.c -I../include
Code:
ar rcs libmincrypt.a *.o
Code:
cd ../mkbootimg
Code:
gcc mkbootimg.c -o mkbootimg -I../include ../libmincrypt/libmincrypt.a
Code:
cp mkbootimg /usr/local/bin/
Code:
cd ../cpio
Code:
gcc mkbootfs.c -o mkbootfs -I../include
Code:
cp mkbootfs /usr/local/bin/
Code:
cd /usr/src/android/bootimg-tools/mkbootimg/
Code:
wget https://raw.github.com/sleekmason/bootimg-tools/master/mkbootimg/unmkbootimg.c
Code:
gcc -o unmkbootimg unmkbootimg.c
Code:
cp unmkbootimg /usr/local/bin/
Now everything is in place to make a new boot image for your tablet!
Finishing this up is easy.
As root, we made a directory in /usr/src/android/boot for your boot.emmc.win file to be torn apart:
Code:
cd /usr/src/android/boot
Copy your new zImage and the boot.emmc.win file you extracted from your device.
Note* "/home/sleek" is the path on my computer, and should be changed to reflect yours!
Code:
cp /home/sleek/android/kernel_output/zImage /usr/src/android/boot
Code:
cp /home/sleek/boot.emmc.win /usr/src/android/boot
Now unpack the boot.emmc.win file to get the ram disk
Code:
unmkbootimg -i boot.emmc.win
Now you may remove the current boot.emmc.win file, and the resultant kernel file as we will be making new ones, and rename the zImage file you moved here to "kernel".
Code:
rm boot.emmc.win kernel && mv zImage kernel
Now repack using the command given to you during the unpack:
Code:
mkbootimg --base 0 --pagesize 2048 --kernel_offset 0x80208000 --ramdisk_offset 0x82200000 --second_offset 0x81100000 --tags_offset 0x80200100 --cmdline 'console=ttyHSL0,115200,n8 androidboot.hardware=palman lpj=67677 vmalloc=300M' --kernel kernel --ramdisk ramdisk.cpio.gz -o boot.emmc.win
Note* For 500 users this may be different. Simply use the command from the prompt.
You should now have a brand new boot.emmc.win image in /usr/src/android/boot!!
To push back on your device to test
Code:
adb reboot bootloader
Code:
fastboot boot boot.emmc.win
USING the above will only put your kernel build into memory and should not hurt your device if something goes wrong. Use the command below to make it permanent.
If everything works well, you should see the change you made to the /general/perf-localversion/ in your settings under kernel. from there it's up to you to hack away! make new and unique kernels!
If you want your kernel to survive reboot do;
Code:
fastboot flash boot boot.emmc.win
then:
Code:
fastboot reboot
You can expect a slow bootup on the first go around as your new kernel populates the widgets, etc..
NOTE*For the use of the latest eabi-4.7 google toolchain, you will need the libglibc libraries from the "testing" branch as gcc 4.7 is in testing. I advise completing the guide with eabi 4.6 first before trying 4.7.
The gamma correction though enabled in 4.6, isn't near as good as the native compile using 4.7. If you want the screen to look like it does in my kernels, you will need 4.7
For the eabi-4.7:
Code:
git clone https://android.googlesource.com/platform/prebuilts/gcc/linux-x86/arm/arm-eabi-4.7
That's it! Good luck! Remember, If you post a kernel you have made, you will need to show your kernel source, etc . . . Git hub is a good choice to keep track of changes you make. Best regards, Sleekmason
If you are a v500 user and want to build your own kernel!
First, read the above post as you will be following the steps listed there.​
There are just a couple of changes that you will need to do, and maybe a riddle to figure out as well. Read on.
You will need to download the v500 source from here: https://www.lg.com/global/support/opensource/opensourceList?superOsCategoryId=CAT00000001&osCategoryId=
Look for the LGV500 kernel source.
Where it says "palman" for the defconfig items, you will want to replace that with the defconfig for the 500, so replace palman with awifi-perf,
like this:
Code:
export KERNEL_DEFCONFIG=awifi-perf_defconfig
Code:
make awifi-perf_defconfig
Important
Follow the guide and build with the Google Toolchain eabi4.6 first
LG compiled for the 500 and 510 using the eabi4.6. It works, and will give you a feel for the process, and allow you to use your kernel.
Note*
I use the google toolchain eabi-4.7 for the sleekai kernels as it changes the gamma to reasonable defaults on the 510 without further tweaking. After compiling a kernel or two to get a feel for it, you should try using the 4.7 toolchain. To do so, you will probably need the libglibc libraries from the "testing" branch. Look it up.
caveat: I recieved a compile error for the v500 when I used the eabi-4.7 . . . . . yeah. You'll have to work that out.
There is a modified anykernel script for emmc devices out there (Search Google or here in xda). You will have to use the anykernel script after making your boot.emmc.win image as fastboot won't work on the 500. There may be another way .... But I don't know what it is.
Edit* There are now two different kernels for the LG GPad 8.3 V500(awifi) located in the development section of the forum.
Best of luck! -sleekmason
Can this be used to create a kernel for the non Google Play Edition Gpad to be able to allow us to install the Google Play edition ROM on it
Sent from my SM-N900W8 using Tapatalk
Canadoc said:
Can this be used to create a kernel for the non Google Play Edition Gpad to be able to allow us to install the Google Play edition ROM on it
Sent from my SM-N900W8 using Tapatalk
Click to expand...
Click to collapse
I would think so. I edited the above to show how to put the image back on your device. You should be able to use any source you wish to compile with. My thoughts are that you might wish to examine the differences in the ram disk if any.
sleekmason said:
Howdy, I would like to share how to download the kernel source for the gpe, compile a new custom kernel, and insert into your LG gpad GPE 510.
...
Click to expand...
Click to collapse
Thanks for the guide. Making GPE kernel was my next step in trying to get the GPE ROM to work on v510.
I just made guide for getting your Android build environment going if you want to use it on your blog or where ever.
http://forum.xda-developers.com/showthread.php?t=2629008
The problem with v500 is that it does not have fastboot so we can not flash kernel like how you can on v510.
@ AndroidUser00110001 Hi! I know that somebody tweaked the Any kernel to work on emmc devices... Maybe it could be adapted? Actually getting the menuconfig and make should be the same process as well as repacking the image. I take it just getting it back on the 500 device is the problem?
I will add your link to this post for setting up a build environment if that is okay.
sleekmason said:
@ AndroidUser00110001 Hi! I know that somebody tweaked the Any kernel to work on emmc devices... Maybe it could be adapted? Actually getting the menuconfig and make should be the same process as well as repacking the image. I take it just getting it back on the 500 device is the problem?
I will add your link to this post for setting up a build environment if that is okay.
Click to expand...
Click to collapse
Is that the koush any kernel? I was going to mess with that too. I just need a small break now. Took a few days to get new system exactly how I want it.
Go ahead and use guide...mo problem at all.
AndroidUser00110001 said:
Is that the koush any kernel? I was going to mess with that too. I just need a small break now. Took a few days to get new system exactly how I want it.
Go ahead and use guide...mo problem at all.
Click to expand...
Click to collapse
Yes, from here: http://forum.xda-developers.com/showthread.php?t=847265
I noted that boot was on block nncblk0p21 on our device, and not 22? better double check that. I tried it Anykernel as well to no avail when getting this set up. Fastboot is Awesome!
It's taxing to get it set up right. Seems like things change very often for the dependencies based on other package changes. I ussually go with testing but redid two partitions with stable. The 32 bit is just going to sit there, which seems kinda silly due to the need for extra packages in 64 to compile for 32 but whatever. Yeah.
AndroidUser00110001 said:
Thanks for the guide. Making GPE kernel was my next step in trying to get the GPE ROM to work on v510.
I just made guide for getting your Android build environment going if you want to use it on your blog or where ever.
http://forum.xda-developers.com/showthread.php?t=2629008
The problem with v500 is that it does not have fastboot so we can not flash kernel like how you can on v510.
Click to expand...
Click to collapse
I don't understand, what are the differences bettween the v500 and v510? they both have the same hardware, but not the same boot partition or something like that?
ayziaa said:
I don't understand, what are the differences bettween the v500 and v510? they both have the same hardware, but not the same boot partition or something like that?
Click to expand...
Click to collapse
The boot on the 500 cannot be fully unlocked.
This is not the appropriate place to ask that kind of question should be asked in general or in troubleshooting. Also, there are already many threads about this same question please use the search utility to find them. Thank you.
i was thinking of writing a tutorial about this as well for the v500 but this better than i would have done Well done...
sleekmason said:
Yes, from here: http://forum.xda-developers.com/showthread.php?t=847265
I noted that boot was on block nncblk0p21 on our device, and not 22? better double check that. I tried it Anykernel as well to no avail when getting this set up. Fastboot is Awesome!
It's taxing to get it set up right. Seems like things change very often for the dependencies based on other package changes. I ussually go with testing but redid two partitions with stable. The 32 bit is just going to sit there, which seems kinda silly due to the need for extra packages in 64 to compile for 32 but whatever. Yeah.
Click to expand...
Click to collapse
Another tool that i ported to the lg g pad a bit back along with loki-doki...
Quick hint, dont bother with direct mmc naming as qcom (i dont know if the other chip makers do the same thing, as i have only had qcom devices) has given us a simple naming scheme...
should only be used by people who know how to use this,
darkassain said:
i was thinking of writing a tutorial about this as well for the v500 but this better than i would have done Well done...
Another tool that i ported to the lg g pad a bit back along with loki-doki...
Quick hint, dont bother with direct mmc naming as qcom (i dont know if the other chip makers do the same thing, as i have only had qcom devices) has given us a simple naming scheme...
should only be used by people who know how to use this,
Click to expand...
Click to collapse
Thank you! Have you successfully used your script to push a kernel onto the 500 Or 510?
I would think this could be very handy for sharing a custom kernel for the 510, but would like to see somebody report a positive test result. Very cool!
sleekmason said:
Thank you! Have you successfully used your script to push a kernel onto the 500 Or 510?
I would think this could be very handy for sharing a custom kernel for the 510, but would like to see somebody report a positive test result. Very cool!
Click to expand...
Click to collapse
yes back before when there wasnt a overclocked kernel i basically used this to push it when i would compile just the kernel (didnt maintain so i now use dyn's)...
yes this is only for the v500 as this has the extra loki step, but it shouldnt be hard to modify so it does not do that extra step
darkassain said:
i was thinking of writing a tutorial about this as well for the v500 but this better than i would have done Well done...
Another tool that i ported to the lg g pad a bit back along with loki-doki...
Quick hint, dont bother with direct mmc naming as qcom (i dont know if the other chip makers do the same thing, as i have only had qcom devices) has given us a simple naming scheme...
should only be used by people who know how to use this,
Click to expand...
Click to collapse
Hi, can you just use a generic anykernel updater script too?
For example to flash a packed boot.img
Code:
run_program("/tmp/busybox", "dd", "if=/dev/block/platform/msm_sdcc.1/by-name/boot", "of=/tmp/boot.img");
run_program("/tmp/unpackbootimg", "-i", "/tmp/boot.img", "-o", "/tmp/");
run_program("/tmp/repack-ramdisk.sh");
run_program("/tmp/mkbootimg.sh");
run_program("/tmp/busybox", "dd", "if=/tmp/newboot.img", "of=/dev/block/platform/msm_sdcc.1/by-name/boot");
mako and flo can do like this.. I think HTC One as well, since they are all similar qcom chipsets maybe this device can too
poondog said:
Hi, can you just use a generic anykernel updater script too?
For example to flash a packed boot.img
Code:
run_program("/tmp/busybox", "dd", "if=/dev/block/platform/msm_sdcc.1/by-name/boot", "of=/tmp/boot.img");
run_program("/tmp/unpackbootimg", "-i", "/tmp/boot.img", "-o", "/tmp/");
run_program("/tmp/repack-ramdisk.sh");
run_program("/tmp/mkbootimg.sh");
run_program("/tmp/busybox", "dd", "if=/tmp/newboot.img", "of=/dev/block/platform/msm_sdcc.1/by-name/boot");
mako and flo can do like this.. I think HTC One as well, since they are all similar qcom chipsets maybe this device can too
Click to expand...
Click to collapse
thanks for reminding me the any kernel uploaded by me won't work as it doesn't parse Loki images xorrectly, I'll upload the correct one once I have access to my pc
darkassain said:
thanks for reminding me the any kernel uploaded by me won't work as it doesn't parse Loki images xorrectly, I'll upload the correct one once I have access to my pc
Click to expand...
Click to collapse
could you please re-post to a different thread rather than hijacking this thread, as your script does not work with the 510 currently and I do not want to go to get confused with my kernel how to. what started out to maybe become relevant apparently will not and so shouldn't be confused with what I'm doing here. I will be happy to try working with your script if you would open up an appropriate thread. Thank you.
Installed kenel and booted. Now to install trickster mod and fix the dang gamma.
gunnyman said:
Installed kenel and booted. Now to install trickster mod and fix the dang gamma.
Click to expand...
Click to collapse
Excellent!! Pleased to know that you are able to use it. Have you changed your gamma settings?
I did on mine and am pleased with the result. I'm using 248, 252, 255 using trickster mod What are you going with?
sleekmason said:
Excellent!! Pleased to know that you are able to use it. Have you changed your gamma settings?
I did on mine and am pleased with the result. I'm using 248, 252, 255 using trickster mod What are you going with?
Click to expand...
Click to collapse
havent messed around too much.
I had a thought about this and I think it would be awesome if we could incorporate faux123's bits for gamma and color control. His fauxcontrol offers much more granular control than trickster.
I'm thankful to have what we have, and THANK YOU for sharing it, but like any good geek I WANTS MOAR!!!!!
gunnyman said:
havent messed around too much.
I had a thought about this and I think it would be awesome if we could incorporate faux123's bits for gamma and color control. His fauxcontrol offers much more granular control than trickster.
I'm thankful to have what we have, and THANK YOU for sharing it, but like any good geek I WANTS MOAR!!!!!
Click to expand...
Click to collapse
me too! I'll look into it. There are other apps besides trickster to give you more control. I think at the kernel level everything we need is unlocked. And yeah, he knows his business like nobody else eh? I'm just persistent.

Noob's guide to building AOSP from scratch.

So, I have been an Android developer since 2009 (HTC dream), and have been actively "consuming" XDA, custom ROMs and other tweaks. Surprisingly, never tried to build my own ROM from scratch.
Recently, something made me want to build the ROM, so that I can make some changes to the way SystemUI behaves (specifically putting some app shortcuts to my Pixel phone(s), like camera etc. which are now removed in Android 10). So, after a week's struggle I got to where I wanted to reach. (90% time spent in getting the first successful flash. 1% feature development. 9% feature polishing).
Here is my guide to all beginners. (It is pretty simple, if you know the steps).
System setup
I have always been a Windows user (and I love my Surface(s)), but you cannot build Android on Windows machines (as clearly called out in source.android.com). I still tried to install Ubuntu shell from Microsoft store, and build (Spoiler alert: Does not work).
Next is Mac. Android can be built in Mac, I got it build in Mac. But, it is not easy. Especially with setting up the environment, having the right version of MacOS (doesn't work on Catalina yet). And also, challenges with filesystem format (Android building only works on case sensitive file system, so you have to create such a partition). Android building needs at least 160GB of disk space (so unless you are super rich and have 512GB+ Macbook with top specs, it is going to be hard).
My choice machine hence became, my two desktops (i7 4 core, 16GB, 1TB SSD, Ubuntu 18.04 and Xeon 12 core, 32GB, 512GB disk, with Ubuntu 18.04).
There is a reason why I specifically talk about these two machines. To build Android fast (cold clean build in less than 4 hours), you need
Fast processors, and more cores
Lots of RAM
A SSD disk (with 200GB space)
If you are missing any of the above 3, you will build times will go up. I have found for hot build, both machines did a decent job (2-3 mins if you are working on single module), but SSD was more important than cores, and RAM.
Setting up your Ubuntu machine. {ETA 30 mins}
Android has official (and clearly laid out) steps here.
But for Ubuntu these are pretty much the steps.
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 libgl1-mesa-dev libxml2-utils xsltproc unzip
And the guide doesn't mention this, but you need Python2.7, so get this.
Code:
# refreshing the repositories
sudo apt update
# its wise to keep the system up to date!
# you can skip the following line if you not
# want to update all your software
sudo apt upgrade
# installing python 2.7 and pip for it
sudo apt install python2.7 python-pip
# installing python-pip for 3.6
sudo apt install python3-pip
Also install adb.
Code:
sudo apt install android-tools-adb android-tools-fastboot
If you have come till here, you're ready to build for different devices.
Getting the code ready to build {ETA 5 hours - 1 day}
Most of this is also mentioned in the AOSP official website, but some stuff are tricky, I will try to highlight those steps here.
We are going to build the ROM for Pixel 3 (Android 10 - QP1A.191105.003 )
Download and explode the code {ETA 2-3 hours, depending on internet speed}
Here we are talking about downloading at least 20GB of code (text heavy content) over the internet. Going to be excruciatingly slow.
Also, we will be downloading code for specific device model, so if you want to do it for a newer model, you will have to go through the grind again.
Although, technically it might be possible to have the same folder contain code for multiple devices, it is too risky IMO, something goes wrong, you lose everything.
Recommended folder structure would be
aosp --> device 1
aosp --> device 2
......
aosp --> device n
Click to expand...
Click to collapse
With each folder containing over 150GB of contents (after downloading, building etc), so in practical sense, n could be only 3-4 at max.
Setting up repo.
Repo is a tool that Google uses to checkout and manage the AOSP code in your local machine. Once you download the codebase, you can use the command to resync, update, code base.
Code:
mkdir ~/bin
PATH=~/bin:$PATH
You should persist this folder in your PATH variable all the times.
Code:
curl https://storage.googleapis.com/git-repo-downloads/repo > ~/bin/repo
chmod a+x ~/bin/repo
This sets up repo in your machine.
One final step before you actually start the long download, setup your git details.
Code:
git config --global user.name "Your Name"
git config --global user.email "[email protected]"
Now download the code. Like I previously suggested I would do this.
Code:
mkdir ~/aosp
cd ~/aosp
mkdir pixel3
cd pixel3
Now, let's start getting the code home.
Code:
repo init -u https://android.googlesource.com/platform/manifest -b android-10.0.0_r10 --depth=1
Here we have done a bunch of things.
We have chosen a particular Android build tag to download (branch). You can follow the link to choose which branch you want to checkout, based on your test phone and Android version you want to build.
We have asked to only download the latest version of the branch and not all of the branch (--depth), this considerably reduces our download time.
Now that we have decided what to download, let's download the code with this command.
Code:
repo sync -qc -j4
This command is going to take a while to download over 20GB of code. In the meanwhile, let's see what we did here.
-q Asks the download to be silent (which means it will show just overall progress)
-c Makes sure we are only downloading current branch
-j[x] This the tricky one. Let's talk about this.
With -j we are asking repo to spawn multiple downloads (parallelly), to speed up the process. We will see this flag going forward in other places also. We should keep the value of x to number of cores we have in our machine. To find how many cores you have run
Code:
nproc --all
. Note that I have had situations where I put a very high value for n (higher than my cores as well), and eventually ran my JVM out of RAM to run the command (in parallel). So, the trade off here is to restrict it to the core number.
***Key step: Download radio drivers.***
Most tutorials miss this or mention it very subtly. But, without this step the ROM you flash won't boot to the home screen (you will be in the boot loop).
Go to the driver binaries page, and download the right zip files for the Android build version (android-10.0.0_r10) and device (Pixel 3) you chose earlier in the repo command.
You will be downloading two zip files (one vendor image zip and one radio drivers zip), both zips will have on shell script file each (.sh), just put those two files in your repo folder (~aosp/pixel3) and run the scripts. It will download the required proprietary files (after asking you to accept the terms). Do not miss this step.. I lost 3 days trying to find the reason for my ROM not booting up, this was it.
Let's build our code
Now things are more definitive.
Code:
source build/envsetup.sh
This command basically sets up your environment, adding necessary commands to path etc.
Code:
lunch aosp_blueline-userdebug
You can read more about this command here.
Basically this sets up the right parameters to build for your specific model. The param can derived based on aosp_[device code]-[userdebug | eng | user].
Once you have run the above two commands, you can *finally* build your codebase.
Code:
m droid -j4
m basically makes and builds the whole codebase.
Code:
droid
refers to the defaults target configuration (optional). -jN is to specify parallelism (equal to number of cores you have).
This command could take anywhere between 4-12 hours for the first run. But, if you followed all steps above, you should have a green message in the end saying this
Code:
[COLOR="SeaGreen"]#### build completed successfully (2:03:04 (hh:mm:ss)) ####[/COLOR]
Flashing your phone
Now, you're 50% safe when your build has finished successfully. Now, next 50% depends if you're able to flash it and get the phone booting.
This part most of you should know, so I am keeping it brief.
Enter fastboot
Code:
adb reboot bootloader
Unlock your bootloader
Code:
fastboot flashing unlock
Flash your Build
From the root folder of your repository (~/aosp/pixel3)
Code:
fastboot flashall -w
In a few minutes your device should be booting to the freshing baked ROM that you made.
What next?
You can just repeat
Code:
m droid -j4
to repeat builds
You can also go to a specific module folder and execute
Code:
mm
to only build that module
You can use adb sync to update specific modules without flashing again (this never worked for me, always bricked my device)
Use *fastboot flashall* without [-w] flag to flash over existing ROM without losing user data.
You can clean up the whole builds and rebuild everything from scratch. Run
Code:
make clobber
to clean your build, and use
Code:
m
to build again
You could face adb issues (device not detected) in Ubuntu. I am not going into details of how to fix that
This has been pretty much my journey so far with AOSP. I am comfortable making changes to modules and building them again.
Aw man, thanks for posting this. Never thought building rom itself would take this much effort & resources. Rom devs are serioulsy awesome ppl. :good:
Thx a lot ,I just want to learn it,it is vevy clear and help me a lot
Thanks very much for creating this. I didn't try flashing the result yet, but the build finished without any problems.
thank you very much for your post, I also want to modify little bit in code aosp and test this changes. Could you plaese provide advice about how I can open code (Android studio?), do some changes and test it by emulator?
thanks for the great guide
but following it gapps will not be included in the build, correct?
do you guys know how to include open gapps?
tia!
hi everything worked in this guide in terms of the build. While flashing the device all steps succeed but during boot the pixel is stuck at the google loading screen. Any suggestions. I have been stuck on the screen for > 30 minutes.
rorlig said:
hi everything worked in this guide in terms of the build. While flashing the device all steps succeed but during boot the pixel is stuck at the google loading screen. Any suggestions. I have been stuck on the screen for > 30 minutes.
Click to expand...
Click to collapse
Maybe you did not download appropriate .sh scripts for your device or didn't run them successfully before building the code. These scripts additionally download files and without them you could have these problems which you mentioned.
I built and loaded AOSP Andorid 9 for PIxel 2 using the eng build vs the userdebug and its works however, when I start installing and granting Google services and such it works but i get a lot of crashes. do you have Google working and not crashing all the time?
```
$ adb root
$ adb remount
$ adb shell
$ cd /system/priv-app
$ mkdir GoogleServicesFramework
$ mkdir Phonesky
$ mkdir PrebuiltGmsCorePi
$ cp /sdcard/GoogleServicesFramework.apk GoogleServicesFramework/GoogleServicesFramework.apk
$ cp /sdcard/Phonesky.apk Phonesky/Phonesky.apk
$ cp /sdcard/PrebuiltGmsCorePi.apk PrebuiltGmsCorePi/PrebuiltGmsCorePi.apk
$ chmod 755 GoogleServicesFramework
$ chmod 755 Phonesky
$ chmod 755 PrebuiltGmsCorePi
$ chmod 644 GoogleServicesFramework/GoogleServicesFramework.apk
$ chmod 644 Phonesky/Phonesky.apk
$ chmod 644 PrebuiltGmsCorePi/PrebuiltGmsCorePi.apk
:: Need to add permissions for the three apps above
::If a device fails to boot, you need to logcat and grep for " - not in privapp-permissions whitelist" and add any missing items in the xml
$ adb push C:\Users\username\Desktop\PIxel2_9.0.0_eng_build\privapp-permissions-platform.xml /etc/permissions/privapp-permissions-platform.xml
```
Hello, I'm interested on the Mac os part. I've been building pixel experience on Ubuntu form am external HDD but because it's a 2011 iMac I have USB 2.0 and r/w speeds are really low slowering the whole process. On the internal drive I have a 500gb SSD that I'd like to use for compiling but partitioning is not an option, could you help me setting up enviroment?
PD: I tried setting it up with brew but I am missing dependencies I can't (don't know how) install them with brew, all guides are for Ubuntu or for Mac is but old.
Thank you in advance!
This guide inspired me to setup a Dockerized build and flash environment for the Pixel 5.
Leaving it here as Pixel 3 owners might find it useful: https://github.com/nvllsvm/pixel5-aosp-builder
Draje0 said:
This guide inspired me to setup a Dockerized build and flash environment for the Pixel 5.
Leaving it here as Pixel 3 owners might find it useful: https://github.com/nvllsvm/pixel5-aosp-builder
Click to expand...
Click to collapse
Thanks, this is very helpful! Have you tested the built image on a pixel 5?
ammarr said:
Thanks, this is very helpful! Have you tested the built image on a pixel 5?
Click to expand...
Click to collapse
Yup - it boots and seems to work except for phone call audio (T-Mobile US).
I am having issue, I did this and got:
#### build completed successfully (17:26:44 (hh:mm:ss)) ####
Click to expand...
Click to collapse
flashing claims to have succeeded but when the phone reboots it just goes back to fastboot mode and says "no valid slot too boot to"
The last few lines of output when doing "fastboot flashall -w" are:
Erase successful, but not automatically formatting.
File system type raw not supported.
Erasing 'metadata' OKAY [ 0.007s]
Erase successful, but not automatically formatting.
File system type raw not supported.
Rebooting OKAY [ 0.000s]
Finished. Total time: 82.933s
Click to expand...
Click to collapse
Is the filesystem raw not supported normal? Other than that I am really not sure why this isn't working.
very very handy post, appreciate it, even though i would probably be not building on my own. 20GB smh.. phew!
Anyone know or figure out how to get gapps on this once built (or built-in) without having to have TWRP?
Great guide. I am working on creating a custom rom myself. I've been wondering if it's possible to prevent system apps from being included in the build. There are a few apps that I use f-droid apps in their place (example K9 mail for stock email app) and don't want to see them re-appear when the ROM is updated. If this is not possible, can they be removed from the build before flashing?
Edit ..
Figured it out.
Hi.. I'm Building AOSP 10 for POCO F1(beryllium). i dont know which command should i choose in lunch cause my device isnt listed.. They have only for Pixel Devices.. Pls guide through it
***Key step: Download radio drivers.***
Most tutorials miss this or mention it very subtly. But, without this step the ROM you flash won't boot to the home screen (you will be in the boot loop).
Go to the driver binaries page, and download the right zip files for the Android build version (android-10.0.0_r10) and device (Pixel 3) you chose earlier in the repo command.
You will be downloading two zip files (one vendor image zip and one radio drivers zip), both zips will have on shell script file each (.sh), just put those two files in your repo folder (~aosp/pixel3) and run the scripts. It will download the required proprietary files (after asking you to accept the terms). Do not miss this step.. I lost 3 days trying to find the reason for my ROM not booting up, this was it.***
How can I get this 2 zip files for my Samsung device (SM-A715F). Thank you

Categories

Resources