[GUIDE] How to Build AOSP Pie Custom ROM for Xperia Devices - Sony Xperia XZs Guides, News, & Discussion

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

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] Setting up a build environment for CDMA Hero

this is a guide for setting up a build environment on ubuntu 10.10. there has been similar guides but i did not have any luck with them. i'll just post step by step what i did to get a good build environment set up and compile jaybob's source.
install ubuntu 10.10
install ubuntu, install all the latest updates, DO NOT INSTALL UBUNTU 11.04 I MADE THIS FOR 10.10!!!
restart ubuntu
go to system, administration, update manager
go to settings
go to other software
check both canonical partners and click close
download python
sudo add-apt-repository ppa:fkrull/deadsnakes
sudo apt-get update
sudo apt-get install python2.5
download jdk 6
sudo add-apt-repository "deb http://archive.canonical.com/ maverick partner"
sudo add-apt-repository "deb http://archive.canonical.com/ubuntu maverick partner"
sudo apt-get update
sudo apt-get install sun-java6-jdk
download sdk
download link: http://dl.google.com/android/android-sdk_r15-linux.tgz
take android-sdk-linux folder and move it inside your home folder
open terminal
cd android-sdk-linux
cd tools
./android
the sdk manager will open. download the platform tools and any sdk versions you wish to have
download git
sudo apt-get update
sudo apt-get upgrade
sudo apt-get install git-core
install required build packages
sudo apt-get install 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
configure your usb
gksudo gedit /etc/udev/rules.d/51-android.rules
in the blank file that opens, paste this next line in the file:
SUBSYSTEM=="usb", SYSFS{idVendor}=="0bb4", MODE="0666"
save and close the file.
then run in terminal:
sudo chmod a+r /etc/udev/rules.d/51-android.rules
cd
gedit .bashrc
in the file that opens, add these next lines to the top of the file:
#AndroidDev PATH
export PATH=${PATH}:${HOME}/android-sdk-linux/platform-tools/
save and close the file, then in terminal, type:
source ~/.bashrc
then in terminal type:
which adb
which adb will show you your adb path. if it says "/home/YOURLINUXNAME/android-sdk-linux/platform-tools//adb" your path is good.
connect your phone, do not mount usb, make sure debugging is checked, then in terminal type:
adb devices
my device showed up as "0123456789ABCDEF device", as long as it says device at the end its good.
create directories
mkdir -p ~/bin
mkdir -p ~/android/system
download repo and make executable
curl https://dl-ssl.google.com/dl/googlesource/git-repo/repo > ~/bin/repo
chmod a+x ~/bin/repo
initialize the repository
cd ~/android/system/
repo init -u git://github.com/TeamHeroC/manifest_aosp_heroc.git
(the repo above is jaybob's repo, there are a couple different repos you can choose from, you can download the AOSP repo, or cyanogenmod's repo aswell from the wiki)
repo sync
copy proprietary files
(must have jaybob's or a cm based rom already flashed to phone)
cd ~/android/system/device/htc/heroc/
./extract-files.sh
build the source
. build/envsetup.sh
lunch aosp_heroc-eng
mka bacon
if all goes well, your rom zip will be in ~/android/system/out/target/product/heroc/
*** when youre initializing the repository, if youre are compiling cyanogenmod's, follow the instructions in the wiki when you get to that section. if you are compiling aosp, follow the instructions on the aosp website. everything before that step should give you a good build environment to decide which source you want to build.***
Thank you:
dastin1015 - i used some of his guide and he is a great developer.
jaybob413 - for being a great developer and for his repo.
cyanogenmod - for the source and some of their guide.
sykopompos - i used some of his guide.
mTeryk - for helping me figure out my adb issue.
youdug - for finding some of the sources and helping me figure everything out.
*reserved*
*second reserved*
glenny buster said:
copy proprietary files
(must have jaybob's or a cm based rom already flashed to phone)
cd ~/android/system/device/htc/heroc/
./extract-files.sh
Click to expand...
Click to collapse
This step should no longer be needed when building from the TeamHeroC repos. I added the proprietary files some time ago to set up one-stop shopping and eliminate the need to do anything other than init, sync, lunch, and build (yes, I am just that lazy). The vendor device makefiles and proprietary files should already be pulled from the vendor_htc_heroc repo into vendor/htc/heroc. If something got trashed, the proprietary files can also be copied from the device/htc/heroc/prebuilt/proprietary folder, and the vendor device makefiles can be regenerated by running setup-makefiles.sh in the device/htc/heroc folder.
It is true that if building from CM7 or other repos, you will probably need to populate the proprietary files into the vendor/htc/heroc/... directories by running extract-files.sh or pulling them from koush's proprietary_vendor_htc repo (where vendor files for all CM7 supported htc devices are stored). You can clone his repo by running (in some other folder/location):
Code:
git clone git://github.com/koush/proprietary_vendor_htc.git
Then copying the heroc folder to vendor/htc/heroc.
This can come in handy if your mobile doesn't have a TeamHeroC or CM7 based ROM loaded, you can't connect to the machine you are building on, or your device is experiencing technical difficulties.
After an initial successful build you should be able to generate an update by another repo sync, lunch, mka bacon.
I would generally recommend doing a make clobber to wipe out the previous build artifacts and ensure a clean build when you generate the update. This does mean that you will recompile everything, so if you are working with a machine that takes a long time to build you may only want to do this if you are having problems or seeing unexpected results. My current build system can do a complete build from scratch in about 15 minutes, so I am now in the habit of doing this every time I build. The machine I originally used to build took over 90 minutes, so I was less likely to invoke clobbering time unless I had issues or was ready to post a release.
awesome guide!!! you the man!

[GUIDE] How to build firefoxOS from source with Ubuntu 12.10/13.04 x64

I have yet to see a good, COMPLETE, step by step tutorial for building firefoxOS, so since I figured it out thought I would document the steps I took and get a good guide going for us.
**This guide is written with Samsung Nexus S 4G (crespo4G) specifically in mind, but it can easily be adapted to any officially supported device
what you will need:
a nexus s 4g (or other officially supported device)
a pc capable of compiling android from source (ie: minimum 2x core cpu, 4gb ram)
ubuntu 12.10 or 13.04 64-bit (google it, it's open source!)
broadband internet (trust me, you want a minimum of 10mbit/sec)
a basic understanding of terminal command, adb and fastboot
ok, let's get started!!
I'll assume you've already installed ubuntu and gotten the network set up. If not, do so now.
First, set up the build environment....
Install java:
Code:
$ sudo add-apt-repository "deb http://archive.canonical.com/ lucid partner"
Code:
$ sudo apt-get update
Code:
$ sudo apt-get install sun-java6-jdk
If you have multiple java installations you need to change the version your system is using
Code:
$ wget http://webupd8.googlecode.com/files/update-java-0.5b
Code:
$ chmod +x update-java-0.5b
Code:
$ sudo ./update-java-0.5b
(it says java 0.5, but it's java 6 don't worry)
choose any java 6 installation and save.
Install android sdk:
download the sdk from android dev site
http://developer.android.com/sdk/index.html
extract it to ~/android/sdk/.....
Code:
$ cd ~/android/sdk/tools
Code:
$ ./android update sdk
update all packages
Install adb & fastboot:
Code:
$ sudo add-apt-repository ppa:nilarimogard/webupd8
Code:
$ sudo apt-get update
Code:
$ sudo apt-get install android-tools-adb android-tools-fastboot
test it!!!
Code:
$ adb devices
Install dependancies:
ubuntu 12.10+ dependancies
Code:
$ sudo apt-get install autoconf2.13 bison bzip2 ccache curl flex gawk gcc g++ g++-multilib gcc-4.6 g++-4.6 g++-4.6-multilib git ia32-libs lib32ncurses5-dev lib32z1-dev libgl1-mesa-dev libx11-dev make
64 bit dependancies
Code:
$ sudo ln -s /usr/lib/i386-linux-gnu/libX11.so.6 /usr/lib/i386-linux-gnu/libX11.so
Code:
$ sudo ln -s /usr/lib/i386-linux-gnu/mesa/libGL.so.1 /usr/lib/i386-linux-gnu/libGL.so
Clone the repo:
Code:
$ git clone git://github.com/mozilla-b2g/B2G.git
Code:
$ cd ~/B2G
Download the source:
Plug in your device, ensure ICS or newer is installed, then enable usb debugging
Code:
$ ./config.sh nexus-s-4g
This is where you can change the guide to work with any supported device. The proper syntax is as follows
Code:
$ ./config.sh (device name)
where (device name) is one of the following:
- galaxy-s2
- galaxy-nexus
- nexus-s
- nexus-s-4g
- otoro
- unagi
- pandaboard
- emulator
- emulator-x86
This takes about an hour
When the source is done downloading, create a file called .userconfig with gedit containing the following two lines of code then save and drop it in ~/B2G
export CC=gcc-4.6
export CXX=g++-4.6
Building from source:
if you're not already there
Code:
$ cd ~/B2G
Code:
$ ./build.sh
*if you get build errors, use a -j option. -j1 option tells your pc to use only one cpu core. -j2 tells it to use 2, and so on...
Using less cpu cores can lead to a more stable build environment and reduce errors
If you use a -j1 option, the syntax is as follows:
Code:
$ ./build.sh -j1
This takes HOURS (probably 4-5)
Flashing b2g:
when it's done, find the .img files in ~/B2G/out/product/target/crespo4g
Code:
$ cd ~/B2G/out/product/target/crespo4g
Boot your device to the bootloader
Code:
$ sudo fastboot flash boot boot.img
Code:
$ sudo fastboot flash system system.img
Code:
$ sudo fastboot flash userdata userdata.img
To create a flashable zip:
plug in your device and enable usb debugging
Code:
$ sudo adb pull /system ~/Documents/crespo4g/b2g
Code:
$ sudo adb pull /data ~/Documents/crespo4g/b2g
add the meta-inf from another nexus s 4g flashable zip
create a .zip with the 3 directories (meta-inf, system and data) and the boot.img you just created
flash in recovery after a FULL wipe (system, boot, data, cache, dalvik)
reserved
Reserved again
Thanks ! Will try this !
Sent from my Nexus s using xda app-developers app
Big Thx Good Guide

[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

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

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

Categories

Resources