Skip to content

Commit

Permalink
Add script to install software on Raspberry Pi
Browse files Browse the repository at this point in the history
Also update instructions for building and installing using script.
  • Loading branch information
niklasekstrom committed Jul 25, 2023
1 parent 05331c4 commit 2efa229
Show file tree
Hide file tree
Showing 8 changed files with 261 additions and 229 deletions.
27 changes: 27 additions & 0 deletions Software/Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
CPP=g++
CC=gcc
DTC=dtc
BIN=bin_pi

clean:
rm -f ${BIN}/a314d-td
rm -f ${BIN}/a314d-cp
rm -f ${BIN}/a314d-fe
rm -f ${BIN}/spi-a314.dtbo
rm -f ${BIN}/start_gpclk
rmdir ${BIN}

${BIN}/a314d-td: a314d/a314d.cc
${CPP} -DMODEL_TD=1 a314d/a314d.cc -O3 -o ${BIN}/a314d-td

${BIN}/a314d-cp: a314d/a314d.cc
${CPP} -DMODEL_CP=1 a314d/a314d.cc -O3 -o ${BIN}/a314d-cp

${BIN}/a314d-fe: a314d/a314d.cc
${CPP} -DMODEL_FE=1 a314d/a314d.cc -O3 -o ${BIN}/a314d-fe

${BIN}/spi-a314.dtbo: a314d/spi-a314-overlay.dts
${DTC} -I dts -O dtb -o ${BIN}/spi-a314.dtbo a314d/spi-a314-overlay.dts

${BIN}/start_gpclk: a314d/start_gpclk.c
${CC} a314d/start_gpclk.c -I/opt/vc/include -L/opt/vc/lib -lbcm_host -o ${BIN}/start_gpclk
67 changes: 0 additions & 67 deletions Software/Makefile-cp

This file was deleted.

66 changes: 0 additions & 66 deletions Software/Makefile-fe

This file was deleted.

70 changes: 0 additions & 70 deletions Software/Makefile-td

This file was deleted.

69 changes: 48 additions & 21 deletions Software/README.md
Original file line number Diff line number Diff line change
@@ -1,40 +1,67 @@
# A314 Software

The A314 software supports multiple variants of A314 hardware.
The variants of the software use the following acronyms:

- a314-td (trapdoor), works with A314-500 and A314-600
- a314-cp (clockport), works with A314-cp
- a314-fe (front expansion), works with A314-1000

## How to install

Software needs to be built and installed for both the Raspberry Pi side and the Amiga side.

### Raspberry Pi

To build and install on the Pi side, do the following:
To build and install the software on the Raspberry Pi side, do the following:

- Install Raspberry Pi OS (I tend to use Raspberry Pi OS Lite 64-bit): https://www.raspberrypi.com/software/operating-systems/
- Install Raspberry Pi OS (I tend to use Raspberry Pi OS Lite 64-bit,
but any recent version should work):
<https://www.raspberrypi.com/software/operating-systems/>
- Install Dependencies: `sudo apt install python3-dev python3-distutils python3-pip build-essential git`
- Clone the a314 repo: `git clone https://github.com/niklasekstrom/a314.git`
- `cd a314/Software`
- Build binaries: `make -f Makefile-td` or `make -f Makefile-cp` depending on variant of A314
- Install software: `sudo make -f Makefile-td install` or `sudo make -f Makefile-cp install`
- Enable and start a314d:
- `sudo systemctl daemon-reload`
- `sudo systemctl enable a314d`
- `sudo systemctl start a314d`
- Obtain a copy of the repository, either:
- Clone the a314 repository: `git clone https://github.com/niklasekstrom/a314.git`, or
- Download the sources from a release. Pick a release from
<https://github.com/niklasekstrom/a314/releases>, download the file linked to as
Source code (tar.gz), and extract with `tar xvf <filename>.tar.gz`.
- Change into the Software directory: `cd a314/Software`
- Run the installer script: `sudo ./install-pi.sh <model>`, where `<model>` is
`td`, `cp` or `fe` depending on which variant of A314 is used.
- Reboot the Raspberry Pi: `sudo reboot now`

### Amiga

The binaries for the Amiga side are already built and are available as part of a release on the GitHub page: https://github.com/niklasekstrom/clockport_pi_interface/releases
The binaries for the Amiga side are already built and are available as part of a release on the GitHub page: <https://github.com/niklasekstrom/a314/releases>

There are multiple sub directories in the release archive, and the files in those sub directories should be copied to the corresponding sub directories in the AmigaOS system volume.

It is also possible to build the Amiga binaries from source on the Raspberry Pi. To do so, follow these steps:
Note that in the Devs directory there are multiple different versions of a314.device:
`a314-td.device`, `a314-cp.device`, `a314-fe.device`.
Copy only the version that matches your A314 hardware and rename it to `a314.device`.

- Install Docker: `curl -sSL https://get.docker.com | sh`
- Allow user pi to run Docker: `sudo usermod -aG docker pi`
- Log out and then log back in again to make the previous command take effect
- Clone the a314 repo: `git clone -b clockport_if https://github.com/niklasekstrom/a314.git`
- `cd a314/Software`
- Build binaries by running: `./rpi_docker_build.sh`
After these files are copied to the Amiga it should be possible to run the pi command.
The pi command can be invoked by `pi` without any arguments to get an interactive bash terminal,
or with arguments to run a particular Linux command.

The binaries are now available in the sub directories of the `bin_amiga` directory.
#### Building

After these files are copied to the Amiga it should be possible to mount the PiDisk: by `Mount PI0:`.
The pi command can be invoked by `pi` without any arguments to run bash, or with arguments to run a particular Linux command.
It is also possible to build the Amiga binaries from source, either on the Raspberry Pi or on a Linux PC.
To do so, follow these steps:

- Download and install VBCC:
- On the bottom of this page, <http://www.compilers.de/vbcc.html>, there are archives with VBCC
pre-compiled for different plattforms such as Linux (x64) and Raspberry Pi
- Download the appropriate archive, e.g.: `wget http://www.ibaug.de/vbcc/vbcc_linux_x64.tar.gz`
- Unpack to some suitable directory: `tar xvf vbcc_linux_x64.tar.gz -C ~/amiga/`
- Set the VBCC environment variable: `export VBCC=~/amiga/vbcc`
- Add VBCC to PATH: `export PATH=$VBCC/bin:$PATH`
- Download and add NDK3.2:
- Download archive from Aminet: `wget http://aminet.net/dev/misc/NDK3.2.lha`
- Install lha extraction software: `sudo apt install lhasa`
- Extract archive: `lha xw=~/amiga/NDK3.2 NDK3.2.lha`
- Add environment variable: `export NDK32=~/amiga/NDK3.2`
- Clone the a314 repo: `git clone https://github.com/niklasekstrom/a314.git ~/amiga/a314`
- Change into the Software directory: `cd ~/amiga/a314/Software`
- Build binaries by running: `make -f Makefile-amiga`

The binaries are now available in the sub directories of the `bin_amiga` directory.
11 changes: 8 additions & 3 deletions Software/ethernet/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,10 @@ This SANA-II driver works by copying Ethernet frames back and forth between the

## Configuring the Raspberry Pi

If the `install-pi.sh` script was run to setup the Raspberry Pi then the following
steps have already been carried out, and no more configuration should be needed
unless your network require some special configuration.

- Install pytun: `sudo pip3 install python-pytun`.
- Copy `ethernet.py` to `/opt/a314/ethernet.py`.
- Update `/etc/opt/a314/a314d.conf` with a line that starts `ethernet.py` on demand.
Expand All @@ -13,17 +17,17 @@ This SANA-II driver works by copying Ethernet frames back and forth between the
- Add the lines in `pi-config/rc.local` to the bottom of `/etc/rc.local` just before `exit 0`. This create iptables rules that forwards packets from the `tap0` interface to the `wlan0` interface.
- Please note that if the Pi is connected using wired ethernet then `wlan0` should be changed to `eth0`.

The first four steps are performed by `sudo make install`. The last steps you have to do manually.

## Configuring the Amiga

This has been tested with the Roadshow and the MiamiDX TCP/IP stacks. These instructions show how to configure Roadshow and Miami for a314ethernet, they do not describe how to install either.

### Common

- Build the `a314eth.device` binary, for example using the `rpi_docker_build.sh` script.
- Copy `bin/a314eth.device` to `DEVS:`.

### Roadshow

- Copy `amiga-config/A314Eth` to `DEVS:NetInterfaces/A314Eth`.
- Copy `amiga-config/routes` to `DEVS:Internet/routes`.
- Copy `amiga-config/name_resolution` to `DEVS:Internet/name_resolution`.
Expand All @@ -33,6 +37,7 @@ This has been tested with the Roadshow and the MiamiDX TCP/IP stacks. These inst
Reboot the Amiga and with some luck you should be able to access the Internet from your Amiga.

### Miami

- Create new device entry under **Hardware**
- Click **New** and select **Ethernet**
- Name it accordingly, for example `a314eth`
Expand Down Expand Up @@ -62,7 +67,7 @@ The above described configuration uses a method called masquerading to create a

To facilitate that access, the firewall on the Pi needs to be configured to forward incoming traffic on specific ports on the external interface to the Amiga. The example below assumes that the Pi and Amiga have both been setup as described earlier in this document.

```
```bash
iptables -A PREROUTING -t nat -i wlan0 -p tcp --dport 21 -j DNAT --to 192.168.2.2:21
iptables -A FORWARD -p tcp -d 192.168.2.2 --dport 21 -j ACCEPT
```
Expand Down
4 changes: 2 additions & 2 deletions Software/ethernet/pi-config/rc.local
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
iptables -t nat -A POSTROUTING -o wlan0 -j MASQUERADE
iptables -A FORWARD -i wlan0 -o tap0 -m state --state RELATED,ESTABLISHED -j ACCEPT
iptables -t nat -A POSTROUTING -o wlan0 -j MASQUERADE
iptables -A FORWARD -i wlan0 -o tap0 -m state --state RELATED,ESTABLISHED -j ACCEPT
iptables -A FORWARD -i tap0 -o wlan0 -j ACCEPT
Loading

0 comments on commit 2efa229

Please sign in to comment.