forked from siderolabs/talos
-
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.
Adds board Turing RK1 (rk3588) board support Add kernel module check for 6.6 Temporary alternative u-boot & kernel image Signed-off-by: Nico Berlee <[email protected]>
- Loading branch information
Showing
12 changed files
with
274 additions
and
32 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
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
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
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
94 changes: 94 additions & 0 deletions
94
internal/app/machined/pkg/runtime/v1alpha1/board/turing_rk1/turing_rk1.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,94 @@ | ||
// 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 TuringRK1 provides the Turing RK1 implementation. | ||
package TuringRK1 | ||
|
||
import ( | ||
"os" | ||
"path/filepath" | ||
|
||
"github.com/siderolabs/go-procfs/procfs" | ||
"golang.org/x/sys/unix" | ||
|
||
"github.com/siderolabs/talos/internal/app/machined/pkg/runtime" | ||
"github.com/siderolabs/talos/pkg/copy" | ||
"github.com/siderolabs/talos/pkg/machinery/constants" | ||
) | ||
|
||
var ( | ||
bin = constants.BoardTuringRK1 + "/u-boot-rockchip.bin" | ||
off int64 = 512 * 64 | ||
dtb = "rockchip/rk3588-turing-rk1.dtb" | ||
) | ||
|
||
// TuringRK1 represents the Rockchip RK3588 based SoM from Turing Machines. | ||
// | ||
// Reference: https://rockpi.org/ | ||
type TuringRK1 struct{} | ||
|
||
// Name implements the runtime.Board. | ||
func (r *TuringRK1) Name() string { | ||
return constants.BoardTuringRK1 | ||
} | ||
|
||
// Install implements the runtime.Board. | ||
func (r *TuringRK1) Install(options runtime.BoardInstallOptions) (err error) { | ||
var f *os.File | ||
|
||
if f, err = os.OpenFile(options.InstallDisk, os.O_RDWR|unix.O_CLOEXEC, 0o666); err != nil { | ||
return err | ||
} | ||
|
||
defer f.Close() //nolint:errcheck | ||
|
||
uboot, err := os.ReadFile(filepath.Join(options.UBootPath, bin)) | ||
if err != nil { | ||
return err | ||
} | ||
|
||
options.Printf("writing %s at offset %d", bin, off) | ||
|
||
var n int | ||
|
||
n, err = f.WriteAt(uboot, off) | ||
if err != nil { | ||
return err | ||
} | ||
|
||
options.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 := filepath.Join(options.DTBPath, dtb) | ||
dst := filepath.Join(options.MountPrefix, "/boot/EFI/dtb", 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 *TuringRK1) KernelArgs() procfs.Parameters { | ||
return []*procfs.Parameter{ | ||
procfs.NewParameter("console").Append("tty0").Append("ttyS9,115200").Append("ttyS2,115200"), | ||
procfs.NewParameter("sysctl.kernel.kexec_load_disabled").Append("1"), | ||
procfs.NewParameter(constants.KernelParamDashboardDisabled).Append("1"), | ||
procfs.NewParameter("cma").Append("128MB"), | ||
} | ||
} | ||
|
||
// PartitionOptions implements the runtime.Board. | ||
func (r *TuringRK1) PartitionOptions() *runtime.PartitionOptions { | ||
return &runtime.PartitionOptions{PartitionsOffset: 2048 * 10} | ||
} |
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
Oops, something went wrong.