Saturday, April 28, 2007

Partition SD card and create swap file

If you are gonna compile software on your zaurus, you should set up a swap file.

Swap file must be on a ext3 partition, if you don't want the whole card to be formatted as ext3, then you need to partition the card.

1. Make sure the SD card is unmounted.
#umount /mnt/card

2. Partition the SD card by cfdisk.
#cfdisk /dev/mmcd/disc0/disc
Set both partitions to primary, first partition type is 06 (FAT), second partition type is 83 (Linux). Then write and exit.


3. Format the partitions.
#mkfs.vfat /dev/mmcd/disc0/part1
#mkfs.ext3 /dev/mmcd/disc0/part2

4. Create swap file.
#mkdir /mnt/swap
#mount -t ext3 /dev/mmcd/disc0/part2 /mnt/swap
#cd /mnt/swap
#dd if=/dev/zero of=swapfile bs=1M count=64
#mkswap swapfile
A 64MB swap file will be created, changing the count value will change the swap file size.


5. Testing the swap file.
#free
#swapon swapfile
#free
#swapoff swapfile
free will show you the current memory usage, and you should be able to see the difference with the swap on/off.


6. Unmounting the swap file
#cd
#umount /mnt/swap

Now, what we need to do is to edit some system files so that swap will be turned on/off when SD card is inserted/removed.

Edit /etc/fstab and add the following line
...
/dev/mmcd/disc0/part2 /mnt/swap auto noauto,owner,noatime 0 0
...

Edit /etc/sdcontrol as followed
...
DEVICE=/dev/mmcd/disc0/part1
DEVICE2=/dev/mmcd/disc0/part2
MOUNT_POINT=/mnt/card
MOUNT_SWAP=/mnt/swap
SWAP_FILE=/mnt/swap/swapfile
...
'insert')
...
mount $FSTYPE $DEVICE $MOUNT_POINT
mount $DEVICE2 $MOUNT_SWAP
...
swapon $SWAP_FILE
;;
'eject')
swapoff $SWAP_FILE
...
umount $MOUNT_POINT
umount $MOUNT_SWAP
...
;;
'comeject')
...
umount $MOUNT_POINT
umount $MOUNT_SWAP
...
usleep 500000
umount $MOUNT_POINT
umount $MOUNT_SWAP
...
;;

If you have followed the commands above, the SD card should be unmounted. Remove the SD card and reinsert it. Swap should be mount automatically (use free to check that). And if you unmount the SD card by applet or by command /etc/sdcontrol stop, swap should be unmounted.

Sunday, April 16, 2006

Linux教學好網

用pdaxrom必須有一定嘅Linux知識,有時買書又知邊本書好
不過我係網上揾到一個好好嘅網,就係鳥哥的 Linux 私房菜
在網頁上,鳥哥會由Linux嘅file system 到點樣去setup server,一一好detail咁解釋落去

Saturday, April 15, 2006

從新開始

買了Zaurus SL-C860已經著差唔多有兩年,玩咗大半年,屋企水浸,部機濕咗,好彩冇乜問題,都重用到,不過之後都冇再玩過

事隔一年,真係得好可惜同哂錢,所以決心再從頭開始過,不過今次唔再係玩cacko,而係玩PdaXrom

一來會有多d嘢玩,二來真係可以接觸到linux 嘅system嘢,學吓點自己config同customize個system,compile同cross-compile applications

我會係E個blog寫底想做嘅嘢同一d notes,之後再係另一個blog到post一個finalized 嘅 how-to's,咁樣自己又唔會唔記得,又可以比第二d人睇吓

以前cacko果個blog轉咗嚟E度