257 lines
6.2 KiB
Markdown
257 lines
6.2 KiB
Markdown
# Installation tools for APUs and Raspberry Pi boxes
|
|
|
|
Supports the following boxes used at LIN sample environment:
|
|
|
|
- bare-apu: Linux box
|
|
- controlbox: from FRM2
|
|
- ionopimax: PLC from Sfera Labs with compute module 3
|
|
- ionopi: PLC from Sfrea labs with Raspberry Pi 3
|
|
- dual-eth-rpi: dual ethernet Raspberry Pi with compute module 4
|
|
|
|
`cfg/` contains the configuration files for all boxes
|
|
|
|
`to_system/` contains the files to be installed in the system
|
|
|
|
`to_<box>/` system files specific for a box (box names as in above list)
|
|
|
|
|
|
## config files
|
|
|
|
filename: cfg/(hostname)_(hexdigits).cfg
|
|
|
|
* (hostname) the hostname to be given on startup
|
|
* (hexdigits) the last six digits of the ethernet adress of the first interface on the APU (leftmost plug)
|
|
|
|
### example content of a config files for a control box:
|
|
|
|
```
|
|
[BOX]
|
|
type=controlbox
|
|
|
|
[NETWORK]
|
|
eth0=192.168.127.254 # leftmost socket: connect here a moxa with factory settings
|
|
eth1=192.168.2.2 # connected device will get this ip via DHCP
|
|
eth2=192.168.3.3 # or must be configured static to this IP
|
|
eth3=dhcp # rightmost socket is the uplink
|
|
|
|
[ROUTER]
|
|
3000=/dev/ttyUSB0 # routing 3000 to the internal serial port /dev/ttyUSB0
|
|
5900=192.168.2.33 # routing VNC (local port 5900 to port 5900 on 192.168.2.33
|
|
8080=192.168.127.254:80 # routing 8080 to port 80 of 192.168.127.254
|
|
|
|
[FRAPPY]
|
|
cfg=uniax # the cfg file for the frappy server
|
|
port=5000 # the port for the frappy server
|
|
|
|
[DISPLAY]
|
|
startup_text=startup...|HOST|ADDR # startup text, 3 lines separated with |
|
|
```
|
|
|
|
the [BOX] section is optional for controlbox and bare-apu
|
|
|
|
|
|
### example content of a config files for a control box:
|
|
|
|
```
|
|
[BOX]
|
|
type=ionopi
|
|
|
|
[NETWORK]
|
|
eth0=wan
|
|
```
|
|
|
|
## network configuration
|
|
|
|
The example above fits the most cases.
|
|
|
|
Here a detailed description of possible settings:
|
|
|
|
### fixed IP
|
|
```
|
|
eth1=192.168.3.5
|
|
```
|
|
Configure the IP address of the connected device to get the specified IP via DHCP or
|
|
configure the device to with this static IP. The last number must be within 1..254,
|
|
the APU port itself will get 1 (or 2, if the specified IP is 1).
|
|
|
|
### custom network
|
|
```
|
|
eth2=192.168.3.1/24 # our ip address, the static address of the connected device must
|
|
# be within 1-254 and not match our own
|
|
```
|
|
24 means 24 bit = 3 bytes network address.
|
|
A local network with static addresses. This way, the APU can get an other address than
|
|
192.168.x.1 or 192.168.x.2 or the network address size might be defined other than 24.
|
|
Probably needed rarely.
|
|
|
|
### uplink via DHCP
|
|
```
|
|
eth0=wan # or eth0=dhcp
|
|
```
|
|
Uplink configured for DHCP in any network n.x.y.z with n < 192
|
|
|
|
### customized uplink
|
|
```
|
|
eth0=wan,192.168.1.0/24
|
|
```
|
|
Add more networks to the allowed uplink range. More than one range is allowed, comma separated.
|
|
Must not overlap networks specified for other ports!
|
|
|
|
### disabled port
|
|
```
|
|
eth3=off # disabled
|
|
```
|
|
|
|
## display
|
|
|
|
available on control boxes (MLZ type) only. must therefore not be present on bare apu boxes.
|
|
|
|
|
|
## Installation of a Fresh Control Box or bare APU
|
|
|
|
Install image by means of a USB stick named e.g. 'apu-boot1'.
|
|
The stick has TinyLinux on it and some additional scripts,
|
|
if you do not have one, you may create it from another box.
|
|
|
|
### a) create a USB stick with TinyLinux (omit if you have the stick already)
|
|
|
|
log in to an apu box
|
|
```
|
|
apu> cd boxtools
|
|
apu> ./maketiny
|
|
```
|
|
You are asked to give the device name from a list (typically sdb)
|
|
before it writes to the stick.
|
|
|
|
|
|
### b) boot with TinyLinux from USB stick
|
|
|
|
for the following we assume now that the stick is named
|
|
|
|
- connect LAN to the leftmost socket
|
|
- put the stick into an apu or control box
|
|
- power
|
|
|
|
after 1-2 minutes the stick should be detectable with
|
|
|
|
```
|
|
> nslookup apu-boot1
|
|
```
|
|
|
|
If the returned ip address starts with 10., you have to register the box in PacketFence.
|
|
Use the the name (e.g. apu-boot1) or the given IP to find the box in PacketFence.
|
|
Register the role as 'sinq-samenv'
|
|
|
|
|
|
If the returned ip address starts with 129.129., you can login with
|
|
|
|
```
|
|
> ssh tc@apu-boot1
|
|
```
|
|
|
|
If this does not work you might try to use the console to login.
|
|
|
|
Connect a Mac with an USB to serial adapter (and null-modem!).
|
|
```
|
|
mac> screen /dev/tty.usbserial-130 115200
|
|
```
|
|
|
|
|
|
### c) Copy Image to APU SSD
|
|
|
|
After logging in, either by ssh or the console do:
|
|
|
|
```
|
|
> write_to_ssd
|
|
|
|
images from l_samenv@samenv:boxes/apuimages:
|
|
|
|
2022-11-09.lz4
|
|
2024-01-18.lz4
|
|
|
|
which image?
|
|
```
|
|
|
|
* Enter the image you want to write (typically the last one).
|
|
* It will take around 10 mins to write the image.
|
|
* remove the stick, power off/on (or do `sudo reboot now`)
|
|
|
|
|
|
### d) Install Services
|
|
|
|
login as `l_samenv@<ip from (b) above>`
|
|
|
|
```
|
|
> cd boxtools
|
|
> git pull
|
|
> python3 install.py
|
|
...
|
|
enter host name:
|
|
...
|
|
|
|
> reboot now
|
|
```
|
|
|
|
After some time, it should be possible to get the host name with
|
|
|
|
```
|
|
> nslookup <hostname given in (d) above>
|
|
```
|
|
|
|
|
|
### e) Install Display Firmware (control box only)
|
|
|
|
If the display is in test mode, finish it by touching several times.
|
|
Then install the firmware:
|
|
|
|
> cd boxtools
|
|
> git pull
|
|
> sudo python3 display.py fw_display.bin
|
|
|
|
|
|
### f) Cloning an Image from an Existing Box
|
|
|
|
Use (b) above to boot from the USB stick
|
|
```
|
|
$ clone
|
|
```
|
|
You are asked to confirm or change the image name.
|
|
|
|
|
|
## Installation of a Fresh Raspberry Pi
|
|
|
|
### install from cloned image (work currently from a Mac only, or may be from another raspberry)
|
|
|
|
Put compute module into PoE adapter, connect microUSB 'POWER' to
|
|
a USB power supply, and connect micorUSB 'SLAVE' to your computer.
|
|
|
|
Go to the rpi subdir and then start
|
|
```
|
|
cd rpi
|
|
`./write_to emmc
|
|
```
|
|
|
|
You may test starting up the compute module in the PoE adapter, with a
|
|
LAN cable attached, or directly in the iono pi max.
|
|
|
|
* on startup, the name will be boxaaaaaa with aaaaaa the last digits of the ethernet address
|
|
* a new file should be created in the cfg sub directory
|
|
|
|
|
|
### installing RPI tools from an fresh raspberry image (downloaded with Raspberry Pi Imager)
|
|
|
|
use the script install-ionopimax.sh or install-ionopi.sh
|
|
(together with configsrtc.sh config-rtc-MCP79410.service)
|
|
to add the needed items for iono pi and the run time clock
|
|
|
|
### create a clone image
|
|
|
|
In the rpi subdirectory, execute
|
|
```
|
|
./clone
|
|
```
|
|
An dated image will be created within about 10 min. and copied to the given directory.
|
|
|
|
|
|
|