mirror of
https://github.com/siderolabs/talos.git
synced 2025-12-15 22:41:55 +01:00
feat: add Rock pi 4 support
Another nice addition to the list of supported SBCs. Signed-off-by: Artem Chernyshev <artem.0xD2@gmail.com>
This commit is contained in:
parent
1362966ff5
commit
83b4e7f744
2
Makefile
2
Makefile
@ -166,7 +166,7 @@ image-%: ## Builds the specified image. Valid options are aws, azure, digital-oc
|
||||
|
||||
images: image-aws image-azure image-digital-ocean image-gcp image-metal image-openstack image-vmware ## Builds all known images (AWS, Azure, Digital Ocean, GCP, Metal, Openstack, and VMware).
|
||||
|
||||
sbc-%: ## Builds the specified SBC image. Valid options are rpi_4, rock64, bananapi_m64, and libretech_all_h3_cc_h5 (e.g. sbc-rpi_4)
|
||||
sbc-%: ## Builds the specified SBC image. Valid options are rpi_4, rock64, bananapi_m64, libretech_all_h3_cc_h5, and rockpi_4 (e.g. sbc-rpi_4)
|
||||
@docker pull $(REGISTRY_AND_USERNAME)/installer:$(TAG)
|
||||
@docker run --rm -v /dev:/dev --privileged $(REGISTRY_AND_USERNAME)/installer:$(TAG) image --platform metal --board $* --tar-to-stdout | tar xz -C $(ARTIFACTS)
|
||||
|
||||
|
||||
@ -15,6 +15,7 @@ import (
|
||||
bananapim64 "github.com/talos-systems/talos/internal/app/machined/pkg/runtime/v1alpha1/board/bananapi_m64"
|
||||
libretechallh3cch5 "github.com/talos-systems/talos/internal/app/machined/pkg/runtime/v1alpha1/board/libretech_all_h3_cc_h5"
|
||||
"github.com/talos-systems/talos/internal/app/machined/pkg/runtime/v1alpha1/board/rock64"
|
||||
rockpi4 "github.com/talos-systems/talos/internal/app/machined/pkg/runtime/v1alpha1/board/rockpi4"
|
||||
rpi4 "github.com/talos-systems/talos/internal/app/machined/pkg/runtime/v1alpha1/board/rpi_4"
|
||||
"github.com/talos-systems/talos/pkg/machinery/constants"
|
||||
)
|
||||
@ -55,6 +56,8 @@ func newBoard(board string) (b runtime.Board, err error) {
|
||||
b = &bananapim64.BananaPiM64{}
|
||||
case constants.BoardRock64:
|
||||
b = &rock64.Rock64{}
|
||||
case constants.BoardRockpi4:
|
||||
b = &rockpi4.Rockpi4{}
|
||||
default:
|
||||
return nil, fmt.Errorf("unsupported board: %q", board)
|
||||
}
|
||||
|
||||
@ -0,0 +1,93 @@
|
||||
// This Source Code Form is subject to the terms of the Mozilla Public
|
||||
// License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||
// file, You can obtain one at http://mozilla.org/MPL/2.0/.
|
||||
|
||||
package rock64
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"io/ioutil"
|
||||
"log"
|
||||
"os"
|
||||
"path/filepath"
|
||||
|
||||
"github.com/talos-systems/go-procfs/procfs"
|
||||
"golang.org/x/sys/unix"
|
||||
|
||||
"github.com/talos-systems/talos/internal/app/machined/pkg/runtime"
|
||||
"github.com/talos-systems/talos/pkg/copy"
|
||||
"github.com/talos-systems/talos/pkg/machinery/constants"
|
||||
)
|
||||
|
||||
var (
|
||||
bin = fmt.Sprintf("/usr/install/u-boot/%s/u-boot-rockchip.bin", constants.BoardRockpi4)
|
||||
off int64 = 512 * 64
|
||||
dtb = "/dtb/rockchip/rk3399-rock-pi-4c.dtb"
|
||||
)
|
||||
|
||||
// Rockpi4 represents the Radxa rock pi board.
|
||||
//
|
||||
// Reference: https://rockpi.org/
|
||||
type Rockpi4 struct{}
|
||||
|
||||
// Name implements the runtime.Board.
|
||||
func (r *Rockpi4) Name() string {
|
||||
return constants.BoardRockpi4
|
||||
}
|
||||
|
||||
// Install implements the runtime.Board.
|
||||
func (r *Rockpi4) Install(disk string) (err error) {
|
||||
var f *os.File
|
||||
|
||||
if f, err = os.OpenFile(disk, os.O_RDWR|unix.O_CLOEXEC, 0o666); err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
defer f.Close() //nolint:errcheck
|
||||
|
||||
uboot, err := ioutil.ReadFile(bin)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
log.Printf("writing %s at offset %d", bin, off)
|
||||
|
||||
var n int
|
||||
|
||||
n, err = f.WriteAt(uboot, off)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
log.Printf("wrote %d bytes", n)
|
||||
|
||||
// NB: In the case that the block device is a loopback device, we sync here
|
||||
// to esure that the file is written before the loopback device is
|
||||
// unmounted.
|
||||
err = f.Sync()
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
src := "/usr/install" + dtb
|
||||
dst := "/boot/EFI" + dtb
|
||||
|
||||
err = os.MkdirAll(filepath.Dir(dst), 0o600)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
return copy.File(src, dst)
|
||||
}
|
||||
|
||||
// KernelArgs implements the runtime.Board.
|
||||
func (r *Rockpi4) KernelArgs() procfs.Parameters {
|
||||
return []*procfs.Parameter{
|
||||
procfs.NewParameter("console").Append("tty0").Append("ttyS2,1500000n8"),
|
||||
}
|
||||
}
|
||||
|
||||
// PartitionOptions implements the runtime.Board.
|
||||
func (r *Rockpi4) PartitionOptions() *runtime.PartitionOptions {
|
||||
return &runtime.PartitionOptions{PartitionsOffset: 2048 * 10}
|
||||
}
|
||||
@ -46,6 +46,9 @@ const (
|
||||
// BoardRock64 is the name of the Pine64 Rock64.
|
||||
BoardRock64 = "rock64"
|
||||
|
||||
// BoardRockpi4 is the name of the Radxa Rock pi 4.
|
||||
BoardRockpi4 = "rockpi_4"
|
||||
|
||||
// KernelParamHostname is the kernel parameter name for specifying the
|
||||
// hostname.
|
||||
KernelParamHostname = "talos.hostname"
|
||||
|
||||
57
website/content/docs/v0.9/Single Board Computers/rockpi_4.md
Normal file
57
website/content/docs/v0.9/Single Board Computers/rockpi_4.md
Normal file
@ -0,0 +1,57 @@
|
||||
---
|
||||
title: "Radxa ROCK PI 4c"
|
||||
description: "Installing Talos on Radxa ROCK PI 4c SBC using raw disk image."
|
||||
---
|
||||
|
||||
## Prerequisites
|
||||
|
||||
You will need
|
||||
|
||||
- `talosctl`
|
||||
- an SD card
|
||||
|
||||
Download the latest alpha `talosctl`.
|
||||
|
||||
```bash
|
||||
curl -Lo /usr/local/bin/talosctl https://github.com/talos-systems/talos/releases/latest/download/talosctl-$(uname -s | tr "[:upper:]" "[:lower:]")-amd64
|
||||
chmod +x /usr/local/bin/talosctl
|
||||
```
|
||||
|
||||
## Download the Image
|
||||
|
||||
Download the image and decompress it:
|
||||
|
||||
```bash
|
||||
curl -LO https://github.com/talos-systems/talos/releases/latest/download/metal-rockpi_4-arm64.img.xz
|
||||
xz -d metal-rockpi_4-arm64.img.xz
|
||||
```
|
||||
|
||||
## Writing the Image
|
||||
|
||||
The path to your SD card can be found using `fdisk` on Linux or `diskutil` on Mac OS.
|
||||
In this example we will assume `/dev/mmcblk0`.
|
||||
|
||||
Now `dd` the image to your SD card:
|
||||
|
||||
```bash
|
||||
sudo dd if=metal-rockpi_4-arm64.img of=/dev/mmcblk0 conv=fsync bs=4M
|
||||
```
|
||||
|
||||
## Bootstrapping the Node
|
||||
|
||||
Insert the SD card to your board, turn it on and wait for the console to show you the instructions for bootstrapping the node.
|
||||
Following the instructions in the console output to connect to the interactive installer:
|
||||
|
||||
```bash
|
||||
talosctl apply-config --insecure --interactive --nodes <node IP or DNS name>
|
||||
```
|
||||
|
||||
Once the interactive installation is applied, the cluster will form and you can then use `kubectl`.
|
||||
|
||||
## Retrieve the `kubeconfig`
|
||||
|
||||
Retrieve the admin `kubeconfig` by running:
|
||||
|
||||
```bash
|
||||
talosctl kubeconfig
|
||||
```
|
||||
Loading…
x
Reference in New Issue
Block a user