[Nexus 7 Android Development] juaners0n:
Hi, this is my very first comment. I want to say thank you for this awesome rom, and I want to share how to get init.d support (courtesy of ramast_) and increase the zram. Also, you can play with swappiness if you want, by just uncomment the last line (100 is the default value). This is the procedure to get 400 mb of zram (default is 256 mb):

ZRAM:

1)

su

mount -o rw,remount /system

cd /system/etc/init

ls (choose any file you want to copy)

cp lmkd.rc init_d.rc

2)

edit the file init_d.rc with the following text:

service init_d /system/bin/sh /system/bin/sysinit

user root

group root

disabled

oneshot

seclabel u:r:sudaemon:s0

on property:sys.boot_completed=1 && property:sys.logbootcomplete=1

start init_d

3)

cd /system/etc/init.d

ls (choose any file you want to copy)

cp 00banner 01zram

4)

edit the file 01zram with the following text:

#!/system/bin/sh

swapoff /dev/block/zram0 > /dev/null 2>&1;

echo '1' > /sys/block/zram0/reset;

echo '0' > /sys/block/zram0/disksize;

echo '1' > /sys/block/zram0/max_comp_streams;

echo $((400*1024*1024)) > /sys/block/zram0/disksize;

mkswap /dev/block/zram0 > /dev/null 2>&1;

swapon /dev/block/zram0 > /dev/null 2>&1;

#sysctl -w vm.swappiness=100;

5)

reboot the system and...

after every reboot, just wait a couple of minutes until changes are applied in background, then enjoy.

6)

check if is working in the file /proc/last_kmsg

by searching for: zram and init_d

note results like this:

[ 2.782377] zram: Created 1 device(s) ...

[ 8.181739] init: (Parsing /system/etc/init/init_d.rc took 0.00s.)

[ 8.197899] zram0: detected capacity change from 0 to 268435456

[ 8.251334] Adding 262140k swap on /dev/block/zram0. Priority:-1 extents:1 across:262140k SS

[ 74.423015] init: Starting service 'init_d'...

[ 181.702790] zram0: detected capacity change from 268435456 to 0

[ 181.704414] zram0: detected capacity change from 0 to 419430400

[ 181.924740] Adding 409596k swap on /dev/block/zram0. Priority:-1 extents:1 across:409596k SS

[ 182.246835] init: Service 'init_d' (pid 1136) exited with status 0

optional check (if available):

zramctl /dev/block/zram0

7)

if you want revert the changes:

su

mount -o rw,remount /system

rm /system/etc/init.d/01zram

BONUS:

SWAP FILE (STATIC):

su

dd if=/dev/zero of=/data/swapfile bs=1m count=400 && chmod 0600 /data/swapfile && mkswap /data/swapfile && swapon /data/swapfile

... just wait the output, it take about 30 seconds to finish

then make the autostart script for the swap file:

mount -o rw,remount /system

cd /system/etc/init.d

ls (choose any file you want to copy)

cp 00banner 02swap

edit the file 02swap with the following text:

#!/system/bin/sh

swapon /data/swapfile;

reboot the system

if you want revert the changes:

su

mount -o rw,remount /system

swapoff /data/swapfile && rm /data/swapfile && rm /system/etc/init.d/02swap

ZRAM AND SWAP WORKING TOGETHER, USAGE AND PRIORITY:

Check the file /proc/swaps

or in terminal:

cat /proc/swaps

Example of 400 mb zram partition + 400 mb swap file:

Filename Type Size Used Priority

/dev/block/zram0 partition 409596 260852 -1

/data/swapfile file 409596 0 -2

then, waching a youtube video in chrome:

/dev/block/zram0 409596 406120 -1

/data/swapfile 409596 72624 -2

SUCCESS:

All working as expected + no killed background apps.