[CSE]  Advanced Operating Systems 
COMP9242 2011/S2 
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 only applies to the Leopard (10.5) and Snow Leopard (10.6) revisions of Mac OS X.

Configuring your Mac

  • Create a new network location.
    1. Select System preference->Network->Location->New Location...
    2. Create a new location for NSLU2 development
    3. Now in the 'show' popup select Built-In Ethernet->TCP/IP.
    4. Set Configure IPv4: to Manual with IP Address and Subnet Mask
    5. Now configure your internet connection on one of the other network devices, such as the AirPort.
  • Create a tftpboot directory for yourself, configure tftp to use it and finally enable tftp:
    $ sudo mkdir /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-2011; mkdir rootfs
    $ sudo sh -c 'echo "/path/to/aos-2011/rootfs -network -mask" >> /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-2011, create a tools/bin directory, and add it to your path

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

  • 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

Last modified: 29 Jul 2011.