Thread is outdated for 4.3... Working on Update. Thanks for your patience
Contents:
Introduction
Glossary & Linux Quick Guide
Setting up Linux (Dual-Boot Style Setup)
Setting up your Build Environment
Building
Cherry-Picking
Using CCache
Editing Local Manifests/Adding APKs to the build
Bash Scripting Autonomy
Creating Launchers
Uploading
Reserved
1. Introduction
Welcome To The Most Comprehensive Tutorial For Building AOKP ROMs I Can Think Of! All of the tutorials I have found have links to other websites interspersed throughout and are dependent on the other sites keeping their information current. Also, they can be confusing. My goal is to create a single document which, unfortunately, will contain some links but will flow in an orderly manner and include a discussion thread for building AOKP nightlies. The setup I will be describing will be using an Ubuntu - 64bit System. YOU MUST USE 64 BIT TO BUILD/COMPILE ANDROID. That said, I recommend Ubuntu 13.04
PLEASE POST ANY QUESTIONS, COMMENTS OR ITEMS YOU THINK WOULD BE BENEFICIAL IN THE THREAD. If this post has helped you, HIT THANKS and TELL OTHERS where to find the info they need. Post the thread on your G+, Facebook, Twitter Etc Accounts. Let's get the word out! Anyone can build! The goal is to create a community feel to this thread. Beginners to advanced users are welcome!
Here is My version of GAPPS. It will install AOKP Camera (Alongside Stock so You can Keep the Photo Sphere feature), Removes the Old Calendar and installs the newest Play Store Version, ***Play Store Version 4.0.25!!!*** Yay!!!!! The First Time you Flash it you might have to select your default calendars again
Thanks to:
VonEsch
Romanbb
These guys have been indispensable for helping me out when I got started, either pointing me in the right direction or learning together...
2. Glossary & Linux Quick Guide
2. Glossary & Linux Quick Guide
Let's start with some basic terms I will use.
Kang: Internet term meaning to steal.Root: Akin to Android's SuperUserNautilus: Ubuntu's default file managersudo: Terminal Command to perform the request as Root.gksu: Terminal Command to open a program as Root i.e. nautilus, gedit, terminal...Repo: 1. Repository. 2. A Python Script used for synchronization between your local repository and AOKP's server repository.Gerrit: A web based code review system, facilitating online code reviews for projects using the Git version control system.Git: An online system used to store source code and manage version control (branches).jb-mr1: Google's branch name for Jellybean 4.2 (jb-mr1.1 is 4.2.2).Terminal: A Linux command prompt. (Ctrl+Alt+t).Commit: A new feature/fix either implemented (merged) or awaiting review and/or approval (open).Build: A completed ROM. (v) To compile a ROMCherry-Pick: To merge an open commit into your local repository to be incorporated into the build.Nightly: A build containing all the merged commits since the last Official Build.Bash: A simple programming language similar in function to DOS.Distro: Short for distribution. Used to refer to a "flavor" of Linux. Different distros have different pros/cons and abilities.Ubuntu: The Linux distro I use.PPA: A Linux package containing software... sorta' like a windows executable.Clone: To download the contents of an online Git repository folder onto your local machine.Build Box: (Box) The PC you are using to build your ROMs.MBR: Master Boot Record - The Hard Drive's own index.Manifest: An XML file that tells the repo script what to include and where to get it from when it syncs your local repository.URL: Short for Universal Resource Locator... basically a Web address.
Linux Quick Guide:
Show Hidden Files in Nautilus: Ctrl+H
Terminal Keyboard Shortcuts:
Copy: Ctrl+Shift+C
Paste: Ctrl+Shift+V
Break Operation: Ctrl+C
3. Setting up Linux (Dual-Boot Style Setup)
3. Setting up Linux (Dual-Boot Style Setup)
I am using the assumption that you have no dedicated PC to build ROMs. The following method will turn your Windows PC into a Dual-Boot Ubuntu/Windows PC. If you already have a build box, go ahead and skip to post #3. Let's get started.
First you need to download Ubuntu. We're going to download Ubuntu 13.04 64-bit. (By the way, Ubuntu's Version control is Year.Month so 13.04 is the April 2013 version). You can burn the image to a disk or a USB stick (Pen Drive). I'm going to show you how to use a pen drive. *IN EITHER CASE* Make sure your BIOS is set to boot from that device first. Don't forget to switch it back afterward.
You can download Ubuntu here: http://www.ubuntu.com/download/desktop
You can download the pen drive installer here: http://www.pendrivelinux.com/universal-usb-installer-easy-as-1-2-3/
OK... Here you're gonna follow the directions for Using the appropriate tools to make your bootable disk. So, Yes I am going to give you some links... but they will be specific, I promise!
To create a bootable DVD: http://www.ubuntu.com/download/help/burn-a-dvd-on-windows
To create a bootable USB stick: http://www.ubuntu.com/download/help/create-a-usb-stick-on-windows
OK.. That done? Great! Moving on...
Another link... But it is fantastic and has pictures! Here you will receive excellent instructions on how to create the dual-boot.
Windows 7
http://www.linuxbsdos.com/2012/05/17/how-to-dual-boot-ubuntu-12-04-and-windows-7/
Windows 7 with 2 hard drives
http://www.linuxbsdos.com/2012/07/2...d-windows-7-on-a-computer-with-2-hard-drives/
Windows 8
http://www.linuxbsdos.com/2012/11/05/dual-boot-windows-8-and-ubuntu-12-10-on-uefi-hardware/
4. Setting up your Build Environment
4. Setting up your Build Environment
OK! Make sure your system is completely functional and up to date, using software updater.
Ready to make a build box? Good!
The following will make life easier and your Box more fun. The following are optional but recommended. All code should be cut and pasted into terminal to prevent typos.
Install proprietary media codecs/libraries:
Code:
sudo apt-get install ubuntu-restricted-extras
Code:
sudo wget --output-document=/etc/apt/sources.list.d/medibuntu.list http://www.medibuntu.org/sources.list.d/$(lsb_release -cs).list && sudo apt-get --quiet update && sudo apt-get --yes --quiet --allow-unauthenticated install medibuntu-keyring && sudo apt-get --quiet update
Code:
sudo apt-get install libdvdcss2
Install VLC Media Player:
Code:
sudo apt-get install vlc
Install "Open in Terminal" Extension. This allows you to open a terminal window in any folder by right click and selecting "Open in Terminal" This is very helpful for cherry picking!!!! ***THIS ONE ISN'T A TERMINAL COMMAND*** Either option will work.
Option #1 Paste this into the address bar of your browser and install in Software Center
Code:
apt:nautilus-open-terminal
Option #2 Paste this into the software center search box and install.
Code:
Nautilus plugin for opening terminals in arbitrary paths
Install gvfs-mtp mount to easily mount and unmount your android 4.2 devices upon plugging in and unplugging: (Not Required for 13.04)
Code:
sudo add-apt-repository ppa:langdalepl/gvfs-mtp
Follow the prompts then:
Code:
sudo apt-get update
Then run software updater
Now, create a file /etc/udev/rules.d/51-android.rules (as the root user) and to copy the following lines in it. must be replaced by the actual username of the user who is authorized to access the phones over USB.
1. Open a Root Access Nautilus Session:
Code:
gksu nautilus
2. Now, Click on File System in the Left Hand Pane, then navigate to etc/udev/rules.d/
3. Now, right click in the folder and Select "Create New Document" then "Empty Document"
4. Name the document 51-android.rules
5. Open 51-android.rules
Paste the following:
Code:
# adb protocol on passion (Nexus One)
SUBSYSTEM=="usb", ATTR{idVendor}=="18d1", ATTR{idProduct}=="4e12", MODE="0666", OWNER="thebytesmasher"
# fastboot protocol on passion (Nexus One)
SUBSYSTEM=="usb", ATTR{idVendor}=="0bb4", ATTR{idProduct}=="0fff", MODE="0666", OWNER="thebytesmasher"
# adb protocol on crespo/crespo4g (Nexus S)
SUBSYSTEM=="usb", ATTR{idVendor}=="18d1", ATTR{idProduct}=="4e22", MODE="0666", OWNER="thebytesmasher"
# fastboot protocol on crespo/crespo4g (Nexus S)
SUBSYSTEM=="usb", ATTR{idVendor}=="18d1", ATTR{idProduct}=="4e20", MODE="0666", OWNER="thebytesmasher"
# adb protocol on stingray/wingray (Xoom)
SUBSYSTEM=="usb", ATTR{idVendor}=="22b8", ATTR{idProduct}=="70a9", MODE="0666", OWNER="thebytesmasher"
# fastboot protocol on stingray/wingray (Xoom)
SUBSYSTEM=="usb", ATTR{idVendor}=="18d1", ATTR{idProduct}=="708c", MODE="0666", OWNER="thebytesmasher"
# adb protocol on maguro/toro (Galaxy Nexus)
SUBSYSTEM=="usb", ATTR{idVendor}=="04e8", ATTR{idProduct}=="6860", MODE="0666", OWNER="thebytesmasher"
# fastboot protocol on maguro/toro (Galaxy Nexus)
SUBSYSTEM=="usb", ATTR{idVendor}=="18d1", ATTR{idProduct}=="4e30", MODE="0666", OWNER="thebytesmasher"
# adb protocol on panda (PandaBoard)
SUBSYSTEM=="usb", ATTR{idVendor}=="0451", ATTR{idProduct}=="d101", MODE="0666", OWNER="thebytesmasher"
# fastboot protocol on panda (PandaBoard)
SUBSYSTEM=="usb", ATTR{idVendor}=="0451", ATTR{idProduct}=="d022", MODE="0666", OWNER="thebytesmasher"
# usbboot protocol on panda (PandaBoard)
SUBSYSTEM=="usb", ATTR{idVendor}=="0451", ATTR{idProduct}=="d00f", MODE="0666", OWNER="thebytesmasher"
# usbboot protocol on panda (PandaBoard ES)
SUBSYSTEM=="usb", ATTR{idVendor}=="0451", ATTR{idProduct}=="d010", MODE="0666", OWNER="thebytesmasher"
# adb protocol on grouper (Nexus 7)
SUBSYSTEM=="usb", ATTR{idVendor}=="18d1", ATTR{idProduct}=="4e42", MODE="0666", OWNER="thebytesmasher"
# fastboot protocol on grouper (Nexus 7)
SUBSYSTEM=="usb", ATTR{idVendor}=="18d1", ATTR{idProduct}=="4e40", MODE="0666", OWNER="thebytesmasher"
# mtp protocol on the grouper (Nexus 7)
SUBSYSTEM=="usb", ATTR{idVendor}=="18d1", ATTR{idProduct}=="4e41", MODE="0666", OWNER="thebytesmasher"
## Google
#SUBSYSTEM=="usb", ATTR{idVendor}=="18d1", ATTR{idProduct}=="4ee2", MODE="0666", OWNER="thebytesmasher"
## LG Nexus 4
SUBSYSTEM=="usb", ATTR{idVendor}=="1004", MODE="0666", OWNER="thebytesmasher"
SUBSYSTEM=="usb", ATTRS{idVendor}=="0bb4", MODE="0666", OWNER="thebytesmasher"
SUBSYSTEM=="usb", ATTRS{idVendor}=="0502", MODE="0666", OWNER="thebytesmasher"
SUBSYSTEM=="usb", ATTRS{idVendor}=="12d1", MODE="0666", OWNER="thebytesmasher"
SUBSYSTEM=="usb", ATTRS{idVendor}=="1004", MODE="0666", OWNER="thebytesmasher"
SUBSYSTEM=="usb", ATTRS{idVendor}=="22b8", MODE="0666", OWNER="thebytesmasher"
SUBSYSTEM=="usb", ATTRS{idVendor}=="04e8", MODE="0666", OWNER="thebytesmasher"
SUBSYSTEM=="usb", ATTRS{idVendor}=="0fce", MODE="0666", OWNER="thebytesmasher"
SUBSYSTEM=="usb", ATTRS{idVendor}=="0489", MODE="0666", OWNER="thebytesmasher"
SUBSYSTEM=="usb", ATTRS{idVendor}=="18d1", SYMLINK+="android_adb", MODE="0666"
SUBSYSTEM=="usb", ATTRS{idVendor}=="04e8", MODE="0666", GROUP="plugdev"
# Google Nexus 7 MTP mode : automatic mount when plugged (all android versions)
ENV{ID_MODEL}=="Nexus_4", ENV{ID_MODEL_ID}=="4ee2", ACTION=="add", RUN+="/usr/bin/sudo -b -u yourlogin /usr/local/sbin/go-mtpfs -allow-other=true /media/Nexus4"
ENV{ID_MODEL}=="Nexus_4", ENV{ID_MODEL_ID}=="4ee2", ACTION=="add", RUN+="/usr/bin/sudo -b -u yourlogin /usr/local/sbin/go-mtpfs -allow-other=true /media/Nexus4"
ENV{ID_MODEL}=="Nexus_7", ENV{ID_MODEL_ID}=="4e41", ACTION=="add", RUN+="/usr/bin/sudo -b -u yourlogin /usr/local/sbin/go-mtpfs -allow-other=true /media/Nexus7"
ENV{ID_MODEL}=="Nexus_7", ENV{ID_MODEL_ID}=="4e42", ACTION=="add", RUN+="/usr/bin/sudo -b -u yourlogin /usr/local/sbin/go-mtpfs -allow-other=true /media/Nexus7"
# Google Nexus 7 MTP mode : automatic unmount when unplugged (all android versions)
ENV{ID_MODEL}=="Nexus_4", ENV{ID_MODEL_ID}=="4ee2", ACTION=="remove", RUN+="/bin/umount /media/Nexus4"
ENV{ID_MODEL}=="Nexus_4", ENV{ID_MODEL_ID}=="4ee2", ACTION=="remove", RUN+="/bin/umount /media/Nexus4"
ENV{ID_MODEL}=="Nexus_7", ENV{ID_MODEL_ID}=="4e41", ACTION=="remove", RUN+="/bin/umount /media/Nexus7"
ENV{ID_MODEL}=="Nexus_7", ENV{ID_MODEL_ID}=="4e42", ACTION=="remove", RUN+="/bin/umount /media/Nexus7"
6. Use the Find and Replace (magnifying glass with pencil) option to find thebytesmasher and replace with your Ubuntu username.
7. Save the file.
Reboot for the above changes to take effect.
** Now to install the required libraries to make your build box work! **
Copy and paste this in terminal:
Code:
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
After that is done installing do:
Code:
sudo ln -s /usr/lib/i386-linux-gnu/mesa/libGL.so.1 /usr/lib/i386-linux-gnu/libGL.so
Then:
Code:
sudo apt-get install schedtool pngcrush
Next we will make the required directories, get the Repo binary/script, Add repo to the path & give it permissions, initialize the repo binary and download the Manifest, then sync the source. Ready?
Make directory for repo binary:
Code:
mkdir ~/bin
Add that directory to your path:
Code:
PATH=~/bin:$PATH
Download repo binary and place it in the proper directory This has recently changed:
Code:
curl http://commondatastorage.googleapis.com/git-repo-downloads/repo > ~/bin/repo
Give repo the proper permissions:
Code:
chmod a+x ~/bin/repo
Create directory for where the AOKP repo will be stored and synced, then go to it:
Code:
mkdir ~/aokp_kk && cd ~/aokp_kk
Notice in the above code how We used && to string together 2 commands.
Initialize the AOKP repo and download the manifest for the KITKAT branch ( -b kitkat):
INITIALIZING REPOSITORY
Init core trees without any device/kernel/vendor :
Code:
repo init -u https://github.com/AOKP/platform_manifest.git -b kitkat
Init repo with all devices, kernels and vendors supported by OurROM :
Code:
repo init -u https://github.com/AOKP/platform_manifest.git -b kitkat -g all,kernel,device,vendor
Init repo only for a particular device :
Code:
repo init -u https://github.com/AOKP/platform_manifest.git -b kitkat -g all,-notdefault,<devicename>,<vendorname>
for example, to init only trees needed to build mako
Code:
repo init -u https://github.com/AOKP/platform_manifest.git -b kitkat -g all,-notdefault,mako,lge
Init repo for multiple devices
Code:
repo init -u https://github.com/AOKP/platform_manifest.git -b kitkat -g all,-notdefault,<devicename1>,<devicename2>,<devicename3>,<vendorname1>,<vendorname2>,<vendorname3>
for example, to init trees needed to build mako and grouper
Code:
repo init -u https://github.com/AOKP/platform_manifest.git -b kitkat -g all,-notdefault,mako,grouper,lge,asus
Sync AOKP source. This can be sped up by using the -j variable. -j4, -j8, -j16, -j32.. Take the number of THREADS your processor have and multiply by 4. The higher the value, the more multitasking... also the higher the number, the slower your build box will run if YOU try to multitask while using a command with a -j variable. Change the number after -j to your liking:
Code:
repo sync -j8
Go do something else. This will take a LONG time! You will be downloading about 10GB of source code. Then Continue on... At this point I reboot my Linux box... Why Not, Right?
Get it? OK!
5. Building...Finally!
5. Building...Finally!
Now we're going to build our first ROM.
The easiest way is to create the ROM and build it into a zip file in one step. to do this we will use the BRUNCH command.
Later we'll set up bash scripts and launchers to simplify the process.
Open a new terminal in the aokp_jb folder using the right click - open in terminal extension we set up earlier
-OR-
you can open a terminal and do
Code:
cd ~/aokp_jb
Then, I always make sure all my variables are set and the build directory is clear:
Code:
PATH=~/bin:$PATH
Code:
make clobber
Now for the next step, use your -j number you decided on earlier (or try another) and substitute mako (both instances) with the device you want to build for (again, don't forget the "."), -j8 or -j12 are reasonable compromises:
Code:
. build/envsetup.sh && brunch mako aokp_mako-userdebug -j32
That's it... for a basic nightly. Now to watch the progress, you can maximize the Terminal Window and open the edit menu (***By default, the Global Menu is enabled in Ubuntu 13.04, that means that for the current window in focus, if you place your mouse pointer at the top left of the screen, you'll get the menu options for that window) and select "Profile Preferences" under the "Scrolling" tab, select "scroll on output"
Now on to More customizations!
6. Cherry-Picking
6. Cherry-Picking
This is the part that most people really want to know about. What is cherry-picking and how do I do it?
On your local computer, you actually have 2 copies of the online Repo. One is in a hidden directory and the other is the one you work with. That way you can modify your visible local copy and if you want to revert or screw something up, it's usually relatively painless to fix. Cherry-picks modify the visible local directory with the modified/added/deleted information of the cherry. When you revert, you're basically calling back up the information from the hidden directory that has been unchanged.
Here is how to cherry pick:
Open up the AOKP Gerrit at
HTML:
http://gerrit.sudoservers.com/#/q/status:open,n,z
Find a change you want to add.
This is where you want to be careful. If the change has multiple parts (i.e. [1/2]) You'll want to cherry-pick both parts.
____________________________________________________________________________________________________________________________________
This is what the Open Commit will look like:
{
"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"
}
____________________________________________________________________________________________________________________________________
Choosing the Commit below the highlight by clicking on the Subject name, The next screen looks like this:
Notice the Commit message, (circled in BLUE) it often contains a brief description of the change.
To the left of the commit message is the basic change info.
***The section entitled Project is the important one.*** This section (Circled in RED) tells you where the cherry pick needs to be downloaded to. For this Commit, it needs to be downloaded to your "/home/YourUserName/aokp_jb/device/asus/grouper" directory.
About halfway down the page, you'll find the download section (Circled in GREEN. Click on the "cherry-pick" label. Now copy the URL underneath by either Ctrl+C or right click and copy.
Now we're going to use the "Open in Terminal" extension we installed earlier. You need to navigate into the aokp_jb/device/asus/grouper directory and right click then select "Open in Terminal" or you can do the same by right clicking on the grouper folder and selecting "Open in Terminal"
____________________________________________________________________________________________________________________________________
Once the terminal is open, paste the URL at the command prompt. Either with a right click and paste or Ctrl+Shift+V.
Press Enter
If successful, You should see this or a similar message:
____________________________________________________________________________________________________________________________________
If you want to cherry pick into the same directory as an active pick, you'll need to commit those changes first:
The easiest way is open a terminal in the folder containing the pick you want to commit and type
Code:
git add -A
then
Code:
git commit -a
Select the files you want to keep and press Ctrl+O (like save) and enter, the Ctrl+X to exit.
When you're done picking go back to the root aokp_jb folder and build!
===================================================================================================================
**In order to sync, you'll need to revert your cherry picks, so sync completes successfully. To do this, type the following in a terminal in each directory you picked into.**
Code:
git reset --hard HEAD && git clean -f && git checkout aokp/jb-mr1
This can also be split up into 3 different commands.
7. Using CCache
7. Using ccache
ccache is a compiler cache for C and C++ that can help make builds faster. It will use space on your Home Partition. The recommended size is 50-100GB. I use 20-30GB and find it speeds up things tremendously. Using ccache is easy. in the root of your build directory (aokp_jb) type the following in Terminal:
Code:
export USE_CCACHE=1
Code:
export CCACHE_DIR=/<path_of_your_choice>/.ccache
Code:
prebuilts/misc/linux-x86/ccache/ccache -M 50G
The 50G is the size you want for your ccache. If you want to watch ccache doing its thing type the following in a new terminal:
Code:
watch -n1 -d prebuilts/misc/linux-x86/ccache/ccache -s
Later, we'll use a script to automate using ccache each time.
8. Editing Local Manifests/Adding APKs
8. Editing Local Manifests/Adding APKs
So, if you've followed this, You've already edited your /home/YourUserName/aokp_jb/.repo/local_manifests/kernel_manifest.xml file. We're going to use this file as our local_manifest.xml. Your default.xml found in the directory platform_manifest is the file that repo uses to sync your local repository. kernel_manifest.xml is a local manifest that adds to your default manifest. We're going to use it to add to and remove from the default manifest. Why is this useful? Well if you want to add something to your build that isn't in AOKP's repository, or replace something that is, you use the local manifest to accomplish this.
Your default.xml defines where on the internets repo can find the base repository (called a remote) for the project you want to add. With some basic deduction, we can see in the following example that the name of the remote is cm and the base repository domain is at https://github.com/:
<remote name="cm"
fetch="https://github.com/"
review="review.cyanogenmod.com" />
Click to expand...
Click to collapse
Understanding how the remote is defined is important because if you want to add projects from a different source, not defined by the default.xml, you'll need to define it in your local manifest. You can name it whatever you want, you'll use that name to call it out in your project path statement.
To add a project that doesn't already exist in default manifest you'd simply add a line to the local manifest (kernel_manifest.xml) like this:
Code:
<project path="packages/apps/CMFileManager" name="CyanogenMod/android_packages_apps_CMFileManager" remote="cm" revision="cm-10.1" />
Defined:
"project path=": this is the local folder the project will sync into/with
"name=": this is the remote location of the repository.
"remote=": this is a call the the remote defined at the head of the manifest.
"revision=": this is the branch of the repository you want.
So in this case:
We are downloading the server repository "android_packages_apps_CMFileManager" from "https://github.com/CyanogenMod/" from the "cm-10.1" branch into our local repository ~/aokp_jb/packages/apps/CMFileManager. GET IT?
So now, whenever we perform a repo sync from the root folder, ~/aokp_jb/packages/apps/CMFileManager will be updated with new commits from CyanogenMod's repository. Cool, huh?
That won't create an app in the build by itself, but it gets us much closer!
In order to tell the AOKP build that you want to build in that app, you need to add it to ~/aokp_jb/build/target/product/core.mk. In this case you add the name of the app "CMFileManager" to the list of Apps in core.mk
Code:
abcc \
apache-xml \
atrace \
bouncycastle \
bu \
cacerts \
CMFileManager \
com.android.location.provider \
com.android.location.provider.xml \
core \
So all we did was add it, plus a space and a back-slash. That's it! Now if we build, CMFileManager will be an available app!
But what if you want to replace an existing app with one from a different repository? You first must remove the AOKP project path, then add the new one as shown above. For this example, we'll say that AOSPs calendar app is different from AOKPs and we want to use AOSPs version. So in kernel_manifest.xml we'll do the following:
Code:
<remove-project name="platform/packages/apps/Calendar" />
<project path="packages/apps/Calendar" name="platform/packages/apps/Calendar" remote="aosp" revision="jb-mr1.1-release" />
See, we removed the standard one, then called out the one we wanted. Since this app has the same name, there is no need to modify any other files. Play with it... See what you can do.
Some applications require other "hooks" like a way to access their settings like CMs LockClock or Chronus. You need to add additional strings and xml settings to create a settings menu in ROM Control.
=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*
Adding APKs.
Sometimes it's not possible to build an app in from a repository. In this case, we'll use the APK itself!
OK, This is a little trickier..
First you need a copy of the APK you want to install during the build. Do I need to tell you not to install paid versions unless the ROM is solely for you???
Then copy the APK into ~/aokp_jb/vendor/aokp/prebuilt/common/app
Now we need to modify 2 Files to incorporate the APK into the Build.
The first is ~/aokp_jb/vendor/aokp/prebuilt/Android.mk
You'll need to add the following code (For this example, we'll assume we are adding the DashClock APK):
Code:
include $(CLEAR_VARS)
LOCAL_MODULE := DashClock
LOCAL_MODULE_OWNER := aokp
LOCAL_SRC_FILES := common/app/$(LOCAL_MODULE).apk
LOCAL_MODULE_TAGS := optional
LOCAL_MODULE_SUFFIX := .apk
LOCAL_MODULE_CLASS := APPS
LOCAL_CERTIFICATE := PRESIGNED
include $(BUILD_PREBUILT)
The next file to edit is ~/aokp_jb/vendor/aokp/configs/common.mk
Here you just need to add DashClock in the same format as the other APKs like this:
Code:
PRODUCT_PACKAGES += \
AOKPtips \
AppWidgetPicker \
DashClock \
LatinImeDictionaryPack \
Microbes \
NovaLauncher \
PerformanceControl \
ROMControl \
Superuser \
su \
SwagPapers \
Torch \
UnicornPorn
That's it. Now when you build you'll see that the APKs you added are built in and annotated as pre-signed!
9. Bash Scripting Autonomy
9. Bash Scripting Autonomy
Bash scripting is an easy tool to create an automated method to perform all of the multi-step functions we've covered already. To create a bash script open a new empty document by right clicking and selecting "create new document", then "empty document". Name it something convenient to the task you want to accomplish with the extension ".sh" like "makemako.sh" Obviously omit the quotes. Open the file.
for a bash script the first line should be:
Code:
#!/bin/bash
Then put all the commands you want in the order you want. For this example, I will show you a script to make a MAKO build incorporating all of the previous elements we've covered so far.
Code:
#! /bin/bash
cd ~/aokp_jb
PATH=~/bin:$PATH
make clobber
export USE_CCACHE=1
wait
export CCACHE_DIR=/home/thebytesmasher/.ccache
wait
prebuilts/misc/linux-x86/ccache/ccache -M 20G
wait
startBuildTimeM=$(date +%r)
. build/envsetup.sh && brunch mako aokp_mako-userdebug -j32
wait
endBuildTimeM=$(date +%r)
echo " "
echo "Build Time: $startBuildTimeM"
echo "Finished: $endBuildTimeM"
cd ~/aokp_jb/out/target/product/mako/
file=$(echo aokp_mako_Purely_Merged*.zip)
cp $file /home/thebytesmasher/Desktop/Latest_Builds/mako/
echo ""
echo "File copy complete"
I used the command "wait" in between operations to ensure they complete prior to commencing the next. Additionally I created Start and Stop variables called "startBuildTimeM" and "endBuildTimeM" to display (echo "") the start and stop times so I can find out exactly how long the build took to make. Also in this command, I specified a ccache size of 20GB.
Next, right-click on the newly created script and go to the permissions tab and select "Allow executing file as a program" as seen below:
Doing this allows you to double click the script and select "Run in Terminal" to execute your script. Later on it will be necessary to have this box checked to allow a launcher to work.
Basically, you can make scripts to automate all of your tasks. The next section, Creating Launchers will simplify the process even more.
**Hint: Put all of your scripts into a folder in your Home directory in a folder to keep them out of the way**
10. Creating Launchers
10. Creating Launchers
What a launcher does: It allows you to create a link that automatically launches your script.
Install the following:
Code:
sudo apt-get install gnome-panel
Then to create a launcher:
Code:
gnome-desktop-item-edit --create-new ~/Desktop
Of course, that gets to be a PITA after awhile... So Why not Create a launcher to make launchers?!!
Create a document called Make New Launcher
Copy & Paste The Following:
Code:
gnome-desktop-item-edit --create-new ~/Desktop
Save the document.
Modify the properties of the document to allow it to be executed as a program.
Move it to your scripts folder.
Open a Terminal.
Paste in the following:
Code:
gnome-desktop-item-edit --create-new ~/Desktop
Now the Make a new launcher window will pop up.
For this Launcher, We're going to select:
Type: Application
Name: Make New Launcher
Command: (Click Browse and navigate to the location where the file you just created is and open it)
Comment: Any Comment you may want
Click on the Springy Platform thing to select a different icon, then click OK.
Now whenever you want to create a new Launcher, just double click the new Icon on your desktop!
For Bash Scripts, You'll want to select "Application in Terminal" for Type. That's it! Now you can make a script for Syncing and for building, make launchers and do it all with one double click!
11. Uploading
11. Uploading
12. Also Reserved
12. Also Reserved
TBS, a very gd thread and guide u had open. I understand it for AOKP. I trying to pull someone source from his github after repo sync from cm source. I goo ard but couldn't find and answer. Pls help me with it. Tks.
orbital_71 said:
TBS, a very gd thread and guide u had open. I understand it for AOKP. I trying to pull someone source from his github after repo sync from cm source. I goo ard but couldn't find and answer. Pls help me with it. Tks.
Click to expand...
Click to collapse
I don't quite understand what you are trying to do, can you elaborate a little please?
Example u already build a rom with all the commit and the stuff u want and u push to github. And i like to pull it all and merge with the latest CM source.
orbital_71 said:
Example u already build a rom with all the commit and the stuff u want and u push to github. And i like to pull it all and merge with the latest CM source.
Click to expand...
Click to collapse
So, you want to make a CM repository, and replace certain CM parts with stuff from another git repository?
TheByteSmasher said:
So, you want to make a CM repository, and replace certain CM parts with stuff from another git repository?
Click to expand...
Click to collapse
Yes..
orbital_71 said:
Yes..
Click to expand...
Click to collapse
Well, I don't build CM... I'm not sure if the directory structure is different..., the concept should be the same though. I'm currently writing the section called editing local manifests (Section 8) It should accomplish the basics of what you want, but there may be other hooks required for whatever you add... Please tell me if this is what you're talking about!
hey man I gotta say I've been building AOKP for a while now. here and there I'd cherry pick so that was easy. recently I was trying to figure out how to get features and apps from other roms like CM over to aokp. CMFilemanager was the first one I wanted to try.
I've followed your guide and my rom is building right now. so far so good. thanks for the guide.
Also the scripting is a great idea. ive been doing that too and it saves a ton of time
Related
Since MTP is replacing UMS in newer version of android I thought I'd share what I did to get it working on my ubuntu partition since it took me a little bit to figure out why it wasn't connecting.
[1]First check your 51-android.rules
Code:
gksudo gedit /etc/udev/rules.d/51-android.rules
[2]And make sure this is in there
Code:
#Sony Ericsson
SUBSYSTEM=="usb", ATTR{idVendor}=="0fce", MODE="0666"
[3]Then install these tools:
Code:
sudo apt-get install mtp-tools mtpfs
[4]Then create a point to mount it
Code:
sudo mkdir /media/Sony
sudo chmod a+rwx /media/Sony
if you change /Sony or another part of the directory just be sure you keep it the same throughout the steps, uppercase and lowercase don't matter unless you screw it up and don't keep the name the same.
[5]Now you yourself to the fuse user group
Code:
sudo adduser YOURUSERNAME fuse
[6]And open up fuse.conf
Code:
gksu gedit /etc/fuse.conf
and remove
[7]The # in front of #user_allow_other so it looks like this:
Code:
user_allow_other
Here's the part that I was annoyed with, cause the original page has it written incorrectly, and for the longest time I couldn't figure that out
[8]Open up your .bashrc
Code:
gksudo gedit ~/.bashrc
And add these exact lines to it:
Code:
alias android-connect="mtpfs -o allow_other /media/Sony"
alias android-disconnect="fusermount -u /media/Sony"
if you've changed your mount point make sure that "/media/Sony" is what you changed it to
DONE!
Now when you plug in your xplay simply type
Code:
android-connect
and it will show the sdcard contents at /media/Sony.
When you done simply type
Code:
android-disconnect[code] to un-mount it.
Original page and tutorial from [URL="http://www.omgubuntu.co.uk/2011/12/how-to-connect-your-android-ice-cream-sandwich-phone-to-ubuntu-for-file-access/"]http://www.omgubuntu.co.uk/[/URL]
and the page that fixed the typo [URL="http://ubuntuforums.org/showthread.php?t=1903440&page=2"]http://ubuntuforums.org/[/URL]
So thank them, I'm just coping their info.
To start I will be adding a lot to this over time so dont be upset if I dont have everything.
To open a terminal without finding it in your programs all you need to do is ctrl+alt+t
Heavily used Commands
cd: this command is used to navigate through your directory's. For example if you have a folder named apps on desktop you would type... cd Desktop...then cd apps.
mkdir: this means make directory or folder. For example cd to your directory then do mkdir whatever. Then you can cd right into that directory ever.
pwd: print working directory. This shows you where you are on the filesystem. This helps if your deep in a directory or folders.
ls: this means list. This tells you all the files in your present working directory.
man: this means manual. This prints like a help page in the terminal to guide you on whatever you need. This can be used for many things.
cp: means copy a file or directory
rm and rmdir: remove a file or like rmdir remove a directory.
mv: move a file or directory
The next command is to issue a command. There are a couple of popular ways of doing so.
First
"./": this is to issue or run a command or file that is in your current directory.
Second
"../": this runs the file that is directly above your current directory.
cat: prints a list of provided text files to the screen.
grep or global regular expression print: searches for patterns or a pattern in a list of files. This is great for small editing if thats what your into and so is.....
diff: compares two text files and displays the differences found between the files on the screen.
history: this is very useful. This shows you a list of your recent commands if you forgot the exact command. To select a command on the list use "!". For example if the label for the command is 00 then type "!00". However most linus OS's allow you to use the up arrow and enter key instead.
Also if you guys dont want a full help list using the "man" command you can use this command: --help
Popular Terminal Commands for Android:
adb: also called android debug bridge is used to issue commands to your phone and debug.
Most people use the following:
adb devices: shows what devices are connected to the computer
adb push and pull: can transfer file from computer to phone and vice versa.
if you want to push an apk to your system make sure that apk is in your adb folder and type: "adb push target.apk system/apps"
adb reboot
adb reboot bootloader
adb logcat: if you are either porting, making roms, or just debugging for a dev you need to know how to logcat. Also if you want to just take the log and make it into a txt file to share just issue the following; "adb logcat -d> logcat.txt"
The logcat will go to your adb folder and save as logcat.txt.
fastboot: is a tool used to update the flash filesystem
I use fastboot for a few things including flashing splashes and flashing recoveries. For example:
Take twrp. To flash to htc one you do...
"fastboot flash recovery twrp.img" presuming you are in your fastboot directory in terminal and the recovery.img is in that folder.
Now as you may know htc uses fastboot to unlock and lock the bootloader using the following commands:
"fastboot oem unlock"
"fastboot oem lock"
Of course you should know this by now you need to be in bootloader under fastboot usb mode.
Now to be able to use fastboot and adb u need sdk and java. Lets start.
"sudo apt-get install openjdk-6-jre openjdk-6-jdk icedtea6-plugin"
This will get u java jdk. Sudo means root and apt-get install means terminal is pulling the file from servers and then installing it.
Next you want sdk. So instead of going all around and downloading it just do this.
" wget http://dl.google.com/android/android-sdk_r20-linux.tgz"
Wget means you are "getting the package".And then you want to extract the file.
"tar -xvzf android-sdk_r20-linux.tgz"
Seeing how the file is a tar "tar -xvzf" extracts that tar. Then cd to the sdk folder and you are good to go.
Speaking of compressing and uncompressing files......
tar -zxvf filename.tar.gz
Untar a tarred and compressed tarball (*.tar.gz or *.tgz).
tar -xvf filename.tar
Untar a tarred but uncompressed tarball (*.tar).
gunzip filename.gz
Decompress a zipped file (*.gz" or *.z).
bunzip2 filename.bz2
Decompress a file (*.bz2) zipped with bzip2 compression.
unzip filename.zip
Decompress a file (*.zip).
Next. Processes.
You know hiw windows has task manager with ctrl+alt+delete. Well here is that for terminal.
ps
(=print status) Display the list of currently running processes with their process IDs (PID) numbers.
kill PID
Force a process shutdown. First determine the PID. Use the command "ps".
bg PID
Send the process to the background.The same can be accomplished with z.
any_command&
Run any command in the background the symbol "&" means run the proceeding command in the background.
killall program_name
Kill program or multiple programs by name. This is useful
lpq
Shows your printing queue.
lprm job_number
Remove a printing job "job_number" from the queue. Alot like windows printing task manager.
lpc
Check and control the printer(s). Type "?" to see the list of available commands.
renice -1 PID
(as root) Change the priority of a running process to -1. Make sure you are Root.
*
Ill add more later. My fingers are tired.
Here are some useful admin commands
printtool
Configuration tool for your printer(s).
linuxconfig
(as root, either in text or graphical mode). You can access and change hundreds of setting from it. Be careful.
adduser user_name
Create a new account (you must be root).
userdel user_name
Remove an account (you must be a root).
passwd
Change the password on your current account. If you are root, you can change the password for any user using: "passwd user_name"
chmod perm filename
Change the file access permission for the files you own. You can make a file accessible in three modes: read (r), write (w), or execute (x) to three classes of users: owner (u), group (g), or others (o).
ls -l filename
Checks the files current permissions.
If the file is accessible to all users in all modes it will show:
rwxrwxrwx
The first triplet shows the file permission for the owner of the file, the second for that group, the third for others. A no permission is shown as "-".
su
You will be asked for your password. Type "exit" to return you to your previous login. Don't work on your machine as root. Use it only when you need it.
fdisk
(as root) Linux hard drive partitioning utility. The program gparted I think is better. To install gparted just like many other programs us the command "sudo apt-get install gparted".
fsck -t ext2 /dev/hda2
Check and repair a filesystem.
Instructions For Setting up a Build Environment for Linux
Make sure you are 64-bit
Have a big hard drive
A good amount of ram
If you dont have java already. Get it.
sudo apt-get install openjdk-6-jdk
You will also need python
Code:
sudo apt-get install python
And git
Code:
sudo apt-get install git-core
Android SDK:
I showed you guys how to get it in the first post.
Now open your home folder and press Ctrl+H to show hidden files, and open up a file called .bashrc.
Add these lines to the bottom of .bashrc:
Code:
# Android tools
export PATH=${PATH}:~/SDK/tools
export PATH=${PATH}:~/SDK/platform-tools
export PATH=${PATH}:~/bin
Now you should also find .profile file in the same place you found .bashrc file. Add this to that file:
Code:
PATH="$HOME/SDK/tools:$HOME/SDK/platform-tools:$PATH"
After that you need to install these packages:
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
On Ubuntu 12.04:
Code:
sudo apt-get install git gnupg flex bison gperf build-essential \
zip curl libc6-dev libncurses5-dev x11proto-core-dev \
libx11-dev libreadline6-dev libgl1-mesa-glx \
libgl1-mesa-dev g++-multilib mingw32 tofrodos \
python-markdown libxml2-utils xsltproc zlib1g-dev
Also this:
Code:
sudo ln -s /usr/lib/i386-linux-gnu/mesa/libGL.so.1 /usr/lib/i386-linux-gnu/libGL.so
Now Configure your USB.
Code:
gksudo gedit /etc/udev/rules.d/51-android.rules
A blank text will open and now add this code and save:
Code:
#Acer
SUBSYSTEM=="usb", ATTR{idVendor}=="0502", MODE="0666"
#ASUS
SUBSYSTEM=="usb", ATTR{idVendor}=="0b05", MODE="0666"
#Dell
SUBSYSTEM=="usb", ATTR{idVendor}=="413c", MODE="0666"
#Foxconn
SUBSYSTEM=="usb", ATTR{idVendor}=="0489", MODE="0666"
#Garmin-Asus
SUBSYSTEM=="usb", ATTR{idVendor}=="091E", MODE="0666"
#Google
SUBSYSTEM=="usb", ATTR{idVendor}=="18d1", MODE="0666"
#HTC
SUBSYSTEM=="usb", ATTR{idVendor}=="0bb4", MODE="0666"
#Huawei
SUBSYSTEM=="usb", ATTR{idVendor}=="12d1", MODE="0666"
#K-Touch
SUBSYSTEM=="usb", ATTR{idVendor}=="24e3", MODE="0666"
#KT Tech
SUBSYSTEM=="usb", ATTR{idVendor}=="2116", MODE="0666"
#Kyocera
SUBSYSTEM=="usb", ATTR{idVendor}=="0482", MODE="0666"
#Lenevo
SUBSYSTEM=="usb", ATTR{idVendor}=="17EF", MODE="0666"
#LG
SUBSYSTEM=="usb", ATTR{idVendor}=="1004", MODE="0666"
#Motorola
SUBSYSTEM=="usb", ATTR{idVendor}=="22b8", MODE="0666"
#NEC
SUBSYSTEM=="usb", ATTR{idVendor}=="0409", MODE="0666"
#Nook
SUBSYSTEM=="usb", ATTR{idVendor}=="2080", MODE="0666"
#Nvidia
SUBSYSTEM=="usb", ATTR{idVendor}=="0955", MODE="0666"
#OTGV
SUBSYSTEM=="usb", ATTR{idVendor}=="2257", MODE="0666"
#Pantech
SUBSYSTEM=="usb", ATTR{idVendor}=="10A9", MODE="0666"
#Philips
SUBSYSTEM=="usb", ATTR{idVendor}=="0471", MODE="0666"
#PMC-Sierra
SUBSYSTEM=="usb", ATTR{idVendor}=="04da", MODE="0666"
#Qualcomm
SUBSYSTEM=="usb", ATTR{idVendor}=="05c6", MODE="0666"
#SK Telesys
SUBSYSTEM=="usb", ATTR{idVendor}=="1f53", MODE="0666"
#Samsung
SUBSYSTEM=="usb", ATTR{idVendor}=="04e8", MODE="0666"
#Sharp
SUBSYSTEM=="usb", ATTR{idVendor}=="04dd", MODE="0666"
#Sony Ericsson
SUBSYSTEM=="usb", ATTR{idVendor}=="0fce", MODE="0666"
#Toshiba
SUBSYSTEM=="usb", ATTR{idVendor}=="0930", MODE="0666"
#ZTE
SUBSYSTEM=="usb", ATTR{idVendor}=="19D2", MODE="0666"
Once you have saved the file type this:
Code:
sudo chmod a+r /etc/udev/rules.d/51-android.rules
Now install your repository:
Type the following:
Code:
mkdir ~/bin
PATH=~/bin:$PATH
curl [url]https://dl-ssl.google.com/dl/googlesource/git-repo/repo[/url] > ~/bin/repo
chmod a+x ~/bin/repo
Now all you have to do is initialize your repository and then make a working folder and sync:
mkdir WORKING_FOLDER
cd WORKING_FOLDER
So lets just say you want to sync and build cm10.1 you need the repo so once you cd into the directory type this:
Code:
repo init -u git://github.com/CyanogenMod/android.git -b cm-10.1
While that runs in the terminal it is going to ask you to put in your name and email address.
Once all thats done just type:
Code:
repo sync
And your good to go. Thats where I stop for now. Any questions just ask.
How to build a sense kernel from source
Judging that you are reading this and going to try and build a kernel make sure you have looked at the previous posts above as they may be needed to complete this task.
Below is the readme from htc dev's website. But why do all this work. Lets use Linux and bash scripts to our advantage.
Code:
defconfig file: m7wls_defconfig (arm-eabi-4.6)
Download:
=========
If you are not already using an AOSP toolchain (included in an AOSP build tree), download the corresponding official android toolchain for the arm-eabi specified above for this device:
git clone [url]https://android.googlesource.com/platform/prebuilt[/url] for 4.4.3
git clone [url]https://android.googlesource.com/platform/prebuilts/gcc/linux-x86/arm/arm-eabi-4.6[/url] for 4.6
(use darwin-x86 in place of linux-x86 for mac)
Build the kernel:
=================
set the following environment variables:
export TOP= [where you installed the toolchain or top of android AOSP code base]
export PATH=$TOP/prebuilts/gcc/linux-x86/arm/arm-eabi-4.6/bin:$PATH (use corresponding arm-eabi bin path)
export ARCH=arm
export SUBARCH=arm
export CROSS_COMPILE=arm-eabi-
make [the defconfig file for this device above]
make clean (for subsequent builds)
make -j4 (in this example 4 is the number of processors of your build machine)
Output Binary Files:
====================
After the build process is finished, there should be a file named "zImage" found in arch/arm/boot/
If you are building a rom with this kernel ZImage, copy it into your build's output folder and rename it to "kernel".
You will also need the following kernel modules. These will eventually be installed into /system/lib/modules on the device.
kernel modules:
./driver/*.ko
The only thing I will ask you to get are the following.
-Download the source from htcdev.
-Get your toolchain and put it in your desired folder. Do that with this command.
**On a sidenote you need to know your devices defconfig and what toolchain your device uses. (This is given on the top of the readme as per the one above.)**
Code:
git clone https://android.googlesource.com/platform/prebuilts/gcc/linux-x86/arm/arm-eabi-4.6"
-for me I put the toolchain in my directory like this. It is different for each toolchain and device. It doesn't matter. /android/kernel/**toolchain**. That's where the extracted toolchain is.
-Next step open a file and add the following text. Make sure the file is executable so you can run it. Add this....
echo "~m7wls STOCK KERNEL COMPILER~"
cd Kernel-m7wls
export ARCH=arm CROSS_COMPILE=/android/kernel/toolchain/arm-eabi-4.6/bin/arm-eabi-4.6-
echo "Cleaning up source"
make clean && make mrproper
date +%Y%m%d%H%M > CURRENT_VERSION
echo "Making config"
make m7wls_defconfig
echo "Adding Current Version to Kernel"
cp CURRENT_VERSION .version
echo "Building Kernel"
make -j4
echo "Kernel ready"
cp -f arch/arm/boot/zImage /android/kernel/htcone/STOCK-m7wls/zImage
echo "Copying modules"
rm -f /android/kernel/htcone/STOCK-m7wls/boot.img-ramdisk/lib/modules/*
find . -name "*.ko" -exec cp {} /android/kernel/htcone/STOCK-m7wls/boot.img-ramdisk/lib/modules/ \;
cd /android/kernel/htcone/STOCK-m7wls/boot.img-ramdisk/lib/modules/
for i in $(find . | grep .ko | grep './')
do
echo $i
/android/kernel/toolchain/arm-eabi-4.6/bin/arm-eabi-4.6-strip --strip-unneeded $i
done
echo "Stripped Modules"
echo "All done,Press Enter to Quit"
read ANS
Click to expand...
Click to collapse
-This is a quick script that does all the work for me. No need to add paths, etc. As long as your folders and filed match the paths of the script all will be ok. Now this script will have to be edited to suite your computer and the destinations of your kernel folders.
-Now once the script is fully correct and everything is setup just cd to the directory your script is in and type the following assuming your file name is m7wls type:
Code:
./m7wls
Once the script has fully run. It should take a while in the folders I made you should see zImage and kernel modules. From there you will need to know how to pack the kernel.
Notice if you downloaded sprints htc one kernel source the source is named m7wls-jb-crc-3.4.10-eb45596. I changed this to just m7wls to make it easier for the script.
Finally, remember you will have to make directories to suit the script for example this line "rm -f /android/kernel/htcone/STOCK-m7wls/boot.img-ramdisk/lib/modules/*" this is where the modules go "*" but I had to make these folders first boot.img-ramdisk/lib/modules/.
If you followed my instructions and did your own fooling around you should have a sense kernel built from source. This is not for beginners. If you have any questions just ask. Message me if you really need some more help.
Happy Building!
Reserved just in case.
Im gonna feel tempted for one more if i really want to add to more.
Is anyone finding this guide useful??
Sent from my HTCONE using xda premium
Project Developer IV
Welcome
This is a guide for all those who want to build for their Xperia 2011 Devices but do not neccesasarily have the knowledge or experience.
This is an unofficial guide for the building of custom ROMs and other mods for the Xperia 2011 Devices. This is a work in progress, with additions being made as often as possible. This thread has already grown with the help of the devs established in this forum. BMP777 began this project a year ago when I was using a Samsung GS II Skyrocket. BMP777 started another alike thread called PR II in the LGOG forum a while back as well. I have since moved on to a ONE, but both threads remain to this day. The point is this: everyone who uses this site has a desire for modding, customizing, and/or otherwise altering their device. Unfortunately, many have no idea how to go about doing these things for themselves. As such, there is a lot of dissatisfaction among developers about receiving constant demands, suggestions, and requests for updates. This thread is meant to give those who want to step up and build for themselves the means to do so. It is an ever-changing thread, with all assistance welcomed.
READ ME:
On one hand, it should go without saying that if you have no knowledge and/or experience with building, java, C++, and various other tools, you probably shouldn't begin here. At the same time, it is possible to learn to build, provided you can read, follow directions, and aren't too lazy to RESEARCH.
OH YEAH, and you better have patience. This isn't easy. It will be work. The quickest way to get flamed is to show yourself to be lazy. If you think that with a couple clicks, you can have your own flashy ROM, forget it. But, if you do want to learn, this is a good place to get started. I have no ego about this; I started the same way and just want to help everyone learn to build their own ROM. But, everyone will struggle to get to a successful point, and lazy, unmotivated people just irritate those who have had to learn from scratch too. Tutorials will be posted for any new thing learned and built as time and space allow. ALL ARE WELCOME AND ALL QUESTIONS ARE TOO. But, seriously, if it's a really ridiculous one, I/we reserve the right to screw with you about it.
ALWAYS REMEMBER:
{
"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"
}
Thread Disclaimer:
The instructions and extras posted here are to be used at your own risk. I am working hard to provide good, workable tutorials that will make successful building much easier. Nevertheless, I am not responsible if you lose your files, brick your device, or inadvertently cause a nuclear war. If you are seeking absolute perfection, RUN NOW WHILE YOU STILL CAN!!
Thread Navigation :
# 2 > Setting Up Build enviorment
# 3 > Building instructions & How To Build Using Linaro 4.8 Toolchain
# 4 > Necessary Fixes for Xperia 2011 Line UP
# 5 > Kernel building and CCACHE
# 6 > reserved for future
XDA:DevDB Information
Project Developer, a Tool/Utility for the Sony Ericsson Xperia Arc
Contributors
officiallysonyrebel, car vs driver , BMP777, Mikeioannina and My buddys vishal_android_freak , saki3d , besttt and YOU
Version Information
Status: Testing
Created 2013-11-29
Last Updated 2013-12-03
Build Enviorment Set up :
This is a combination of the steps offered in the threads 'Compile JB on Ubuntu' and TeamChopsticks CyanogenMod.
Special thanks to dastin1015 and TeamChopsticks.
Tip: Allocate at least 75 gigs of space for the building of ONE ROM. If you install ccache, you will want 90. A complete build directory can use as much as 100 gigs, so make sure you have plenty of room. One of the ways to fail out a build is too use all of your partition before acquiring all the necessary files.
Here are the steps from those 2 tutorials in correct order:
0.1 ))
Install Gedit
Code:
# gedit
sudo apt-get install gedit
1) You need the following:
-JDK 6 if you wish to build Jellybean.
Code:
[COLOR="Black"]$ sudo apt-get oracle-java7-installer
-Python 2.4 -- 2.7, which you can download from python.org.[/COLOR]
Or:
Code:
[COLOR="black"]$ sudo apt-get install python
-Git 1.7 or newer. You can find it at git-scm.com.[/COLOR]
Or:
Code:
[COLOR="black"]$ sudo apt-get install git-core[/COLOR]
-Android SDK:
Download the SDK here: http://developer.android.com/sdk/index.html
Extract the SDK and place it in your home directory.
I renamed my SDK to android-sdk to make it easier to navigate to – this tutorial assumes you've done that as well.
Go to your home folder, press Ctrl+H to show hidden files, and open up your .bashrc file.
Add these lines at the bottom of the file:
Code:
[COLOR="black"]# Android tools
export PATH=${PATH}:~/android-sdk/tools
export PATH=${PATH}:~/android-sdk/platform-tools
export PATH=${PATH}:~/bin[/COLOR]
Find your .profile file and add this at the bottom of the file:
Code:
[COLOR="black"]PATH="$HOME/android-sdk/tools:$HOME/android-sdk/platform-tools:$PATH"
You have now successfully installed the Android SDK.[/COLOR]
To check for updates issue this into your terminal:
Code:
[COLOR="black"]$ android[/COLOR]
2) Install required packages. 64-bit (recommended)
Code:
[COLOR="black"]$ sudo apt-get install git-core gnupg flex bison gperf build-essential
zip curl zlib1g-dev libc6-dev lib32ncurses5-dev ia32-libs
x11proto-core-dev libx11-dev lib32readline-gplv2-dev lib32z-dev
libgl1-mesa-dev g++-multilib mingw32 tofrodos python-markdown
libxml2-utils lzop schedtool[/COLOR]
On newer versions of Ubuntu such as 11.10 you may need to do the following:
Code:
[COLOR="black"]$ sudo ln -s /usr/lib/i386-linux-gnu/libX11.so.6 /usr/lib/i386-linux-gnu/libX11.so[/COLOR]
Code:
[COLOR="black"]$ sudo apt-get install git-core gnupg flex bison gperf build-essential
zip curl libc6-dev libncurses5-dev:i386 x11proto-core-dev
libx11-dev:i386 libreadline6-dev:i386 libgl1-mesa-glx:i386
libgl1-mesa-dev g++-multilib mingw32 openjdk-6-jdk tofrodos
python-markdown libxml2-utils xsltproc zlib1g-dev:i386
$ sudo ln -s /usr/lib/i386-linux-gnu/mesa/libGL.so.1 /usr/lib/i386-linux-gnu/libGL.so[/COLOR]
3) Configure your USB.
Code:
[COLOR="black"]$ gksudo gedit /etc/udev/rules.d/51-android.rules[/COLOR]
Inside of this blank text file insert:
Code:
[COLOR="black"]#Acer
SUBSYSTEM=="usb", ATTR{idVendor}=="0502", MODE="0666"
#ASUS
SUBSYSTEM=="usb", ATTR{idVendor}=="0b05", MODE="0666"
#Dell
SUBSYSTEM=="usb", ATTR{idVendor}=="413c", MODE="0666"
#Foxconn
SUBSYSTEM=="usb", ATTR{idVendor}=="0489", MODE="0666"
#Garmin-Asus
SUBSYSTEM=="usb", ATTR{idVendor}=="091E", MODE="0666"
#Google
SUBSYSTEM=="usb", ATTR{idVendor}=="18d1", MODE="0666"
#HTC
SUBSYSTEM=="usb", ATTR{idVendor}=="0bb4", MODE="0666"
#Huawei
SUBSYSTEM=="usb", ATTR{idVendor}=="12d1", MODE="0666"
#K-Touch
SUBSYSTEM=="usb", ATTR{idVendor}=="24e3", MODE="0666"
#KT Tech
SUBSYSTEM=="usb", ATTR{idVendor}=="2116", MODE="0666"
#Kyocera
SUBSYSTEM=="usb", ATTR{idVendor}=="0482", MODE="0666"
#Lenevo
SUBSYSTEM=="usb", ATTR{idVendor}=="17EF", MODE="0666"
#LG
SUBSYSTEM=="usb", ATTR{idVendor}=="1004", MODE="0666"
#Motorola
SUBSYSTEM=="usb", ATTR{idVendor}=="22b8", MODE="0666"
#NEC
SUBSYSTEM=="usb", ATTR{idVendor}=="0409", MODE="0666"
#Nook
SUBSYSTEM=="usb", ATTR{idVendor}=="2080", MODE="0666"
#Nvidia
SUBSYSTEM=="usb", ATTR{idVendor}=="0955", MODE="0666"
#OTGV
SUBSYSTEM=="usb", ATTR{idVendor}=="2257", MODE="0666"
#Pantech
SUBSYSTEM=="usb", ATTR{idVendor}=="10A9", MODE="0666"
#Philips
SUBSYSTEM=="usb", ATTR{idVendor}=="0471", MODE="0666"
#PMC-Sierra
SUBSYSTEM=="usb", ATTR{idVendor}=="04da", MODE="0666"
#Qualcomm
SUBSYSTEM=="usb", ATTR{idVendor}=="05c6", MODE="0666"
#SK Telesys
SUBSYSTEM=="usb", ATTR{idVendor}=="1f53", MODE="0666"
#Samsung
SUBSYSTEM=="usb", ATTR{idVendor}=="04e8", MODE="0666"
#Sharp
SUBSYSTEM=="usb", ATTR{idVendor}=="04dd", MODE="0666"
#Sony Ericsson
SUBSYSTEM=="usb", ATTR{idVendor}=="0fce", MODE="0666"
#Toshiba
SUBSYSTEM=="usb", ATTR{idVendor}=="0930", MODE="0666"
#ZTE
SUBSYSTEM=="usb", ATTR{idVendor}=="19D2", MODE="0666"[/COLOR]
4) Save the file and close it and then issue this command:
Code:
[COLOR="black"]$ sudo chmod a+r /etc/udev/rules.d/51-android.rules[/COLOR]
5) Install the repo:
Code:
[COLOR="black"]$ mkdir ~/bin
$ PATH=~/bin:$PATH
$ curl https://dl-ssl.google.com/dl/googlesource/git-repo/repo > ~/bin/repo
$ chmod a+x ~/bin/repo[/COLOR]
Create your work directory:
Code:
[COLOR="black"]mkdir ~/"your directory name here" For example: mkdir ~/cm10
cd ~/cm10[/COLOR]
Setup local manifest:
Code:
[COLOR="Black"]mkdir .repo/local_manifests
touch .repo/local_manifests/semc.xml
gedit .repo/local_manifests/semc.xml[/COLOR]
Necessary Files for Xperia 2011 :
Tip :For Building any Rom for Xperia 2011 devices u need these specific device files
1 . first is "semc.xml"
2. second is "patches"
you can find correct SEMC.xml here : [thanks to @mikeioannina for maintaining our device Sources
===================================================================================
===================================================================================
For KitKat 4.4.x
* Patch #1 Fix semc camera preview
Code:
git fetch http://review.cyanogenmod.org/CyanogenMod/android_frameworks_av refs/changes/82/54582/1 && git cherry-pick FETCH_HEAD
* Patch #2 Allow devices to disable fence sync
Code:
git fetch http://review.cyanogenmod.org/CyanogenMod/android_frameworks_native refs/changes/94/52994/3 && git cherry-pick FETCH_HEAD
* Patch #3 Backwards compatibility with old EGL
Code:
git fetch http://review.cyanogenmod.org/CyanogenMod/android_frameworks_native refs/changes/57/54257/4 && git cherry-pick FETCH_HEAD
* Patch #4 Bring back support for mHeap-based screenshots
Code:
git fetch http://review.cyanogenmod.org/CyanogenMod/android_frameworks_native refs/changes/62/53162/5 && git cherry-pick FETCH_HEAD
*Patch No. 5 # SoftapControllerTI: update parameters for setSoftap
Code:
git fetch http://review.cyanogenmod.org/CyanogenMod/android_system_netd refs/changes/05/55805/1 && git cherry-pick FETCH_HEAD
====================== DO NOT USE IT - I M WARNING or u will get ERRORS ==========================
Aditonal Patch #5 Use AOSP version of wpa_supplicant_lib
Code:
git fetch http://review.cyanogenmod.org/CyanogenMod/android_hardware_ti_wlan refs/changes/89/54289/2 && git cherry-pick FETCH_HEAD
====================================================
Building Instructions : For CyanogenMod :: AOKP :: Carbon roms :: Beanstalk
Unofficial
thanks mikeioannia for initial CM guide
To get started with Android/CyanogenMod, you'll need to get familiar with Git and Repo.
To initialize your local repository using the CyanogenMod trees, use a command like this:
first create folder named " cm "
Code:
mkdir cm
enter into cm
Code:
cd ~/cm
For CM - 11.0 kitkat 4.4.x
Code:
[COLOR="black"]repo init -u git://github.com/CyanogenMod/android.git -b cm-11.0[/COLOR]
Then to sync up:
Code:
[COLOR="black"]repo sync[/COLOR]
Please see the CyanogenMod Wiki for building instructions.
For more information on this Github Organization and how it is structured, please read the wiki article.
Create and edit semc.xml in .repo:
Code:
[COLOR="black"]gedit .repo/local_manifests/semc.xml[/COLOR]
Add this to the semc.xml:
For CM 11.0 KitKat 4.4.x
copy paste semc.xml for kikat 4.4 from here : https://raw.github.com/LegacyXperia/local_manifests/cm-11.0/semc.xml
then
Code:
[COLOR="Black"]repo sync[/COLOR]
For 4.4 apply patches from 4.4
1.
Code:
cd ~/cm/frameworks/av
-> copy paste patch #1 press enter
2.
Code:
cd ~/cm/frameworks/native
-> copy paste patch #2 press enter
-> copy paste patch #3 press enter
-> copy paste patch #4 press enter
3.
Code:
cd ~/cm/system/netd
-> copy paste patch #5 press enter
Code:
[COLOR="black"]. build/envsetup.sh (notice the period and space)
vendor/cm/get-prebuilts
[/COLOR]
then
Code:
brunch <device>
Special thanks to scott.hart.bti for his hard work -
From terminal
1. type
Code:
[COLOR="black"]cd[/COLOR]
.
This will bring you to your root folder.
2. type
Code:
[COLOR="black"]mkdir beanstalk[/COLOR]
.
This will create a folder named beanstalk.
3. type
Code:
[COLOR="black"]cd beanstalk[/COLOR]
.
This will take you to the beanstalk directory created from previous step
4. type
Code:
[COLOR="black"]repo init -u git://github.com/scotthartbti/android.git -b kk44[/COLOR]
.
This will setup the folders to be synced.
5. For Beanstalk KitKat 4.4.x
copy paste semc.xml for kikat 4.4 from here : https://raw.github.com/LegacyXperia/local_manifests/cm-11.0/semc.xml
then
Code:
[COLOR="Black"]repo sync[/COLOR]
apply patches for 4.4
1.
Code:
cd ~/beanstalk/frameworks/av
-> copy paste patch #1 press enter
2.
Code:
cd ~/beanstalk/frameworks/native
-> copy paste patch #2 press enter
-> copy paste patch #3 press enter
-> copy paste patch #4 press enter
2.
Code:
cd ~/beanstalk/system/netd
-> copy paste patch #5 press enter
9. Outside of terminal, navigate to beanstalk/vendor/cm. Double click on the get-prebuilts file and select run in terminal. This will fetch necessary files needed to build and place them where they need to be.
10. Type
Code:
[COLOR="Black"]. build/envsetup.sh && brunch <device>[/COLOR]
11. Previous step will start building beanstalk for your device. The process takes anywhere from 1 - 3 hours depending on your computer.
12. Once completed, it will say package complete and you will have a beanstalk named zip file in your out folder.
Unofficial
Special thanks to spleef and ktempleman for laying this out
This set of instructions is unverified. If you build successfully or have build issues, please post here so we can confirm or fix what isn't working
First:
Code:
[COLOR="Black"]mkdir aokp[/COLOR]
then
Code:
[COLOR="black"]cd aokp[/COLOR]
then
Code:
[COLOR="black"]repo init -u https://github.com/AOKP/platform_manifest.git -b kitkat[/COLOR]
after it does its thing
Code:
[COLOR="black"]mkdir .repo/local_manifests
touch .repo/local_manifests/semc.xml
gedit .repo/local_manifests/semc.xml[/COLOR]
copy paste semc.xml for kikat 4.4 from here : https://raw.github.com/LegacyXperia/local_manifests/cm-11.0/semc.xml
save and exit then
Code:
[COLOR="black"]repo sync[/COLOR]
after everything syncs
apply patches for 4.4
1.
Code:
cd ~/aokp/frameworks/av
-> copy paste patch #1 press enter
2.
Code:
cd ~/aokp/frameworks/native
-> copy paste patch #2 press enter
-> copy paste patch #3 press enter
-> copy paste patch #4 press enter
2.
Code:
cd ~/aokp/system/netd
-> copy paste patch #5 press enter
Code:
[COLOR="black"]gedit vendor/aokp/vendorsetup.sh[/COLOR]
and add this to the bottom:
Code:
[COLOR="black"]add_lunch_combo aokp_device-userdebug[/COLOR]
save and exit.. then
Code:
[COLOR="black"]. build/envsetup.sh[/COLOR]
Code:
[COLOR="black"]brunch device[/COLOR]
For more on AOKP building, try here: http://aokp.co/learn/so-you-want-to-build-aokp-jb-ubuntu-1204
And Here: https://github.com/AOKP
Unofficial
Getting Started
To get started with the Carbon-Dev sources, you'll need to get familiar with Git and Repo.
Create the Directories
You will need to set up some directories in your build environment.
To create them run:
Code:
[COLOR="black"]mkdir -p ~/carbon[/COLOR]
Install the Repository
You may need to reboot for these changes to take effect. Now enter the following to initialize the repository:
Code:
[COLOR="black"]cd ~/carbon[/COLOR]
Repositories:
Before you continue --> run this in the terminal
Code:
[COLOR="black"]repo init -u https://github.com/CarbonDev/android.git -b kk[/COLOR]
after it does its thing
Code:
[COLOR="black"]mkdir .repo/local_manifests
touch .repo/local_manifests/semc.xml
gedit .repo/local_manifests/semc.xml[/COLOR]
copy paste semc.xml for kikat 4.4 from here : https://raw.github.com/LegacyXperia/local_manifests/cm-11.0/semc.xml
save and exit then
Code:
[COLOR="black"]repo sync[/COLOR]
after everything syncs
apply patches for 4.4
1.
Code:
cd ~/carbon/frameworks/av
-> copy paste patch #1 press enter
2.
Code:
cd ~/carbon/frameworks/native
-> copy paste patch #2 press enter
-> copy paste patch #3 press enter
-> copy paste patch #4 press enter
3.
Code:
cd ~/carbon/system/netd
-> copy paste patch #5 press enter
Code:
[COLOR="black"]gedit vendor/carbon/vendorsetup.sh[/COLOR]
and add this to the bottom:
Code:
[COLOR="black"]add_lunch_combo carbon_device-userdebug[/COLOR]
save and exit.. then
Code:
[COLOR="black"]. build/envsetup.sh[/COLOR]
Code:
[COLOR="black"]brunch device[/COLOR]
To get started with AORP, you'll need to get familiar with Git and Repo.
To initialize your local repository using the AORP trees, use a command like this:
first create folder named " AORP "
Code:
mkdir AORP
enter into AORP
Code:
cd ~/AORP
For kitkat 4.4.x
Code:
[COLOR="black"]repo init -u git://github.com/AORP/android.git -b kk[/COLOR]
Then to sync up:
Code:
[COLOR="black"]repo sync[/COLOR]
Please see the CyanogenMod Wiki for building instructions.
For more information on this Github Organization and how it is structured, please read the wiki article.
Create and edit semc.xml in .repo:
Code:
[COLOR="black"]gedit .repo/local_manifests/semc.xml[/COLOR]
Add this to the semc.xml:
For CM 11.0 KitKat 4.4.x
copy paste semc.xml for kikat 4.4 from here : https://raw.github.com/LegacyXperia/local_manifests/cm-11.0/semc.xml
then
Code:
[COLOR="Black"]repo sync[/COLOR]
For 4.4 apply patches from 4.4
1.
Code:
cd ~/AORP/frameworks/av
-> copy paste patch #1 press enter
2.
Code:
cd ~/AORP/frameworks/native
-> copy paste patch #2 press enter
-> copy paste patch #3 press enter
-> copy paste patch #4 press enter
3.
Code:
cd ~/AORP/system/netd
-> copy paste patch #5 press enter
Code:
[COLOR="black"]. build/envsetup.sh (notice the period and space)
vendor/cm/get-prebuilts
[/COLOR]
then
Code:
brunch <device>
Next Tutorial is Strictly Not for beginners
Building with Linaro 4.8 toolchain
Checkout these toolchains customised for arm v7 and scorpion Cpu here http://forum.xda-developers.com/showthread.php?t=2098133
thanks @Christopher83
Go into Terminal and navigate to the root folder of your source tree, then:
Code:
[COLOR="Black"]prebuilts/gcc/linux-x86/arm/[/COLOR]
Run:
Code:
[COLOR="black"]wget http://releases.linaro.org/13.06/components/toolchain/gcc-linaro/4.8/gcc-linaro-4.8-2013.06.tar.bz2[/COLOR]
Run:
Code:
[COLOR="black"]bunzip2 *.tar.bz2[/COLOR]
Run:
Code:
[COLOR="black"]tar -xvf *.tar[/COLOR]
Using your file manager, navigate to the root folder of your source tree again.
Navigate To "/build", in your root folder.
Run:
Code:
[COLOR="black"]gksudo gedit envsetup.sh[/COLOR]
change the line in bold, to look exactly like this one:
Code:
[COLOR="black"]case $ARCH in
x86) toolchaindir=x86/i686-linux-android-4.6/bin
;;
[B]arm) toolchaindir=arm/gcc-linaro-4.8-2013.06[/B] [COLOR="Red"]<--------[/COLOR]
;;
mips) toolchaindir=mips/mipsel-linux-android-4.6/bin
;;
*)
echo "Can't find toolchain for unknown architecture: $ARCH"
toolchaindir=xxxxxxxxx
;;
esac
[/COLOR]
Exit out and open new. Initialize and build. That's it! Makes you wonder why you never did it before, right?
Not so fast. You may have build issues, you may not. I had a few lengthy sets of errors in gsm calltracker and another .java file that was solved by using Meld and making it look exactly like a successful build's file. More as I learn.......
Thanks to infected_ for this tut; his post can be found here: [/COLOR]
http://forum.xda-developers.com/showpost.php?p=42976693&postcount=12
This is a work in progress. Many more pieces of information will be added and this is meant to be an ever-changing thread. If you see something that is outdated or incorrect, please let me know ASAP, so I can make the correction. Also, make sure that any info offered can be and has been confirmed as functional.
Thanks to:
CyanogenMod
scott.hart.bti
Team Carbon
david279
MallardDuck
ktempleton
AdhvanIt
matthew0776
spleef
M4570D0N
car vs driver
mikeioannina
BMP777
Kernel Building and Ccache
Building your first kernel
(this is non-device-specific; tweaks will be required to produce an M7SPR kernel) :
This is a set of steps to get you building your first kernel. Special thanks to thewadegeek for putting this tutorial together. His thread can be found here: http://forum.xda-developers.com/showthread.php?t=1748297
Step 1. Build Environment
A. Install Ubuntu 12.04(Not holding your hand here, if you can't do this you shouldn't be messing with kernels)
B. Required packages: git-core, gnupg, flex, bison, gperf, libsdl-dev, libesd0-dev, libwxgtk2.6-dev, build-essential, zip, curl, libncurses5-dev, zlib1g-dev, ia32-libs, lib32z1-dev, lib32ncurses5-dev, gcc-multilib, g++-multilib, and Adb.
C. Open a terminal
D. Type
Code:
[COLOR="black"]mkdir android[/COLOR]
E. Type
Code:
[COLOR="black"]cd android[/COLOR]
G.Type
Code:
[COLOR="black"]mkdir kernel[/COLOR]
Step 2. Your Source
A. Open your Terminal Prompt
B. Type
Code:
[COLOR="black"]cd android/kernel[/COLOR]
C. Type
Code:
[COLOR="black"]git clone git://github.com/DooMLoRD/android_prebuilt_toolchains.git toolchains[/COLOR]
D. Now comes the tricky part, you need to have some-type of source for your kernel. Check the following two sites for your device as appropriate. Once you have it download it is extracted/cloned into a folder in your kernel directory.
http://developer.sonymobile.com/wpor...ads/opensource
Step 3. Modifications
This is the part people are curious about, they want to make modifications to the kernel to make it "special". Start all these from the root directory of your kernel source.
Mod 1. Applying a patch
A. Download the patch you wish to apply, in this case this one should work.
B. Save that file as "kernelPatch" in your kernel directory.
C. Open a Terminal
D. Move into the root directory of the kernel you wish to patch.
E. Type
Code:
[COLOR="black"]patch -p1 < ../kernelPatch[/COLOR]
Mod 2. Adding a Governor Alone
A. Open "drivers/cpufreq/Kconfig"
B. Add the following lines in appropriate spot amongst the other govenor's
Code:
[COLOR="Black"]config CPU_FREQ_DEFAULT_GOV_SMARTASS
bool "smartass"
select CPU_FREQ_GOV_SMARTASS
select CPU_FREQ_GOV_PERFORMANCE
help
Use the CPUFreq governor 'smartass' as default.
[/COLOR]
Code:
[COLOR="Black"]config CPU_FREQ_GOV_SMARTASS
tristate "'smartass' cpufreq governor"
depends on CPU_FREQ
help
smartass' - a "smart" optimized governor!
If in doubt, say N.[/COLOR]
C. Open "drivers/cpufreq/Makefile"
D. Add the following line in the appropriate spot.
Code:
[COLOR="Black"] obj-$(CONFIG_CPU_FREQ_GOV_SMARTASS) += cpufreq_smartass.o[/COLOR]
E. Create a file called "drivers/cpufreq/cpufreq_smartass.c"
F. Put the following code in that file.
http://pastebin.com/f0Bk9kVZ
G. open "include/linux/cpufreq.h"
H. Under the "Cpufreq Default" section add
Code:
[COLOR="Black"]#elif defined(CONFIG_CPU_FREQ_DEFAULT_GOV_SMARTASS)
extern struct cpufreq_governor cpufreq_gov_smartass;
#define CPUFREQ_DEFAULT_GOVERNOR (&cpufreq_gov_smartass)[/COLOR]
Ok there is a governor added, do the exact same steps for any other one's you would like to add.
Step 4. Getting a Config file
Option A. Pulling a config file from a kernel.
A. Hook up a device that is using a kernel similar to one you are using as your base.
B. Open a terminal
C. Change to your root kernel directory
D. Type
Code:
[COLOR="black"]adb pull /proc/config.gz[/COLOR]
E. Type
Code:
[COLOR="black"]gunzip config.gz[/COLOR]
F. Type
Code:
[COLOR="black"]mv config arch/arm/configs/<your_config_name>_defconfig[/COLOR]
Option B. Using the manufacturers config.
Unfortunately as stated above, not all kernels support the "/proc/config.gz" method. You can typically find a manufacturer's configuration file in "arch/arm/configs". I believe the one for my HTC Flyer was called "flyer_hc_defconfig", so look for a layout similar to that one. Also read the README to get a better idea of how to modify it. I would personally make a copy of it called "<your_config_name>_defconfig" and use that as my base.
Step 5. Building
Time to start the real "build" section of this tutorial.
Part A. Pre-build Steps
A. Open terminal and change to the root of your kernel directory
B. Type
Code:
[COLOR="black"]export ARCH=arm[/COLOR]
C. Type
Code:
[COLOR="black"]export CROSS_COMPILE=~/android/kernel/toolchains/arm-eabi-linaro-4.6.2/bin/arm-eabi-[/COLOR]
Part B. The First Build
A. Type
Code:
[COLOR="black"]make <your_config_name>_defconfig[/COLOR]
B. Type
Code:
[COLOR="black"]make menuconfig[/COLOR]
and make the required changes to use any modules you added or similar changes.
C. Type
Code:
[COLOR="black"]make -j<maximum number of jobs>[/COLOR]
Part C. Re-Builds
A. Type
Code:
[COLOR="black"]make clean[/COLOR]
B. Type
Code:
[COLOR="black"]make oldconfig[/COLOR]
C. Type
Code:
[COLOR="black"]make -j<maximum number of jobs>[/COLOR]
Part D. Building Modules
You have two options:
A. Type
Code:
[COLOR="black"]make modules[/COLOR]
B. Type
Code:
[COLOR="black"]make path/to/your/module.ko[/COLOR]
The above steps explained:
Part A.(These steps are required every time you close your terminal and re-open it to build again.)
A. Ok shouldn’t need to explain this.
B. This command sets your target architecture.
C. Defines the path to the toolchain we are going to use to compile our kernel. You can change this to point towards whatever toolchain you have downloaded or feel like using, the way it is currently configured it will use the Linaro toolchain that we downloaded above.
Part B.(These only need to be run the first time you build a kernel.)
A. Load's your configuration file from earlier.
B. Open up a menu to configure your kernel. It will use the config file you loaded in the previous step as a base.
C. Viola start the build. I typically allow 1 job per core, so on my quad core machine I put "make -j4". Just raising that number will not make your build faster, your processor needs to be able to support the number of jobs you are assigning it.
Part C. (Use the command's when you are building any-time outside of the first)
A. This command gets rid of any old/outdated binaries or modules you compiled before, and let's start fresh. I like to run it every I build unless my changes are really small and localized.
B. A very awesome command, it parses through what has changed and only prompts you about new options.
C. See the explanation for the above "Part C.".
Part D.(Use these for just building kernel modules.)
A. This will re-build all modules.
B. Will rebuild just the module you need. Very useful when you need to rebuild a WiFi module.
Step 6. Now what
Ok we have now started our build and we are waiting for it to finish, so there are two possible outcomes:
Outcome A. Build Succeeds
W00t!! You have a kernel built by your self from source. There are a couple things you need in-order to use this kernel on your device any ".ko" modules and the zImage binary. If you pay attention to the output of your compiler then you will see the location of those objects. However the following commands will make your life a bit easier(Thanks Recognized Developer Hacre):
A. Open a terminal
B. Change to your root kernel directory
C. Type
Code:
[COLOR="black"]mkdir ../<your_kernel>_output[/COLOR]
D. Type
Code:
[COLOR="black"]cp arch/arm/boot/zImage ../<your_kernel>_output/zImage[/COLOR]
E. Type
Code:
[COLOR="black"]find . -name "*.ko" -exec cp {} ../<your_kernel>_output \;[/COLOR]
The above steps explained:
A-C. Self-Explanatory
D. Move our kernel binary into our output folder
E. This handy bit of magic finds all ".ko" modules and also copies them into your output file.
You will also need to assemble a kernel image containing a initramfs for your device, along with the kernel binary and such. That however is beyond the scope of this tutorial. To get started though try searching the following phrases.
Code:
[COLOR="Black"]building android kernel image
xda build kernel image
xda unpack boot.img[/COLOR]
Outcome B. Build Fails
Oh dear. It failed. Well guess what...this is going to happen..a LOT. Get used to it, and get used to googling and experimenting with different solutions. The following are some tips that will help you with debugging your issues.
Running a "Clean" build
A. Backup your config file - Type
Code:
[COLOR="black"]cp .config ../backupConfig[/COLOR]
B. Re-run the build process using just your defconfig from earlier.
Limiting Output(Thanks Hacre.)
A. Another good tip is to run "make -j1" to get the error, as it will limit the amount of text you need to scroll through.[/COLOR]
[/CENTER]
Building TWRP recovery - http://forum.xda-developers.com/showthread.php?t=1943625
Building CWM recovery - http://forum.xda-developers.com/showthread.php?t=1866545
Tutorial for CM-11.0 custom kernel coming Soon
CCACHE
Here is a brief tutorial on the installation of Ccache, which can shorten build times drastically :
If you have room on your build system you can speed
your builds up considerably by using ccache. ccache is a compiler
cache. It speeds up re-compilation of C/C++ code by caching
previous compiles and detecting when the same compile is
being done again.
Install it with apt-get:
Code:
[COLOR="Black"]sudo apt-get install ccache[/COLOR]
Set environment vars for Android use:
(I put these exports in my .bashrc)
Code:
[COLOR="Black"]export USE_CCACHE=1
export NDK_CCACHE=ccache[/COLOR]
Set a cache size of 10G for optimal results:
Code:
[COLOR="black"]ccache -M 10G[/COLOR]
Check the status of your cache with the command:
Code:
[COLOR="black"]ccache -s [/COLOR]
Returns:
Code:
[COLOR="black"]
cache directory /home/jocala/.ccache
cache hit 106673
cache miss 18379
called for link 3758
preprocessor error 5
not a C/C++ file 4425
unsupported compiler option 678
no input file 4565
files in cache 36758
cache size 3.2 Gbytes
max cache size 10.0 Gbytes[/COLOR]
[/QUOTE]
Really Useful things
Here are some relevant topics/tutorials/sites:
Download | Ubuntu - www.ubuntu.com/download
Official Ubuntu Documentation: Help for all versions. - https://help.ubuntu.com/
How To Windows Dual Boot: - https://help.ubuntu.com/community/WindowsDualBoot
How To Use The Terminal: Commandline stuff. - https://help.ubuntu.com/community/UsingTheTerminal/
[HOW TO] Beginners Guide to Android ROM Development - http://forum.xda-developers.com/showthread.php?t=1272270 (courtesy of isidromxz)
[Tutorial] Compile JB on Ubuntu - http://forum.xda-developers.com/showthread.php?t=1762641 (courtesy of dastin1015)
[CM10] [PPA] Cyanogenmod Compiler v0.6 - http://forum.xda-developers.com/showthread.php?t=1789190 (courtesy of lithid-cm)
[Wiki] How to: Gerrit - http://wiki.cyanogenmod.com/wiki/Howto:_Gerrit
[Wiki] How to: Git - http://wiki.cyanogenmod.com/wiki/Howto:_Git
[Wiki] How to: Connect to device with SSH - http://wiki.cyanogenmod.com/wiki/Howto:_Connect_to_Device_with_SSH
Here is an easy-to-use page on common Linux commands: - http://www.pixelbeat.org/cmdline.html
Linux Newbie Guide : - http://www.unixguide.net/linux/linuxshortcuts.shtml
Also, Team Chopsticks has a good page with some useful tips as well, located here:
http://www.teamchopsticks.org/p/contributing.html (thanks to bdusmc for the tip)
Here is a link to LIFEHACKER's command line tutorials. Very good stuff!! : http://lifehacker.com/5743814/become-a-command-line-ninja-with-these-time+saving-shortcuts
CyanogenMod git : - https://github.com/CyanogenMod
LegacyXperia git : - https://github.com/LegacyXperia
Original Beanstalk thread : - http://forum.xda-developers.com/showthread.php?t=2091900
Beanstalk git : - https://github.com/scotthartbti?tab=repositories
The Muppets git : - https://github.com/TheMuppets
[/FONT][/CENTER]
Seven
I want you to lock this thread once you have reserved all the posts needed before anyone posts.. We can open it once all tuts are ready
Regards,
vishal_android freak
Thread ready
officiallysonyrebel said:
Building with Linaro 4.8 toolchain
Go into Terminal and navigate to the root folder of your source tree, then:
Code:
[COLOR="Black"]prebuilts/gcc/linux-x86/arm/[/COLOR]
Run:
Code:
[COLOR="black"]wget http://releases.linaro.org/13.06/components/toolchain/gcc-linaro/4.8/gcc-linaro-4.8-2013.06.tar.bz2[/COLOR]
Run:
Code:
[COLOR="black"]bunzip2 *.tar.bz2[/COLOR]
Run:
Code:
[COLOR="black"]tar -xvf *.tar[/COLOR]
Using your file manager, navigate to the root folder of your source tree again.
Navigate To "/build", in your root folder.
Run:
Code:
[COLOR="black"]gksudo gedit envsetup.sh[/COLOR]
change the line in bold, to look exactly like this one:
Code:
[COLOR="black"]case $ARCH in
x86) toolchaindir=x86/i686-linux-android-4.6/bin
;;
[B]arm) toolchaindir=arm/gcc-linaro-4.8-2013.06[/B] [COLOR="Red"]<--------[/COLOR]
;;
mips) toolchaindir=mips/mipsel-linux-android-4.6/bin
;;
*)
echo "Can't find toolchain for unknown architecture: $ARCH"
toolchaindir=xxxxxxxxx
;;
esac
[/COLOR]
Exit out and open new. Initialize and build. That's it! Makes you wonder why you never did it before, right?
Not so fast. You may have build issues, you may not. I had a few lengthy sets of errors in gsm calltracker and another .java file that was solved by using Meld and making it look exactly like a successful build's file. More as I learn.......
Thanks to infected_ for this tut; his post can be found here: [/COLOR]
http://forum.xda-developers.com/showpost.php?p=42976693&postcount=12
Click to expand...
Click to collapse
Building with Linaro 4.8 toolchain doesn't work, gcc-linaro-4.8-2013.06.tar.bz2 is source file, I also tried the following file
Code:
http://releases.linaro.org/13.06/components/android/toolchain/4.8/android-toolchain-eabi-4.8-2013.06-x86.tar.bz2
and modified envsetup.sh but still doesn't work.
SquallATF said:
Building with Linaro 4.8 toolchain doesn't work, gcc-linaro-4.8-2013.06.tar.bz2 is source file, I also tried the following file
Code:
http://releases.linaro.org/13.06/components/android/toolchain/4.8/android-toolchain-eabi-4.8-2013.06-x86.tar.bz2
and modified envsetup.sh but still doesn't work.
Click to expand...
Click to collapse
what error u are getting ..? and have u done everything correctly .?
officiallysonyrebel said:
what error u are getting ..? and have u done everything correctly .?
Click to expand...
Click to collapse
no error,but I see is still used the original compiler via 'ps -x' command, I‘m not sure which setp will use ANDROID_EABI_TOOLCHAIN, and I see another post http://forum.xda-developers.com/showthread.php?t=2330970 about Compile Xperia Z ROM with Linaro, it replaced ndk
SquallATF said:
no error,but I see is still used the original compiler via 'ps -x' command, I‘m not sure which setp will use ANDROID_EABI_TOOLCHAIN, and I see another post http://forum.xda-developers.com/showthread.php?t=2330970 about Compile Xperia Z ROM with Linaro, it replaced ndk
Click to expand...
Click to collapse
try new link which i added in OP for building instructions with Linaro
SquallATF said:
no error,but I see is still used the original compiler via 'ps -x' command, I‘m not sure which setp will use ANDROID_EABI_TOOLCHAIN, and I see another post http://forum.xda-developers.com/showthread.php?t=2330970 about Compile Xperia Z ROM with Linaro, it replaced ndk
Click to expand...
Click to collapse
if you want linaro you have to make some additional commits on kernel
you can look for that commits in here
https://github.com/SlimXperia/msm7x30-3.4.x-nAa
AWSM...!!!
AWSM job OP.....its a dream come true thread for any n00b..was looking for something like this specifically for our SX2011 devices...will try out building roms using this guide...thank u vry much OP:good::laugh::highfive:
Good post, for first I can turn into a bit of development instead of modding\cook. I will do something after my Arc turn into EOL!
Cheers
Enviado desde mi HUAWEI Y300-0100 mediante Tapatalk
SquallATF said:
Building with Linaro 4.8 toolchain doesn't work, gcc-linaro-4.8-2013.06.tar.bz2 is source file, I also tried the following file
Code:
http://releases.linaro.org/13.06/components/android/toolchain/4.8/android-toolchain-eabi-4.8-2013.06-x86.tar.bz2
and modified envsetup.sh but still doesn't work.
Click to expand...
Click to collapse
nice tutor bro...
Patches updated to Latest .. :good: updated build instructions "SlimKat" and "AORP" tutorial SOON
officiallysonyrebel said:
Patches updated to Latest .. :good: updated build instructions "SlimKat" and "AORP" tutorial SOON
Click to expand...
Click to collapse
i PM u bro
try to patch PAC
one more thing while try to use patch 2/3/4 get error
but if u applied just patch 2 its patched without error
Any help?
[email protected]:~/pac/system$ cd ~/pac/system/frameworks/native
[email protected]:~/pac/system/frameworks/native$ git fetch http://review.cyanogenmod.org/CyanogenMod/android_frameworks_native refs/changes/57/54257/4 && git cherry-pick FETCH_HEAD
From http://review.cyanogenmod.org/CyanogenMod/android_frameworks_native
* branch refs/changes/57/54257/4 -> FETCH_HEAD
error: could not apply 1af87c2... DisplayDevice: Backwards compatibility with old EGL
hint: after resolving the conflicts, mark the corrected paths
hint: with 'git add <paths>' or 'git rm <paths>'
hint: and commit the result with 'git commit'
[email protected]:~/pac/system/frameworks/native$ git fetch http://review.cyanogenmod.org/CyanogenMod/android_frameworks_native refs/changes/62/53162/5 && git cherry-pick FETCH_HEAD
From http://review.cyanogenmod.org/CyanogenMod/android_frameworks_native
* branch refs/changes/62/53162/5 -> FETCH_HEAD
error: 'cherry-pick' is not possible because you have unmerged files.
hint: Fix them up in the work tree,
hint: and then use 'git add/rm <file>' as
hint: appropriate to mark resolution and make a commit,
hint: or use 'git commit -a'.
fatal: cherry-pick failed
[email protected]:~/pac/system/frameworks/native$ git fetch http://review.cyanogenmod.org/CyanogenMod/android_frameworks_native refs/changes/94/52994/3 && git cherry-pick FETCH_HEAD
From http://review.cyanogenmod.org/CyanogenMod/android_frameworks_native
* branch refs/changes/94/52994/3 -> FETCH_HEAD
error: 'cherry-pick' is not possible because you have unmerged files.
hint: Fix them up in the work tree,
hint: and then use 'git add/rm <file>' as
hint: appropriate to mark resolution and make a commit,
hint: or use 'git commit -a'.
fatal: cherry-pick failed
Click to expand...
Click to collapse
3andala said:
i PM u bro
try to patch PAC
one more thing while try to use patch 2/3/4 get error
but if u applied just patch 2 its patched without error
Any help?
Click to expand...
Click to collapse
there are some conflicts with patches and PAC sources u need to resolve these conflicts
first apply patch when it shows error
type
Code:
git commit -a
and got to pathced files
and fined these symabols
Code:
>>>>>> or ======
delete it..!!
it is easy method
and in someplaces u need to see which code should be kept and which should be deleted but these lines
Code:
>>>>>> or ======
should be deleted ..
best of luck!
keep devloping
Project Developer
Welcome
This is a guide for all those who want to build for their Xperia Z Device but do not neccesasarily have the knowledge or experience.
This is an unofficial guide for the building of custom ROMs and other mods for the Xperia Z. This is a work in progress, with additions being made as often as possible. This thread has already grown with the help of the devs established in this forum. BMP777 began this project a year ago when I was using a Samsung GS II Skyrocket. BMP777 started another alike thread called PR II in the LGOG forum a while back as well. I have since moved on to a ONE, but both threads remain to this day. and Started by Me on Xperia Arc The point is this: everyone who uses this site has a desire for modding, customizing, and/or otherwise altering their device. Unfortunately, many have no idea how to go about doing these things for themselves. As such, there is a lot of dissatisfaction among developers about receiving constant demands, suggestions, and requests for updates. This thread is meant to give those who want to step up and build for themselves the means to do so. It is an ever-changing thread, with all assistance welcomed.
READ ME:
On one hand, it should go without saying that if you have no knowledge and/or experience with building, java, C++, and various other tools, you probably shouldn't begin here. At the same time, it is possible to learn to build, provided you can read, follow directions, and aren't too lazy to RESEARCH.
OH YEAH, and you better have patience. This isn't easy. It will be work. The quickest way to get flamed is to show yourself to be lazy. If you think that with a couple clicks, you can have your own flashy ROM, forget it. But, if you do want to learn, this is a good place to get started. I have no ego about this; I started the same way and just want to help everyone learn to build their own ROM. But, everyone will struggle to get to a successful point, and lazy, unmotivated people just irritate those who have had to learn from scratch too. Tutorials will be posted for any new thing learned and built as time and space allow. ALL ARE WELCOME AND ALL QUESTIONS ARE TOO. But, seriously, if it's a really ridiculous one, I/we reserve the right to screw with you about it.
ALWAYS REMEMBER:
{
"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"
}
Thread Disclaimer:
The instructions and extras posted here are to be used at your own risk. I am working hard to provide good, workable tutorials that will make successful building much easier. Nevertheless, I am not responsible if you lose your files, brick your device, or inadvertently cause a nuclear war. If you are seeking absolute perfection, RUN NOW WHILE YOU STILL CAN!!
Thread Navigation :
# 2 > Setting Up Build enviorment
# 3 > Building instructions & How To Build Using Linaro Toolchain
# 4 > Kernel building and CCACHE
# 5 > reserved for future
XDA:DevDB Information
Project Developer, a Tool/Utility for the Sony Xperia Z
Contributors
officiallysonyrebel, car vs driver , BMP777, @Saki3d , @FXP , @kali , @codeworkx , @cdesai
Version Information
Status: Testing
Created 2013-11-29
Last Updated 2013-12-03
Build Enviorment Set up :
This is a combination of the steps offered in the threads 'Compile JB on Ubuntu' and TeamChopsticks CyanogenMod.
Special thanks to dastin1015 and TeamChopsticks.
Tip: Allocate at least 75 gigs of space for the building of ONE ROM. If you install ccache, you will want 90. A complete build directory can use as much as 100 gigs, so make sure you have plenty of room. One of the ways to fail out a build is too use all of your partition before acquiring all the necessary files.
Here are the steps from those 2 tutorials in correct order:
0.1 ))
Install Gedit
Code:
# gedit
sudo apt-get install gedit
1) You need the following:
-JDK 6 if you wish to build Jellybean.
Code:
[COLOR="Black"]$ sudo apt-get oracle-java7-installer
-Python 2.4 -- 2.7, which you can download from python.org.[/COLOR]
Or:
Code:
[COLOR="black"]$ sudo apt-get install python
-Git 1.7 or newer. You can find it at git-scm.com.[/COLOR]
Or:
Code:
[COLOR="black"]$ sudo apt-get install git-core[/COLOR]
-Android SDK:
Download the SDK here: http://developer.android.com/sdk/index.html
Extract the SDK and place it in your home directory.
I renamed my SDK to android-sdk to make it easier to navigate to – this tutorial assumes you've done that as well.
Go to your home folder, press Ctrl+H to show hidden files, and open up your .bashrc file.
Add these lines at the bottom of the file:
Code:
[COLOR="black"]# Android tools
export PATH=${PATH}:~/android-sdk/tools
export PATH=${PATH}:~/android-sdk/platform-tools
export PATH=${PATH}:~/bin[/COLOR]
Find your .profile file and add this at the bottom of the file:
Code:
[COLOR="black"]PATH="$HOME/android-sdk/tools:$HOME/android-sdk/platform-tools:$PATH"
You have now successfully installed the Android SDK.[/COLOR]
To check for updates issue this into your terminal:
Code:
[COLOR="black"]$ android[/COLOR]
2) Install required packages. 64-bit (recommended)
Code:
[COLOR="black"]$ sudo apt-get install git-core gnupg flex bison gperf build-essential
zip curl zlib1g-dev libc6-dev lib32ncurses5-dev ia32-libs
x11proto-core-dev libx11-dev lib32readline-gplv2-dev lib32z-dev
libgl1-mesa-dev g++-multilib mingw32 tofrodos python-markdown
libxml2-utils lzop schedtool[/COLOR]
On newer versions of Ubuntu such as 11.10 you may need to do the following:
Code:
[COLOR="black"]$ sudo ln -s /usr/lib/i386-linux-gnu/libX11.so.6 /usr/lib/i386-linux-gnu/libX11.so[/COLOR]
Code:
[COLOR="black"]$ sudo apt-get install git-core gnupg flex bison gperf build-essential
zip curl libc6-dev libncurses5-dev:i386 x11proto-core-dev
libx11-dev:i386 libreadline6-dev:i386 libgl1-mesa-glx:i386
libgl1-mesa-dev g++-multilib mingw32 openjdk-6-jdk tofrodos
python-markdown libxml2-utils xsltproc zlib1g-dev:i386
$ sudo ln -s /usr/lib/i386-linux-gnu/mesa/libGL.so.1 /usr/lib/i386-linux-gnu/libGL.so[/COLOR]
3) Configure your USB.
Code:
[COLOR="black"]$ gksudo gedit /etc/udev/rules.d/51-android.rules[/COLOR]
Inside of this blank text file insert:
Code:
[COLOR="black"]#Acer
SUBSYSTEM=="usb", ATTR{idVendor}=="0502", MODE="0666"
#ASUS
SUBSYSTEM=="usb", ATTR{idVendor}=="0b05", MODE="0666"
#Dell
SUBSYSTEM=="usb", ATTR{idVendor}=="413c", MODE="0666"
#Foxconn
SUBSYSTEM=="usb", ATTR{idVendor}=="0489", MODE="0666"
#Garmin-Asus
SUBSYSTEM=="usb", ATTR{idVendor}=="091E", MODE="0666"
#Google
SUBSYSTEM=="usb", ATTR{idVendor}=="18d1", MODE="0666"
#HTC
SUBSYSTEM=="usb", ATTR{idVendor}=="0bb4", MODE="0666"
#Huawei
SUBSYSTEM=="usb", ATTR{idVendor}=="12d1", MODE="0666"
#K-Touch
SUBSYSTEM=="usb", ATTR{idVendor}=="24e3", MODE="0666"
#KT Tech
SUBSYSTEM=="usb", ATTR{idVendor}=="2116", MODE="0666"
#Kyocera
SUBSYSTEM=="usb", ATTR{idVendor}=="0482", MODE="0666"
#Lenevo
SUBSYSTEM=="usb", ATTR{idVendor}=="17EF", MODE="0666"
#LG
SUBSYSTEM=="usb", ATTR{idVendor}=="1004", MODE="0666"
#Motorola
SUBSYSTEM=="usb", ATTR{idVendor}=="22b8", MODE="0666"
#NEC
SUBSYSTEM=="usb", ATTR{idVendor}=="0409", MODE="0666"
#Nook
SUBSYSTEM=="usb", ATTR{idVendor}=="2080", MODE="0666"
#Nvidia
SUBSYSTEM=="usb", ATTR{idVendor}=="0955", MODE="0666"
#OTGV
SUBSYSTEM=="usb", ATTR{idVendor}=="2257", MODE="0666"
#Pantech
SUBSYSTEM=="usb", ATTR{idVendor}=="10A9", MODE="0666"
#Philips
SUBSYSTEM=="usb", ATTR{idVendor}=="0471", MODE="0666"
#PMC-Sierra
SUBSYSTEM=="usb", ATTR{idVendor}=="04da", MODE="0666"
#Qualcomm
SUBSYSTEM=="usb", ATTR{idVendor}=="05c6", MODE="0666"
#SK Telesys
SUBSYSTEM=="usb", ATTR{idVendor}=="1f53", MODE="0666"
#Samsung
SUBSYSTEM=="usb", ATTR{idVendor}=="04e8", MODE="0666"
#Sharp
SUBSYSTEM=="usb", ATTR{idVendor}=="04dd", MODE="0666"
#Sony Ericsson
SUBSYSTEM=="usb", ATTR{idVendor}=="0fce", MODE="0666"
#Toshiba
SUBSYSTEM=="usb", ATTR{idVendor}=="0930", MODE="0666"
#ZTE
SUBSYSTEM=="usb", ATTR{idVendor}=="19D2", MODE="0666"[/COLOR]
4) Save the file and close it and then issue this command:
Code:
[COLOR="black"]$ sudo chmod a+r /etc/udev/rules.d/51-android.rules[/COLOR]
5) Install the repo:
Code:
[COLOR="black"]$ mkdir ~/bin
$ PATH=~/bin:$PATH
$ curl https://dl-ssl.google.com/dl/googlesource/git-repo/repo > ~/bin/repo
$ chmod a+x ~/bin/repo[/COLOR]
Create your work directory:
Code:
[COLOR="black"]mkdir ~/"your directory name here" For example: mkdir ~/cm10
cd ~/cm10[/COLOR]
Setup local manifest:
Code:
[COLOR="Black"]mkdir .repo/local_manifests
touch .repo/local_manifests/sony.xml
gedit .repo/local_manifests/sony.xml[/COLOR]
Necessary Files for Xperia Z :
Tip :For Building any Rom for Xperia Z u need these specific device files
1 . first is "sony.xml"
Code:
<?xml version="1.0" encoding="UTF-8"?>
<manifest>
<project path="device/sony/fusion3-common" name="CyanogenMod/android_device_sony_fusion3-common" remote="github" revision="cm-11.0" />
<project path="device/sony/qcom-common" name="CyanogenMod/android_device_sony_qcom-common" remote="github" revision="cm-11.0" />
<project path="device/sony/yuga" name="CyanogenMod/android_device_sony_yuga" remote="github" revision="cm-11.0" />
<project path="vendor/sony" name="CyanogenMod/proprietary_vendor_sony" remote="github" revision="cm-11.0" />
<project path="kernel/sony/apq8064" name="CyanogenMod/android_kernel_sony_apq8064" remote="github" revision="cm-11.0" />
<project path="hardware/sony/DASH" name="CyanogenMod/android_hardware_sony_DASH" remote="github" revision="cm-11.0" />
</manifest>
Building Instructions : For CyanogenMod :: AOKP :: Carbon roms :: Beanstalk
Unofficial
To get started with Android/CyanogenMod, you'll need to get familiar with Git and Repo.
To initialize your local repository using the CyanogenMod trees, use a command like this:
first create folder named " cm "
Code:
mkdir cm
enter into cm
Code:
cd ~/cm
For CM - 11.0 kitkat 4.4.x
Code:
[COLOR="black"]repo init -u git://github.com/CyanogenMod/android.git -b cm-11.0[/COLOR]
Then to sync up:
Code:
[COLOR="black"]repo sync[/COLOR]
Please see the CyanogenMod Wiki for building instructions.
For more information on this Github Organization and how it is structured, please read the wiki article.
Create and edit semc.xml in .repo:
Code:
[COLOR="black"]gedit .repo/local_manifests/sony.xml[/COLOR]
Add this to the semc.xml:
For CM 11.0 KitKat 4.4.x
copy paste semc.xml for kikat 4.4 from above
then
Code:
[COLOR="Black"]repo sync[/COLOR]
Code:
[COLOR="black"]. build/envsetup.sh (notice the period and space)
vendor/cm/get-prebuilts
[/COLOR]
then
Code:
brunch yuga
Special thanks to scott.hart.bti for his hard work -
From terminal
1. type
Code:
[COLOR="black"]cd[/COLOR]
.
This will bring you to your root folder.
2. type
Code:
[COLOR="black"]mkdir beanstalk[/COLOR]
.
This will create a folder named beanstalk.
3. type
Code:
[COLOR="black"]cd beanstalk[/COLOR]
.
This will take you to the beanstalk directory created from previous step
4. type
Code:
[COLOR="black"]repo init -u git://github.com/scotthartbti/android.git -b kk44[/COLOR]
.
This will setup the folders to be synced.
5. For Beanstalk KitKat 4.4.x
copy paste sony.xml for kikat 4.4 from above
then
Code:
[COLOR="Black"]repo sync[/COLOR]
apply patches for 4.4
9. Outside of terminal, navigate to beanstalk/vendor/cm. Double click on the get-prebuilts file and select run in terminal. This will fetch necessary files needed to build and place them where they need to be.
10. Type
Code:
[COLOR="Black"]. build/envsetup.sh && brunch yuga[/COLOR]
11. Previous step will start building beanstalk for your device. The process takes anywhere from 1 - 3 hours depending on your computer.
12. Once completed, it will say package complete and you will have a beanstalk named zip file in your out folder.
Unofficial
Special thanks to spleef and ktempleman for laying this out
This set of instructions is unverified. If you build successfully or have build issues, please post here so we can confirm or fix what isn't working
First:
Code:
[COLOR="Black"]mkdir aokp[/COLOR]
then
Code:
[COLOR="black"]cd aokp[/COLOR]
then
Code:
[COLOR="black"]repo init -u https://github.com/AOKP/platform_manifest.git -b kitkat[/COLOR]
after it does its thing
Code:
[COLOR="black"]mkdir .repo/local_manifests
touch .repo/local_manifests/sony.xml
gedit .repo/local_manifests/sony.xml[/COLOR]
copy paste semc.xml for kikat 4.4 from above
save and exit then
Code:
[COLOR="black"]repo sync[/COLOR]
after everything syncs
Code:
[COLOR="black"]gedit vendor/aokp/vendorsetup.sh[/COLOR]
and add this to the bottom:
Code:
[COLOR="black"]add_lunch_combo aokp_yuga-userdebug[/COLOR]
save and exit.. then
Code:
[COLOR="black"]. build/envsetup.sh[/COLOR]
Code:
[COLOR="black"]brunch yuga[/COLOR]
For more on AOKP building, try here: http://aokp.co/learn/so-you-want-to-build-aokp-jb-ubuntu-1204
And Here: https://github.com/AOKP
Unofficial
Getting Started
To get started with the Carbon-Dev sources, you'll need to get familiar with Git and Repo.
Create the Directories
You will need to set up some directories in your build environment.
To create them run:
Code:
[COLOR="black"]mkdir -p ~/carbon[/COLOR]
Install the Repository
You may need to reboot for these changes to take effect. Now enter the following to initialize the repository:
Code:
[COLOR="black"]cd ~/carbon[/COLOR]
Repositories:
Before you continue --> run this in the terminal
Code:
[COLOR="black"]repo init -u https://github.com/CarbonDev/android.git -b kk[/COLOR]
after it does its thing
Code:
[COLOR="black"]mkdir .repo/local_manifests
touch .repo/local_manifests/sony.xml
gedit .repo/local_manifests/sony.xml[/COLOR]
copy paste sony.xml for kikat 4.4 from above
save and exit then
Code:
[COLOR="black"]repo sync[/COLOR]
after everything syncs
Code:
[COLOR="black"]gedit vendor/carbon/vendorsetup.sh[/COLOR]
and add this to the bottom:
Code:
[COLOR="black"]add_lunch_combo carbon_yuga-userdebug[/COLOR]
save and exit.. then
Code:
[COLOR="black"]. build/envsetup.sh[/COLOR]
Code:
[COLOR="black"]brunch yuga[/COLOR]
To get started with AORP, you'll need to get familiar with Git and Repo.
To initialize your local repository using the AORP trees, use a command like this:
first create folder named " AORP "
Code:
mkdir AORP
enter into AORP
Code:
cd ~/AORP
For kitkat 4.4.x
Code:
[COLOR="black"]repo init -u git://github.com/AORP/android.git -b kk[/COLOR]
Then to sync up:
Code:
[COLOR="black"]repo sync[/COLOR]
Please see the CyanogenMod Wiki for building instructions.
For more information on this Github Organization and how it is structured, please read the wiki article.
Create and edit sony.xml in .repo:
Code:
[COLOR="black"]gedit .repo/local_manifests/semc.xml[/COLOR]
Add this to the semc.xml:
For KitKat 4.4.x
copy paste sony.xml for kikat 4.4 from above
then
Code:
[COLOR="Black"]repo sync[/COLOR]
Code:
[COLOR="black"]. build/envsetup.sh (notice the period and space)
vendor/cm/get-prebuilts
[/COLOR]
then
Code:
brunch yuga
Next Tutorial is Strictly Not for beginners
Building with Linaro 4.8 toolchain
Go into Terminal and navigate to the root folder of your source tree, then:
Code:
[COLOR="Black"]prebuilts/gcc/linux-x86/arm/[/COLOR]
Run:
Code:
[COLOR="black"]wget http://releases.linaro.org/13.06/components/toolchain/gcc-linaro/4.8/gcc-linaro-4.8-2013.06.tar.bz2[/COLOR]
Run:
Code:
[COLOR="black"]bunzip2 *.tar.bz2[/COLOR]
Run:
Code:
[COLOR="black"]tar -xvf *.tar[/COLOR]
Using your file manager, navigate to the root folder of your source tree again.
Navigate To "/build", in your root folder.
Run:
Code:
[COLOR="black"]gksudo gedit envsetup.sh[/COLOR]
change the line in bold, to look exactly like this one:
Code:
[COLOR="black"]case $ARCH in
x86) toolchaindir=x86/i686-linux-android-4.6/bin
;;
[B]arm) toolchaindir=arm/gcc-linaro-4.8-2013.06[/B] [COLOR="Red"]<--------[/COLOR]
;;
mips) toolchaindir=mips/mipsel-linux-android-4.6/bin
;;
*)
echo "Can't find toolchain for unknown architecture: $ARCH"
toolchaindir=xxxxxxxxx
;;
esac
[/COLOR]
Exit out and open new. Initialize and build. That's it! Makes you wonder why you never did it before, right?
Not so fast. You may have build issues, you may not. I had a few lengthy sets of errors in gsm calltracker and another .java file that was solved by using Meld and making it look exactly like a successful build's file. More as I learn.......
Thanks to infected_ for this tut; his post can be found here: [/COLOR]
http://forum.xda-developers.com/showpost.php?p=42976693&postcount=12
This is a work in progress. Many more pieces of information will be added and this is meant to be an ever-changing thread. If you see something that is outdated or incorrect, please let me know ASAP, so I can make the correction. Also, make sure that any info offered can be and has been confirmed as functional.
Thanks to:
CyanogenMod
scott.hart.bti
Team Carbon
david279
MallardDuck
ktempleton
AdhvanIt
matthew0776
spleef
M4570D0N
car vs driver
mikeioannina
BMP777
Kernel Building and Ccache
Building your first kernel
:
This is a set of steps to get you building your first kernel. Special thanks to thewadegeek for putting this tutorial together. His thread can be found here: http://forum.xda-developers.com/showthread.php?t=1748297
Step 1. Build Environment
A. Install Ubuntu 12.04(Not holding your hand here, if you can't do this you shouldn't be messing with kernels)
B. Required packages: git-core, gnupg, flex, bison, gperf, libsdl-dev, libesd0-dev, libwxgtk2.6-dev, build-essential, zip, curl, libncurses5-dev, zlib1g-dev, ia32-libs, lib32z1-dev, lib32ncurses5-dev, gcc-multilib, g++-multilib, and Adb.
C. Open a terminal
D. Type
Code:
[COLOR="black"]mkdir android[/COLOR]
E. Type
Code:
[COLOR="black"]cd android[/COLOR]
G.Type
Code:
[COLOR="black"]mkdir kernel[/COLOR]
Step 2. Your Source
A. Open your Terminal Prompt
B. Type
Code:
[COLOR="black"]cd android/kernel[/COLOR]
C. Type
Code:
[COLOR="black"]git clone git://github.com/DooMLoRD/android_prebuilt_toolchains.git toolchains[/COLOR]
D. Now comes the tricky part, you need to have some-type of source for your kernel. Check the following two sites for your device as appropriate. Once you have it download it is extracted/cloned into a folder in your kernel directory.
http://developer.sonymobile.com/wpor...ads/opensource
Step 3. Modifications
This is the part people are curious about, they want to make modifications to the kernel to make it "special". Start all these from the root directory of your kernel source.
Mod 1. Applying a patch
A. Download the patch you wish to apply, in this case this one should work.
B. Save that file as "kernelPatch" in your kernel directory.
C. Open a Terminal
D. Move into the root directory of the kernel you wish to patch.
E. Type
Code:
[COLOR="black"]patch -p1 < ../kernelPatch[/COLOR]
Mod 2. Adding a Governor Alone
A. Open "drivers/cpufreq/Kconfig"
B. Add the following lines in appropriate spot amongst the other govenor's
Code:
[COLOR="Black"]config CPU_FREQ_DEFAULT_GOV_SMARTASS
bool "smartass"
select CPU_FREQ_GOV_SMARTASS
select CPU_FREQ_GOV_PERFORMANCE
help
Use the CPUFreq governor 'smartass' as default.
[/COLOR]
Code:
[COLOR="Black"]config CPU_FREQ_GOV_SMARTASS
tristate "'smartass' cpufreq governor"
depends on CPU_FREQ
help
smartass' - a "smart" optimized governor!
If in doubt, say N.[/COLOR]
C. Open "drivers/cpufreq/Makefile"
D. Add the following line in the appropriate spot.
Code:
[COLOR="Black"] obj-$(CONFIG_CPU_FREQ_GOV_SMARTASS) += cpufreq_smartass.o[/COLOR]
E. Create a file called "drivers/cpufreq/cpufreq_smartass.c"
F. Put the following code in that file.
http://pastebin.com/f0Bk9kVZ
G. open "include/linux/cpufreq.h"
H. Under the "Cpufreq Default" section add
Code:
[COLOR="Black"]#elif defined(CONFIG_CPU_FREQ_DEFAULT_GOV_SMARTASS)
extern struct cpufreq_governor cpufreq_gov_smartass;
#define CPUFREQ_DEFAULT_GOVERNOR (&cpufreq_gov_smartass)[/COLOR]
Ok there is a governor added, do the exact same steps for any other one's you would like to add.
Step 4. Getting a Config file
Option A. Pulling a config file from a kernel.
A. Hook up a device that is using a kernel similar to one you are using as your base.
B. Open a terminal
C. Change to your root kernel directory
D. Type
Code:
[COLOR="black"]adb pull /proc/config.gz[/COLOR]
E. Type
Code:
[COLOR="black"]gunzip config.gz[/COLOR]
F. Type
Code:
[COLOR="black"]mv config arch/arm/configs/<your_config_name>_defconfig[/COLOR]
Option B. Using the manufacturers config.
Unfortunately as stated above, not all kernels support the "/proc/config.gz" method. You can typically find a manufacturer's configuration file in "arch/arm/configs". I believe the one for my HTC Flyer was called "flyer_hc_defconfig", so look for a layout similar to that one. Also read the README to get a better idea of how to modify it. I would personally make a copy of it called "<your_config_name>_defconfig" and use that as my base.
Step 5. Building
Time to start the real "build" section of this tutorial.
Part A. Pre-build Steps
A. Open terminal and change to the root of your kernel directory
B. Type
Code:
[COLOR="black"]export ARCH=arm[/COLOR]
C. Type
Code:
[COLOR="black"]export CROSS_COMPILE=~/android/kernel/toolchains/arm-eabi-linaro-4.6.2/bin/arm-eabi-[/COLOR]
Part B. The First Build
A. Type
Code:
[COLOR="black"]make <your_config_name>_defconfig[/COLOR]
B. Type
Code:
[COLOR="black"]make menuconfig[/COLOR]
and make the required changes to use any modules you added or similar changes.
C. Type
Code:
[COLOR="black"]make -j<maximum number of jobs>[/COLOR]
Part C. Re-Builds
A. Type
Code:
[COLOR="black"]make clean[/COLOR]
B. Type
Code:
[COLOR="black"]make oldconfig[/COLOR]
C. Type
Code:
[COLOR="black"]make -j<maximum number of jobs>[/COLOR]
Part D. Building Modules
You have two options:
A. Type
Code:
[COLOR="black"]make modules[/COLOR]
B. Type
Code:
[COLOR="black"]make path/to/your/module.ko[/COLOR]
The above steps explained:
Part A.(These steps are required every time you close your terminal and re-open it to build again.)
A. Ok shouldn’t need to explain this.
B. This command sets your target architecture.
C. Defines the path to the toolchain we are going to use to compile our kernel. You can change this to point towards whatever toolchain you have downloaded or feel like using, the way it is currently configured it will use the Linaro toolchain that we downloaded above.
Part B.(These only need to be run the first time you build a kernel.)
A. Load's your configuration file from earlier.
B. Open up a menu to configure your kernel. It will use the config file you loaded in the previous step as a base.
C. Viola start the build. I typically allow 1 job per core, so on my quad core machine I put "make -j4". Just raising that number will not make your build faster, your processor needs to be able to support the number of jobs you are assigning it.
Part C. (Use the command's when you are building any-time outside of the first)
A. This command gets rid of any old/outdated binaries or modules you compiled before, and let's start fresh. I like to run it every I build unless my changes are really small and localized.
B. A very awesome command, it parses through what has changed and only prompts you about new options.
C. See the explanation for the above "Part C.".
Part D.(Use these for just building kernel modules.)
A. This will re-build all modules.
B. Will rebuild just the module you need. Very useful when you need to rebuild a WiFi module.
Step 6. Now what
Ok we have now started our build and we are waiting for it to finish, so there are two possible outcomes:
Outcome A. Build Succeeds
W00t!! You have a kernel built by your self from source. There are a couple things you need in-order to use this kernel on your device any ".ko" modules and the zImage binary. If you pay attention to the output of your compiler then you will see the location of those objects. However the following commands will make your life a bit easier(Thanks Recognized Developer Hacre):
A. Open a terminal
B. Change to your root kernel directory
C. Type
Code:
[COLOR="black"]mkdir ../<your_kernel>_output[/COLOR]
D. Type
Code:
[COLOR="black"]cp arch/arm/boot/zImage ../<your_kernel>_output/zImage[/COLOR]
E. Type
Code:
[COLOR="black"]find . -name "*.ko" -exec cp {} ../<your_kernel>_output \;[/COLOR]
The above steps explained:
A-C. Self-Explanatory
D. Move our kernel binary into our output folder
E. This handy bit of magic finds all ".ko" modules and also copies them into your output file.
You will also need to assemble a kernel image containing a initramfs for your device, along with the kernel binary and such. That however is beyond the scope of this tutorial. To get started though try searching the following phrases.
Code:
[COLOR="Black"]building android kernel image
xda build kernel image
xda unpack boot.img[/COLOR]
Outcome B. Build Fails
Oh dear. It failed. Well guess what...this is going to happen..a LOT. Get used to it, and get used to googling and experimenting with different solutions. The following are some tips that will help you with debugging your issues.
Running a "Clean" build
A. Backup your config file - Type
Code:
[COLOR="black"]cp .config ../backupConfig[/COLOR]
B. Re-run the build process using just your defconfig from earlier.
Limiting Output(Thanks Hacre.)
A. Another good tip is to run "make -j1" to get the error, as it will limit the amount of text you need to scroll through.[/COLOR]
[/CENTER]
Building TWRP recovery - http://forum.xda-developers.com/showthread.php?t=1943625
Building CWM recovery - http://forum.xda-developers.com/showthread.php?t=1866545
CCACHE
Here is a brief tutorial on the installation of Ccache, which can shorten build times drastically :
If you have room on your build system you can speed
your builds up considerably by using ccache. ccache is a compiler
cache. It speeds up re-compilation of C/C++ code by caching
previous compiles and detecting when the same compile is
being done again.
Install it with apt-get:
Code:
[COLOR="Black"]sudo apt-get install ccache[/COLOR]
Set environment vars for Android use:
(I put these exports in my .bashrc)
Code:
[COLOR="Black"]export USE_CCACHE=1
export NDK_CCACHE=ccache[/COLOR]
Set a cache size of 10G for optimal results:
Code:
[COLOR="black"]ccache -M 10G[/COLOR]
Check the status of your cache with the command:
Code:
[COLOR="black"]ccache -s [/COLOR]
Returns:
Code:
[COLOR="black"]
cache directory /home/jocala/.ccache
cache hit 106673
cache miss 18379
called for link 3758
preprocessor error 5
not a C/C++ file 4425
unsupported compiler option 678
no input file 4565
files in cache 36758
cache size 3.2 Gbytes
max cache size 10.0 Gbytes[/COLOR]
Really Useful things
Here are some relevant topics/tutorials/sites:
Download | Ubuntu - www.ubuntu.com/download
Official Ubuntu Documentation: Help for all versions. - https://help.ubuntu.com/
How To Windows Dual Boot: - https://help.ubuntu.com/community/WindowsDualBoot
How To Use The Terminal: Commandline stuff. - https://help.ubuntu.com/community/UsingTheTerminal/
[HOW TO] Beginners Guide to Android ROM Development - http://forum.xda-developers.com/showthread.php?t=1272270 (courtesy of isidromxz)
[Tutorial] Compile JB on Ubuntu - http://forum.xda-developers.com/showthread.php?t=1762641 (courtesy of dastin1015)
[CM10] [PPA] Cyanogenmod Compiler v0.6 - http://forum.xda-developers.com/showthread.php?t=1789190 (courtesy of lithid-cm)
[Wiki] How to: Gerrit - http://wiki.cyanogenmod.com/wiki/Howto:_Gerrit
[Wiki] How to: Git - http://wiki.cyanogenmod.com/wiki/Howto:_Git
[Wiki] How to: Connect to device with SSH - http://wiki.cyanogenmod.com/wiki/Howto:_Connect_to_Device_with_SSH
Here is an easy-to-use page on common Linux commands: - http://www.pixelbeat.org/cmdline.html
Linux Newbie Guide : - http://www.unixguide.net/linux/linuxshortcuts.shtml
Also, Team Chopsticks has a good page with some useful tips as well, located here:
http://www.teamchopsticks.org/p/contributing.html (thanks to bdusmc for the tip)
Here is a link to LIFEHACKER's command line tutorials. Very good stuff!! : http://lifehacker.com/5743814/become-a-command-line-ninja-with-these-time+saving-shortcuts
CyanogenMod git : - https://github.com/CyanogenMod
LegacyXperia git : - https://github.com/LegacyXperia
Original Beanstalk thread : - http://forum.xda-developers.com/showthread.php?t=2091900
Beanstalk git : - https://github.com/scotthartbti?tab=repositories
The Muppets git : - https://github.com/TheMuppets
[/FONT][/CENTER]
Build Your Own ROM "Like a Boss" Share it!
lets roll the clock
Make your 'own' KitKat-ROM today!
V1.1 - 20140219 Repos changed
V1.0 - 20140218 Initial release
Thank you note: Many thanks to dhacker29 for dedicating his time developing for this fine piece if hardware.
{
"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"
}
Overview
I. Preparation
II. Installation of the required packages
III. Installing Java
IV. The sources
V. Building the ROM
VI. Rebuilding with newest sources
I. Preparation
Things you need for building:
A computer
An internet connection
An open mind
Time
Patience
First of all, you need a running up-to-date Ubuntu/Linux system. I am using Ubuntu 13.10 64-bit.
Use the terminal to make the steps. A terminal window can be opened by pressing Ctrl+Alt+T. Every single command for the terminal is marked with a $ sign. Just paste every command (without the $ sign) to your terminal window and there shouldn't be any problem.
IMPORTANT: INSTALL EVERYTHING AS A USER WITH NORMAL RIGHTS. DON'T INSTALL AS ROOT!
II. Installation of the required packages (Ubuntu 13.10 64-bit)
Install packages:
Code:
$ sudo apt-get install bison build-essential curl flex \
g++-multilib gcc-multilib git-core gnupg gperf \
lib32ncurses5-dev lib32readline-gplv2-dev lib32z1-dev \
libesd0-dev libncurses5-dev libsdl1.2-dev \
libwxgtk2.8-dev libxml2 libxml2-utils lzop \
openjdk-6-jdk openjdk-6-jre pngcrush schedtool \
squashfs-tools xsltproc zip zlib1g-dev
III. Installing Java
You need a version 6 Java Development Kit for building CM11.0. Usually, the SUN JDK 6 is recommended. But there is another way: you can use the OpenJDK 6. When you installed the required packages as described above, you will just need to configure your Java installation.
Check your Java version:
Code:
$ java -version
Verify the symlinks. Javac, Java, Javaws, Javadoc, Javah, Javap and Jar should all point to the right Java location and version:
Code:
$ ls -la /etc/alternatives/java* && ls -la /etc/alternatives/jar
If they are pointing to the wrong versions you have to change that to OpenJDK6.
Select the default Java version for your system:
Code:
$ sudo update-alternatives --config javac
$ sudo update-alternatives --config java
$ sudo update-alternatives --config javaws
$ sudo update-alternatives --config javadoc
$ sudo update-alternatives --config javah
$ sudo update-alternatives --config javap
$ sudo update-alternatives --config jar
That's it.
IV. The sources
Install repo:
Repo is a tool that makes it quite easy to download and maintain the sources of Cyanogenmod.
Code:
$ mkdir ~/bin
$ PATH=~/bin:$PATH
$ cd ~/bin
$ curl http://commondatastorage.googleapis.com/git-repo-downloads/repo > ~/bin/repo
$ chmod a+x ~/bin/repo
Create the working directory:
Code:
$ mkdir ~/cm11
$ cd ~/cm11
Initialize Repo:
Code:
$ repo init -u git://github.com/CyanogenMod/android.git -b cm-11.0
and enter your credentials.
Download the sources:
Code:
$ repo sync
Wait until it's finished - takes some time to download the hefty 12 GB of source code!
Have a break, have a KitKat!
If the process stops responding, use Ctrl+C to break out of it and resume the download with another
Code:
$ repo sync
If you are running into a lot of syncing errors the reason might be that the 'repo sync' command is establishing four threads automatically. This might be too much. So try to change the command to run with one thread only by using
Code:
$ repo sync -j1
Initialize the environment
Code:
$ . build/envsetup.sh
Obtain the files:
Add repositories for the MOTO G by creating two files in the local_manifests directory. To see this directory, you have to press Ctrl-H in your file manager. If the directory isn't already there, create it with
Code:
$ mkdir ~/cm11/.repo/local_manifests
Use this code to create the file falcon.xml
Code:
$ gedit ~/cm11/.repo/local_manifests/falcon.xml
Paste the following lines to the editor (20140219: repos changed to CyanogenMod)
Code:
<manifest>
<project name="CyanogenMod/android_device_qcom_common" path="device/qcom/common" remote="github" revision="cm-11.0"/>
<project name="CyanogenMod/android_device_motorola_qcom-common" path="device/motorola/qcom-common" remote="github" revision="cm-11.0"/>
<project name="[COLOR="DarkRed"]CyanogenMod[/COLOR]/android_device_motorola_falcon" path="device/motorola/falcon" remote="github" revision="cm-11.0"/>
<project name="[COLOR="DarkRed"]CyanogenMod[/COLOR]/android_kernel_motorola_msm8226" path="kernel/motorola/msm8226" remote="github" revision="cm-11.0"/>
<project name="[COLOR="DarkRed"]CyanogenMod[/COLOR]/android_device_motorola_msm8226-common" path="device/motorola/msm8226-common" remote="github" revision="cm-11.0"/>
<project name="CyanogenMod/android_hardware_qcom_display-caf-new" path="hardware/qcom/display-caf-new" remote="github" revision="cm-11.0"/>
<project name="CyanogenMod/android_hardware_qcom_media-caf-new" path="hardware/qcom/media-caf-new" remote="github" revision="cm-11.0"/>
<project name="CyanogenMod/android_hardware_qcom_fm" path="hardware/qcom/fm" remote="github" revision="cm-11.0"/>
</manifest>
Save the file.
Use this code to create the file vendor.xml (in case you already have a vendor.xml file because you are buiilding for multiple devices, just add the project line to your vendor.xml file)
Code:
$ gedit ~/cm11/.repo/local_manifests/vendor.xml
Paste the following lines to the editor
Code:
<?xml version="1.0" encoding="UTF-8"?>
<manifest>
<project path="vendor/motorola" name="TheMuppets/proprietary_vendor_motorola" remote="github" revision="cm-11.0"/>
</manifest>
Save the file.
Run
Code:
$ repo sync
again to get the files needed.
Download the necessary prebuilts from cyanogenmod by running
Code:
$ cd ~/cm11
$ vendor/cm/get-prebuilts
And you're done syncing!
V. Building the ROM
Now build it:
Code:
$ brunch falcon
And the building process starts. Have patience now. Building takes around half an hour on fast systems and a lot more on older and slower machines.
When everything worked as it should you will find your new ROM-image in ~/cm11/out/target/product/falcon
It is called cm-11-DATE-UNOFFICIAL-falcon-zip. You can flash it via CWM/TWRP as usual.
VI. Rebuilding with newest sources
Whenever you like to update your sources and build a new version you have to run these four simple commands:
Code:
$ cd ~/cm11
$ repo sync
$ . build/envsetup.sh
$ brunch falcon
Compiling again takes less time than compiling took the first time because it's only building new parts while reusing old parts that haven't changed.
Happy building!
Reserved
Reserved
Good
Thanks for taking the effort to write this down.
Docker template for building CyanogenMod
Have you seen this?
http://forum.xda-developers.com/showthread.php?t=2650345
Guide changed
New V1.1 - 20140219 Repos changed
First post has been changed accordingly.
VI. Rebuilding with newest sources
Whenever you like to update your sources and build a new version you have to run these four simple commands:
Code:
$ cd ~/cm11
$ repo sync
$ . build/envsetup.sh
$ brunch falcon
Compiling again takes less time than compiling took the first time because it's only building new parts while reusing old parts that haven't changed.
Click to expand...
Click to collapse
Is it not necessary to also run this again?
Code:
cd vendor/cm
./get-prebuilts
cd ../..
PS: At the end of part IV youve got "get-prebuilts" instead of "./get-prebuilts".
if you could add option to build with Linaro-Toolchain
tazlooney89 said:
if you could add option to build with Linaro-Toolchain
Click to expand...
Click to collapse
+1
michalurban said:
Is it not necessary to also run this again?
Code:
cd vendor/cm
./get-prebuilts
cd ../..
Click to expand...
Click to collapse
It is the pre-built terminal program. You just need it the first time you build. Otherwise you would get an error message while compiling the ROM. It is unnecessary to get the program over and over again. Since it's pre-built, it gets its updates from the market/play store.
michalurban said:
PS: At the end of part IV youve got "get-prebuilts" instead of "./get-prebuilts".
Click to expand...
Click to collapse
Something got mixed up there. Changed my lines. But your solution works too, of course. Thanks for pointing me to it.
tazlooney89 said:
if you could add option to build with Linaro-Toolchain
Click to expand...
Click to collapse
Really depends on the time I will have on my hands and the interest the thread draws. Maybe I'll add some tweaks and tricks including a basic set of compiling against Linaro TC 4.8.x next week. We will see...
Is there an automatic way to have the build.prop file (the system/build.prop option ro.build.date) altered?
I have a script renaming the compiled rom - to make the filaname end with "-michalurban-$NOW" where $NOW is a variable containing date and time of creation. And I would like to remove the ro.build.date value and replace it with michalurban-$NOW so I would easily know if Im using Official NIGHTLY or my build ...
My Linux (Bash, whatever) skill is knee deep in manure Im afraid ... is this possible?
michalurban said:
Is there an automatic way to have the build.prop file (the system/build.prop option ro.build.date) altered?
I have a script renaming the compiled rom - to make the filaname end with "-michalurban-$NOW" where $NOW is a variable containing date and time of creation. And I would like to remove the ro.build.date value and replace it with michalurban-$NOW so I would easily know if Im using Official NIGHTLY or my build ...
My Linux (Bash, whatever) skill is knee deep in manure Im afraid ... is this possible?
Click to expand...
Click to collapse
I usually change the build.prop indirectly before the building process.
I delete a few files before rebuilding. E.g. the old build.prop with
Code:
rm -f out/target/product/falcon/system/build.prop
Whenever I am setting up a new build environment I edit the file common.mk in /vendor/cm/config
In line 317 or 323 you could try to change the value of CM_DISPLAY_VERSION or ro.cm.display.version to suit your needs.
Or you can do what I am doing - I usually add a time value to my ROMs (Rom-name and CyanogenMod-version under 'About phone'):
line 288 reads:
Code:
CM_VERSION := $(PRODUCT_VERSION_MAJOR)-$(shell date -u +%Y%m%d)-$(CM_BUILDTYPE)$(CM_EXTRAVERSION)-$(CM_BUILD)
and I changed it to
Code:
CM_VERSION := $(PRODUCT_VERSION_MAJOR)-$(shell TZ=":Europe/Berlin" date +%Y%m%d\-%H%M%S)[email protected]$(CM_BUILDTYPE)$(CM_EXTRAVERSION)-$(CM_BUILD)
I also added [email protected] You can change practically everything here.
Then save the file and rebuild.
The CyanogenMod Version in 'about phone' should look like this when you flash the ROM:
Happy building!
Is it possible to do this on a NTFS-formatted drive? Im running low on space on my linux /home directory but Ive got plenty of space on my Win7 NTFS drive ... Im just afraid of file permission troubles ...
you can make an image file on the NTFS partition loopmount it, then format it to ext4.
Sent from my XT1032
Rhyn said:
you can make an image file on the NTFS partition loopmount it, then format it to ext4.
Sent from my XT1032
Click to expand...
Click to collapse
You mean to create a file on the NTFS partition, format it as EXT4, mount it somewhere and then use it for compilation via Ubuntu but "on" the NTFS drive? Wouldnt it mean a hard hit to the performance? I suppose it wont but as my PC is not high-end everything matters ...
BTW I found some guide on the Net and Ive modified it for my needs (probably lol). Is it ok?
Code:
# Create file to store EXT4 partition on NTFS partition (100GB)
dd if=/dev/urandom of=/media/D/linux.img bs=2048 count=50000000
# Create and format loop device (of the EXT4 file)
losetup /dev/loop0 /media/D/linux.img
mkfs.ext4 -b 1024 /dev/loop0
# Mount the new EXT4 file
mount -o loop /media/D/linux.img /home/michal/NTFSdrive
EDIT: Script tested and running fine (I got so excited I wrote this edit in czech not english the first time lol).
yeah I meant exactly that. This guide seems ok. The performance won't be as good as with a native partition, but won't be terribly bad either
Sent from my XT1032
Another weird question of mine:
I deleted all files, set the CCACHE to be 100GB using command "prebuilts/misc/linux-x86/ccache/ccache -M 100G" which was confirmed and started the whole process. But after successfully finishing compilation the directory is again "only" 50GB ... why? I expected it to be twice as large ...
michalurban said:
Another weird question of mine:
I deleted all files, set the CCACHE to be 100GB using command "prebuilts/misc/linux-x86/ccache/ccache -M 100G" which was confirmed and started the whole process. But after successfully finishing compilation the directory is again "only" 50GB ... why? I expected it to be twice as large ...
Click to expand...
Click to collapse
You have to inform the compiler that the cache will be used first, then config a directory and last, set the cache size to xx GB which creates the hidden dir. (to see it, use Ctrl+H)
Code:
$ export USE_CCACHE=1
$ export CCACHE_DIR=/your_path_here/.ccache
$ prebuilts/misc/linux-x86/ccache/ccache -M 100G
Btw: it's a good idea to use a 'make clean' first...
To see what's going on while caching, open another terminal, go to your cm11 root dir and execute
Code:
watch -n1 -d prebuilts/misc/linux-x86/ccache/ccache -s
Now, Ive got a script building the ROM for me. It usually works fine for first sync and compilation as well as for any secondary syncs. But sometimes it returns a message that something isnt present in some file (it differs) and the compilation ends with "Error 1" which I found to be "Out of memory". Now, the guide at CM web says that I should
Code:
edit: system/build/tools/releasetools/common.py
change: java -Xmx2048m to java -Xmx1024m or java -Xmx512m
BTW the right file path is
Code:
build/tools/releasetools/common.py
But Im curious if this change could be done in an automated way by the script (and Im not really familiar with sed, awk and all this regular expressions) ... If not, I guess Ill put some READ command before the compilation itself, giving me time to change it - or just add "nano system/build/tools/releasetools/common.py". But still, automatic way would be better.
EDIT: Solution (with JAVAMEM being set in the beginning of the script):
Code:
sed -i 's/Xmx2048m/Xmx'$JAVAMEM'm/' build/tools/releasetools/common.py
ADD:
Weird, when I try to set the directory and size for CCACHE, nothing happens - it stays at /home/michal/.ccache and 100GB ...
About two days ago a new problem emerged. I followed the guide exactly but in the end, after "brunch falcon"
Code:
make: *** [/home/michal/Build/MotoG-CM11/out/target/product/falcon/obj/SHARED_LIBRARIES/hwcomposer.msm8226_intermediates/hwc_utils.o] Error 1
It happened before so I erased all content of the directory and did all the commands from scratch. But its the same ... even after changing Java memory something (Xmx2048m) to 1024, which was recommended in the CM guide.