Archive for January 12th, 2006

Adding swap, and adding a menu entry to activate it

I followed the instructions given in this blog, and added a swap file on my removable card to try to improve the perfomance of the system.

All the following steps are done in the Nokia 770.

I created a script at /root/addswap with these contents:


#!/bin/sh
mkswap /media/mmc1/swap 24576
swapon /media/mmc1/swap

I am wondering if the often writings due to swapping can damage the removable card (indeed, I asked about that in the maemo-developers mailing list). So, I created also a script /root/delswap, with these contents:


#!/bin/sh
swapoff /media/mmc1/swap

I pretend to execute these scripts as a normal user, creating an entry in the menus. So, I added the scripts to the /etc/sudoers file. I added these lines:


user ALL = NOPASSWD: /root/addswap
user ALL = NOPASSWD: /root/delswap

Now, they can be executed as a non-root user using sudo. For example, sudo /root/addswap. Create two scripts /root/addswap_user and /root/delswap_user containing sudo /root/addswap and sudo /root/delswap. Give execution permissions (with chmod a+x script_name) to all the scripts.

Next step is to add the scripts to the main menu, to add or remove swap with a point and click.

Go to /var/lib/install/etc/others-menu/extra_applications, and create two files. First addswap.desktop containing


[Desktop Entry]
Encoding=UTF-8
Version=1.0
Type=Application
Name=Add swap
Exec=/root/addswap_user
X-HildonDesk-ShowInToolbar=true
X-Osso-Type=application/x-executable

and delswap.desktop containing


[Desktop Entry]
Encoding=UTF-8
Version=1.0
Type=Application
Name=Remove swap
Exec=/root/delswap_user
X-HildonDesk-ShowInToolbar=true
X-Osso-Type=application/x-executable

Now you have the opportunity of turning on and off the swap just clicking in the applications menu.

I made some tests. With these applications open, the perfomance was very good (take a look at the output of the free command).

1 comment January 12th, 2006

Non-HID bluetooth keyboards working!

18 comments January 12th, 2006


What's this?

This is a blog about the new Nokia 770. It will show tricks, hacks, reviews, etc about this impressive gadget. Comments and feedback are welcome.

You can contact me at isra _at_ herraiz.org, or just leaving a comment in any post.

Calendar

January 2006
M T W T F S S
« Dec   Feb »
 1
2345678
9101112131415
16171819202122
23242526272829
3031  

Posts by Month

Posts by Category

Valid XHTML
Valid CSS
No-www.org