Networking on the Minimig with PPP and Roadshow

When working with an Amiga running on a Minimig platform then data transfer is not as convenient as one might think: You have an SD Card connected and copying files around with SD Card is not the biggest deal, but unfortunately your Amiga is currently running from a system drive stored on this card :/ Each copy operation therefore essentially requires a reboot of your Amiga and that’s not the productive work flow I had in mind…

That’s the reason why I always prefer having network access on all my machines for truly covenient file handling (e.g. with FTP, wget…).

In my last post I showed you how to add a SilverSurfer high speed serial port to your Minimig running on the Turbo Chameleon 64. Now we will use this serial port that is running up to 115200 Baud with ease for something useful: networking! Old farts remember the times when home network access was done with PPP and a serial modem gateway. We’ll go that road but replace the modem and gateway with a small and cheap Linux machine, here the all hyped Rpi and a direct serial “null modem” link via an USB-to-serial adapter.

TC64 with SilverSurfer attached to Raspi

TC64 with SilverSurfer attached to Raspi

Read on to find out all the glory details, starting with a pure “virtual” simulation running on a Mac on to the real thing…

[You can use this approach to bring other classic Amigas to the network, too. But for all machines with a parallel port available I’d suggest to use my plipbox project: Its far easier to setup, a lot faster (4-5x ), and even cheaper :)]

1. Ingredients

The following ingredients are required for this little project:

  • Hardware
    • Minimig TC64 flashed with cp Firmware (see my last post) and a SilverSurfer card attached
    • An USB-to-Serial Converter
    • A 9-to-25 pin serial adapter to connect the SilverSurfer with the USB-to-serial converter
    • A Raspberry Pi with Raspbian installed
  • Amiga Software
    • Amiga HDF Image running on minimig
      I use a BetterWB installed on vanilla OS 3.1
    • An Amiga TCP Stack: Roadshow 1.11 [2]
      I chose this one, because its actively supported, has a nice CLI interface and ships PPP support out of the box. And not to forget: it has pure 68000 support (not only 020er or better)!
      Note: use the most recent version 1.11 as it fixes some PPP Bugs!
  • Raspbian Software:
    • pppd – the ppp server
  • Mac/Host (Posix) Software (for the emulation)
    • FS-UAE – best Amiga emulator for Posix systems
    • socat – swiss army knife for quickly setting up various data connections
    • pppd (pre-installed on most systems)

2. Prepraring and Testing the Amiga HDF

Get your FS-UAE up and running first. There a lots of tutorials out there on this topic. We will use it to prepare the Minimig HDF file.

FS-UAE Config

My HDF File from the Minimig is called minimig.hdf and as a first step I copy it to my Mac into the ~/Documents/FS-UAE/Hard Drives/ folder.

Set up a FS-UAE configuration file to use this image with a compatible machine:

[config]
amiga_model = A1200
fast_memory = 8192
hard_drive_0 = minimig.hdf
hard_drive_1 = /Users/chris/amiga/shared
window_width = 640
window_height = 512
window_resizable = false
serial_port = /tmp/vser

Note the second hard drive is a local directory I use to exchange data files with my Mac file system.

The last option is the most interesting: We connect Paula’s serial port to a file named /tmp/vser. What’s this you might ask?

Virtual Serial Line

This is where the magic begins: We want to simulate a PPP connection from the Amiga running inside FS-UAE and therefore we need to connect its serial port to a serial line with a pppd listening on the other side. We run pppd directly on the Mac but this tool also wants to connect to a serial port… So we have two applications on the Mac each wanting to reach a serial port device…

I use a wonderful tool called socat (found e.g. on MacPorts on Macs) to create the “virtual serial line” between them: It allows me to create two PTYs (virtual terminals) and connects them. I created a small script called vser2pty to achieve this:

#!/bin/sh
OPTS=raw,echo=0,onlcr=0,echoctl=0,echoke=0,echoe=0,iexten=0
exec socat "$@" pty,$OPTS,link=/tmp/vser pty,$OPTS,link=/tmp/hser

If you run this script in a terminal then a “virtual serial line” is created between the terminals named /tmp/vser and /tmp/hser. Those pseudo terminals are actually compatible to real serial ports as they used to connect terminals, too.

Now everything becomes clear: We let FS-UAE’s Paula emulation connect to /tmp/vser while the pppd process will use /tmp/hser

Roadshow Config

Ok, enough magic for now… Start your virtual serial line and (after this) FS-UAE. Inside FS-UAE install Roadshow 1.11 (or the Update) if you haven’t already done so.

On the Amiga side we will need a network driver file for PPP first: Create a new file in DEVS:NetInterfaces/PPP with the following contents:

device=ppp-serial.device
requiresinitdelay=no

Now on a CLI you could already add this interface with:

CLI> addnetinterface ppp
Interface "ppp" added.

The driver needs a configuration file to find out what serial port or what options are requested: Create a new file called: S:PPP-Configurations/ppp-serial:

interface=ppp
device=serial.device
baud=38400
rtscts=no
checkcarrier=no
nullmodem=yes

This file is for testing only. Later on we will use S:PPP-Configurations/ppp-silver which uses the SilverSurfer device:

interface=ppp
device=silversurfer.device
baud=115200
rtscts=yes
checkcarrier=no
nullmodem=yes

Ok, now on the Amiga in FS-UAE we are set up! Before we can continue here, we’ll need to start the pppd on the host side…

pppd Config on Host

pppd expects that the serial device it connects to has to start with /dev/… Therefore, we can’t directly use the link that our virtual serial port script has created. But a cheesy ls discovers the real PTY and this a /dev device 🙂

> ls -l /tmp/hpar
/dev/ttys002

Note: that the name of the PTY might change every time you restart the vser2pty script.

Now we can launch pppd as root (we need these priviledges to allow pppd to setup the required net interfaces):

> sudo pppd debug -detach proxyarp 192.168.2.250:192.168.2.251 ttys002 115200

The mentioned IP adresses give the point-to-point link used for ppp: the first is the host address the second the Amiga’s address. To make proxyarp work, you have to make sure that these addresses are on the same subnet as your main network link on your machine. E.g. my Mac sits on the 192.168.2.x subnet of my home router and therefore 192.168.2.250 is a valid point-to-point address that can use proxyarp.

The only thing missing is enabled IP forwarding on your machine. On Macs you do:

> sudo sysctl -w net.inet.ip.forwarding=1

Ok, pppd is up and running… Now we can connect from the Amiga side…

Roadshow Connect

Use the ppp_dialer script installed with Roadshow and the script for the serial.device we already set up:

CLI> ppp_dialer s:PPP-Configurations/ppp-serial
...
PPP has connected

If everything works fine then you see the connect in both pppd and CLI output.

...
 Sat Nov 16 19:59:09 2013 : found interface en3 for proxy arp
 Sat Nov 16 19:59:09 2013 : local IP address 192.168.2.250
 Sat Nov 16 19:59:09 2013 : remote IP address 192.168.2.251
 Sat Nov 16 19:59:09 2013 : Received protocol dictionaries
 Sat Nov 16 19:59:09 2013 : Received acsp/dhcp dictionaries
 Sat Nov 16 19:59:09 2013 : Committed PPP store
 Sat Nov 16 19:59:09 2013 : Received acsp/dhcp dictionaries
 Sat Nov 16 19:59:09 2013 : Committed PPP store

Open a new CLI and keep the PPP link up. Now you can use the network on your Amiga:

CLI2> ping 192.168.2.250    # ping Mac pppd (basic test)
CLI2> ping 192.168.2.1      # ping my router (check ip forwarding)
CLI2> ftp 192.168.2.1       # ftp my router (test non-ping apps)

So far, so good… PPP, Networking does fine in the Amiga setup. Now lets head over to the real Hardware (TM).

First transfer the altered minimig.hdf disk image back to your SD card you’ll use with the Minimig. I prefer the rsync command here as it is faster of only slight changes were applied to the image.

3. Raspi Setup

The Minimig PPP setup

The Minimig PPP setup

I assume you have a configured an up to date Raspbian Linux distribution already running on your system.

First make sure to have pppd installed:

# apt-get install ppp

Setting up the Serial Link

Now attach your serial-to-USB adapter. Most adapters are recognized out of the box by Linux and registered as a tty device in /dev/ttyUSBx. In dmesg you’ll see something like this:

[ 27.625546] ftdi_sio 1-1.3:1.0: FTDI USB Serial Device converter detected
[ 27.626059] usb 1-1.3: Detected FT232BM
[ 27.626085] usb 1-1.3: Number of endpoints 2
[ 27.626100] usb 1-1.3: Endpoint 1 MaxPacketSize 64
[ 27.626114] usb 1-1.3: Endpoint 2 MaxPacketSize 64
[ 27.626126] usb 1-1.3: Setting MaxPacketSize 64
[ 27.628597] usb 1-1.3: FTDI USB Serial Device converter now attached to ttyUSB0
[ 27.628659] ftdi_sio: v1.6.0:USB FTDI Serial Converters Driver

As you can see I use a FT232-based device that is well supported on Linux (and OS X) and also available almost everywhere at decent prices.

And the device itself is here:

> ls -la /dev/ttyUSB0
rw-rw---T 1 root dialout 188, 0 Nov 17 10:17 /dev/ttyUSB0

Ok, serial port is up.

Adding the Serial Adapter

Most modern serial ports have a DB 9 connector while the SilverSurfer has an Amiga compatible DB 25 serial port. Therefore, an 9-to-25 adapter is required to connect both. I soldered mine with the instructions found at Cloanto’s site:

USB-to-Serial adapter with self-made 9-to-25 pin adapter

USB-to-Serial adapter with self-made 9-to-25 pin adapter

IP Forwarding

To finish the SW setup, we need to enable IP forwarding on Linux otherwise the Amiga connected via PPP can’t reach the rest of the world.

You can do this for this session with:

> sudo sysctl net.ipv4.ip_forward=1

Or permanently by adding the following line to /etc/sysctl.conf:

net.ipv4.ip_forward=1

Starting PPPD

Now its time to fire up the pppd server itself:

> sudo /usr/sbin/pppd noauth nodetach debug proxyarp \
     192.168.2.250:192.168.2.251 /dev/ttyUSB0 115200

It now waits for the connection setup from the Minimig. Therefore ‘dial’ there with the SilverSurfer config:

CLI> addnetinterface ppp
CLI> ppp_dialer S:PPP-Configurations/ppp-silver
...
PPP has connected

Ok, we are on the Net!

Minimig running Roadshow PPP and pinging the net

Minimig running Roadshow PPP and pinging the net

You can play around with your full featured link now:

CLI> ping 192.168.2.250     # ping Raspi-side of point-to-point link
CLI> ping 192.168.2.1       # ping my router (see if ip forwarding work)
CLI> ping www.lallafa.de    # reach the world (test DNS)

Ah, before I forget: the last call needs DNS to resolve the symbolic name. To make this work on Roadshow you have to edit the file DEVS:Internet/name_resolution:

nameserver 192.168.2.1 # add my router as name server

After a restart of Roadshow networking everything should work:

CLI> netshutdown
CLI> addnetinterface ppp
CLI> ppp_dialer S:PPP-Configurations/ppp-silver

That’s it… all you need to get your ‘mig on the net! 🙂

Make it persistent

If you want to make the pppd setup persistent and run it automatically on Pi startup then you can add the call to /etc/rc.local:

# /etc/rc.local
# auto ppp startup
/usr/sbin/pppd noauth persist proxyarp \
   192.168.2.250:192.168.2.251 /dev/ttyUSB0 115200

Now debugging is disabled, daemon mode enabled and automatic retries activated. (see ‘man pppd’ for more details…)

If you want to play with some performance options you might want to try the ‘novj’ option to disable header compression…

Serial PPP with 115200 Baud gives you an avg. of 6 to 8 KiB/s data transfer rate… Not fast as hell, but all in all much more comfortable than ejecting your SD Card and booting the system each time you need small file 🙂

Have Fun!

My comfy desktop with Minimig PPP setup

My comfy desktop with Minimig PPP setup

1 thought on “Networking on the Minimig with PPP and Roadshow

  1. Pingback: Tutorial: Minimig en red |

Leave a Reply