[Android Software/Hacking General [Developers Only]] dorimanx:
Hi,

I am chief and developer of ROM for HTC HD2!

And i am in to tweaks also!

You have made impressive work here!!!

Well done!!!

I need developer like you in my thread helping me.

I will share with you all my scripts, i also will use some of your work in my ROM if you don't mind :)

My Undervolting Script!

# pwd
/system/etc/init.d
# cat 98cpu_voltage
#!/system/bin/sh
# Created by Dorimanx

# set vdd_levels on boot by dorimanx (XDA Developers)
echo '245000 975' > /sys/devices/system/cpu/cpu0/cpufreq/vdd_levels
echo '384000 975' > /sys/devices/system/cpu/cpu0/cpufreq/vdd_levels
echo '422400 975' > /sys/devices/system/cpu/cpu0/cpufreq/vdd_levels
echo '460800 975' > /sys/devices/system/cpu/cpu0/cpufreq/vdd_levels
echo '499200 1000' > /sys/devices/system/cpu/cpu0/cpufreq/vdd_levels
echo '537600 1000' > /sys/devices/system/cpu/cpu0/cpufreq/vdd_levels
echo '576000 1025' > /sys/devices/system/cpu/cpu0/cpufreq/vdd_levels
echo '614400 1050' > /sys/devices/system/cpu/cpu0/cpufreq/vdd_levels
echo '652800 1075' > /sys/devices/system/cpu/cpu0/cpufreq/vdd_levels
echo '691200 1100' > /sys/devices/system/cpu/cpu0/cpufreq/vdd_levels
echo '729600 1125' > /sys/devices/system/cpu/cpu0/cpufreq/vdd_levels
echo '768000 1150' > /sys/devices/system/cpu/cpu0/cpufreq/vdd_levels
echo '806400 1150' > /sys/devices/system/cpu/cpu0/cpufreq/vdd_levels
echo '844800 1175' > /sys/devices/system/cpu/cpu0/cpufreq/vdd_levels
echo '883200 2000' > /sys/devices/system/cpu/cpu0/cpufreq/vdd_levels
echo '921600 1225' > /sys/devices/system/cpu/cpu0/cpufreq/vdd_levels
echo '960000 1250' > /sys/devices/system/cpu/cpu0/cpufreq/vdd_levels
echo '998400 1275' > /sys/devices/system/cpu/cpu0/cpufreq/vdd_levels
echo '1036800 1300' > /sys/devices/system/cpu/cpu0/cpufreq/vdd_levels
echo '1075200 1300' > /sys/devices/system/cpu/cpu0/cpufreq/vdd_levels
echo '1113600 1300' > /sys/devices/system/cpu/cpu0/cpufreq/vdd_levels
echo '1152000 1325' > /sys/devices/system/cpu/cpu0/cpufreq/vdd_levels
echo '1190400 1325' > /sys/devices/system/cpu/cpu0/cpufreq/vdd_levels

My OOM Killer tweaks!

# pwd
/system/etc/init.d
# cat 90ramscript
#!/system/bin/sh
# Created by Dorimanx

echo "Applying Kernel Tweaks and RAM Manipulations"
echo "512,1024,1024,2048,4096,8192" > /sys/module/lowmemorykiller/parameters/minfree
echo "512,1024,1024,2048,4096,8192" > /sys/module/lowmemorykiller/parameters/minfile
echo "2,2,4,9,12,17" > /sys/module/lowmemorykiller/parameters/adj
echo "0" > /sys/module/lowmemorykiller/parameters/debug_level
echo "64" > /sys/module/lowmemorykiller/parameters/cost
echo "DONE"

echo "Unlimiting processes and open files for system"
ulimit -n 100000
ulimit -s unlimited
echo "DONE"

My Cache Rearrange Script!

# pwd
/system/etc/init.d
# cat 95cache
#!/system/bin/sh
# Created by Dorimanx and Charan!

cache_partition=`grep cache /proc/mtd | cut -d: -f1 | sed 's/mtd/mtdblock/'`
mountpoint=`mount | grep ${cache_partition} | awk '{print $3}'`

# make / writeable so that I can modifications
mount -o rw,remount /

if [ -h /cache ] ; then
# /cache is a symbolic link
mkdir /mnt/cache
mount -t yaffs2 -o rw /dev/block/$cache_partition /mnt/cache
if [ ! -d /mnt/cache/recovery ] ; then
mkdir /mnt/cache/recovery
mv /cache/recovery/* /mnt/cache/recovery/.
fi
rm -rf /cache/recovery
ln -s /mnt/cache/recovery /cache/recovery
elif [ -d /cache ] ; then
# /cache is a directory
if [ "$mountpoint" = "/cache" ] ; then
# /cache is mounted in the right place
# do nothing, other than permissions at the end of this script
else
# the block device is not mounted or, is mounted somewhere else
umount ${mountpoint}
mkdir /mnt/cache
mount -t yaffs2 -o rw /dev/block/$cache_partition /mnt/cache
if [ ! -d /mnt/cache/recovery ] ; then
mkdir /mnt/cache/recovery
mv /cache/recovery/* /mnt/cache/recovery/.
fi
rm -rf /cache/recovery
umount /mnt/cache
rmdir /mnt/cache
mount -t yaffs2 -o rw /dev/block/$cache_partition /cache
fi
elif [ ! -e /cache ] ; then
# the /cache doesn't exist
mkdir /cache
mount -t yaffs2 -o rw /dev/block/${cache_partition} /cache

fi
# change permission to 0.0 so market place can access /cache
chown 0.0 /cache
if [ ! -e /cache/recovery ] ; then
mkdir /cache/recovery
fi

# change permission for recovery directory so
# ROM Manager and CWM can access it
chown 1000.2001 /cache/recovery
chmod 0777 /cache/ -R

My MAIN SUPER SCRIPT! :)

# pwd
/system/etc/init.d
# cat /etc/init.d/99script
#!/system/bin/sh
# Created by Dorimanx

while [ ! -e /mnt/sdcard/phonePrioritizer/script.txt ]
do
sleep 10
echo "Waiting For SDCARD to be Mounted and file /sdcard/phonePrioritizer/script.txt to be located"
done
echo "Found SDCARD and /sdcard/phonePrioritizer/script.txt file"

echo "Install busybox at first time"
if [ -e /system/xbin/crond ];
then
echo "No need to install busybox again";
else
busybox --install -s /system/xbin;
fi
echo "DONE"

echo "Fix for radio hcitool permissions, Thanks to crawling and atoore"
chown 0:0 /system/xbin/hcitool
chmod 4755 /system/xbin/hcitool
echo "DONE"

echo "Fixing init.d permissions!"
chown 1000:2000 /system/etc/init.d -R
chmod 750 /system/etc/init.d -R
echo "DONE"

echo "TWEAKS: remount all partitions with rw,noatime,nodiratime,norelatime";
PART=`mount | grep -v /mnt/asec | grep -v /acct | grep -v /dev/cpuctl | grep -v /mnt/secure/asec | cut -d " " -f3`
for k in $PART
do
sync
mount -o remount,rw,noatime,nodiratime,norelatime $k
done
echo "DONE"

echo "TWEAKS: use noop as i/o scheduler + Telling system that disk is FLASH!";
echo "Speeding the READ/WRITE speeds! And adds more controled write speed burst!"
MTD=`ls -d /sys/block/mtd*`;
MMC=`ls -d /sys/block/mmc*`;
for i in $MTD $MMC
do
echo 0 > $i/queue/rotational;
echo 20 > $i/queue/read_ahead_kb;
echo 20 > $i/queue/nr_requests;
echo cfq > $i/queue/scheduler;
echo noop > $i/queue/scheduler;
echo "2048" > /sys/devices/virtual/bdi/179:0/read_ahead_kb
echo "97" > /sys/devices/virtual/bdi/179:0/max_ratio
done
for g in /sys/block/*/queue/rotational;
do
echo 0 > $g;
done;
echo "DONE"

echo "Activating Swap EXT Partition!"
mount -o rw,remount -t yaffs2 /dev/block/mtdblock3 /system
mkswap /dev/block/mmcblk0p3
mkswap /sdcard/swap > /dev/null
echo "/dev/block/mmcblk0p3 swap swap" > /system/etc/fstab
echo "/sdcard/swap swap swap" >> /system/etc/fstab
swapon -a
free
echo "DONE"

echo "Fixing Market + Recovery + dalvik-cache Permissions!"
rm -rf /mnt/sdcard/download-market/
mkdir /mnt/sdcard/download-market/
rm -rf /cache/download
ln -s /sdcard/download-market /cache/download
rm -rf /cache/dalvik-cache
ln -s /sd-ext/dalvik-cache /cache/dalvik-cache
chmod 777 /cache -R
chown 1000:1000 /cache/dalvik-cache
chown 1000.2001 /cache/download
echo "DONE"

echo "FIXING Camera Link"
chmod 777 /sys/class/leds/flashlight/*
echo "DONE"

count=1
while [ $count -le 24 ]
do
if [ -d /mnt/secure/asec/ ]; then
echo "Found /mnt/secure/asec"
echo "TWEAKS: remount all partitions with rw,noatime,nodiratime,norelatime";
sleep 180
PARTASEC=`mount | grep /mnt/asec | cut -d " " -f3`
SYSTEM=`mount | grep /system | cut -d " " -f3`
for k in $PARTASEC $SYSTEM
do
sync
mount -o remount,rw,noatime,nodiratime,norelatime $k
done
echo "DONE"

if [ -d /sys/block/dm-0/ ]; then
echo "FOUND /sys/block/dm*/ Settings Tweaks"
for i in /sys/block/dm*/queue/iosched/quantum;
do
echo "16" > $i
done

for k in /sys/block/dm*/queue/iosched/slice_idle;
do
echo 0 > $k;
done;

for y in /sys/block/dm*/queue/iosched/back_seek_max;
do
echo "1000000000" > $y;
done;

for z in /sys/block/dm*/queue/iosched/back_seek_penalty;
do
echo 1 > $z;
done;
echo "DONE"
else
echo "NO /sys/block/dm*/ FOUND! Skipping"
fi

if [ -d /sys/block/loop0/ ]; then
echo "FOUND /sys/block/loop*/ Settings Tweaks"
for e in /sys/block/loop*/queue/read_ahead_kb;
do
echo 20 > $e;
done;
echo "DONE"
else
echo "NO /sys/block/loop*/ FOUND! Skipping"
fi

if [ -d /mnt/secure/asec/ ]; then
exit
else
count=`expr $count + 1`
echo "Count= $count"
sleep 10
fi
fi

echo "This script was been fixed by vodkinagdan and me."

done

This is my Kernel Tweaks Script!

# pwd
/system/etc
# cat sysctl.conf
# Created by Dorimanx

kernel.panic = 90
kernel.ctrl-alt-del=1
kernel.panic_on_oops=0
fs.lease-break-time=43
net.ipv4.tcp_timestamps=0

vm.overcommit_memory=0
vm.panic_on_oom=0
vm.oom_kill_allocating_task=1
vm.oom_dump_tasks=0
vm.overcommit_ratio=90
vm.page-cluster=3
vm.dirty_background_ratio=10
vm.dirty_ratio=20
vm.dirty_writeback_centisecs=100
vm.dirty_expire_centisecs=100
vm.swappiness=50
vm.lowmem_reserve_ratio=40 40
vm.drop_caches=0
vm.min_free_kbytes=4096
vm.min_free_order_shift=4
vm.percpu_pagelist_fraction=0
vm.max_map_count=200000
vm.laptop_mode=1
vm.block_dump=0
vm.vfs_cache_pressure=10
vm.mmap_min_addr=4096
vm.highmem_is_dirtyable=1
vm.scan_unevictable_pages=0

#Tweaks by zeppelinrox
kernel.sched_compat_yield=1
kernel.sched_child_runs_first=0
kernel.threads-max=5000
net.core.wmem_max=524288
net.core.rmem_max=524288
net.ipv4.tcp_tw_recycle=1
net.ipv4.tcp_rmem=6144 87380 524288
net.ipv4.tcp_wmem=6144 87380 524288

My ROM works with SWAP and phone prioritizer app that run this script every 30 minutes!

# pwd
/mnt/sdcard/phonePrioritizer
# cat script.txt
#!/system/bin/sh
# Created by Dorimanx

#This is the Dialer and launcher
HOMEAPP=$(pidof 'android.process.acore')
busybox renice -18 $HOMEAPP

#This is the ADW Launcher
busybox renice -18 `pidof com.android.launcher`

#This is the system services (do not change only if you know what you are doing!)
busybox renice -5 `pidof com.android.mms` # Text message app
busybox renice -5 `pidof com.android.browser` # Browser app
busybox renice -5 `pidof com.google.android.youtube` # YouTube app
busybox renice -5 `pidof com.google.android.apps.maps` # Maps
busybox renice 5 `pidof com.google.process.gapps`

#This is the Calling And Media Services!
busybox renice -17 `pidof com.android.phone`
busybox renice -18 `pidof android.process.media`

#This is the LOGCAT process!
logcat=$(ps | grep logcat | cut -d " " -f4)
busybox renice 10 $logcat

#This is the Full Screen Caller.
busybox renice -10 `pidof com.androminigsm.fsci`

#This is the GO SMS if dont have it just put # like this #busybox renice -14 `pidof com.jb.gosms`
busybox renice -10 `pidof com.jb.gosms`

#This is the TouchDown main Exchange app, if dont have it just put #
busybox renice -10 `pidof com.nitrodesk.droid20.nitroid`

#This is the ALLAPPS Drawler! if you dont have that i dont know how you find your stuff.
busybox renice -10 `pidof xxbcn.AllAppsOrganizerPlusB`

#This is the SEAL app, its locking app, no one can access them but you! if dont have it just put #
busybox renice -6 `pidof com.sebastian.seal`

#This is GOTO lock screen, if dont have it just put #
busybox renice -1 `pidof com.innowebtech.g0t0`

#This is the XDA Forum app :)
busybox renice -1 `pidof com.quoord.tapatalkxdapre.activity`

#slide it keyboard
busybox renice -5 `pidof com.dasur.slideit`

#This is Gallery
busybox renice -2 `pidof com.cooliris.media`

#Add your app here! use the same string! busybox renice -12 `pidof YOUR APP PACKAGE NAME`
#If app if very fast you can lower the -12 to -8 or -5 it's will be shown nicely!

My build.prop tweaks!

ro.media.enc.file.format = 3gp,mp4
ro.media.enc.vid.codec = m4v,h263
ro.media.enc.vid.h263.width = 176,800
ro.media.enc.vid.h263.height = 144,480
ro.media.enc.vid.h263.bps = 64000,60000000
ro.media.enc.vid.h263.fps = 1,30
ro.media.enc.vid.m4v.width = 176,1280
ro.media.enc.vid.m4v.height = 144,720
ro.media.enc.vid.m4v.bps = 64000,60000000
ro.media.enc.vid.m4v.fps = 1,30

#
# Increase SKIA decode memory capability for progressive jpg file
#
ro.media.dec.jpeg.memcap = 100000000

# Release Bluetooth HW/SW information
ro.bt.chipset = Broadcom BCM4329-B1
ro.bt.version = Bluetooth 2.1 + EDR
ro.bt.stack = Broadcom BTL-A
ro.bt.stack.version = 2.0.50.032
#0x10000010010100100000011 represent bt profile list
ro.bt.profiles = 4270339

# Properties of BTLA stack
service.brcm.bt.activation = 0
service.brcm.bt.srv_active = 0
service.brcm.bt.hcid_active = 0
service.brcm_bt.btld = 0
service.brcm.bt.btld_pid = 0
service.brcm.bt.avrcp_pass_thru = 0
service.brcm.bt.avrcp_toggle = 1

# DNS
net.dns1=8.8.8.8
net.dns2=8.8.4.4
net.ppp0.dns1=8.8.8.8
net.ppp0.dns2=8.8.4.4

#
# ADDITIONAL_BUILD_PROPERTIES
#
media.stagefright.enable-player=true
media.stagefright.enable-meta=true
media.stagefright.enable-scan=true
media.stagefright.enable-http=true
rild.libpath=/system/lib/libhtc_ril.so

# For auto backlight default value
settings.display.autobacklight=1

# default value of brightness
settings.display.brightness=155

#fix apps that need to connect to a server that Force Close
ro.kernel.android.checkjni=0

#DORIMANX TWEAKS!
ro.telephony.call_ring.delay=800
mot.proximity.delay=200
ro.lge.proximity.delay=200
ro.wifi.channels=14
dalvik.vm.heapsize=128m
windowsmgr.max_events_per_sec=240
wifi.supplicant_scan_interval=60

debug.fb.rgb565=0
ro.ril.avoid.pdp.overlap=1
persist.sys.shutdown.mode=hibernate
media.a1026.nsForVoiceRec=0
media.a1026.enableA1026=1
ro.setupwizard.mode=OPTIONAL
dalvik.vm.execution-mode=int:jit

ro.FOREGROUND_APP_ADJ=0
ro.VISIBLE_APP_ADJ=1
ro.PERCEPTIBLE_APP_ADJ=3
ro.HEAVY_WEIGHT_APP_ADJ=3
ro.SECONDARY_SERVER_ADJ=2
ro.BACKUP_APP_ADJ=3
ro.HOME_APP_ADJ=1
ro.HIDDEN_APP_MIN_ADJ=25
ro.CONTENT_PROVIDER_ADJ=15
ro.EMPTY_APP_ADJ=17

# Define the memory thresholds at which the above process classes will
# be killed. These numbers are in pages (4k).

ro.HOME_APP_MEM=512

WARNING!!!!

This setting will overload the default OOM task killer and allow to manually kill only the unneeded tasks all the rest will stay in RAM all the time,

ro.HIDDEN_APP_MIN_ADJ=25

So your Launcher protection is not needed any more,

And in my ROM it's not working!

The oom is set to 4 or 8 after 2 seconds when i open any app, and launcher goes to background.

and default task manager will kill all big apps when you reach 40 services in RAM, and it dont care about OOM_ADJ setting!

Sorry to disappoint you.

My task killer override also disable this limit and i can load to ram 60 services and more using SWAP as backup RAM.

Hope to hear from you on my thread,

Check my signature! :)

You can use any of my work :)

Ask me all you want, i will follow your tread!