# GXemul: Luna 88K emulation

Back to the index.

This emulation mode attempts to emulate a Luna 88K workstation. Note that these were based on Motorola 88000 processors, not 68000.

Emulated hardware:

- 88100 CPU (Only a single CPU works well, up to 4 can be experimented with.)
- Interrupt controller and parts of the system board
- Serial console
- Keyboard and mouse
- Graphical monochrome framebuffer, 1280 x 1024
- Lance Ethernet

NOT emulated yet:

- SCSI
- Color framebuffers

OpenBSD/luna88k works as a guest OS, with either serial console or graphical framebuffer, when using root-on-nfs.

### OpenBSD/luna88k:

GXemul does not yet emulate the SCSI controller in the LUNA88K machine, so OpenBSD/luna88k needs to boot with root-on-nfs. Another emulated machine must then be used as the nfs root server, and the emulated LUNA88K machine must boot as a diskless client. To make matters even more complicated, the OpenBSD/luna88k 6.8 RAMDISK kernel has support for Ethernet, but it does not seem to have a driver for nfs included or at least it doesn't work in the emulator. Therefore, a separate OpenBSD ramdisk kernel, e.g. for OpenBSD/sgi, needs to be used to run the final step of the root-on-nfs installation.

Performing this setup is quite time consuming, but necessary.

Let's get started.

1. First of all, the "`nfs server`" machine must be set up. Install NetBSD/pmax 8.0 from CDROM, perform a default install (without X11) from CDROM without configuring the network, but add a 4000 MB `/tftpboot` partition when configuring the disk!

2. On the host, download the OpenBSD distribution:

   `` |
       wget http://ftp.eu.openbsd.org/pub/OpenBSD/6.8/luna88k/base68.tgz
       wget http://ftp.eu.openbsd.org/pub/OpenBSD/6.8/luna88k/comp68.tgz
       wget http://ftp.eu.openbsd.org/pub/OpenBSD/6.8/luna88k/xbase68.tgz
       wget http://ftp.eu.openbsd.org/pub/OpenBSD/6.8/luna88k/xfont68.tgz
       wget http://ftp.eu.openbsd.org/pub/OpenBSD/6.8/luna88k/xserv68.tgz
       wget http://ftp.eu.openbsd.org/pub/OpenBSD/6.8/luna88k/xshare68.tgz

3. Start the emulation of the DECstation NFS server using this command line:

   `` |
       gxemul -xe 3max -d nbsd_pmax.img -d base68.tgz -d comp68.tgz -d xbase68.tgz -d xfont68.tgz -d xserv68.tgz -d xshare68.tgz

   and enter the following commands to configure the server for NFS serving and extract the OpenBSD distribution:

   `` |
       echo hostname=server >> /etc/rc.conf
       echo ifconfig_le0=\"inet 10.0.0.2\" >> /etc/rc.conf
       echo nameserver 10.0.0.254 >> /etc/resolv.conf
       echo 10.0.0.254 > /etc/mygate
       echo /tftpboot -maproot=root -alldirs 10.0.0.3 > /etc/exports
       echo rpcbind=YES >> /etc/rc.conf
       echo nfs_server=YES >> /etc/rc.conf
       echo mountd=YES >> /etc/rc.conf
       echo bootparamd=YES >> /etc/rc.conf
       printf "client root=10.0.0.2:/tftpboot swap=10.0.0.2:/tftpboot/swap\n" > /etc/bootparams
       echo "00:00:0a:10:20:30 client" > /etc/ethers
       echo 10.0.0.3 client > /etc/hosts

       cd /tftpboot
       tar xzf /dev/sd1c
       tar xzf /dev/sd2c
       tar xzf /dev/sd3c
       tar xzf /dev/sd4c
       tar xzf /dev/sd5c
       tar xzf /dev/sd6c

       tar zxfv var/sysmerge/etc.tgz
       tar zxfv var/sysmerge/xetc.tgz

       chmod 1777 tmp

       dd if=/dev/zero of=swap bs=1024 count=262144

       echo inet 10.0.0.3 > /tftpboot/etc/hostname.le0
       chmod 640 /tftpboot/etc/hostname.le0
       echo 10.0.0.254 > /tftpboot/etc/mygate
       echo nameserver 10.0.0.254 > /tftpboot/etc/resolv.conf
       echo 127.0.0.1 client localhost > /tftpboot/etc/hosts

       echo 10.0.0.2:/tftpboot / nfs rw 0 0 > /tftpboot/etc/fstab
       echo 10.0.0.2:/tftpboot/swap none swap sw,nfsmntpt=/swap >> /tftpboot/etc/fstab

       halt

4. Download the OpenBSD/luna88k GENERIC, MULTIPROCESSOR, and RAMDISK kernels:

       	http://ftp.eu.openbsd.org/pub/OpenBSD/6.8/luna88k/bsd
       	http://ftp.eu.openbsd.org/pub/OpenBSD/6.8/luna88k/bsd.mp
       	http://ftp.eu.openbsd.org/pub/OpenBSD/6.8/luna88k/bsd.rd

5. Create a configuration file called `config_client`:

   `` |
       !  Configuration file for running OpenBSD/luna88k diskless with
       !  a NetBSD/pmax machine as the nfs server.
       !
       !  This config file is for the client.

       net(
       	add_remote("localhost:12444")   ! the server
       	local_port(12445)               ! the client
       )

       machine(
       	name("client machine")
       	serial_nr(1)

               type("luna88k")
               subtype("luna-88k")
       	! use_x11(1)

       	! For multiprocessor experiments:
       	! ncpus(4)
               ! load("bsd.mp")

               ! load("bsd.rd")
               load("bsd")
       )

   ... and another configuration file for the server, `config_server`:

   `` |
       net(
       	local_port(12444)               ! the server
       	add_remote("localhost:12445")   ! the client
       )

       machine(
       	name("nfs server")
       	serial_nr(2)

               type("dec")
               subtype("5000/200")

               disk("nbsd_pmax.img")
       )

6. Download an OpenBSD/sgi RAMDISK kernel (only used to run MAKEDEV):

       	http://ftp.eu.openbsd.org/pub/OpenBSD/6.7/sgi/bsd.rd.IP32

7. Create a configuration file called `config_client_sgi`:

   `` |
       !  Configuration file for running OpenBSD/sgi diskless with
       !  a NetBSD/pmax machine as the nfs server.
       !
       !  This config file is for the client.

       net(
       	add_remote("localhost:12444")   ! the server
       	local_port(12445)               ! the client
       )

       machine(
       	name("client machine")
       	serial_nr(1)

               type("sgi")
               subtype("o2")
       	use_x11(1)
       	memory(1024)

               load("bsd.rd.IP32")
               ! load("bsd.IP32")
       )

8. Boot the "nfs server" and the OpenBSD/sgi "client machine" as two separate emulator instances:

       	in one xterm:
       	gxemul @config_server

       	and then, in another xterm:
       	gxemul @config_client_sgi

9. In the emulated OpenBSD/sgi client, type 's' for Shell and run these commands:

   `` |
       ifconfig mec0 10.0.0.3; route add default 10.0.0.254
       mount -v 10.0.0.2:/tftpboot /mnt
       cd /mnt/dev; ./MAKEDEV all; cd /; umount /mnt
       halt -p

10. Finally, run the luna88k client:

        	gxemul @config_client

    When asked about root device, enter `le0`.

If you want to run with the graphical framebuffer, uncomment the `use_x11(1)` line in `config_client` first. Unfortunately, Xorg lacks a driver for `wsfb` in OpenBSD/luna88k 6.8, which is needed.

You can extract the files

    ./usr/X11R6/lib/modules/drivers/wsfb_drv.la
    ./usr/X11R6/lib/modules/drivers/wsfb_drv.so

from the OpenBSD 6.7 xserver distribution file, and use them even if the rest of the OS is version 6.8. If you have extracted the files above, then start X by running `startx`.

You can experiment with the multiprocessor kernel (bsd.mp), with up to 4 emulated CPUs. It is not as stable as running single-processor, though. Also, the emulator itself is not multithreaded, so all CPUs are emulated using a single host processor, so a higher number of emulated CPUs means a slower total emulation speed.

Uncomment the bsd.mp file in the configuration file, and set ncpus to the number of cpus (1 through 4).

One can also experiment with the RAMDISK kernel (much easier than following the rather involved process above):

- Download https://ftp.eu.openbsd.org/pub/OpenBSD/6.8/luna88k/bsd.rd

Start the emulator like this:

    	gxemul -e luna-88k bsd.rd

    	(For older OpenBSD/luna88k kernels, 5.4 and below:)
    	gxemul -e luna-88k 0x20000:0x20:bsd.rd

Add `-X` if you want to use the graphical framebuffer.

The following is not needed in order to experiment with booting OpenBSD, but can be interesting nonetheless: Download https://ftp.eu.openbsd.org/pub/OpenBSD/6.2/luna88k/boot and try

    	gxemul -v -e luna-88k 0x00700000:0x20:0x00700000:boot