[SCRIPT][v1.4]Bug Reporter (ultimate debugging) -- The MUST debugging AIO tool! - Miscellaneous Android Development

Greetings
Hello everyone, I made a script to help developers solve problems and you become a more helpful user.
What does it do?
It exports to sdcard :
dmesg
last_kmsg
wakelocks
kernel version
logcat (normal and long)
radio (aka modem log)
getprop (aka build.prop)
running processes
partition info
mount info
RAM info
interrupts
boot logs from kernels like : nAa, lupus
Total maximum possible logs are 14 files.
What should I do? :cyclops:
Send files from the folder with the time-stamp you have just created or send the tar.gz'ed file to the corresponding developer to help him. Each time you run the script it creates a different folder with a unique time-stamp of the time and date you dumped the logs.
Send whatever is needed, everything is in bug_reporter folder.
Ok, how do we install this thing?
Make sure you download the latest version [ v1.4 is the latest ] which is attached below and put it in your sdcard...and that your device is rooted.
Go to CWM recovery and flash it! It does no harm, it just copies a small 6kb file in your /system/xbin. So there is no need to uninstall it later. It will accompany you until you flash a new ROM.
If you are coming from another version, just flash it over.
If you are having any problems, first attach the debug.txt from bug_reporter folder and tell me your device, kernel and ROM. The problem might be your busybox installation though.
Ok, how do we use this thing?
Make sure you have a terminal app, I use this : https://play.google.com/store/apps/details?id=jackpal.androidterm
Open a terminal app and just type :
Code:
su
bug
IT WON'T WORK PROPERLY IF NOT EXECUTED FROM /system/xbin/, SO IT MAY FAIL WITH SCRIPT MANAGER. TRY AND REPORT BACK TO ME.
That's it?
Yes. :good:
If you have any questions, feel free to ask anything. :highfive:
Any screenshots? :angel:
Yep.
{
"lightbox_close": "Close",
"lightbox_next": "Next",
"lightbox_previous": "Previous",
"lightbox_error": "The requested content cannot be loaded. Please try again later.",
"lightbox_start_slideshow": "Start slideshow",
"lightbox_stop_slideshow": "Stop slideshow",
"lightbox_full_screen": "Full screen",
"lightbox_thumbnails": "Thumbnails",
"lightbox_download": "Download",
"lightbox_share": "Share",
"lightbox_zoom": "Zoom",
"lightbox_new_window": "New window",
"lightbox_toggle_sidebar": "Toggle sidebar"
}
I want to contribute/redistribute
Oh, please do! :victory: Spread it, mod it, rewrite it, make your own version, inform developers, tell ROM cookers to include it, do whatever you want with it, but please don't forget me...
Post any improvements or modifications for me here. :fingers-crossed:
Here is the "source code" of it:
Code:
#!/system/bin/sh
DIRECTORY="/sdcard/bug_reporter"
clear
#ROOT CHECK, FOR SCRIPT TO WORK ON ALL su VERSIONS
clear
echo "Checking root permissions..."
if [ "$(id)" != "uid=0(root) gid=0(root)" ];
then
echo " - Denied?"
echo " * Please accept superuser permission..."
echo " /!\ FIRST TYPE: su"
echo
exit
elif [ "$(id)" == "uid=0(root) gid=0(root)" ];
then
echo " - Granted! SU binary version : $(su -V)"
else
echo
echo " /!\ Some errors occured... Obviously..."
echo " * Run the script again."
echo " - Asking superuser permissions..."
echo " ( i ) If you see somewhere "root", we are OK,"
echo " else, we are NOT."
su
echo " Look at it :"
id
exit
fi
{
#CREATING THE NEST DIRECTORY
#
if [ ! -d "$DIRECTORY" ];
then
echo " - Directory not found.
echo " - Creating...
mkdir $DIRECTORY
echo " - Done!
else
echo " - Fatal error! Exiting...
exit
fi
#FOR DEBUGGING REASONS
#
echo " - SU binary version : $(su -V)"
#VACUUM
#
clear
##SETTING MAX MB
if [ ! -f $DIRECTORY/max_mb.txt ];
then
echo Logs can easily exceed over the size you can imagine.
echo So, I will ask you if you want me to delete them
echo in the future.
echo
echo "How many MB of logs do you want to keep?"
echo "(5 MB recommended)"
read keep
KEEP_KB=$(echo $(($keep*1024)) )
echo $KEEP_KB > $DIRECTORY/max_mb.txt
clear
fi
SIZE=$(du -s $DIRECTORY | cut -f1)
MAX_MB=$(cat $DIRECTORY/max_mb.txt)
MB=$(echo $(($SIZE/1024)) )
##CHECKING IF MAX MB ARE REACHED AND PROMPT
if [ "$SIZE" -ge "$MAX_MB" ];
then
echo Log files have reached the maximum size you have set.
echo Their size is around $MB MB.
echo
echo Do you want to clean all logs?
echo "(y = Yes, clean. n = No, reset max MB value)"
read clean
echo
if [ "$clean" == "y" ] || [ "$clean" == "Y" ] || [ "$clean" == "yes" ] || [ "$clean" == "YES" ];
then
rm -r $DIRECTORY
echo - Cleaned!
echo - Re-run the script to set again the max MB value.
echo - Bye!
exit
elif [ "$clean" == "n" ] || [ "$clean" == "N" ] || [ "$clean" == "no" ] || [ "$clean" == "NO" ];
then
rm $DIRECTORY/max_mb.txt
echo - Value reseted!
echo - Re-run the script to set again the max MB value.
echo - Continuing...
sleep 2
else
echo "/!\ Illegal character. Try again...";
sleep 1
exec bug
fi
fi
#PRECALCULATIONS FOR LOGCATING
#
ls dev/log > $DIRECTORY/devlog
MAIN=$(grep main $DIRECTORY/devlog)
RADIO=$(grep radio $DIRECTORY/devlog)
clear
DATETIME=$(date +%Y%m%d%H%M%S)
export DATETIME
echo " ,-------------, Everything is saved on sdcard"
echo " / [email protected] / under bug_reporter folder."
echo "/_____________/__,------,"
echo "| Bug reporter v1.4 / Remember the timestamp!"
echo "|_______________,-----' Format : yyyymmddhhmmss"
echo
echo "It exports and compresses as tarball the following :"
echo "* dmesg"
echo "* last_kmsg"
echo "* wakelocks"
echo "* kernel version"
echo "* logcat (normal and long)"
echo "* radio (aka modem log)"
echo "* getprop (aka build.prop)"
echo "* running processes"
echo "* partition info"
echo "* mount info"
echo "* RAM info"
echo "* interrupts"
echo "* boot logs from kernels like : nAa, lupus"
echo
cd $DIRECTORY
#TIMESTAMP WHICH IS THE FOLDER'S NAME WHERE THE FILES ARE SAVED ON EACH RUN
echo - report timestamp : $DATETIME
mkdir "$DATETIME"
echo - exporting...
#FOR DMESG
echo - dmesg
dmesg > $DIRECTORY/"$DATETIME"/dmesg.txt
echo - OK!
#FOR LAST_KSMG
#
echo - last_kmsg
if [ -f /proc/last_kmsg ];
then
cat /proc/last_kmsg > $DIRECTORY/"$DATETIME"/last_kmsg.txt
echo - OK!
else
echo " /!\ last_kmsg not found!";
fi
#FOR WAKELOCKS
#
echo - wakelocks
if [ -f /proc/wakelocks ];
then
cat /proc/wakelocks > $DIRECTORY/"$DATETIME"/wakelocks.txt
echo - OK!
else
echo " /!\ wakelocks not found!";
fi
#FOR KERNEL VERSION
#
echo - kernel version
if [ -f /proc/version ];
then
cat /proc/version > $DIRECTORY/"$DATETIME"/kernel.txt
uname -a >> $DIRECTORY/"$DATETIME"/kernel.txt
echo - OK!
else
echo " /!\ version not found!";
fi
#FOR LOLCATS
#
if [ "$MAIN" != "main" ] || [ "$RADIO" != "radio" ];
then
echo " /!\ main and radio logging aborted!";
echo "* I can't logcat properly, loggers may be disabled."
echo "- Your ROM's dev must have disabled it via a script."
echo " OR"
echo "- Loggers are disabled from kernel."
else
##MAIN
echo - logcat
logcat -d > $DIRECTORY/"$DATETIME"/logcat.txt
echo - OK!
echo - long logcat
logcat -v long -d > $DIRECTORY/"$DATETIME"/long_logcat.txt
echo - OK!
##RADIO
echo - radio
logcat -b radio -v time -d > $DIRECTORY/"$DATETIME"/radio.txt
echo - OK!
fi
#FOR GETPROP
#
echo - getprop
getprop > $DIRECTORY/"$DATETIME"/getprop.txt
echo - OK!
#FOR RUNNING PROCESSES
#
echo - processes
ps > $DIRECTORY/"$DATETIME"/processes.txt
echo - OK!
#FOR PARTITION INFO
#
echo - partition info
df > $DIRECTORY/"$DATETIME"/partitions.txt
echo - OK!
#FOR MOUNTS
#
echo - mount info
mount > $DIRECTORY/"$DATETIME"/mounts.txt
echo - OK!
#FOR RAM
#
echo - RAM info
free > $DIRECTORY/"$DATETIME"/ram.txt
echo - OK!
#FOR INTERRUPTS
#
echo - interrupts
cat /proc/interrupts > $DIRECTORY/"$DATETIME"/interrupts.txt
echo - OK!
##----DEVIDER FOR SPECIAL LOGS----##
#BOOT LOG FOR nAa KERNELS AND DERIVATIVES
#
if [ -f "/boot.txt" ];
then
echo " ( i ) Oh, I found a boot log too!"
echo "- That's found on some nAa kernels, backing it up."
cat /boot.txt > $DIRECTORY/"$DATETIME"/boot.txt
echo - OK!
fi
#BOOT LOG FOR lupus KERNELS AND DERIVATIVES
#
if [ -f "/tmp/lupus.log" ];
then
echo " ( i ) Oh, I found a boot log too!"
echo "- That's found on some lupus kernels, backing it up."
cat /tmp/lupus.log > $DIRECTORY/"$DATETIME"/boot.txt
echo - OK!
fi
##----###----##
#CLEANING UP UNEEDED FILES FOR USER
#
echo - Cleaning up...
##CLEANING LAST TARBALL
rm *.tar.gz 2>&1 | >$DIRECTORY/devlog
##devlog IS A FILE OF PRECALCULATIONS FOR LOGCAT
if [ -f "$DIRECTORY/devlog" ];
then
rm $DIRECTORY/devlog
fi
#COMPRESSING FOR EASY SENDING
#
echo - Compressing logs...
echo - Done!
echo " ( i ) Send "$DATETIME".tar.gz to developer(s)!"
tar -zcf "$DATETIME".tar.gz "$DATETIME"
echo - Exiting...
#ADVERTISING THE SCRIPT
#
echo "http://forum.xda-developers.com/showthread.php?p=41107818" > $DIRECTORY/"$DATETIME"/"I used bug_reporter script.txt"
#DEBUGING MY SCRIPT
#
} 2>&1 | tee $DIRECTORY/debug.txt
exit

CHANGELOG
Code:
[B]v1.4[/B] [B][COLOR="Red"]MORE FEATURES[/COLOR][/B]-[COLOR="SeaGreen"]WORKS ON ALL SUPERUSER APPS[/COLOR]
- alternative root check
- now it's [B]not[/B] necessary to have SuperSU, you can use whatever you want, but you have to type [B]su[/B] first
- added additional logging of : [B]running processes[/B], [B]partition info[/B], [B]mount info[/B], [B]RAM info[/B], [B]interrupts[/B], [B]boot logs[/B] from [B]lupus[/B] kernel
- avoided potential bug with radio logging
- added some more info about kernel version logging (with [B]uname -a[/B] command)
- code clean up and more easier to follow
- faster? (it takes 1 second for me)
[B]v1.3[/B] [B][COLOR="Red"]ROCK STABLE[/COLOR][/B]-[COLOR="SeaGreen"]THE BEST[/COLOR]
- corrected root check
- added compatibility with CM10.1, it uses an older version of su and the script will ask you to install SuperSU to update it
- corrected and re-ordered some text
- optimized script speed by removing unnecessary su requests (it just takes 3 secs to finish)
- added build.prop backup with getprop command, it will help devs understand more info about your situation
- added some sort of advertisement of the script, so that it'll become popular
- added compression of the last logging folder, so that you can easily send it to dev(s)
- added more info on the script, made more presentable and explanatory for those who are willing to modify it
[B]v1.2[/B] [B][COLOR="Red"]STABLE[/COLOR][/B]-[COLOR="SeaGreen"]FULLY TESTED[/COLOR]
- finally fixed logcat exporting, now it will work for sure, fully tested
- cleaned up the script a lot and made it simplier for reading
- added radio (aka modem log), wakelocks and kernel version logging
- fixed terminal output logging for debugging better
[B]v1.1[/B] [I][COLOR="Gray"]it won't logcat, but everything else works[/COLOR][/I]
- fixed wrong logcat exporting, now when it's disabled, you'll know it
- added an auto-check for vaccuming logs after reaching above the MB size you set (logs can easily reach 10 MB)
- small bugfixes
- root check, in order to be sure we collect logs as root
- terminal output logging for debugging reasons
[B]v1.0 beta[/B] [I][COLOR="Gray"]works, but has many errors, it may even fail to flash.[/COLOR][/I]
- initial release

Thank you very much, this script will help a lot of people, including me
Sent from my R800i using xda premium

Is it possible to move this bug file to system/xbin instead of flashing it (gives error). And if yes, what should be the permissions?

zadrozny91 said:
Is it possible to move this bug file to system/xbin instead of flashing it (gives error). And if yes, what should be the permissions?
Click to expand...
Click to collapse
It's fixed. Just flash bug_reporter[v1.0]-nAa.zip, the permissions are 755. If you are unsure about permissions, see this : http://www.draac.com/chmodchart.html
But I am telling you to flash the fixed zip, it'll work.

leajian said:
It's fixed. Just flash bug_reporter[v1.0]-nAa.zip, the permissions are 755. If you are unsure about permissions, see this : http://www.draac.com/chmodchart.html
But I am telling you to flash the fixed zip, it'll work.
Click to expand...
Click to collapse
nice concept ,,but there are some problems
after taking log
both lastkmsg and logcat file show nothing(empty files)
long logcat shows this: 9 com.android.settings
only dmesg is correctly extracted

UPDATE!
Code:
[B]v1.1[/B]
- fixed wrong logcat exporting, now when it's disabled, you'll know it
- added an auto-check for vaccuming logs after reaching above the MB size you set (logs can easily reach 10 MB)
- small bugfixes
- root check, in order to be sure we collect logs as root
- terminal output logging for debugging reasons

Thanks man, I was going to write something similar until I found this.
I cannot attest to the zip's functionality as I use it with script manager, but I can say version 1.0 worked perfectly (producing the three possible proper log files) for me. Version 1.1 not so much it tells me 'I can't logcat' when I clearly can; gl with your 'main not found' problem.
Also a suggestion maybe include in your zip a copy of the script that goes to /sdcard/ so the user can easily access it in order to facilitate using it as a widget.

defiant07 said:
Thanks man, I was going to write something similar until I found this.
I cannot attest to the zip's functionality as I use it with script manager, but I can say version 1.0 worked perfectly (producing the three possible proper log files) for me. Version 1.1 not so much it tells me 'I can't logcat' when I clearly can; gl with your 'main not found' problem.
Also a suggestion maybe include in your zip a copy of the script that goes to /sdcard/ so the user can easily access it in order to facilitate using it as a widget.
Click to expand...
Click to collapse
Indeed, logcating won't work no matter what. It's a bug. I am aware of it. I'll fix it today I guess along with some code cleanup and considering your suggestion.
Sent from my MT11i using xda premium

Code:
[B]v1.2[/B] [B][COLOR="Red"]STABLE[/COLOR][/B]-[COLOR="SeaGreen"]FULLY TESTED[/COLOR]
- finally fixed logcat exporting, now it will work for sure, fully tested
- cleaned up the script a lot and made it simplier for reading
- added radio (aka modem log), wakelocks and kernel version logging
- fixed terminal output logging for debugging better
Also v1.0 beta re-added in case you want it.

Might convert this to external scripts for windows and unix as well. Btw, why the root checker? If it needs to be in system/xbin then you already have root
Sent from my Nexus 7 using Tapatalk HD

cybojenix said:
Might convert this to external scripts for windows and unix as well. Btw, why the root checker? If it needs to be in system/xbin then you already have root
Sent from my Nexus 7 using Tapatalk HD
Click to expand...
Click to collapse
:victory: Yeah, do whatever you want with it!
About the root check... Have you ever thought of "just in case" case? Well sometimes sh!t happens... Like the 7+7=16 embarrassing situation on final exams for example.
Anyway, probably won't need this check on other unix systems... You'll need to start the script with
Code:
sudo -i
and remove any
Code:
su -c
in the script. Also some logging files are available only for android, like logcat and logcat radio. If you need any help with converting I can help you both for windows and unix, just PM me.
EDIT : Opss, root check is buggy, I've discovered it thanks to you! I'll upload a fixed minor revision later.

leajian said:
:victory: Yeah, do whatever you want with it!
About the root check... Have you ever thought of "just in case" case? Well sometimes sh!t happens... Like the 7+7=16 embarrassing situation on final exams for example.
Anyway, probably won't need this check on other unix systems... You'll need to start the script with
Code:
sudo -i
and remove any
Code:
su -c
in the script. Also some logging files are available only for android, like logcat and logcat radio. If you need any help with converting I can help you both for windows and unix, just PM me.
EDIT : Opss, root check is buggy, I've discovered it thanks to you! I'll upload a fixed minor revision later.
Click to expand...
Click to collapse
I mean set up a script to run from a pc to debug android. Let's you run it on non rooted devices (parts of it anyway)
It's quicker than getting a user to push and run via the android terminal (which not everyone has)
Easier to run via an adb interface which can be supplied, and implement an update script everyone is running the same version
Btw won't need help check my signature for the root scripts
Sent from my Nexus 7 using Tapatalk HD

UPDATE! The tool is now in a super stable state of development.
Code:
[B]v1.3[/B] [B][COLOR="Red"]ROCK STABLE[/COLOR][/B]-[COLOR="SeaGreen"]THE BEST[/COLOR]
- corrected root check
- added compatibility with CM10.1, it uses an older version of su and the script will ask you to install SuperSU to update it
- corrected and re-ordered some text
- optimized script speed by removing unnecessary su requests (it just takes 3 secs to finish)
- added build.prop backup with getprop command, it will help devs understand more info about your situation
- added some sort of advertisement of the script, so that it'll become popular
- added compression of the last logging folder, so that you can easily send it to dev(s)
- added more info on the script, made more presentable and explanatory for those who are willing to modify it

can i get permission for adding your script in my cm-10.1 for LG-P350 ?

PecanCM said:
can i get permission for adding your script in my cm-10.1 for LG-P350 ?
Click to expand...
Click to collapse
Says in the post you can. Just credit
Sent from my Nexus 7 using Tapatalk HD

Just sharing. I use this:
bugreport > /sdcard/bug_report_`date +"%Y%m%d-%H%M"`
You may want to incorporate it in some way.
Sent from my GT-I9100 using xda premium

RovG said:
Just sharing. I use this:
bugreport > /sdcard/bug_report_`date +"%Y%m%d-%H%M"`
You may want to incorporate it in some way.
Sent from my GT-I9100 using xda premium
Click to expand...
Click to collapse
Thanks, I'll have it in mind, the reason why I didn't do this before is that I wanted it to be simple and not so informative.
In next update I might add some colors too!
Anyway here is an update... :fingers-crossed:
Code:
[B]v1.4[/B] [B][COLOR="Red"]MORE FEATURES[/COLOR][/B]-[COLOR="SeaGreen"]WORKS ON ALL SUPERUSER APPS[/COLOR]
- alternative root check
- now it's [B]not[/B] necessary to have SuperSU, you can use whatever you want, but you have to type [B]su[/B] first
- added additional logging of : [B]running processes[/B], [B]partition info[/B], [B]mount info[/B], [B]RAM info[/B], [B]interrupts[/B], [B]boot logs[/B] from [B]lupus[/B] kernel
- avoided potential bug with radio logging
- added some more info about kernel version logging (with [B]uname -a[/B] command)
- code clean up and more easier to follow
- faster? (it takes 1 second for me)

Related

[BASH SCRIPT][UPDATED] Governor Switch Scripts from the Command Line

UPDATE: Govswitch.sh has received an upgrade and it can now automagically generate an init.local.rc.new which can be used to set a governor on start up. It will also generate the chosen governor specific script and place it in the /system/bin folder. Thank you Duffkitty for the idea!
Original Post:
In the spirit of Open Source, I've written a couple of scripts that I wanted to share with the community. These are meant for advanced users familiar with the *nix command line. I didn't want to buy SetCPU (yes, I'm cheap ) so I decided to automate the process through the Bash shell language. For those interested, I've written a couple of Bash scripts that allow you to switch CPU governors via the command line. One script generates single instance scripts (one per governor) that can be used in conjunction with GScript for single click governor shortcuts. These single instance scripts are also ideal for changing the governor at boot. The other is command line only and prompts the user to choose from the available governors on the system.
I got tired of having to type it all out so I scripted the process. I just wanted to share with everyone else. I'm also planning to write a watch script that changes to the powersave governor automagically if the battery gets low.
I hope someone finds these scripts useful. Please let me know if anyone finds any errors in the scripts.
These scripts are offered under the terms of the GPLv2. Please see:
http://www.gnu.org/licenses/old-licenses/gpl-2.0.html
You must have root to run these. Usage is detailed in the scripts.
Disclaimer:
You use this script at your own risk. There are no warranties or guarantees of functionality or safety implied or stated whatsoever.
If you do not know what this does, please do not use it.
Despite my harsh warning above, I've designed these scripts to be as failsafe as possible so that nothing is written if the user does not want changes or the governor being selected is already in use. I use these scripts all the time and I have tried to make them as user friendly as command line scripts can be.
Unzip the attached zip to your SD Card. It contains:
gpl-2.0.txt
Description: License file.
govscriptgen.sh
Description: This script generates a set of scripts, one per governor to '/sdcard/governors/'. If a governor is not available in the kernel, no script is generated for it. IE: You can't have ondemand on a kernel that only has interactive built in as the only governor. If you do happen to run a governor script for a governor that is not available, it will simply exit with an error message and no changes made.
Example:
Run:
Code:
bash /sdcard/govscriptgen.sh
Then:
Code:
bash /sdcard/governors/ondemand.sh
Code:
## This script is offered free for use and distribution under the terms and conditions
# in accordance with the GPLv2. For more inforation please visit:
# http://www.gnu.org/licenses/old-licenses/gpl-2.0.html
#
## Written by Alex Zaballa (8/23/2010) for use on Android OS.
#
## Description: This script is designed to facilitate CPU Governor switching from
# the Bash command line that comes with custom Android ROMs. It reads the governors
# available on the system generates a script per governor.
# This allows user selection and future automation through Bash.
# Running this script with preexisting scripts in the gen_path
# will automatically overwrite the preexisting scripts.
# If you are a Bash editor, rename/backup anything you want to keep.
#
## Usage:
# bash /yourpath/govscriptgen.sh
#
## For root users only.
#
## Disclaimer:
# You use this script at your *own risk*. There are no warranties or guarantees
# of functionality or safety implied or stated whatsoever.
# If you do not know what this does, please do not use it.
##
# User Editable: Change this variable to change the generation path.
# Please use quotes and end slash.
gen_path="/sdcard/governors/"
# What governors are available to us?
gov_list="$(cat /sys/devices/system/cpu/cpu0/cpufreq/scaling_available_governors)"
# Create governor script folder if it does not exist.
if [ ! -e "${gen_path}" ]; then
mkdir ${gen_path}
fi
# Main loop
# Loop through the available governors.
for gov in ${gov_list}; do
# Concatenate path + filename.
script_name="${gen_path}${gov}.sh"
# Echo it all to script_name, rinse, repeat.
echo "Generating ${script_name} ..."
echo '## This script is offered free for use and distribution under the terms and conditions' > ${script_name}
echo '# in accordance with the GPLv2. For more inforation please visit:' >> ${script_name}
echo '## http://www.gnu.org/licenses/old-licenses/gpl-2.0.html' >> ${script_name}
echo '#' >> ${script_name}
echo '## Written by Alex Zaballa (8/23/2010) for use on Android OS.' >> ${script_name}
echo '#' >> ${script_name}
echo '## Description: This script is designed to facilitate CPU Governor' >> ${script_name}
echo '# switching from the Bash command line that comes with custom'>> ${script_name}
echo '# Android ROMs. The script name is generated from the available' >> ${script_name}
echo '# governors and when run, updates to the governor for which the script' >> ${script_name}
echo '# is named. If a governor is not available, it will exit safely with an error.' >> ${script_name}
echo '# These scripts can be used with GScript to create governor shortcuts.' >> ${script_name}
echo '#'
echo '## Usage:' >> ${script_name}
echo "# bash ${script_name}" >> ${script_name}
echo '#' >> ${script_name}
echo '## For root users only.' >> ${script_name}
echo '#' >> ${script_name}
echo '## Disclaimer:' >> ${script_name}
echo '# You use this script at your *own risk*. There are no warranties or guarantees' >> ${script_name}
echo '# of functionality or safety implied or stated whatsoever.' >> ${script_name}
echo '# If you do not know what this does, please do not use it.' >> ${script_name}
echo '##' >> ${script_name}
echo "" >> ${script_name}
echo "" >> ${script_name}
echo '# Set governor that the script controls. This was given at generation.' >> ${script_name}
echo -e 'gov='"\042"${gov}"\042" >> ${script_name}
echo '# What is the current system governor?' >> ${script_name}
echo -e current_gov="\042"'$(cat /sys/devices/system/cpu/cpu0/cpufreq/scaling_governor)'"\042" >> ${script_name}
echo '# What governors are available to us?' >> ${script_name}
echo -e gov_list="\042"'$(cat /sys/devices/system/cpu/cpu0/cpufreq/scaling_available_governors)'"\042" >> ${script_name}
echo "" >> ${script_name}
echo '# Failsafe: If the governor we are trying to set to is not available, exit safely.' >> ${script_name}
echo 'if [ "$(echo "${gov_list}" | grep -c "${gov}" )" != "0" ]; then' >> ${script_name}
echo '# Failsafe: If the governor we are trying to set to is already set, write nothing.' >> ${script_name}
echo ' if [ "${gov}" != "${current_gov}" ]; then' >> ${script_name}
echo ' echo "${gov}" > /sys/devices/system/cpu/cpu0/cpufreq/scaling_governor' >> ${script_name}
echo ' current_gov="$(cat /sys/devices/system/cpu/cpu0/cpufreq/scaling_governor)"' >> ${script_name}
echo ' echo "Governor changed to:[${current_gov}]"' >> ${script_name}
echo ' else' >> ${script_name}
echo ' echo "Governor already set to:[${current_gov}]"' >> ${script_name}
echo ' echo "No changes made."' >> ${script_name}
echo ' fi' >> ${script_name}
echo 'else' >> ${script_name}
echo ' echo "Error: [${gov}] governor is not available on this kernel. No changes made."' >> ${script_name}
echo 'fi' >> ${script_name}
done
govswitch.sh
Description:
This script is meant for interactive terminal use (IE: use if you are staring at a command line prompt). It prompts the user for governor selection.
Example:
Run:
Code:
bash /sdcard/govswitch.sh
Code:
## This script is offered free for use and distribution under the terms and conditions
# in accordance with the GPLv2. For more inforation please visit:
# http://www.gnu.org/licenses/old-licenses/gpl-2.0.html
##
## Written by Alex Zaballa (8/23/2010) for use on Android OS.
##
# Description: This script is designed to facilitate CPU Governor switching from
# the Bash command line that comes with custom Android ROMs. It reads the governors
# available on the system and asks the user which they would like to use.
#
## Usage:
# bash /yourpath/govswitch.sh
#
## For root users only.
#
## Disclaimer:
# You use this script at your *own risk*. There are no warranties or guarantees
# of functionality or safety implied or stated whatsoever.
# If you do not know what this does, please do not use it.
##
# No root, no go.
if [ "$(whoami)" != "root" ]; then
echo "ERROR: You do not have sufficient privileges to run this script."
echo "Please re-run with root privileges."
exit 1
fi
# Default paths. Most of these should not change unless AOS does.
gov_path="/sys/devices/system/cpu/cpu0/cpufreq/scaling_governor"
available_path="/sys/devices/system/cpu/cpu0/cpufreq/scaling_available_governors"
init_rc_path="/system/etc/init.local.rc"
bash_path="/system/xbin/bash"
# Recursive function to nag user for a sane and expected answer: (Y)(y) or (N)(n).
function yesno {
read -s -n 1 ans
case $ans in
# If the user has made a choice, update system variable and exit function and for loop.
Y|y) if [ "$2" == '/system/etc/init.local.rc' ]; then
# Do no harm. User has final say to replace 'init.local.rc'.
clear
echo "Setting system to rw permissions."
mount -o remount,rw -t yaffs2 /dev/block/mtdblock3 /system
# Backup the original init.local.rc file if one does not exist.
if [ ! -e "${init_rc_path}.bak" ]; then
echo "Generating $2.bak"
cat "${init_rc_path}" > "${init_rc_path}.bak"
fi
echo "Generating $2.new"
cat "$2" > "$2.new"
echo "$1" >> "$2.new"
else
echo "$1" > "$2"
echo "[$1] written to:"
echo "$2"
fi
break 2> /dev/null ;;
# If the user wants something else, skip current item listed.
N|n) echo "Not writing [$1]..."
if [ "$2" == '/system/etc/init.local.rc' ]; then
echo "Done."
exit 0
fi ;;
# Garbage answer in; sanity nag out. Recurse.
* ) echo "Please enter:[y/n]"
yesno "$1" "$2";;
esac
}
# What governors are available to us?
gov_list="$(cat "${available_path}")"
# Main Loop
clear
echo "Available governors:[${gov_list}]"
# Failsafe: If all answers are no, we don't change anything.
echo "Answer (n)o to every question to keep current governor."
# Loop through available options.
for gov in ${gov_list}; do
# What is our current governor?
current_gov="$(cat "${gov_path}")"
# Skip question if the current governor and our option is the same.
if [ "${gov}" != "${current_gov}" ]; then
echo "The current governor is:[${current_gov}]"
echo ""
echo "Change to:[${gov}][y/n]?"
yesno "${gov}" "${gov_path}"
fi
done
# Confirm what we've done.
current_gov="$(cat "${gov_path}")"
echo -e "\nThe current governor is:[${current_gov}]"
echo "Do you want to use this governor on startup?"
startup_script="$(echo -e '/system/bin/'"${current_gov}"'.sh')"
init_string="$(echo -e 'service gov_'"${current_gov} ${bash_path} ${startup_script}\n\t\t"'oneshot'"\n\n\n")"
yesno "${init_string}" "${init_rc_path}"
if [ ! -e "${startup_script}" ]; then
# Echo it all to startup_script.
echo "Generating ${startup_script} ..."
echo '## This script is offered free for use and distribution under the terms and conditions' > ${startup_script}
echo '# in accordance with the GPLv2. For more inforation please visit:' >> ${startup_script}
echo '## http://www.gnu.org/licenses/old-licenses/gpl-2.0.html' >> ${startup_script}
echo '#' >> ${startup_script}
echo '## Written by Alex Zaballa (8/23/2010) for use on Android OS.' >> ${startup_script}
echo '#' >> ${startup_script}
echo '## Description: This script is designed to facilitate CPU Governor' >> ${startup_script}
echo '# switching from the Bash command line that comes with custom'>> ${startup_script}
echo '# Android ROMs. The script name is generated from the available' >> ${startup_script}
echo '# governors and when run, updates to the governor for which the script' >> ${startup_script}
echo '# is named. If a governor is not available, it will exit safely with an error.' >> ${startup_script}
echo '# These scripts can be used with GScript to create governor shortcuts.' >> ${startup_script}
echo '#' >> ${startup_script}
echo '## Usage:' >> ${startup_script}
echo "# bash ${startup_script}" >> ${startup_script}
echo '#' >> ${startup_script}
echo '## For root users only.' >> ${startup_script}
echo '#' >> ${startup_script}
echo '## Disclaimer:' >> ${startup_script}
echo '# You use this script at your *own risk*. There are no warranties or guarantees' >> ${startup_script}
echo '# of functionality or safety implied or stated whatsoever.' >> ${startup_script}
echo '# If you do not know what this does, please do not use it.' >> ${startup_script}
echo '##' >> ${startup_script}
echo "" >> ${startup_script}
echo "" >> ${startup_script}
echo '# Set governor that the script controls. This was given at generation.' >> ${startup_script}
echo -e 'gov='"\042"${current_gov}"\042" >> ${startup_script}
echo '# What is the current system governor?' >> ${startup_script}
echo -e 'current_gov='"\042"'$(cat /sys/devices/system/cpu/cpu0/cpufreq/scaling_governor)'"\042" >> ${startup_script}
echo '# What governors are available to us?' >> ${startup_script}
echo -e 'gov_list='"\042"'$(cat /sys/devices/system/cpu/cpu0/cpufreq/scaling_available_governors)'"\042" >> ${startup_script}
echo "" >> ${startup_script}
echo '# Failsafe: If the governor we are trying to set to is not available, exit safely.' >> ${startup_script}
echo 'if [ "$(echo "${gov_list}" | grep -c "${gov}" )" != "0" ]; then' >> ${startup_script}
echo '# Failsafe: If the governor we are trying to set to is already set, write nothing.' >> ${startup_script}
echo ' if [ "${gov}" != "${current_gov}" ]; then' >> ${startup_script}
echo ' echo "${gov}" > /sys/devices/system/cpu/cpu0/cpufreq/scaling_governor' >> ${startup_script}
echo ' current_gov="$(cat /sys/devices/system/cpu/cpu0/cpufreq/scaling_governor)"' >> ${startup_script}
echo ' echo "Governor changed to:[${current_gov}]"' >> ${startup_script}
echo ' else' >> ${startup_script}
echo ' echo "Governor already set to:[${current_gov}]"' >> ${startup_script}
echo ' echo "No changes made."' >> ${startup_script}
echo ' fi' >> ${startup_script}
echo 'else' >> ${startup_script}
echo ' echo "Error: [${gov}] governor is not available on this kernel. No changes made."' >> ${startup_script}
echo 'fi' >> ${startup_script}
fi
echo ""
echo "***"
echo "WARNING:"
echo "CHECK init.local.rc.new for correctness"
echo "BEFORE overwriting the original."
echo "***"
echo "If you need a backup of the original,"
echo "init.local.rc.bak was created at runtime."
echo "Run the following or similar command"
echo "to overwrite init.local.rc in /system/etc/:"
echo ""
echo "cat init.local.rc.bak > init.local.rc"
Thanks downloading now.
duffkitty said:
Thanks downloading now.
Click to expand...
Click to collapse
Please let me know if you have any questions.
At first I got a yesno error but ran it with sh and not bash.
Working but I can't figure out gscript it sends out stderr's. I have the lite so dunno.
I'm guessing to start at boot I would need to edit a bit =P
Sent from my CM 6 Blackmodded Heroc using the XDA app. Now with uncapped kernel and battery tweaks.
duffkitty said:
At first I got a yesno error but ran it with sh and not bash.
Working but I can't figure out gscript it sends out stderr's. I have the lite so dunno.
I'm guessing to start at boot I would need to edit a bit =P
Sent from my CM 6 Blackmodded Heroc using the XDA app. Now with uncapped kernel and battery tweaks.
Click to expand...
Click to collapse
I found this for running scripts at boot. It's a good place to start.
http://forum.xda-developers.com/showthread.php?t=690564&page=2
govscriptgen.sh
This script generates a set of scripts, one per governor. It's those scripts you would want to use at boot or in gscript. If you didn't change the location, and assuming that you could write to your SD Card, they should be located in '/sdcard/governors'. There will be one per available governor (this is dictated by the kernel configuration).
In GScript do the following:
1. Open GScript Lite.
2. Menu > Add Script
3. Name the script. Let's say Ondemand.
4. Check 'Needs SU?'
5. In the text box type (without quotes), 'bash /sdcard/governors/ondemand.sh'
6. Create a shortcut to that script and it will set the governor it is named for.
govswitch.sh
This one is for use in a terminal and prompts the user for the desired governor.
I think I figured out and was gonna post it but you already did thanks. I appreciate it.
Sent from my CM 6 Blackmodded Heroc using the XDA app. Now with uncapped kernel and battery tweaks.
Added interactive.sh to /system/bin and fixed the permissions but I added
service gov_interactive /system/bin/interactive.sh
oneshot
To init.local.rc and it doesn't start... I can run it in terminal emulator with just interactive.sh though....
Sent from my CM 6 Blackmodded Heroc using the XDA app. Now with uncapped kernel and battery tweaks.
duffkitty said:
Added interactive.sh to /system/bin and fixed the permissions but I added
service gov_interactive /system/bin/interactive.sh
oneshot
To init.local.rc and it doesn't start... I can run it in terminal emulator with just interactive.sh though....
Sent from my CM 6 Blackmodded Heroc using the XDA app. Now with uncapped kernel and battery tweaks.
Click to expand...
Click to collapse
I think it needs the interpreter in front of it. Could you try the following?
Code:
service gov_interactive /system/xbin/bash /system/bin/interactive.sh
zansatsu said:
I think it needs the interpreter in front of it. Could you try the following?
Code:
service gov_interactive /system/xbin/bash /system/bin/interactive.sh
Click to expand...
Click to collapse
That does it. I guess it doesn't automagically know it's bash =P
Sent from my CM 6 Blackmodded Heroc using the XDA app. Now with uncapped kernel and battery tweaks.
duffkitty said:
That does it. I guess it doesn't automagically know it's bash =P
Click to expand...
Click to collapse
I'm glad it worked. Yeah, Android's command line fought me most of the way until I learned to just call bash before running any scripts. I suspect it's probably because the command line on Android initializes in a relatively 'bare' state as compared to all of Linux's bells and whistles that I'm used to.
Let me know if you have any more questions.
zansatsu said:
I'm glad it worked. Yeah, Android's command line fought me most of the way until I learned to just call bash before running any scripts. I suspect it's probably because the command line on Android initializes in a relatively 'bare' state as compared to all of Linux's bells and whistles that I'm used to.
Let me know if you have any more questions.
Click to expand...
Click to collapse
Thanks for helping =) I wonder if its possible to add bsd style init scripts. I guess you don't actually need to change many services but an rc.conf file would be cool =P
Sent from my CM 6 Blackmodded Heroc using the XDA app. Now with uncapped kernel and battery tweaks.
duffkitty said:
Thanks for helping =) I wonder if its possible to add bsd style init scripts. I guess you don't actually need to change many services but an rc.conf file would be cool =P
Sent from my CM 6 Blackmodded Heroc using the XDA app. Now with uncapped kernel and battery tweaks.
Click to expand...
Click to collapse
I started on Slackware and a '/etc/rc.d/rc.local' file would be really awesome. Slackware being one of the oldest distros (if not the oldest) is very similar to BSD. I've had to configure Slack many times, but once you did it was rock-solid.
Android feels more like Ubuntu in some ways and Red Hat in others, but a very slim version of either. I can't really explain it.
Anywho. Glad I could help.
Code:
## This script is offered free for use and distribution under the terms and conditions
# in accordance with the GPLv2. For more inforation please visit:
# http://www.gnu.org/licenses/old-licenses/gpl-2.0.html
#
## Written by Alex Zaballa (9/23/2010) for use on Android OS.
#
Click to expand...
Click to collapse
How did you write this script one month in the future?
Seriously....would this script be able to change kernel voltage from command line? Say changing from undervolted to regular voltage for certain tasks (like GPS nav for example), then switch back to undervolt for other usage? Is something like that even possible? I've seen a few others ask about something like that in other threads.
chromiumleaf said:
How did you write this script one month in the future?
Click to expand...
Click to collapse
I'm just that ahead of my time! ROFL
DOH!
I corrected and reposted the zip file.
chromiumleaf said:
Seriously....would this script be able to change kernel voltage from command line? Say changing from undervolted to regular voltage for certain tasks (like GPS nav for example), then switch back to undervolt for other usage? Is something like that even possible? I've seen a few others ask about something like that in other threads.
Click to expand...
Click to collapse
If there is a command line associated with it, I can write a script that can easily handle it. I haven't looked into the specifics on changing voltages...
TBH: That thought scares the bejeezuz out of me.
zansatsu said:
If there is a command line associated with it, I can write a script that can easily handle it. I haven't looked into the specifics on changing voltages...
TBH: That thought scares the bejeezuz out of me.
Click to expand...
Click to collapse
Check out this thread for some of the initial dev conversations on undervolting: http://forum.xda-developers.com/showthread.php?t=697286 Ironically, I think some of it started from the guy who dev'd setcpu. Might have some info in it that could help you figure some things out. I'd try to sum it up for you but that stuff is just a bit over my head
Decad3nce said:
Code:
/* MSM7201A Levels 3-6 all correspond to 1.2V, level 7 corresponds to 1.325V. */
enum {
VDD_0 = 0,
VDD_1 = 1,
VDD_2 = 2,
VDD_3 = 3,
VDD_4 = 4,
VDD_5 = 5,
VDD_6 = 6,
VDD_7 = 7,
VDD_END
};
Thanks to kleranc for idea.
Click to expand...
Click to collapse
These are kernel level calls that have to be compiled into the kernel. Unless they make this available as a system variable, like the governors are, I don't think changing the voltage from the command line is possible... or even safe. The governors are routines written to control different CPU modes of operation and are designed to be fairly safe to use in instances of power management. Adjusting the voltages from the command line would prove to be too close to suicidal because Bash can't operate at the speeds necessary to monitor voltage fluctations.
Example: We hit a voltage spike, which needs to be corrected in nanoseconds (billionth of a second), Bash would brick the phone by not responding until at least 50 milliseconds (thousandth of a second) later, if ever.
Now if they had modules written that the kernel had different voltage 'modes' and built-in safeties, then I wouldn't have a problem manipulating them from the command line. As it stands, I'll leave it to people who think in ARM Assembler, C, and C++. lol
However, I am taking script ideas, so feel free to suggest anything else you might think is useful.
No Hero gets left behind!
Sent from my FROYO HERO.
Govswitch.sh has received an upgrade and it can now automagically generate an init.local.rc.new which can be used to set a governor on start up. It will also generate the chosen governor specific script and place it in the /system/bin folder. Thank you Duffkitty for the idea!
zansatsu said:
Govswitch.sh has received an upgrade and it can now automagically generate an init.local.rc.new which can be used to set a governor on start up. It will also generate the chosen governor specific script and place it in the /system/bin folder. Thank you Duffkitty for the idea!
Click to expand...
Click to collapse
Awesome I'm not longer using CM for a daily and switched to Zen-ROM but may go back when a release happens. Niche audience for the script but its very helpful
Sent from my HTC Hero using XDA App

[Mod][Flash] Universal Bootanimation Flash Update.zip - Sense|AOSP|Sprint|HTC|Verizon

Hello World.
Tommy here. This time I have a nifty little trick for you guys.
This took a little creative thinking but I think I got it pretty good. I was chatting with some Team Ramen Noodles guys and someone asked how an AOSP botanimaiton zip can be flashed on a Sense ROM. This was the lightbulb moment
Instructions for dev:
Download from link below.
Place the file "bootanimation.zip" inside the update.zip. I put a placeholder so you would know where to replace it.
Optionally, you can put a sound "android_audio.mp3". If you don't want it, then just leave it out. Not necessary.
When you open it up, you will see two place holder files, "bootanimaion.zip__HERE" and "android_audo.mp3__HERE". You can delete them if you want, but they don't do anything. Just for reference.
Files must be named "bootanimation.zip" and "android_audio.zip", otherwise won't work.
The script "tt_uni_boot" looks for the animation and sound in the rom, and replaces it depending on what it finds.
This works on AOSP, Sense, Sprint, HTC, and Verizion
The update.zip below is what you should use as your base if you want to make your bootanimation universal for all roms.
Also, if anyone wants to flash it as is, it contains this lovely animation:
{
"lightbox_close": "Close",
"lightbox_next": "Next",
"lightbox_previous": "Previous",
"lightbox_error": "The requested content cannot be loaded. Please try again later.",
"lightbox_start_slideshow": "Start slideshow",
"lightbox_stop_slideshow": "Stop slideshow",
"lightbox_full_screen": "Full screen",
"lightbox_thumbnails": "Thumbnails",
"lightbox_download": "Download",
"lightbox_share": "Share",
"lightbox_zoom": "Zoom",
"lightbox_new_window": "New window",
"lightbox_toggle_sidebar": "Toggle sidebar"
}
Original Thread Here
Universal Bootanimation update.zip v0.0.1 - January 08, 2012
Enjoy!
Please report feedback. I and dean_fx tested it before I posted, but if you want different feature or something like that let me know.
Tommy
edit1.
And in case anyone wants to adapt my script, I am more than happy to share. Just give a little credit
Sharing means caring. And collaborative efforts yield better results.
Code:
#!/system/bin/bash
#tommytomatoe
#universal animation flasher
# creating logfile "lockscreen" on sdcard
log=sdcard/bootanimation.log
touch $log
# mounting system as R/W
busybox mount -o remount,rw /system
echo "/system mounted as R/W" > $log
echo "" >> $log
# doing some checks
# bootanimation locatioon
if busybox [ -e /system/customize/resource/bootanimation.zip ]; then
BOOT_ANI=/system/customize/resource/bootanimation.zip
elif busybox [ -e /data/local/bootanimation.zip ]; then
BOOT_ANI=/data/local/bootanimation.zip
elif busybox [ -e /system/media/bootanimation.zip ]; then
BOOT_ANI=/system/media/bootanimation.zip
elif busybox [ -e /system/customize/resource/spc_bootanimation.zip ]; then
BOOT_ANI=/system/customize/resource/spc_bootanimation.zip
elif busybox [ -e /data/local/spc_bootanimation.zip ]; then
BOOT_ANI=/data/local/spc_bootanimation.zip
elif busybox [ -e /system/media/spc_bootanimation.zip ]; then
BOOT_ANI=/system/media/spc_bootanimation.zip
elif busybox [ -e /system/customize/resource/VZW_bootanimation.zip ]; then
BOOT_ANI=/system/customize/resource/VZW_bootanimation.zip
elif busybox [ -e /data/local/VZW_bootanimation.zip ]; then
BOOT_ANI=/data/local/VZW_bootanimation.zip
elif busybox [ -e /system/media/VZW_bootanimation.zip ]; then
BOOT_ANI=/system/media/VZW_bootanimation.zip
elif busybox [ -e /system/customize/resource/hTC_bootanimation.zip ]; then
BOOT_ANI=/system/customize/resource/hTC_bootanimation.zip
elif busybox [ -e /data/local/hTC_bootanimation.zip ]; then
BOOT_ANI=/data/local/hTC_bootanimation.zip
elif busybox [ -e /system/media/hTC_bootanimation.zip ]; then
BOOT_ANI=/system/media/hTC_bootanimation.zip
else
echo "Bootanimation does not exist" >> $log
exit 1
fi
# bootanimation sound location
if busybox [ -e /system/customize/resource/android_media.mp3 ]; then
BOOT_SOUND=/system/customize/resource/android_media.mp3
elif busybox [ -e /data/local/android_media.mp3 ]; then
BOOT_SOUND=/data/local/android_media.mp3
elif busybox [ -e /system/media/android_media.mp3 ]; then
BOOT_SOUND=/system/media/android_media.mp3
elif busybox [ -e /system/customize/resource/android_audio.mp3 ]; then
BOOT_SOUND=/system/customize/resource/android_audio.mp3
elif busybox [ -e /data/local/android_audio.mp3 ]; then
BOOT_SOUND=/data/local/android_audio.mp3
elif busybox [ -e /system/media/android_audio.mp3 ]; then
BOOT_SOUND=/system/media/android_audio.mp3
elif busybox [ -e /system/customize/resource/SPC_animation_final.mp3 ]; then
BOOT_SOUND=/system/customize/resource/SPC_animation_final.mp3
elif busybox [ -e /data/local/SPC_animation_final.mp3 ]; then
BOOT_SOUND=/data/local/SPC_animation_final.mp3
elif busybox [ -e /system/media/SPC_animation_final.mp3 ]; then
BOOT_SOUND=/system/media/SPC_animation_final.mp3
else
echo "Bootanimation sound does not exist" >> $log
fi
echo "$BOOT_ANI" >> $log
echo "$BOOT_SOUND" >> $log
echo "" >> $log
# moving animation
busybox mv -f /data/local/tmp/bootanimation.zip $BOOT_ANI
if busybox [ -e /data/local/tmp/bootanimation.zip ] ; then
buxybox rm -f /data/local/tmp/bootanimation.zip
fi
if busybox [ -e $BOOT_ANI ] ; then
echo "SUCCESS! Bootanimation moved to $BOOT_ANI" >> $log
else
echo "FAILURE! Bootanimation not moved to $BOOT_ANI" >> $log
fi
echo "" >> $log
# moving busybox mv -f /data/local/tmp/bootanimation.zip $BOOT_ANI
busybox mv -f /data/local/tmp/android_audio.mp3 $BOOT_SOUND
if busybox [ -e /data/local/tmp/android_audio.mp3 ] ; then
buxybox rm -f /data/local/tmp/android_audio.mp3
fi
if busybox [ -e $BOOT_SOUND ] ; then
echo "SUCCESS! Bootanimation sound moved to $BOOT_SOUND" >> $log
else
echo "FAILURE! Bootanimation sound moved to $BOOT_SOUND" >> $log
fi
echo "" >> #log
echo "Universal Bootanimation Flasher Commencing" >> $log
Nice one Tommy.
Edit. got the error tried couple ways going into, will check back soon.
Edit2. smooth sailing...
Tekn010933 said:
Nice one Tommy.
Edit. got the error tried couple ways going into, will check back soon.
Click to expand...
Click to collapse
Fixed!
I always type https instead of http out of habbit
Thanks Tommy, I've downloaded it and stored it in my vault..haha...NEVER know when this might come in handy!!
Thanks for sharing with us!
KIOWA69 said:
Thanks for sharing with us!
Click to expand...
Click to collapse
My pleasure! It was a fun one to do.
Sent from my PC36100 using Tapatalk
tommytomatoe said:
Hello World.
Tommy here. This time I have a nifty little trick for you guys.
This took a little creative thinking but I think I got it pretty good. I was chatting with some Team Ramen Noodles guys and someone asked how an AOSP botanimaiton zip can be flashed on a Sense ROM. This was the lightbulb moment
Instructions for dev:
Download from link below.
Place the file "bootanimation.zip" inside the update.zip. I put a placeholder so you would know where to replace it.
Optionally, you can put a sound "android_audio.mp3". If you don't want it, then just leave it out. Not necessary.
When you open it up, you will see two place holder files, "bootanimaion.zip__HERE" and "android_audo.mp3__HERE". You can delete them if you want, but they don't do anything. Just for reference.
Files must be named "bootanimation.zip" and "android_audio.zip", otherwise won't work.
The script "tt_uni_boot" looks for the animation and sound in the rom, and replaces it depending on what it finds.
This works on AOSP, Sense, Sprint, HTC, and Verizion
The update.zip below is what you should use as your base if you want to make your bootanimation universal for all roms.
Also, if anyone wants to flash it as is, it contains this lovely animation:
Original Thread Here
Universal Bootanimation update.zip v0.0.1 - January 08, 2012
Enjoy!
Please report feedback. I and dean_fx tested it before I posted, but if you want different feature or something like that let me know.
Tommy
edit1.
And in case anyone wants to adapt my script, I am more than happy to share. Just give a little credit
Sharing means caring. And collaborative efforts yield better results.
Code:
#!/system/bin/bash
#tommytomatoe
#universal animation flasher
# creating logfile "lockscreen" on sdcard
log=sdcard/bootanimation.log
touch $log
# mounting system as R/W
busybox mount -o remount,rw /system
echo "/system mounted as R/W" > $log
echo "" >> $log
# doing some checks
# bootanimation locatioon
if busybox [ -e /system/customize/resource/bootanimation.zip ]; then
BOOT_ANI=/system/customize/resource/bootanimation.zip
elif busybox [ -e /data/local/bootanimation.zip ]; then
BOOT_ANI=/data/local/bootanimation.zip
elif busybox [ -e /system/media/bootanimation.zip ]; then
BOOT_ANI=/system/media/bootanimation.zip
elif busybox [ -e /system/customize/resource/spc_bootanimation.zip ]; then
BOOT_ANI=/system/customize/resource/spc_bootanimation.zip
elif busybox [ -e /data/local/spc_bootanimation.zip ]; then
BOOT_ANI=/data/local/spc_bootanimation.zip
elif busybox [ -e /system/media/spc_bootanimation.zip ]; then
BOOT_ANI=/system/media/spc_bootanimation.zip
elif busybox [ -e /system/customize/resource/VZW_bootanimation.zip ]; then
BOOT_ANI=/system/customize/resource/VZW_bootanimation.zip
elif busybox [ -e /data/local/VZW_bootanimation.zip ]; then
BOOT_ANI=/data/local/VZW_bootanimation.zip
elif busybox [ -e /system/media/VZW_bootanimation.zip ]; then
BOOT_ANI=/system/media/VZW_bootanimation.zip
elif busybox [ -e /system/customize/resource/hTC_bootanimation.zip ]; then
BOOT_ANI=/system/customize/resource/hTC_bootanimation.zip
elif busybox [ -e /data/local/hTC_bootanimation.zip ]; then
BOOT_ANI=/data/local/hTC_bootanimation.zip
elif busybox [ -e /system/media/hTC_bootanimation.zip ]; then
BOOT_ANI=/system/media/hTC_bootanimation.zip
else
echo "Bootanimation does not exist" >> $log
exit 1
fi
# bootanimation sound location
if busybox [ -e /system/customize/resource/android_media.mp3 ]; then
BOOT_SOUND=/system/customize/resource/android_media.mp3
elif busybox [ -e /data/local/android_media.mp3 ]; then
BOOT_SOUND=/data/local/android_media.mp3
elif busybox [ -e /system/media/android_media.mp3 ]; then
BOOT_SOUND=/system/media/android_media.mp3
elif busybox [ -e /system/customize/resource/android_audio.mp3 ]; then
BOOT_SOUND=/system/customize/resource/android_audio.mp3
elif busybox [ -e /data/local/android_audio.mp3 ]; then
BOOT_SOUND=/data/local/android_audio.mp3
elif busybox [ -e /system/media/android_audio.mp3 ]; then
BOOT_SOUND=/system/media/android_audio.mp3
elif busybox [ -e /system/customize/resource/SPC_animation_final.mp3 ]; then
BOOT_SOUND=/system/customize/resource/SPC_animation_final.mp3
elif busybox [ -e /data/local/SPC_animation_final.mp3 ]; then
BOOT_SOUND=/data/local/SPC_animation_final.mp3
elif busybox [ -e /system/media/SPC_animation_final.mp3 ]; then
BOOT_SOUND=/system/media/SPC_animation_final.mp3
else
echo "Bootanimation sound does not exist" >> $log
fi
echo "$BOOT_ANI" >> $log
echo "$BOOT_SOUND" >> $log
echo "" >> $log
# moving animation
busybox mv -f /data/local/tmp/bootanimation.zip $BOOT_ANI
if busybox [ -e /data/local/tmp/bootanimation.zip ] ; then
buxybox rm -f /data/local/tmp/bootanimation.zip
fi
if busybox [ -e $BOOT_ANI ] ; then
echo "SUCCESS! Bootanimation moved to $BOOT_ANI" >> $log
else
echo "FAILURE! Bootanimation not moved to $BOOT_ANI" >> $log
fi
echo "" >> $log
# moving busybox mv -f /data/local/tmp/bootanimation.zip $BOOT_ANI
busybox mv -f /data/local/tmp/android_audio.mp3 $BOOT_SOUND
if busybox [ -e /data/local/tmp/android_audio.mp3 ] ; then
buxybox rm -f /data/local/tmp/android_audio.mp3
fi
if busybox [ -e $BOOT_SOUND ] ; then
echo "SUCCESS! Bootanimation sound moved to $BOOT_SOUND" >> $log
else
echo "FAILURE! Bootanimation sound moved to $BOOT_SOUND" >> $log
fi
echo "" >> #log
echo "Universal Bootanimation Flasher Commencing" >> $log
Click to expand...
Click to collapse
I do something a little different, I take the file.from aosp, its named bootanimation.zip, rename it to spc_bootanimation.zip and place it in system/cutomize/resource. Using root explorer. I reboot, and.it works. I use the ics animation on my on my swag rom.
Sent from my PC36100 using xda premium
davidstjohn1 said:
I do something a little different, I take the file.from aosp, its named bootanimation.zip, rename it to spc_bootanimation.zip and place it in system/cutomize/resource. Using root explorer. I reboot, and.it works. I use the ics animation on my on my swag rom.
Sent from my PC36100 using xda premium
Click to expand...
Click to collapse
Yep. That is the tradition method. But now the maker of the bootanimation just needs to post one zip that works on all roms. How handy
Sent from my PC36100 using Tapatalk
If I ever post another boot animation, you better believe I'm using this! Would save a ton of random "where does this go?" questions..
Sent from my PC36100 using xda premium
This looks familiar. Hmmmmm. Lol.
Great work Tommy!
Sent from my RamenizedEvo on Cricket.
tommytomatoe said:
Yep. That is the tradition method. But now the maker of the bootanimation just needs to post one zip that works on all roms. How handy
Sent from my PC36100 using Tapatalk
Click to expand...
Click to collapse
Tommy,
You are thanked x2.
You're as busy as a cat covering up sh*t.
I've been trying to quantify your knowledge and sum it up in a few words. I finally figured it out. You, my friend, are an "idea man". Your knowledge keeps expanding because of the unique ideas you formulate when you are challenged with each new endeavor. Yet, it goes beyond just that. You have the generosity to share your ideas and solutions with the community, which encourages others to participate. The kindness and respect that you show to all members of this community is refreshing and much appreciated. Thank you for all your contributions.
Mark
First off, great concept!
However, looking through the bash script i noticed what appear to be a few bugs.
1: some typos in the comments and echoed text.
2: you check for an existing sound and set it to BOOT_SOUND but if not found the script continues without BOOT_SOUND initialised to anything.
3: you typed "buxybox" instead of "busybox" in two locations (durring the move process)
4: when replacing the animation you move the new file to BOOT_ANI, then check for and delete the temp file. Then you check if BOOT_ANI exists and report success or failure. The problem as written is that BOOT_ANI always exists, regardless if the move operation succeeded. Same problem for the sound.
I'm working on a fix for these issues and will post it later today, after i have a chance to test it.
-SLS-
SouL Shadow said:
First off, great concept!
However, looking through the bash script i noticed what appear to be a few bugs.
1: some typos in the comments and echoed text.
2: you check for an existing sound and set it to BOOT_SOUND but if not found the script continues without BOOT_SOUND initialised to anything.
3: you typed "buxybox" instead of "busybox" in two locations (durring the move process)
4: when replacing the animation you move the new file to BOOT_ANI, then check for and delete the temp file. Then you check if BOOT_ANI exists and report success or failure. The problem as written is that BOOT_ANI always exists, regardless if the move operation succeeded. Same problem for the sound.
I'm working on a fix for these issues and will post it later today, after i have a chance to test it.
-SLS-
Click to expand...
Click to collapse
Thanks for those notes I caught most of these errors directly after I made posted. But this was just a fun idea I had to help out someone.
1. Yep. lol. locatioon isn't a word.
2. Good point. Bad logic on my part. But the script works regardless. If there is no "BOOt_SOUND" then there will be nothing to move and so the script will just error out during this part. No big deal since there isn't a sound anyways...but it should be fixed regardless.
3. buxybox is also not a word. lol. This was my first typo I noticed after putting the script up. I didn't bother to go in and fix it because the command is actually redundant. In the busybox mv -f command, the file is moved from the original location. No need to "busybox rm" it, or in my case "buxybox"
4. I actually didn't think about this. I wrote the script with intent to put any bootanimation where it belongs. I put the logs in there just for testing purposes and didn't consider that the animation/sound would exist regardless of failure.
Feel free to improve the script at your convenience! That is why I posted it so other users can improve.
While these errors should be fixed, the script still works as intended Only detail oriented people will notice.
I already have an updated version prepared but I will wait for your version. I will post it up
Just got home and about to begin working on this. just wanted to note that the check for a BOOT_SOUND is important in the case where a user doesn't currently have sound and is flashing one that does include a sound. In that scenario they would end up with only the new animation and no sound.
I think i have a solution to choose a default location when no sound is currently present. Will test and report back.
-SLS-
ok, after a little work, some testing, and many many delays, my update to your original script:
http://www.soulshadow.net/android/tt_uni_boot
a few things to note:
- i left the first line unchanged, however to work on my evo running CM 7.1 i had to change the path to /system/xbin/bash. *** Also works using /system/bin/sh ***
- I added more logging
- I added more conditional checks and changed the execution order. can now be used to replace an animation, a sound, or both. depending which files are included in the zip.
- Added a "default" location if no existing animation or sound is found.
- Currently only supports single phone distribution. Meaning, each phone model still requires a different animation zip file because of display size differences. hopefully this limitation can be eliminated with planned run time discovery, creating a truly universal script.
To Do:
- check and possibly reorder the animation and sound search order.
- find out which location should be used as a default
- check permissions on installed files
- run time discovery of phone specs (manufacturer, model, rom) to aid in installation choices.
- remove or back up existing files first
- read command line arguments to change run time functionality and allow for usage from within an app
I am currently working on some of the additional features, but wanted to share what i have so far.
Enjoy!
-SLS-
SouL Shadow said:
ok, after a little work, some testing, and many many delays, my update to your original script:
http://www.soulshadow.net/android/tt_uni_boot
a few things to note:
- i left the first line unchanged, however to work on my evo running CM 7.1 i had to change the path to /system/xbin/bash. *** Also works using /system/bin/sh ***
- I added more logging
- I added more conditional checks and changed the execution order. can now be used to replace an animation, a sound, or both. depending which files are included in the zip.
- Added a "default" location if no existing animation or sound is found.
- Currently only supports single phone distribution. Meaning, each phone model still requires a different animation zip file because of display size differences. hopefully this limitation can be eliminated with planned run time discovery, creating a truly universal script.
To Do:
- check and possibly reorder the animation and sound search order.
- find out which location should be used as a default
- check permissions on installed files
- run time discovery of phone specs (manufacturer, model, rom) to aid in installation choices.
- remove or back up existing files first
- read command line arguments to change run time functionality and allow for usage from within an app
I am currently working on some of the additional features, but wanted to share what i have so far.
Enjoy!
-SLS-
Click to expand...
Click to collapse
Thanks man! Glad someone took this script and adding to it. Thank you!
Sent from my PC36100 using Tapatalk
Dead links
canievision said:
Dead links
Click to expand...
Click to collapse
Ive been meaning to re-upload. Will do in a few days.
Sent from my EVO using Tapatalk 2
Hey can i get that flashable zip? the links seem to be dead
imilleson said:
Hey can i get that flashable zip? the links seem to be dead
Click to expand...
Click to collapse
I would like this also

[MT6582][init.d Tweaks][Mix n Match]-[ALPHA version]

INTRODUCTION
I am using MTK6582 device Agua Rio (close relative of Wiko Rainbow, Explay Fresh, Blu) for 4 months now and to be honest I really enjoyed using this Android phone and so I began searching for effective init.d tweaks that will be compatible for my phone. No offense to the other developers who worked hard on building a set of tweak scripts but most of them are not compatible with my phone. It is simply because the declarations of the path is not present in my device or sometimes they are just supported by MTK6582. So I started recreating my own scripts and have been using it for weeks and works as expected.
This is still in Alpha version so I am not expecting a 360-degree change in performance but if there's one thing I can guarantee you, they are working for the devices I've mentioned above and to prove that there are log files from where you can verify if the scripts were properly executed or not.
DISCLAIMER
I will not be held liable or responsible if you brick your device after flashing this tweak. ALWAYS HAVE YOUR BACKUP READY!
FLASH AT YOUR OWN RISK!!!
FEATURES
- Battery Tweaks (a lot of things going on here like battery re-calibration which will be done every 7 days, centisecs flushing interval, WiFi Sleep from Gaurav, Entropy tweak for battery, pm.sleep_mode)
- updated Loopysmoothness for MTK (I modified the declaration of variables so that the script can be a little more flexible - Credits to [email protected])
- VM Tweaks (experimental - modified scripts to work for MTK6582 credits to [email protected] and [email protected] of Fly-on)
- GPU Rendering (Enable GPU rendering for 2D operations)
- DHCPd script to clean the DHCP leases before starting
- SDboost - (modded script to work with MTK - credits to [email protected] of Fly-on and V6 Supercharger - SD Card read-ahead cache to 2048 KB)
- IOTweaks for responsiveness
- Network tweaks - (my own mix with a touch of [email protected] network tweaks)
- Zipalign - (modded script that will zipalign any new apps in /system/app, /system/framework, /data/app every reboot)
11-DEC-2014 ALPHA 3B UPDATES
- Remount - to make your device more responsive
- zRAM - utlizing ZRAM to increase performance - http://forum.xda-developers.com/showthread.php?t=2320734
- LagBuster - Credits to [email protected] for giving me an idea to incorporate RNGD Entropy
- Props - Adding more useful prop parameters
- Looping scripts (stored in /data/Tweaks/scripts)
-- Lagfix - will run every 60min and will execute fstrim Due to bad effects in the long run I have removed this (ref: http://man7.org/linux/man-pages/man8/fstrim.8.html)
-- Defrag - will run every 12hours to execute VACUUM and REINDEX to optimize the database - credits to [email protected] of Fly-on
-- CPU Hotplug - another battery tweak which I have modified which will run specific set of hotplug depending on the needs of your device and also depending on the current capacity of your battery. Credits to [email protected]
-- Xposed Log cleaner - this is one of the scripts I initially released to temporarily fix the logging problem of the latest Xposed Installer. If you don't have the app, the script will exit - http://forum.xda-developers.com/showpost.php?p=56439074
- Added host file to block annoying phishing and ad-serving websites
- Added resolv.conf to use Google's public DNS for faster browsing
11-DEC-2014 ALPHA 3B UPDATES
- lowmemorykiller - Another rotational script that will check and update your lowmemorykiller parameters - Won't really add much value since LMK resets its value from time to time.. Thanks again bro @kermage !
- 3G Booster - I have now added in the flashable installer the 3G hack from [email protected]
- Added an uninstaller in case you don't like the tweaks. Thank you for using.
WHAT'S INSIDE
/system/etc/init.d/
- 01_BattTweaks
- 02_LoopySmoothness
- 03_VMTweaks
- 04_GPURender
- 05_DHCPD
- 06_SDBoost
- 07_IOTweaks
- 10_DONOTDELETE
- 11_Network
- 13_EXT4Remount
- 14_Zram
- 16_LagBuster
- 17_SetProps
- 51_Zipalign
/system/etc/
- hosts
- resolv.conf
/system/xbin/
- bash
- busybox
- rngd
- sqlite3
- zip
- zipalign
/data/Tweaks/scripts
- 08_LagFix.sh
- 09_Defrag.sh
- 12_CPUHotplug.sh
- 15_Mem_Tweaks
- 50_XposedCleanLog.sh
/data/Tweaks/logs
*** All logs from init.d scripts and rotational scripts (/data/Tweaks/scripts)
Click to expand...
Click to collapse
REQUIREMENTS
1. Rooted
2. Busybox
3. Kernel with init.d support
4. Custom recovery tool (CWMR, TWRP, Philz, CarlivTouch)
5. Presence of mind
6. Faith!
HOW TO INSTALL
1. Download the flashable zip file and save it to your SDcard (remember where you saved it)
2. Power off your phone
3. Press Power + Vol UP + Vol DOWN simultaneously
4. Choose Recovery mode
5. Select install from SDcard
6. Install the zip file
7. Wait until the installation is completed.
8. Reboot!
To manually Push the tweak
1. Download the zip file into your SDcard
2. Extract the files
3. Copy all the contents of init.d to your /system/etc/init.d
4. Change the permission to rwxr-xr-x or rwxrwxrwx
5. Copy all the content of net to /system/etc
6. Change the permission of "hosts" and "resolv.conf" to rw-rw-rw
7. Go to /data and add a new folder named "Tweaks"
8. Go to /data/Tweaks and add new 2 folders - "scripts" and "logs"
9. Copy all the contents from "scripts" (from the zip file) to /data/Tweaks/scripts
10. Change the permissions of all the files in /data/Tweaks/scripts to rwxr-xr-x or rwxrwxrwx
11. Reboot.
HOW TO VERIFY
With the use of Root Explorer or ES Explorer, go to /data/Tweaks/logs and you will see the log files generated by the scripts. Also if you have a Terminal Emulator, you can check that the rotational scripts are running in the background.
Oh by the way, sorry to disappoint the Antutu lovers but the scripts were not customized to satisfy your eyes with Antutu scores.
To manually Delete the Tweaks
1. Delete all the files mentioned above from your phone using Root Explorer (or any file manager like ES explorer)
2. You can leave the files added in /system/xbin/ as it may help you in the future... 'just a suggestion but you can delete it if you want.
FAQs
Q: Not working. How can I tell the scripts were actually working?
A: Check the logs stored in /data/Tweaks/logs and inspect if there are log files. And with the use of any text editor check one by one the log files for any errors.
Q: There are no files in /data/Tweaks/logs, what happened?
A: It is possible that your ROM does not have init.d support. You can try using [email protected]'s fix for that (http://forum.xda-developers.com/showthread.php?t=1933849). Then you can try using again the tweak
Q: After flashing the tweaks, I cannot connect to my VPN app like Psiphon. How to fix this?
A: To be honest, I am unsure yet why but you can try either the following:
1. Check again the permission of /system/etc/hosts, /system/etc/resolv.conf and make sure they are set to rw-rw-rw. Then reboot;
2. OR, move/delete /system/etc/init.d/11_Network, /system/etc/hosts, /system/etc/resolv.conf then reboot
Q: My Internet connection is slow.
A: You can try adding the 3G hack from [email protected] (http://forum.xda-developers.com/showpost.php?p=42185612&postcount=100)
Q: The tweak is actually useless, it is not working. Should this be the case?
A: If I was not able to help you in any way, thanks for testing and feedback. Google is our friend.
Thank you all!
Mix n Match ALPHA 3B is now available
CHANGES 11-DEC-2014:
Please refer to the notes above. for the updates .
The INSTALLER will backup your previous tweaks and any conflicting files with Mix n Match. I have also added now an UNINSTALLER in case you are not satisfied. The UNINSTALLER will revert all the changes made before you flashed the latest tweaks.
Again... Flash at your own risk!
Thank you very much​
great job man.. :good:
what version of rio you're using?
mines s5501 and running on kitkat deodexed by edmhar, is your tweaks compatible with edmhar's deodexed stock rom?
Good, i'll write governer tweaks for hotplug and post link here, i'll make different versions for more battery and more responsiveness
Agua Rio
cheeze.keyk said:
great job man.. :good:
what version of rio you're using?
mines s5501 and running on kitkat deodexed by edmhar, is your tweaks compatible with edmhar's deodexed stock rom?
Click to expand...
Click to collapse
I am using Agua Rio V2
COOL!
umangleekha said:
Good, i'll write governer tweaks for hotplug and post link here, i'll make different versions for more battery and more responsiveness
Click to expand...
Click to collapse
Cool! And good JOB as well
updated the hotplug
umangleekha said:
Good, i'll write governer tweaks for hotplug and post link here, i'll make different versions for more battery and more responsiveness
Click to expand...
Click to collapse
Hey Bro, in this release I have modified your CPU hotplug and this is a rotational shell script
Code:
#!/system/bin/sh
# Name: 12_CPUHotplug.sh
# Date: 11/03/2014
# Author: Arsie Organo Jr. - [email protected]
# Link:
# About: This is additional tweaking for MT6582 devices
# to improve battery life
# You will need your device to be:
# 1. Rooted
# 2. Busybox is installed.
# 3. hotplug
# Credits: Fly-On, Medusa, and Umang Leekha hotplug
####################################################
# START
# Logging
datalog=/data/Tweaks/logs/12_CPUHotplug.log
# Check if your device supports Hotplug
HOTPLUG=/sys/devices/system/cpu/cpufreq/hotplug
if [ -d $HOTPLUG ] ; then
echo "This device supports hotplug." | tee -a $datalog;
else
echo "No hotplug support for this device. Exiting script now!" | tee -a $datalog;
exit 0
fi;
# If device is awake, it will check current battery level and also the %usr level of the CPU (all)
a=1
sleepme=10
while [ $a -ge 0 ]
do
busybox rm -f $datalog
busybox touch $datalog
BATTSTAT=`cat /sys/class/power_supply/battery/capacity`
MAXLVL=100
USRLVL=`busybox mpstat -P ALL | grep all | awk '{print $3}'`
USRLVL=${USRLVL%.*}
GAUGE=60
ANTUTU=`ps | grep com.antutu | wc -l`
ANTUTUUSE=`busybox top -b -n10 -d3 | grep com.antutu.ABenchMark | cut -c42-45 | awk '{sum+=$0}END{print sum*10}'`
if [ $ANTUTUUSE -gt 10 ] ; then
echo "Antutu Benchmark is still running. Unable to switch to Level 5 hotplug." | tee -a $datalog;
else
killall -9 com.antutu.ABenchMark
fi;
chmod 644 /sys/devices/system/cpu/cpufreq/hotplug/*
if [ $ANTUTU -gt 0 ] ; then
echo "Level Antutu Hotplug (Pro Performance) will be applied due to Antutu - $( date +"%m-%d-%Y %H:%M:%S" )" | tee -a $datalog;
echo "Battery Level: $BATTSTAT | MPSTAT Level: $USRLVL" | tee -a $datalog;
echo 85 > /sys/devices/system/cpu/cpufreq/hotplug/up_threshold;
echo 90 > /sys/devices/system/cpu/cpufreq/hotplug/cpu_up_threshold;
echo 50000 > /sys/devices/system/cpu/cpufreq/hotplug/sampling_rate;
echo 10 > /sys/devices/system/cpu/cpufreq/hotplug/cpu_down_differential;
echo 15 > /sys/devices/system/cpu/cpufreq/hotplug/down_differential;
echo 0 > /sys/devices/system/cpu/cpufreq/hotplug/powersave_bias;
echo 50000 > /sys/devices/system/cpu/cpufreq/hotplug/sampling_rate_min;
echo 4 > /sys/devices/system/cpu/cpufreq/hotplug/cpu_num_limit;
echo "up_threshold: $( cat /sys/devices/system/cpu/cpufreq/hotplug/up_threshold )" | tee -a $datalog;
echo "cpu_up_threshold: $( cat /sys/devices/system/cpu/cpufreq/hotplug/cpu_up_threshold )" | tee -a $datalog;
echo "sampling_rate: $( cat /sys/devices/system/cpu/cpufreq/hotplug/sampling_rate )" | tee -a $datalog;
echo "cpu_down_differential: $( cat /sys/devices/system/cpu/cpufreq/hotplug/cpu_down_differential )" | tee -a $datalog;
echo "powersave_bias: $( cat /sys/devices/system/cpu/cpufreq/hotplug/powersave_bias )" | tee -a $datalog;
echo "sampling_rate_min: $( cat /sys/devices/system/cpu/cpufreq/hotplug/sampling_rate_min )" | tee -a $datalog;
echo "cpu_num_limit: $( cat /sys/devices/system/cpu/cpufreq/hotplug/cpu_num_limit )" | tee -a $datalog;
echo "===== COMPLETED - $( date +"%m-%d-%Y %H:%M:%S" ) =====" | tee -a $datalog;
elif [ $USRLVL -lt $GAUGE ] || [ $BATTSTAT -lt $GAUGE ]; then
echo "Level 5 Hotplug (Battery Saver) will be applied - $( date +"%m-%d-%Y %H:%M:%S" )" | tee -a $datalog;
echo "Battery Level: $BATTSTAT | MPSTAT Level: $USRLVL" | tee -a $datalog;
echo 95 > /sys/devices/system/cpu/cpufreq/hotplug/up_threshold;
echo 95 > /sys/devices/system/cpu/cpufreq/hotplug/cpu_up_threshold;
echo 40000 > /sys/devices/system/cpu/cpufreq/hotplug/sampling_rate;
echo 1 > /sys/devices/system/cpu/cpufreq/hotplug/cpu_down_differential;
echo 1 > /sys/devices/system/cpu/cpufreq/hotplug/down_differential;
echo 100 > /sys/devices/system/cpu/cpufreq/hotplug/powersave_bias;
echo 40000 > /sys/devices/system/cpu/cpufreq/hotplug/sampling_rate_min;
echo 2 > /sys/devices/system/cpu/cpufreq/hotplug/cpu_num_limit;
echo "up_threshold: $( cat /sys/devices/system/cpu/cpufreq/hotplug/up_threshold )" | tee -a $datalog;
echo "cpu_up_threshold: $( cat /sys/devices/system/cpu/cpufreq/hotplug/cpu_up_threshold )" | tee -a $datalog;
echo "sampling_rate: $( cat /sys/devices/system/cpu/cpufreq/hotplug/sampling_rate )" | tee -a $datalog;
echo "cpu_down_differential: $( cat /sys/devices/system/cpu/cpufreq/hotplug/cpu_down_differential )" | tee -a $datalog;
echo "powersave_bias: $( cat /sys/devices/system/cpu/cpufreq/hotplug/powersave_bias )" | tee -a $datalog;
echo "sampling_rate_min: $( cat /sys/devices/system/cpu/cpufreq/hotplug/sampling_rate_min )" | tee -a $datalog;
echo "cpu_num_limit: $( cat /sys/devices/system/cpu/cpufreq/hotplug/cpu_num_limit )" | tee -a $datalog;
echo "===== COMPLETED - $( date +"%m-%d-%Y %H:%M:%S" ) =====" | tee -a $datalog;
elif [ $USRLVL -ge $GAUGE ] && [ $BATTSTAT -ge $GAUGE ] ; then
echo "Level 0 Hotplug (Pro Performance) will be applied - $( date +"%m-%d-%Y %H:%M:%S" )" | tee -a $datalog;
echo "Battery Level: $BATTSTAT | MPSTAT Level: $USRLVL" | tee -a $datalog;
echo 85 > /sys/devices/system/cpu/cpufreq/hotplug/up_threshold;
echo 85 > /sys/devices/system/cpu/cpufreq/hotplug/cpu_up_threshold;
echo 30000 > /sys/devices/system/cpu/cpufreq/hotplug/sampling_rate;
echo 15 > /sys/devices/system/cpu/cpufreq/hotplug/cpu_down_differential;
echo 15 > /sys/devices/system/cpu/cpufreq/hotplug/down_differential;
echo 0 > /sys/devices/system/cpu/cpufreq/hotplug/powersave_bias;
echo 30000 > /sys/devices/system/cpu/cpufreq/hotplug/sampling_rate_min;
echo 4 > /sys/devices/system/cpu/cpufreq/hotplug/cpu_num_limit;
echo "up_threshold: $( cat /sys/devices/system/cpu/cpufreq/hotplug/up_threshold )" | tee -a $datalog;
echo "cpu_up_threshold: $( cat /sys/devices/system/cpu/cpufreq/hotplug/cpu_up_threshold )" | tee -a $datalog;
echo "sampling_rate: $( cat /sys/devices/system/cpu/cpufreq/hotplug/sampling_rate )" | tee -a $datalog;
echo "cpu_down_differential: $( cat /sys/devices/system/cpu/cpufreq/hotplug/cpu_down_differential )" | tee -a $datalog;
echo "powersave_bias: $( cat /sys/devices/system/cpu/cpufreq/hotplug/powersave_bias )" | tee -a $datalog;
echo "sampling_rate_min: $( cat /sys/devices/system/cpu/cpufreq/hotplug/sampling_rate_min )" | tee -a $datalog;
echo "cpu_num_limit: $( cat /sys/devices/system/cpu/cpufreq/hotplug/cpu_num_limit )" | tee -a $datalog;
echo "===== COMPLETED - $( date +"%m-%d-%Y %H:%M:%S" ) =====" | tee -a $datalog;
fi;
sleep $sleepme
done
# END
Too interested in !
But I have to ask you how to uninstall if we did not use your special one, because of I have a sad experience before...
Good question, I always make sure that anything I install I create a document or uninstaller.. however, I was too busy at work and wanted to share this to my FB friends so I published it as Alpha version and wanted to get their feedback.
Give me a few minutes and I will update the doc on how to uninstall.
Hi dhampire,
I have updated the docs for you.. in the next release I will make an backup and uninstaller so that if someone does not want this tweaks they can go back from their previous set.
Good Job ser!
Next custom rom
LOL!
petiksmode said:
Next custom rom
Click to expand...
Click to collapse
hopefully I'd be able to cook one
Will this work on leagoo lead 3? mt6582, 512m of ram
init.d support
birdsilver said:
Will this work on leagoo lead 3? mt6582, 512m of ram
Click to expand...
Click to collapse
Please wait on my next release within this week and try on your phone. But please check first if your device supports init.d.
eyesfortech said:
Please wait on my next release within this week and try on your phone. But please check first if your device supports init.d.
Click to expand...
Click to collapse
Thank you very much for your response, I'll wait. I activated init.d thanks to Ryuinferno, via the terminal support.
:good:
The main page has been updated.. check out what's new
I have re-uploaded the MixnMatch_ALPHA_3b_Installer.zip installer today (12Dec2014) to fix the Bluetooth on/off bug.
Sorry for the inconvenience guys. It should be OK now.
Thanks your job! I'm trying now.
Hi.
Thanks your job! I'm trying now.
In my device, your log said that these scripts did not work.
- 09_Defrag.sh
- 12_CPUHotplug.sh
My device Lenovo s930 (MT6582) dual sim / Kitkat 4.4.2
Regards.
Problem (Sound)
Hi. I have a report for you master.
Sound problem.
1. Telephone.
In my case, I can't hear a voice (1st call), after hang up, I can hear a voice on 2nd call with big voice.
2. Alarm
I can't hear a sound.
Common is sound problem.
Regards.
Logs
dhampire said:
Hi.
Thanks your job! I'm trying now.
In my device, your log said that these scripts did not work.
- 09_Defrag.sh
- 12_CPUHotplug.sh
My device Lenovo s930 (MT6582) dual sim / Kitkat 4.4.2
Regards.
Click to expand...
Click to collapse
Can you send me the logs from /data/Tweaks/logs ?
Or please let me know if you are familiar with ADB Shell so that I can give you the commands to check.
Thanks.
17_SetProps
dhampire said:
Hi.
Thanks your job! I'm trying now.
In my device, your log said that these scripts did not work.
- 09_Defrag.sh
- 12_CPUHotplug.sh
My device Lenovo s930 (MT6582) dual sim / Kitkat 4.4.2
Regards.
Click to expand...
Click to collapse
dhampire said:
Hi. I have a report for you master.
Sound problem.
1. Telephone.
In my case, I can't hear a voice (1st call), after hang up, I can hear a voice on 2nd call with big voice.
2. Alarm
I can't hear a sound.
Common is sound problem.
Regards.
Click to expand...
Click to collapse
Hi,
Since we have a different device, can you delete 17_SetProps from /system/etc/init.d and then reboot?
Thanks.

[Q] Logcat broken - adb works

Hello,
i got a problem with my logcat. I get no output. I tried "adb logcat" or the app "Logcat Viewer" with root.
What i have done so far:
I installed Xposed and multirom - i also uninstalled both for testing - no changes.
I tried deleting the /dev/logs/
Some infos:
Right now i'm on 4.4.4 (CM 11.0-XNPH44S)
Kernel: 3.4.104~AK.077.OPO.CM11
What can i do? I also got another OnePlus One with the same setup and it's working flawless there...
Thanks for any help
Ok i returned to stock completly - logcat worked again.
Installed Xposed - logcat worked.
Installed Multirom - logcat broken
Any Ideas?
Maybe LogCat is disabled by default in the Kernel Configuration/Setting? Which Kernel are you using?
Edit: Okay you're using the AK Kernel, try to install Synapse and UKM there should be a option to enable CatLog and then you could read it with root...
Gesendet von meinem A0001 mit Tapatalk
Synape says: Noo UCI support detected.
some info on my init.rc (maybe the problem is there)
# initialize ak
echo "[ak kernel] initialize boot script" | tee /dev/kmsg
# disable debugging on some modules
echo "0" > /sys/module/kernel/parameters/initcall_debug;
echo "0" > /sys/module/alarm/parameters/debug_mask;
echo "0" > /sys/module/alarm_dev/parameters/debug_mask;
echo "0" > /sys/module/binder/parameters/debug_mask;
echo "0" > /sys/module/xt_qtaguid/parameters/debug_mask;
echo "[ak kernel] disable debug mask" | tee /dev/kmsg
----
if [ -e /data/local/userinit.sh ];
then
log -p i -t userinit "Executing /data/local/userinit.sh";
logwrapper /system/bin/sh /data/local/userinit.sh;
setprop cm.userinit.active 1;
fi;
if [ -d /data/local/userinit.d ];
then
logwrapper busybox run-parts /data/local/userinit.d;
setprop cm.userinit.active 1;
fi;
----
/system/xbin/daemonsu --auto-daemon &
----
Download and Flash UKM_v3.6.1.1_Special_Ed.zip from ak . hiddenbytes . org (Homepage from AK Kernel) to get Kernel Support in Synapse. Then there should be an option
Ok that kind of fixed it. I enabled "logcat" in synapse, but:
now when i reboot i get no logcat, then it takes 2-3min and i get a SuperSu notification that Synapse is granted root.
Then the whole logcat pops in. Why is that?
Isn't there a kernel (stock or stable) that supports multirom without fiddling around with such important things like logcat?

[GUIDE][TUT] Learn basic scripting, how to execute scripts, mod building

Hello guys, I want to share my expirience with users who wants to learn basic scripting stuff, busybox commands, how to use them, how to execute them, how to make .sh files.
Ok, let's start!!! ​
First we must to learn what is busybox. BusyBox is software that provides several stripped-down Unix tools in a single executable file. It runs in a variety of POSIX environments such as Linux, Android.
Busybox allows you or programs to perform actions on your phone using Linux (copied from Unix) commands. Android is basically a specialized Linux OS with a Java compatible (Dalvik) machine for running programs. The Android kernel is a modified version of the Linux kernel (that is why the Android kernel must always be open source). Busybox gives functionality to your phone that it does not have without it. Many programs, especially root programs such as Titanium Backup, require busybox to perform the functions of the program. Without busybox installed your phone is much more limited in what it can do.
{
"lightbox_close": "Close",
"lightbox_next": "Next",
"lightbox_previous": "Previous",
"lightbox_error": "The requested content cannot be loaded. Please try again later.",
"lightbox_start_slideshow": "Start slideshow",
"lightbox_stop_slideshow": "Stop slideshow",
"lightbox_full_screen": "Full screen",
"lightbox_thumbnails": "Thumbnails",
"lightbox_download": "Download",
"lightbox_share": "Share",
"lightbox_zoom": "Zoom",
"lightbox_new_window": "New window",
"lightbox_toggle_sidebar": "Toggle sidebar"
}
Here is some info about busybox, you can track here release dates, you can download sources...
http://spblinux.de/2.0/doc/commands.html
Also here is busybox installer for our "linux devices" heheh ^~^ by stericson. You have two versions of it as you see paid and free.
Chose paid if you want to donate him for awesome job.
Free:
https://play.google.com/store/apps/details?id=stericson.busybox
Paid(PRO):
https://play.google.com/store/apps/details?id=stericson.busybox.donate
After that you need Terminal app, you can download it from playstore too.
Link: Download it from here
This app emulates Linux terminal, with it you can access to android shell.
Lets's start with learning basic terminal stuff
The most of shell commands doesn't need root access, but some of them are need it.
To give root access to the terminal app, you need to type next.
Code:
su [I](press enter)[/I]
After pressing enter, another window will popup to grant root access. Tap on GRANT
***When you typing something into the terminal window, take care because EVERYTHING IS CASE SENSITIVE.***
We all know there are three permissions per group on a file read,write,execute or rwx.
To set permissions as rw-r--r-- we use chmod 644 or 0644 but most don't know why ? Here's why
Read or r has a positional weight of 4, Write or w has 2 and Execute or x has 1. Add them up for each group and you'll get the chmod number to use. For above example, the numbers will be (4+2)(4)(4) i.e. 644 or if you want four digits, use 0644 and that's pretty much it. It comes in very handy if you're learning shell scripting because Linux revolves around permissions. (Thanks to @MSF Jarvis)
Let's go trough basic shell commands. ​
If you interested about all commands, you can check them HERE.
cat [file destination] - use this command to print everything from a file to the terminal window
Example:
Open terminal window, and type next:
Code:
busybox cat /proc/meminfo [I](press enter)[/I]
You will get output after pressing enter
Now, you can see here, if you open any file manager and go to destination which was given for example "/proc/meminfo"
You will see next file and stuff inside it
Heheh, is it same?? ^~^ for sure that it is, you can use it for any file on your device which have text in it.
Let's go to the next basic command ^~^
echo - this command can be used for printing arguments to stdout. Also you can use it for adding text in already existing file which we need here, because we are learning scripting stuff, right? ^~^
Example:
Open terminal window, and type next:
Code:
busybox echo "Scripting is awesome" > /sdcard/test [I](press enter)[/I]
Ok, let's explain this.
First you added a command echo to add something in existing file, then between "..." we need to put arguments, for our case this is "Scripting is awesome" next we see symbol " > " which will forward arguments to next added direction, in our case this is "/sdcard/test".
First we need to have a existing file (IMPORTANT)
After we agreed with that we have a file
Open terminal as I already explained and after pressing enter you will get output on the terminal window.
That is a file from our /sdcard/
Don't delete this file, we will use it later with " sh" command.
Let's go to the next basic command
clear - Use this comand to clear whole terminal window.
Example:
You have a terminal window which have a lot of stuff on it, for example stuff from previous lines, text, etc.
You can simply make it blank with just one command
Code:
busybox clear [I](then press enter)[/I]
And voila, terminal window is blank
touch [file destination] - Use this command to create a blank file on any destination on your android device.
Example:
Open terminal window, and type next:
Code:
busybox touch /sdcard/scripting_007 [I](press enter)[/I]
This will create file called "scripting_007" on "/sdcard/" in this case, you can put any.
As you can see file "scripting_007" exist on /sdcard/
mkdir [file destination] - Use this command to create one empty folder on any destination on your android device.
Example:
Open terminal window, and type next:
Code:
busybox mkdir /sdcard/development [I](press enter)[/I]
This will create folder called "development" on "/sdcard/" in this case, you can put any.
sh [path of a file] - Use this command to execute basic script
Example:
Open terminal window, and type next:
Code:
sh /sdcard/test [I](press enter)[/I]
This will execute file which you make before with "echo" command
sleep [time in secs] - Use this command to make an offset between executing lines inside script.
Example:
Open terminal window, and type next:
Code:
busybox echo "Scripting is"
busybox sleep 10
busybox echo "awesome"
This is a combination of two commands as you can see, echo and sleep.
After launching this simple script in terminal window you will get first "Scripting is" and after 10 secs you will get awesome.
rm [ -f (file) -rf (folder)] - this is a command for removing files (-f) and folders (-rf)
Example:
Create a file called "android" on sdcard, then open terminal window, and type next:
Code:
busybox rm -f /sdcard/android
This simple code will remove a file called android from sdcard.
Now do the same thing with a folder, create one with the name "android" and run terminal emulator
Code:
busybox rm -rf /sdcard/android
This will remove folder called android from your sdcard.
Now, let's go with some advanced stuff​
You need any text editor, I suggesting this one
Link: Download from here
Now, open the app and write a new file and give it a name "test1"
Inside a file write next text:
Code:
busybox echo "Android"
busybox sleep 2
busybox echo "is"
busybox sleep 2
busybox echo "Awesome"
Save the file and copy it to some location, i suggest /sdcard/.
Open up terminal emulator and type next
Code:
sh /sdcard/test1 [I](press enter)[/I]
This thing will execute your script with the name test1 from /sdcard/.
Output will be "Android", then after two seconds will appear "is" and then after two more seconds "Awesome" will appear. THATS IT!!! You learned how to make a file (script) and how to execute it with terminal emulator.
Now do the same thing make a file with the name "test2" and make another file with a name "print"
First open "test1" and write next:
Code:
busybox echo "After 5 seconds"
busybox sleep 1
busybox echo "You will get a suprice"
busybox sleep 2
busybox clear
busybox echo "1"
busybox sleep 1
busybox clear
busubox echo "2"
busybox sleep 1
busybox clear
busybox echo "3"
busybox sleep 1
busybox clear
busybox echo "4"
busybox sleep 1
busybox clear
busybox echo "5"
busybox sleep 1
busybox clear
sh /sdcard/print
I think that you already know whats happened here
You have print, then you have sleep to make offset, and after that you have clear command to make window blank
Now open file with the name "print"
Inside it write next:
Code:
busybox echo "Voila, suprise"
Save this file, and open terminal emulator, and write next:
Code:
sh /sdcard/test2
And magic happens
In this example you learned how to execute second file with first, I think that it's not difficult for you
In this example we will play a bit with colors outputs
Codes for colors are below
Code:
busybox echo -e " 1. Black \e[0;100m \e[00;37;40m"
busybox echo -e " 2. Red \e[0;101m \e[00;37;40m"
busybox echo -e " 3. Green \e[0;102m \e[00;37;40m"
busybox echo -e " 4. Yellow \e[0;103m \e[00;37;40m"
busybox echo -e " 5. Blue \e[0;104m \e[00;37;40m"
busybox echo -e " 6. Purple \e[0;105m \e[00;37;40m"
busybox echo -e " 7. Cyan \e[0;106m \e[00;37;40m"
busybox echo -e " 8. White \e[0;107m \e[00;37;40m"
Try to copy this into terminal window and see what will happened or try whing which you learned before with the executing files. Copy whole code to a file and execute it with "sh" command. USE YOUR KNOWLEDGE.
Here you can see all things based on bash script coloring
https://wiki.archlinux.org/index.php/Color_Bash_Prompt
or
http://misc.flogisoft.com/bash/tip_colors_and_formatting
Here you can see all codes and it's nice descirbed.
Now, let's start
Make a file with the name "test3" open it and write or copy next code inside:
Code:
busybox echo " .... "
busybox echo " / / "
busybox echo " / / "
busybox echo " / / "
busybox echo " / /_._._. "
busybox echo -e " /_._._._._./ \e[00;41m SPEED MOD \e[00;37;40m v3.0"
busybox echo "*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*"
busybox echo -e "\e[01;32m Feel smoothness \e[00;37m"
busybox echo " "
As you can see this part was taken from mine L Speed performance/battery mod
Save the file, open terminal and type inside
Code:
sh /sdcard/test3
And you will get the same screen like in first L Speed menu.
Let's play a bit with this
You see the code
Code:
\e[00;41m SPEED MOD \e[00;37;40m v3.0
Just change one number instead of 41 write 42 and you will get green color, then give a try to other nubers. Every number is another color for example:
Code:
# Reset
Color_Off='\e[0m' # Text Reset
# Regular Colors
Black='\e[0;30m' # Black
Red='\e[0;31m' # Red
Green='\e[0;32m' # Green
Yellow='\e[0;33m' # Yellow
Blue='\e[0;34m' # Blue
Purple='\e[0;35m' # Purple
Cyan='\e[0;36m' # Cyan
White='\e[0;37m' # White
# Bold
BBlack='\e[1;30m' # Black
BRed='\e[1;31m' # Red
BGreen='\e[1;32m' # Green
BYellow='\e[1;33m' # Yellow
BBlue='\e[1;34m' # Blue
BPurple='\e[1;35m' # Purple
BCyan='\e[1;36m' # Cyan
BWhite='\e[1;37m' # White
# Underline
UBlack='\e[4;30m' # Black
URed='\e[4;31m' # Red
UGreen='\e[4;32m' # Green
UYellow='\e[4;33m' # Yellow
UBlue='\e[4;34m' # Blue
UPurple='\e[4;35m' # Purple
UCyan='\e[4;36m' # Cyan
UWhite='\e[4;37m' # White
# Background
On_Black='\e[40m' # Black
On_Red='\e[41m' # Red
On_Green='\e[42m' # Green
On_Yellow='\e[43m' # Yellow
On_Blue='\e[44m' # Blue
On_Purple='\e[45m' # Purple
On_Cyan='\e[46m' # Cyan
On_White='\e[47m' # White
# High Intensity
IBlack='\e[0;90m' # Black
IRed='\e[0;91m' # Red
IGreen='\e[0;92m' # Green
IYellow='\e[0;93m' # Yellow
IBlue='\e[0;94m' # Blue
IPurple='\e[0;95m' # Purple
ICyan='\e[0;96m' # Cyan
IWhite='\e[0;97m' # White
# Bold High Intensity
BIBlack='\e[1;90m' # Black
BIRed='\e[1;91m' # Red
BIGreen='\e[1;92m' # Green
BIYellow='\e[1;93m' # Yellow
BIBlue='\e[1;94m' # Blue
BIPurple='\e[1;95m' # Purple
BICyan='\e[1;96m' # Cyan
BIWhite='\e[1;97m' # White
# High Intensity backgrounds
On_IBlack='\e[0;100m' # Black
On_IRed='\e[0;101m' # Red
On_IGreen='\e[0;102m' # Green
On_IYellow='\e[0;103m' # Yellow
On_IBlue='\e[0;104m' # Blue
On_IPurple='\e[0;105m' # Purple
On_ICyan='\e[0;106m' # Cyan
On_IWhite='\e[0;107m' # White
On the next phase we will learn how to use variables, in bash scripts this is simple, just add a simple "tag" then what you want to connext wit this tag.
Here is an example:
Code:
file=/sdcard/test4
busybox touch $file
Ok, here is one simple thing, this is same like in touch command explaining, but there is a little difference. We added variable or you can call it shortcut if it's easier for you.
To call variable somewhere in a file you need to use a dollar sign "$" then name of your variable. Let's to next examole with variables.
As we now have file called test4 on our SD, we can go trough.
Code:
file=/sdcard/test4
busybox echo "hey file" > $file
As you can see everything is repeating from previous examples just with variable. This is much easier, and you will save a bit of time.
Now we can see what is inside file Open terminal emulator and type next
Code:
busybox cat /sdcard/test4
And you will get output "hey file"
Simple isn't it?
In this part we will learn how to use if, elif, else It's pretty simple, let's start.
Pattern for this will be:
Code:
if [what]; then
do something
fi
if [what]; then
do something
elif [what if not "if"]
do something
else
what to do else
fi
Ok what we have here?
The first part of code show us simple code which mean if for example something is true then do something and then close if with fi.
Second part of code is a bit "complicated". If somethig is true then do something, then we have elif, in case that if is false then it will do what is under elif. In case that both of them are false, everything what is under else will be executed.
Ok here is an example:
Code:
if [ -e /sdcard/test5 ]; then
busybox echo "hello" > /sdcard/test5
else
busybox touch /sdcard/test5
busybox echo "hello" > /sdcard/test5
fi
Ok, if file test 5 exists add hello to it, else(if not) then create a file and add text hello in it.
Another example with a bit of complications heheh
Code:
if [ -e /sdcard/test5 ]; then
busybox echo "file 5 exists"
elif [ -e /sdcard/test6 ]; then
busybox echo "file 6 exists"
else
busybox echo "files are not exist"
fi
Ok, here is explanation, if test5 exist then print "file 5 exists" going to the next line, if file test6 exist pri t "file 6 exists" and else if both of them doesn't exist print "files are not exist".
Donation:
http://forum.xda-developers.com/donatetome.php?u=5514152
Everyone who knows a bit of the performance/battery mods wants sometime to learn what is inside and how it's working
Here is a guide by @Paget96 (me) ^~^
As we know for every mod we need root, this is needed because we must to access to android shell.
init.d support, that is a folder which launch files from it on every boot. Init.d is included on some ROM's by default, but on some you need yo enable it by default(I will explain later how).
Next thing what you need is for sure busybox. And a little bit of free space on the /system partition.
Everyone knows how to root, I don't need to explain how to do that right?
User who doesn't have init.d will make it with next steps.
1. Flash superSU by @Chainfire (IMPORTANT)
2. In /system/etc/ make a file with the name "install-recovery-2.sh and push next code in it
Code:
#!/system/bin/sh
/system/bin/sysinit
3. Inside system/bin make a file with the name " sysinit" and push next code in it
Code:
#!/system/bin/sh
busybox sleep 30
export PATH=/sbin:/system/sbin:/system/bin:/system/xbin
run-parts /system/etc/init.d
4. Open /system/etc and make folder with the name "init.d"
Now you need to set permissions for all of this files.
Open terminal emulator and do next:
Code:
su
This will give root access
Code:
busybox chmod 755 /system/etc/install-recovery-2.sh
busybox chown 0.2000 /system/etc/install-recovery-2.sh
With this you will set "executable" permissions.
And we need permission for sysinit
Code:
busybox chmod 755 /system/bin/sysinit
busybox chown 0.2000 /system/bin/sysinit
And that's it
To install busybox use app "busybox installer" by stericson from playstore.
***IMPORTANT*** Don't change too much things, because you will get crap in your hands
Tools which are needed is
Text editor, I suggest Turbo Editor
Terminal emulator
ES file explorer
Ok, let's start
We will start with virtual memory tweaking...
Open file manager and create one folder where you will build a mod.
Inside it we will create one file for beginning and call it "00sysmod"
Code:
#!/system/bin/sh
busybox chmod 644 /proc/sys/vm/*
busybox sysctl -e -w vm.dirty_background_ratio=3
busybox sysctl -e -w vm.dirty_ratio=15
busybox sysctl -e -w vm.swappiness=40
busybox sysctl -e -w vm.dirty_expire_centisecs=500
busybox sysctl -e -w vm.dirty_writeback_centisecs=3000
busybox sysctl -e -w vm.min_free_kbytes=4096
busybox sysctl -e -w vm.overcommit_memory=1
busybox sysctl -e -w vm.overcommit_ratio=75
busybox sysctl -e -w vm.page-cluster=0
busybox sysctl -e -w vm.panic_on_oom=0
Copy this inside file, save it and copy to init.d folder
After that set permissions to 755
Code:
busybox chmod 755 /system/etc/init.d/00sysmod
Let's explain every line:
First line is a header of every script.
Next line will change permissions (in this case read, write, read, read) of a files which are inside /proc/sys/vm/*. * means every file.
Everything below it are vm parameters.
vm.dirty_background_ratio
Contains, as a percentage of total available memory that contains free pages
and reclaimable pages, the number of pages at which the background kernel
flusher threads will start writing out dirty data.
The total avaiable memory is not equal to total system memory.
dirty_ratio
Contains, as a percentage of total available memory that contains free pages
and reclaimable pages, the number of pages at which a process which is
generating disk writes will itself start writing out dirty data.
The total avaiable memory is not equal to total system memory.
swappiness
This control is used to define how aggressive the kernel will swap
memory pages. Higher values will increase agressiveness, lower values
decrease the amount of swap. A value of 0 instructs the kernel not to
initiate swap until the amount of free and file-backed pages is less
than the high water mark in a zone.
The default value is 60.
dirty_expire_centisecs
This tunable is used to define when dirty data is old enough to be eligible
for writeout by the kernel flusher threads. It is expressed in 100'ths
of a second. Data which has been dirty in-memory for longer than this
interval will be written out next time a flusher thread wakes up.
dirty_writeback_centisecs
The kernel flusher threads will periodically wake up and write `old' data
out to disk. This tunable expresses the interval between those wakeups, in
100'ths of a second.
Setting this to zero disables periodic writeback altogether.
min_free_kbytes
This is used to force the Linux VM to keep a minimum number
of kilobytes free. The VM uses this number to compute a
watermark[WMARK_MIN] value for each lowmem zone in the system.
Each lowmem zone gets a number of reserved free pages based
proportionally on its size.
Some minimal amount of memory is needed to satisfy PF_MEMALLOC
allocations; if you set this to lower than 1024KB, your system will
become subtly broken, and prone to deadlock under high loads.
Setting this too high will OOM your machine instantly.
overcommit_memory
This value contains a flag that enables memory overcommitment.
When this flag is 0, the kernel attempts to estimate the amount
of free memory left when userspace requests more memory.
When this flag is 1, the kernel pretends there is always enough
memory until it actually runs out.
When this flag is 2, the kernel uses a "never overcommit"
policy that attempts to prevent any overcommit of memory.
Note that user_reserve_kbytes affects this policy.
DON'T CHANGE THIS VALUE, YOU WILL GET CRAP IN A HANDS, THIS IS JUST FOR INFO
overcommit_ratio
With this parameter you will set how much space will allocations use in physical RAM. (Percentage)
page-cluster
page-cluster controls the number of pages up to which consecutive pages
are read in from swap in a single attempt. This is the swap counterpart
to page cache readahead.
The mentioned consecutivity is not in terms of virtual/physical addresses,
but consecutive on swap space - that means they were swapped out together.
It is a logarithmic value - setting it to zero means "1 page", setting
it to 1 means "2 pages", setting it to 2 means "4 pages", etc.
Zero disables swap readahead completely.
panic_on_oom
This enables or disables panic on out-of-memory feature.
If this is set to 0, the kernel will kill some rogue process,
called oom_killer. Usually, oom_killer can kill rogue processes and
system will survive.
If this is set to 1, the kernel panics when out-of-memory happens.
If this is set to 2, the kernel panics compulsorily even on the
above-mentioned. Even oom happens under memory cgroup, the whole
system panics
In this part we will tweak kernel parameters
Open file manager as before and create a file with the name " 00kerneltweak"
Here we will use if statement, just for a little practise ^~^
Code:
if [ -e /proc/sys/kernel/shmmni ]; then
busybox echo "2048" > /proc/sys/kernel/shmmni
fi
if [ -e /proc/sys/kernel/shmall ]; then
busybox echo "1572864" > /proc/sys/kernel/shmall
fi
if [ -e /proc/sys/kernel/shmmax ]; then
busybox echo "33554432" > /proc/sys/kernel/shmmax
fi
if [ -e /proc/sys/kernel/msgmni ]; then
busybox echo "512" > /proc/sys/kernel/msgmni
fi
if [ -e /proc/sys/kernel/msgmnb ]; then
busybox echo "16384" > /proc/sys/kernel/msgmnb
fi
if [ -e /proc/sys/kernel/msgmax ]; then
busybox echo "8192" > /proc/sys/kernel/msgmax
fi
Copy this inside file, save it and copy to init.d folder
After that set permissions to 755
Code:
busybox chmod 755 /system/etc/init.d/00kerneltweak
Same as we learned before if file exist then do next
Let's explain this parameters:
shmall
The total amount of shared memory (in pages) which can be allocated on the system
shmmax
The maximum size of a shared memory segment (in pages)
shmmni
The maximum number of shared memory segments available on the system
msgmni
The number of IPC message queue resources allowed (by default, 16).
msgmnb
Defines the maximum size in bytes of a single message queue. The default value is 65536 bytes.
msgmax
The maxim...
Remove Google Play Services data
Code:
#!/system/bin/sh
mount -o remount,rw /data
busybox mount -o remount,rw /data
GSM=/data/data/com.google.android.gms
for i in $GSM
do
busybox rm -rf $i/*
done
make a file, and add this inside, like before
copy to /system/etc/init.d
set permissions to 755
Clear browser data
Code:
#!/system/bin/sh
mount -o remount,rw /data
busybox mount -o remount,rw /data
browser=/data/data/com.android.NAME_OF_THE_BROWSER
for i in $browser
do
busybox rm -rf $i/*
done
make a file, and add this inside, like before
copy to /system/etc/init.d
set permissions to 755
first write a name of the browser, some devices have chrome as a default, then name will be
com.android.chrome
I'm sure that its
com.android.browser for default one
Check that inside /data/data, then just change inside the script
Or you can use this package
Code:
#!/system/bin/sh
while true; do
mount -o remount,rw /data
busybox mount -o remount,rw /data
busybox echo -n "Enter a name of the browser: "
busybox read -r name
brw=/data/data/com.android.$name
if [ -d $brw ]; then
for i in $brw
do
busybox rm -rf $i/*
done
busybox echo "Clearing done"
busybox sleep 2
else
busybox echo "Browser doesn't exist, please type another one..."
busybox sleep 3
fi
done
Well, this for this file guide is different,
Call the file "ccleaner" copy it to /system/bin
Set permissions to 755 like before
Open terminal emulator
Code:
su
ccleaner
Thanks Man
Thanks @Paget96 for your Support Man It will help Many user to Learn From You :fingers-crossed::good:
And Am the First to Comment on your Forum
cheers:laugh:
axays said:
Thanks @Paget96 for your Support Man It will help Many user to Learn From You :fingers-crossed::good:
And Am the First to Comment on your Form [emoji14]
Click to expand...
Click to collapse
I hope so
This thread needs too much stuff here, I cannot finish it in one day
Sent from my Nexus 5 using Tapatalk
Wow Good Job and Good Luck @Paget96 Its willbe Awesome
Paget96 said:
I hope so
This thread needs too much stuff here, I cannot finish it in one day
Sent from my Nexus 5 using Tapatalk
Click to expand...
Click to collapse
I'm a fan of your L Speed Mod, and this tutorial clears up many things. Subscribing now for updates when you add more stuff here.
Sent from my HTC Desire 616 dual sim using Tapatalk
Evolutionzz said:
Wow Good Job and Good Luck @Paget96 Its willbe Awesome
Click to expand...
Click to collapse
Thank you mate ^~^
MSF Jarvis said:
I'm a fan of your L Speed Mod, and this tutorial clears up many things. Subscribing now for updates when you add more stuff here.
Sent from my HTC Desire 616 dual sim using Tapatalk
Click to expand...
Click to collapse
Heh fans everywhere ^~^ Yeah, but TUT is not finished this is maybe 20% of stuff which are need to be here
Sent from my Nexus 5 using Tapatalk
Guys, more stuff will come tomorrow
Sent from my Nexus 5 using Tapatalk
Paget96 said:
Thank you mate ^~^
Heh fans everywhere ^~^ Yeah, but TUT is not finished this is maybe 20% of stuff which are need to be here
Sent from my Nexus 5 using Tapatalk
Click to expand...
Click to collapse
Just 20%!!!! I'm dying to see the rest....
Paget96 said:
Thank you mate ^~^
Heh fans everywhere ^~^ Yeah, but TUT is not finished this is maybe 20% of stuff which are need to be here
Sent from my Nexus 5 using Tapatalk
Click to expand...
Click to collapse
Sent from my HTC Desire 616 dual sim using Tapatalk
MSF Jarvis said:
Just 20%!!!! I'm dying to see the rest....
Sent from my HTC Desire 616 dual sim using Tapatalk
Click to expand...
Click to collapse
Heheh, there will be whole stuff about scripting which I used for L Speed building
Sent from my Nexus 5 using Tapatalk
For now, I think that it's enough, if you have more request, type below
Also I want to see screenshots of your attempts
Sent from my Nexus 5 using Tapatalk
Hell yeah!! Awesome Guide my bro @Paget96 Fantastic! This what people wanted from a long time. Amazing.
Sent From dark_world through my Android One
dark_optimistic said:
Hell yeah!! Awesome Guide my bro @Paget96 Fantastic! This what people wanted from a long time. Amazing.
Sent From dark_world through my Android One
Click to expand...
Click to collapse
Thank you, this is why I created it
Sent from my Nexus 5 using Tapatalk
Paget96 said:
For now, I think that it's enough, if you have more request, type below
Also I want to see screenshots of your attempts
Sent from my Nexus 5 using Tapatalk
Click to expand...
Click to collapse
I borked my phone a bit (this is a non - rooted phone ) so I'll post screenshots later when I UN-bork it.
Sent from my HTC Desire 616 dual sim using Tapatalk
MSF Jarvis said:
I borked my phone a bit (this is a non - rooted phone ) so I'll post screenshots later when I UN-bork it.
Sent from my HTC Desire 616 dual sim using Tapatalk
Click to expand...
Click to collapse
What you mean with borked?? hehh
I'm waiting for your screenshots, just to see how users understood stuff ^~^
Sent from my Nexus 5 using Tapatalk
delete
Awesome work as usual :angel:
Black_Eyes said:
Awesome work as usual :angel:
Click to expand...
Click to collapse
Thank you
I just want to share mine experience with the users
And probably to teach someone
Sent from my Nexus 5 using Tapatalk
Paget96 said:
What you mean with borked?? hehh
I'm waiting for your screenshots, just to see how users understood stuff ^~^
Sent from my Nexus 5 using Tapatalk
Click to expand...
Click to collapse
Borked means I changed my recovery and flashed a GB ROM instead of using my friends custom built CM 11 build. My trusty Tahr system also broke down, but I am resilient so I'll manage and you WILL see the screenshots before 5PM IST.[emoji16] [emoji16] [emoji16] [emoji6] [emoji6] [emoji6] [emoji6]
Sent from my HTC Desire 616 dual sim using Tapatalk

Categories

Resources