[CSE]  Advanced Operating Systems 
COMP9242 2017/S2 
CRICOS Provider
Number: 00098G

PRINTER Printer-Friendly Version

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 if you wish to work locally. These instructions will be distribution specific (for Ubuntu) but they should at least give you an idea of how to set up other distributions.

The components you will need to install are:

  • Cross compilers
  • Driver for the USB->serial converter
  • A serial terminal program (we recommend picocom)
  • TFTP server
  • time server
  • An NFS server/share
  • netcat
Once installed, the installation can be tested by following the milestone 0 instructions.

Ubuntu Instructions

Based on Ubuntu 16.04.

Cross compilers

The Ubuntu default version of gcc-arm seems to work fine.

apt-get install gcc-arm-linux-gnueabi

NOTE: After checking out the AOS codebase, you will need to change the cross compiler prefix to arm-linux-gnueabi-. Do this by running make menuconfig from the checked out check out source directory, and then going to Toolchain Options.

Installing drivers

The Ubuntu USB serial and USB Ethernet drivers seem to work by default.

You may need to install some of the following packages:

apt-get install build-essential
apt-get install git
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
apt-get install libxml2-utils
apt-get install python-tempita
apt-get install realpath

Setting up the network

Insert the USB to Ethernet adapter into a spare USB port on your Linux host machine and run:

$ dmesg
. The name that your system assigned to the Ethernet port should appear near the bottom of the output. For example:
ax88179_178a 2-2:1.0 eth1: register 'ax88179_178a' at usb-0000:00:14.0-2, D-Link DUB-1312 USB 3.0 to Gigabit Ethernet Adapter, e4:6f:13:f3:e3:93 
You may find that the port was immediately renamed:
ax88179_178a 2-2:1.0 enxe46f13f3e393: renamed from eth1
The following instructions assume that the Ethernet port was named eth1 and that no renaming occurred. If this is not the case, replace eth1 appropriately (enxe46f13f3e393 in the above example).

Add the following lines to /etc/network/interfaces:

iface eth1 inet static
Bring up the interface:
sudo ifup eth1

Setting up the TFTP server

After installing the tftpd-hpa package, the default Ubuntu tftp directory will be /var/lib/tftpboot. You will either need to modify our helper scripts 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.

Our source expects the tftp directory to be /var/tftpboot/$USER.

Setting up the time server

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.

Set up an NFS share

Make sure NFS server is installed:

$ apt-get install nfs-kernel-server nfs-common
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):

Substitute /var/tftpboot/USERNAME to whatever is set TFTP_DIRECTORY to in your tftpd configuration.

Substitute UID with your Unix user ID (usually 1000).

Substitute GID with your Unix group ID (usually 1000).

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. If you skip this minicom may need root permissions to run.

You may be required to change the settings for minicom. Use dmesg to work out which port the USB to serial converter has been attached to (its usually /dev/ttyUSB0). Then set minicom to use that serial port, 115200 baud rate, 8N1, and no hardware flow control, using sudo minicom -s /dev/ttyUSB0.
Last modified: 28 Jul 2017.