[SCRIPT] [GIT] gind (git-find) - git repository file/pattern search made easy - Miscellaneous Android Development

gind (git-find)
Hello guys,
I made a little script for searching inside git repositories and I'd like to share it with you guys
Came with the idea when fixing BlueDroid errors while building CM12 for p970 xP
Download
It's here on GitHub:
https://github.com/Alphasquare/Gind
How to use
Types: string, file
Code:
gind <type...> <pattern...>
Installation
To install, simply wget the file or download the zip.
As sudo, do:
Code:
chmod +x gind.sh
to make it executable.
Then, to install it, do:
Code:
mv gind.sh /bin/gind
Now gind is available globally. You can add it to your home directory bin folder instead,
Code:
mv gind.sh ~/bin/gind
Example output:
Code:
$ gind file bd.h
bta/include/bd.h

Related

[APP][DEV][GUIDE] Using the Android Java Internal/Hidden API classes

Using Java Reflection with Eclipse ADT to Access Internal/Hidden API classes.
Purpose
We present a way to access all the Internal and Hidden Java packages/classes
in the AOS. To do this we need to both repackage the Android.jar and hack the
Eclipse ADT plugin, to allow using these internal packages.
Posting
==================================================
Do NOT post general questions/requests on how to
do this or that, they will not be answered here.
DO post if you have additional tricks, hacks or
information that can help/benefit this tutorial.
==================================================
Background
There are two reasons one cannot use internal packages. One reason is that, if
you're using Eclipse as your development platform, those packages are
internally blocked in the Eclipse ADT plugin. Second reason is that the normal
development android.jar runtime does not contain those *.class files that
belong to the internal packages.
"There is no easy way to use com.android.internal package (internal API) or
anything marked with @hide attribute (hidden API) without using reflection.
That’s because android.jar file does not contain classes from internal and
hidden API and because of this nobody can reference those classes in compile
time."
Thus we need to first restore the "original" android.jar which will allow us
to use internal and hidden APIs. But the runtime equivalent of Android SDK’s
android.jar file is framework.jar. This file is located in the
/system/framework/ directory of your device. We will extract and use this for
our pleasure.
The general procedure:
A) Grab the "full" framwork.jar from your device
B) extract the class files
C) add them to "full" android.jar ??
D) Hack the Eclipse ADT plugin jar.
Finally, NOTHING would have been possible without the excellent step-by-step
instructions on the devmaze-blog by senior Android developer Ievgenii Nazaruk
(aka. "inazaruk"). THANK YOU Ievgenii!​References
http://stackoverflow.com/questions/...d-sdk-with-hidden-and-internal-apis-available
http://stackoverflow.com/questions/...-state-permission-for-apps-ran-on-gingerbread
http://code.google.com/p/smali/wiki/DeodexInstructions
http://code.google.com/p/adt-addons/
​
The General Procedure
NOTE: All this was performed on Windows Vista with Cygwin.(1) Grab BOOTCLASSPATH from init.rc
Find the line in your init.rc file that reads something like:
Code:
[SIZE=2]export BOOTCLASSPATH /system/framework/core.jar:/system/framework/bouncycastle.jar:/system/framework/ext.jar:/system/framework/framework.jar:/system/framework/android.policy.jar:/system/framework/services.jar:/system/framework/core-junit.jar[/SIZE]
Extract and reformat the path to:
Code:
[SIZE=2]core.jar:bouncycastle.jar:ext.jar:framework.jar:android.policy.jar:services.jar:core-junit.jar[/SIZE]
(2) Grab the "framework" from your device
Create a working directory somewhere, let's call it "_framework":
Code:
[SIZE=2]mkdir ./_framework[/SIZE]
[SIZE=2]cd _framework[/SIZE]
Grab all the framework files from your device:
Code:
[SIZE=2]adb pull /system/framework .[/SIZE]
Rename directory if needed.
NOTE-1: From now on I'll assume you know where you are!
NOTE-2: Most GB 2.3.4+ devices uses .odex'ed files,
with name pairs like: <package>.jar and <package>.odex.
These need to be converted.
(3) Use baksmali with (1)
You can also use baksmali with the switch: -d <framwork-dir>.
The general command is something like below, but in windows there may be "wrappers"
that allow you to just type "baksmali" without the "java -jar" prefix and without
the ".jar" post fix. Anyway here is the command I used:
Code:
[SIZE=2]java -Xmx1024m -jar ./../../baksmali.jar -a 10 -c :core.jar:bouncycastle.jar:ext.jar:framework.jar:android.policy.jar:services.jar:core-junit.jar -x framework.odex[/SIZE]
==> This results in all files put in the "out" sub-directory.
This directory contain 3 sub-directories (for GB 2.3.4):
Code:
[I]android [/I](Hidden APIs)
[I]com [/I](Internal APIs)
[I]javax [/I](Hidden APIs)
NOTE: If you are using Google's own API's, you will probably also need to add
those packages to the path above. (Eg. Email.jar, etc etc ?)
(4) Then use smali to create a dex file from "out" directory
Code:
java -jar smali.jar out
==> creates out.dex from "out" directory.
(5) Run dex2jar on out.dex
Code:
[SIZE=2]./dex2jar.bat out.dex[/SIZE]
==> creates out_dex2jar.jar
(This .jar contain close to 4900 files at 12 MB!)
(6) Rename "out_dex2jar.jar" to "framework-classes.zip"
Code:
[SIZE=2]mv out_dex2jar.jar framework-classes.zip
unzip framework-classes.zip[/SIZE]
(7) Find and copy your Android SDK's android.jar file
Go to: /path/to/android-sdk-windows/platforms/android-X/android.jar
where X is the API level of interest. This obviously have to match the
API level of the files you extracted from your device in: /system/framework .
This .jar file contain more than 5300 files when expanded, but missing all
the internal packages. Our job is to add them back in.
Let's first make a copy that we can use to expand and add files from (6):
Code:
cp android.jar custom-android.zip
unzip custom-android.zip
(8) Add all *.class files from (6) in to (7)
Copy and replace all existing *.class files from framework-classes.zip into
custom-android.zip:
Code:
[SIZE=2]cp -R /path/to/framework-classes/* /path/to/custom-android/.[/SIZE]
The root content of that directory should then look something like this:
Code:
[SIZE=2]android[/SIZE]
[SIZE=2]assets[/SIZE]
[SIZE=2]com[/SIZE]
[SIZE=2]dalvik[/SIZE]
[SIZE=2]java[/SIZE]
[SIZE=2]javax[/SIZE]
[SIZE=2]junit[/SIZE]
[SIZE=2]META-INF[/SIZE]
[SIZE=2]org[/SIZE]
[SIZE=2]res[/SIZE]
[SIZE=2]AndroidManifest.xml[/SIZE]
[SIZE=2]resources.arsc[/SIZE]
(9) Rename directory and create your new "classy-android.jar"
We rename it so not confuse with the original:
Code:
mv custom-android classy-android
zip classy-android
mv classy-android.zip classy-android.jar
IMPORTANT:
Make absolutely sure that the folder structure of your zip archive
is exactly the same as what you intended. To check, unzip the file
and see if it is what you (and eventually Eclipse) would expect.
(For example, if you use 7zip to zip a directory file called "test",
into "test.zip", you may end-up extracting it to ./test/test/... )
(10) Enabling & Restricting Access to classy-android.jar
Instead of just replacing the android.jar with classy-android.jar, we choose
to create a customized Android platform. This way you can enable the Internal
and Hidden API's for those projects requiring them, while other standard
projects doesn't have access to those.
(a) Go to: /path/to/android-sdk-windows/platforms/
and copy the relevant directory (for example):
Code:
cp -R android-10 android-10-internals
(b) Replace android.jar with your classy-android.jar:
Code:
cp classy-android.jar android.jar
("cp" overwrites!)
(c) Edit the build.prop file:
Edit/replace the following lines:
Code:
[SIZE=2]ro.build.version.sdk=10 ==> ro.build.version.sdk=[COLOR=Black][B]-10[/B][/COLOR][/SIZE]
[SIZE=2]ro.build.version.release=2.3.3 ==> ro.build.version.release=2.3.internal[/SIZE]
(11) Customizing the Eclipse ADT
In order to be able to use com.android.internal packages in the Eclipse ADT,
you have to disable the internal protection mechanism of the plugin, that
prevent you to use these libraries. You can see this by right-clicking on your
project package and navigate to:
Code:
[SIZE=2]==> Properties ==> Java Build Path ==> Libraries (tab) [/SIZE]
[SIZE=2]--> Android 2.x.x --> android.jar [/SIZE]
[SIZE=2]--> "Access rules: 1 rule defined": [B][COLOR=Red](X)[/COLOR][/B] [B]Forbidden: com/android/internal/**[/B][/SIZE]
This can not be removed (bug?), even though the interface allows changing, it
never persists after closing the Properties window. So we have to hack it!
The way to do it, is to hexedit the correct java class file and change the
name from "internal" to "internax". First let's find the correct file. The
plugin file is located in the ./eclipse/plugins/ directory, and its name is
something like:
Code:
com.android.ide.eclipse.adt_18.0.0.v201203301601-306762.jar
(a) make a backup copy of this (with the exact name preserved) in another directory.
(b) make a another copy of this in another directory.
(c) unzip (b) in that directory
Code:
[SIZE=2]cp com.android.ide.eclipse.adt_18.0.0.v201203301601-306762.jar hacked_adt.zip[/SIZE]
[SIZE=2]unzip hacked_adt.zip[/SIZE]
[SIZE=2]cd hacked_adt[/SIZE]
This is a huge directory system, so forget poking around in it,
just go to the correct sub-directory:
Code:
[SIZE=2]cd ./com/android/ide/eclipse/adt/internal/project/[/SIZE]
Then find the correct file and the approximate string location within that file:
Code:
[SIZE=2]strings.exe -f -4 -t x ./*.class |grep "android\/internal"[/SIZE]
It happens to be in "AndroidClasspathContainerInitializer.class". Now, use a
hexeditor to find and change the string "com/android/internal/**"
to "com/android/internax/**". That will do it!
Now zip-up your hacked jar directory and copy it over the old one.
(Remember that "cp" overwrites without warning!)
Code:
[SIZE=2]zip hacked_adt[/SIZE]
[SIZE=2]cp hacked_adt.zip /path/to/eclipse/plugins/com.android.ide.eclipse.adt_18.0.0.v201203301601-306762.jar[/SIZE]
You Are Done!
Enjoy your newly hacked Eclipse! ​Errors
If you get any errors;
1. make sure you have zipped up everything properly as warned before.
2. make sure you have included Google API packages in your BOOTCLASSPATH in step (3).
3. Try to "clean-up" the Java by: "Right-Click" ==> Source ==> "Clean Up...".
4. Google them
5. Ignore them
6. Give up. Not! But I can't help you!
If it still doesn't work, try to download inazaruk's pre-compiled set of internal android.jar's from here.
(For android 7,8,10,15.)
​
WIP! <here be dragons2>
For a project using internal package imports, see my thread:
"[TOOL][APP][WIP] Native AT Command Injector"
<here be more dragons>
Following the instructions in posts 1-2 above, may not always work. It is not known to me at this time, why it shouldn't. One theory is that it can have something to do with how Eclipse and Android.jar is packaging their files and the resulting sizes.
This was mentioned in this Stackoverflow post:
"Jar files: why does extracting then compression a jar file create a file of a different size to the original?"
Then reading the man pages for "jar" we can inform ourselves with:
Code:
[SIZE=2] c Creates a new archive file named jarfile (if f is specified) or to
standard output (if f and jarfile are omitted). Add to it the
files and directories specified by inputfiles.
u Updates an existing file jarfile (when f is specified) by adding
to it files and directories specified by inputfiles.
x Extracts files and directories from jarfile (if f is specified) or
standard input (if f and jarfile are omitted). If inputfiles is
specified, only those specified files and directories are
extracted. Otherwise, all files and directories are extracted.
t Lists the table of contents from jarfile (if f is specified) or
standard input (if f and jarfile are omitted). If inputfiles is
specified, only those specified files and directories are listed.
Otherwise, all files and directories are listed.
i Generate index information for the specified jarfile and its
dependent jar files.
[/SIZE]
More info is provided here:
The JAR Overview @
http://java.sun.com/javase/6/docs/technotes/guides/jar/jarGuide.html
The JAR File Specification @
http://java.sun.com/javase/6/docs/technotes/guides/jar/jar.html
The JARIndex Spec @
http://java.sun.com/javase/6/docs/technotes/guides/jar/jar.html
JAR Tutorial @
http://java.sun.com/docs/books/tutorial/jar/
pack200 Reference Page @
http://java.sun.com/javase/6/docs/technotes/tools/share/pack200.html
Another theory is that it may have something to do with what seem to be, that Google have revoked the the use of MODIFY_PHONE_STATE since Android 2.3, and that this influences the Eclipse behavior, when using and modifying older android.jar's. This was mentioned here and here.
Any help would be very much appreciated!
< bump >
Hi, thanks for the info, I made it using linux and worked really nice, these were the lines that I used, hope be useful.
This is my Android folder at home
Code:
Android/
├── eclipse
├── ndk
├── platforms-internals
├── sdk
└── tools
Start an avd running the desired API to modify in this case API-17
Code:
$ emulator -avd avd_api_17 -no-window &
Get the framework
Code:
$ cd ~/Android/
$ mkdir _framework
$ cd _framework
$ adb -s emulator-5554 pull /system/framework .
Grab BOOTCLASSPATH
Code:
$ adb -s emulator-5554 shell cat init.rc | grep BOOTCLASSPATH > bootclasspath
I didn't have the tools used in this tutorial, so I included the steps for getting them
Decompile with baskmali
Code:
$ cd ~/Android/tools
$ wget https://smali.googlecode.com/files/baksmali-1.4.2.jar
$ cd ~/Android/_framework
$ java -Xmx1024m -jar ../tools/baksmali-1.4.2.jar -a 17 -c core.jar:core-junit.jar:bouncycastle.jar:ext.jar:framework.jar:telephony-common.jar:mms-common.jar:android.policy.jar:services.jar:apache-xml.jar -x framework.odex
The parameter -a for baksmali refers to the API we are working with.
Generate out.dex with smali
Code:
$ cd ~/Android/tools
$ wget https://smali.googlecode.com/files/smali-1.4.2.jar
$ cd ~/Android/_framework
$ java -jar ../tools/smali-1.4.2.jar out
Get internal and hidden classes using dex2jar
Code:
$ cd ~/Android
$ wget https://dex2jar.googlecode.com/files/dex2jar-0.0.9.15.zip
$ unzip dex2jar-0.0.9.15.zip
$ rm dex2jar-0.0.9.15.zip
$ cd _framework/
$ ../tools/dex2jar-0.0.9.15/d2j-dex2jar.sh out.dex
$ unzip out-dex2jar.jar -d framework-classes
Add these classes to plataform's default android.jar
Code:
$ cd ~/Android
$ unzip sdk/platforms/android-17/android.jar -d custom-android
$ cp -r _framework/framework-classes/* custom-android/
$ rm -r _framework
$ cd custom-android
$ zip -r ../custom-android.jar *
$ cd ..
$ rm -r custom-android
Create new extended platform
Code:
$ cd ~/Android
$ cp -r sdk/platforms/android-17 platforms-internals/android-17-internals
$ mv custom-android.jar platforms-internals/android-17-internals/android.jar
$ vi platforms-internals/android-17-internals/build.prop
ro.build.version.release=4.2.2
ro.build.version.release=4.2.2.internal
$ ln -s ~/Android/platforms-internals/android-17-internals ~/Android/sdk/platforms/android-17-internals
I use a symlink for keep it a little organized
Hack ADT
Code:
$ cd ~/Android
$ unzip eclipse/plugins/com.android.ide.eclipse.adt_22.0.4.v201307151829--741630.jar -d hacked_adt
Go to right folder
Code:
$ cd hacked_adt/com/android/ide/eclipse/adt/internal/project/
Find file where is our desired string
Code:
$ strings -f -a -t x * | grep "android\/internal"
Edit with an hex editor
Code:
$ bless AndroidClasspathContainerInitializer.class &
Here we change the l for the x.
Replace original file making a backup
Code:
$ cd ~/Android
$ cp eclipse/plugins/com.android.ide.eclipse.adt_22.0.4.v201307151829--741630.jar eclipse/plugins/com.android.ide.eclipse.adt_22.0.4.v201307151829--741630.jar.original
$ cd hacked_adt/
$ zip -r ../eclipse/plugins/com.android.ide.eclipse.adt_22.0.4.v201307151829--741630.jar *
$ cd ..
$ rm -r hacked_adt
This worked for me... thanks E:V:A
I got just one error related to a dropbox class, but i think this is not important... hope that
lenieto3 said:
...Start an avd running the desired API to modify in this case API-17... This worked for me... I got just one error related to a dropbox class, but i think this is not important...
Click to expand...
Click to collapse
Thanks and sorry for late reply. I'm very happy to hear these instructions still works with API-17! Could you also upload your hacked JAR somewhere so that people can save some time when experimenting?
I was just here to check-in and try to bump this thread to see if it is still useful to anyone.
E:V:A said:
Thanks and sorry for late reply. I'm very happy to hear these instructions still works with API-17! Could you also upload your hacked JAR somewhere so that people can save some time when experimenting?
I was just here to check-in and try to bump this thread to see if it is still useful to anyone.
Click to expand...
Click to collapse
ive got access to ActivityManager's hidden methods.
I want to use the removeTask method, but it keeps saying that I dont have the REMOVE_TASKS permissions even though I added it to the manifest (and turned off lint).
Permission Denial: removeTask() from pid=9963, uid=10179 requires android.permission.REMOVE_TASKS
Does someone know if there are any automated tools to do/performs steps 1-9?
I'd like to see a tool to automatically pull (from phone), extract and create a compatible android.jar.
@Mohammad_Adib: Sorry, this is the wrong thread for those type of questions.
see this link stackoverflow.com|questions|30656933|android-system-framework-jar-files

[UBUNTU][DEBIAN]Common Commands used in Linux

Common Commands used in Linux.
Since, Android is based on Linux, there is much possibility that there is a need to use a Linux based OS. For such use, UBUNTU
is favoured, for its easy and more user friendly.
Today, I am going to Post a few commands that are very useful to the newbies to development
I myself am new, and have faced many problems with this, so I am posting a this thread, to help all the noobs/newbies find what they need in a single place
Okay so, lets start with some basic commands, which can be classified as general commands, and each Linux user MUST KNOW ALL OF THEM !!
Code:
sudo
It simply means "Superuser do". It requires password.
Code:
sudo apt-get install APPLICATION_name
This installs the application finding it on the internet, and gives you the suitable output(If the app exists or not).
Code:
sudo apt-get remove APPLICATION_name
It Removes the application
Code:
sudo apt-get update
it updates the repositories
Code:
sudo apt-get upgrade
upgrades your installed application with their latest versions from Ubuntu repositories
Code:
killall APPLICATION_NAME
kills (terminates) an application
Code:
ps -e
displays currently running processes
Code:
kill APPLICATION_PID
kills an application; where APPLICATION_PID.
NOTE: YOU CAN FIND "PID" USING EARLIER CODE.
Code:
wget http://path_to_file.com
downloads a file from the web to current directory
Code:
cd /PATH/TO/DIR
changes current directory to DIR. Use cd to change the current directory into any dir
Code:
cd ..
Like ms-dos, goes up one directory
Code:
dir
OR
Code:
ls
lists directory content
Code:
man COMMAND
Displays manual for command.
eg: man sudo
Code:
cp ORIGINALFILE NEWFILE
Copy a file
Code:
mv SOURCE DESTINATION
Moves a file
NOTE: YOU CAN ALSO RENAME A FILE WITH THIS.
EG: mv old_filename new_filename
Code:
mkdir FOLDERNAME
Make a directory/folder
Miscellaneous: Level 2
Code:
du -sh folder name
This calculates the size of the folder
Code:
ps -aux
This shows all the running processes
Code:
chown -R User:User dir
Change owner of files and directories
Code:
chmod 777 yourScript
This makes a shell script ".sh" extension
Code:
netstat -anltp | grep "LISTEN"
See all open ports on your machine
Code:
sudo apt-get install ufw
sudo ufw allow 80/tcp
sudo ufw allow 22/tcp
sudo ufw allow 443/tcp
sudo ufw allow 21/tcp
sudo ufw enable
Ubuntu provides a uncomplicated firewall (ufw). To install it and only allow SSH, FTP, and webtraffic use the following command.
Network Commands
Code:
ifconfig
Shows the network connections
WILL UPDATE REGULARLY AS MUCH I COULD.
Code:
passwd
Run after installing Linux when you see "[email protected]:~$" to set your root pass word
Code:
adduser
Replace and run to add a new user
Code:
adduser sudo
Replace and run to add that user to sudo
Code:
sudo apt-get purge
Replace and run to purge your system of that package
Code:
apt-cache search
Replace and run to search for new packages to install
Note: "wild cards" eg "*" are acceptable
Code:
find -type f -iname 'some-compressed-file*' -print0 | xargs -0 sudo tar -vxpzf
Replace with at least the "root" directory you want to search through and Replace " some-compressed-file " (leave the single quotes ' ' and the wild card *) and run to find every file under the given directory that has that name and the pipe " | " it out to tar so that'll extract to your current directory
Note: "find" does the finding, the "-type -f" tells find to only look for files, the "-iname" tells find to search parts of file names, the ' ' around "some-compressed-file" keeps the * from doing bad things, the "print0" tells find to "scrub" for spaces and such before outputting a result, the " | " pipes the results of find to xargs, the "-0" is because of "print0" in the find side of the pipe, and "sudo tar - vxpzf" is where tar extracts the findings of find.
Code:
find $HOME -type f -iname '*zip' -print0 | xargs -0 ls
Run to find and list every zip file under the home folder
Say you want to make a file to contain some notes wile in the command line
Code:
sudo cat > $HOME/someNotes.txt <<EOF
# place a command here
echo "hello world, I update aptget"
sudo apt-get update -q
EOF
Try editing the part after $HOME; type it in or write a file that contains the combo of " cat > $HOME/someNotes.txt <<EOF " some text or commands " EOF " and you'll find making custom scripts of varying complexity to be easy.
.......
Hope some of these are also found to be useful for others.
Thanks for starting this here thread.
Hit the link in my signature for more help with Linux for new and seasoned users
Edit 08082013- added another useful tip and reformatted commands to better fit the OP's formatting.
Sent from either my SPH-D700 or myTouch3Gs
Debian Kit/QEMU Linux Install guide for all android devices that I'm writing:
http://forum.xda-developers.com/showthread.php?t=2240397
Now have working Installers for ARM Java 7 JDK + Maptools + jMonkey
Yo ! Nice Share
To delete contents of a large text file ..
Code:
cat /dev/null > NameOfTheFile
Useful variations of ls command :
Show dir content in a list
Code:
ls -l
Show dir content in a list sorted by modification time (newer first)
Code:
ls -lt
Show dir content in a list sorted by modification time (older first)
Code:
ls -lrt
Show subdirectories recursively
Code:
ls -R
If you want to show files starting with . (hidden file), you can add -a option.
More options with command :
Code:
man ls
Useful variations of grep command :
grep is used to print lines matching a pattern.
Find the entry for current user in file /etc/passwd :
Code:
cat /etc/passwd | grep $USER
Find all the entry except current user entry in file /etc/passwd :
Code:
cat /etc/passwd | grep -v $USER
Find all the numbers in file /etc/passwd :
Code:
cat /etc/passwd|grep '[0-9]*'
Add color to grep command :
Code:
cat /etc/passwd | grep --color $USER
(You can add
Code:
alias grep='grep --color=auto'
in ~/.bashrc to always have colored grep)
Useful variations of tar command :
Create archive_name.tar from dirname :
Code:
tar cvf archive_name.tar dirname/
Create archive_name.tar.gz (compressed) from dirname :
Code:
tar zcvf archive_name.tar.gz dirname/
Extract archive_name.tar.gz :
Code:
tar zxvf archive_name.tar.gz
Useful variations of mkdir command :
Create directory and subdirectories if not existing :
Code:
mkdir -p /tmp/a/b/c
(mkdir /tmp/a/b/c will fail if /tmp/a and /tmp/a/b don't exist)
Useful tip :
Use bash variable "!$" to get the value of the last argument of the last command interpreted.
For example :
Code:
mkdir /tmp/test_a
cd !$ (equivalent cd /tmp/test_a)
or,
Code:
mv /tmp/a /tmp/b
ls !$ (equivalent ls /tmp/b)

[Completed] How to create Device tree for Android Rom building

How to create Device tree for Android Rom building
I assume you already downloaded source code
before we start please do following
1. Install unpackbootimg
Go to https://github.com/CoolDevelopment/android_bootimg_tools and download as a zzip or use git clone command.
extract files
cd directory
make
now you will find unpackbootimg and mkbootimg in this directory
2. copy unpackbootimg and mkbootimg to /usr/bin
sudo cp unpackbootimg /usr/bin
sudo cp mkbootimg /usr/bin
Note this is necessary if you are getting error
" "unpackbootimg not found. Is your android build environment set up and have the host tools been built?
3. Extracting boot.img from your device
What we need
1. A rooted phone
2. Enable Usb Debugging in Developer Mode
3. ADB command knowldge
connect your phone via usb cable ensure that usb debugging is enabled
open terminal and type adb devices
if it is showing your device's serial no than we are ready to go
C. type
adb shell
su
ls -l /dev/block/platform/mtk-msdc.0/11230000.msdc0/by-name
please note this command may vary by device to device. What we are doing here we want to know partition scheme of your device.
note down block name of /boot partition
example it will be like boot -> /dev/block/mmcblk0p7
d. type this
dd if=/dev/block/mmcblk0p7 of=/sdcard/boot.img
now boot.img succesfully transfered to your SD card Copy it to your Desktop
now path should be /home/user/Desktop/boot.img or similar but remeber path name alternatively you can type pwd in terminal to know this
creating device/Vendor-Name/Device-codename
cd to your working directory
Syntex: ./build/tools/device/mkvendor.sh Vendor-Name Device-CodeName ~/Path to your/boot.img
Example:
./build/tools/device/mkvendor.sh GIONEE GIONEE_WBL7511 ~/Desktop/boot.img
Now it will create following file in /device/Vender-Name/Device_CodeName
AndroidBoard.mk
cm.mk
recovery.fstab
AndroidProducts.mk
device_GIONEE_WBL7511.mk
system.prop
BoardConfig.mk
kernel
Note1: Please create vendorsetup.mk file in this directory manually. To use source build/envsetup.sh
Note2: Please double check BoardConfig.mk file and ensure every partition size is correct in this file. Also check recovery.fstab showing correct mount point
Note3: Here kernel is prebuilt kernel. If you want to compile kernel as well as download your kernel source in /kernel/Vender-Name/Device_CodeName dirtectory. You will find kernel related config in BoardConfig.mk
Please note it will not create vendorsetup.sh file and following Directory
1./vendor/Vender-Name/Device_CodeName
2. /kernel/Vender-Name/Device_CodeName
Wait for next post for more info
Thank You
http://azodik.com/
Thread closed as Assist is not the place to post guides

[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?

[Tutorial] Android OTA payload dumper on Android

Introduction
This tutorial will teach you how to specifically extract the boot.img from your OTA/ROM's payload.bin on your Android device, rather than a computer.
In addition to this, you will also have the ability to access all other img files that are packaged with the payload.bin.
The boot partition contains a kernel image and a RAM disk combined via mkbootimg.
You would generally want to keep a copy of your current OTA/ROM's boot.img in the event that you want to recover your devices boot partition when you want to switch kernels, or repairing a corrupted device due to kernel/RAM disk issues.
Prerequisites
Termux Installed: Official Play Store Link | Official F-Droid Link
payload_dumper: Official GitHub Link
To get started
Code:
# Extract payload_dumper folder contents to: /storage/emulated/0/payload_dumper/
# Extract payload.bin from your OTA/ROM to: /storage/emulated/0/payload_dumper/
$ pkg install python -y
$ pip install --upgrade pip
$ apt update && apt upgrade -y
$ termux-setup-storage
# Allow Termux access photos, media and files on your device
$ cd storage/shared/payload_dumper
$ pip install -r requirements.txt
$ python payload_dumper.py payload.bin
# You will find the dumped payload in /storage/emulated/0/payload_dumper/output
Sources
https://explainshell.com/explain?cmd=sudo+apt-get+update+&&+sudo+apt-get+upgrade
https://github.com/python/cpython
https://packaging.python.org/tutorials/installing-packages/
https://github.com/vm03/payload_dumper
https://termux.com/
https://wiki.termux.com/wiki/Python
https://source.android.com/devices/bootloader/partitions-images
https://wiki.termux.com/wiki/Internal_and_external_storage
Nice!
I am getting the following error and I cannot figure out how to fix it:
Code:
Processing LOGO partitionTraceback (most recent call last):
File "payload_dumper.py", line 157, in <module>
dump_part(part)
File "payload_dumper.py", line 100, in dump_part
out_file = open('%s/%s.img' % (args.out, part.partition_name), 'wb')
FileNotFoundError: [Errno 2] No such file or directory: 'output/LOGO.img'
Thank you a lot Man!
This method working great with OnePlus 7 pro. Extracted system.img from Hydrogen, will try reflash it to Oxygen rom.
GuestK00376 said:
Introduction
This tutorial will teach you how to specifically extract the boot.img from your OTA/ROM's payload.bin on your Android device, rather than a computer.
In addition to this, you will also have the ability to access all other img files that are packaged with the payload.bin.
The boot partition contains a kernel image and a RAM disk combined via mkbootimg.
You would generally want to keep a copy of your current OTA/ROM's boot.img in the event that you want to recover your devices boot partition when you want to switch kernels, or repairing a corrupted device due to kernel/RAM disk issues.
Prerequisites
Termux Installed: Official Play Store Link | Official F-Droid Link
payload_dumper: Official GitHub Link
To get started
Code:
# Extract payload_dumper folder contents to: /storage/emulated/0/payload_dumper/
# Extract payload.bin from your OTA/ROM to: /storage/emulated/0/payload_dumper/
$ pkg install python -y
$ pip install --upgrade pip
$ apt update && apt upgrade -y
$ termux-setup-storage
# Allow Termux access photos, media a
[QUOTE="GuestK00376, post: 81933401"]
Introduction
This tutorial will teach you how to specifically extract the boot.img from your OTA/ROM's payload.bin on your Android device, rather than a computer.
In addition to this, you will also have the ability to access all other img files that are packaged with the payload.bin.
The boot partition contains a kernel image and a RAM disk combined via mkbootimg.
You would generally want to keep a copy of your current OTA/ROM's boot.img in the event that you want to recover your devices boot partition when you want to switch kernels, or repairing a corrupted device due to kernel/RAM disk issues.
Prerequisites
Termux Installed: Official Play Store Link | Official F-Droid Link
payload_dumper: Official GitHub Link
To get started
[CODE]# Extract payload_dumper folder contents to: /storage/emulated/0/payload_dumper/
# Extract payload.bin from your OTA/ROM to: /storage/emulated/0/payload_dumper/
$ pkg install python -y
$ pip install --upgrade pip
$ apt update && apt upgrade -y
$ termux-setup-storage
# Allow Termux access photos, media and files on your device
$ cd storage/shared/payload_dumper
$ pip install -r requirements.txt
$ python payload_dumper.py payload.bin
# You will find the dumped payload in /storage/emulated/0/payload_dumper/output
Sources
https://explainshell.com/explain?cmd=sudo+apt-get+update+&&+sudo+apt-get+upgrade
https://github.com/python/cpython
https://packaging.python.org/tutorials/installing-packages/
https://github.com/vm03/payload_dumper
https://termux.com/
https://wiki.termux.com/wiki/Python
https://source.android.com/devices/bootloader/partitions-images
https://wiki.termux.com/wiki/Internal_and_external_storage
Click to expand...
Click to collapse
nd files on your device
$ cd storage/shared/payload_dumper
$ pip install -r requirements.txt
$ python payload_dumper.py payload.bin
# You will find the dumped payload in /storage/emulated/0/payload_dumper/output[/CODE]
[/QUOTE]
Started with this "$ pkg install python -y" but installing process was ending with ... see my screen shot.
ltth said:
Started with this "$ pkg install python -y" but installing process was ending with ... see my screen shot.
Click to expand...
Click to collapse
Seems that the repo isn't hosted by bintray anymore: https://github.com/termux/science-packages/commit/6485c133c539ec20663cf5807a3d1e5db3c8e917
EDIT: I followed the instructions here to change the repo using the termux-change-repo command.
I'm getting the following
cd: storage/shared/payload_dumper: Permission denied
even when no permissions denied on both termux and ternux api.
What am I doing wrong?
Onrplus 9 pro
hello guys, how to downgrade python, what command?
psychoela said:
View attachment 5508737hello guys, how to downgrade python, what command?
Click to expand...
Click to collapse
Download python 3.7
Had the same error
trying to extract boot.img from a rom, getting the following error...
" MutableMapping = collections.MutableMapping
AttributeError: module 'collections' has no attribute 'MutableMapping' "
any way to fix?
Does this still work
SidneyD said:
Seems that the repo isn't hosted by bintray anymore: https://github.com/termux/science-packages/commit/6485c133c539ec20663cf5807a3d1e5db3c8e917
EDIT: I followed the instructions here to change the repo using the termux-change-repo command.
Click to expand...
Click to collapse
Can you share your steps please
This doesn't work!!
Edit:
This working fine. Just figured out the play Store version of termux is outdated.
This is still working as of Jan 2023. A couple of changes need to be made.
- download Termux from F-droid servers instead.
- install openssl-tool in termux (type openssl and follow instructions)
I was able to extract the payload easily.

Categories

Resources