Apr 6, 2013

swap on android

tinimbang ngenthong ra nggenah.... just trying improve performa on weak android :D
and do all this "tuto" with your own risk

-- needed--
- kernel support for swap ( if you don't have try to complie your kernel or find enother kernel that support it)
- rooted android
- and make it easy using adb command on your PC

most people make swap partition on their sdcard, and most people say's it slow and can reduce "sd card" life.
 on mine, i use free space on  /data partition ( have 1GB )  and create swap image in it and hope faster than on sdcard.

--creating swap image--
create swap image using dd command ( you can run this command on android or you can run faster on linux PC)
ok swap image created and formated as swap, push image to android phone ( /data/ ).

--turn on swap--
ok, swap allready on /data/swp.img. now turn it on with this command.
busybox swapon /data/swp.img

at this point swap is on ^_^

next let android automatic turn swap ON after reboot. in this case we need add script on init.d
this my simple script placed on /system/etc/init.d/91swapon

# brekele.inc ^_^ 
#Init.d runing swap 

busybox swapon /data/swp.img

Set permission to init file with :
chmod 777 /system/etc/init.d/91swapon 

test this script with reboot your device.

have fun.... :D