[PATCH] OLIMEX-Teres-A64: Official Support

  • Open
  • quality assurance status badge
Details
One participant
  • Jacob Hrbek
Owner
unassigned
Submitted by
Jacob Hrbek
Severity
normal
J
J
Jacob Hrbek wrote on 7 Mar 2023 05:18
(address . guix-patches@gnu.org)(name . Jacob Hrbek)(address . kreyren@rixotstudio.cz)
20230307041057.6747-1-kreyren@rixotstudio.cz
This contribution uses experience gained from
GNU Guix support for the OLIMEX Teres-A64 system.

Signed-off-by: Jacob Hrbek <kreyren@rixotstudio.cz>
---
gnu/system/images/olimex-teres-a64.scm | 79 ++++++++++++++++++++++++++
1 file changed, 79 insertions(+)
create mode 100644 gnu/system/images/olimex-teres-a64.scm

Toggle diff (85 lines)
diff --git a/gnu/system/images/olimex-teres-a64.scm b/gnu/system/images/olimex-teres-a64.scm
new file mode 100644
index 0000000000..7398ee9314
--- /dev/null
+++ b/gnu/system/images/olimex-teres-a64.scm
@@ -0,0 +1,79 @@
+;;; GNU Guix --- Functional package management for GNU
+;;; Copyright © 2020 Mathieu Othacehe <m.othacehe@gmail.com>
+;;; Copyright © 2023 Jacob Hrbek <kreyren@fsfe.org>
+;;;
+;;; This file is part of GNU Guix.
+;;;
+;;; GNU Guix is free software; you can redistribute it and/or modify it
+;;; under the terms of the GNU General Public License as published by
+;;; the Free Software Foundation; either version 3 of the License, or (at
+;;; your option) any later version.
+;;;
+;;; GNU Guix is distributed in the hope that it will be useful, but
+;;; WITHOUT ANY WARRANTY; without even the implied warranty of
+;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+;;; GNU General Public License for more details.
+;;;
+;;; You should have received a copy of the GNU General Public License
+;;; along with GNU Guix. If not, see <http://www.gnu.org/licenses/>.
+
+;;; This file provides an official GNU Guix support for the OLIMEX Teres-A64
+
+(define-module (gnu system images olimex-teres-a64)
+ #:use-module (gnu bootloader)
+ #:use-module (gnu bootloader u-boot)
+ #:use-module (gnu image)
+ #:use-module (gnu packages linux)
+ #:use-module (guix platforms arm)
+ #:use-module (gnu services)
+ #:use-module (gnu services base)
+ #:use-module (gnu system)
+ #:use-module (gnu system file-systems)
+ #:use-module (gnu system image)
+ #:use-module (srfi srfi-26)
+ #:export (olimex-teres-a64-barebones-os
+ olimex-teres-a64-image-type
+ olimex-teres-a64-barebones-raw-image))
+
+(define olimex-teres-a64-barebones-os
+ (operating-system
+ (host-name "olimex")
+ (timezone "UTC")
+ (locale "en_US.utf8")
+ (bootloader (bootloader-configuration
+ (bootloader u-boot-teres_i-bootloader)
+ (targets '("/dev/mmcblk0"))))
+ (initrd-modules '())
+ (kernel linux-libre-arm64-generic)
+ (file-systems (cons (file-system
+ (device (file-system-label "my-root"))
+ (mount-point "/")
+ (type "ext4"))
+ %base-file-systems))
+ (services (cons (service agetty-service-type
+ (agetty-configuration
+ (baud-rate "115200")
+ (term "vt100")
+ (tty "ttyS0")))
+ %base-services))))
+
+(define olimex-teres-a64-image-type
+ (image-type
+ (name 'pinebook-pro-raw)
+ (constructor (lambda (os)
+ (image
+ (inherit
+ ;; All AllWinner SoCs will try to find a boot image at sector 16 (8KB) of an SD card [https://u-boot.readthedocs.io/en/latest/board/allwinner/sunxi.html#installing-u-boot]
+ (raw-with-offset-disk-image (* 1024 8))) ; 1024 (sector size for 1 kilobyte) * 8 = 8196 sectors which is 8 KB)
+ (operating-system os)
+ (platform aarch64-linux))))))
+
+(define olimex-teres-a64-barebones-raw-image
+ (image
+ (inherit
+ (os+platform->image olimex-teres-a64-barebones-os aarch64-linux
+ #:type olimex-teres-a64-image-type))
+ (name 'olimex-teres-a64-barebones-raw-image)))
+
+;; Return the default image.
+olimex-teres-a64-raw-image
--
2.37.3
J
J
Jacob Hrbek wrote on 7 Mar 2023 13:54
[PATCH] Add missing bootloader config
(address . 62024@debbugs.gnu.org)(name . Jacob Hrbek)(address . kreyren@rixotstudio.cz)
20230307125340.4142-1-kreyren@rixotstudio.cz
Signed-off-by: Jacob Hrbek <kreyren@rixotstudio.cz>
---
gnu/bootloader/u-boot.scm | 16 ++++++++++++++++
1 file changed, 16 insertions(+)

Toggle diff (41 lines)
diff --git a/gnu/bootloader/u-boot.scm b/gnu/bootloader/u-boot.scm
index 65d7923465..d68f019b82 100644
--- a/gnu/bootloader/u-boot.scm
+++ b/gnu/bootloader/u-boot.scm
@@ -43,6 +43,7 @@ (define-module (gnu bootloader u-boot)
u-boot-puma-rk3399-bootloader
u-boot-rock64-rk3328-bootloader
u-boot-rockpro64-rk3399-bootloader
+ u-boot-teres_i-bootloader
u-boot-ts7970-q-2g-1000mhz-c-bootloader
u-boot-wandboard-bootloader))

@@ -129,6 +130,15 @@ (define install-rockpro64-rk3399-u-boot

(define install-pinebook-pro-rk3399-u-boot install-rockpro64-rk3399-u-boot)

+(define install-teres_i-u-boot
+ #~(lambda (bootloader root-index image)
+ (let ((idb (string-append bootloader "/libexec/idbloader.img"))
+ (u-boot (string-append bootloader "/libexec/u-boot.itb")))
+ (write-file-on-device idb (stat:size (stat idb))
+ image (* 64 512))
+ (write-file-on-device u-boot (stat:size (stat u-boot))
+ image (* 16384 512)))))
+
(define install-u-boot-ts7970-q-2g-1000mhz-c-u-boot
#~(lambda (bootloader device mount-point)
(let ((u-boot.imx (string-append bootloader "/libexec/u-boot.imx"))
@@ -264,6 +274,12 @@ (define u-boot-pinebook-pro-rk3399-bootloader
(package u-boot-pinebook-pro-rk3399)
(disk-image-installer install-pinebook-pro-rk3399-u-boot)))

+(define u-boot-teres_i-bootloader
+ (bootloader
+ (inherit u-boot-allwinner64-bootloader)
+ (package u-boot-teres_i)
+ (disk-image-installer install-teres_i-u-boot)))
+
(define u-boot-ts7970-q-2g-1000mhz-c-bootloader
;; This bootloader doesn't really need to be installed, as it is read from
;; an SPI memory chip, not the SD card. It is copied to /boot/u-boot.imx
--
2.37.3
J
J
Jacob Hrbek wrote on 7 Mar 2023 16:48
[PATCH] Adjustments..
(address . 62024@debbugs.gnu.org)(name . Jacob Hrbek)(address . kreyren@rixotstudio.cz)
20230307154843.21602-1-kreyren@rixotstudio.cz
Now builds

Signed-off-by: Jacob Hrbek <kreyren@rixotstudio.cz>
---
gnu/bootloader/u-boot.scm | 12 +----
gnu/packages/bootloaders.scm | 4 ++
.../{olimex-teres-a64.scm => teres_i.scm} | 44 +++++++++++--------
3 files changed, 30 insertions(+), 30 deletions(-)
rename gnu/system/images/{olimex-teres-a64.scm => teres_i.scm} (70%)

Toggle diff (132 lines)
diff --git a/gnu/bootloader/u-boot.scm b/gnu/bootloader/u-boot.scm
index d68f019b82..50bbd2975a 100644
--- a/gnu/bootloader/u-boot.scm
+++ b/gnu/bootloader/u-boot.scm
@@ -130,15 +130,6 @@ (define install-rockpro64-rk3399-u-boot

(define install-pinebook-pro-rk3399-u-boot install-rockpro64-rk3399-u-boot)

-(define install-teres_i-u-boot
- #~(lambda (bootloader root-index image)
- (let ((idb (string-append bootloader "/libexec/idbloader.img"))
- (u-boot (string-append bootloader "/libexec/u-boot.itb")))
- (write-file-on-device idb (stat:size (stat idb))
- image (* 64 512))
- (write-file-on-device u-boot (stat:size (stat u-boot))
- image (* 16384 512)))))
-
(define install-u-boot-ts7970-q-2g-1000mhz-c-u-boot
#~(lambda (bootloader device mount-point)
(let ((u-boot.imx (string-append bootloader "/libexec/u-boot.imx"))
@@ -277,8 +268,7 @@ (define u-boot-pinebook-pro-rk3399-bootloader
(define u-boot-teres_i-bootloader
(bootloader
(inherit u-boot-allwinner64-bootloader)
- (package u-boot-teres_i)
- (disk-image-installer install-teres_i-u-boot)))
+ (package u-boot-teres_i)))

(define u-boot-ts7970-q-2g-1000mhz-c-bootloader
;; This bootloader doesn't really need to be installed, as it is read from
diff --git a/gnu/packages/bootloaders.scm b/gnu/packages/bootloaders.scm
index ee47a9fad7..17e752b10a 100644
--- a/gnu/packages/bootloaders.scm
+++ b/gnu/packages/bootloaders.scm
@@ -1315,6 +1315,10 @@ (define*-public (make-u-boot-bin-package u-boot-package
u-boot-bin)))
(license (package-license u-boot-package))))

+(define-public u-boot-teres_i
+ (make-u-boot-sunxi64-package
+ "teres_i" "aarch64-linux-gnu"))
+
(define-public %u-boot-rpi-efi-configs
'("CONFIG_OF_EMBED"
"CONFIG_OF_BOARD=y"))
diff --git a/gnu/system/images/olimex-teres-a64.scm b/gnu/system/images/teres_i.scm
similarity index 70%
rename from gnu/system/images/olimex-teres-a64.scm
rename to gnu/system/images/teres_i.scm
index 7398ee9314..a9b16b677f 100644
--- a/gnu/system/images/olimex-teres-a64.scm
+++ b/gnu/system/images/teres_i.scm
@@ -19,23 +19,25 @@

;;; This file provides an official GNU Guix support for the OLIMEX Teres-A64

-(define-module (gnu system images olimex-teres-a64)
+(define-module (gnu system images teres_i)
#:use-module (gnu bootloader)
#:use-module (gnu bootloader u-boot)
#:use-module (gnu image)
+ #:use-module (gnu packages certs)
#:use-module (gnu packages linux)
#:use-module (guix platforms arm)
#:use-module (gnu services)
#:use-module (gnu services base)
+ #:use-module (gnu services networking)
#:use-module (gnu system)
#:use-module (gnu system file-systems)
#:use-module (gnu system image)
#:use-module (srfi srfi-26)
- #:export (olimex-teres-a64-barebones-os
- olimex-teres-a64-image-type
- olimex-teres-a64-barebones-raw-image))
+ #:export (teres_i-barebones-os
+ teres_i-image-type
+ teres_i-barebones-raw-image))

-(define olimex-teres-a64-barebones-os
+(define teres_i-barebones-os
(operating-system
(host-name "olimex")
(timezone "UTC")
@@ -50,30 +52,34 @@ (define olimex-teres-a64-barebones-os
(mount-point "/")
(type "ext4"))
%base-file-systems))
- (services (cons (service agetty-service-type
- (agetty-configuration
- (baud-rate "115200")
- (term "vt100")
- (tty "ttyS0")))
- %base-services))))
+ (services (cons*
+ (service agetty-service-type
+ (agetty-configuration
+ (baud-rate "115200")
+ (term "vt100")
+ (tty "ttyS0")))
+ (service dhcp-client-service-type)
+ (service ntp-service-type)
+ %base-services))
+ (packages (cons nss-certs %base-packages))))

-(define olimex-teres-a64-image-type
+(define teres_i-image-type
(image-type
- (name 'pinebook-pro-raw)
+ (name 'teres_i-raw)
(constructor (lambda (os)
(image
(inherit
;; All AllWinner SoCs will try to find a boot image at sector 16 (8KB) of an SD card [https://u-boot.readthedocs.io/en/latest/board/allwinner/sunxi.html#installing-u-boot]
- (raw-with-offset-disk-image (* 1024 8))) ; 1024 (sector size for 1 kilobyte) * 8 = 8196 sectors which is 8 KB)
+ (raw-with-offset-disk-image (* 1024 8))) ; 1024 (sector size for 1 kilobyte) * 8 = 8192 sectors which is 8 KB)
(operating-system os)
(platform aarch64-linux))))))

-(define olimex-teres-a64-barebones-raw-image
+(define teres_i-barebones-raw-image
(image
(inherit
- (os+platform->image olimex-teres-a64-barebones-os aarch64-linux
- #:type olimex-teres-a64-image-type))
- (name 'olimex-teres-a64-barebones-raw-image)))
+ (os+platform->image teres_i-barebones-os aarch64-linux
+ #:type teres_i-image-type))
+ (name 'teres_i-barebones-raw-image)))

;; Return the default image.
-olimex-teres-a64-raw-image
+teres_i-barebones-raw-image
--
2.37.3
J
J
Jacob Hrbek wrote on 8 Mar 2023 04:16
[PATCH] Align offset with pine64
(address . 62024@debbugs.gnu.org)(name . Jacob Hrbek)(address . kreyren@rixotstudio.cz)
20230308031615.21820-1-kreyren@rixotstudio.cz
It doesn't boot which where the likely culprit is the offset as it
expects the bootloader on 8192 sector start

Signed-off-by: Jacob Hrbek <kreyren@rixotstudio.cz>
---
gnu/system/images/teres_i.scm | 3 +--
1 file changed, 1 insertion(+), 2 deletions(-)

Toggle diff (14 lines)
diff --git a/gnu/system/images/teres_i.scm b/gnu/system/images/teres_i.scm
index a9b16b677f..607d003a11 100644
--- a/gnu/system/images/teres_i.scm
+++ b/gnu/system/images/teres_i.scm
@@ -69,8 +69,7 @@ (define teres_i-image-type
(constructor (lambda (os)
(image
(inherit
- ;; All AllWinner SoCs will try to find a boot image at sector 16 (8KB) of an SD card [https://u-boot.readthedocs.io/en/latest/board/allwinner/sunxi.html#installing-u-boot]
- (raw-with-offset-disk-image (* 1024 8))) ; 1024 (sector size for 1 kilobyte) * 8 = 8192 sectors which is 8 KB)
+ (raw-with-offset-disk-image))
(operating-system os)
(platform aarch64-linux))))))

--
2.37.3
J
J
Jacob Hrbek wrote on 8 Mar 2023 05:42
(address . 62024@debbugs.gnu.org)(name . GNUtoo@cyberdimension.org)(address . GNUtoo@cyberdimension.org)
OwYfuunh01-CL6gOvUkXtirFmyGVg8asVxs2H_xBeQLDK6YrEynD3iOhvRWPHD6D0lDm8ZI1cjBvDY4OVFWJLh3ELNFcQz6SeycvnZrnHGY=@rixotstudio.cz
It now builds and boots, but without an internet connection due to the proprietary firmware on the WiFI and lack of any other method to connect beyond a USB modem.

h-node says that there is a way to make it work fully libre with some kernel hacks that i have no idea what they mean[https://h-node.org/wifi/view/en/1725/Realtek-Semiconductor-Co---Ltd--RTL8723BE-PCIe-Wireless-Network-Adapter/1/1/undef/undef/undef/undef/wifi-works/RTL8723]

CC GNUToo your turn

-- Jacob "Kreyren" Hrbek


------- Original Message -------
On Wednesday, March 8th, 2023 at 4:16 AM, Jacob Hrbek <kreyren@rixotstudio.cz> wrote:


Toggle quote (25 lines)
> It doesn't boot which where the likely culprit is the offset as it
> expects the bootloader on 8192 sector start
>
> Signed-off-by: Jacob Hrbek kreyren@rixotstudio.cz
>
> ---
> gnu/system/images/teres_i.scm | 3 +--
> 1 file changed, 1 insertion(+), 2 deletions(-)
>
> diff --git a/gnu/system/images/teres_i.scm b/gnu/system/images/teres_i.scm
> index a9b16b677f..607d003a11 100644
> --- a/gnu/system/images/teres_i.scm
> +++ b/gnu/system/images/teres_i.scm
> @@ -69,8 +69,7 @@ (define teres_i-image-type
> (constructor (lambda (os)
> (image
> (inherit
> - ;; All AllWinner SoCs will try to find a boot image at sector 16 (8KB) of an SD card [https://u-boot.readthedocs.io/en/latest/board/allwinner/sunxi.html#installing-u-boot]
> - (raw-with-offset-disk-image (* 1024 8))) ; 1024 (sector size for 1 kilobyte) * 8 = 8192 sectors which is 8 KB)
> + (raw-with-offset-disk-image))
> (operating-system os)
> (platform aarch64-linux))))))
>
> --
> 2.37.3
?
Your comment

Commenting via the web interface is currently disabled.

To comment on this conversation send an email to 62024@debbugs.gnu.org

To respond to this issue using the mumi CLI, first switch to it
mumi current 62024
Then, you may apply the latest patchset in this issue (with sign off)
mumi am -- -s
Or, compose a reply to this issue
mumi compose
Or, send patches to this issue
mumi send-email *.patch