Screen Version
School of Computer Science & Engineering
University of New South Wales

 Advanced Operating Systems 
 COMP9242 2012/S2 

Developing your AOS project on Linux

Many CSE students have Linux machines which they would like to be able to use to work away from the CSE labs. The following is a guide as to how to set up the necessary drivers/software. These instructions will be debian specific in some spots (e.g. setting up the tftp server) but they should at least give you an idea of how to set up other distributions.

The components you will need to install are:

Once installed, the installation can be tested by following the milestone 0 instructions.

Also, recent versions of Ubuntu are special. See this section.

Cross compilers

Two pre-built cross-compilers are provided for you

If neither of these binaries works on your distro/platform then you are on your own to build your own cross-compiler.

Installing drivers

You need device drivers for the RTL8150 based USB to Ethernet dongle, and the FT232RL USB-Serial converter. Fortunately, these drivers are in the linux kernel and are compiled by most modern distributions, so you should be able to plug them in and see messages from the drivers via dmesg.

The modules required are:

If you don't have hotplug set up correctly, you may need to use modprobe: modprobe rtl8150 && modprobe ftdi_sio. Of course, you might be better off throwing some effort into making hotplug work, like in the CSE labs.

From here on in, we'll assume you can get all of this going, with the serial converter on /dev/ttyUSB0, and the ethernet adapter on eth1. Substitute these values below if your setup varies (e.g. if you are using a real Ethernet port or network) -- dmesg should show you what interface you get.

Setting up the network

The AOS board expects to find a host at 192.168.168.1. You can change this temporarily in the bootloader, but it's easier to set up your host to be at this address. (This is the rationale behind using an independent network provided by the USB to Ethernet dongle.) Set this up with

ifconfig eth1 192.168.168.1 up
    

Setting up the TFTP server

The bootloader will download your software image from a tftp server running on your host. So you need to set one up:

apt-get install tftpd

Edit your /etc/inetd.conf. Change the following line to reflect the location of the directory which you want to use as your tftp root. (In this case it is /tftpboot).

tftp            dgram   udp     wait    nobody  /usr/sbin/tcpd  /usr/sbin/in.tftpd /tftpboot

You may need to restart inetd at this point using /etc/init.d/inetd restart

You will also need to adjust your handy Makefile if you want it to automatically copy the bootimg.bin file to the tftpboot directory. The variable to look for is: TFTPROOT

Setting up the time server

Uncomment (or add) the following line in /etc/inetd.conf :

#time           dgram   udp     wait    root    internal

Set up an NFS share

Install the NFS server:

$ apt-get install nfs-kernel-server nfs-common portmap
Then set up the exports by editing /etc/exports and adding the following lines (adjusted for the location of your tftp root directory and your username):
/var/tftpboot/USERNAME 192.168.168.2(rw,sync,all_squash,subtree_check,anonuid=UID,anongid=GID)

Install the NSLU2 utility program

It is necessary to be able to control the NSLU2 using a utility program. It controls the reset line, allowing the NSLU2 to boot once a serial console has been opened.

Download the source code. Uncompress it, make, and copy the resulting executable to a directory in your $PATH (or add the nslu2-util directory to your $PATH).

Install other required software

Install the following packages:

apt-get install picocom netcat ethereal

Recent Ubuntu distributions

Networking

I've just updated this based on Ubuntu 12.04

The USB drivers seem to work by default.

You need may need to install some of the following packages:

apt-get install build-essential mercurial
apt-get install libncurses5-dev
apt-get install netcat.traditional
update-alternatives --set nc /bin/nc.traditional
apt-get install picocom minicom
apt-get install tftpd-hpa tftp-hpa
apt-get install nfs-kernel-server
apt-get install xinetd

Unfortunately, newer Ubuntu distributions include the 'easy to use' NetworkManager, which destroys everything. Instead, add the following lines to /etc/network/interfaces:

iface eth1 inet static
    address 192.168.168.1
    netmask 255.255.255.0
Then, restart NetworkManager, and bring up the interface:
sudo service network-manager restart
sudo ifup eth1

TFTP

After installing the tftpd-hpa package, the default tftp directory will be /var/lib/tftpboot. You will either need to modify our source tree to match the new default, or modify /etc/default/tftpd-hpa, i.e. change TFTP_DIRECTORY to match our source.

You may need to adjust ownership and/or permissions to allow you access to the directory (e.g. chmod a+rwx /var/lib/tftpboot if you are in a benign environment.

Time

Configure xinetd to serve time by editing /etc/xinetd.d/time to set disable = no, and restart via

sudo service xinetd restart
.
# default: off
# description: An RFC 868 time server. This protocol provides a
# site-independent, machine readable date and time. The Time service sends back
# to the originating source the time in seconds since midnight on January first
# 1900.
# This is the tcp version.
service time
{
        disable         = no
        type            = INTERNAL
        id              = time-stream
        socket_type     = stream
        protocol        = tcpar
        user            = root
        wait            = no
}

# This is the udp version.
service time
{
        disable         = no
        type            = INTERNAL
        id              = time-dgram
        socket_type     = dgram
        protocol        = udp
        user            = root
        wait            = yes
}

Apparently, for some versions of ubuntu there was no obvious ways to coerce xinetd into serving TIME. On the other hand, it's a 5-line Java program, so writing a server for it is left as an exercise to the reader. Have a read of this.

NFS

Naturally, substitute /var/tftpboot for whatever is set TFTP_DIRECTORY to in your tftpd configuration.

Serial Line Access

Add your account to group dialout to give access to /dev/ttyUSB0. You'll need to logout and back in to update your groups.


Last modified: 23 Jul 2012.