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

PRINTER Printer-Friendly Version

Developing your AOS project on a Macintosh

Mac OS X is a wonderful operating system that many students have on their laptops. It is possible to configure the Mac to become a host for AOS slug development. This web page lists the steps necessary to configure a Mac. The number of steps will seem quite daunting but each one is reasonably simple and you should proceed step by step. It is easier to use recent Macintoshes with AirPort installed.

The current version of this HOWTO applies to Leopard, Snow Leopard and Lion.

You will need a mac with an ethernet port. If you don't have an ethernet port, you can try and get the usb-to-ethernet converter working. Good Luck.

Configuring your Mac

  • Detach the ethernet cable from the ethernet to USB converter. Plug one end into the ethernet
  • Create a new network location under System -> Network with the following details (need to click show or advanced for some details):
    1. Interface: Ethernet
    2. TCP/IP: Configure IPv4 - Manually
    3. IP Address 192.168.168.1 and Subnet Mask 255.255.255.0.
    4. Connect to the internet via WiFi.
  • Create a tftpboot directory for yourself, configure tftp to use it and finally enable tftp:
    $ sudo mkdir -p /var/tftpboot/$USER
    $ sudo chown $USER /var/tftpboot/$USER
    $ cd /System/Library/LaunchDaemons
    $ sudo <editor> tftp.plist # change /private/tftpboot to /var/tftpboot/<YOUR_USER_NAME>
    $ sudo launchctl unload tftp.plist
    $ sudo launchctl load -F tftp.plist
  • Export an nfs filesystem.

    It is easier to export the tftpboot directory as your filesystem for later milestones. This section describes the steps necessary to do this.

    (Note that it does not appear to be possible to export /var/tftpboot/$USER directly on Leopard, as the nfsd does not follow symlinks, and /var is a symlink.)

    $ cd aos-2012; mkdir rootfs
    $ sudo sh -c 'echo "/path/to/aos-2012/rootfs -network 192.168.168.0 -mask 255.255.255.0" >> /etc/exports'
    $ sudo nfsd
    You will need to run $ sudo nfsd each time you reboot your system.
  • The NFS code in SOS also requires the host to be running a server for the time protocol on UDP port 37. This is not NTP! Have a go at implementing your own time server. It's a trivial program. (I managed to do it in 5 lines of Java. Nothing in Java takes 5 lines.)

Installing and configuring software

  • Install the FTDI USB serial driver

    You will need the USB driver for the serial card in your slug. You can find it in Virtual COM Port Drivers, grab whichever driver you need for your Macintosh system. Once you have the driver you can plugin the Slug and find out what the USB serial port is called; it will be something starting with /dev/cu.usbserial-*, note this down as you will need to configure picocom below.

  • Install MacPorts

    Download and install the MacPorts package installer from here.

  • Install picocom

    $ sudo port install picocom

    You can then talk to your slug by running (* is what you found earlier, when you installed the FTDI driver)

    $ sudo picocom -b 115200 /dev/cu.usbserial-*

  • Install Mercurial and libmpc

    $ sudo port install mercurial libmpc
    (Go have a coffee while this happens; libmpc takes a while to build.) TortoiseHg is a fairly attractive graphical frontend to Mercurial; if this sounds like something you'd like, install tortoisehg as well.

    WARNING: it depends on Qt, which takes ages to build.

  • Install gmake, gsed, GNU coreutils

    $ sudo port install gsed gmake coreutils

  • Inside aos-2012, create a tools/bin directory, and add it to your path

    $ export PATH=/Users/$USER/.../aos-2012/tools/bin:$PATH

  • Edit the .config file in aos-2012 so that it has the correct toolchain.

    CONFIG_CROSS_COMPILER_PREFIX="arm-softfloat-be-"

  • Inside the tools/bin dir, create symlinks to /opt/local/bin/gsed, /opt/local/bin/gmake, /opt/local/bin/gcp, and /opt/local/bin/greadlink, without the 'g' prefix

    $ cd tools/bin; ln -s /opt/local/bin/gsed sed; etc

  • Download the OSX 10.6 ARM cross compiler from here and extract.

    $ tar -jxvf osx_10.6_cross.tar.bz2

  • Add the cross/bin directory to your PATH, like above...
  • Download and build the nslu2 tool. Put the nslu2 binary in the tools/bin directory
  • To use the nslu2 binary, call it with the name of the serial port that you noted earlier
    nslu2 -p /dev/cu.usbserial-* reset

Problems?
Last modified: 27 Aug 2012.