ติดตั้ง UCBT Bluetooth extension สำหรับ NS2.29 บน Ubuntu 10.04

ก่อนอื่นต้องมาทำความรู้จักกับ UCBT Bluetooth extension กันก่อนนะครับ โดยที่ UCBT Bluetooth extension คือ
 UCBT implements a full bluetooth stack, including Baseband, LMP, L2CAP, BNEP layers. It integrates with ns-2 well and works out of box for recent ns-2 release, ns-2.28. UCBT closely follows spec 1.1 and is partially updated to spec 2.0.

อ้างอิงจาก : http://www.cs.uc.edu/~cdmc/ucbt/

ขั้นตอนในการติดตั้งสามารถทำได้ดังนี้ครับ
1. ทำการเตรียมไฟล์ในการติดตั้ง ซึ่งจะต้องประกอบด้วย 2 ไฟล์คือ

  1. ns-allinone-2.29.3.tar.gz สามารถดาว์นโหลดได้จาก nsnam.sourceforge.net

  2. ucbt-0.9.9.2a.tgz  สามารถดาว์นโหลดได้จาก http://www.cs.uc.edu/~cdmc/ucbt/src/ucbt-0.9.9.2a.tgz


2. ทำการติดตั้ง Library ที่จำเป็นต้องใช้ในการติดตั้งดังนี้
[shell]
sudo apt-get install build-essential autoconf automake libxmu-dev gcc-4.1 g++-4.1
[/shell]

3. เนื่องจาก Ubuntu ที่ผมใช้อยู่นั้นมีการติดตั้ง gcc และ g++ หลาย version ดังนั้นจึงต้องทำการ export เพื่อใช้ในการ compile ns2.29 ครับด้วยคำสั่ง
[shell]
export CC=gcc-4.1
export CCX=g++-4.1
[/shell]

4. โดยที่ไฟล์ที่ผมดาว์นโหลดมานั้นอยู่ใน /home/attaphon/Downloads
[shell]
attaphon@ubuntu:~/Downloads$ pwd
/home/attaphon/Downloads

attaphon@ubuntu:~/Downloads$ ls -l
-rw-r--r-- 1 attaphon attaphon 68618537 2011-12-15 06:53 ns-allinone-2.29.3.tar.gz
-rw-r--r-- 1 attaphon attaphon 315098 2011-12-15 07:56 ucbt-0.9.9.2a.tgz
[/shell]

เพื่อความสะดวก และง่าย ผมจะคัดลอกไฟล์ที่จำเป็นไปไว้ใน path ที่ผมต้องการ โดยต้องทำการสร้าง folder และคัดลอกไฟล์ตามลำดับ
[shell]
attaphon@ubuntu:~$ mkdir NS-2
attaphon@ubuntu:~$ cp Downloads/ns-allinone-2.29.3.tar.gz NS-2/
attaphon@ubuntu:~$ cp Downloads/ucbt-0.9.9.2a.tgz NS-2/
[/shell]

5.ทำการแตกไฟล์ ns-allinone-2.29.3.tar.gz ด้วยคำสั่ง
[shell]
attaphon@ubuntu:~$ cd NS-2/
attaphon@ubuntu:~/NS-2$ tar xzvf ns-allinone-2.29.3.tar.gz
[/shell]

6.ทำการแตกไฟล์ ucbt-0.9.9.2a.tgz ไปไว้ใน path ns-allinone-2.29/ ด้วยคำสั่ง
[shell]
attaphon@ubuntu:~/NS-2$ cp ucbt-0.9.9.2a.tgz ns-allinone-2.29
attaphon@ubuntu:~/NS-2$ cd ns-allinone-2.29/ns-2.29/
attaphon@ubuntu:~/NS-2/ns-allinone-2.29/ns-2.29$ tar xzvf ../ucbt-0.9.9.2a.tgz
[/shell]

7.ทำการติดตั้ง (compile) ด้วยคำสั่ง

[shell]
attaphon@ubuntu:~/NS-2/ns-allinone-2.29/ns-2.29$ cd ucbt-0.9.9.2a
attaphon@ubuntu:~/NS-2/ns-allinone-2.29/ns-2.29/ucbt-0.9.9.2a$ ./install-bt 
[/shell]

หรืออาจจะใช้คำสั่ง
[shell]
./install-bt [-d|-t]
[/shell]
เพื่อต้องการ  debug

8.ขั้นตอนสุดท้ายทำการ test โดยใน  UCBT Bluetooth extension นั้นมีไฟล์ตัวอย่างที่เป็น .tcl อยู่แล้ว เราสามารถที่จะทำการทดสอบได้โดย

[shell]
attaphon@ubuntu:~/NS-2/ns-allinone-2.29/ns-2.29/ucbt-0.9.9.2a$ cd test/
attaphon@ubuntu:~/NS-2/ns-allinone-2.29/ns-2.29/ucbt-0.9.9.2a/test$ ../../ns test_sdp.tcl > x.out
[/shell]

ทำการ cat หรือ more ไฟล์ trace file .out เพื่อแสดงผลลัพธ์หรือผลการจำลอง
[shell]
attaphon@ubuntu:~/NS-2/ns-allinone-2.29/ns-2.29/ucbt-0.9.9.2a/test$ more x.out
[/shell]

ขอจบด้วยเพียงเท่านี้

ราตรีสวัสดิ์ครับ ในคืนที่อุณหภูมิใน กทม. เพิ่มสูงขึ้น และผู้คนในคืนนี้กำลังติดตามการเปิดตัว iPhone4s อยู่

Comments

  1. no export,it gcc 4.4

    ReplyDelete
  2. you should be export gcc-4.1 and g++4.1

    ReplyDelete

Post a Comment