Hi to all guys i'm developing a new rom and i'd like to put an executable script in it. I'm not very goot at bash,but you can help me. Here it is:
Code:
Welcome to openOptimus modding script!
echo Choose an option:
echo 1.Change boot animation
echo 2.Disable/enable Stagefright player
echo 3.Enable/disable Hardware acceleration
echo 4.Check Wi-Fi Tx-Power
read -p "Change boot animation" choice
read -p "Disable/enable Stagefright player" choice
read -p "Enable/disable Hardware acceleration" choice
read -p "Enable/disable Hardware acceleration" choice
read -p "Check Wi-Fi Tx-Power" choice
if test "$choice" == "1"
then
goto bootanim
fi
if test "$choice" == "2"
then
goto stagefright
fi
if test "$choice" == "3"
then
goto hwacc
fi
if test "$choice" == "4"
then
echo You need to run this only if you have Wi-Fi on!
iwconfig wlan0
fi
:bootanim
echo *********************************************************
echo * Boot animation changer *
echo *********************************************************
echo Please choose one:
echo 1.Megatron boot animation
echo 2.Android particles
echo 3.CyanogenMod 7
echo 4.Coin
read -p "Megatron boot animation" bootchoice
read -p "Android particles" bootchoice
read -p "CyanogenMod 7" bootchoice
read -p "Coin" bootchoice
if test "$bootchoice" == "1"
then
busybox cp /sdcard/openOptimus_resources/Megatron/bootanimation.zip /data/local
echo Boot animation copied.
if test "$bootchoice" == "2"
then
busybox cp /sdcard/openOptimus_resources/Particles/bootanimation.zip /data/local
echo Boot animation copied.
if test "$bootchoice" == "3"
then
busybox cp /sdcard/openOptimus_resources/CM7/bootanimation.zip /data/local
echo Boot animation copied.
fi
if test "$bootchoice" == "4"
then
busybox cp /sdcard/openOptimus_resources/Coin/bootanimation.zip /data/local
echo Boot animation copied.
fi
:stagefright
Stagefright player enabler/disabler
echo Please choose an option:
echo 1.Enable Stagefright player
echo 2.Disable stagefright player
read -p "Enable Stagefright player" stagefright
read -p "Disable stagefright player" stagefright
if test "$stagefright" == "1"
then
busybox cp /sdcard/openOptimus_resources/Stagefright2/build.prop /system
echo Stagefright player enabled.
fi
if test "$stagefright" == "2"
then
busybox cp /sdcard/openOptimus_resources/Stagefright2/build.prop /system
echo Stagefright player disabled.
fi
:hwacc
echo
echo Hardware acceleration enabler/disabler
echo WARNING:This disables/enables Hwacc,but enables stagefright
echo
echo Please choose an option:
echo 1.Enable Hardware acceleration
echo 2.Disable Hardware acceleration
read -p "Enable Hardware acceleration" hwacc
read -p "Disable Hardware acceleration" hwacc
if test "$hwacc" == "1"
then
busybox cp /sdcard/openOptimus_resources/Hwacc1/build.prop /system
echo Hardware acceleration enabled.
fi
if test "$hwacc" == "2"
then
busybox cp /sdcard/openOptimus_resources/Hwacc2/build.prop /system
echo Hardware acceleration disabled.
fi
It's all ok? Please answer me,in my last three topics nobody answered me.
Uhh, what exactly is the problem?
The only problem I see in this is that you use multiple build.prop files for enabling/disable stagefright and hardware acceleration.
My suggestion is you use sed, a stream editor. This way, you won't need copying files from the folder and may actually make the code easier to read.
This is how I use sed. It creates a backup of the file, searches for the string to be replaced, and then replaces it.
Code:
sed -i.bak 's/ro.media.enc.jpeg.quality=90/ro.media.enc.jpeg.quality=100/g' /system/build.prop
If you plan on doing this, read more about sed. I've kinda forgotten the syntax since I made this 15 days ago and never really used it again. And yes, that's how fast I forget stuff
Thanks kpbotbot ur da man of xda. So,there are no syntax problems in the script except the build.prop? Maybe i can use setprop to disable/enable hwacc/stagefright. I read about setprop in franciscofranco's tweaks topic. Can i use it?
@kpbotbot ..i wanted to look at sed and your example just made it very easy
Lol no I'm not.
I'm not entirely sure how bash handles input. I haven't given scripting much time yet despite the fact that I've been on linux for quite some time xD The logic is in the script though. Have you tested it?
Regarding the franciscofranco's scripts, of course you can use them
I'm trying it with setprop. BTW,i don't wanna piss you off guys but take a look in Optimus One General. Take a look at "APKManager not working" It's very important.
I don't have any idea what in the world is wrong with APKManager since I don't use or plan on using it. What do you need it for anyway?
By the way, had a look at bash scripting. Why does this have 4 read lines?
Code:
read -p "Change boot animation" choice
read -p "Disable/enable Stagefright player" choice
read -p "Enable/disable Hardware acceleration" choice
read -p "Enable/disable Hardware acceleration" choice
read -p "Check Wi-Fi Tx-Power" choice
I've had a quick look on your script. First of all DON'T USE GOTO's!!!
You have two "read -p "Enable/disable Hardware acceleration" choice".
Code:
echo You need to run this only if you have Wi-Fi on!
iwconfig wlan0
Why do you have iwconfig wlan0 lying there? If you don't have Wi-Fi on it will just simply output an error saying it's not on...
Use functions instead.
Try a little tutorial here (http://tldp.org/LDP/abs/html/functions.html) about functions. I didn't recommend using this a few minutes ago for some reason. Anyway, you may need to make a major rewrite to your script, but better readability and flow make it easier to maintain and trace errors.
I'm not sure if there are any other (or better) ways of doing this. Have a look at ruigui's script
kpbotbot said:
Use functions instead.
Try a little tutorial here (http://tldp.org/LDP/abs/html/functions.html) about functions. I didn't recommend using this a few minutes ago for some reason. Anyway, you may need to make a major rewrite to your script, but better readability and flow make it easier to maintain and trace errors.
I'm not sure if there are any other (or better) ways of doing this. Have a look at ruigui's script
Click to expand...
Click to collapse
I agree, functions would be better than the way you're doing atm.
Yea now i'm gonna take a look at ruigui's script.
Dudes i wanna ask you some:
When i cook my rom and change framework i get bootloop. This doesn't happen if i cook rom w/ original framework,or if i flash a zip that contains that particular framework.
And,i downloaded black mms apk from void and ringnofade. When i put 'em in my rom they force close! Why? Do i need to change classes.dex?
.
EDIT:I taked a look at ruigui's script,but this didn't help me. Please fix my script.
Thanks guys.
I don't know most of bash's syntax, so you do it
Here's how you should do it:
Create the functions. 1 for bootanim changer, 1 for enabling of hardware acceleration, 1 for SF, and 1 for the other one I forgot
Make the choosing part (the one with the reads)
Call appropriate function depending on choice
If you come to think of it this is actually easier than gotos.
ciaox said:
Dudes i wanna ask you some:
* When i cook my rom and change framework i get bootloop. This doesn't happen if i cook rom w/ original framework,or if i flash a zip that contains that particular framework.
Click to expand...
Click to collapse
Because you're not supposed to replace framework-res.apk because on the first boot, android checks signatures. It will get into a bootloop when it fails on that. (Experts please follow this up. I'm not sure).
Just replace the stuff inside the framework-res.apk with the stuff in the themed framework so as not to break signing. Just open framework-res.apk with an archiving tool and drag stuff onto it replacing the previous stuff. DO NOT EXTRACT
At least that's how I avoid bootloops. Try asking paolo how he did some of the stuff
EDIT: Also, do not resign framework-res.apk. You shouldn't sign it with a testkey xD
ciaox said:
EDIT:I taked a look at ruigui's script,but this didn't help me. Please fix my script.
Click to expand...
Click to collapse
We ain't gonna fix your script. If you come here with valuable questions after you did your research, then we can help and answer, if you come here asking for us to fix "your" work, sorry dude, ain't going to happen.
And about gotos, anyone that programmed anything in his/her life will know that gotos = problems and possible security holes.
@ciaox Got bored xD Made a script.
Try to look at mine. The code is straightforward so no need to explain them - http://forum.xda-developers.com/showpost.php?p=12510469&postcount=144
Don't use this as base though. Just look at the functions and how to call them. Then, make yours
franciscofranco said:
We ain't gonna fix your script. If you come here with valuable questions after you did your research, then we can help and answer, if you come here asking for us to fix "your" work, sorry dude, ain't going to happen.
And about gotos, anyone that programmed anything in his/her life will know that gotos = problems and possible security holes.
Click to expand...
Click to collapse
Man i'm sorry about dis,i will take a look at kpbotbot's script. Many thanks to everyone. Please keep thread open cuz i'm gonna need you guys..
oh man i get this. I can now call functions,i will let u know
Many thanks
[OT] I wanna integrate dspmanager in my rom but it doesn't work,and if i put libaudioflinger.so from cm7 by mik i can't hear anything. [/OT]
Yeah guys just rewrited my script! Now it must be ok! Check it out,i think it's OK.
Code:
#!/system/bin/sh
##########################################################################
# openOptimus tweaks v2 beta #
# Script created by ciaox. only for openOptimus ROM. #
# Copyright (c) ciaox 2011. #
##########################################################################
hwon(){
cp /sdcard/openOptimus_resources/Hwacc1/build.prop /system
echo Hardware acceleration enabled.
fi
}
hwoff(){
cp /sdcard/openOptimus_resources/Hwacc2/build.prop /system
echo Hardware acceleration disabled.
fi
}
sfon(){
cp /sdcard/openOptimus_resources/Stagefright1/build.prop /system
echo Stagefright player enabled.
fi
}
sfoff(){
cp /sdcard/openOptimus_resources/Stagefright2/build.prop /system
echo Stagefright player disabled.
fi
}
megatron(){
cp /sdcard/openOptimus_resources/Megatron/bootanimation.zip /data/local
echo Boot animation copied.
}
particles(){
cp /sdcard/openOptimus_resources/Particles/bootanimation.zip /data/local
echo Boot animation copied.
}
cyan7(){
cp /sdcard/openOptimus_resources/CM7/bootanimation.zip /data/local
echo Boot animation copied.
}
coin(){
cp /sdcard/openOptimus_resources/Coin/bootanimation.zip /data/local
echo Boot animation copied.
}
boot(){
echo *********************************************************
echo * Boot animation changer *
echo *********************************************************
echo Please choose one:
echo 1.Megatron boot animation
echo 2.Android particles
echo 3.CyanogenMod 7
echo 4.Coin
read megatron
read particles
read cyan7
read coin
if test "$megatron" == "1"
then megatron
fi
if test "$particles" == "2"
then particles
fi
if test "$cyan7" == "3"
then cyan7
fi
if test "$coin" == "4"
then coin
fi
}
tx(){
echo You need to run this only if you have Wi-Fi on!
iwconfig wlan0
fi
}
sf(){
echo *********************************************************
echo *stagefright player enabler/disabler *
echo *********************************************************
echo Please choose an option:
echo 1.Enable Stagefright player
echo 2.Disable stagefright player
read sfon
read sfoff
if test "$sfon" == "1"
then sfon
fi
if test "$sfoff" == "2"
then sfoff
fi
}
sf(){
echo *********************************************************
echo * Hardware acceleration enabler/disabler *
echo *********************************************************
echo WARNING:This disables/enables Hwacc,but enables stagefright
echo
echo Please choose an option:
echo 1.Enable Hardware acceleration
echo 2.Disable Hardware acceleration
read hwon
read hwoff
if test "$hwon" == "1"
then hwon
fi
}
if test "$hwoff" == "2"
then hwoff
fi
}
echo *********************************************************
echo * Welcome to openOptimus modding script! *
echo *********************************************************
echo Choose an option:
echo 1.Change boot animation
echo 2.Disable/enable Stagefright player
echo 3.Enable/disable Hardware acceleration
echo 4.Check Wi-Fi Tx-Power
read boot
read sf
read hw
read tx
if test "$boot" == "1"
then boot
fi
if test "$sf" == "2"
then sf
fi
if test "$hw" == "3"
then hw
fi
if test "$tx" == "4"
then tx
you called you hardware acceleration disabler/enabler as "sf" instead of "hw".
I think you should call a case loop instead of this:
Code:
read boot
read sf
read hw
read tx
if test "$boot" == "1"
then boot
fi
if test "$sf" == "2"
then sf
fi. . . . . . .
which should be something like this:
Code:
read $option
case $option in
1)
boot
;;
2)
sf
;;
3)
hw
;;
4)
tx
;;
esac
or something like that. btw, what happens after you're finished with one tweak, let's say disabling/enabling stagefright? I think you should call you main menu as another function and just call it at the bottom of you script. not an expert, just giving some inputs.
Code:
hwon(){
cp /sdcard/openOptimus_resources/Hwacc1/build.prop /system
echo Hardware acceleration enabled.
fi
}
hwoff(){
cp /sdcard/openOptimus_resources/Hwacc2/build.prop /system
echo Hardware acceleration disabled.
fi
}
sfon(){
cp /sdcard/openOptimus_resources/Stagefright1/build.prop /system
echo Stagefright player enabled.
fi
}
sfoff(){
cp /sdcard/openOptimus_resources/Stagefright2/build.prop /system
echo Stagefright player disabled.
fi
}
What happened to setprop? Using multiple build.prop files will make it even more complicated. And if someone made modifications to their build.prop files then used this, they would lose their changes.
kpbotbot said:
Code:
hwon(){
cp /sdcard/openOptimus_resources/Hwacc1/build.prop /system
echo Hardware acceleration enabled.
fi
}
hwoff(){
cp /sdcard/openOptimus_resources/Hwacc2/build.prop /system
echo Hardware acceleration disabled.
fi
}
sfon(){
cp /sdcard/openOptimus_resources/Stagefright1/build.prop /system
echo Stagefright player enabled.
fi
}
sfoff(){
cp /sdcard/openOptimus_resources/Stagefright2/build.prop /system
echo Stagefright player disabled.
fi
}
What happened to setprop? Using multiple build.prop files will make it even more complicated. And if someone made modifications to their build.prop files then used this, they would lose their changes.
Click to expand...
Click to collapse
Oh yeah forgot this..will update script. Thx to ungaze for the tip i'm gonna add a main_menu function. And i will use case.
Ok i rewrited script again:
Code:
#!/system/bin/bash
##########################################################################
# openOptimus tweaks v2 beta 2 #
# Script created by ciaox. only for openOptimus ROM. #
# Copyright (c) ciaox 2011. #
##########################################################################
exit(){
echo Goodbye! And hope u will enjoy openOptimus (:
fi
}
hwon(){
setprop debug.sf.hw=1
echo Hardware acceleration enabled.
fi
}
hwoff(){
setprop debug.sf.hw=0
echo Hardware acceleration disabled.
fi
}
sfon(){
setprop media.stagefright.enable-player=true
setprop media.stagefright.enable-meta=true
setprop media.stagefright.enable-scan=true
setprop media.stagefright.enable-http=true
echo Stagefright player enabled.
fi
}
sfoff(){
setprop media.stagefright.enable-player=false
setprop media.stagefright.enable-meta=false
setprop media.stagefright.enable-scan=false
setprop media.stagefright.enable-http=false
echo Stagefright player disabled.
fi
}
megatron(){
cp /sdcard/openOptimus_resources/Megatron/bootanimation.zip /data/local
echo Boot animation copied.
}
particles(){
cp /sdcard/openOptimus_resources/Particles/bootanimation.zip /data/local
echo Boot animation copied.
}
cyan7(){
cp /sdcard/openOptimus_resources/CM7/bootanimation.zip /data/local
echo Boot animation copied.
}
coin(){
cp /sdcard/openOptimus_resources/Coin/bootanimation.zip /data/local
echo Boot animation copied.
}
boot(){
echo *********************************************************
echo * Boot animation changer *
echo *********************************************************
echo Please choose one:
echo 1.Megatron boot animation
echo 2.Android particles
echo 3.CyanogenMod 7
echo 4.Coin
read megatron
read particles
read cyan7
read coin
if test "$megatron" == "1"
then megatron
fi
if test "$particles" == "2"
then particles
fi
if test "$cyan7" == "3"
then cyan7
fi
if test "$coin" == "4"
then coin
fi
}
tx(){
echo You need to run this only if you have Wi-Fi on!
iwconfig wlan0
fi
}
sf(){
echo *********************************************************
echo *stagefright player enabler/disabler *
echo *********************************************************
echo Please choose an option:
echo 1.Enable Stagefright player
echo 2.Disable stagefright player
read sfon
read sfoff
if test "$sfon" == "1"
then sfon
fi
if test "$sfoff" == "2"
then sfoff
fi
}
sf(){
echo *********************************************************
echo * Hardware acceleration enabler/disabler *
echo *********************************************************
echo
echo Please choose an option:
echo 1.Enable Hardware acceleration
echo 2.Disable Hardware acceleration
read hwon
read hwoff
if test "$hwon" == "1"
then hwon
fi
}
if test "$hwoff" == "2"
then hwoff
fi
}
main_menu(){
echo *********************************************************
echo * Welcome to openOptimus modding script! *
echo *********************************************************
echo Choose an option:
echo 1.Change boot animation
echo 2.Disable/enable Stagefright player
echo 3.Enable/disable Hardware acceleration
echo 4.Check Wi-Fi Tx-Power
echo 5.Exit
read boot
read sf
read hw
read tx
read exit
if test "$boot" == "1"
then boot
fi
if test "$sf" == "2"
then sf
fi
if test "$hw" == "3"
then hw
fi
if test "$tx" == "4"
then tx
fi
}
if test "$exit" == "5"
then exit
fi
}
Related
I'm trying to make a script that will do a modification to the build.prop on boot.
Usually I flash the cm7 nightly and I pull the build.prop, modify it and push it back before the first boot. The idea is to make it easier for flashing roms on the go. Using custom_backup_list.txt seems to be a viable option but it will keep an old build.prop indefinitely.
Some of the properties that I want to change are
Code:
windowsmgr.max_events_per_sec=100
ro.sf.lcd_density=201
ro.config.ringtone=_Mosquito 16bit.mp3
ro.config.alarm_alert=Alarm_Beep_02.ogg
From what I read today CM7 looks for inituser.sh file at two different locations:
Code:
/sd-ext/userinit.sh
/data/local/userinit.sh
As of now I have tried without success doing the following
Make a userinit.sh script at /data/local with the following code
Code:
#!/system/bin/sh
mount -o rw,remount -t yaffs2 /dev/block/mtdblock3 /system
setprop windowsmgr.max_events_per_sec 100
setprop ro.sf.lcd_density 201
setprop ro.config.ringtone "_Mosquito 16bit.mp3"
setprop ro.config.alarm_alert Alarm_Beep_02.ogg
I'm not sure if there's something wrong in the above code, or CM7 is not running the scripts on boot.
EDIT: after adb push the file I do
Code:
adb shell
chmod 755 /data/local/userinit.sh
I've been trying for several hours now. Still get issue with stuck at X.
This is my updated script. Not sure what is wrong...
Using CM7 nightly36
cavs intersectraven
ss4n1 script
dtapp2sd
this is my userinit.sh at /data/local
Code:
#!/system/bin/sh
file=/system/.bproped
if [ -f "$file" ]; then
echo "Done already"
else
mount -o rw,remount -t yaffs2 /dev/block/mtdblock3 /system
sed -i 's/ro.sf.lcd_density=240/ro.sf.lcd_density=202/g' /system/build.prop
sed -i '/ro.config.ringtone/d' /system/build.prop
sed -i '/ro.config.alarm_alert/d' /system/build.prop
echo "ro.telephony.call_ring.delay=1000" >> /system/build.prop
echo "ro.config.ringtone=_Mosquito 16bit.mp3" >> /system/build.prop
echo "ro.config.alarm_alert=Alarm_Beep_02.ogg" >> /system/build.prop
echo "windowsmgr.max_events_per_sec=100" >> /system/build.prop
echo > /system/.bproped
fi;
exit 0
I know where you're coming from. Takes a while to customize your phone manually after each nightly, so I actually have a custom script similar to what you're doing, which updates build.prop and other config files (hosts, gps.conf, etc). Only mine is run within the update.zip, using the recovery shell /sbin/sh.
For your method, you can try this ...
Code:
#!/system/bin/sh
MODIFIED=`cat /system/build.prop|grep "zeus_chingon"`
if [ "$MODIFIED" ];
then
echo "Done already"
else
mount -o remount,rw /system
sed -i 's/ro.sf.lcd_density=240/ro.sf.lcd_density=202/g' /system/build.prop
RINGTONE=`cat /system/build.prop|grep "ro.config.ringtone"`
sed -i 's/$RINGTONE/ro.config.ringtone=_Mosquito_16bit.mp3/g' /system/build.prop
ALARM=`cat /system/build.prop|grep "ro.config.alarm_alert"`
sed -i 's/$ALARM/ro.config.alarm_alert=Alarm_Beep_02.ogg/g' /system/build.prop
echo "ro.telephony.call_ring.delay=1000" >> /system/build.prop
echo "windowsmgr.max_events_per_sec=100" >> /system/build.prop
echo "# Modified by zeus_chingon" >> /system/build.prop
mount -o remount,ro /system
fi
EDIT:
My own custom script is HERE. Feel free to modify for your own use.
ch33kybutt said:
I know where you're coming from. Takes a while to customize your phone manually after each nightly, so I actually have a custom script similar to what you're doing, which updates build.prop and other config files (hosts, gps.conf, etc). Only mine is run within the update.zip, using the recovery shell /sbin/sh.
For your method, you can try this ...
Code:
#!/system/bin/sh
MODIFIED=`cat /system/build.prop|grep "zeus_chingon"`
if [ "$MODIFIED" ];
then
echo "Done already"
else
mount -o remount,rw /system
sed -i 's/ro.sf.lcd_density=240/ro.sf.lcd_density=202/g' /system/build.prop
RINGTONE=`cat /system/build.prop|grep "ro.config.ringtone"`
sed -i 's/$RINGTONE/ro.config.ringtone=_Mosquito_16bit.mp3/g' /system/build.prop
ALARM=`cat /system/build.prop|grep "ro.config.alarm_alert"`
sed -i 's/$ALARM/ro.config.alarm_alert=Alarm_Beep_02.ogg/g' /system/build.prop
echo "ro.telephony.call_ring.delay=1000" >> /system/build.prop
echo "windowsmgr.max_events_per_sec=100" >> /system/build.prop
echo "# Modified by zeus_chingon" >> /system/build.prop
mount -o remount,ro /system
fi
EDIT:
My own custom script is HERE. Feel free to modify for your own use.
Click to expand...
Click to collapse
Thanks for your help, I end up using your zip file with some modification. The problem that I keep encountering is that using the /data/local/userinit.sh method it get stuck on boot at X.
I saw in your buildprop.sh some settings like
Code:
ro.HOME_APP_ADJ=1
ro.HOME_APP_MEM=3072
what does each one do?
I use LauncherPro if that have anything to do with it.
ro.HOME_APP_ADJ determines oom_adj value and ro.HOME_APP_MEM determines memory threshold, for your chosen launcher app. In short, these settings help to keep the launcher resident in memory and thus reduce homescreen lag.
One thing you have know about the ro.* settings in build.prop, are that they are writeable one-time only, i.e. once any ro.* value has been set, it becomes read-only and you cannot use setprop to change it further.
So it seems that your orginal buildprop.sh script add to the first line of build prop by using the
Code:
sed -i '1i\Something' /system/build.prop;
to put it in "higher priority" so that it get run first and overlook the second occurence that might occur in the build.prop afterwards?
So if i want to add something to line number n it would be
sed -i 'ni\something' .......
zeus_chingon said:
So it seems that your orginal buildprop.sh script add to the first line of build prop by using the
Code:
sed -i '1i\Something' /system/build.prop;
to put it in "higher priority" so that it get run first and overlook the second occurence that might occur in the build.prop afterwards?
So if i want to add something to line number n it would be
sed -i 'ni\something' .......
Click to expand...
Click to collapse
That's correct.
Build.prop
Hi All,
By default my System folder didn't had the build.prop. i extracted it from the CM7 Rom made some changes and copied it to System folder and rebooted.
Changes ringtone(default) Playa.ogg to Rigel.ogg.
After reboot still Playa.ogg as my default ringtone.
What is figured was my Phone isnt including build.prop file
Any suggestions?
Thanx
Wildfire Rooted(CM7 Nightly 2.3.5)
▒▄█▀▄░ █▀▄ █▀▀▄ █▀▀ █▄░█ ▄▀▄ █░░ ▀ █▄░█ █▀▀░░▒▐█▀█▒▐█▀█▒█▒█░░▒▐█▀█ ▄▀▄ █▄░█ ▀█▀ █▀▀▄ ▄▀▄ █░
▐█▄▄▐█ █░█ █▐█▀ █▀▀ █░▀█ █▀█ █░▄ █ █░▀█ █▀▀░░▒▐█░░▒▐█▄█▒█▒█░░▒▐█░░ █░█ █░▀█ ░█░ █▐█▀ █░█ █░▄
▐█░▒▐█ ▀▀░ ▀░▀▀ ▀▀▀ ▀░░▀ ▀░▀ ▀▀▀ ▀ ▀░░▀ ▀▀▀░░▒▐█▄█▒▐█░░▒▀▄▀░░▒▐█▄█ ░▀░ ▀░░▀ ░▀░ ▀░▀▀ ░▀░ ▀▀▀
Rules Your CPU A Breeze !
*CF-ROOT ONLY !
DISCLAIMER: I take no responsible if you brick your phone
To Devs:
You have agreed to this if you're going to use any parts of my work:
Code:
If you are taking any of my work as reference, please add credit and maybe a link of my thread would be nice.
Pm me and tell me about your project.
Provide 'do & don't' and warnings about issues that Adrenaline Boost could cause to end user's device.
If you're using my file, please do not edit my #comment or add any main function unrelated system outputs.
If you're using main function related code of my files, please add '#NAME_OF_MY_FILE by ImbaWind' on top of your file and maybe more precisely, which part of it.
[Description]
One Script To Rule Your CPU , Why SetCPU If You Have Installed This Script ?!
Why This Script ?!
Handy Script UI !
Easy To Use !!
No App Needed !!!
Zero Ram Usage !!!!
Few kb Space Needed ONLY !!!!!
More Tweaks Than Others!!!!!!
More Functions Than Others!!!!!!!
100% FREE !!!!!!!!
Functions :
1. Change Cpu Governors
----a) Set Cpu Governor Setting On Boot !
----b) Drop Cache When Phone Boots !
2. Change Cpu Max Frequency (b84 only)
----a)Set Clock Frequency On Boot ! [NEW]
3. Change Cpu Min Frequency (b84 only)
4. Adrenaline Boost™ [NEW*]
What you need :
Terminal
Root access (Superuser)
Busybox
Clockworkmod
CF-ROOT
How to install:
1. Download the latest version of .zip file attached below and put into your sdcard
2. Reboot into CWM
3. Go 'mounts and storage' > 'mount /system'
4. Go 'install zip from sdcard' > 'choose zip from sdcard' > locate 'Adrenaline CPU Control_BETA3.2.zip'
5. reboot system now
How to use:
Go terminal emulator and type :
Code:
su
clock
New function: Adrenaline Boost™
What is this?
-It's actually option 4 [drop cache] from previous build and I have pulled it out and add more command to clear more ram, now it shows your free ram too!
When and why should I use this?
-You will notice that your ram will increase everyday and task manager are NOT able to clear it and your phone are damn lag and you have to reboot, this is because the android os works everyday and creates system caches itself.
-Adrenaline™ Boost will help you to clear those caches for you and give back you smooth performance!!
-For more information, go here.
How to use this ?
Go terminal emulator and type :
Code:
su
boost
Then exit terminal and go task manager clear ram , you will see the magic !
And your phone will smooth as butter
**This Script Are ABLE To Overclock If You Are Using CF-ROOT B84!**
Currently Available Governor:
Code:
conservative
ondemand
smartass
smartassV2 [b84 only]
interactive
interactiveX
powersave
performance
userspace
Screenshots
Before : 245670 ~ 825600
{
"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"
}
Selecting Governor
Insert Governor
Change Max Frequency From 825600 to 844800
As you can see , the max frequency changed
My script is working
PROOF: Set CPU shows exactly what setting I have in CPU Script
Adrenaline Boost™
Before Memory Free : 44.1172 MB
After Memory Free : 95.9102 MB
Memory Freed : 51.793 MB
Known Issue :
-Loop back to 'Current Governor : xxxxxx: when selecting exit option after choosing a governor, have no idea what causes it =(
How to uninstall ?
Reboot cwm, mount /system and install THIS from sdcard.
-------THINGS TO DO IN NEXT VERSION-------
1) More Governor Tweaks
*) Bug Fixes [If got any]
Credits
-Special thank to ketut.kumajaya for CF-Root and his guidance
-pikachu (I learn to create flashable-zip using his cwm package as guide)
-Google for Android OS
-matmutant from X10 Mini for his script's first line (You are running from ***to *** , Current Governor is ***)
-Those who have helped/tried to help me
-droidphile for his awesome ref
For those who want to include this into your ROM, please give proper credits and a link directs to this thread, thanks
I may use HOURS for an update but if you like my work,
please consider to use only one SECOUND to hit the THANKS button
It will make me happy and motivate me to update more often and add more features
Rate this thread ✯ ✯ ✯ ✯ ✯ and share it to your friends too!
If you found this script S'UCKS and think that this script is just crap , please comment to tell me why ;D
I'm willing to accept your view and make my script better =]
Any Feedback Please =D
If you want to mod this script for others kernel use , or include this in your rom
PLEASE SEND A PM TO ME , AND POST A LINK DIRECT TO HERE
[For devs and experts]
Loop back to 'Current Governor : xxxxxx: when selecting [Exit] option after choosing a governor, have no idea what causes it =S
Any help please =D
[Change Log]
Alpha 1 > 12/1/2012 <
1st release
Alpha 1.1 > 12/1/2012 <
Fix a minor bug , doesn't matter if your phone are rooted properly
Alpha 2 > 15/1/2012 <
Made flashable zip but the files are set as wrong permission
Added command to copy file to init.d , but the script does't work [Will be able to set on boot when it's done]
Alpha 2.1 > 23/1/2012 <
Found a minor bug , causes "end of file" error
Alpha 2.2 > 24/1/2012 <
Fixed a 'End Of File' error
BETA 1 > 26/1/2012 <
Added Set On Boot Function !
Added Clear Ram During Boot
BETA 2 > 30/1/2012 <
CPU Freq Are Now Able To Set On Boot !!
BETA 2.1 > 30/1/2012 <
Fixed some minor bugs
Add only b84 can access option 3 , 4 and smartassV2 governor
BETA 2.2 > 6/2/2012 <
Fixed a minor bug when changing governor
Beta 3 > 25/2/2012 <
Major Update
Fully Flashable zip
New Function : Adrenaline Boost
More Governor Tweaks
Bug Fixes
Beta 3.1 > 14/3/2012 <
Updated Adrenaline™ Boost, now shows your free ram
Beta 3.2 > 3/4/2012 <
Updated to Adrenaline™ Boost V3
Try 'touch'?
Code:
touch /system/init.d/nameofscripthere
echo "interactiveX" > /sys/devices/system/cpu/cpu0/cpufreq/scaling_governor
Dunno if that's correct, do some experiment
Touch is used to create a plain file when there's no file available on /path/to/file
KcLKcL said:
Try 'touch'?
Code:
touch /system/init.d/nameofscripthere
echo "interactiveX" > /sys/devices/system/cpu/cpu0/cpufreq/scaling_governor
Dunno if that's correct, do some experiment
Touch is used to create a plain file when there's no file available on /path/to/file
Click to expand...
Click to collapse
thanks for your reply
i'll try it tomorrow
don't work , I extracted it and put in system bin changed permission and rebooted and went to terminal and
su
clock
didn't work..
should I flash it?
Sent from my GT-S5830 using xda premium
dylan_ace said:
don't work , I extracted it and put in system bin changed permission and rebooted and went to terminal and
su
clock
didn't work..
should I flash it?
Sent from my GT-S5830 using xda premium
Click to expand...
Click to collapse
move the file inside the .zip not the folder
check ur perm
dun rename the file otherwise wont work
dont flash it , it's not a flashable file
the Alpha folder from the extract?
Sent from my GT-S5830 using xda premium
dylan_ace said:
the Alpha folder from the extract?
Sent from my GT-S5830 using xda premium
Click to expand...
Click to collapse
the file is called : 'clock'
if u edit the file by notepad u will see those code are same as my 1st post code
if it's same , move the 'clock' file to /system/bin
Does it only set the CPU frequencies based on the Kernels limitations? ie. CF-Root 3.7-b83 max frequency is 902MHz with OC'ing apps, am I to expect this to be the same....
I already have it, lol
saigetshu said:
I already have it, lol
Click to expand...
Click to collapse
then why dont u share? LOL
-SGA- said:
Does it only set the CPU frequencies based on the Kernels limitations? ie. CF-Root 3.7-b83 max frequency is 902MHz with OC'ing apps, am I to expect this to be the same....
Click to expand...
Click to collapse
this script doesn't overclock , it just let u choose those freq and governors that are already INCLUDED in ur kernel
imbawind said:
DISCLAIMER: I take no responsible if you brick your phone
I have made a script to change governors , max cpu freq and min cpu freq , SetCPU is not needed once this script is completely done
What you need :
Terminal
Root access (Superuser)
Clockworkmod
How to use:
1.Download the .zip file(flashable) and flash via recovery
2.Check Permission :
/system/bin/clock => rwxrwxrwx
3. Open Terminal
4.Type
Code:
su
clock
** Do NOT Rename The File
Functions
1. Change Governors
2. Change Max Frequency
3. Change Min Frequency
4. Drop System Cache
5. Reboot
**This Script doesn't overclock , you need a modified overclock-able kernel to overclock.** [Script error if u set the freq over 800mhz because I haven't make correspond file yet , will complete this once <set on boot> is done]
After selected option 4 go task manager , hit clear ram and see the ram usage
Code:
#!/system/bin/bash
# Cpu Freq Script
# Alpha 2
if [ -f "/system/xbin/su" ]; then
busybox mount -o remount,rw -t rootfs /
echo "Remounted RW !"
else
echo "ERROR : Failed To mount RW !"
echo -n " Please Enter Key To Exit... “;
read enterKey
exit 0
fi
speed=1
sleep="sleep $speed"
# Current Max Clock Speed
cur_max_file=/sys/devices/system/cpu/cpu0/cpufreq/scaling_max_freq
CUR_MAX=`cat $cur_max_file`
# Current Min Clock Speed
cur_min_file=/sys/devices/system/cpu/cpu0/cpufreq/scaling_min_freq
CUR_MIN=`cat $cur_min_file`
# Current Governor
scal_gov_file=/sys/devices/system/cpu/cpu0/cpufreq/scaling_governor
CUR_GOV=`cat $scal_gov_file`
# Available Governor
avail_gov_file=/sys/devices/system/cpu/cpu0/cpufreq/scaling_available_governors
AVAIL_GOV=`cat $avail_gov_file`
# Available Frequencies
avail_freq_file=/sys/devices/system/cpu/cpu0/cpufreq/scaling_available_frequencies
AVAIL_FREQ=`cat $avail_freq_file`
# ECHO Tell Current Clock Speed
echo -e " You're running from \033[1;32m $CUR_MIN \033[0;36m to \033[1;32m $CUR_MAX \033[0;36m Hz"
echo -e "Current governor is \033[1;32m $CUR_GOV \033[0;36m"
echo ""
echo ""
$sleep
# ECHO Show Available Governor
echo " Available Governor: "
echo "$AVAIL_GOV"
echo ""
$sleep
# ECHO Show Available Freq
echo " Available Frequencies: "
echo "$AVAIL_FREQ"
echo ""
$sleep
echo " [ Options ] "
echo " 1. Change CPU Governor Profile "
echo " 2. Change Maximum Processor Frequency "
echo " 3. Change Minimum Processor Frequency "
echo " 4. Drop System Caches "
echo " 5. Reboot "
echo " 6. Exit "
echo ""
$sleep
echo -n " Please Enter Option [1 - 6] : "
read opt
echo ""
$sleep
case $opt in
1) echo " [Option 1] Change CPU Governor Profile "
echo ""
echo ""
echo -e " Current Governor: $CUR_GOV"
echo ""
$sleep
echo " Available Governors: "
echo "$AVAIL_GOV"
echo ""
$sleep
echo " Insert your desired governor: "
echo -n " Your Governor: ";read GOV
echo $GOV > /sys/devices/system/cpu/cpu0/cpufreq/scaling_governor
echo " Complete "
NEW_GOV_FILE=`cat /sys/devices/system/cpu/cpu0/cpufreq/scaling_governor`
NEW_GOV=$NEW_GOV_FILE
rm -f /system/etc/init.d/smartass
rm -f /system/etc/init.d/interactiveX
rm -f /system/etc/init.d/interactive
rm -f /system/etc/init.d/conservative
rm -f /system/etc/init.d/userspace
rm -f /system/etc/init.d/powersave
rm -f /system/etc/init.d/performance
rm -f /system/etc/init.d/ondemand
cp /system/etc/clock/governors/$GOV /system/etc/init.d;
chmod 777 /system/etc/init.d/$GOV
echo ""
echo ""
$sleep
echo -e " Current Governor: $NEW_GOV"
echo ""
echo ""
$sleep
echo -n " Press Enter Key To Continue... ";
read enterKey
opt=0
clock;;
2) echo " [Option 2] Change Maximum Processor Frequency "
echo ""
echo ""
$sleep
echo -e " Current Maximum Frequency: $CUR_MAX "
echo ""
$sleep
echo " Available Frequency: "
echo "$AVAIL_FREQ "
echo ""
echo ""
$sleep
echo -n " Insert Your Frequency: ";read HFREQ
echo $HFREQ > /sys/devices/system/cpu/cpu0/cpufreq/scaling_max_freq
echo " Changed Successfully "
NEW_CUR_MAX=`cat /sys/devices/system/cpu/cpu0/cpufreq/scaling_max_freq`
NEW_MAX=$NEW_CUR_MAX
echo ""
echo ""
rm -f /system/etc/init.d/122880
rm -f /system/etc/init.d/245760
rm -f /system/etc/init.d/320000
rm -f /system/etc/init.d/480000
rm -f /system/etc/init.d/800000
cp /system/etc/clock/max_freq/$HFREQ /system/etc/init.d;
chmod 777 /system/etc/init.d/$HFREQ
$sleep
echo -e " Current Processor Maximum Frequency: $NEW_MAX "
echo ""
echo ""
$sleep
echo -n " Press Enter Key To Continue... ";
read enterKey
opt=0
clock;;
3) echo " [Option 3] Change Minimum Processor Frequency "
echo ""
$sleep
echo -e " Current Minimum CPU Frequency: $CUR_MIN "
echo ""
$sleep
echo " Available Frequency: "
echo "$AVAIL_FREQ "
echo ""
echo ""
$sleep
echo -n " Insert Your Frequency: ";read LFREQ
echo $LFREQ > /sys/devices/system/cpu/cpu0/cpufreq/scaling_min_freq
echo " Changed Successfully "
NEW_MIN_FILE=`cat /sys/devices/system/cpu/cpu0/cpufreq/scaling_min_freq`
NEW_MIN=$NEW_MIN_FILE
echo ""
echo ""
$sleep
echo -e " Current Processor Minimum Frequency: $NEW_MIN "
echo ""
echo ""
$sleep
echo -n " Press Enter Key To Continue... ";
read enterKey
opt=0
clock;;
4) echo "3" > /proc/sys/vm/drop_caches
echo "1" > /proc/sys/vm/drop_caches
echo " Ram Dropped "
echo ""
echo ""
$sleep
echo -n " Press Enter Key To Continue... ";
read enterKey
opt=0
clock;;
5) echo " Rebooting... "
$sleep
reboot;;
6) echo " Exit "
$sleep
exit 0;;
*) echo " Invalid Option "
echo ""
$sleep
echo " Please try again "
echo ""
$sleep
echo -n " Please Enter Key To Continue... ";
read enterKey
opt=0
clock;;
esac
Click to expand...
Click to collapse
Updated to Alpha 2 , Experts needed
On CF-Rooted ROM, your settings will be overwitten by /system/etc/init.cfroot.post_boot.sh .
ketut.kumajaya said:
On CF-Rooted ROM, your settings will be overwitten by /system/etc/init.cfroot.post_boot.sh .
Click to expand...
Click to collapse
imbawind , listen to him .
He is the kernel expert around here .
if ketut says this then might need to modify that init script itself
EmoBoiix3 said:
imbawind , listen to him .
He is the kernel expert around here .
Click to expand...
Click to collapse
yea, I know, thanks
ketut.kumajaya said:
On CF-Rooted ROM, your settings will be overwitten by /system/etc/init.cfroot.post_boot.sh .
Click to expand...
Click to collapse
Can I delete that file or delete all the words inside?
I saw
Code:
if [ $(propget $TWEAK_GOVERNOR_CONSERVATIVE] = "enabled" ]; then
echo conservative >/sys/devices/system/cpu/cpu0/cpufreq/scaling_governor
Isit mean that if there is a line in build.prop called
Code:
TWEAK_GOVERNOR_CONSERVATIVE=enabled
then init.cfroot.post_boot.sh will set the governor to conservative?
If I create a file with these setting :
Code:
#!/system/bin/bash
setprop TWEAK_GOVERNOR_CONSERVATIVE enabled
Will it enable the 'conservative'?
Code:
#!/system/bin/bash
setprop TWEAK_GOVERNOR_CONSERVATIVE enabled
and
Code:
#!/system/bin/bash
setprop TWEAK_GOVERNOR_CONSERVATIVE=enabled
both not working , any idea?
or can i just delete those words which interrupt my init.d script inside the init.cfroot.post_boot.sh?
Galaxy Ace have a very limited property. Use my propset/propget script to store/restore your own settings, like I have done on CF-Root and Darktremor apps2sd. Now or later setprop will make your brain hot with some strange issue (bluetooth, GPS, wifi, etc).
ketut.kumajaya said:
Galaxy Ace have a very limited property. Use my propset/propget script to store/restore your own settings, like I have done on CF-Root and Darktremor apps2sd. Now or later setprop will make your brain hot with some strange issue (bluetooth, GPS, wifi, etc).
Click to expand...
Click to collapse
what are these "propset/propget/setprop“ mean?
I found a script that adds boot audio. In it there is a line calling stagefright, stagefright either doesn't exist on my ROM and I have no clue as to add it. Here is the script in question which I don't know the original author however lithid from http://forum.cyanogenmod.org did some work on it and was close to creating a updater-script. Please Help Me as I know some scripting but not a lot
PS I was advised to ask this question to the devs by a cyanogenmod.org mod named bassmadrigal
Code:
#!/system/bin/sh
#I just made this into a script this was from a post on XDA by spiicytuna
#http://forum.xda-developers.com/showpost.php?p=8274824&postcount=2
#Please give the credit to him not me.
echo "preparing system..."
#Setting up the system for read/write access
mount -o remount,rw /system
#linking busybox mkdir (broken in rc2)
rm /system/bin/mkdir
ln -s /system/xbin/mkdir /system/bin/mkdir
mkdir -p /data/local/boot
echo "checking for previous bootsound installation..."
if [ -e /system/bin/bootsound ];
then
echo "bootsound already enabled, exiting.."
mount -o remount,ro /system
exit
fi
if [ "`ls /sbin|grep -q recovery;echo $?`" = "0" ];
then
mount -a > /dev/null
recoverymode=y
else
mount -o rw,remount /system
recoverymode=n
fi
echo "preparing startup scripts..."
#This is to create the needed scripts in init.local.rc
echo '' >> /system/etc/init.local.rc
echo '' >> /system/etc/init.local.rc
echo '###Bootsound - Safe to Delete: Start ###' >> /system/etc/init.local.rc
echo "" >> /system/etc/init.local.rc
echo 'service bootsound /system/bin/bootsound' >> /system/etc/init.local.rc
echo ' user media' >> /system/etc/init.local.rc
echo ' group audio' >> /system/etc/init.local.rc
echo ' disabled' >> /system/etc/init.local.rc
echo ' oneshot' >> /system/etc/init.local.rc
echo '' >> /system/etc/init.local.rc
echo 'on property:init.svc.bootanim=running # to correct timin' >> /system/etc/init.local.rc
echo ' start bootsound' >> /system/etc/init.local.rc
echo '' >> /system/etc/init.local.rc
echo 'on property:dev.bootcomplete=1' >> /system/etc/init.local.rc
echo ' stop bootsound' >> /system/etc/init.local.rc
echo '### Bootsound - Safe to Delete: End ###' >> /system/etc/init.local.rc
echo "creating script for bootsound in /system/bin..."
echo '#Now creating the bootsound script'
touch /system/bin/bootsound
echo '#!/system/bin/sh' >> /system/bin/bootsound
echo '' >> /system/bin/bootsound
echo 'bprop=/system/build.prop' >> /system/bin/bootsound
echo '' >> /system/bin/bootsound
echo 'play=$(cat $bprop | egrep -c -i -o ro.config.play.bootsound=1)' >> /system/bin/bootsound
echo 'if [ "$play" = "1" ]; then' >> /system/bin/bootsound
echo ' stagefright -a -o /system/media/android_audio.mp3' >> /system/bin/bootsound #this is the line that breaks the code
echo 'fi' >> /system/bin/bootsound
echo 'exit 0' >> /system/bin/bootsound
#Changing some permissions
chmod 777 /system/bin/bootsound
chown root:shell /system/bin/bootsound
echo '' >> /system/build.pro
echo 'ro.config.play.bootsound=1' >> /system/build.prop
echo 'media.stagefright.enable-player=true' >> /system/build.prop
echo 'media.stagefright.enable-meta=true' >> /system/build.prop
echo 'media.stagefright.enable-scan=true' >> /system/build.prop
echo 'media.stagefright.enable-http=true' >> /system/build.prop
#removed self-destruct, script checks for previous install
sleep 1
mount -o ro,remount /system
echo "done."
exit
ethan_hines said:
I found a script that adds boot audio. In it there is a line calling stagefright, stagefright either doesn't exist on my ROM and I have no clue as to add it. Here is the script in question which I don't know the original author however lithid from http://forum.cyanogenmod.org did some work on it and was close to creating a updater-script. Please Help Me as I know some scripting but not a lot
PS I was advised to ask this question to the devs by a cyanogenmod.org mod named bassmadrigal
Click to expand...
Click to collapse
Not sure if this works , but I will eventually try it , but not now , on my free time.
stagefright indeed is not included , my phone too doesn't have stagefright , if you go to youtube and search for android developement tutorials by "thenewboston" . you'll find 200 videos series , just watch the first 20 ones and you'll learn to use Media which replaces stagefright...I didn't try it yet.
It includes
Our_Player and Media Player and the directory of the song....check it out and give us heads ups!
thethiny said:
Not sure if this works , but I will eventually try it , but not now , on my free time.
stagefright indeed is not included , my phone too doesn't have stagefright , if you go to youtube and search for android developement tutorials by "thenewboston" . you'll find 200 videos series , just watch the first 20 ones and you'll learn to use Media which replaces stagefright...I didn't try it yet.
It includes
Our_Player and Media Player and the directory of the song....check it out and give us heads ups!
Click to expand...
Click to collapse
I appreciate the info, I took a look at his tutorials esp the ones involving animation, he really knows his stuff. I am not a Java programmer by any means and to be honest I find it quite tedious, it's like trying to teach a baby (this case the Dalvik VM) to do basic stuff like draw a green ball took like 20 lines of code!
What I need to know essentially is, do I have to use JAVA to get this to work now? In the past ie ICS and lower, there wasn't a problem with Custom Boot Audio, now with JB it seems it has disappeared from the radar.
I know the binary /system/bin/bootanimation (is this written in JAVA?, is there a source code for this bin?) is called at boot time by init.rc in the following manner:
Code:
service bootanim /system/bin/bootanimation
class main
user graphics
group graphics
disabled
oneshot
/system/bin/bootanimation (at least from what I gather) looks in /system/media for bootanimation.zip (zipped in store mode) decompresses it , looks at desc.txt for the code and displays the animation png by png.
In some desc.txt there is an s line, example:
Code:
# mobility
p 1 0 SOUND
s transdroid.mp3
which is SUPPOSED TO call a custom boot audio from /system/media (.mp3?) at the same time. This appears not to work. So logicaly I think the binary needs some tweaking. Can you offer any suggestions?
As you can see I have spent ALLOT of time mulling over why this,one would think, simple task: display a series of images and play audio at boot time I mean how hard can that be?
I am not trying to be a pest I just need to know WHY this doesn't work in JB (CM10.1)
How can I run a script with the code that I will give on kitkat , because my touchscreen get unresponsive and this script should fix it?
#!/system/bin/sh
echo 20 > /sys/devices/i2c-3/3-0024/main_ttsp_core.cyttsp4_i2c_adapter/finger_threshold
chmod 666 /sys/devices/i2c-3/3-0024/main_ttsp_core.cyttsp4_i2c_adapter/signal_disparity
echo 0 > /sys/devices/i2c-3/3-0024/main_ttsp_core.cyttsp4_i2c_adapter/signal_disparity
Dear Community, dear Developers outside..
I'm using Magisk 14.0 on a Redmi Note 4 Snapdragon and super satisfied with it.
I just want to make simple changes like changing the lowmemorykiller minfree parameters - just like an init.d script in Kernel Adiutor..
Most of the commands are effective - but some of them are not..
This is what I want to apply for example:
chmod 666 /sys/module/lowmemorykiller/parameters/minfree
chown root /sys/module/lowmemorykiller/parameters/minfree
echo '7283,14566,21849,28928,36415,43698' > /sys/module/lowmemorykiller/parameters/minfree
..but does not work..
But these, for example.. these are working just fine:
echo '30' > /proc/sys/vm/swappiness
echo '0' > /sys/module/lowmemorykiller/parameters/enable_adaptive_lmk
echo '80' > /proc/sys/vm/overcommit_ratio
echo '400' > /proc/sys/vm/vfs_cache_pressure
echo '2430' > /proc/sys/vm/extra_free_kbytes
echo '4096' > /proc/sys/kernel/random/write_wakeup_threshold
echo '1024' > /sys/block/mmcblk0/queue/read_ahead_kb
echo '0' > /sys/block/mmcblk0/queue/iostats
echo '1' > /sys/block/mmcblk0/queue/add_random
echo '1024' > /sys/block/mmcblk1/queue/read_ahead_kb
echo '0' > /sys/block/mmcblk1/queue/iostats
echo '1' > /sys/block/mmcblk1/queue/add_random
swapoff /dev/block/zram0 > /dev/null 2>&1
echo '1' > /sys/block/zram0/reset
echo '0' > /sys/block/zram0/disksize
echo '1' > /sys/block/zram0/max_comp_streams
echo '524288000' > /sys/block/zram0/disksize
mkswap /dev/block/zram0 > /dev/null 2>&1
swapon /dev/block/zram0 > /dev/null 2>&1
echo '4096' > /proc/sys/kernel/random/read_wakeup_threshold
echo '4096' > /proc/sys/vm/min_free_kbytes
echo '0' > /proc/sys/vm/oom_kill_allocating_task
echo '90' > /proc/sys/vm/dirty_ratio
echo '70' > /proc/sys/vm/dirty_background_ratio
I do know that all I have to do is to put my script to one of these dirs - depending on when I want to run the scripts:
/magisk/.core/service.d
/magisk/.core/post-fs-data.d
But, as I mentioned - most of them has effect, some of them has no..
Any comment, any suggestion is more than appreciated.
Thank you!
[SOLVED] - solution is in post #5
Desperate bump..
I searched for help docs for service.d and post-fs-data.d but counldn't find them, can I ask you when each folder is executed, also does the scripts inside them must have .sh extension or not ?
I want to restart my systemui after boot complete, can you tell me if this script is ok ?
Code:
#!system/bin/sh
sleep 20
su
pkill -l TERM -f com.android.systemui
ps : the pkill command works fine after an "su" in terminal emulator
sorry for the offtopic !
@sheraro
https://github.com/topjohnwu/Magisk/blob/master/docs/README.MD
First of all: the solution for my issue was a simple sleep 30 in the services.sh to delay the start.. and I used an auxiliary file as well to make the changes (called from services.sh with 30sec delay, copied with the update-binary file directly, set permission to 0777 via config.sh) after that is all started working..
sheraro said:
I searched for help docs for service.d and post-fs-data.d but counldn't find them, can I ask you when each folder is executed, also does the scripts inside them must have .sh extension or not ?
I want to restart my systemui after boot complete, can you tell me if this script is ok ?
Code:
#!system/bin/sh
sleep 20
su
pkill -l TERM -f com.android.systemui
ps : the pkill command works fine after an "su" in terminal emulator
sorry for the offtopic !
Click to expand...
Click to collapse
So, second thing, @sheraro, I think you should delete the command su from your script because Magisk scripts are running as root anyway and if you issue su command it will start a shell with elevated privileges - an interactive shell, not what you want here, a sudo like command.. it works in the terminal because it is interactive but in the shell script if you start su it starts an interactive shell and it halts your script because it won't exit the shell you started.. and the next command will never run.. if you know what I mean.. but you don't need it anyway, because - as I mentioned - it is running as root anyway. +1: The syntax of the shebang is bad in your example, it is missing an exclamation mark. Can you re-test it like this:
Code:
#!/system/bin/sh
sleep 20
pkill -l TERM -f com.android.systemui
exit 0
.sh extension is not needed, the thing is: you have to set the correct permission in the config.sh like this:
Code:
set_permissions() {
# Default permissions, don't remove them
set_perm_recursive $MODPATH 0 0 0777 0777
[..omitted..]
Thing is: the files must have execute priv. and you can execute them like
Code:
$MODDIR/./desiredfilename
in the services.sh script.
Hope this helps.
crok.bic said:
.sh extension is not needed, the thing is: you have to set the correct permission in the config.sh like this:
Code:
set_permissions() {
# Default permissions, don't remove them
set_perm_recursive $MODPATH 0 0 0777 0777
[..omitted..]
Thing is: the files must have execute priv. and you can execute them like
Code:
$MODDIR/./desiredfilename
in the services.sh script.
Hope this helps.
Click to expand...
Click to collapse
I'm just pasting my script in service.d only, set permissions manually to 0777, corrected !#/system typo, removed su command, but no luck...
Where's services.sh and config.sh ?
sheraro said:
I'm just pasting my script in service.d only, set permissions manually to 0777, corrected !#/system typo, removed su command, but no luck...
Where's services.sh and config.sh ?
Click to expand...
Click to collapse
Reading your comment I think you are not developing a Magisk module, do you?
I do and this is why you have no idea where is config.sh, services.sh and the others I think.
If you just want to have some kind of "init.d script" support and run the script in your own phone *only* then your script should be in the folder /magisk/.core/service.d and it should have execute permission. That's all what you need - probably the sleep 20 is not enough, increase it to sleep 30 for instance.
If this is still not enough info I would suggest to read the Magisk documentation thoroughly (linked in post #4) and if you still stuck I suggest you to open your own thread, describe your problem thoroughly (what is your goal? what would you like to achive? how did you already try? what is happening but should not or not happening but you think it should happen? you know what I mean..) and ask the community. Probably you will be able to solve your issue in minutes/hours.
I changed it to sleep 100, same problem, you're right I should create a new thread for this.
I have a theme installed that mimics oreo style, but the systemUI is not themed until it's restarted, so I thought about a script executed after boot, anyway thanks for your help
It seems that sleep will delay the run of other modules' service.sh. is there any solution that will not affect other module?
nicorg3221 said:
It seems that sleep will delay the run of other modules' service.sh. is there any solution that will not affect other module?
Click to expand...
Click to collapse
I don't experience this behavior - what you described is the post-fs-data behavior.
I did the trick with a separate ("auxiliary") file and tried to explain how in post #5 but let me try again:
- created a file in the module's common folder (I gave the name `tweak`)
- this file starts with a shebang (it's a script..) and continues with a sleep 30 then comes my commands..
- then copied the file from the module to the Magisk module directory into /magisk/$MODDIR with the module file META-INF/com/google/android/update-binary (I added it to the copy section, manually.. I know, I know, it should work automagically anyway, but did not work and I was fed up with the coding, so hardcoded it.. sorry)
- I set the default file permission to 0777 in config.sh (yes, 0777, this is loose AF but works.. and I don't really care, the file contains code that can make the device *better* and has no suid bit set, so there is only little to no room to harm anything..)
- then I included a call in my module's common/service.sh like $MODDIR/./tweak to start my script
- when the tweak script starts it will start with the sleep 30 so implements the delay.. BUT!
- Because services.sh files from the modules are called parallelly by Magisk (by default, by it's nature, by it's code.. you got it) my module does not delays others - but still has the delay.
Hope this helps.
sheraro said:
I changed it to sleep 100, same problem, you're right I should create a new thread for this.
I have a theme installed that mimics oreo style, but the systemUI is not themed until it's restarted, so I thought about a script executed after boot, anyway thanks for your help
Click to expand...
Click to collapse
Pleased to help you - but honestly, if the only task you need is to kill and restart systemUI then I would do it via init.d script run by an app that mimics init.d scripting, or using a kernel that supports init.d scripts (if only you want to use that theme). It's just less complex for you I think, but honestly, a simple script file that has execute permission in /magisk/.core/services.d/ gives you 100% the same solution.
crok.bic said:
I don't experience this behavior - what you described is the post-fs-data behavior.
I did the trick with a separate ("auxiliary") file and tried to explain how in post #5 but let me try again:
- created a file in the module's common folder (I gave the name `tweak`)
- this file starts with a shebang (it's a script..) and continues with a sleep 30 then comes my commands..
- then copied the file from the module to the Magisk module directory into /magisk/$MODDIR with the module file META-INF/com/google/android/update-binary (I added it to the copy section, manually.. I know, I know, it should work automagically anyway, but did not work and I was fed up with the coding, so hardcoded it.. sorry)
- I set the default file permission to 0777 in config.sh (yes, 0777, this is loose AF but works.. and I don't really care, the file contains code that can make the device *better* and has no suid bit set, so there is only little to no room to harm anything..)
- then I included a call in my module's common/service.sh like $MODDIR/./tweak to start my script
- when the tweak script starts it will start with the sleep 30 so implements the delay.. BUT!
- Because services.sh files from the modules are called parallelly by Magisk (by default, by it's nature, by it's code.. you got it) my module does not delays others - but still has the delay.
Hope this helps.
Click to expand...
Click to collapse
I have my script in starting in .Core. Maybe that's the problem
nicorg3221 said:
I have my script in starting in .Core. Maybe that's the problem
Click to expand...
Click to collapse
..then it is in the wrong dir.. it is clearly described in the Magisk documentation.
I have researched a bit. I think you can use getprop sys.boot_completed to check if boot is completed. We should run init.d scripts after boot is completed instead of just wait for 30/100 seconds.
I place all my init.d scripts I want to run in /magisk/.core/service.d/init.d.
Then, I have a service.d script [exec_init_d.sh] in /magisk/.core/service.d. Magisk will run exec_init_d.sh when boot.
exec_init_d.sh will wait for sys.boot_completed and run all the files in /magisk/.core/service.d/init.d after boot completed
exec_init_d.sh
Code:
#!/system/bin/sh
# Please don't hardcode /magisk/modname/... ; instead, please use $MODDIR/...
# This will make your scripts compatible even if Magisk change its mount point in the future
MODDIR=${0%/*}
# This script will be executed in late_start service mode
# More info in the main Magisk thread
if [ "$1" != "1" ]; then
$0 1 &
log -p i -t Magisk "start new instance to let Magisk boot stages proceed"
exit
fi
#param
RUNLOG=0
RETRY_INTERVAL=5 #in seconds
MAX_RETRY=60
EXEC_WAIT=3 #in seconds
INIT_D_DIR=$MODDIR/init.d
LOG_PATH=$MODDIR/debug.log
#init
retry=${MAX_RETRY}
#wait for boot completed
log -p i -t Magisk "wait for boot completed"
while (("$retry" > "0")) && [ "$(getprop sys.boot_completed)" != "1" ]; do
sleep ${RETRY_INTERVAL}
((retry--))
done
if (("$retry" == "0")); then
log -p i -t Magisk "boot not completed within maximum number of retry"
else
log -p i -t Magisk "boot completed"
fi
sleep ${EXEC_WAIT}
log -p i -t Magisk "init.d execution started from ${INIT_D_DIR}"
if (("${RUNLOG}" == "1")); then
/data/magisk/busybox run-parts $INIT_D_DIR &> $LOG_PATH
log -p i -t Magisk "init.d execution output written to $LOG_PATH"
else
/data/magisk/busybox run-parts $INIT_D_DIR
fi
log -p i -t Magisk "init.d execution completed"