This repository has been archived by the owner on Aug 19, 2023. It is now read-only.
forked from siderolabs/sidero
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
docs: add doc for using rpi4 as server.
This guide explains how to use RPI4 as servers when using sidero. Closes: siderolabs/talos#3621 Signed-off-by: Kevin Hellemun <17928966+OGKevin@users.noreply.github.com>
- Loading branch information
Showing
1 changed file
with
186 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,186 @@ | ||
--- | ||
description: "Using Raspberrypi pi 4 as servers" | ||
weight: 6 | ||
--- | ||
|
||
# Raspberrypi4 as servers | ||
|
||
This guide will explain on how to use Sidero to manage Raspberrypi-4's as | ||
servers. This guide goes hand in hand with the [bootstrapping | ||
guide](/docs/v0.3/guides/bootstrapping). | ||
|
||
From the bootstrapping guide, reach "Install Sidero" and come back to this | ||
guide. Once you finish with this guide, you will need to go back to the | ||
bootstrapping guide and continue with "Register the servers". | ||
|
||
The rest of this guide goes with the assumption that you've a cluster setup with | ||
sidero and ready to accept servers. This guide will explain the changes that | ||
needs to be made to be able to accept RPI4 as server. | ||
|
||
# RPI4 boot process | ||
To be able to boot talos on the Pi4 via network, we need to undergo a 2 step | ||
boot process. The Pi4 has an EEPROM which contains code to boot up the Pi. This | ||
EEPROM expects a specific boot folder structure as explained on | ||
[this](https://www.raspberrypi.org/documentation/configuration/boot_folder.md) page. | ||
We will use the EEPROM to boot into UEFI, which we will then use to PXE and iPXE boot into sidero & talos. | ||
|
||
# Prerequisites | ||
## Update EEPROM | ||
To enable the EEPROM on the Pi to support network booting, we must update it to | ||
the latest version. Visit the | ||
[release](https://github.com/raspberrypi/rpi-eeprom/releases) page and grab the | ||
latest `rpi-boot-eeprom-recovery-*-network.zip` (as of time of writing, | ||
v2021.0v.29-138a1 was used). Put this on a SD card and plug it into the Pi. The | ||
Pi's status light will flash rapidly after a few seconds, this indicates that | ||
the EEPROM has been updated. | ||
|
||
This operation needs to be done once per Pi. | ||
|
||
## Serial number | ||
Power on the Pi without an SD card in it and hook it up to a monitor, | ||
|
||
<!-- todo: Explain how to get serial number from this page --> | ||
|
||
## talos-systems/pkg | ||
Clone the [talos-systems/pkg](https://github.com/talos-systems/pkgs) repo. | ||
Create a new folder called `raspberrypi4-eufi` and `raspberrypi4-eufi/serials`. | ||
Create a file `raspberrypi4-eufi/pkg.yaml` containing the following: | ||
``` | ||
name: raspberrypi4-eufi | ||
variant: alpine | ||
install: | ||
- unzip | ||
steps: | ||
# {{ if eq .ARCH "aarch64" }} This in fact is YAML comment, but Go templating instruction is evaluated by bldr restricting build to arm64 only | ||
- sources: | ||
- url: https://github.com/pftf/RPi4/releases/download/v1.26/RPi4_UEFI_Firmware_v1.26.zip # <-- update version NR accordingly. | ||
destination: RPi4_UEFI_Firmware.zip | ||
sha256: d6db87484dd98dfbeb64eef203944623130cec8cb71e553eab21f8917e0285f7 | ||
sha512: 96a71086cdd062b51ef94726ebcbf15482b70c56262555a915499bafc04aff959d122410af37214760eda8534b58232a64f6a8a0a8bb99aba6de0f94c739fe98 | ||
prepare: | ||
- | | ||
unzip RPi4_UEFI_Firmware.zip | ||
rm RPi4_UEFI_Firmware.zip | ||
mkdir /rpi4 | ||
mv ./* /rpi4 | ||
install: | ||
- | | ||
mkdir /rootfs | ||
ls /pkg/serials | while read serial; do mkdir /rootfs/$serial && cp -r /rpi4/* /rootfs/$serial && cp -r /pkg/serials/$serial/* /rootfs/$serial/; done | ||
# {{ else }} | ||
- install: | ||
- | | ||
mkdir -p /rootfs | ||
# {{ end }} | ||
finalize: | ||
- from: /rootfs | ||
to: / | ||
``` | ||
|
||
# EUFI / RPi4 | ||
|
||
Now that the EEPROM can network boot, we need to prepare the structure of our | ||
boot folder. Essentially what the bootloader will do is look for the this folder | ||
on the network rather than on the SD card. | ||
|
||
Visit the [release page of RPi4](https://github.com/pftf/RPi4/releases) and grab | ||
the latest `RPi4_UEFI_Firmware_v*.zip` (at the time of writing, v1.26 was used). | ||
Extract the zip into a folder, the structure will look like the following: | ||
|
||
``` | ||
. | ||
├── RPI_EFI.fd | ||
├── RPi4_UEFI_Firmware_v1.26.zip | ||
├── Readme.md | ||
├── bcm2711-rpi-4-b.dtb | ||
├── bcm2711-rpi-400.dtb | ||
├── bcm2711-rpi-cm4.dtb | ||
├── config.txt | ||
├── firmware | ||
│ ├── LICENCE.txt | ||
│ ├── Readme.txt | ||
│ ├── brcmfmac43455-sdio.bin | ||
│ ├── brcmfmac43455-sdio.clm_blob | ||
│ └── brcmfmac43455-sdio.txt | ||
├── fixup4.dat | ||
├── overlays | ||
│ └── miniuart-bt.dtbo | ||
└── start4.elf | ||
``` | ||
As a one time operation, we need to configure EUFI to do network booting by | ||
default, remove the 3gb mem limit if it's set and optionally set the CPU clock to | ||
max. | ||
Take these files and put them on the SD card and boot the Pi. You will see | ||
the Pi logo and the option to hit `esc`. | ||
|
||
<!-- todo: explain how to change boot order, mem, and cpu --> | ||
|
||
When you hit `reset`, the settings will be save to the `RPI_EFI.fd` file on the | ||
SD card. This is where we will run into a limitation that is explained in the | ||
following issue: https://github.com/pftf/RPi4/issues/59. What this mean is that | ||
we need to create a `RPI_EFI.fd` file for each Pi that we want to use as server. | ||
This is because that the MAC address is also stored in the `RPI_EFI.fd` file, | ||
which makes it invalid when you try to use it in a different Pi. | ||
|
||
Plug the SD card back into your computer and extract the `RPI_EFI.fd` file from | ||
it and place it into the `raspberrypi4-eufi/serials/<serial>/`. The dir should | ||
look like this: | ||
``` | ||
raspberrypi4-eufi/ | ||
├── pkg.yaml | ||
└── serials | ||
└─── XXXXXXXX | ||
└── RPI_EFI.fd | ||
``` | ||
|
||
# Build the image with the boot folder contents | ||
Now that we have the `RPI_EFI.fd` of our Pi in the correct location, we must now | ||
build a docker image containing the boot folder for the EEPROM. To do this, run | ||
the following command in the pkgs repo: | ||
|
||
`make PLATFORM=linux/arm64 USERNAME=$USERNAME PUSH=true TARGETS=raspberrypi4-eufi` | ||
|
||
This will build and push the following image: | ||
`ghcr.io/ogkevin/raspberrypi4-eufi:<tag>` | ||
|
||
_If you need to change some other settings like registry etc, have a look in the | ||
Makefile to see the available variables that you can override._ | ||
|
||
The content of the image will be the following: | ||
|
||
``` | ||
280b960e | ||
├── RPI_EFI.fd | ||
├── Readme.md | ||
├── bcm2711-rpi-4-b.dtb | ||
├── bcm2711-rpi-400.dtb | ||
├── bcm2711-rpi-cm4.dtb | ||
├── config.txt | ||
├── firmware | ||
│ ├── LICENCE.txt | ||
│ ├── Readme.txt | ||
│ ├── brcmfmac43455-sdio.bin | ||
│ ├── brcmfmac43455-sdio.clm_blob | ||
│ └── brcmfmac43455-sdio.txt | ||
├── fixup4.dat | ||
├── overlays | ||
│ └── miniuart-bt.dtbo | ||
└── start4.elf | ||
``` | ||
|
||
# Patch metal controller | ||
To enable the 2 boot process, we need to include this EEPROM boot folder into | ||
the sidero's tftp folder. To achieve this, we will use a init container using | ||
the image we created above to copy the contents of it into the tftp folder. | ||
|
||
<!-- todo: explain how to create init container with shared empty dir between | ||
sidero and init container --> | ||
|
||
<!-- cp / /var/lib/sidero/tftp should be it--> | ||
|
||
# Profit | ||
|
||
With the patched metal controller, you should not be able to register the Pi4 to | ||
sidero by just connecting it to the network. From this point you can continue | ||
with the [bootstrapping | ||
guide](/docs/v0.3/guides/bootstrapping) at "Register the servers". |