Quantcast
Channel: xda-developers - Android Software and Hacking General [Developers Only]
Viewing all articles
Browse latest Browse all 3614

[Tut] Fast Change Kernel Paramteres

$
0
0
This is a very simple guide for build a script that manipulates the kernel parameters. Using SManager we will add it on us home or dock.
No specific skills are required, only patient.

What You Need:

- Root Permissions
- a customizable kernel
- SManager & SMWidgets
- Busybox

------------------------------------------------

1) First make your personal script for manipulating the kernel parameters.
Make a new file without extension on your computer and open it with a text editor
a) write this two line (IMPORTANT !!!)

#!/system/bin/sh
busybox mount -o remount,rw /system

the first line is the standard initialization of a sh script in Linux-Unix system. The second line allows the writing of the file system.

b) Now add the code. All the kernel parameters are text file located in the /sys/ folder. Is possible to edit such parameters writing

echo NEWVALUE > / PATH / OF / THE / DESTINATION / PARAMETER

for example, for changing the minimum frequency

# CPU Min Freq
echo 700000 > /sys/devices/system/cpu/cpu0/cpufreq/scaling_min_freq

In sh scripts the line with # symbol won't be execute, so you can write whatever you wants.

c) The most important parameters are located in:

# CPU Min Freq
/sys/devices/system/cpu/cpu0/cpufreq/scaling_min_freq

# CPU Max Freq
/sys/devices/system/cpu/cpu0/cpufreq/scaling_max_freq

# CPU Governor
/sys/devices/system/cpu/cpu0/cpufreq/scaling_governor

# IO Scheduler (ALL THIS PARAMETERS MUST BE CHANGED FOR THE SCHEDULER)
/sys/block/mmcblk0/queue/scheduler
/sys/block/mmcblk0boot0/queue/scheduler
/sys/block/mmcblk0boot1/queue/scheduler
/sys/block/mtdblock0/queue/scheduler

I attached a simple script in this form here. You can found other parameters here, or A complete documentation of a kernel linux here. Other scripts and information about the Android kernel can be found here, here. A complete documentation of a kernel linux is here

BE CAREFUL WITH EDITING KERNEL PARAMETERS. ALWAYS READ THE DOCUMENTATION OF YOUR KERNEL AND CHECK THE PARAMETERS

d) Add this line at the end of the file for remount the system folder as read-able only

busybox mount -o remount,ro /system

now your script is done.
You can check and control the parameters by typing on the terminal or via ADB

cat / PATH / OF / THE / PARAMETER / YOU / ARE / CHECKING

------------------------------------------------

2) push the file on your phone. Set executable permission of file with an explorer or with chmod comand. Now open SManager, navigate to the path of the script and add it on its database. You can check it and test if everything works fine.
------------------------------------------------

3) the last step consists to add the shortcut of the script your home. With the most advanced launcher you can change the icon and the name and personalize it.

------------------------------------------------

4) optional: after the execution of the script with SWmanager the terminal will be open. To automatically return on the home you must add at the end of the script a line with the activity of your launcher related to the home button (this is a method I found, if someone has a better idea please tell me ;))

For Nova Launcher the code is:

am start -a android.intent.action.MAIN -n com.teslacoilsw.launcher/com.android.launcher2.Launcher

The method is used to found this activity was:

a) Open an app, and then return the to the home by pusching the central button
b) With the terminal emulator, or via adb, launch the logcat command
c) look for the last activity related to your launcher
d) replace the part after the -n with the string you have found

------------------------------------------------

All is done, if you have questions or some advice please contact me.
...The english will improve during my android experience :angel:

Attached Files
File Type: zip Scripts.zip - [Click for QR Code] (1.2 KB)

Viewing all articles
Browse latest Browse all 3614

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>