BGS 19 Oktober 2013

Goes Himax Pure II init.d script tweaks

Project : Goes Himax Pure II init.d script tweaks
Realease : 54goes v3 by bagoes.s on HimaxPureII
Code :


#!/system/bin/sh
# =====
# 54goes v3 by bagoes.s on HimaxPureII
# =====

# =====
# knzo Collection tweak script
# =====

# battery tweaks
echo "500" > /proc/sys/vm/dirty_expire_centisecs
echo "1000" > /proc/sys/vm/dirty_writeback_centisecs
# EXT4 tweaks (greatly increase I/O) (needs /system, /cache, /data partitions formatted to EXT4)
# a) removes journalism
tune2fs -o journal_data_writeback /block/path/to/system
tune2fs -O ^has_journal /block/path/to/system
tune2fs -o journal_data_writeback /block/path/to/cache
tune2fs -O ^has_journal /block/path/to/cache
tune2fs -o journal_data_writeback /block/path/to/data
tune2fs -O ^has_journal /block/path/to/data
# b) perfect mount options
busybox mount -o remount,noatime,noauto_da_alloc,nodiratime,barrier=0,nobh /system
busybox mount -o remount,noatime,noauto_da_alloc,nosuid,nodev,nodiratime,barrier=0,nobh /data
busybox mount -o remount,noatime,noauto_da_alloc,nosuid,nodev,nodiratime,barrier=0,nobh /cache
# Flags blocks as non-rotational and increases cache size
LOOP=`ls -d /sys/block/loop*`;
RAM=`ls -d /sys/block/ram*`;
for j in $LOOP $RAM
do
echo "0" > $j/queue/rotational;
echo "2048" > $j/queue/read_ahead_kb;
done
MMC=`ls -d /sys/block/mmc*`;
for q in $MMC
do
#    echo "deadline" > $q/queue/scheduler;
#    echo "512" > $q/queue/read_ahead_kb;
    echo "0" > $q/queue/rotational;
    echo "1" > $q/queue/iosched/fifo_batch;
    echo "1" > $q/queue/iosched/low_latency;
    echo "1" > $q/queue/iosched/back_seek_penalty;
    echo "1000000000" > $q/queue/iosched/back_seek_max;
    echo "3" > $q/queue/iosched/slice_idle;
    echo "16" > $q/queue/iosched/quantum
    echo "512" > $q/queue/nr_requests;
done
# microSD card speed tweak
echo "2048" > /sys/devices/virtual/bdi/179:0/read_ahead_kb;
# Defrags database files
for i in \
`find /data -iname "*.db"`
do \
sqlite3 $i 'VACUUM;';
done
# Move dalvik-cache to cache partition (if it's big enough) to free up data partition space
CACHESIZE=$(df -k /cache | tail -n1 | tr -s ' ' | cut -d ' ' -f2)
if [ $CACHESIZE -gt 80000 ]
    then
    echo "Large cache detected, moving dalvik-cache to /cache"
    if [ ! -d /cache/dalvik-cache ]
        then
        busybox rm -rf /cache/dalvik-cache /data/dalvik-cache
        mkdir /cache/dalvik-cache /data/dalvik-cache
        fi

    busybox chown 1000:1000 /cache/dalvik-cache
    busybox chmod 0771 /cache/dalvik-cache

    # bind mount dalvik-cache so we can still boot without the sdcard
    busybox mount -o bind /cache/dalvik-cache /data/dalvik-cache
    busybox chown 1000:1000 /data/dalvik-cache
    busybox chmod 0771 /data/dalvik-cache
    else
    echo "Small cache detected, dalvik-cache will remain on /data"
fi
# Disable normalize sleeper
mount -t debugfs none /sys/kernel/debug
echo NO_NORMALIZED_SLEEPER > /sys/kernel/debug/sched_features

# ======
# Touchscreen (Slaid480) # Configure touchscreen sensitivity # Sensitive(Chainfire)
# ======

echo "7035" > /sys/class/touch/switch/set_touchscreen;
echo "8002" > /sys/class/touch/switch/set_touchscreen;
echo "11000" > /sys/class/touch/switch/set_touchscreen;
echo "13060" > /sys/class/touch/switch/set_touchscreen;
echo "14005" > /sys/class/touch/switch/set_touchscreen;

# =====
# Optimize SQlite databases of apps
# =====

echo "";
echo "*********************************************";
echo "Optimizing and defragging your database files (*.db)";
echo "Ignore the 'database disk image is malformed' error";
echo "Ignore the 'no such collation sequence' error";
echo "*********************************************";
echo "";

for i in \
`busybox find /data -iname "*.db"`;
do \
    /system/xbin/sqlite3 $i 'VACUUM;';
    /system/xbin/sqlite3 $i 'REINDEX;';
done;

if [ -d "/dbdata" ]; then
    for i in \
    `busybox find /dbdata -iname "*.db"`;
    do \
        /system/xbin/sqlite3 $i 'VACUUM;';
        /system/xbin/sqlite3 $i 'REINDEX;';
    done;
fi;


if [ -d "/datadata" ]; then
    for i in \
    `busybox find /datadata -iname "*.db"`;
    do \
        /system/xbin/sqlite3 $i 'VACUUM;';
        /system/xbin/sqlite3 $i 'REINDEX;';
    done;
fi;


for i in \
`busybox find /sdcard -iname "*.db"`;
do \
    /system/xbin/sqlite3 $i 'VACUUM;';
    /system/xbin/sqlite3 $i 'REINDEX;';
  
# =====
# sqlite tweaks
# =====

busybox mount -o remount,rw -t auto /system;
busybox mount -o remount,rw -t auto /data;
busybox mount -o remount,rw -t auto /sys;
busybox mount -o remount,rw -t auto /proc;

if [ -f /data/system/packages.xml ];
    then
    for i in `busybox find /data -iname "*.db"`;    do
        /system/xbin/sqlite3 $i 'PRAGMA journal_mode = WAL;';
    done;
else
    echo "May Need To Reboot after first boot for WAL to take effect";
fi;

if [ -f /data/system/packages.xml ];
    then
    for i in `busybox find /data -iname "*.db"`;    do
        /system/xbin/sqlite3 $i 'PRAGMA temp_store = MEMORY;';
    done;
else
    echo "May Need To Reboot after first boot for WAL to take effect";
fi;

if [ -f /data/system/packages.xml ];
    then
    for i in `busybox find /data -iname "*.db"`;    do
        /system/xbin/sqlite3 $i 'PRAGMA count_changes = OFF;';
    done;
else
    echo "May Need To Reboot after first boot for WAL to take effect";
fi;

if [ -f /data/system/packages.xml ];
    then
    for i in `busybox find /data -iname "*.db"`;    do
        /system/xbin/sqlite3 $i 'PRAGMA synchronous = OFF;';
    done;
else
    echo "May Need To Reboot after first boot for WAL to take effect";
fi;

if [ -f /data/system/packages.xml ];
    then
    for i in `busybox find /data -iname "*.db"`;    do
        /system/xbin/sqlite3 $i 'PRAGMA auto_vacuum = FULL;';
    done;
else
    echo "May Need To Reboot after first boot for WAL to take effect";
fi;

if [ -f /data/system/packages.xml ];
    then
    for i in `busybox find /data -iname "*.db"`;    do
        /system/xbin/sqlite3 $i 'PRAGMA wal_autocheckpoint = 0;';
    done;
else
    echo "May Need To Reboot after first boot for WAL to take effect";
fi;

# =====
# Cleaner Copyright (c) 2011 Leonard Luangga
# =====

#remove cache, tmp, and unused files
rm -f /cache/*.apk
rm -f /cache/*.tmp
rm -f /data/dalvik-cache/*.apk
rm -f /data/dalvik-cache/*.tmp

if [ -e /data/system/userbehavior.db ]
then
  rm -f /data/system/userbehavior.db
fi

if [ -d /data/system/usagestats ]
then
  chmod 400 /data/system/usagestats
fi

if [ -d /data/system/appusagestats ]
then
  chmod 400 /data/system/appusagestats
fi


# Remove logger
rm /dev/log/main

#remove main log
if [ -e /dev/log/main ]
then
  rm -f /dev/log/main
fi
 

Tidak ada komentar:

Posting Komentar

Terima kasih telah berkunjung dan membaca artikel ini. Silahkan berikan saran dan pertanyaan di kolom berikut ini.