2009/10/27

make swap file


Something found in the rcS,and try to understand what it is.

--- rcS --------------------------

dd if=/Test.fat of=/dev/rd/0
mount -t vfat /dev/rd/0 /mnt/rd
swapon /mnt/rd/swap.img

 :
----------------------------------

  
1. What is /dev/rd/0 ?

The RAMDISCS are placed in their own directory, and are named thus: 
/dev/rd/{0,1,2,...}
 

2. What does dd command do ? (manpages)

Convert and copy a file


3. How to generate something like Test.fat ?


yenping@YenPing:/tmp$ dd if=/dev/zero of=/tmp/mySWAP bs=1M count=128
128+0 records in
128+0 records out
134217728 bytes (134 MB) copied, 0.723966 s, 185 MB/s


yenping@YenPing:/tmp$ ll -h /tmp/mySWAP
-rw-r--r-- 1 yenping yenping 128M 2009-10-27 10:06 /tmp/mySWAP


yenping@YenPing:/tmp$ mkswap mySWAP
Setting up swapspace version 1, size = 131068 KiB
no label, UUID=c46d0a76-dbbd-4144-af6b-093a3e3e00c1


yenping@YenPing:/tmp$ free
             total       used       free     shared    buffers     cached
Mem:       2060436    2010644      49792          0     105424     293172
-/+ buffers/cache:    1612048     448388
Swap:       996020      56664     939356


yenping@YenPing:/tmp$ sudo swapon mySWAP
yenping@YenPing:/tmp$ free
             total       used       free     shared    buffers     cached
Mem:       2060436    2007576      52860          0     103944     291860
-/+ buffers/cache:    1611772     448664
Swap:      1127084      56664    1070420
 

yenping@YenPing:/tmp$ swapon -s
Filename                Type         Size      Used    Priority
/dev/sda3               partition    996020    56664    -1
/tmp/mySWAP             file         131064    0        -2

yenping@YenPing:/tmp$ sudo swapoff /tmp/mySWAP
yenping@YenPing:/tmp$ free
             total       used       free     shared    buffers     cached
Mem:       2060436    1977128      83308          0     102444     290332
-/+ buffers/cache:    1584352     476084
Swap:       996020      56664     939356


2009/10/13

pthread in eclipse

click Project -> Properties

C/C++ Build - Settings - [Tool Settings] - GCC C++ Linker

- Libraries ............. add  pthread
- Miscellaneous ..... add -lpthread