View Single Post
Posts: 1,101 | Thanked: 1,185 times | Joined on Aug 2008 @ Spain
#1
Hi all,
I have managed to put the swap file in the external mmc fat partition and make it work like the default in the internal mmc.
This is only recommended when booting from mmc, as it requires editing a couple of startup scripts, and you can't remove the mmc. Doing it when booting from flash and then removing the mmc will have quite an ill effect if the swap file is not previously disabled. If you use brontide's hack (see http://www.internettablettalk.com/fo...ad.php?t=22408) this is highly recommended, as the increased swappiness may wear the flash memory much faster.
The mount/umount and control of mmc and swap is done by the daemon ke-recv (recently opensourced). This daemon has some provisions to put the swap file in the external mmc, but unfortunately it is not finished and will not work easily. The right thing to do is to finish the ke-recv implementation, along with the control panel applet (is the later closed source?), this is nothing but an ugly hack with some enviroment variables and startup scripts, but it works.

Edit /etc/osso-af-init/af-defines.sh, go to the end of the file, and just after the last "export" line (line 140) and before the "fi" line the following lines:
Code:
  # put swap in external mmc
  export OSSO_SWAP=$MMC_MOUNTPOINT
  # ke-recv doesn't honor OSSO_SWAP
  export INTERNAL_MMC_SWAP_LOCATION=$MMC_MOUNTPOINT
Edit /etc/init.d/ke-recv
Look for the lines:
Code:
        echo "$NAME."
        ;;
  stop)
        echo -n "Stopping $DESC: "
Add BEFORE the "echo $NAME" line the following lines:
Code:
        # workaround for swap in external mmc, wait for swap file to appear
        (COUNT=0
        while [[ ! -e "$OSSO_SWAP/.swap" ]] && [[ $COUNT -lt 30 ]]; do
        sleep 1
        let COUNT+=1
        done
        [[ -e "$OSSO_SWAP/.swap" ]] && /sbin/swapon "$OSSO_SWAP/.swap")&
Add AFTER the "echo -n Stopping $DESC" line the following:
Code:
        # workaround: turn off swap because if swap is in external mmc ke-recv will fail to umount mmc
        [[ -e "$OSSO_SWAP/.swap" ]] && /sbin/swapoff "$OSSO_SWAP/.swap"
Reboot after saving the files. Now you can use the control panel applet to control the swap file in the usual way, but it will be located in the external mmc. Plugging the usb cable will also have the same effect it has when the swap file is in the internal mmc.
This has been tested in a N810 running Diablo.
Attached Files
File Type: gz external-swap-hack.tar.gz (3.0 KB, 221 views)
 

The Following 5 Users Say Thank You to maacruz For This Useful Post: