From 80edb3a58138498ae08d040b49e1016d35fb1991 Mon Sep 17 00:00:00 2001 From: Markus Zolliker Date: Tue, 16 Jan 2024 12:57:06 +0100 Subject: [PATCH] add docu for installing APU to README.md --- README.md | 116 ++++++++++++++++++++++++++++++++++++++++++++++++++++-- 1 file changed, 113 insertions(+), 3 deletions(-) diff --git a/README.md b/README.md index 7c438a2..a9216d5 100644 --- a/README.md +++ b/README.md @@ -18,7 +18,7 @@ content of the config files: ``` [NETWORK] enp1s0=192.168.127.254 # leftmost socket: connect here a moxa with factory settings -enp2s0=192.168.2.2 # connected device will get this ip via DHCP +enp2s0=192.168.2.2 # connected device will get this ip via DHCP enp3s0=192.168.3.3 # or must be configured static to this IP enp4s0=dhcp # rightmost socket is the uplink @@ -47,7 +47,7 @@ Here a detailed description of possible settings: ``` enp2s0=192.168.3.5 ``` -Configure the IP address of the connected device to get the specified IP via DHCP or +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). @@ -63,7 +63,7 @@ Probably needed rarely. ### uplink via DHCP ``` -enp4s0=wan # or enp4s0=dhcp +enp4s0=wan # or enp4s0=dhcp ``` Uplink configured for DHCP in any network n.x.y.z with n < 192 @@ -84,4 +84,114 @@ enp3s0=off # disabled 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 + +### Tools / Resources needed + +#### progress bar + +On mac use ``brew install pv`` to install. If you do not want it, you may leve it out, +it is a matter of convenience. In this case omit ``| pv `` in the commands + + + +## install image by means of an USB stick + +The stick has TinyLinux and on it and some additional scripts + +If you do not have one, you may create it logging to an other box as root + +### a) create a USB stick with TinyLinux (omit if you have the stick already) + +to verify that /dev/sdb is your stick, use the following command before and after plugging the stick +``` +apu> ls /dev/sdb +``` + +copy the stick image to the stick (32 GB should be enough) + +``` +mac> dd if=apuinstall.lz4 bs=512k | pv | ssh root@ "lz4 -d | dd of=/dev/sdb bs=512k" +``` + +### b) mount with TinyLinux from USB stick + +Connect a Mac with an USB to serial adapter (and null-modem!). +If no such adapter is available, you might try to connect LAN and search for computer name box, +do the registration in PacketFence and reboot, login with root/root). +``` +mac> screen /dev/tty.usbserial-130 115200 +``` + +Do not yet connect LAN, plug USB stick and start the box, wait for prompt 'tc@box:' +``` +apu> cd /media/CENTOS7_APU (or /media/CENTOS_APU) +apu> sh reg +``` + +enter new hostname (HWaddr will be on the output) +register to PacketFence (if not yet done) and set role to sinq-samenv +connect LAN to rightmost socket on a bare APU or the leftmost socket an a control box +``` +apu> sh tiny +... +some random art images are shown ... +... +inet addr:129.168.1.43 Bcast:192.168.1.255 Mask:255.255.255.0 +inet addr:127.0.0.1 Mask:255.0.0.0 +``` + +Use the displayed ip address for the following step. + + +### c) Copy Image to APU SSD +``` +mac> cd ~/switchdrive/apu/images +mac> dd if=apumaster.lz4 bs=512k | pv | ssh root@192.168.1.43 "lz4 -d | dd of=/dev/sda bs=512k" +``` + +(you are asked for root password, which is root, ``| pv `` may be omitted) + +remove the stick, power off/on + +login with root/FrappyLinse +``` +> cd aputools +> git pull +> python3 install.py +... +enter host name: +... + +> reboot now +``` + +DONE! + + +### d) Cloning an Image from an Existing Box + +Use (b) above to boot from TinyLinux (replace the IP address by the one from the box!) +First make sure that a copy of the last apumaster.lz4 is saved with its date. +``` +mac> ssh root@192.168.1.43 "dd if=/dev/sda bs=512k | lz4" | pv | dd of=apumaster.lz4 bs=512k +``` + + +### e) Appendix + +Source of scripts on TinyLinux: +``` +apu> cat tini.sh +tce-load -wi nano +tce-load -wi lz4 +tce-load -wi openssh +sudo /usr/local/etc/init.d/openssh start +sudo chpasswd << EOF +tc:tc +root:root +EOF +ifconfig | grep 'inet addr' +``` +