From 10e444d552ebf6370fb8ffc389039b7f13d85f32 Mon Sep 17 00:00:00 2001 From: Tim O'Guin Date: Thu, 4 Dec 2025 14:47:22 -0600 Subject: [PATCH] feat: add support for FriendlyElec CM3588 NAS This adds initial support for the CM3588 NAS, based on the Rockchip RK3588 SoC. There is no SPI boot image in upstream u-boot, so I left it out. Changes: - Add friendlyelec-cm3588-nas build profile - Add u-boot artifacts - Add installer for board Signed-off-by: Tim O'Guin Signed-off-by: Noel Georgi --- MAINTAINERS.md | 45 ++++----- README.md | 45 ++++----- .../friendlyelec-cm3588-nas/u-boot/pkg.yaml | 36 +++++++ go.work | 1 + installers/friendlyelec-cm3588-nas/pkg.yaml | 33 +++++++ installers/friendlyelec-cm3588-nas/src/go.mod | 11 +++ installers/friendlyelec-cm3588-nas/src/go.sum | 10 ++ .../friendlyelec-cm3588-nas/src/main.go | 96 +++++++++++++++++++ installers/pkg.yaml | 7 ++ .../friendlyelec-cm3588-nas.yaml | 10 ++ profiles/pkg.yaml | 2 + 11 files changed, 252 insertions(+), 44 deletions(-) create mode 100644 artifacts/friendlyelec-cm3588-nas/u-boot/pkg.yaml create mode 100644 installers/friendlyelec-cm3588-nas/pkg.yaml create mode 100644 installers/friendlyelec-cm3588-nas/src/go.mod create mode 100644 installers/friendlyelec-cm3588-nas/src/go.sum create mode 100644 installers/friendlyelec-cm3588-nas/src/main.go create mode 100644 profiles/friendlyelec-cm3588-nas/friendlyelec-cm3588-nas.yaml diff --git a/MAINTAINERS.md b/MAINTAINERS.md index cba83491..f0cd4d69 100644 --- a/MAINTAINERS.md +++ b/MAINTAINERS.md @@ -7,25 +7,26 @@ This document contains a list of maintainers in this repo. For now, you become a ## Current Maintainers -| Overlay Name | Board | PR | SoC | Maintainer | GitHub ID | -| -------------------- | --------------------- | --------------------------------------------------------- | ------- | -------------------------------- | ----------------------------------------------- | -| helios64 | Kobol Helios64 | [#23](https://github.com/siderolabs/sbc-rockchip/pull/23) | RK3399 | Hemanth Bollamreddi | [blmhemu](https://github.com/blmhemu) | -| nanopi-r4s | NanoPi R4S | [#4](https://github.com/siderolabs/sbc-rockchip/pull/4) | RK3399 | TBD (Initial PR moved from pkgs) | TBD | -| nanopi-r5s | NanoPi R5S | [#16](https://github.com/siderolabs/sbc-rockchip/pull/16) | RK3568 | Nicklas Frahm | [nicklasfrahm](https://github.com/nicklasfrahm) | -| odroid-m1 | Hardkernel Odroid M1 | [#67](https://github.com/siderolabs/sbc-rockchip/pull/67) | RK3568 | Albert Lloveras Carbonell | [alloveras](https://github.com/alloveras) | -| orangepi-5 | Orange Pi 5 | [#47](https://github.com/siderolabs/sbc-rockchip/pull/47) | RK3588s | Laurin Streng | [laurinstreng](https://github.com/LaurinStreng) | -| orangepi-5-max | Orange Pi 5 Max | [#77](https://github.com/siderolabs/sbc-rockchip/pull/77) | RK3588 | Alar Okas | [alardev](https://github.com/alardev) | -| orangepi-5-plus | Orange Pi 5 Plus | [#52](https://github.com/siderolabs/sbc-rockchip/pull/52) | RK3588 | Ryan Persée | [rpersee](https://github.com/rpersee) | -| orangepi-r1-plus-lts | Orange Pi R1 Plus LTS | [#9](https://github.com/siderolabs/sbc-rockchip/pull/9) | RK3328 | Giau. Tran Minh | [giautm](https://github.com/giautm) | -| radxa-zero-3e | Radxa ZERO 3E | [#71](https://github.com/siderolabs/sbc-rockchip/pull/71) | RK3566 | Noah Craig | [tyraeis](https://github.com/tyraeis) | -| rock64 | Pine64 Rock64 | [#4](https://github.com/siderolabs/sbc-rockchip/pull/4) | RK3328 | TBD (Initial PR moved from pkgs) | TBD | -| rockpi4 | Rock Pi 4A,Rock Pi 4B | [#1](https://github.com/siderolabs/sbc-rockchip/pull/1) | RK3399 | TBD (Initial PR moved from pkgs) | TBD | -| rockpi4c | Rock Pi 4C | [#1](https://github.com/siderolabs/sbc-rockchip/pull/1) | RK3399 | TBD (Initial PR moved from pkgs) | TBD | -| rockpro64 | Pine64 RockPro64 | [#55](https://github.com/siderolabs/sbc-rockchip/pull/55) | RK3399 | Tim Sandquist | [tsndqst](https://github.com/tsndqst) | -| rock3b | Radxa ROCK 3B | [#73](https://github.com/siderolabs/sbc-rockchip/pull/73) | RK3568 | Micha Bauer | [mi-bauer](https://github.com/mi-bauer) | -| rock4cplus | Radxa ROCK 4C+ | [#5](https://github.com/siderolabs/sbc-rockchip/pull/5) | RK3399 | Damià Poquet Femenia | [DamiaPoquet](https://github.com/DamiaPoquet) | -| rock4se | Radxa ROCK 4SE | [#18](https://github.com/siderolabs/sbc-rockchip/pull/18) | RK3399 | Boran Car | [borancar](https://github.com/borancar) | -| rock5a | Radxa ROCK 5A | [#51](https://github.com/siderolabs/sbc-rockchip/pull/51) | RK3588 | Josh Moore | [joshdmoore](https://github.com/joshdmoore) | -| rock5b | Radxa ROCK 5B | [#45](https://github.com/siderolabs/sbc-rockchip/pull/45) | RK3588 | Christoph Hoopmann | [choopm](https://github.com/choopm) | -| rock5t | Radxa ROCK 5T | [#83](https://github.com/siderolabs/sbc-rockchip/pull/83) | RK3588 | Martin Holovsky | [martinholovsky](https://github.com/martinholovsky) | -| turingrk1 | Turing Machines RK1 | [#35](https://github.com/siderolabs/sbc-rockchip/pull/35) | RK3588 | Nico Berlee | [nberlee](https://github.com/nberlee) | +| Overlay Name | Board | PR | SoC | Maintainer | GitHub ID | +| ----------------------- | ----------------------- | --------------------------------------------------------- | ------- | -------------------------------- | --------------------------------------------------- | +| friendlyelec-cm3588-nas | FriendlyElec CM3588 NAS | [#96](https://github.com/siderolabs/sbc-rockchip/pull/96) | RK3588 | Tim O'Guin | [timoguin](https://github.com/timoguin) | +| helios64 | Kobol Helios64 | [#23](https://github.com/siderolabs/sbc-rockchip/pull/23) | RK3399 | Hemanth Bollamreddi | [blmhemu](https://github.com/blmhemu) | +| nanopi-r4s | NanoPi R4S | [#4](https://github.com/siderolabs/sbc-rockchip/pull/4) | RK3399 | TBD (Initial PR moved from pkgs) | TBD | +| nanopi-r5s | NanoPi R5S | [#16](https://github.com/siderolabs/sbc-rockchip/pull/16) | RK3568 | Nicklas Frahm | [nicklasfrahm](https://github.com/nicklasfrahm) | +| odroid-m1 | Hardkernel Odroid M1 | [#67](https://github.com/siderolabs/sbc-rockchip/pull/67) | RK3568 | Albert Lloveras Carbonell | [alloveras](https://github.com/alloveras) | +| orangepi-5 | Orange Pi 5 | [#47](https://github.com/siderolabs/sbc-rockchip/pull/47) | RK3588s | Laurin Streng | [laurinstreng](https://github.com/LaurinStreng) | +| orangepi-5-max | Orange Pi 5 Max | [#77](https://github.com/siderolabs/sbc-rockchip/pull/77) | RK3588 | Alar Okas | [alardev](https://github.com/alardev) | +| orangepi-5-plus | Orange Pi 5 Plus | [#52](https://github.com/siderolabs/sbc-rockchip/pull/52) | RK3588 | Ryan Persée | [rpersee](https://github.com/rpersee) | +| orangepi-r1-plus-lts | Orange Pi R1 Plus LTS | [#9](https://github.com/siderolabs/sbc-rockchip/pull/9) | RK3328 | Giau. Tran Minh | [giautm](https://github.com/giautm) | +| radxa-zero-3e | Radxa ZERO 3E | [#71](https://github.com/siderolabs/sbc-rockchip/pull/71) | RK3566 | Noah Craig | [tyraeis](https://github.com/tyraeis) | +| rock64 | Pine64 Rock64 | [#4](https://github.com/siderolabs/sbc-rockchip/pull/4) | RK3328 | TBD (Initial PR moved from pkgs) | TBD | +| rockpi4 | Rock Pi 4A,Rock Pi 4B | [#1](https://github.com/siderolabs/sbc-rockchip/pull/1) | RK3399 | TBD (Initial PR moved from pkgs) | TBD | +| rockpi4c | Rock Pi 4C | [#1](https://github.com/siderolabs/sbc-rockchip/pull/1) | RK3399 | TBD (Initial PR moved from pkgs) | TBD | +| rockpro64 | Pine64 RockPro64 | [#55](https://github.com/siderolabs/sbc-rockchip/pull/55) | RK3399 | Tim Sandquist | [tsndqst](https://github.com/tsndqst) | +| rock3b | Radxa ROCK 3B | [#73](https://github.com/siderolabs/sbc-rockchip/pull/73) | RK3568 | Micha Bauer | [mi-bauer](https://github.com/mi-bauer) | +| rock4cplus | Radxa ROCK 4C+ | [#5](https://github.com/siderolabs/sbc-rockchip/pull/5) | RK3399 | Damià Poquet Femenia | [DamiaPoquet](https://github.com/DamiaPoquet) | +| rock4se | Radxa ROCK 4SE | [#18](https://github.com/siderolabs/sbc-rockchip/pull/18) | RK3399 | Boran Car | [borancar](https://github.com/borancar) | +| rock5a | Radxa ROCK 5A | [#51](https://github.com/siderolabs/sbc-rockchip/pull/51) | RK3588 | Josh Moore | [joshdmoore](https://github.com/joshdmoore) | +| rock5b | Radxa ROCK 5B | [#45](https://github.com/siderolabs/sbc-rockchip/pull/45) | RK3588 | Christoph Hoopmann | [choopm](https://github.com/choopm) | +| rock5t | Radxa ROCK 5T | [#83](https://github.com/siderolabs/sbc-rockchip/pull/83) | RK3588 | Martin Holovsky | [martinholovsky](https://github.com/martinholovsky) | +| turingrk1 | Turing Machines RK1 | [#35](https://github.com/siderolabs/sbc-rockchip/pull/35) | RK3588 | Nico Berlee | [nberlee](https://github.com/nberlee) | diff --git a/README.md b/README.md index b818044b..f45d01ba 100644 --- a/README.md +++ b/README.md @@ -4,25 +4,26 @@ This repo provides the overlay for RockChip based Talos image. ## Supported Overlay -| Overlay Name | Board | SoC | Description | -| -------------------- | --------------------- | ------- | --------------------------------------------- | -| helios64 | Kobol Helios64 | RK3399 | Overlay for Kobol Helios64 | -| nanopi-r4s | NanoPi R4S | RK3399 | Overlay for NanoPi R4S | -| nanopi-r5s | NanoPi R5S | RK3568 | Overlay for NanoPi R5S (only WAN, no NVMe) | -| odroid-m1 | Hardkernel Odroid M1 | RK3568 | Overlay for Hardkernel's Odroid M1 | -| orangepi-5 | Orange Pi 5 | RK3588s | Overlay for Orange Pi 5 | -| orangepi-5-max | Orange Pi 5 Max | RK3588 | Overlay for Orange Pi 5 Max | -| orangepi-5-plus | Orange Pi 5 Plus | RK3588 | Overlay for Orange Pi 5 Plus | -| orangepi-r1-plus-lts | Orange Pi R1 Plus LTS | RK3328 | Overlay for Orange Pi R1 Plus LTS | -| radxa-zero-3e | Radxa ZERO 3E | RK3566 | Overlay for Radxa ZERO 3E | -| rock3b | Radxa ROCK 3B | RK3568 | Overlay for Radxa ROCK 3B | -| rock4cplus | Radxa ROCK 4C+ | RK3399 | Overlay for Radxa ROCK 4C+ | -| rock4se | Rock 4 SE | RK3399 | Overlay for Rock 4 SE | -| rock5a | Radxa ROCK 5A | RK3588s | Overlay for Radxa ROCK 5A | -| rock5b | Radxa ROCK 5B | RK3588 | Overlay for Radxa ROCK 5B | -| rock5t | Radxa ROCK 5T | RK3588 | Overlay for Radxa ROCK 5T | -| rock64 | Pine64 Rock64 | RK3328 | Overlay for Pine64 Rock64 | -| rockpi4 | Rock Pi 4A,Rock Pi 4B | RK3399 | Generic overlay for Rock Pi 4A and Rock Pi 4B | -| rockpi4c | Rock Pi 4C | RK3399 | Overlay for Rock Pi 4C | -| rockpro64 | Pine64 ROCKPro64 | RK3399 | Overlay for Pine64 ROCKPro64 | -| turingrk1 | Turing Machines RK1 | RK3588 | Overlay for Turing Machines RK1 | +| Overlay Name | Board | SoC | Description | +| ----------------------- | ----------------------- | ------- | ---------------------------------------------- | +| friendlyelec-cm3588-nas | FriendlyElec CM3588 NAS | RK3588 | Overlay for FriendlyElec CM3588 NAS / NAS Plus | +| helios64 | Kobol Helios64 | RK3399 | Overlay for Kobol Helios64 | +| nanopi-r4s | NanoPi R4S | RK3399 | Overlay for NanoPi R4S | +| nanopi-r5s | NanoPi R5S | RK3568 | Overlay for NanoPi R5S (only WAN, no NVMe) | +| odroid-m1 | Hardkernel Odroid M1 | RK3568 | Overlay for Hardkernel's Odroid M1 | +| orangepi-5 | Orange Pi 5 | RK3588s | Overlay for Orange Pi 5 | +| orangepi-5-max | Orange Pi 5 Max | RK3588 | Overlay for Orange Pi 5 Max | +| orangepi-5-plus | Orange Pi 5 Plus | RK3588 | Overlay for Orange Pi 5 Plus | +| orangepi-r1-plus-lts | Orange Pi R1 Plus LTS | RK3328 | Overlay for Orange Pi R1 Plus LTS | +| radxa-zero-3e | Radxa ZERO 3E | RK3566 | Overlay for Radxa ZERO 3E | +| rock3b | Radxa ROCK 3B | RK3568 | Overlay for Radxa ROCK 3B | +| rock4cplus | Radxa ROCK 4C+ | RK3399 | Overlay for Radxa ROCK 4C+ | +| rock4se | Rock 4 SE | RK3399 | Overlay for Rock 4 SE | +| rock5a | Radxa ROCK 5A | RK3588s | Overlay for Radxa ROCK 5A | +| rock5b | Radxa ROCK 5B | RK3588 | Overlay for Radxa ROCK 5B | +| rock5t | Radxa ROCK 5T | RK3588 | Overlay for Radxa ROCK 5T | +| rock64 | Pine64 Rock64 | RK3328 | Overlay for Pine64 Rock64 | +| rockpi4 | Rock Pi 4A,Rock Pi 4B | RK3399 | Generic overlay for Rock Pi 4A and Rock Pi 4B | +| rockpi4c | Rock Pi 4C | RK3399 | Overlay for Rock Pi 4C | +| rockpro64 | Pine64 ROCKPro64 | RK3399 | Overlay for Pine64 ROCKPro64 | +| turingrk1 | Turing Machines RK1 | RK3588 | Overlay for Turing Machines RK1 | diff --git a/artifacts/friendlyelec-cm3588-nas/u-boot/pkg.yaml b/artifacts/friendlyelec-cm3588-nas/u-boot/pkg.yaml new file mode 100644 index 00000000..8b058d59 --- /dev/null +++ b/artifacts/friendlyelec-cm3588-nas/u-boot/pkg.yaml @@ -0,0 +1,36 @@ +# References: +# U-Boot: +# - https://u-boot.readthedocs.io/en/latest +name: u-boot-friendlyelec-cm3588-nas +variant: scratch +shell: /bin/bash +dependencies: + - stage: base + - stage: arm-trusted-firmware-rk3588 + - stage: rkbin-rk3588 + +steps: + - sources: + - url: https://ftp.denx.de/pub/u-boot/u-boot-{{ .uboot_version }}.tar.bz2 + destination: u-boot.tar.bz2 + sha256: "{{ .uboot_sha256 }}" + sha512: "{{ .uboot_sha512 }}" + env: + SOURCE_DATE_EPOCH: {{ .BUILD_ARG_SOURCE_DATE_EPOCH }} + prepare: + # cm3588-nas-rk3588_defconfig + - | + tar xf u-boot.tar.bz2 --strip-components=1 + - | + make cm3588-nas-rk3588_defconfig + build: + - | + make -j $(nproc) HOSTLDLIBS_mkimage="-lssl -lcrypto" BL31=/libs/arm-trusted-firmware/rk3588/bl31.elf ROCKCHIP_TPL=/libs/rkbin/rk3588_ddr_lp4_2112MHz_lp5_2400MHz_v1.19.bin + install: + # NOTE: got a build error when attempting to include u-boot-rockchip-spi.bin in copy command + - | + mkdir -p /rootfs/artifacts/arm64/u-boot/friendlyelec-cm3588-nas + cp -v -t /rootfs/artifacts/arm64/u-boot/friendlyelec-cm3588-nas u-boot-rockchip.bin +finalize: + - from: /rootfs + to: /rootfs diff --git a/go.work b/go.work index 73483530..1db89b80 100644 --- a/go.work +++ b/go.work @@ -1,6 +1,7 @@ go 1.25.4 use ( + ./installers/friendlyelec-cm3588-nas/src ./installers/helios64/src ./installers/nanopi-r5s/src ./installers/nanopi-r4s/src diff --git a/installers/friendlyelec-cm3588-nas/pkg.yaml b/installers/friendlyelec-cm3588-nas/pkg.yaml new file mode 100644 index 00000000..abe732c9 --- /dev/null +++ b/installers/friendlyelec-cm3588-nas/pkg.yaml @@ -0,0 +1,33 @@ +name: friendlyelec-cm3588-nas +variant: scratch +shell: /bin/bash +dependencies: + - stage: base +steps: + - env: + GOPATH: /tmp/go + network: default + cachePaths: + - /.cache/go-build + - /tmp/go/pkg + prepare: + - | + cd /pkg/src + go mod download + - env: + GOPATH: /tmp/go + cachePaths: + - /.cache/go-build + - /tmp/go/pkg + build: + - | + cd /pkg/src + CGO_ENABLED=0 go build -o ./friendlyelec-cm3588-nas . + install: + - | + mkdir -p /rootfs/installers/ + + cp /pkg/src/friendlyelec-cm3588-nas /rootfs/installers/friendlyelec-cm3588-nas +finalize: + - from: /rootfs + to: /rootfs diff --git a/installers/friendlyelec-cm3588-nas/src/go.mod b/installers/friendlyelec-cm3588-nas/src/go.mod new file mode 100644 index 00000000..39f23a79 --- /dev/null +++ b/installers/friendlyelec-cm3588-nas/src/go.mod @@ -0,0 +1,11 @@ +module friendlyelec-cm3588-nas + +go 1.25.4 + +require ( + github.com/siderolabs/go-copy v0.1.0 + github.com/siderolabs/talos/pkg/machinery v1.11.5 + golang.org/x/sys v0.38.0 +) + +require gopkg.in/yaml.v3 v3.0.1 // indirect diff --git a/installers/friendlyelec-cm3588-nas/src/go.sum b/installers/friendlyelec-cm3588-nas/src/go.sum new file mode 100644 index 00000000..b530de4c --- /dev/null +++ b/installers/friendlyelec-cm3588-nas/src/go.sum @@ -0,0 +1,10 @@ +github.com/siderolabs/go-copy v0.1.0 h1:OIWCtSg+rhOtnIZTpT31Gfpn17rv5kwJqQHG+QUEgC8= +github.com/siderolabs/go-copy v0.1.0/go.mod h1:4bF2rZOZAR/ags/U4AVSpjFE5RPGdEeSkOq6yR9YOkU= +github.com/siderolabs/talos/pkg/machinery v1.11.5 h1:RDt7pAoe5K6y99N66t+nkBaJsL8asQfcYYeIH2JSrGY= +github.com/siderolabs/talos/pkg/machinery v1.11.5/go.mod h1:BWuhCGOFzm0RWPQ61arPG6A3GWLbo0KXN69N+Be+6Eg= +golang.org/x/sys v0.38.0 h1:3yZWxaJjBmCWXqhN1qh02AkOnCQ1poK6oF+a7xWL6Gc= +golang.org/x/sys v0.38.0/go.mod h1:OgkHotnGiDImocRcuBABYBEXf8A9a87e/uXjp9XT3ks= +gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405 h1:yhCVgyC4o1eVCa2tZl7eS0r+SDo693bJlVdllGtEeKM= +gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= +gopkg.in/yaml.v3 v3.0.1 h1:fxVm/GzAzEWqLHuvctI91KS9hhNmmWOoWu0XTYJS7CA= +gopkg.in/yaml.v3 v3.0.1/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= diff --git a/installers/friendlyelec-cm3588-nas/src/main.go b/installers/friendlyelec-cm3588-nas/src/main.go new file mode 100644 index 00000000..60766b6e --- /dev/null +++ b/installers/friendlyelec-cm3588-nas/src/main.go @@ -0,0 +1,96 @@ +// 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 main + +import ( + _ "embed" + "fmt" + "os" + "path/filepath" + + "github.com/siderolabs/go-copy/copy" + "github.com/siderolabs/talos/pkg/machinery/overlay" + "github.com/siderolabs/talos/pkg/machinery/overlay/adapter" + "golang.org/x/sys/unix" +) + +const ( + off int64 = 512 * 64 + dtb = "rockchip/rk3588-friendlyelec-cm3588-nas.dtb" +) + +func main() { + adapter.Execute(&friendlyelecCM3588Nas{}) +} + +type friendlyelecCM3588Nas struct{} + +type friendlyelecCM3588NasExtraOptions struct {} + +func (i *friendlyelecCM3588Nas) GetOptions(extra friendlyelecCM3588NasExtraOptions) (overlay.Options, error) { + kernelArgs := []string{ + "cma=128MB", + "console=tty0", + "console=ttyS9,115200", + "console=ttyS2,115200", + "sysctl.kernel.kexec_load_disabled=1", + "talos.dashboard.disabled=1", + } + return overlay.Options{ + Name: "friendlyelec-cm3588-nas", + KernelArgs: kernelArgs, + PartitionOptions: overlay.PartitionOptions{ + Offset: 2048 * 10, + }, + }, nil +} + +func (i *friendlyelecCM3588Nas) Install(options overlay.InstallOptions[friendlyelecCM3588NasExtraOptions]) error { + uBootBin := filepath.Join(options.ArtifactsPath, "arm64/u-boot/friendlyelec-cm3588-nas/u-boot-rockchip.bin") + + if err := uBootLoaderInstall(uBootBin, options.InstallDisk); err != nil { + return err + } + + src := filepath.Join(options.ArtifactsPath, "arm64/dtb", dtb) + dst := filepath.Join(options.MountPrefix, "boot/EFI/dtb", dtb) + + if err := copyFileAndCreateDir(src, dst); err != nil { + return err + } + + return nil +} + +func copyFileAndCreateDir(src, dst string) error { + if err := os.MkdirAll(filepath.Dir(dst), 0o600); err != nil { + return err + } + + return copy.File(src, dst) +} + +func uBootLoaderInstall(uBootBin, installDisk string) error { + f, err := os.OpenFile(installDisk, os.O_RDWR|unix.O_CLOEXEC, 0o666) + if err != nil { + return fmt.Errorf("failed to open %s: %w", installDisk, err) + } + + defer f.Close() //nolint:errcheck + + uboot, err := os.ReadFile(uBootBin) + if err != nil { + return err + } + + if _, err = f.WriteAt(uboot, off); err != nil { + return err + } + + // NB: In the case that the block device is a loopback device, we sync here + // to ensure that the file is written before the loopback device is + // unmounted. + return f.Sync() +} diff --git a/installers/pkg.yaml b/installers/pkg.yaml index 23686946..79168d9a 100644 --- a/installers/pkg.yaml +++ b/installers/pkg.yaml @@ -2,6 +2,7 @@ name: sbc-rockchip variant: scratch shell: /bin/bash dependencies: + - stage: friendlyelec-cm3588-nas - stage: helios64 - stage: nanopi-r5s - stage: nanopi-r4s @@ -23,6 +24,8 @@ dependencies: - stage: rock5t - stage: turingrk1 - stage: profiles + - stage: u-boot-friendlyelec-cm3588-nas + platform: linux/arm64 - stage: u-boot-helios64 platform: linux/arm64 - stage: u-boot-nanopi-r5s @@ -63,6 +66,10 @@ dependencies: platform: linux/arm64 - stage: u-boot-turingrk1 platform: linux/arm64 + - image: "{{ .BUILD_ARG_PKGS_PREFIX }}/kernel:{{ .BUILD_ARG_PKGS }}" + platform: linux/arm64 + from: /dtb/rockchip/rk3588-friendlyelec-cm3588-nas.dtb + to: /rootfs/artifacts/arm64/dtb/rockchip/rk3588-friendlyelec-cm3588-nas.dtb - image: "{{ .BUILD_ARG_PKGS_PREFIX }}/kernel:{{ .BUILD_ARG_PKGS }}" platform: linux/arm64 from: /dtb/rockchip/rk3399-kobol-helios64.dtb diff --git a/profiles/friendlyelec-cm3588-nas/friendlyelec-cm3588-nas.yaml b/profiles/friendlyelec-cm3588-nas/friendlyelec-cm3588-nas.yaml new file mode 100644 index 00000000..083ac72f --- /dev/null +++ b/profiles/friendlyelec-cm3588-nas/friendlyelec-cm3588-nas.yaml @@ -0,0 +1,10 @@ +arch: arm64 +platform: metal +secureboot: false +output: + kind: image + outFormat: .xz + imageOptions: + diskSize: 1306525696 + diskFormat: raw + bootloader: grub diff --git a/profiles/pkg.yaml b/profiles/pkg.yaml index ea451020..a9d411f4 100644 --- a/profiles/pkg.yaml +++ b/profiles/pkg.yaml @@ -1,6 +1,8 @@ name: profiles variant: scratch finalize: + - from: /pkg/friendlyelec-cm3588-nas + to: /rootfs/profiles - from: /pkg/helios64 to: /rootfs/profiles - from: /pkg/nanopi-r5s