Log inUsernamePassword
Log me on automatically each visit    
Register
Register
Log in to check your private messages
Log in to check your private messages
Zaurus 中文论坛 Forum Index » 硬件讨论

This forum is locked: you cannot post, reply to, or edit topics.   This topic is locked: you cannot edit posts or make replies.
[转帖]修改系統,讓 swap 能自行啟動
View previous topic :: View next topic  
Author Message
米迈7500c



Joined: 01 Nov 2006
Posts: 46

小企鹅: 1568

PostPosted: 2006-Dec-15 Fri, pm2:38 Reply with quote
 Post subject: [转帖]修改系統,讓 swap 能自行啟動

[PDA] Zaurus pdaXrom 改裝記 (6) - 設定 swap
為了加速系統的運行,一般在 linux 的系統中都會加上 swap patition 或是 swap file。我是選用 swapfile,大致上有底下三個步驟:
切割 sd 卡,並製作 ext3 的 partition

製作 swap file

修改系統,讓 swap 能自行啟動

先看第一個部份:
卸載 sd 卡:
umount /mnt/card
切割 sd 卡。我是選擇把 sd 卡 (1G) 平均切作兩部份,第一個 partition 是 FAT16 格式,做為共通的用途;第二個 partition 是 ext3 格式,給 zaurus 使用 (含 swap file)。
cfdisk /dev/mmcd/disc0/disc
兩個 partition 都是 primary,第一個的 type 是 06 (FAT16),第二個的 type 是 83 (linux)。

格式化:
mkfs.vfat /dev/mmcd/disc0/part1
mkfs.ext3 /dev/mmcd/disc0/part2
不過有時在 linux 下格式化 FAT16 會怪怪的,最好是找個 PDA/相機/windows 來格式化 FAT16。

再來是製作 swap file:
製作 swap file:
mount -t ext3 /dev/mmcd/disc0/part2 /mnt/card
cd /mnt/card
dd if=/dev/zero of=swapfile bs=1M count=128
mkswap swapfile
試著掛上 swap:
free
swapon swapfile
free
swapoff swapfile
從兩次的 "free" 指令中,可以看出 swap 是否有正確的掛上?

最後記得把 /mnt/card 卸載:
cd
umount /mnt/card

最後是修改系統,讓系統運作順暢自動一些:
修改 /etc/fstab 檔:
......
/dev/mmcd/disc0/part1 /mnt/card-fat16 auto noauto,owner 0 0
/dev/mmcd/disc0/part2 /mnt/card auto noauto,owner 0 0
......
另外,要記得下指令 "mkdir /mnt/card-fat16"。

往後 ext3 的 partition 是掛在 /mnt/card,FAT16 的 partition 是掛在 /mnt/card-fat16。

修改 /etc/sdcontrol 檔:
......
DEVICE=/dev/mmcd/disc0/part2
SWAP_FILE=/mnt/card/swapfile
......
case "$ACTION" in
'insert')
......
swapon $SWAP_FILE
;;
'eject')
swapoff $SWAP_FILE
......
亦即在 insert 的最後加上 swapon,在 eject 前 swapoff。

在這樣修改下,開機後 swap 會自行啟動。若要退出 sd 卡,要下 "/etc/sdcontrol eject" 指令;重插入 sd 卡時,會自行啟動 swap。

原文:http://mfhsieh.blogspot.com/2005/11/pda-zaurus-pdaxrom-6-swap.html
作者:mfhsieh
感谢mfhsieh前辈同意转帖,谢谢,Smile


Last edited by 米迈7500c on 2007-Jan-12 Fri, am8:36; edited 2 times in total
Back to top
View user's profile Send private message
badog
论坛管理员


Joined: 01 Nov 2006
Posts: 1021

小企鹅: 6575

PostPosted: 2006-Dec-15 Fri, pm6:11 Reply with quote
 Post subject:

这个方便大家了啊!
Back to top
View user's profile Send private message Send e-mail
ryebread



Joined: 13 Nov 2006
Posts: 107

小企鹅: 1836

PostPosted: 2006-Dec-28 Thu, pm2:44 Reply with quote
 Post subject:

学习学习 Very Happy Very Happy
Back to top
View user's profile Send private message
badog
论坛管理员


Joined: 01 Nov 2006
Posts: 1021

小企鹅: 6575

PostPosted: 2006-Dec-28 Thu, pm3:16 Reply with quote
 Post subject:

这个提高级教程,不错
Back to top
View user's profile Send private message Send e-mail
freeair



Joined: 04 Dec 2006
Posts: 11

小企鹅: 320

PostPosted: 2007-Mar-01 Thu, pm8:10 Reply with quote
 Post subject:

这个 我试过 不行
Back to top
View user's profile Send private message
freeair



Joined: 04 Dec 2006
Posts: 11

小企鹅: 320

PostPosted: 2007-Mar-01 Thu, pm8:38 Reply with quote
 Post subject:

这个 我试过 不行
Back to top
View user's profile Send private message
Display posts from previous:     
This forum is locked: you cannot post, reply to, or edit topics.   This topic is locked: you cannot edit posts or make replies.    Zaurus 中文论坛 Forum Index » 硬件讨论 All times are GMT + 8 Hours
Page 1 of 1

 
Jump to:   
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
You cannot attach files in this forum
You can download files in this forum

[ 页面生成时间: 秒 ] :: [ 次查询 ] :: [ ]
Powered by phpBB © 2001, 2002 phpBB Group
iCGstation v1.0 Template By Ray © 2003, 2004 iOptional