[COMPLETE][NOOB-FRIENDLY] TWRP COMPILE GUIDE - MSM/MTK. {CyanogenMod} - Android Software Development

Lets go straight into topic.
Requirements.
Ubuntu 14.04 or + required.
Official CM 13 support.
1: Setting up Environment.
1.1 Build Essentials
Code:
sudo apt-get install git-core gnupg flex bison gperf build-essential \
zip curl zlib1g-dev gcc-multilib g++-multilib libc6-dev-i386 \
lib32ncurses5-dev x11proto-core-dev libx11-dev lib32z-dev ccache \
libgl1-mesa-dev libxml2-utils xsltproc unzip
1.2 Settingup Java
Code:
sudo apt-get update
sudo apt-get install openjdk-8-jdk
Code:
[B]2. Download Repo.[/B]
Code:
mkdir WORKING-DIR && cd WORKING-DIR
repo init -u https://github.com/lj50036/platform_manifest_twrp_cm -b twrp-13.0
repo sync -j# --force-sync (replace '#' with Number of Cores + '1' )
3.Cloning
you can find your device tree @ github.com/CyanogenMod
Mine: Sprout! Android One so https://github.com/CyanogenMod/android_device_google_sprout/tree/cm-13.0
mkdir -p device/<your-brand>/<codename>
example:
Code:
mkdir -p device/google/sprout4
git clone https://github.com/CyanogenMod/android_device_google_sprout.git -b cm-13.0 device/google/sprout4
open cm.dependencies file you will find the additional repository required: for me sprout-common
you will find it on github.com/CyanogenMod
you can clone it anywhere.
4.Merging Common and Device Tree
open cm.dependencies in device tree. empty all the text in it!.
go to common tree if MTK Device: common/rootdir/
if MSM Device: common/rootdir/etc/
copy and if-needed replace all rootdir files from common to device tree.
Open BoardConfig.mk in Device Tree
Open BoardConfigCommon.mk in Common Tree
Add All the missing text in device tree from common tree.
if vendorsetup.sh file is not there in device tree then make a file named vendorsetup.sh
open vendorsetup.sh, add this lines in same format with your device requirements.
add_lunch_combo cm_<your-codename>-eng
add_lunch_combo cm_<your-codename>-userdebug
5. Deleting Unwanted lines which will cause errors while compiling!
open cm.mk, device.mk, <your-codename>.mk, if-exist full_<your-codename>.mk any other .mk files.
delete all the lines which are calling vendor, kernel and any other bull crap!.
6. Adding Prebuilt-kernel Instead of Source
Download Latest cm-nightly-<your-codename>.zip
extract boot.img from zip
unpack the boot.img using carlivkitchen
open extracted dir, copy <recovery-file-name>-kernel to devicetree/rootdir/
rename <recovery-file-name>-kernel to kernel
open BoardConfig.mk in device tree
go to #kernel
you will find TARGET_KERNEL_SOURCE := <make this line empty>
you will find TARGET_KERNEL_CONFIG := <make this line empty>
add line TARGET_PREBUILT_KERNEL := device/<your-brand>/<your-codename>/rootdir/kernel
save and exit
7.Compiling
cd WORKING-DIR
. build/envsetup.sh
you can run any command:
lunch cm_<your-codename>-eng
(or)
lunch cm_<your-codename>-userdebug
Once lunching is successfull.
make -j# recoveryimage (replace # with number of cores + 1)
8. OUT/target/product/<your-codename>/recovery.img

Related

[TUTORIAL][HOWTO] Building CyanogenMod 7 for the HTC Thunderbolt [FINAL]

How to build your own CyanogenMod 7:
Install the Build Packages
Install using the package manager of your choice:
For 32-bit & 64-bit systems:
Code:
git-core gnupg flex bison gperf libsdl1.2-dev libesd0-dev libwxgtk2.6-dev squashfs-tools build-essential zip curl libncurses5-dev zlib1g-dev sun-java6-jdk pngcrush schedtool
For 64-bit only systems:
Code:
g++-multilib lib32z1-dev lib32ncurses5-dev lib32readline5-dev gcc-4.3-multilib g++-4.3-multilib
NOTE: gcc-4.3-multilib g++-4.3-multilib is no longer available for Ubuntu 11.04 64-bit, but should still build without issue.
NOTE: On Ubuntu 10.10, and variants, you need to enable the parter repository to install sun-java6-jdk:
Code:
add-apt-repository "deb http://archive.canonical.com/ maverick partner"
Create the Directories
You will need to set up some directories in your build environment.
To create them:
Code:
mkdir -p ~/bin
mkdir -p ~/android/system
Install the Repository
Code:
curl "http://php.webtutor.pl/en/wp-content/uploads/2011/09/repo" > ~/bin/repo
chmod a+x ~/bin/repo
PATH=~/bin:$PATH
Now enter the following to initialize the repository:
Code:
cd ~/android/system/
repo init -u git://github.com/ProTekk/android.git -b gingerbread
repo sync -j16
Copy proprietary files
Code:
git clone git://github.com/koush/proprietary_vendor_htc.git ~/android/system/vendor/htc
Download RomManager
NOTE: This only needs to be done when an update to RomManager is released. If you are-up-to date, you may skip to Building CyanogenMod.
Download RomManager which is needed by the build:
Code:
cd ~/android/system/device/htc/mecha
~/android/system/vendor/cyanogen/get-rommanager
Check for updates
First, check for updates in the source:
Code:
cd ~/android/system/
repo sync
Configure Build & Compile
Now, the environment must be configured to build and the ROM compiled, from code, for the Thunderbolt.
Code:
. build/envsetup.sh && brunch mecha
Now for the lazy people who don't want to type all that crap:
Download and run the new script: http://fzservers.com/newmecha.sh
You can do whatever you like while it runs. If you have never created a CyanogenMod repo on your local system then go out to dinner, grab some coffee, call your mother or do something time consuming because this will be a LONG wait depending on your Internet connection and system performance. The build will run as soon as the script sets everything up and again it is LOOOONG depending on the performance of your system.
Everything will be located in
Code:
~/android/system
Once it's done you can locate the flashable .zip in the "out" directory of your CyanogenMod repo. Happy crackflashing to all!
Reserved....
Fixed an issue with the build script. Please redownload it and try again.

[GUIDE] Compile CM9 for the Thunderbolt

The purpose of this guide is to show the steps required to compile CM9 specifically for the Thunderbolt. This may be adapted for other ROMs in the future. However, I will not describe how to setup your development environment as that information changes based on distribution versions and has been done many times over. A few good references are here, with an example of mine at the end of this post:
CyanogenMod Wiki - Learning to Build CyanogenMod
CyanogenMod Build Guide for Nexus 7 (Use as an example)
My goal is to aid others in development as the steps to get everything working on the Thunderbolt are not straight-forward unless you know what they are. Even though I had plenty of sources when I started, I still had to spend many hours to get them working. The camera and radio need some extra steps, but those are now streamlined for both my benefit and everyone else's.
I added these steps on gist.github as scripts, although I have not tested them as such. It would be best if you do each line at a time to better understand what you're doing.
Build CM9 Thunderbolt - First Time Only
Build CM9 Thunderbolt - Subsequent Builds
For the first build only:
Code:
mkdir android
cd android/
repo init -u git://github.com/CyanogenMod/android.git -b ics
mkdir -p .repo/local_manifests
wget https://raw.github.com/jblack248/android/ics/local_manifest.xml -O .repo/local_manifests/cm_mecha.xml
repo sync
# Cherry-pick frameworks/base/libs/ui commit from Twisted
cd frameworks/base/ && git fetch http://review.cyanogenmod.com/CyanogenMod/android_frameworks_base refs/changes/85/13285/8 && git cherry-pick FETCH_HEAD && cd ../..
# checkout branch in local trees
repo start ics device/htc/common device/htc/mecha device/htc/msm7x30-common hardware/qcom/camera kernel/htc/mecha-3.0 packages/apps/Camera vendor/htc/mecha vendor/htc/mecha-radio
# download prebuilts
cd vendor/cm/
./get-prebuilts
cd ../..
. build/envsetup.sh
lunch cm_mecha-userdebug
# Make build then rebuild with radio - read script in vendor/htc/mecha-radio if interested
mka bacon && . vendor/htc/mecha-radio/liquid_telephony.sh
For subsequent builds:
Code:
repo sync
# Cherry-pick frameworks/base/libs/ui commit from Twisted
cd frameworks/base/ && git fetch http://review.cyanogenmod.com/CyanogenMod/android_frameworks_base refs/changes/85/13285/8 && git cherry-pick FETCH_HEAD && cd ../..
. build/envsetup.sh
lunch cm_mecha-userdebug
# Make build then rebuild with radio - read script in vendor/htc/mecha-radio if interested
mka bacon && . vendor/htc/mecha-radio/liquid_telephony.sh
How I set up the build environment on Xubuntu 13.04 64-bit - Gist.github:
Code:
echo "Install Android Development Tools and Dependencies"
sudo apt-get install -y android-tools-adb android-tools-fastboot git-core gnupg flex bison gperf libsdl1.2-dev libesd0-dev libwxgtk2.8-dev squashfs-tools build-essential zip curl libncurses5-dev zlib1g-dev lib32z1-dev pngcrush schedtool g++-multilib lib32z1-dev lib32ncurses5-dev lib32readline-gplv2-dev gcc-multilib g++-multilib schedtool libc6-dev-i386 ccache
echo "Link zconf.h to fix Android compile issues in 13.04"
ln -s /usr/include/x86_64-linux-gnu/zconf.h /usr/include
echo "Installing Development Tools"
sudo apt-get install -y meld gedit-plugins git gitk gtkhash
echo "Customize .bashrc"
echo "export USE_CCACHE=1" >> ~/.bashrc
echo "ccache -M 20G > /dev/null 2>&1" >> ~/.bashrc
# these locations will be different for you, depending on where you installed the SDK
# echo "export PATH=${PATH}:~/Documents/Development/bin:~/Documents/Development/adt-bundle-linux-x86_64/sdk/tools:~/Documents/Development/adt-bundle-linux-x86_64/sdk/platform-tools"
Just a note; for the sake of newbs you may want to include instructions on getting the repo script as it doesn't just work OOB.
Code:
remote object '/system/lib/libcamera.so' does not exist
remote object '/system/lib/libcneapiclient.so' does not exist
remote object '/system/lib/libcneqmiutils.so' does not exist
remote object '/system/etc/firmware/a225p5_pm4.fw' does not exist
remote object '/system/etc/firmware/a225_pfp.fw' does not exist
remote object '/system/etc/firmware/a225_pm4.fw' does not exist
remote object '/system/etc/firmware/a300_pfp.fw' does not exist
remote object '/system/etc/firmware/a300_pm4.fw' does not exist
I got this when running ./extract-files.sh although all other files extracted fine, and I'm assuming at the very least libcamera.so is 100% necessary.
You are correct, libcamera.so is especially needed. You can either copy the files manually or modify the extract-files.sh script and extract the ROM zip to a folder to copy the files locally instead of using ADB. Change 'adb pull' to 'cp' and modify the path of the first parameter to the ROM zip folder.
I referenced a couple other guides that help you get the development set up, even the repo bin. That information changes, has been done over many times, and isn't as useful in the long run unless I micro-manage this guide. If I get a chance I might flesh this out a little, but I'm not sure how much of a desire there is for this. I'll help where I can, though.
I updated the OP with fixes to make sure everything works automatically. You no longer have to use the extract-files.sh script (or setup adb) since I made a vendor repo to include all of those files for you. Thanks to santod and others for pointing out a number of problems.
Note: As of 2013-06-29 CM9 is in a broken state as we're getting the kernel and stock OTA blobs to work properly.

[CLOSED][How to][Build CMB ROMS][TF300T][Mint64bit]

This will guide you thought the setup of Mint. The setup of your build environment, and finely the output of a flashable CMB ROM for your 700
First anything that starts with a bullet point is just for your reference.. Do not copy these things into your bash window...
Anything that is a code is copied one line at a time into your bash window and than enter
Now Install Mint 64 bit and a PC.. We will need at least a 250 GB hard drive...
This is a work in progress so let me know if anyone has any questions...
You can Find Mint here Click Me
Update System
Code:
sudo apt-get update
Code:
sudo apt-get upgrade
Build Env
Code:
sudo apt-get install git-core gnupg flex bison gperf libsdl1.2-dev libesd0-dev libwxgtk2.8-dev squashfs-tools build-essential zip curl
Code:
sudo apt-get install libncurses5-dev zlib1g-dev pngcrush schedtool libxml2 libxml2-utils xsltproc android-tools-fastboot android-tools-adb
Code:
sudo apt-get install g++-multilib lib32z1-dev lib32ncurses5-dev lib32readline-gplv2-dev gcc-multilib meld ia32-libs lzop ccache gedit
Code:
mkdir -p ~/bin
Code:
mkdir -p ~/android/system
Code:
curl http://commondatastorage.googleapis.com/git-repo-downloads/repo > ~/bin/repo
Code:
chmod a+x ~/bin/repo
Code:
export PATH=${PATH}:~/bin
Code:
gedit ~/.bashrc
Copy & Paste at bottom of bashrc on its own line
Code:
export PATH=${PATH}:~/bin
END-Paste
Code:
cd ~/android/system/
Code:
repo init -u git://github.com/cmbroms/platform_manifest.git -b kk4.4
You will be prompt to give your email and name just follow the steps on screen
Prepare to wait for a massive download 3 to 10 hours depending on your internet speed...
Code:
repo sync
Code:
cd ~/android/system/vendor/cmb
Code:
./get-prebuilts
Java
Code:
su
Code:
echo "deb http://ppa.launchpad.net/webupd8team/java/ubuntu precise main" | tee -a /etc/apt/sources.list
Code:
echo "deb-src http://ppa.launchpad.net/webupd8team/java/ubuntu precise main" | tee -a /etc/apt/sources.list
Code:
apt-key adv --keyserver keyserver.ubuntu.com --recv-keys EEA14886
Code:
apt-get update
Code:
apt-get install oracle-java6-installer
Code:
exit
Code:
sudo apt-get install oracle-java6-set-default
Ccache
Code:
gedit ~/.bashrc
Copy & Paste at bottom of bashrc on its own line
Code:
export USE_CCACHE=1
Code:
export CCACHE_DIR=~/ccache
END-Paste
Code:
source ~/.bashrc
Code:
ccache -M 50G
Building a ROM
Code:
cd ~/android/system
Make sure your in sync with the repo, you will do this every time right before you build.
Code:
repo sync
Code:
source build/envsetup.sh
Code:
lunch
Pick the number of the rom you would like to build
I maintain the 700,300,m7vzw so those are the only ones I can help with
the -j* is how may cpu cores you would like to give to the build process
So -j2 would tell the build process that you have 2 core you would like to use to build
Code:
make clean && make bacon -j2
The flash-able zip will be in the out folder of your build directory
Code:
XDA:DevDB Information
How to build CMB ROM for your TF300T, a Tool/Utility for the Asus Transformer TF300T
Contributors
lj50036
Version Information
Status: Testing
Created 2014-01-17
Last Updated 2014-01-17
Sources
CMB github Click Me
ASOP Click Me
CM wiki Click Me
Java Click Me
Reserved
Download Tab
I posted a downloadable .txt file, so you don't have to have a browser open, for the process.. The download is available in the download tab at the top of every page of this forum... Thx as always lj

[Guide] Build MoKee Rom 7.1.2 For Samsung T700/T705/T800/T805

How To Build MoKee Rom For Exynos5420 Device (7.1.2)​Support Device :
HTML:
klimtwifi # Samsung T700
klimtlte # Samsung T705
chagallwifi # Samsung T800
chagalllte # Samsung T805
chagallltetmo # Samsung T807T
ha3g # Samsung Note3 (N900)
Step 1: Setting Up A Compile Environment
You must have a 64-bit environment.
A Linux computer should have 8 GB RAM or more, otherwise build errors may occur.
Ubuntu 16.04
These instructions should work for other version of Ubuntu and most other Debian-based systems.
Install build packages
Open a terminal (ctrl + alt + t). First install the necessary packages; copy paste the code below and hit enter.
HTML:
sudo apt-get update
sudo apt-get install git ccache automake lzop bison gperf build-essential zip curl zlib1g-dev zlib1g-dev:i386 g++-multilib python-networkx libxml2-utils bzip2 libbz2-dev libbz2-1.0 libghc-bzlib-dev squashfs-tools pngcrush schedtool dpkg-dev liblz4-tool make optipng maven bc pngquant imagemagick yasm libssl-dev
sudo apt-get install openjdk-8-jdk
HTML:
mkdir -p ~/bin
mkdir -p ~/mokee
curl https://storage.googleapis.com/git-repo-downloads/repo > ~/bin/repo
chmod a+x ~/bin/repo
Add bin to PATH
HTML:
echo "export PATH=~/bin:$PATH" >> ~/.bashrc
Configure git:
HTML:
git config --global user.email "[email protected]"
git config --global user.name "Your Name"
Move to build directory and sync the source code:
HTML:
cd ~/mokee
repo init -u https://github.com/Cyborg2017/android_mokee.git -b mokee-7.1.2
repo sync -j8 -f --no-clone-bundle
Let's configure ccache too. It will reduce the build time to 40% after first build
HTML:
echo "export USE_CCACHE=1" >> ~/.bashrc
~/mokee/prebuilts/misc/linux-x86/ccache/ccache -M 25G
25G means it will use upto 25 gb of disk space for ccaching. Atleast 10 gb is recommended. But if you want to compile for more devices, use more space for ccache.
Step 2: Compiling For Your Device
# MoKee Rom For Samsung Exynos5420 Chips Device
============================================================
To initialize your local repository using the MoKee trees, use a command like this:
HTML:
repo init -u https://github.com/Cyborg2017/android_mokee.git -b mokee-7.1.2
Then to sync up:
HTML:
repo sync
Start Work
-------------------------------------------------------------
To work faster, we introduced a new build script to help you start compiling.
First, go to the root path of your project. We assume that your source is under
(/mokee):
HTML:
cd /mokee
then feel free to use the build script:
HTML:
. build/envsetup.sh
lunch mk_klimtwifi # T700
lunch mk_klimtlte # T705
lunch mk_chagallwifi # T800
lunch mk_chagalllte # T805
lunch mk_chagallltetmo # T807T
lunch mk_ha3g # N900
mka bacon -j8
The script is interactive so everything else is self-explanatory.
Source:
https://github.com/Cyborg2017/android_mokee
https://github.com/Cyborg2017/android_device_samsung_exynos5420-common
https://github.com/Cyborg2017/android_device_samsung_chagalllte
https://github.com/Cyborg2017/android_device_samsung_chagallwifi
https://github.com/Cyborg2017/android_device_samsung_klimtlte
https://github.com/Cyborg2017/android_device_samsung_klimtwifi
https://github.com/Cyborg2017/android_device_samsung_chagallltetmo
https://github.com/Cyborg2017/android_device_samsung_ha3g
https://github.com/Cyborg2017/android_kernel_samsung_exynos5420
Thanks:
MoKee Rom Team: https://github.com/MoKee
Exynos5420 Team: https://github.com/exynos5420
LineageOs Team: https://github.com/LineageOS

[GUIDE] How to Build AOSP Pie Custom ROM for Xperia Devices

WARNING: This guide is only for experienced users only. I will not responsible for any damages that you had been done during modifying your android device!
Prerequisite before setup for custom ROM building:
1. An unlocked Xperia device, which have its support for Pie ROM. See the list of device here
2. Ubuntu 18.04 OS (either on actual installation on HDD or installed on virtualbox only)
3. A powerful PC/laptop
4. 100Mbps internet connection
5. A brain
NOTE: If your device is not unlocked yet, please follow the official guide given by Sony here.
Steps for building the custom ROM:
1. Install OpenJDK JDK version
Code:
sudo apt-get install openjdk-8-jdk
2. Install all of these stuffs (you might need to copy these into text editor and save it as script file:
Code:
sudo apt install -y bc build-essential ccache curl g++-multilib gcc-multilib git gnupg gperf imagemagick lib32ncurses5-dev lib32readline-dev lib32z1-dev liblz4-tool libncurses5-dev libsdl1.2-dev libssl-dev libwxgtk3.0-dev libxml2 libxml2-utils lzop m4 openjdk-8-jdk pngcrush repo rsync schedtool squashfs-tools xsltproc zip zlib1g-dev bison gperf libxml2-utils make zlib1g-dev:i386 liblz4-tool libncurses5 lunch unzip clang
3. Download repo tool (you might be prompted to set up git account access when running curl command):
Code:
mkdir ~/bin
curl http://commondatastorage.googleapis.com/git-repo-downloads/repo > ~/bin/repo
chmod a+x ~/bin/repo
4. Open up .bashrc file:
Code:
nano ~/.bashrc
5. Put these line at the end of the file and save:
Code:
export PATH=~/bin:$PATH
export LC_ALL=C
export USE_CCACHE=1
Then, configure cache limit to 20GB (you have to declare very specific because running ccache -M 20G only straight from the terminal won't work)
Code:
prebuilts/misc/linux-x86/ccache/ccache -M 20G
6. Reload bash variables:
Code:
source ~/.bashrc
7. Initialize repo tree:
Code:
mkdir ~/android
cd ~/android
repo init -u https://android.googlesource.com/platform/manifest -b android-9.0.0_r35
8. Clone the local manifests from GitHub:
Code:
cd .repo
git clone https://github.com/sonyxperiadev/local_manifests
cd local_manifests
git checkout android-9.0.0_r35
cd ../..
9. Downloading the 30-40GB of source codes!:
Code:
repo sync
10. Cherry-pick the upstream patches:
Code:
./repo_update.sh
11. Initializing device type for ROM building:
Code:
source build/envsetup.sh && lunch
or
Code:
source build/envsetup.sh && lunch aosp_[device_model]-userdebug
12. Building the custom ROM ( it will take at about 4-5 hours):
Code:
make -j[number of CPU cores]
13. Flashing your AOSP images (ROM images can be found at android/out/target/product/<device>/ directory):
Code:
fastboot erase cache
fastboot erase userdata
fastboot flash boot boot.img
fastboot flash system system.img
fastboot flash cache cache.img
fastboot flash userdata userdata.img
14. Flashing OEM images (Download the vendor image corresponding to your device here):
Code:
fastboot flash oem SW_binaries_for_Xperia_AOSP_O_MR0_4.4_<release version>_<platform>.img
15. Reboot your device:
Code:
fastboot reboot
If the device able to boot, then congratulations!...
Guide reference: https://developer.sony.com/develop/...build-instructions/build-aosp-android-p-9-0-0
ADDITIONAL NOTES:
If you're want Google apps installed, follow these steps below:
1. Download OpenGapps from the website here and put the opengapps zip file into microsd card or USB OTG drive.
2. Download Magisk zip file here and put it into microsd card or USB OTG drive.
3. Download the TWRP image here according to your device and flash the recovery or just boot it directly
Code:
fastboot flash recovery TWRP.img
or
Code:
fastboot boot TWRP.img
4. Go to Install and select microSD or USB OTG storage and install opengapps package first.
5. Then, install Magisk package for patching in order to enable Google apps functionalities on AOSP ROM.
6. Wipe cache and reboot the device.
Thanks for the advice
This guide really came in handy, i'm not quite fixed up just yet, but so far has been a real help, thank you

Categories

Resources