Skip site navigation (1)Skip section navigation (2)
Date:      Sat, 3 Jun 1995 21:12:36 -0400 (EDT)
From:      "House of Debuggin'" <wpaul@skynet.ctr.columbia.edu>
To:        gja@ansley.com (Greg Ansley)
Cc:        hackers@freebsd.org
Subject:   Re: Using FreeBSD as fileserver for diskless Sun3??
Message-ID:  <199506040112.VAA03332@skynet.ctr.columbia.edu>
In-Reply-To: <199506032115.RAA12834@ansley.com> from "Greg Ansley" at Jun 3, 95 05:15:53 pm

next in thread | previous in thread | raw e-mail | index | archive | help
They say this Greg Ansley person was kidding when he wrote:

> 
> I'm trying to configure a couple of old Sun3s (a 3/60 and a 3/80) for
> use as Xterminals booting diskless from my primary FreeBSD file server.
> 
> I've gotten to the point where the kernel has been successfully loaded

Lucky you: this is usually the hardest part for most people. :)

> and the sun is trying to mount it's swapspace from the server. At this point
> a get the message:
> 
> mount swapfile server:/export/swap/Xkernel failed, rpc status 2

It so happens that I have Seth Robertson's old job (Seth created
Xkernel), so I've gotten rather accustomed to sorting out diskless
booting problems. :) 

On the systems Seth has configured here, swap isn't used. Instead,
the kernels use a dummy 'no swap' device and rely entirely on
whatever RAM they happen to have. The 3/50 machines seem to do
pretty well with 4 megs and mono frame buffers. The color machines
(some 3/60s and a couple of 3/110s, believe it or not) get by with 8.
If you have at least this much RAM in your systems, you shouldn't
need swap space with Xkernel.

You need to configure your kernel like this:

config   vmunix   root on type nfs   swap on ns0b
pseudo-device ns

You then need to link your kernel with the ns.c module appended to
this message. Note carefully the comments in the code about the adb
script; you must patch your kernel image before the ns device will
work properly.

That said, you should be able to use an NFS swap device with a
FreeBSD server. I have a feeling the problem is that you haven't
yet created the file that you're trying to swap on:

> mount swapfile server:/export/swap/Xkernel failed, rpc status 2

For this to work, 'Xkernel' must be a file and the client
system must have permission to mount the /export/swap directory
in order to access. It also needs root access permission, since
diskless root and swap mounts are always done by the kernel as
the superuser. You can cheat a bit with this if you remap root
to a non-privileged user and then change the ownerships of the
exported files to that user.

Furthermore, each client needs its own device. Here's what should
be done to create the swap files (let's assume you want 8 megs of
swap for each machine):

1) Create the files

# dd if=/dev/zero of=/export/swap/Xkernel/3-60-swap bs=8192 count=1000
# dd if=/dev/zero of=/export/swap/Xkernel/3-80-swap bs=8192 count=1000

2) Edit /etc/exports and give the 3/50 and 3/80 root mount access
   to /export/swap/Xkernel

3) kill -HUP the mountd daemon to have it re-read /etc/exports

4) Edit your bootparams database and set the swap file for the
   3/60 to /export/swap/Xkernel/3-60-swap and set the swap file
   for the 3/80 to /export/swap/Xkernel/3-80-swap.

You should be able to boot the machines correctly now.

-Bill

-- 
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~T~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
-Bill Paul            (212) 854-6020 | System Manager
Work:         wpaul@ctr.columbia.edu | Center for Telecommunications Research
Home:  wpaul@skynet.ctr.columbia.edu | Columbia University, New York City
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
The Møøse Illuminati: ignore it and be confused, or join it and be confusing!
~~~~~~~~~ FreeBSD 2.1:  "We can kick your operating system's ass!" ~~~~~~~~~~

/*
 * no-swap kernel device.
 *
 * Its purpose is to simply not allow the kernel to swap properly.
 * The kernel isn't supposed to WANT to swap under these circumstances.
 *
 * Written by Nick Sayer <mrapple@quack.kfu.com>
 *
 * Credit given to ji@cs.columbia.edu for his ramdisk from which much
 * of this driver was derived.
 *
 *
 * After a kernel is made with this swap device, you must run the
 * following adb script:
 *
adb -w vmunix <<_EOF_
rootfs?W 'nfs'
rootfs+10?W ''
swapfile?W 'spec'
swapfile+10?W 'ns0b'
$q
_EOF_
 *
 */

#include "ns.h"

#if NNS > 0

#include <sys/errno.h>
#include <sys/param.h>
#include <sundev/mbvar.h>
#include <sys/vmsystm.h>

#ifndef OPENPROMS
struct  mb_driver nsdriver = {
        0,              /* probe:       see if a driver is really there */
        0,              /* slave:       see if a slave is there */
        0,              /* attach:      setup driver for a slave */
        0,              /* go:          routine to start transfer */
        0,              /* done:        routine to finish transfer */
        0,              /* poll:        polling interrupt routine */
        0,              /* size:        mount of memory space needed */
        "ns",           /* dname:       name of a device */
        0,              /* dinfo:       backpointers to mbdinit structs */
        "ns",           /* cname:       name of a controller */
        0,              /* cinfo:       backpointers to mbcinit structs */
        MDR_PSEUDO,     /* flags:       Mainbus usage flags */
        0,              /* link:        interrupt routine linked list */
};
#endif

nsopen()
{
  return 0;
}
nsread()
{
  panic("Read from NS device");
}
nswrite()
{
  panic("Write to NS device");
}
nsioctl()
{
  panic("IOCTL on NS device");
}

nsstrategy(bp)
struct buf *bp;
{
	bp->b_error = EIO;
	bp->b_flags |= B_ERROR;
	iodone(bp);
}


nssize()
{
  return btodb(freemem*PAGESIZE);
}

#endif /* NNS > 0 */



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?199506040112.VAA03332>