Active Topics

 


Reply
Thread Tools
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, 220 views)
 

The Following 5 Users Say Thank You to maacruz For This Useful Post:
Posts: 755 | Thanked: 406 times | Joined on Feb 2008 @ UK
#2
Could be a useful little hack.

You say plugging in a usb cable works, but you can't remove the memory card manually? - isn't the tablet using a similar method to temporarily turn off the swap when it provides access to the memory cards via usb as it does when a memory card is removed?
 
Posts: 1,101 | Thanked: 1,185 times | Joined on Aug 2008 @ Spain
#3
You say plugging in a usb cable works, but you can't remove the memory card manually? - isn't the tablet using a similar method to temporarily turn off the swap when it provides access to the memory cards via usb as it does when a memory card is removed?
Since I'm only using it when booting from mmc I haven't tested, but if the tablet uses the same method it would work. I had not thought about it so I automatically leaned to the safe side.
 
Posts: 17 | Thanked: 1 time | Joined on Jun 2009
#4
I had made .swap in mmc1 ,size is 128MB.
and to copy external-swap-hack to /etc.
but reboot N810.
the message is display:
"Virtual memory file corrupted and disabled
Use the Memory applet in the Control panel to enable it"
Why?
help me ,please
 
Posts: 17 | Thanked: 1 time | Joined on Jun 2009
#5
up to top.
thank for help
 
Reply

Tags
hack, mmc boot, swap


 
Forum Jump


All times are GMT. The time now is 07:17.