diff mbox series

[bug#48371] Add crust firmware for sunxi devices

Message ID 87o8dgrk70.fsf@yucca
State New
Headers show
Series [bug#48371] Add crust firmware for sunxi devices | expand

Checks

Context Check Description
cbaines/comparison success View comparision
cbaines/git branch success View Git branch
cbaines/applying patch fail View Laminar job
cbaines/issue success View issue

Commit Message

Vagrant Cascadian May 11, 2021, 10:15 p.m. UTC
The attached patches add crust System Control Processor firmware for
pinebook, pine64+ and pine64-lts. Crust manages various power management
aspects for these platforms, notably suspend states.

live well,
  vagrant

Comments

M May 13, 2021, 1 p.m. UTC | #1
Vagrant Cascadian schreef op di 11-05-2021 om 15:15 [-0700]:
> +       #:make-flags (list
> +                     "CROSS_COMPILE=or1k-elf-"
> +                     "DEBUG=1"
> +                     "HOSTCC=gcc"
> +                     "HOSTAR=ar"
> +                     "HOST_COMPILE=aarch64-linux-gnu-"
> +                     "LEX=flex")

IIUC, CROSS_COMPILE is the system Crust will run on, and HOST_COMPILE
is the system where Crust is compiled. So shouldn't HOST_COMPILE be

  (string-append (nix-system->gnu-triplet (%current-system)) "-")

such that Crust can be cross-compiled from non-aarch64 or non-linux systems?

Greetings,
Maxime.
Vagrant Cascadian May 30, 2021, 12:55 a.m. UTC | #2
On 2021-05-13, Maxime Devos wrote:
> Vagrant Cascadian schreef op di 11-05-2021 om 15:15 [-0700]:
>> +       #:make-flags (list
>> +                     "CROSS_COMPILE=or1k-elf-"
>> +                     "DEBUG=1"
>> +                     "HOSTCC=gcc"
>> +                     "HOSTAR=ar"
>> +                     "HOST_COMPILE=aarch64-linux-gnu-"
>> +                     "LEX=flex")
>
> IIUC, CROSS_COMPILE is the system Crust will run on, and HOST_COMPILE
> is the system where Crust is compiled. So shouldn't HOST_COMPILE be
>
>   (string-append (nix-system->gnu-triplet (%current-system)) "-")
>
> such that Crust can be cross-compiled from non-aarch64 or non-linux systems?

Good point!

Although I couldn't get it to work, always ending in:

  ERROR: In procedure %resolve-variable:
  Unbound variable: nix-system->gnu-triplet

firmware.scm includes:

  #:use-module (guix utils)

Which is where I think that is defined, but...

Setting HOST_COMPILE to an empty value appears to work and it just uses
the defined HOSTCC and HOSTAR, so this is probably better anyways!


There's a new crust version available, so I'll give that a quick test
before sending updated patches.


live well,
  vagrant
diff mbox series

Patch

From 6939b8555f4d2ed57b4993c501686d5ccdf47703 Mon Sep 17 00:00:00 2001
From: Vagrant Cascadian <vagrant@debian.org>
Date: Tue, 11 May 2021 21:15:15 +0000
Subject: [PATCH 2/2] gnu: u-boot: Add crust firmware to pinebook, pine64_plus
 and pine64-lts.

* gnu/packages/bootloaders.scm (make-u-boot-sunxi64-package): Take argument
  for System Control Processor (SCP) firmware.
  [native-inputs]: Add SCP firmware.
  (u-boot-pine64-plus, u-boot-pine64-lts, u-boot-pinebook): Pass appropriate
  crust firmware as the SCP firmware.
---
 gnu/packages/bootloaders.scm | 15 +++++++++++----
 1 file changed, 11 insertions(+), 4 deletions(-)

diff --git a/gnu/packages/bootloaders.scm b/gnu/packages/bootloaders.scm
index 56bef57cb7..6f1bb5b8c9 100644
--- a/gnu/packages/bootloaders.scm
+++ b/gnu/packages/bootloaders.scm
@@ -737,7 +737,7 @@  it fits within common partitioning schemes.")
 (define-public u-boot-am335x-evm
   (make-u-boot-package "am335x_evm" "arm-linux-gnueabihf"))
 
-(define-public (make-u-boot-sunxi64-package board triplet)
+(define-public (make-u-boot-sunxi64-package board triplet scpfirmware)
   (let ((base (make-u-boot-package board triplet)))
     (package
       (inherit base)
@@ -752,6 +752,9 @@  it fits within common partitioning schemes.")
                           (assoc-ref (or native-inputs inputs) "firmware")
                           "/bl31.bin")))
                     (setenv "BL31" bl31)
+                    (setenv "SCP" (string-append
+                                   (assoc-ref inputs "scpfirmware")
+                                   "/scp.bin"))
                     ;; This is necessary when we're using the bundled dtc.
                     ;(setenv "PATH" (string-append (getenv "PATH") ":"
                     ;                              "scripts/dtc"))
@@ -759,16 +762,20 @@  it fits within common partitioning schemes.")
                   #t))))))
       (native-inputs
        `(("firmware" ,arm-trusted-firmware-sun50i-a64)
+         ("scpfirmware" ,scpfirmware)
          ,@(package-native-inputs base))))))
 
 (define-public u-boot-pine64-plus
-  (make-u-boot-sunxi64-package "pine64_plus" "aarch64-linux-gnu"))
+  (make-u-boot-sunxi64-package "pine64_plus" "aarch64-linux-gnu"
+                               crust-pine64-plus))
 
 (define-public u-boot-pine64-lts
-  (make-u-boot-sunxi64-package "pine64-lts" "aarch64-linux-gnu"))
+  (make-u-boot-sunxi64-package "pine64-lts" "aarch64-linux-gnu"
+                               crust-pine64-plus))
 
 (define-public u-boot-pinebook
-  (let ((base (make-u-boot-sunxi64-package "pinebook" "aarch64-linux-gnu")))
+  (let ((base (make-u-boot-sunxi64-package "pinebook" "aarch64-linux-gnu"
+                                           crust-pinebook)))
     (package
       (inherit base)
       (arguments
-- 
2.30.2