Operating Systems and Networks Lab (OSNET)
Mint-2 Project



  • Installing Linux From Existing MiNT Node
  • Installing Linux From Scratch
    • Install Voyage Linux on a CF Card
    • Boot the net5501
    • Compiling Linux 2.6.30 Kernel
    • Compiling Madwifi Driver for PCI Wireless Card
    • Compiling TP-Link TL-WN321G G 54M Wireless USB Adapter Device Driver for Linux Kernel 2.6.30
    • Configure Network Interfaces
    • Install Packages
    • Install NS2
  • Installing MiNT Software

Installing Linux From Existing MiNT Node

Begin with an image of an existing MiNT node. For all of these instructions, /dev/sdb is the CF card reader. This may be different in your machine; make?sure?you have it right, otherwise your hard drive may be overwritten.

dd if=/dev/sdb of=cfimage2gb

When this completes, it should show 2GB transferred. Now remove the CF card from the existing node and insert a new, blank CF card. Perform the following step:

dd if=cfimage2gb of=/dev/sdb

You'll want to edit a few details before putting the card in the robot, so first mount it:

mkdir tempmnt mount -t ext2 -o loop /dev/sdb1 tempmnt

There are two files you will need to edit; begin with /etc/hostname. Change the name to mintN, where N is the cardinality of the node. Next edit /etc/network/interfaces, changing the address entry under ath0 to 192.168.1.(100+N), where N is the cardinality of the node once again. Now unmount it:

umount /dev/sdb1

Finally, set the boot flag:

fdisk /dev/sdb

Type a (toggle boot flag), 1 (partition 1), w (write changes). When it finishes, you may remove the now-prepared CF card.

Installing Linux From Scratch

When we were trying to install Linux on the PowerPC-based RouterBoard RB600A, I was stuck trying to consult the following very conflicting and only slightly-applicable documentation:

However, now that we have moved to the x86-based net5501 board from Soekris Engineering, the process of installing and configuring Linux for the robot is simplified significantly. The main steps to install Linux can be outlined as the following steps:

  1. Format a 2GB Compact Flash card, then download and install Voyage Linux on the card using a Linux computer
  2. Boot the net5501 with the CF card; it should automatically recognize the GRUB bootloader
  3. Configure network interfaces, preferably eth0 and wifi0 (the miniPCI card on the board itself)
  4. Get the 2 significant MAC addresses registered for the network so the following steps can be performed:
  5. Modify /etc/apt/sources.list, then install build-essential, automake, and autoconf
  6. Make the /home/mint directory, and follow the NS2 Installation Guide

Install Voyage Linux on a CF Card

Due to the capacity of the 2G CF card, we need to use 8G CF card instead. To set up the Linux on a 8G CF card, we firstly download Voyage Linux source 0.7.0 from http://mirror.voyage.hk/download/voyage/voyage-0.7.0.tar.bz2

After that, we untar the source tar file and follow [Voyage Linux Root]/README file to create the image.

Notice: The Voyage Linux installation process will copy all the files preserving the permissions. Therefore, you need to untar the source file using root account. Otherwise, your image won't boot up correctly.

Boot the net5501

You won't have problem booting up the Voyage Linux 0.7.0

Compiling Linux 2.6.30 Kernel

Since we have source code compiled under 2.6.30 Linux kernel, we do not want to spend extra time on compiling them using the current Voyage Linux 0.7.0. We download the Linux kernel 2.6.30 fromhttp://www.kernel.org/pub/linux/kernel/v2.6/linux-2.6.30.tar.gz

We used [Voyage Linux Root]/boot/config-2.6.32-voyage as a reference to compile our customized 2.6.30 kernel.

Compiling Madwifi Driver for PCI Wireless Card

We compiled madwifi-0.9.4-r4136-20110203 as our PCI wireless card driver.

Compiling TP-Link TL-WN321G G 54M Wireless USB Adapter Device Driver for Linux Kernel 2.6.30

Currently, we are using TP-Link TL-WN321G adapter.

1. Download RT3070USB(RT307x) driver 2009_0525_RT3070_Linux_STA_v2.1.1.0.bz2

2. Connect device and check WLAN USB hardware ID to be 2070/3070/2870 or other

root@mint3:/home/mint# lsusb
Bus 002 Device 001: ID 1d6b:0001 Linux Foundation 1.1 root hub
Bus 001 Device 002: ID 148f:2070 Ralink Technology, Corp.
RT2070 Wireless Adapter Bus 001 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub

You can see something like this: 148f:2070 see WLAN USB hardware ID and disconnect it from usb

3. Extract archive file in step 1 by any archive manager or use this code

$sudo su
#tar jxvf 2009_0525_RT3070_Linux_STA_v2.1.1.0.bz2

4. ADD Device ID to Source File File located 2009_0525_RT3070_Linux_STA_v2.1.1.0/os/linux/usb_main_dev.c under section #ifdef RT3070 using any text editor

{USB_DEVICE(0x148F,0x2070)}, /*your comment Ralink 2070 */

you can add your own USB wireless hardware ID by changing 148f and 2070 to any other number get from step 2.

5. Compile source code

$sudo make
$sudo make install

6. Some Manual File Copying Copy the .DAT file to /etc/Wireless. using following code.(the install script should do it but just in case). Also copy the rt2870.bin file to /lib/firmware.

$sudo mkdir -p /etc/Wireless/RT2870STA
$sudo cp RT2870STA.dat /etc/Wireless/RT2870STA/
$sudo apt-get install tofrodos $sudo apt-get install dos2unix
$sudo dos2unix /etc/Wireless/RT2870STA/RT2870STA.dat
$sudo chmod +x /etc/Wireless/RT2870STA/RT2870STA.dat
$sudo cp common/rt2870.bin /lib/firmware/

7. Start The Module

$sudo modprobe rt3070sta

If you add this to /etc/rc.local in your node, it will always insert the module when starts

Configure Network Interfaces

To use the Atheros 5212-based cards correctly, interfaces ath0 through ath3 must be created from wifi0 through wifi3 at boot time. A small script must be created to do this. If necessary, remountrw, then make a directory called /home/mint/scripts, and place the following in startup.sh:

#!/bin/sh wlanconfig ath0 create wlandev wifi0 wlanmode sta wlanconfig ath1 create wlandev wifi1 wlanmode sta wlanconfig ath2 create wlandev wifi2 wlanmode sta wlanconfig ath3 create wlandev wifi3 wlanmode sta ifdown ath0 ifup ath0 iwconfig ath0 OpenWRT

The first line specifies the interpreter, the next four lines create ath0 through ath3, and the final line enables ath0 for controlling the robot. To make it executable:

chmod +x /home/mint/scripts/startup.sh

Now, you'll want to enable starting this on runlevel 2, the default runlevel for multi-user mode. Still remounted as read/write, vi /etc/inittab, scroll to the bottom, and add these two lines:

#Configure ath0 through ath3 on boot [Christopher] 1:2:once:/home/mint/scripts/startup.sh

This means that startup.sh will run once on entering runlevel 2. The final step for network setup will be to modify /etc/network/interfaces as follows. First, comment out the lines related to eth0, and then add these lines:

auto ath0 iface ath0 inet static wireless-essid OepnWRT address #101 is node 1, 102 node 2, etc netmask broadcast gateway


When you boots up, you can setup the USB adapter interface?ra0?using the following scripts:

#!/bin/bash control_interface=linksysctrl echo "setup control interface ra0... ${control_interface}" ifconfig ra0 up iwconfig ra0 essid "${control_interface}" dhclient ra0

We have a managed wireless network called?syslinkctrl?as the control interface for all the nodes, which, for each node, is the interface?ra0. We also have script to setup the experiment wireless Ad-Hoc network?linksys?interface ath0 which we created from wifi0 interface.

#!/bin/sh wlanconfig ath0 create wlandev wifi0 wlanmode sta

Install Packages

Begin by editing /etc/apt/sources.list to add the following line:

#deb http://debian.cs.binghamton.edu/debian etch main

You'll want to enable eth0 here to use apt-get, and disable it again when you finish.

apt-get install build-essential autoconf automake apt-get install tcl8.4 tcl8.4-dev tk8.4 tk8.4-dev stow

Install NS2

mkdir /home/mint cd /home/mint wget http://internap.dl.sourceforge.net/sourceforge/nsnam/ns-allinone-2.33.tar.gz tar -xzf ns-allinone-2.33.tar.gz cd ns-allinone-2.33
./install export PATH=$PATH:/home/mint/ns-allinone-2.33/bin:/home/mint/ns-allinone-2.33/tcl8.4.18/unix:/home/mint/ns-allinone-2.33/tk8.4.18/unix cd ns-2.33/

If the validate command looks like it's working correctly, you can terminate it prematurely, as it takes hours to complete.

Note that the tcl/tk version may be different for you, and that even ns-allinone may be at a later version. Verify that you are getting the latest versions of all software packages.