Building OpenSSH on the IRIX platform

This is a step-by-step example of how to build portable OpenSSH on IRIX 6.5. The goal here was to build it to run on all SGI hardware platforms under IRIX 6.5, so I made sure to compile everything with the mipspro compiler from SGI using the -mips3 and -n32 compiler options. Everything was installed in its default location, which is under /usr/local. This example is for OpenSSH version 2.5.1p1

Download and untar everything you need

  1. Get the OpenSSH source - Grab the source from www.openssh.com/portable.html. As mentioned above, the version used here is openssh-2.5.1p1

  2. Get the OpenSSL source - In order to compile OpenSSH, you need a working installation of OpenSSL. Hit www.openssl.org/source for this. The version used here is openssl-0.9.6

  3. Get the libz source - Compiling one or the other (or both, I can't recall) of these requires a working install of the libz compression library. This is available via FTP at ftp://ftp.cdrom.com/pub/infozip/zlib/ The version used here is zlib-1.1.3

  4. Untar it all - /usr/local/src is a good place to blow all this out. There's no gnu tar on IRIX 6.5 by default, so you can't use the -z flag for uncompressing on the fly (shame). The following commands ought to take care of it, though. Run the gzcat command three times, replacing <filename.tar.gz> with the name of each tar file:

    cd /usr/local/src
    gzcat <filename.tar.gz> | tar xvf -

Build and install libz

  1. In the /usr/local/src/zlib-1.1.3 directory, I ran the command:

    ./configure

  2. The machine I was on had both gcc and mipspro compilers. configure chose to setup the Makefile for gcc, but I didn't want that. So I had to make a couple small changes at the top of the Makefile:

    CC=cc
    CFLAGS=-mips3 -n32 -O3 -DHAVE_UNISTD_H -DUSE_MMAP

  3. Finally, I ran the following make commands (as root):

    make
    make test
    make install

Build and install OpenSSL

  1. Go into the /usr/local/src/openssl-0.96 directory. Unlike zlib, it looks like the Configure script for openssl does the right thing if you run:

    ./Configure irix-mips3-cc

    And the make commands (as root)...

    make
    make test
    make install

Build and install OpenSSH

  1. Unlike openssl, the configure script for this package was not mipspro-friendly. It totally refused to use cc with gcc installed. So I just uninstalled gcc with swmgr. And then I had to trick the configure script into using the compiler options that I wanted:

    setenv CFLAGS \"-mips3 -n32 -O2\"
    ./configure

  2. With that fixed, I issued the make commands (as root):

    make
    make install

Set it up to run from init

The last thing is to get the sshd daemon to run out of init so that it comes up at boot time. Below this is a script I wrote which does just that. Copy the text into a file called /etc/init.d/sshd and then run these commands:

chmod 755 /etc/init.d/sshd
ln -s /etc/init.d/sshd /etc/rc2.d/S61sshd
ln -s /etc/init.d/sshd /etc/rc0.d/K26sshd

You should now have a complete working install of openssh on your SGI.

#!/bin/sh

SSH_ROOT=/usr/local
SSH_BIN=$SSH_ROOT/bin
SSH_ETC=$SSH_ROOT/etc
SSH_SBIN=$SSH_ROOT/sbin

case "$1" in
'start')
   if [ ! (-d $SSH_ETC) ]; then
      echo -n "sshd:  Cannot access directory "
      echo -n "$SSH_ETC" 
      echo ".  Skipping ssh startup."
      exit 0
   fi

   if [ ! (-d $SSH_BIN) ]; then
      echo -n "sshd:  Cannot access directory "
      echo -n "$SSH_BIN" 
      echo ".  Skipping ssh startup."
      exit 0
   fi

   if [ ! (-d $SSH_SBIN) ]; then
      echo -n "sshd:  Cannot access directory "
      echo -n "$SSH_SBIN" 
      echo ".  Skipping ssh startup."
      exit 0
   fi

   if [ ! -f $SSH_ETC/ssh_host_key ]; then
      echo ' creating ssh RSA host key';
      $SSH_BIN/ssh-keygen -N "" -f $SSH_ETC/ssh_host_key
   fi
   if [ ! -f $SSH_ETC/ssh_host_dsa_key ]; then
      echo ' creating ssh DSA host key';
      $SSH_BIN/ssh-keygen -d -N "" -f $SSH_ETC/ssh_host_dsa_key
   fi

   echo -n "sshd: Starting the ssh daemon..."
   $SSH_SBIN/sshd
   echo "done."
   exit 1
   ;;

'stop')
   echo -n "sshd: Stopping the ssh daemon..."
   killall sshd
   echo "done."
   ;;

*)
   echo "usage: $0 {start|stop}"
   ;;
esac