[GUIDE] Building froyo from source - Desire Android Development

Here is a guide to building froyo from source for the HTC Desire. I am using Ubuntu 10.4, any Linux distro will do.
Thanks & credits: Defer/deovferreira, AdamG, Kali-
If you are interested in this sort of thing I encourage you to join #teamdesire on irc.freenode.net
Get packages
Code:
sudo apt-get install git-core gnupg flex bison gperf libsdl-dev libesd0-dev libwxgtk2.6-dev build-essential zip curl libncurses5-dev zlib1g-dev valgrind
cd ~
mkdir bin
curl http://android.git.kernel.org/repo >~/bin/repo
chmod a+x ~/bin/repo
Install java (from java.com - not documented here in this post), set some variables and get the aosp source. Edit the path to your java installation if it's not the same as below.
Code:
cat >> ~/.bashrc <<EOF
export JAVA_HOME=/usr/local/java/jdk1.6.0_18/
export ANDROID_JAVA_HOME=$JAVA_HOME
export PATH=$PATH:~/bin:$JAVA_HOME/bin
alias makedroid='make -j$(grep -c processor /proc/cpuinfo) TARGET_PRODUCT=full_bravo | tee build-$(date +%d%m%y%H%M).log'
EOF
. ~/.bashrc
mkdir mydroid
cd mydroid
repo init -u git://android.git.kernel.org/platform/manifest.git -b froyo
repo sync
Please note, if you are using java 1.6 you will need to edit ~/mydroid/build/core/main.mk and comment out the lines that abort the build if you are not using java 1.5 (comment out lines 104-134)
Set up a bravo "vendor". Download defer's vendor files and extract bravo and bravo-common into ~/mydroid/device/htc/
Code:
cd ~/mydroid/device/htc/bravo
Thanks to deovferreira and Kali- for this vendor config.
Now you need to connect your HTC desire and enable usb debugging. This script we are running will pull propriatary files from the device to go into the new system image. You need to pull the files from an Android 2.2 rom or this will fail! Try using OpenDesire from AdamG or DeFrost from RichardTrip
Code:
./extract_files.sh
Configure ulimits (default of 1024 causes 'too many open files' error in Ubuntu). Substitute 'myuser' with your username:
Code:
sudo cat >> /etc/security/limits.conf<<EOF
myuser soft nofile 8192
myuser hard nofile 8192
EOF
You need to exit from your shell and start a new one for this change to take effect.
Now you can start your build!
Code:
cd ~/mydroid
source build/envsetup.sh
makedroid
Check your build.log in ~/mydroid afterwards for errors.
It takes about an hour to build on my 2.3Ghz dual core laptop with 2Gb of ram. Afterwards in out/product/target/bravo you will find system.img and a system directory containing the files to flash to your device (minus symlinks, create those using your update-script -- open up someone elses rom to discover how these work).
Additional - LED notifications
See this post for info on LED notifications: http://forum.xda-developers.com/showpost.php?p=7186561&postcount=117

Good to see your attempting this mate. Keep us informed!
Just a thought, have u tried pulling the files from a froyo rom? Might fix your errors.
-------------------------------------
Sent via the XDA Tapatalk App

If I let the build run it does finish, but I get a generic device, not a bravo specific one... i.e. my vendor is ignored. I don't know how to choose the 'lunch' option in Android 2.2. I'm sure its easy, probably one command, but I can't find the doc that explains how!
Edit, ok just found out how to do this on the android developer site, will give my build another go...
Code:
% cd $TOP
% . build/envsetup.sh
# pick a configuration using choosecombo
% choosecombo
% make -j4 PRODUCT-generic-user

Just a thought. Too many open files may refer to the linux max open file descriptors.
Max is usually 1024 by default which can cause problems for huge builds.
Either do it as root after setting his ulimits with (probably a bad idea)
Code:
ulimit -Hn 8192
ulimit -Sn 8192
or change it for yourself in /etc/security/limits.conf
Code:
myuser soft nofile 8192
myuser hard nofile 8192

Yeah I already ran ulimit (as me, not as root) and it said 'ulimit unlimited'!

st0kes said:
Yeah I already ran ulimit (as me, not as root) and it said 'ulimit unlimited'!
Click to expand...
Click to collapse
Yeah, but the important information is from ulimit -n
(-n is for nofile, you can see all limits with ulimit -a)

Thanks mate you were on the money the with upping the limit in limits.conf. My previous limit was 1024, increasing it to 8192 has overcome that error message!
To build using the custom vendor rather than the generic product:
Code:
make -j2 TARGET_PRODUCT=htc_bravo

I'm happy to see that my first ever post on this forum turned out to be useful for someone, cheers!

st0kes said:
Thanks mate you were on the money the with upping the limit in limits.conf. My previous limit was 1024, increasing it to 8192 has overcome that error message!
To build using the custom vendor rather than the generic product:
Code:
make -j2 TARGET_PRODUCT=htc_bravo
Click to expand...
Click to collapse
After building were you able to successfully flash this to your Desire? Or does it take alot more effort..

There are a few more steps - compiling a kernel (if you don't want to use someone elses) and packing it into a boot.img, and packing the files into an update.zip. I've just had a successful froyo build after making a few more small tweaks. Now just to pack it into an update.zip and flash it ... will let you know if it works!
If it's working I'll go back and update the original post with full instructions.

bookmarked this page! def need this for reference lol

After fixing my laptop and reinstalling kubuntu I'll definitely try this.
This thread should be stickied.

Good job mate. Can't wait to flash this. Fingers crossed.

Nice post, looking forward to see how it works out. That is realy the interesting part - how to get from source to the desire rom.

a lot of the instructions here are similar to the ones found at http://wiki.cyanogenmod.com/index.php/Building_from_source

Updated the original post.
My build is going all the way to the end, but the output does not boot...logcat shows a bootloop and crashdump from the Android framework. Will update with fully working instructions hopefully within a few days!

@st0kes: behnaam-android_vendor_htc_bravo-e409d97.tar.gz does not exist, could you upload it please?

The files exist here
http://github.com/behnaam/android_vendor_htc_bravo

Hi,
i got the following errors:
h**p://nopaste.info/374d05fc39.html
Don't know why. Suggestions?
greetz

Hmm .. You will need to make some small edits in the vendor files ... change all instances of vendor/htc to devices/htc.
For example in BoardConfig.mk
Code:
BOARD_EGL_CFG := vendor/htc/bravo/egl.cfg
In device.mk
Code:
include vendor/htc/bravo/device_bravo.mk
In device_bravo.mk
Code:
DEVICE_PACKAGE_OVERLAYS := vendor/htc/bravo/overlay
There may be some others ...
Code:
find ~/mydroid/devices/htc/bravo -type f -exec grep -l vendor "{}" ";"
My Linux laptop is at home so can't be of much more help ... I'll update the OP with these details though.

Related

How-to compile a fresh Android!

Hi all.
In this thread I'd like to collect all the information I've found scattered in various threads in order to compile Android system and kernel, directly from GIT repo.
Hoping this help who wants to try to compile Froyo from the GIT repo but really doesn't know where to start!!!
All credits for this infos, obviously, doesn't go to me but to all the great persons I've found in this forum, helping me with a lot of informations: Dzo, l1q1d, Kalt_Kaffe, Incubus and many others.
If something of the things written below is not correct... first of all forgive me! I'm only a newbie trying to do something useful for others like me!!! Then please... help me to correct the mistakes!!!
And then, please, forgive my really bad english! Any correction is appreciated!
DISCLAIMER: even if this steps have been personally tested by me everything u'll decide to do u'll do at ur own risk. The flashing procedure may brick your device.
I've implanted all the compiling environment in a virtual machine with the latest Ubuntu (10.04).
NOTE ABOUT VIRTUAL MACHINE: if you are using a virtual machine it's important that you setup it with at least 1,5GB or RAM. With less RAM than this your Android will not compile.
All you need to obtain a fresh Android System is only a lot of time (and patience) and at least 10GB of free disk space.
10GB is the very minimum disk space you need. If you decide to try in a virtual machine I suggest to create a virtual disk at least 20GB.
1) Install needed software
As in the latest Ubuntu version the repositories have the "sun-java6-jdk", with which you cannot compile Android, you have to install the previous Java version from the Jaunty repo. To do this edit, with your favourite text editor and using "sudo", the "etc/apt/sources.list" file adding the following two lines:
Code:
deb http://us.archive.ubuntu.com/ubuntu/ jaunty multiverse
deb http://us.archive.ubuntu.com/ubuntu/ jaunty-updates multiverse
and then, from a terminal, run the following commands:
Code:
sudo apt-get update
sudo apt-get install sun-java5-jdk
After this you can delete/comment the two lines added above in the sources.list file.
Then, according to the instruction described here, install the needed software with the following command:
Code:
$ sudo apt-get install git-core gnupg flex bison gperf libsdl-dev libesd0-dev libwxgtk2.6-dev build-essential zip curl libncurses5-dev zlib1g-dev valgrind
2) Installing repo and configuring the environment
After the installation of the needed software follow this steps to create the right environment for ur compilation. I assume to work in my "/home/virtual" directory. If d'u like to work in another directory simply replace this path with yours in the commands.
Code:
$ mkdir bin
$ PATH=$PATH:/home/virtual/bin/
$ curl http://android.git.kernel.org/repo > /home/virtual/bin/repo
$ chmod a+x /home/virtual/bin/repo
$ mkdir mydroid
$ cd mydroid
3) Downloading, syncing and compiling the source
Now that you are in the destination directory (I've called it "mydroid" but obviously you can call it with every name you want) you've to init and syncing your repo with the one on the server.
The "init" step have to be executed only the first time. Then you can start directly from the "sync" command.
The following steps may need a looooooot of time (about 3 hours in my virtual machine) so you can have one (or two maybe!!!) coffee in the further coffee bar in your city!!!
Anyway let's go:
Code:
$ repo init -u git://androidhtc.git.sourceforge.net/gitroot/androidhtc/manifest -b froyo
$ repo sync
$ . build/envsetup.sh
$ lunch full_vogue-userdebug
$ make
With these commands you'll obtain a system with all languages in it.
You'll find the "system" folder under "out/target/product/vogue". Simply tar it and you're in!!!
4) Compiling the kernel
If you only want to compile the kernel you have to follow this steps (from your repo dir - "mydroid" in my case)
Code:
$ cd kernel
Open, with your favourite text editor, the file "Makefile" and change the CROSS_COMPILE line like the following:
Code:
CROSS_COMPILE=../prebuilt/linux-x86/toolchain/arm-eabi-4.4.0/bin/arm-eabi-
then run the following commands:
Code:
make vogue_defconfig
make
After the compilation you'll find the "zImage" file into "kernel/arch/arm/boot/" and use it like you want (I.E. I compile it with NBHCreator in order to flash it into my Polaris).
That's all, folks!!!
Enjoy!
Initializing project gps ...
fatal: The remote end hung up unexpectedly
error: Cannot fetch gps
way not?
did it finish or did it get stuck and there is more to fetch?

[HOWTO][VM][Compile]Setup Lubuntu for Android compiling (VirtualBox Option)

This Guide is intended to fast-track the curious Windows user into the world of Compiling Android With Linux
It does not cover Linux in depth and does not cover hacking the code.
It does include an introduction to git by way of an example (replacing the default Kernel)
I hope it proves helpful
Below I shall run through setting up VirtualBox and installing Lubuntu.
Lubuntu is a lighter alternative to Ubuntu targeted at older/low powered hardware which makes it ideally suited to running in a VM.
Before we start, I would like to make it clear that unless you have a powerful,memory rich PC, compiling Android inside a VM is not ideal.
Having said that, You can probably get some mileage on a reasonably spec'ed Machine. And this should prove helpful to those who are not quite ready to take the plunge and install a native linux.​
The latter half of the guide detailing Lubuntu will also work running native on the bare metal. Just ignore the VB driver parts.
If you haven't already, Download an iso from http://cdimages.ubuntu.com/lubuntu/releases/11.10/release/
I will be working through the desktop version
if you have a 64-bit PC *AND* your current OS is 64-bit get the lubuntu-11.10-desktop-amd64.iso
if your PC or OS is 32-bit then lubuntu-11.10-desktop-1386.iso is what you want.
As well as a {L}ubuntu disk, you will need:
VirtualBox https://www.virtualbox.org/ optionally grab the extension pack for usb2 support
At least 25 GB free disk space with large file support
A working internet connection, the CM source is 9GB so have that in mind.
VirtualBox Installation
Bit of a no brainer, just install it like any other program
At some point it may prompt you to download Additions, not to be confused with the extension pack.
The Additions Pack is an .iso containing drivers for the guest OS's, video, clipboard etc.
VirtualBox Setup
Once VirtualBox has installed open it
If you downloaded the extensions pack install it as follows:
file >> preferences >> extensions
click the add package icon and navigate to the download
Now create a virtual machine
click new >> next
give it a name like "AndroidCompiler"
OS Type "Linux"
Version "Ubuntu" >> next
The Version is not particularly important, as far as I know it is just for the icon.​
increase the memory , keeping it in the green >> next
create new disk >> next
VDI >> next
Fixed size >> next
select the location (for example your second hard drive X: or whatever)
change the size to 5.00 GB, if the slider is a pita just type it >> next
If you can afford it a larger disk will not hurt, 10GB should be plenty​
review and >> create >> create again
The basic VM is now complete
Fine tune the VM Settings
Highlight the new VM and hit Settings
system
Motherboard tab
in boot order select hdd and 'move' it to the top of the list with the up icon
Processor tab
tick enable PAE/NX
select number of CPUs
Note that if you use all of your cpu cores it will slow down your host​
Display
Video tab
tick enable 3D
Network
Adapter 1 tab
Attached to Bridge Adaptor
Name < select your NIC >
Advanced >
Promiscuous Mode : Allow All
Storage
highlight the empty CD
click the cd icon to the far right
Choose a virtual cd/dvd, (your iso d/l)
highlight the sata Controller
add hard disk (3 stacked disks icon) >> create new disk
create a new disk called AndroidSrc or something, it must be at least 20GB (40GB recommended)
if you plan on playing with ics then triple it​
Shared Folders
add new folder
tick auto mount
navigate to a folder (or create a new one)
this will be used to transfer files between your OS and the VM​
Now click OK, and then start
Installation of Lubuntu
You will be presented with a rather ugly language selection, pick one
Then select install Lubuntu
Ignore any errors about smbpii4 bios blah blah..
Language selection (again but nicer looking) >> continue
Tick download updates while installing >> continue
select something else >> continue
select /dev/sda >> new partition table
select /dev/sda free space >> add
type = logical
size = 555
location = end
use as = swap area
>> OK
Normally Linux Distos create a swap the same size as physical memory.
This is so physical memory can be dumped to swap when going into hibernation (save state with no power use)
Since VirtualBox has it's own Save State feature we don't need it.
And for what it's worth I have always found the resume after hibernate to be painfully slow​
select /dev/sda free space >> add
type = primary
size = <what it says>
location = beginning
use as ext4
mount point = /
>> ok
tick format for /dev/sda2
select /dev/sdb >> new partition table
select /dev/sdb free space >> add
type = primary
size = <what it says>
location = beginning
use as ext4
mount point = /Android
>> ok
tick format for /dev/sdb1
unless you are re-using an old Android source disk​
>> install now
Where are You?
Lubuntu guesses from your IP, if needed correct it​ >> continue
Keyboard setup >> continue
username / password >> continue
wait for it to finish
>> restart now! -- press enter when prompted
You should now be booted to Lubuntu
Ignore the update manager, we will get the script to deal with that.
VirtualBox Drivers
Next to the clock should be a pci card icon
click it
install drivers
activate >> input your password
wait .....
when finished >> close
bottom left is some strange icon, it is the main menu
click it >> logout >> logout (no need to reboot yet) >> login again
Shared Folders
Main Menu >> system tools >> users and groups
Manage Groups >> vboxsf >> Properties >> tick your username
Main Menu >> Accessories >> LXTerminal (right click >> add to desktop, if you like)
The reason for the earlier logout and back in was to activate the VB host to VM clipboard
The below script will install the required packages
It will work for both 32 and 64 bit
The script is based on instructions for 11.10
It will probably work on 11.04 and may even work on 10.xx but I have only tested against Lubuntu 11.10 both 32 and 64 bit
It is not specific to Lubuntu and should work with any Ubuntu 11.10 derivative
To paste with the keyboard ctrl+shift+v *NOT* ctrl+v
ctrl+shift+c to copy​copy and paste this to the term.
Code:
cat > ~/setup.sh << "EOF"
#!/bin/bash
sudo apt-get update
# Reference : http://source.android.com/source/initializing.html
case $(uname -m) in
x86_64) # packages for 64-bit
sudo apt-get -y install git-core gnupg flex bison gperf build-essential \
zip curl zlib1g-dev libc6-dev lib32ncurses5-dev ia32-libs \
x11proto-core-dev libx11-dev lib32z-dev \
libgl1-mesa-dev g++-multilib mingw32 tofrodos python-markdown \
libxml2-utils xsltproc
sudo apt-get -y install lib32readline-gplv2-dev || \
sudo apt-get -y install lib32readline5-dev
case $(awk -F"=" '/DISTRIB_RELEASE/ {print $NF}' /etc/lsb-release) in
11.10|11.04) sudo apt-get -y install libx11-dev:i386 ;;
10.10|10.04) sudo ln -s /usr/lib32/mesa/libGL.so.1 /usr/lib32/mesa/libGL.so ;;
esac ;;
i?86) # packages for 32-bit
sudo apt-get -y install git-core gnupg flex bison gperf build-essential \
zip curl zlib1g-dev libc6-dev libncurses5-dev x11proto-core-dev \
libx11-dev libreadline6-dev libgl1-mesa-dev tofrodos python-markdown \
libxml2-utils xsltproc ;;
*) echo "Error: Machine type not recognised" && exit 1;;
esac
# Extras for CyanogenMod builds
sudo apt-get -y install squashfs-tools \
pngcrush libsdl1.2-dev \
libesd0-dev \
libwxgtk2.6-dev \
schedtool
# system update
sudo apt-get -y upgrade
# install sun java jdk
# Reference : top google hit for " ubuntu 11.10 sun-java6-jdk "
# http://www.gaggl.com/2011/10/installing-java6-jdk-on-ubuntu-11-10/
case $(awk -F"=" '/DISTRIB_RELEASE/ {print $NF}' /etc/lsb-release) in
11.10) codename=oneiric;;
11.04) codename=natty;;
10.10) codename=maverick;;
11.10) codename=lucid;;
*) echo "Error: Unrecognised ubuntu version";exit 1;;
esac
test -e /etc/apt/sources.list.d/ferramroberto-java-${codename}.list || \
echo | sudo add-apt-repository ppa:ferramroberto/java
sudo apt-get update
sudo apt-get -y install sun-java6-jdk sun-java6-plugin
# The default lubuntu install does not include java
# but other ubuntu derivatives may include openjdk
Java6Sun=$(echo | update-alternatives --config java | awk '/java-6-sun/ && ($1 !~ /*|^There/){print $1}')
test "$Java6Sun" != "" && echo $Java6Sun | sudo update-alternatives --config java
# create ~/bin if it does not exist
install -v -d ~/bin
# clean up
rm $0
EOF
Now run the script
Code:
bash ~/setup.sh
It will ask for your password
eventually you will be asked to read and accept the Sun Java licence
Once all that is done..
The updates will have installed a new kernel, and we still haven't loaded the VMs special video/shared folder drivers yet so it is time for a reboot
Like the logout we did earlier, but reboot.
Now that you have rebooted lets fix the permissions for our source partition
open a term
Code:
sudo chown $USER:$USER /Android
replace Android with the mount point you gave for your source drive
make a directory for the CM src
Code:
mkdir /Android/CM
cd /Android/CM
Now to get the src
#
# http://source.android.com/source/downloading.html
# http://wiki.cyanogenmod.com/wiki/HTC_Dream_&_Magic:_Compile_CyanogenMod_(Linux)
Code:
curl https://dl-ssl.google.com/dl/googlesource/git-repo/repo > ~/bin/repo
chmod a+x ~/bin/repo
repo init -u git://github.com/CyanogenMod/android.git -b gingerbread
repo sync -c -j16
The CM wiki advises repo sync -j16
You will be downloading 9 GB, depending on the speed of your connection this may take some time
Reduce the number of threads(16) if you don't want to saturate your connection
NEW : 2012-03-10
added -c to the repo sync.
-c tells repo to only fetch the current branch which will save time and diskspace
If you are interested in comparing branches then leave out -c
don't forget to include -c with all future repo syncs
using -c will save approx 2GB diskspace as well as network bandwidth (7GB instead of 9GB)​
use this table to get an approximation of how long it will take
Code:
10GB @ 60 Mbit/s 0.46 hrs ( 28 mins)
10GB @ 40 Mbit/s 0.69 hrs ( 42 mins)
10GB @ 20 Mbit/s 1.39 hrs ( 83 mins)
10GB @ 10 Mbit/s 2.78 hrs ( 167 mins)
10GB @ 5 Mbit/s 5.56 hrs ( 333 mins)
10GB @ 2.5 Mbit/s 11.11 hrs ( 667 mins)
10GB @ 1 Mbit/s 27.78 hrs ( 1667 mins)
Assumes Max throughput
When setting up the VM we created a bridge to one of your NICs
If you are on a laptop and switch between wire and wireless, you can also with the VM
Devices >> network adaptors (the VirtualBox Menu)
You could try setting up a 2nd adapter, one for wire and the other wireless, net traffic should be routed automatically
You can only add adaptors while the VM is Powered Off​
When repo sync has completed
Setting up the Environment
Setting up the Environment needs to be done with each new shell session
make sure you are in the repo root
A quick glance at your command prompt should tell you where you are
Code:
source build/envsetup.sh
alternative:
Code:
. build/envsetup.sh
that is <dot><space>bui​
Setting up the build
ccache
not to be confused with compcache, ccache can help speed up recompilations
More information can be found on cm's wiki here
and in google's http://source.android.com/source/initializing.html
Code:
export USE_CCACHE=1
# for reboots and new shell sessions
echo "export USE_CCACHE=1" >> ~/.bashrc
by default ccache uses ~/.ccache we won't have enough space
Code:
export CCACHE_DIR=/Android/.ccache
# for reboots and new shell sessions
echo "export CCACHE_DIR=/Android/.ccache" >> ~/.bashrc
The default max cache size is 976.6 MB (that is what is reported,could be a / 1024 screwup ), this will just about fit our min sized 20GB drive
http://source.android.com/source/initializing.html recommends between 50 and 100 GB. I imagine this is to accommodate multiple targets
space permitting between 5 and 10 GB should be fine for a single device
if you have a 20GB Android drive then leave it at the default
If you opted for a larger drive, adapt to suit
for 5 GB :
Code:
prebuilt/linux-x86/ccache/ccache -M 5G
The setting is stored in CCACHE_DIR so unless you want to change it forget about it.
Lets do lunch
don't ask me why it is called lunch. My best guess is a play on Menu
Code:
lunch
and select your target
when you get bored of seeing that lunch menu
Code:
lunch cyanogen_dream_sapphire-eng
Proprietary Files
The Proprietary Files need to be put into the vendor tree
You have two options:
Extract from a zip
Extract from your device
I'm going to walk through Option 1
Remember the Shared Folder we created?
Well we are going to use that now.
On your Host system copy a recent ROM zip to the folder your shared with the VM
good choices are : ezginger, ADS_magpie, dw9906
in your VM's terminal,
Code:
ls /media/
you should see a folder sf_<Name> and in that folder your rom zip
There are two scripts in device/htc/dream_sapphire/
unzip-files.sh and extract-files.sh
Unfortunately the unzip-files.sh script is not up to date with extract
You can manually fix it or use my script which converts the extract script to an unzip script
to use it:
set a environment var like so
Code:
ROM=/me<tab>s<tab><tab>
<tab> is the tab key, please don't type <tab>
read this to get an idea of what is happening​eventually you should have something like
ROM=/media/sf_5gb/ADS_magpie-V1.0-signed.zip
Code:
pushd device/htc/dream_sapphire
#awk '/adb pull/{sub(/adb pull/,"unzip '$ROM'")sub(/\.\./,"-o ..")};{print}' extract-files.sh | sh
# 2012-03-19 corrected the above script, it should be :
awk '/adb pull/{sub(/adb pull \//,"unzip -o '$ROM' ")sub(/.*/,"-d ../../../vendor/htc/$DEVICE/proprietary/",$NF)};{print}' extract-files.sh | sh
popd
pushd and popd
The above step only needs to be done the once
that is unless the proprietary files require changes, for instance a switch to open sourced versions
Kernel
The DS kernel in CM is old so I added ezterry's latest
I shall show you how, but we are taking the scenic route
We shall create our own git repo and add that to a local_manifest
Configure git
This is a global config, you should only need to do it once per user
Code:
git config --global user.name "Your Name Comes Here"
git config --global user.email [email protected]
taken from file:///usr/share/doc/git-doc/gittutorial.html
Install git docs with
Code:
sudo apt-get install git-doc
Create a git repo and push to it
Code:
git init /Android/my_git_repos/device_htc_dream_sapphire
cd /Android/CM/device/htc/dream_sapphire
git push file:///Android/my_git_repos/device_htc_dream_sapphire github/gingerbread
Now let's have a look
Code:
cd /Android/my_git_repos/device_htc_dream_sapphire
ls
you will see it is empty
But wait.. is it empty?
Code:
ls .<tab><tab>
Code:
git branch -a
git checkout gingerbread
ls
git log # q to exit
git log -p
now lets make some changes
Remember the shared folder?
Well I hope you have ezterry kernel pack in there
Code:
unzip /media/sf_<REPLACEME>/ezgb-2636-v1.5.2_S.zip *2708*
mv 2708-zImage kernel
mv mod-2708/modules.sqf prebuilt/
rmdir mod-2708/
git status
edit full_dream_sapphire.mk
change
device/htc/dream_sapphire/prebuilt/wlan.ko:/system/lib/modules/wlan.ko \
to
device/htc/dream_sapphire/prebuilt/modules.sqf:/system/lib/modules/modules.sqf \
we can do this with a simple sed
Code:
sed -i -e 's[/wlan.ko[/modules.sqf[g' full_dream_sapphire.mk
now
Code:
git diff
Code:
git add full_dream_sapphire.mk kernel prebuilt/modules.sqf
Since the wlan.ko is of no use to us (we replaced the kernel it was for) we need to remove it
but not just from the filesystem but git as well
Code:
git rm prebuilt/wlan.ko
Have another look at git status and git diff
notice that git diff produces no output
now try git diff --cached
commit the staged changes with
Code:
git commit
The default editor for git is nano
^ == ctrl
^O == ctrl+o
write commit notes
Code:
Updated Kernel and kmodules to 2708 ezgb-2636-v1.5.2
http://forum.xda-developers.com/showpost.php?p=14768272&postcount=2427
to save Ctrl+o<enter>
to exit Ctrl+x
if you prefer vim
Code:
git config --global core.editor vim
don’t forget to install vim​Adding a local_manifest.xml
Code:
cat > /Android/CM/.repo/local_manifest.xml << "EOF"
<?xml version="1.0" encoding="UTF-8"?>
<manifest>
<remote name="Local"
fetch="file:///Android/my_git_repos/" />
<project path="device/htc/dream_sapphire" remote="Local" name="device_htc_dream_sapphire" revision="gingerbread" />
</manifest>
EOF
Apologies My initial post had an error in the above codebox
it should be fetch="file:///Android/my_git_repos/" not fetch="file:///Android/my_git_repos/device_htc_dream_sapphire/"​
make sure you are in /Android/CM/
repo sync
Then look in device/htc/dream_sapphire to see if your changes were applied
Code:
pushd device/htc/dream_sapphire
git branch -a # look for remotes/m/gingerbread -> Local/gingerbread
git log -p # you should see your commit notes
popd
Remove RomManager
Optionally remove RomManager from the build
Code:
sed -i '/RomManager/d' vendor/cyanogen/products/common.mk
The above is not permanent, when you repo sync it will be reverted
That is unless you commit the change​if you want RomManager then
Code:
./vendor/cyanogen/get-rommanager
finally build it
Code:
mka bacon
It is going to take a while depending on the speed of your machine and the memory/cpu cores you gave the VM (if you are using a VM)
Lets hope you don't get any build errors
If all goes well you should end up with a zipfile in /Android/CM/out/target/product/dream_sapphire/
Don't forget your /media/sf_ folder, cp the completed zip to that and from there you can treat it like any other rom
I hope you had fun following this
reserved for extras
like editors, linux tipsntricks, github, eclipse
moar extraz
I was under the impression that 64-bit linux was required now to compile android from source.
I compiled AOSP froyo with the following specs fine:
Ubuntu 10.04 (tried both native and vm)
Pentium 4 3.20ghz Hyper-Threaded
32-bit of course
3.12 GB of RAM
It took about two hours but not as bad as I thought, and it worked
Anyways thank you Scrip for this wonderful guide (yes I'll thank you in a second).
I knew 70%ish of this, and you helped fill up the rest of the holes for me
Thanks a lot man.
I'm sorry for kinda yelling back at you earlier
One question: Is there any hope for grabbing the cm6 source? It's been broken with a lot of files missing for a while now.
select /dev/sda free space >> add
type = primary
size = <what it says>
location = beginning
use as ext4
mount point = /
>> ok
tick format for /dev/sda2
Click to expand...
Click to collapse
Tried this and no matter how many times I do it it still makes the entire 12GB sda partition the SWAP space.
EDIT: So solution is not to type in "555" but to use the arrow selection button to drop it down to "555".
wergeld said:
I was under the impression that 64-bit linux was required now to compile android from source.
Click to expand...
Click to collapse
Pointless and inaccurate post
Come back when you can prove 32-bit won't compile Android
Post the appropriate errors and I will do my best to resolve it
Scrip said:
Pointless and inaccurate post
Come back when you can prove 32-bit won't compile Android
Post the appropriate errors and I will do my best to resolve it
Click to expand...
Click to collapse
Woah, just asking. I saw this:
Ubuntu 10.04 64-bit is recommended. Building using a newer version of Ubuntu or a 32-bit Ubuntu is currently only experimentally supported and is not guaranteed to work on branches other than master.
Click to expand...
Click to collapse
This is taken from http://source.android.com/source/initializing.html
I just wanted to make sure that yes, you can compile against 32-bit before I spend a while setting this up.
wergeld said:
Tried this and no matter how many times I do it it still makes the entire 12GB sda partition the SWAP space.
EDIT: So solution is not to type in "555" but to use the arrow selection button to drop it down to "555".
Click to expand...
Click to collapse
no idea what is wrong there
try the other way round
with a clean 12gb partition
primary = < size - 555 >
use as = ext4
mount point = /
you could just let ubuntu set everything up
downside is
I will need to add instruction to mount the /Android drive
+ wasted diskspace
but again, I don't see why
Scrip said:
no idea what is wrong there
try the other way round
with a clean 12gb partition
primary = < size - 555 >
use as = ext4
mount point = /
you could just let ubuntu set everything up
downside is
I will need to add instruction to mount the /Android drive
+ wasted diskspace
but again, I don't see why
Click to expand...
Click to collapse
No worries on that. Ghost in the Machine maybe. Coming from TFS and VS2010 I have come accustomed to oddball things like this.
So far so good. Best part is the package script you have up there. Waiting to finish package installs...
frankdrey said:
I compiled AOSP froyo with the following specs fine:
Ubuntu 10.04 (tried both native and vm)
Pentium 4 3.20ghz Hyper-Threaded
32-bit of course
3.12 GB of RAM
It took about two hours but not as bad as I thought, and it worked
Anyways thank you Scrip for this wonderful guide (yes I'll thank you in a second).
I knew 70%ish of this, and you helped fill up the rest of the holes for me
Thanks a lot man.
I'm sorry for kinda yelling back at you earlier
One question: Is there any hope for grabbing the cm6 source? It's been broken with a lot of files missing for a while now.
Click to expand...
Click to collapse
I can't say it will build
look at the repo init command
-b <branch>
so if you replace gingerbread with froyo you will checkout cm6
if you have already added the local_manifest then you need to delete that before a repo sync
I will probably cover this in post 2/3
post 1 is basic
my idea is to get people interested
posts 2 and 3 will deal with extras, in post 1 I skipped basics like text editing
mostly because I have no idea how to deal with that.
Personally I use vim or kate
But I plan (if there is interest) on adding eclipse, which would make a text editor redundant
Yes I have downloaded the source for froyo before
A lot of the files are missing and repo sync doesn't complete
I know that all alsa-related files are missing, but there is more that I might have forgotten by now
frankdrey said:
Yes I have downloaded the source for froyo before
A lot of the files are missing and repo sync doesn't complete
I know that all alsa-related files are missing, but there is more that I might have forgotten by now
Click to expand...
Click to collapse
if post (or better pastebin.com)
the errors I can look
I've not tested these instructions against froyo , but I did at least get a zip from froyo asop a while back
missing files stinks of a screwed up prop mk
Yes AOSP works fine
CM6 doesn't
I'll post the errors when I find the time to get it all set up.
That may not be for a while though .
frankdrey said:
Yes AOSP works fine
CM6 doesn't
I'll post the errors when I find the time to get it all set up.
That may not be for a while though .
Click to expand...
Click to collapse
I think cm6 still points to android.git.kernel.org (which is gone). I was gonna fork from cm and change it to the right place but I haven't got around to it yet....
tvall said:
I think cm6 still points to android.git.kernel.org (which is gone). I was gonna fork from cm and change it to the right place but I haven't got around to it yet....
Click to expand...
Click to collapse
Yes I fixed that part.
but there were a whole buncha repos missing, the alsa one is all i can remember right now
WOW! Very well done! I love how you cited your sources and everything.
I appreciate the time and effort you put into this. Definately makes for a great reference.
Sent from my HTC PH39100 using Tapatalk
Thank you very much for this great tutorial! Even if I knew already most of the things, it's very useful to have such a tutorial here. We will see if this tutorial helps to increase the number of active android developers ...
Btw.: this thread should become sticky.
AndDiSa said:
Btw.: this thread should become sticky.
Click to expand...
Click to collapse
+1
Sent from my HTC PH39100 using Tapatalk
Left for work and set up the repo sync. Hopefully when I get home I can get a compile going. Thanks!

[GUIDE][DEV] Compile any source built rom for your device [ULTRA NOOB FRIENDLY]

I know there are many other guides avalable regarding this, But I tried to focus on the small points also that many guides overlook
that's why I have this for you. Do let know if I have missed something or more details have to be included in case still there is a difficulty in compiling
This thread on Madteam Forums: http://madteam.co/forum/development...lt-rom-for-your-device-(ultra-noob-friendly)/
So lets start with simple things
Basic FAQ:
Q: What is a Source built rom?
A: Source Built Roms are roms that are compiled from source on a Linux Platform! They are not themed manually.
Q: How do we build these type of roms?
A: Setup Linux and then follow this guide.
Click to expand...
Click to collapse
This post/guide is divided into 4 parts:
1. Setting up build environment
2. Machine specifications etc.
3. Device Tree and source basics
4. Syncing Source and Building
PART 1: Setting up build environment​
Type sudo su and then your password to get rid of Admin Permissions
#Installing Python
STEP 1: Open terminal (CTRL + ALT + T)
Then execute the following commands in terminal one by one
Code:
sudo apt-get install build-essential gcc
cd Downloads
wget http://www.python.org/ftp/python/2.5.6/Python-2.5.6.tgz
tar -xvzf Python-2.5.6.tgz
cd Python-2.5.6
./configure --prefix=/usr/local/python2.5
make
sudo make install
sudo ln -s /usr/local/python2.5/bin/python /usr/bin/python2.5
Now Python is configured
#Installing JDK
As far as I know PPA which was the earlier method of installing JDK etc. doesn't exist's anymore, So I used another way!
Step 1: Open Terminal (CTRL + ALT + T)
STEP 2: Now we need to download the JDK 6 Binary by executing this command in terminal
Code:
wget --no-check-certificate --no-cookies --header "Cookie: gpw_e24=http%3A%2F%2Fwww.oracle.com" "http://download.oracle.com/otn-pub/java/jdk/6u45-b06/jdk-6u45-linux-x64.bin"
STEP 3: Then we need to run the binary and move it to a shared location:
Code:
chmod +x jdk-6u45-linux-x64.bin
sudo ./jdk-6u45-linux-x64.bin
sudo mv jdk1.6.0_45 /usr/lib/jvm/
STEP 4: Now you have to install all binaries and give them highest priority, This will also overwrite the previous version of Java Binaries in your computer
Code:
sudo update-alternatives --install /usr/bin/java java /usr/lib/jvm/jdk1.6.0_45/bin/java 1
sudo update-alternatives --install /usr/bin/javac javac /usr/lib/jvm/jdk1.6.0_45/bin/javac 1
sudo update-alternatives --install /usr/bin/javaws javaws /usr/lib/jvm/jdk1.6.0_45/bin/javaws 1
sudo update-alternatives --install /usr/bin/jar jar /usr/lib/jvm/jdk1.6.0_45/bin/jar 1
sudo update-alternatives --install /usr/bin/javadoc javadoc /usr/lib/jvm/jdk1.6.0_45/bin/javadoc 1
STEP 5: Now check if JDK 1.6 is selected on this:
Code:
sudo update-alternatives --config java
sudo update-alternatives --config javac
sudo update-alternatives --config javaws
sudo update-alternatives --config jar
sudo update-alternatives --config javadoc
Now JDK is configured! To check if it is done
Execute this is Terminal
Code:
java -version
Output will be similar to this
Code:
java version "1.6.0_45"
Java(TM) SE Runtime Environment (build 1.6.0_45-b06)
Java HotSpot(TM) 64-Bit Server VM (build 20.45-b01, mixed mode)
#Installing GNU Make
Code:
cd Downloads
wget -o make.tar.gz http://ftp.gnu.org/gnu/make/make-3.81.tar.gz
tar -xvzf make-3.81.tar.gz
cd make-3.82
./configure
sudo make install
These commands are for Make 1.81 if you want to install Make 1.82 Execute these
Code:
cd
wget -o make.tar.gz http://ftp.gnu.org/gnu/make/make-3.82.tar.gz
tar -xvzf make-3.82.tar.gz
cd make-3.82
./configure
sudo make install
Now GNU make is configures
#Installing Android SDK
STEP ONE: Download the SDK from http://developer.android.com/sdk/index.html and extract it in a folder called "sdk" in the Downloads folder
STEP TWO: Now, Execute these commands in terminal
Code:
cd ~/Downloads/sdk/tools/
./android sdk
SDK is configured now :victory:
#Installing required packages:
STEP 1: Open Terminal
Now execute these commands:
Code:
apt-get install git-core gnupg flex bison gperf build-essential \
zip curl zlib1g-dev libc6-dev libncurses5-dev x11proto-core-dev \
libx11-dev libreadline6-dev libgl1-mesa-dev tofrodos python-markdown \
libxml2-utils xsltproc pngcrush gcc-multilib lib32z1 schedtool
Good, Now you have successfully setup linux build environment!​
PART 2: Machine specifications and other misc. stuff​
Basic Computer Specs:
2Ghz Dual Core Processor
2GB Minimum ram
50GB File Space (For only one rom source)
*PLEASE NOTE*: This is the basic specification, It really depends on the condition of your ram and cpu!
If you want to use other apps while compilation you should make a 5GB minimum swap partition!
If ram is more than 4GB ram then you don't swap partition!
PART 3: DEVICE TREE AND SOURCE BASICS​
Basic source folders:
/packages - Proprietary rom applications
/framework - Framework (Overall rom UI and stuff)
/device - Device config
/vendor - Vendor Tree and other vendor files
/hardware - Hardware drivers
Q: What is BoardConfig.mk?
A: It's the file where you setup path's to files like toolchain etc. and enable/disable stuff, its very easy to understand. You can find it in your device's tree
Q: Where is build.prop in source?
A. Build.prop is available in the source in the form of system.prop in the device tree!
Q: How to remove ringtones, video editor, CM wallpapers from bulid?
A: Go to device/releasetools/extras.txt and Delete anything you don't want in your build
PART 4: Syncing Source and Building​
# Installing Repo Package
Code:
mkdir ~/bin
curl https://dl-ssl.google.com/dl/googlesource/git-repo/repo > ~/bin/repo
chmod a+x ~/bin/repo
STEP 2: Now it is recommended to reboot your computer (No need of sudo su after reboot)
STEP 3: Now make directory:
Code:
mkdir -p ~/rom/android/system
STEP 4: Go into directory and set path for Repo Package
Code:
cd ~/rom/android/system
PATH=~/bin:$PATH
STEP 5: NOW ITS TIME FOR SYNCING:
Their are different sources for different roms:
Some are listed bellow:
MIUI - www.github.com/micode/
Rootbox - www.github.com/Root-Box/
rasbeanjelly - www.github.com/rascarlo/
Xylon AOSP - www.github.com/xyaosp/
PAC-Man - www.github.com/PAC-Man/
CyanogenMod - www.github.com/Cyanogenmod/
CarbonROM - www.github.com/carbondev/
SaberMOD - www.github.com/SaberMOD/
AOKP - www.github.com/AOKP/
From the above collection some are Gingerbread some are ICS and some are JB 4.1/4.2 you have to visit these links via browser and see which source is which and follow the commands given at android.git/platform_manifest.git
Click to expand...
Click to collapse
For CM10.1 source execute this:
Code:
repo init -u git://github.com/CyanogenMod/android.git -b cm10.1
For syncing CM10 source execute:
Code:
repo init -u git://github.com/CyanogenMod/android.git -b jellybean
You have to find for the rest!!
PS: You don't have to execute all the repo init commands written above
Now to sync execute this after the the repo init command
Code:
repo sync
Once it finishes without breaking all the folders will appear in rom/android/system folder
now execute this:
Code:
mkdir -p ~/rom/android/system/device/<ManufacturerName>/<DeviceCodeName>
and extract the device config/tree here
for me its samsung/totoro (galaxy Y, Don't mind )
then do the following:
Code:
mkdir -p ~/rom/android/system/vendor/<ManufacturerName>/<DeviceCodename>
Its the same as for the device folder
Now for compiling:
Code:
. build/envsetup.sh
lunch cm_<DeviceCodename>-eng
brunch cm_<DeviceCodename>-eng
Your build will be located at /rom/android/system/out as <RomName>-date/month/year-UNOFFICIAL-<DeviceCodeName>.zip
HAPPY COMPILING ​
Credits:
MadTeam (motafoca, whitexp etc.) for MADTeam Forums and many help
Team Broadcom CM (bieltv.3, SpaceCaker, Psychogame etc.) for giving my device a quite stable cm.. I learnt to compile because of them! Cheers
BeerGang
mithun46
abhisahara
galaxyfreak
cybojenix
Sniper Killer for supporting me a lot! Thanks dude
prototype-U for Supporting..
Others who supported me
IF YOU LIKE MY GUIDE, DO RATE THIS THREAD A FIVE STAR!
THOSE WHO ARE FACING ERRORS, DO POST YOUR PROBLEM at speed_bot's Source Building Help Thread ​
Good good !! Nicely compiled
abhisahara said:
Good good !! Nicely compiled
Click to expand...
Click to collapse
Thanks
I'll update this guide whenever I get time
Good work on this, I found it quite clear keep up the good work!
Sent from my GT-I9505 using Tapatalk 4 Beta
nicely copied
Aniruddh Chandratre said:
nicely copied
Click to expand...
Click to collapse
Just read what I said at the begging of the thread!
If you are too lazy then:
I know there are many other guides avalable regarding this, But I tried to focus on the small points also that many guides overlook
that's why I have this for you. Do let know if I have missed something or more details have to be included in case still there is a difficulty in compiling
Click to expand...
Click to collapse
And yes, I took reference from others guide... I do give credits!
Have you ever compiled it(successfully) yourself?
Sent from my HTC Desire X using xda app-developers app
prototype-U said:
Have you ever compiled it(successfully) yourself?
Sent from my HTC Desire X using xda app-developers app
Click to expand...
Click to collapse
Yes.. I did..
Thanks for your support
Arnav.G said:
Yes.. I did..
Thanks for your support
Click to expand...
Click to collapse
Where is it?
Sent from my HTC Desire X using xda app-developers app
prototype-U said:
Where is it?
Sent from my HTC Desire X using xda app-developers app
Click to expand...
Click to collapse
It will come...
Please don't spam the thread now! I know you are a RC and you know the rules but still.. Please
http://xda-university.com/as-a-developer/getting-started-building-android-from-source
Nice simplifications...
Noob friendly? Lol! Did you test it on yourself!
When I run the binaries on jdk
I get errors on the 2nd command-Syntax error
Why >
Fang Leone said:
When I run the binaries on jdk
I get errors on the 2nd command-Syntax error
Why >
Click to expand...
Click to collapse
Can you please explain your problem in a little more details?
"This Story Ends Where It Began" - Octavarium (Dream Theater)
Sent from my GT-I9505
Great Guide!!
This is very kind of you to make this helpful thread. It really helped me alot after setting up my new build environment. I ran into an error on you post that you may want to correct, other than that, great work! Here is the typo
"cd Downloads
wget -o make.tar.gz http://ftp.gnu.org/gnu/make/make-3.81.tar.gz
tar -xvzf make-3.81.tar.gz<--this is correct.
cd make-3.82<---it changes here.
./configure
sudo make install"
Hello guys!
I have an error at brunch:
Code:
host Java: guavalib (/home/richard/android/system/out/host/common/obj/JAVA_LIBRARIES/guavalib_intermediates/classes)
logtags: /home/richard/android/system/out/target/common/obj/JAVA_LIBRARIES/framework_intermediates/src/core/java/android/content/EventLogTags.java <= frameworks/base/core/java/android/content/EventLogTags.logtags
logtags: /home/richard/android/system/out/target/common/obj/JAVA_LIBRARIES/framework_intermediates/src/core/java/android/speech/tts/EventLogTags.java <= frameworks/base/core/java/android/speech/tts/EventLogTags.logtags
logtags: /home/richard/android/system/out/target/common/obj/JAVA_LIBRARIES/framework_intermediates/src/core/java/android/webkit/EventLogTags.java <= frameworks/base/core/java/android/webkit/EventLogTags.logtags
[B]make: *** No rule to make target `/home/richard/android/system/out/host/linux-x86/bin/dx', needed by `/home/richard/android/system/out/target/common/obj/APPS/Apollo_intermediates/proguard.classes-with-local.dex'. Stop.[/B]
make: *** Waiting for unfinished jobs....
logtags: /home/richard/android/system/out/target/common/obj/JAVA_LIBRARIES/telephony-common_intermediates/src/src/java/com/android/internal/telephony/EventLogTags.java <= frameworks/opt/telephony/src/java/com/android/internal/telephony/EventLogTags.logtags
Note: Some input files use or override a deprecated API.
Note: Recompile with -Xlint:deprecation for details.
Anyone knows what's causing it? It couldn't be the roomservice.xml in local_manifest as I used the one which another person successfully built CM with. I also repo sync'ed a few times already. I tried make clobber and built again, but nothing :crying:
I am building PACMAN ROM (4.3) now by the way.
All help is appreciated (with a thank!)
Greedings everyone
For some time now i am trying to download and compile CyanongenMod Sources for my Device. I Install VirtualBox + Linux Mint + all the needed stuff. Then i do the repo init and everything looks ok but when i do the repo sync it always throw me a error fetch stop because of sync errors. Ive done it a lot of time with no luck. Also i tried the repo sync -f which finaly finishes fetching things but stops at getting the project tree. Can anyone help me? :/ its really frustrating
vale amicis said:
I know there are many other guides avalable regarding this, But I tried to focus on the small points also that many guides overlook
that's why I have this for you. Do let know if I have missed something or more details have to be included in case still there is a difficulty in compiling
This thread on Madteam Forums: http://madteam.co/forum/development...lt-rom-for-your-device-(ultra-noob-friendly)/
So lets start with simple things
Basic FAQ:
This post/guide is divided into 4 parts:
1. Setting up build environment
2. Machine specifications etc.
3. Device Tree and source basics
4. Syncing Source and Building
PART 1: Setting up build environment​
Type sudo su and then your password to get rid of Admin Permissions
#Installing Python
STEP 1: Open terminal (CTRL + ALT + T)
Then execute the following commands in terminal one by one
Code:
sudo apt-get install build-essential gcc
cd Downloads
wget http://www.python.org/ftp/python/2.5.6/Python-2.5.6.tgz
tar -xvzf Python-2.5.6.tgz
cd Python-2.5.6
./configure --prefix=/usr/local/python2.5
make
sudo make install
sudo ln -s /usr/local/python2.5/bin/python /usr/bin/python2.5
Now Python is configured
#Installing JDK
As far as I know PPA which was the earlier method of installing JDK etc. doesn't exist's anymore, So I used another way!
Step 1: Open Terminal (CTRL + ALT + T)
STEP 2: Now we need to download the JDK 6 Binary by executing this command in terminal
Code:
wget --no-check-certificate --no-cookies --header "Cookie: gpw_e24=http%3A%2F%2Fwww.oracle.com" "http://download.oracle.com/otn-pub/java/jdk/6u45-b06/jdk-6u45-linux-x64.bin"
STEP 3: Then we need to run the binary and move it to a shared location:
Code:
chmod +x jdk-6u45-linux-x64.bin
sudo ./jdk-6u45-linux-x64.bin
sudo mv jdk1.6.0_45 /usr/lib/jvm/
STEP 4: Now you have to install all binaries and give them highest priority, This will also overwrite the previous version of Java Binaries in your computer
Code:
sudo update-alternatives --install /usr/bin/java java /usr/lib/jvm/jdk1.6.0_45/bin/java 1
sudo update-alternatives --install /usr/bin/javac javac /usr/lib/jvm/jdk1.6.0_45/bin/javac 1
sudo update-alternatives --install /usr/bin/javaws javaws /usr/lib/jvm/jdk1.6.0_45/bin/javaws 1
sudo update-alternatives --install /usr/bin/jar jar /usr/lib/jvm/jdk1.6.0_45/bin/jar 1
sudo update-alternatives --install /usr/bin/javadoc javadoc /usr/lib/jvm/jdk1.6.0_45/bin/javadoc 1
STEP 5: Now check if JDK 1.6 is selected on this:
Code:
sudo update-alternatives --config java
sudo update-alternatives --config javac
sudo update-alternatives --config javaws
sudo update-alternatives --config jar
sudo update-alternatives --config javadoc
Now JDK is configured! To check if it is done
Execute this is Terminal
Code:
java -version
Output will be similar to this
Code:
java version "1.6.0_45"
Java(TM) SE Runtime Environment (build 1.6.0_45-b06)
Java HotSpot(TM) 64-Bit Server VM (build 20.45-b01, mixed mode)
#Installing GNU Make
Code:
cd Downloads
wget -o make.tar.gz http://ftp.gnu.org/gnu/make/make-3.81.tar.gz
tar -xvzf make-3.81.tar.gz
cd make-3.82
./configure
sudo make install
These commands are for Make 1.81 if you want to install Make 1.82 Execute these
Code:
cd
wget -o make.tar.gz http://ftp.gnu.org/gnu/make/make-3.82.tar.gz
tar -xvzf make-3.82.tar.gz
cd make-3.82
./configure
sudo make install
Now GNU make is configures
#Installing Android SDK
STEP ONE: Download the SDK from http://developer.android.com/sdk/index.html and extract it in a folder called "sdk" in the Downloads folder
STEP TWO: Now, Execute these commands in terminal
Code:
cd ~/Downloads/sdk/tools/
./android sdk
SDK is configured now :victory:
#Installing required packages:
STEP 1: Open Terminal
Now execute these commands:
Code:
apt-get install git-core gnupg flex bison gperf build-essential \
zip curl zlib1g-dev libc6-dev libncurses5-dev x11proto-core-dev \
libx11-dev libreadline6-dev libgl1-mesa-dev tofrodos python-markdown \
libxml2-utils xsltproc pngcrush gcc-multilib lib32z1 schedtool
Good, Now you have successfully setup linux build environment!​
PART 2: Machine specifications and other misc. stuff​
Basic Computer Specs:
2Ghz Dual Core Processor
2GB Minimum ram
50GB File Space (For only one rom source)
*PLEASE NOTE*: This is the basic specification, It really depends on the condition of your ram and cpu!
If you want to use other apps while compilation you should make a 5GB minimum swap partition!
If ram is more than 4GB ram then you don't swap partition!
PART 3: DEVICE TREE AND SOURCE BASICS​
Basic source folders:
/packages - Proprietary rom applications
/framework - Framework (Overall rom UI and stuff)
/device - Device config
/vendor - Vendor Tree and other vendor files
/hardware - Hardware drivers
Q: What is BoardConfig.mk?
A: It's the file where you setup path's to files like toolchain etc. and enable/disable stuff, its very easy to understand. You can find it in your device's tree
Q: Where is build.prop in source?
A. Build.prop is available in the source in the form of system.prop in the device tree!
Q: How to remove ringtones, video editor, CM wallpapers from bulid?
A: Go to device/releasetools/extras.txt and Delete anything you don't want in your build
PART 4: Syncing Source and Building​
# Installing Repo Package
Code:
mkdir ~/bin
curl https://dl-ssl.google.com/dl/googlesource/git-repo/repo > ~/bin/repo
chmod a+x ~/bin/repo
STEP 2: Now it is recommended to reboot your computer (No need of sudo su after reboot)
STEP 3: Now make directory:
Code:
mkdir -p ~/rom/android/system
STEP 4: Go into directory and set path for Repo Package
Code:
cd ~/rom/android/system
PATH=~/bin:$PATH
STEP 5: NOW ITS TIME FOR SYNCING:
For CM10.1 source execute this:
Code:
repo init -u git://github.com/CyanogenMod/android.git -b cm10.1
For syncing CM10 source execute:
Code:
repo init -u git://github.com/CyanogenMod/android.git -b jellybean
You have to find for the rest!!
PS: You don't have to execute all the repo init commands written above
Now to sync execute this after the the repo init command
Code:
repo sync
Once it finishes without breaking all the folders will appear in rom/android/system folder
now execute this:
Code:
mkdir -p ~/rom/android/system/device/<ManufacturerName>/<DeviceCodeName>
and extract the device config/tree here
for me its samsung/totoro (galaxy Y, Don't mind )
then do the following:
Code:
mkdir -p ~/rom/android/system/vendor/<ManufacturerName>/<DeviceCodename>
Its the same as for the device folder
Now for compiling:
Code:
. build/envsetup.sh
lunch cm_<DeviceCodename>-eng
brunch cm_<DeviceCodename>-eng
Your build will be located at /rom/android/system/out as <RomName>-date/month/year-UNOFFICIAL-<DeviceCodeName>.zip
HAPPY COMPILING ​
Click to expand...
Click to collapse
I had two things to ask
1)Was installing android-sdk needed
2)If device not yet had a cm build or device tree how to get them

[Noob Friendly] How to build CM 12.1 for Flamingo

Hello guys,
Soo there was thread made by Vynikal but its some kind of dead and outdated for cm 12.1, i managed to make everything work on my pc and want to help everyone who has problems with building CM12.1 for Flamingo.
ATTENTION!:I or xda-dev are not responsible for any damage to your device,eyes or life, made by hapiness of having cm12.1 built
Requirements:
-Ubuntu 64bit: Tuto
-Stable internet connection, no mobile connection(its not stable enough)
-About 100GB of disk space(if you screw something up you will have some in reserve)
-All fastboot,flashboot and adb drivers installed
-Beefy pc
Lets begin:​We will start with preparations
Lets install JDK.
Code:
sudo apt-get update
then:
Code:
sudo apt-get install openjdk-7-jdk
Now you will need to install build packages, they are needed for building CyanogenMod.
Type this in terminal:
Code:
sudo apt-get install bison build-essential curl flex git gnupg gperf libesd0-dev liblz4-tool libncurses5-dev libsdl1.2-dev libwxgtk2.8-dev libxml2 libxml2-utils lzop openjdk-7-jdk openjdk-7-jre pngcrush schedtool squashfs-tools xsltproc zip zlib1g-dev g++-multilib gcc-multilib lib32ncurses5-dev lib32readline-gplv2-dev lib32z1-dev
You will also need USB access for extracting blobs.
Code:
sudo nautilus
This will open file manager as root.
Now you must go through several steps:
1.Click Computer in the left tray of file manager - you will see some folders like: etc
2.Open Folders etc/udev/rules.d/
3.Create new document and name it: 51-android.rules
4.You can close file manager now.
If you done that 4 steps now we can continue. lets fill up that file.
Copy paste that command to console:
Code:
wget -S -O - http://source.android.com/source/51-android.rules | sed "s/<username>/$USER/" | sudo tee >/dev/null /etc/udev/rules.d/51-android.rules; sudo udevadm control --reload-rules
and change <username> to your ubuntu username. in my case it will look like this:
Code:
wget -S -O - http://source.android.com/source/51-android.rules | sed "s/dominik/$USER/" | sudo tee >/dev/null /etc/udev/rules.d/51-android.rules; sudo udevadm control --reload-rules
Now we need to create some directories:
Code:
mkdir -p ~/bin
mkdir -p ~/android/system
Last thing before loong downloading - repo command:
In terminal type:
Code:
curl https://storage.googleapis.com/git-repo-downloads/repo > ~/bin/repo
chmod a+x ~/bin/repo
Now you will need to open .bashrc with gedit its in home (you will see it if you enable Show hidden files or CTRL+H)
add that at the end of file:
Code:
export PATH=~/bin:$PATH
Now open .profile with gedit same as .bashrc its in default direction
paste this code to that file:
Code:
# set PATH so it includes user's private bin if it exists
if [ -d "$HOME/bin" ] ; then
PATH="$HOME/bin:$PATH"
fi
Initializing the repo:​Type in terminal:
Code:
cd ~/android/system
repo init -u git://github.com/CyanogenMod/android.git -b cm-12.1
Finally add local_manifest directory and copy-paste file included in attachment(thanks almighty Vynikal)
Code:
Code:
mkdir -p ~/android/system/.repo/local_manifests
And dont-click-the-red-button like command:
Code:
repo sync
And one more command to repair some duplicates in sepolicy
Code:
cd external/sepolicy
git revert 79ff523ac99b339914ccaa754e068072d64da542
Now i have Good and Bad news:
Good: we've done with the preparations.
Bad: this is not the end :silly:
Exporting blobs:​Its kinda tricky now, you will need hiper super duper stock rom and USB debugging toggled on + you need to connect your device to ubuntu, just go to devices/usb and chose your phone (its up in the vm tray)
First make sure that you allowed usb debugging(that window that will pop up in phone)
Once again open .profile and copy-paste this:
Code:
if [ -d "<path-to-sdk>/platform-tools" ] ; then
PATH="<path-to-sdk>/platform-tools:$PATH"
fi
And run that command in terminal to install adb and fastboot drivers.
Code:
sudo apt-get install android-tools-adb android-tools-fastboot
Now enter that commands in terminal:
Code:
cd ~/android/system/device/sony/flamingo
./extract-files.sh
Setting up and preparing our files to building
Code:
cd ~/android/system
. build/envsetup.sh
breakfast flamingo
Build
Code:
brunch flamingo
============================================+#@#+============================================
Thanks to:
[email protected] for creating his tuto for cm12 and manifests
-visi0nary He helped me the most with several problems that we will fix in next post
-Others that i forgot sorry and send me PM (will add you)
pc:
i5 4460
2x g.skill ripjawsx cl7 1600mhz 4gb
took about 2h with ccache
Troubleshooting​Any problems? just post logs and wait for response.
When i was building that CM i had some problems with paths like i said in first post it gave me something like this
Code:
find: `dummy': No such file or directory
find: `../../../../../../external/hamcrest/src': No such file or directory
find: `../../../../../../external/junit/src/org': No such file or directory
find: `../../../../../../external/hamcrest/src': No such file or directory
make: Entering directory `/home/dominik/android/system'
build/core/copy_headers.mk:15: warning: overriding commands for target `/home/dominik/android/system/out/target/product/flamingo/obj/include/qcom/display/copybit.h'
build/core/copy_headers.mk:15: warning: ignoring old commands for target `/home/dominik/android/system/out/target/product/flamingo/obj/include/qcom/display/copybit.h'
build/core/copy_headers.mk:15: warning: overriding commands for target `/home/dominik/android/system/out/target/product/flamingo/obj/include/qcom/display/copybit_priv.h'
build/core/copy_headers.mk:15: warning: ignoring old commands for target `/home/dominik/android/system/out/target/product/flamingo/obj/include/qcom/display/copybit_priv.h'
build/core/Makefile:46: warning: overriding commands for target `/home/dominik/android/system/out/target/product/flamingo/system/bin/wcnss_service'
build/core/base_rules.mk:550: warning: ignoring old commands for target `/home/dominik/android/system/out/target/product/flamingo/system/bin/wcnss_service'
PRODUCT_COPY_FILES vendor/sony/msm8226-common/proprietary/vendor/etc/audio_effects.conf:system/vendor/etc/audio_effects.conf ignored.
No private recovery resources for TARGET_DEVICE flamingo
make -C kernel/sony/msm8974 O=/home/dominik/android/system/out/target/product/flamingo/obj/KERNEL_OBJ ARCH=arm CROSS_COMPILE="/home/dominik/android/system/prebuilts/misc/linux-x86/ccache/ccache arm-eabi-" VARIANT_DEFCONFIG= SELINUX_DEFCONFIG= aosp_yukon_flamingo_defconfig
make[1]: Entering directory `/home/dominik/android/system/kernel/sony/msm8974'
target SharedLib: libm (/home/dominik/android/system/out/target/product/flamingo/obj/SHARED_LIBRARIES/libm_intermediates/LINKED/libm.so)
[B][COLOR="Red"]target SharedLib: libstdc++ (/home/dominik/android/system/out/target/product/flamingo/obj/SHARED_LIBRARIES/libstdc++_intermediates/LINKED/libstdc++.so)
/home/dominik/android/system/out/target/product/flamingo/obj/ETC/file_contexts_intermediates/file_contexts: Multiple different specifications for /sys/devices/virtual/graphics/fb0/rgb (ubject_r:livedisplay_sysfs:s0 and ubject_r:sysfs_display:s0).
Error loading context file from /home/dominik/android/system/out/target/product/flamingo/obj/ETC/file_contexts_intermediates/file_contexts[/COLOR][/B]
make: *** [/home/dominik/android/system/out/target/product/flamingo/obj/ETC/file_contexts_intermediates/file_contexts] Error 4
make: *** Deleting file `/home/dominik/android/system/out/target/product/flamingo/obj/ETC/file_contexts_intermediates/file_contexts'
make: *** Waiting for unfinished jobs....
GEN /home/dominik/android/system/out/target/product/flamingo/obj/KERNEL_OBJ/Makefile
#
# configuration written to .config
#
make[1]: Leaving directory `/home/dominik/android/system/kernel/sony/msm8974'
make: Leaving directory `/home/dominik/android/system'
#### make failed to build some targets (02:17 (mm:ss)) ####
i marked that place. visi0nary told me that 2 files has same paths that interfere each other and doesnt allow to continue with build. soo we found solution, but idk if its my fault or its some typo or other kind of mistake
Fix:
1. Go to android/system/device/sony/msm8226-common/sepolicy
2. Open file_contexts in gedit and add # before last line
it should look like this:
Code:
# Trim Area daemon
/dev/socket/tad u:object_r:tad_socket:s0
# CPU governor controls
/dev/socket/mpdecision(/.*)? u:object_r:mpctl_socket:s0
/dev/socket/mpctl u:object_r:mpctl_socket:s0
/dev/pn547 u:object_r:nfc_device:s0
/dev/block/platform/msm_sdcc\.1/by-name/modemst1 u:object_r:modem_efs_partition_device:s0
/dev/block/platform/msm_sdcc\.1/by-name/modemst2 u:object_r:modem_efs_partition_device:s0
/dev/block/platform/msm_sdcc\.1/by-name/fsg u:object_r:modem_efs_partition_device:s0
/dev/block/platform/msm_sdcc\.1/by-name/TA u:object_r:trim_area_partition_device:s0
/data/system/default_values u:object_r:mpctl_data_file:s0
/system/bin/sct_service u:object_r:sct_exec:s0
/system/bin/tad_static u:object_r:tad_exec:s0
/system/bin/ta_qmi_service u:object_r:ta_qmi_exec:s0
/system/bin/thermanager u:object_r:thermanager_exec:s0
#/sys/devices/virtual/graphics/fb0/rgb -- u:object_r:sysfs_display:s0
for actual moment cm 12.1 dont work at all
Woah, it's been a long time since I stopped visiting this forum.
Your tut is kinda good, but I can't tell if something has changed in the past.
Actually those blobs you are extracting should be located in this repo, which is also downloaded through local_manifests, so maybe extracting them again is useless.
Bad luck, this device feels abandoned since the begining.
But hey, does it boot? If yes, progress has been made :cyclops:
Vynikal said:
Woah, it's been a long time since I stopped visiting this forum.
Your tut is kinda good, but I can't tell if something has changed in the past.
Actually those blobs you are extracting should be located in this repo, which is also downloaded through local_manifests, so maybe extracting them again is useless.
Bad luck, this device feels abandoned since the begining.
But hey, does it boot? If yes, progress has been made :cyclops:
Click to expand...
Click to collapse
nope dont boot at all at any build
and yeah they should be downloaded with it but somehow when i was compiling it there was error that prevented from building it, after extracting that blobs(something might be missing) everyhing went ok
ps. sorry that i used your thread without permission
MasterDomino said:
nope dont boot at all at any build
and yeah they should be downloaded with it but somehow when i was compiling it there was error that prevented from building it, after extracting that blobs(something might be missing) everyhing went ok
ps. sorry that i used your thread without permission
Click to expand...
Click to collapse
No worries, I have no plans on this forum. My E3 is broken, beaten and scarred. And with Firefox OS installed.
I was always wondering why the hell no CM12 build boots. I guess I won't know anytime soon.
Vynikal said:
No worries, I have no plans on this forum. My E3 is broken, beaten and scarred. And with Firefox OS installed.
I was always wondering why the hell no CM12 build boots. I guess I won't know anytime soon.
Click to expand...
Click to collapse
me and visi0nary found out it's propably fstab because adb not even toggles, its propably problem with mounting :/
Is this will work for all varian?
useone07 said:
Is this will work for all varian?
Click to expand...
Click to collapse
propably not because it doesnt work for my wariant(selinux or fstab problem ) cm 12 works perfectly but on D2203, idk about other wariants.

[GUIDE]DualBootPatcher Use, Build from Source/using Docker/Travis And Add New Devices

Hi all DualBootPatcher fans, in this thread i'll try to explain all things about DualBootPatcher, so if your user please read this post carefully then continue to other posts, and if you developer you can skip it and go to post #2 directly
Part 0: Introduction & How to use DualBootPatcher?
What is DualBootPatcher?
DualBootPatcher is an open-source app that allows multiple ROMs to be installed on a single Android device. It does its best to work with existing code and does not require explicit support from ROMs. There are currently 270+ supported devices and their variations.
It's originally developed by the amazing developer @chenxiaolong with help of many contributors
Click to expand...
Click to collapse
What does the app do ?:
It patches...
Custom kernels for dual boot support
ROMs so that they can be installed as secondary
Google Apps packages for AOSP-based ROMs
SuperSU so that it can be used in the secondary ROM
Where can i find it?
Website
XDA Main Thread
Github
What's supported ?
Except Toaster and Alarm clocks pretty much everything is supported.
Click to expand...
Click to collapse
How to use the App?
- Download, install and open the app.
- Swipe to the right to open the menu. Click "ROMS". Now if this is the first time you use it, it will ask you if you want to set kernel. Do so!
- After it has finished go to ROM Settings (primary ROM 3 dot menu) and select Update Ramdisk. It will update it and will ask you to reboot. Press Reboot Now, or Reboot later.
- Now Download any ROM you like and open the app again and open the menu and open Patch Zip File from the menu. Ensure that your Device is set to (yourdevicename) and under Partition configuration select secondary/dataslot (will install 2nd ROM in /system) or data slot.
- Click continue and select where to save the patched file.
- You should see the file is being put in "Queue". Just click the confirm button to the upper right.
Note: If you want to go back, just swipe the ROM in queue to right and start over.
- The app will patch the zip. When done, go back to "ROMs".
- Click "Flash zip files" (the big pink button on the lower right). Click the pink plus button to add your previously patched zip file.
- Locate the file you have patched in step 7. Unless you have changed the name there, it should be something like ROM_name_partition_config_ID.zip (like RR-N-v5.8.3-20170707-cheeseburger-Unofficial_dual.zip).
- Click on that file and choose "Keep location". Now confirm the flash with the button on the upper right side.
Note: You can also install the patched zip files in recovery.
- It will now open the terminal and begin flashing the file. This requires some patience. After it has flashed the file you'll see success message in green.
- Now click back and you should see your newly installed ROM along with the Primary ROM.
Note: You can find more options by clicking on the three buttons on each ROM.
- Now reboot and wait till finishing 2nd ROM first boot. install DualBootPatcher apk so you can easily switch ROMs, there is another way to change ROMs: flash DualBootUtilities.zip and switch ROM manually.
Note: Using Bootui:
- Open app then select settings and press install (update) bootui. then Swipe to the right to open the menu. Click "ROMS" again and open secondary ROM Settings) and select Update Ramdisk, Now you can change ROMs simply using boot ui (something like grub bootloader but it works like twrp)
Partitions Configurations:
The patcher offers several locations for installing ROMs:
Primary: This is normally used for installing a zip to the primary ROM. It is not required, but is strongly recommended because it has code to prevent the zip from inadvertently affecting other ROMs.
Dual: Dual/Secondary is the first multiboot installation location. It installs to the system partition. This is a good spot for installing a second ROM because it doesn't take any space away from the internal storage.
Multi-slots: There are 3 multislots: multi-slot-1, multi-slot-2, multi-slot-3. These install to the cache partition. This is specifically for devices, like the Galaxy S4, that have a massive cache partition.
Data-slots: There can be an unlimited number of data slots. These install to the data partition and eat up space on the internal storage. This is useful for devices where the system partition is nearly full and the cache partition is tiny. These slots are named "data-slot-[id]", where "id" is something you provide in the app.
Extsd-slots: There can be an unlimited number of extsd slots. These install to the external SD card, which is useful as it keeps the ROMs off of the internal storage. Note that the ROM's data files are still stored on the data partition.
Apps and Data sharing:
DualBootPatcher very recently got support for sharing apps and their data across ROMs. Maybe sharing is somewhat of a misleading term. The feature actually makes Android load the shared apps and data from a centralized location, /data/multiboot/_appsharing. So you're not sharing apps from one ROM to another per se. The ROMs are just loading the apps from one shared location. Let me make this clearer with an analogy.
Think of the people in a company office as ROMs. You want to share with your coworkers some documents (apps). Instead of telling them to come over to your desk to see those documents (sharing apps from one ROM to another), everyone goes to the conference room to look at the documents together (loading apps from a shared location). That's how app and data sharing is implemented.
Click to expand...
Click to collapse
To use app sharing, follow these steps in every ROM that you want to use app sharing: (doesn't work with JB ROMs)
Install the app you want to share
Open DualBootPatcher and go to "App Sharing" in the navigation drawer
Enable individual app sharing
Tap "Manage shared applications" and enable APK/data sharing for the app
Reboot
When you uninstall an app that's shared, it simply become unshared for the current ROM. That way, other ROMs are not affected. To continue the analogy above, if you quit your job, you won't shred the documents that everybody else was looking at.
If you unshare an app's data, it will go back to using the data it had before it was shared. In other words, you leave the conference room and go back to work on your own documents at your desk.
Click to expand...
Click to collapse
How to Tips:
How to boot to another ROM ?
This is simple ... There is no reboot to primary, secondary or whatever. So all you have to do is:
1) Go to ROMs section of the App.
2) Click on the ROM you want to boot to. You should see "Switching ROM" message. After few seconds, you should see a report message saying that "ROM successfully switched".
3) Now just do a normal reboot of your device. See the magic! It should boot to the ROM you have switched on step 2.
Note: You can find more options by selecting the three buttons on each ROMs (like creating reboot widgets for directly rebooting to specific rom).
You also need to install the App to all of the ROMs you install. Otherwise, you want be able to boot to other ROMs!
Other How to ?
Wipe /cache, /data, /system, or dalvik-cache?
The easiest way is to do it from the app while booted in another ROM. Just go to "Roms" in the navigation drawer, tap the 3 dots options menu for the ROM you want to wipe, and tap "Wipe ROM".
Update the primary ROM?
Patch the zip for primary and flash it. The "primary" installation target is designed so that other ROMs won't be affected when you want to flash something for the primary ROM.
Update a non-primary ROM?
Patch and flash the zip exactly like how you did it the first time.
Flash a mod or custom kernel for the primary ROM?
Patch it for primary before flashing. If the zip does not wipe /cache, it is also safe to flash it directly.
Flash a mod or custom kernel for a non-primary ROM?
Just patch and flash it
Now, You're perfect DualBootPatcher user,so let's enter the main guide !
Guide Index:
Part 1: How to build DualBootPatcher from source manually?
Part 2: How to build DualBootPatcher using docker images?
Part 3: How to build DualBootPatcher using TravisCI?
Part 4: How to add new Devices to DualBootPatcher?
Part 5: How to submit new Devices to official DualBootPatcher support?
Extra: How to share apps (apk) between ROMs? (soon!)
Before we start you should know that DBP is not just android app, there is versions for windows and linux also and in this guide i'll talk about app and linux version only, i don't use windows
Part 1: How to build DualBootPatcher from source?
When you deeply exploring DualBootPatcher repository you'll find all information and guides you need but for some people instructions isn't clear enough, so let me explain it here
- You'll need linux, whichever distribution you use. but i'm sure building works on [Debian-Ubuntu-Fedora-Arch] and all its derivations.
A) Prerequisites:
- You'll need these packages whatever version you want to build:
Android NDK
Currently NDK r15 is required to build, you can get it here
Download, Extract and rename it to "android-ndk"
Code:
wget https://dl.google.com/android/repository/android-ndk-r15-linux-x86_64.zip && unzip android-ndk-r15-linux-x86_64.zip && mv android-ndk-r15 android-ndk
And then export android ndk:
Code:
echo "export ANDROID_NDK=$(pwd)/android-ndk" >> ~/.bashrc
echo "export ANDROID_NDK_HOME=$(pwd)/android-ndk" >> ~/.bashrc
cmake
DBP needs cmake 3.7.2 or higher. you need to download it here
Downloading & Extract command:
Code:
wget https://cmake.org/files/v3.7/cmake-3.7.2.tar.gz && tar xzf cmake-3.7.2.tar.gz
extract to folder and run the following commands in cmake folder
Code:
sed -i 's|cmake_options="-DCMAKE_BOOTSTRAP=1"|cmake_options="-DCMAKE_BOOTSTRAP=1 -DCMAKE_USE_OPENSSL=ON"|' bootstrap
./bootstrap
make
sudo make install
OpenSSL
i'm successfully build using openssl-1.1.0c, download here and extract.
Code:
wget https://www.openssl.org/source/openssl-1.1.0c.tar.gz && tar xzf openssl-1.1.0c.tar.gz
open openssl-1.1.0c folder and install it
Code:
./config shared --prefix=/usr/local/ssl --openssldir=/usr/local/ssl
make
sudo make install
echo 'PATH=${PATH}:/usr/local/ssl' >> ~/.bashrc
gtest
Install on Ubuntu / Debian:
Code:
sudo apt-get install libgtest-dev
On Fedora:
Code:
sudo dnf install gtest-devel
On Archlinux:
Code:
sudo pacman -S gtest
yaml-cpp
Install on Ubuntu / Debian using
Code:
sudo apt-get install libyaml-cpp-dev
On Fedora
Code:
sudo dnf install yaml-cpp-devel
On Archlinux:
Code:
sudo pacman -S yaml-cpp
Other General packages that must be installed: [Skip this if you have android build environment :good: ]
Ubuntu / Debian:
Code:
sudo apt-get install ccache libboost-dev libssl-dev openssl python-minimal build-essential libfontconfig1 findutils git make libprocps-dev unzip zip gcc-multilib g++-multilib lib32ncurses5-dev transifex-client gnupg mesa-common-dev libglu1-mesa-dev
Fedora:
Code:
sudo dnf install ccache findutils gcc-c++ git make procps-ng unzip zip gnupg ncurses-compat-libs transifex-client openssl-devel
Archlinux:
Code:
sudo pacman -S ccache boost openssl lib32-openssl findutils git make procps-ng unzip zip gnupg gcc-multilib ncurses
Code:
sudo pacaur -S transifex-client ncurses5-compat-libs lib32-ncurseslib32-ncurses5-compat-libs
- For building android app you need:
Android SDK
You need to install SDK using android studio ( build-tools 25.0.3, platforms android-25, platform-tools and tools )
or install from terminal:
Code:
mkdir -p android-sdk && cd android-sdk
wget -q https://dl.google.com/android/repository/platform-tools_r25.0.3-linux.zip && unzip -qq platform-tools_r25.0.3-linux.zip
wget -q https://dl.google.com/android/repository/build-tools_r25.0.3-linux.zip && unzip -qq build-tools_r25.0.3-linux.zip
wget -q https://dl.google.com/android/repository/tools_r25.2.3-linux.zip && unzip -qq tools_r25.2.3-linux.zip
Then Export it:
Code:
echo "export ANDROID_HOME=$(pwd)" >> ~/.bashrc
echo "export PATH=${PATH}:${ANDROID_HOME}/tools" >> ~/.bashrc
JDK 1.8
Ubuntu / Debian:
Code:
sudo apt-get install openjdk-8-jdk openjdk-8-jdk-headless
Fedora:
Code:
sudo dnf install java-1.8.0-openjdk-devel java-1.8.0-openjdk-headless
Archlinux:
Code:
sudo pacman -S jdk8-openjdk
Other packages:
Ubuntu / Debian:
Code:
sudo apt-get install lib32stdc++-6-dev
Fedora:
Code:
sudo dnf install glibc.i686 libstdc++.i686
Archlinux:
Code:
sudo pacman -S glibc libstdc++5 lib32-libstdc++5
- And for linux version you need:
qt5
it must be 5.3 or higher
Ubuntu / Debian:
Code:
sudo apt-get install qttools5-dev-tools libqt5core5a
Fedora:
Code:
sudo dnf install qt5-qtbase-devel
Archlinux:
Code:
sudo pacman -S qt5-base
Other packages:
Ubuntu / Debian:
Code:
sudo apt-get install libarchive-dev liblz4-tool liblzma-dev lz4-dev zlib1g-dev lib32z-dev
Fedora:
Code:
sudo dnf install libarchive-devel lz4-devel xz-devel
Archlinux:
Code:
sudo pacman -S libarchive lz4 xz lib32-xz lzip
- Some final touches:
Enable cache:
Code:
echo "export USE_CCACHE=1" >> ~/.bashrc
Reload bash environment:
Code:
source ~/.bashrc
- Cloning the source:
Code:
git clone --recursive https://github.com/chenxiaolong/DualBootPatcher.git
B) Building Android APP:
- Open DualBootPatcher folder and make new folder "build" and open it.
Code:
mkdir build && cd build/
- Now Build the app:
Code:
cmake .. -DMBP_BUILD_TARGET=android -DMBP_BUILD_TYPE=debug
make
cpack -G TXZ
make apk
And you'll find built apk in DualBootPatcher/Android_GUI/build/outputs/apk/Android_GUI-debug.apk
C) Building Utilities Zip:
Utilities Zip is AROMA based zip which enable you to switch ROMs form twrp or wipe ROM when something went wrong.
- In build folder run these commands:
Code:
make android-system_armeabi-v7a
make -C data/devices
./utilities/create.sh
you'll find built utilities.zip in DualBootPatcher/build/utilities/DualBootUtilities-9.2.0.zip
D) Building Linux App:
- In build folder run these commands:
Code:
cmake .. -DMBP_BUILD_TARGET=desktop -DMBP_PORTABLE=ON
make
cpack -G TXZ
or to pack it to zip file:
Code:
cpack -G ZIP
Special Thanks:
@oF2pks For helping me setup build environment on arch
@Ahmed Hady & @androidlover5842 Without their helps i won't be here
Part 2: How to build DualBootPatcher using docker images?
What is docker? [in case you don't know it ]
Docker is the world’s leading software container platform. Developers use Docker to eliminate “works on my machine” problems when collaborating on code with co-workers. Operators use Docker to run and manage apps side-by-side in isolated containers to get better compute density. Enterprises use Docker to build agile software delivery pipelines to ship new features faster, more securely and with confidence for both Linux, Windows Server, and Linux-on-mainframe apps.
Click to expand...
Click to collapse
Firstly, make sure you have docker installed, if not install it
From here you should choose a method you'll follow, Building docker images manually or use pre-built docker images.
A) Building docker images manually:
@chenxiaolong sir has made docker image configuration files here
all you need to do after sync the repo like part 1 is entering the following commands in DualBootPatcher directory:
Code:
./docker/generate.sh
./docker/build.sh
Note that building the docker images will take a long time and consume a lot of bandwidth--multiple gigabytes at the very least. It will download all the dependencies for building DualBootPatcher for all supported targets.
Click to expand...
Click to collapse
B) Using ready-made docker images:
i have made docker images and uploaded them to docker hub
to download "pull" it enter these commands:
Code:
docker pull yshalsager/dualbootpatcher:9.3.0-4-base
docker pull yshalsager/dualbootpatcher:9.3.0-4-android
docker pull yshalsager/dualbootpatcher:9.3.0-4-linux
Building DualBootPatcher using docker:
- To enter docker container and build DualBootPatcher make folder "builder" in DualBootPatcher directory
Code:
cd DualBootPatcher && mkdir -p builder
- Then run this to enter android build container
Code:
docker run --rm -it -e USER_ID=$(id -u) -e GROUP_ID=$(id -g) -v "$(pwd):/builder/DualBootPatcher:rw,z" -v "${HOME}/.android:/builder/.android:rw,z" -v "${HOME}/.ccache:/builder/.ccache:rw,z" -v "${HOME}/.gradle:/builder/.gradle:rw,z" yshalsager/dualbootpatcher:9.3.0-4-android bash
- After this you'll continue like normal building:
Code:
cd DualBootPatcher/builder && cmake .. -DMBP_BUILD_TARGET=android -DMBP_BUILD_TYPE=debug && make -j16 && rm -rf assets && cpack && make apk -j16
make android-system_armeabi-v7a -j16 && make -C data/devices -j16
- Now exit from container and enter linux build one:
Code:
docker run --rm -it -e USER_ID=$(id -u) -e GROUP_ID=$(id -g) -v "$(pwd):/builder/DualBootPatcher:rw,z" -v "${HOME}/.android:/builder/.android:rw,z" -v "${HOME}/.ccache:/builder/.ccache:rw,z" -v "${HOME}/.gradle:/builder/.gradle:rw,z" yshalsager/dualbootpatcher:9.3.0-4-linux bash
- Build utilities ZIP:
Code:
cd DualBootPatcher/builder && ./utilities/create.sh
- And build linux app
Code:
cmake .. -DMBP_BUILD_TARGET=desktop -DMBP_PORTABLE=ON && make -j16 && cpack
- You'll find output files in your local "builder" folder like normal build.
Part 3: How to build DualBootPatcher using TravisCI?
Travis CI is free open-source continues integration service, which simply take your project from GitHub and test / build it for you !
it's amazing solution if you don't have time/free space/mind lol :cyclops: to test your code.
- you'll need to signup Travis account, go here and press signup, enter your GitHub account details then approve Travis needed permissions and done.
- Now Fork DualBootPatcher repository to your account and create .travis.yml file in project root.
- Copy my Travis configuration to your .travis.yml
Code:
sudo: required
services:
- docker
before_install:
# Clone DualBootPatcher Repository
- git clone --recursive https://github.com/yshalsager/DualBootPatcher -b master DualBootPatcher/
# Pull docker images
- docker pull yshalsager/dualbootpatcher:9.3.0-4-base
- docker pull yshalsager/dualbootpatcher:9.3.0-4-android
- docker pull yshalsager/dualbootpatcher:9.3.0-4-linux
script:
# Make work directories
- mkdir $HOME/.android
- mkdir -p ${TRAVIS_BUILD_DIR}/DualBootPatcher/builder/ && cd ${TRAVIS_BUILD_DIR}/DualBootPatcher/
# Build APK
- |
docker run --rm -i -e USER_ID=$(id -u) -e GROUP_ID=$(id -g) -v "$(pwd):/builder/DualBootPatcher:rw,z" -v "${HOME}/.android:/builder/.android:rw,z" yshalsager/dualbootpatcher:9.3.0-4-android bash << EOF
cd DualBootPatcher/builder && cmake .. -DMBP_BUILD_TARGET=android -DMBP_BUILD_TYPE=debug && make -j16 && rm -rf assets && cpack && make apk -j16
make android-system_armeabi-v7a -j16 && make -C data/devices -j16
exit
EOF
- |
docker run --rm -i -e USER_ID=$(id -u) -e GROUP_ID=$(id -g) -v "$(pwd):/builder/DualBootPatcher:rw,z" -v "${HOME}/.android:/builder/.android:rw,z" yshalsager/dualbootpatcher:9.3.0-4-linux bash << EOF
# Build Utilities Zip
cd ~/DualBootPatcher/builder && ./utilities/create.sh
# Build Linux
cmake .. -DMBP_BUILD_TARGET=desktop -DMBP_PORTABLE=ON && make -j16 && cpack
exit
EOF
after_success:
- export TRAVIS_CURRENT_DATE=$(date +"%d%m%y-%Hh%Mm")
# Check output & md5sum
- ls -l ${TRAVIS_BUILD_DIR}/DualBootPatcher/Android_GUI/build/outputs/apk/debug/Android_GUI-debug.apk
- md5sum ${TRAVIS_BUILD_DIR}/DualBootPatcher/Android_GUI/build/outputs/apk/debug/Android_GUI-debug.apk
- ls -l ${TRAVIS_BUILD_DIR}/DualBootPatcher/builder/utilities/DualBootUtilities-9.3.0.zip
- md5sum ${TRAVIS_BUILD_DIR}/DualBootPatcher/builder/utilities/DualBootUtilities-9.3.0.zip
- ls -l ${TRAVIS_BUILD_DIR}/DualBootPatcher/builder/DualBootPatcher-9.3.0-Linux.zip
- md5sum ${TRAVIS_BUILD_DIR}/DualBootPatcher/builder/DualBootPatcher-9.3.0-Linux.zip
# Upload to transfer.sh
- cd ${TRAVIS_BUILD_DIR}/DualBootPatcher/Android_GUI/build/outputs/apk/debug/ && curl --upload-file ./Android_GUI-debug.apk https://transfer.sh/Android_GUI-debug-${TRAVIS_CURRENT_DATE}.apk
- cd ${TRAVIS_BUILD_DIR}//DualBootPatcher/builder/utilities/ && curl --upload-file ./DualBootUtilities-9.3.0.zip https://transfer.sh/DualBootUtilities-9.3.0-${TRAVIS_CURRENT_DATE}.zip
- cd ${TRAVIS_BUILD_DIR}/DualBootPatcher/builder/ && curl --upload-file ./DualBootPatcher-9.3.0-Linux.zip https://transfer.sh/DualBootPatcher-9.3.0-${TRAVIS_CURRENT_DATE}-Linux.zip
- Edit line 8 with your Repository and branch you want to build.
Code:
- git clone --recursive https://github.com/yshalsager/DualBootPatcher -b master DualBootPatcher/
- This simple TravisCI configuration builds both of apk and utilities.zip and deploy them to transfer.sh
- Now open Travis and add your DualBootPatcher fork to projects and start building :good:
- You'll find built apk md5 and links from line at the end Travis log
- Build takes about 25 mins
- When you add new commits to repository Travis will always build new apk for you !
- If you want to change something in configuration, always check its syntax to make sure it's valid YAML using this site
Part 4: How to add new Devices to DualBootPatcher?
To add your/new device to DualBootPatcher you need to get some information first then add it to DualBootPatcher devices:
- Flash GetLogs-20161128-1.zip using recovery [TWRP highly recommended]
- Copy /sdcard/logs/[Date&Time].tar to PC, extract it and let's start.
- This is new device template:
Code:
- name: (Device Name)
id: (device id)
codenames:
- (device codename1)
- (device codename2)
- (device codename3)
architecture: (device architecture)
block_devs:
base_dirs:
- (/dev/block/bootdevice/by-name)
system:
- (/dev/block/bootdevice/by-name/system)
cache:
- (/dev/block/bootdevice/by-name/cache)
data:
- (/dev/block/bootdevice/by-name/userdata)
boot:
- (/dev/block/bootdevice/by-name/boot)
recovery:
- (/dev/block/bootdevice/recovery)
extra:
- (/dev/block/bootdevice/modem)
boot_ui:
supported: true
flags:
- (TW_HAS_DOWNLOAD_MODE)
graphics_backends:
- fbdev
brightness_path: (/sys/class/leds/lcd-backlight/brightness)
max_brightness: (255)
default_brightness: (162)
pixel_format: (RGBX_8888)
theme: portrait_hdpi
- You'll edit all values between brackets.
- open logs/system/build.prop, you'll find:
ro.product.model= is your (Device Name)
ro.product.name= and ro.product.device= is your (device id) and (device codename1), if you know more names for your device add it in (device codename2) / (device codename3)
ro.product.cpu.abi= is your (device architecture)
- open logs/recovery/recovery.fstab, you'll find main device mount points, copy each mount point to it name
- open logs/recovery/recovery.log, you'll find TW_BRIGHTNESS_PATH := /sys/class/leds/lcd-backlight/brightness this is your (brightness_path)
I:Got max brightness 255 is (max_brightness)
setting GGL_PIXEL_FORMAT_RGBA_8888 is (pixel_format)
- Note: you can get these info from BoradConfig.mk in your device twrp tree.
- Now read "Partition Logs:" in recovery.log
it'll tell us second mount point, as example /system | /dev/block/mmcblk0p41
so you should add it like
Code:
system:
- /dev/block/bootdevice/by-name/system
- /dev/block/mmcblk0p41
and so on with other partitions.
- Checking more mounts: (not necessary but i recommend it)
open logs/listings/dev_full and scroll down to /dev/block/platform/soc.0 you'll find another main mount point which contain by-name and by-num folders like /dev/block/platform/soc.0/f9824900.sdhci
from /dev/block/platform/soc.0/f9824900.sdhci/by-name list copy each partition mount point to your device
- Now we're done, you should have something like
Code:
- name: Xiaomi Mi4S
id: aqua
codenames:
- aqua
architecture: arm64-v8a
block_devs:
base_dirs:
- /dev/block/bootdevice/by-name
- /dev/block/platform/soc.0/f9824900.sdhci/by-name
system:
- /dev/block/bootdevice/by-name/system
- /dev/block/platform/soc.0/f9824900.sdhci/by-name/system
- /dev/block/mmcblk0p41
cache:
- /dev/block/bootdevice/by-name/cache
- /dev/block/platform/soc.0/f9824900.sdhci/by-name/cache
- /dev/block/mmcblk0p42
data:
- /dev/block/bootdevice/by-name/userdata
- /dev/block/platform/soc.0/f9824900.sdhci/by-name/userdata
- /dev/block/mmcblk0p44
boot:
- /dev/block/bootdevice/by-name/boot
- /dev/block/platform/soc.0/f9824900.sdhci/by-name/boot
- /dev/block/mmcblk0p37
recovery:
- /dev/block/bootdevice/by-name/recovery
- /dev/block/platform/soc.0/f9824900.sdhci/by-name/recovery
- /dev/block/mmcblk0p38
boot_ui:
supported: true
graphics_backends:
- fbdev
flags:
- TW_QCOM_RTC_FIX
pixel_format: RGBX_8888
brightness_path: /sys/class/leds/lcd-backlight/brightness
max_brightness: 255
default_brightness: 162
theme: portrait_hdpi
- Open DualBootPatcher/data/devices/(your device manufacturer).yml and add your device codes. then Check your code syntax here if everything is right, make commit to add your device to your repository.
- Build apk using any method explained above to test it.
Part 5: How to submit new Devices to official DualBootPatcher support?
Once you checked everything is working, it's time to contribute to DualBootPatcher and add your device to official devices:
- First, Check you made all needed changes to add your device without problems, again check for YAML syntax because if it's wrong build won't work.
- Open DualBootPatcher Repository, press New pull request button.
- Press compare across forks and change the head fork to your username/DualBootPatcher
- Give a name and a description to your pull request, some thing like: "Add (Device Name) support" or "data: Add (device name)
- Now click the "Create pull request" green button
- Wait for your changes to be verified and merged to the project, the developer received your code and he will review, try and add it to the source code. You will be notified when your code merged.
Supported Devices by me
Here is my all contributions to DualBootPatcher:
Nokia X/XL
Nokia X2
Samsung Galaxy Win & Core
Xiaomi Mi 6
Xiaomi Redmi 4A
OnePlus 5
HTC Desire Eye
YU YUREKA BLACK
Xiaomi Mi 4S
Xiaomi Redmi Pro
Samsung Galaxy S8/S8+ [Exynos & Snapdragon]
Zenfone 2 Laser [Z00ED]
Lenovo Vibe K6
Samsung Tab S2
Samsung Galaxy Note 8 (Exynos)
If you can't add your device, you can pm me with logs tar file and i'll add it for you
Hii reserved
---------- Post added at 02:20 AM ---------- Previous post was at 02:20 AM ----------
I will tell u, how to sync apps between roms, without using double storage space for apk and libs.
---------- Post added at 02:25 AM ---------- Previous post was at 02:20 AM ----------
also can be used as multi profile
Support Nokia 6?
Qualcomm s430 Full root...
taicracker said:
Support Nokia 6?
Qualcomm s430 Full root...
Click to expand...
Click to collapse
Flash get logs
And send me
taicracker said:
Support Nokia 6?
Qualcomm s430 Full root...
Click to expand...
Click to collapse
Read this man! https://forum.xda-developers.com/showpost.php?p=73551957&postcount=5
or if you can't do it i can help, just give me the logs tar file
yshalsager said:
Read this man! https://forum.xda-developers.com/showpost.php?p=73551957&postcount=5
or if you can't do it i can help, just give me the logs tar file
Click to expand...
Click to collapse
The file where you say is located on the device. I will upload it to you soon ?
---------- Post added at 05:27 PM ---------- Previous post was at 04:28 PM ----------
yshalsager said:
Read this man! https://forum.xda-developers.com/showpost.php?p=73551957&postcount=5
or if you can't do it i can help, just give me the logs tar file
Click to expand...
Click to collapse
https://drive.google.com/file/d/0B-7MZC8TPIGtTjQyOFVydzNHV1U/view?usp=drivesdk
This is the logs file. (.tar.gz)
I am not on a PC right now. You help me. Do you need the build.prop file on your device?
addy692 said:
Flash get logs
And send me
Click to expand...
Click to collapse
https://drive.google.com/file/d/0B-7MZC8TPIGtTjQyOFVydzNHV1U/view?usp=drivesdk
?
taicracker said:
https://drive.google.com/file/d/0B-7MZC8TPIGtTjQyOFVydzNHV1U/view?usp=drivesdk
This is the logs file. (.tar.gz)
I am not on a PC right now. You help me. Do you need the build.prop file on your device?
Click to expand...
Click to collapse
I got it, apk will be here soon
yshalsager said:
I got it, apk will be here soon
Click to expand...
Click to collapse
Ok. Thanks
taicracker said:
Ok. Thanks
Click to expand...
Click to collapse
@taicracker
Here you are, please test and report me
https://transfer.sh/rqmJs/Android_GUI-debug-290817-12h43m41s.apk
yshalsager said:
@taicracker
Here you are, please test and report me
https://transfer.sh/rqmJs/Android_GU...-12h43m41s.apk
Click to expand...
Click to collapse
link die
taicracker said:
link die
Click to expand...
Click to collapse
Sorry
https://transfer.sh/rqmJs/Android_GUI-debug-290817-12h43m41s.apk
yshalsager said:
Sorry
https://transfer.sh/rqmJs/Android_GUI-debug-290817-12h43m41s.apk
Click to expand...
Click to collapse
Ok Thanks. I'm downloading. Installation is complete and then I do next. My Nokia 6 does not have a compatible room at all
I installed apk file and what do i do next?

Categories

Resources