-
Notifications
You must be signed in to change notification settings - Fork 575
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
This add support for the Pine64 and Pine64+ ARM64 SBCs. Signed-off-by: Jorik Jonker <jorik@kippendief.biz>
- Loading branch information
Showing
5 changed files
with
166 additions
and
2 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
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
101 changes: 101 additions & 0 deletions
101
internal/app/machined/pkg/runtime/v1alpha1/board/pine64/pine64.go
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,101 @@ | ||
// 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 pine64 | ||
|
||
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-sunxi-with-spl.bin", constants.BoardPine64) | ||
off int64 = 1024 * 8 | ||
dtb = "/dtb/allwinner/sun50i-a64-pine64-plus.dtb" | ||
) | ||
|
||
// Pine64 represents the Pine64 board | ||
// | ||
// References: | ||
// - http://linux-sunxi.org/Pine64 | ||
type Pine64 struct{} | ||
|
||
// Name implements the runtime.Board. | ||
func (b *Pine64) Name() string { | ||
return constants.BoardBananaPiM64 | ||
} | ||
|
||
// Install implements the runtime.Board. | ||
func (b Pine64) 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 | ||
} | ||
//nolint:errcheck | ||
defer f.Close() | ||
|
||
var uboot []byte | ||
|
||
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 | ||
} | ||
|
||
err = copy.File(src, dst) | ||
if err != nil { | ||
return err | ||
} | ||
|
||
return nil | ||
} | ||
|
||
// KernelArgs implements the runtime.Board. | ||
func (b Pine64) KernelArgs() procfs.Parameters { | ||
return []*procfs.Parameter{ | ||
procfs.NewParameter("console").Append("tty0").Append("ttyS0,115200"), | ||
} | ||
} | ||
|
||
// PartitionOptions implements the runtime.Board. | ||
func (b Pine64) PartitionOptions() *runtime.PartitionOptions { | ||
return &runtime.PartitionOptions{PartitionsOffset: 2048} | ||
} |
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
57 changes: 57 additions & 0 deletions
57
website/content/docs/v0.11/Single Board Computers/pine64.md
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,57 @@ | ||
--- | ||
title: "Pine64" | ||
description: "Installing Talos on a Pine64 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-pine64-arm64.img.xz | ||
xz -d metal-pine64-arm64.img.xz | ||
``` | ||
|
||
## Writing the Image | ||
|
||
The path to your SD card can be found using `fdisk` on Linux or `diskutil` on macOS. | ||
In this example, we will assume `/dev/mmcblk0`. | ||
|
||
Now `dd` the image to your SD card: | ||
|
||
```bash | ||
sudo dd if=metal-pine64-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 | ||
``` |