[Galaxy Ace II Android Development] Rox:
How to play with kernel

Here are some intructions/tips about how to play with the kernel.

Terminal is needed.

If you want to change the values,it needs su permission.

If you get 'Permisson denied',you need su permisson.

If the devices lost responses,hold power button 8s to reboot.

Simply,You can cd to the folder first,then do echos.

Then `???` stands for the number to input

Boot time

RoXSel boots faster than stock normally.

4.2.2

Stock: 8600ms - 8800ms
RoXSel: 8400ms - 8600ms

Report other versions !!

How to check boottime?

cat /d/boottime/summary

CPU Governors

OndemandQ ( Default )

Ondemand

Performance

Hotplug

SmartAss2

Lionhearth

Lulzativeq

Powersave

Intellidemand

Lagfree

Lazy

Interactive

Conservetive

Userspace

* Personaly,I use OnDemand(Q)

* OndemandQ is a new governor. It will hotplug cpu when screen turns off only.

* If you mind the battery life time,choose HotPlug. It hotplugs cpu frequently.

* LulzactiveQ, it will hotplug cpus

CPU Freqs

On JB,we cannot tweak min/max scale freqs via apps like SetCPU.

Here is the method.

cd /sys/power

For example: set 400Mhz as max limited

echo 400000 > cpufreq_max_limit

* When you switch on/off power saving mode, this tweak will be overrided.

IO schedulers

Noop ( Default )

Deadline

Cfq

Bfq

Row

Zen

Sio

Vr

* Personally, i use Zen

Frandom Module

Use CrossBeeder to enable frandom.

Deepest sleep state

Stock: 3 Default: 3

Deepest supported is 5.

To change:

echo 5 > /d/cpuidle/deepest_state

* PegasusQ ( hotplug governors ) works badly with 5

* OnDemand works well with 5

* Please note that it wont increase the using time but standby time.

To check the cpuidle state:

cat /d/cpuidle/stats

USB VBus

( v2+ )

This can enable the internal vbus power supply for usb devices.

But the phone still cannot recognize our usb devices now.

You can use it for fun,like charging for other devices, using usb fan...

To enable :

cd /sys/kernel/abb-regu
echo 1 > VOTG

* Say 0 to VOTG to disable

* Plug yoru cable first,then enable it

zRAM

zRAM is optimized for Android.

It is not lazy anymore.

Using zRAM will take a little CPU,because it needs to compress/decompress memory.

Recommended compressing about 18% of RAM,about 100mb

Setup disksize first: (example: 96mb= 96×1024×1024)

echo 100663296 > /sys/block/zram0/disksize

* Larger size more RAM will be compressed.

* Too large size might make phone lag

Enable:

mkswap /dev/block/zram0
swapon /dev/block/zram0

To check how many does it use:

cat /sys/block/zram0/num_reads
cat /sys/block/zram0/num_writes

* You can get other info in its sysfs

Swap

Format/resize your SdCard via computer first.

Enable:

mkswap /dev/block/mmcblk1p1
swapon /dev/block/mmcblk1p1

Init.d script

Put some scripts (any name you like) in init.d folder with permisson 0777 (rwxrwxrwx) (at least has read and exec permission)

Scripts with right permisson will be runned when system boots.

Charger control

Please note that this control can damage your battery/phone.

If your battery/phone damaged,read the top of #1 post.

Lower current makes the charging longer,but protects battery.

Too high current can burn your battery!

I recommend you that dont set the max limited current over 900mA.

AC Maximum current: (stock: 600 , min: 0 , max: 900) mA

echo ??? > /sys/kernel/abb-charger/max_ac_c

USB Maximum current: (stock: 600 , min: 0 , max: 900) mA

echo ??? > /sys/kernel/abb-charger/max_usb_c

* The control only accepts values like 0, 100, 200 ...

* Set usb current to 0,the phone wont charge in usb port,but transmits data.

Track driver memory [advanced] :

cat /sys/kernel/abb-charger/stats

To get the charging current:

When you plug charger:

dmesg | grep -i ab8500-charger

Real charged notification

To be honest,it needs to check manually.

cat /sys/module/abb_chargalg/parameters/eoc_status

* You can use Rootexplorer to view this file.

* When it says "First full charging reached",then the UI should show you charged 100%

But it is not the real full charged.

* When it says it is the real full charged,you can unplug the charger.

* When you are charging and do a reboot will reset the counter.

* According to my experiments,it needs 1-2 hours to charge to real full.

MMC SIP CRC

( v2+ )

Disabling SPI CRC can improve mmc performance (10% ~ 30%)

But phone may freeze randomly

echo 0 > /sys/module/mmc_core/parameters/use_spi_crc

Camera LED Flash

( v2+ )

HIghlight mode for assistive light, enabling this for a long time will heat up your device, be careful!

Enable:

echo 1 > /sys/class/camera/flash/highlight

Disable:

echo 0 > /sys/class/camera/flash/highlight

Fsync Control

Get current status:

cat /sys/kernel/fsync/mode

FSYNC modes:

0: fsync on
1: fsync off
2: fsync dyn

Disable FSYNC:

echo 1 > /sys/kernel/fsync/mode

* Disabling fsync can improve io performace,

but it can make the data which hasnt been written lose when a sudden poweroff comes.

* Disabling fsync or enabling dyn_fsync will make param driver fail to store data

That means your "reboot recovery" will fail.

Enable Dynamic FSYNC:

echo 2 > /sys/kernel/fsync/mode

* Dynamic fsync will sync all buffers when screen turns off,

* If there is a heavy io load,the screen might get stuck for seconds.

* This is an experimental feature.

Mali GPU

Mali debug level

Disabling can speed up a bit

echo 0 > /sys/module/mali/parameters/mali_debug_level

* Higher level,more messages will be printed in dmesg, system will slow down

Mali L2 max reads control: (Stock:28kb,Default:48kb(max))

echo xx > /sys/module/mali/parameters/mali_l2_max_reads

* Some values will slow down graphics

* If not sure,keep default

Mali PM sampling rate: (Default: 1000ms)

echo xx > /sys/module/mali/parameters/mali_pm_sampling_rate

Mali PP scheduler tweaks: (Default: disable)

echo 1 > /sys/module/mali/parameters/mali_pp_scheduler_balance_jobs

* Enabling this,Some places will over ahead,choose by your self

Mali Utilization sampling rate: (Stock:500ms,Default:1000ms)

How often report a mali utilization.

echo xxx > /sys/module/mali/parameters/mali_utilization_sampling_rate

* Keep this default if unsure.

Mali Utilization control

(Default: low_to_high 192 high_to_low 64)

Our driver will report a mali utilization frequently.

This utilization(range: 0~255) means the load of mali.

If utilization is bigger than low_to_high ,driver will request higher hardware performance(highest APE/DDR OPP).

If utilization is smaller than high_to_low ,the driver will store the requested OPP(uses low OPP).

OPP can be understood as freq simply.

To check mali utilization values:

echo 5 > /sys/module/mali/parameters/mali_debug_level

cat /proc/kmsg | grep -i utilization

When it says SIGNAL_HIGH,it will request highest OPP.

When it says SIGNAL_LOW,it will request lowest OPP.

Press Ctrl+C to stop printing.

You can reduce low_to_high to trigger higher OPP requirement.

For smoothness and less powersaving:

Set low_to_high between 100-192.

echo 120 > mali_utilization_low_to_high

Mali max preemptive allocated max memory size:

Default is 16mb(16*1024*1024), bigger max size more throughput.

But when this value is too big, no more throughput.

For example: 48mb = 48*1024*1024

echo 50331648 > /sys/module/mali/parameters/pre_allocated_memory_size_max

EGL Driver

To use Mali hardware egl driver only:

Edit /system/lib/egl.cfg

0 0 android
0 1 mali

To

0 0 mali

Then remove libGLES_android.so

* Recommend to backup these files

* According to my feelings: after disabling sw egl driver,UI is faster

Logcat

Well,we have made android logger(logcat) as module to free more RAM.

Some guys request logcat.

Now we provide you a workaround:

Create a new init.d script:

#!/system/bin/sh
insmod /system/lib/modules/logger.ko

or

Flash this ZIP

Then you can use logcat command.

Almost tweaks will be restored to default after reboots.

So you can make your tweaks as init.d scripts to apply them when boots. :D