guix-patches
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[bug#39617] [PATCH 2/2] gnu: Add u-boot-pinebook-pro-rk3399.


From: Jan Nieuwenhuizen
Subject: [bug#39617] [PATCH 2/2] gnu: Add u-boot-pinebook-pro-rk3399.
Date: Sat, 15 Feb 2020 19:52:09 +0100

* gnu/packages/bootloaders.scm (make-u-boot-package): Add named parameter 
#:u-boot.
(u-boot-pbp): New variable.
(u-boot-pinebook-pro-rk3399): Use them to create new variable.
* gnu/bootloader/u-boot.scm (install-pinebook-pro-rk3399-u-boot,
u-boot-pinebook-pro-rk3399-bootloader): New variable.
* gnu/system/examples/pinebook-pro.tmpl: New file.
---
 Makefile.am                           |  1 +
 gnu/bootloader/u-boot.scm             | 11 ++++++
 gnu/packages/bootloaders.scm          | 45 ++++++++++++++++++++-
 gnu/system/examples/pinebook-pro.tmpl | 57 +++++++++++++++++++++++++++
 4 files changed, 112 insertions(+), 2 deletions(-)
 create mode 100644 gnu/system/examples/pinebook-pro.tmpl

diff --git a/Makefile.am b/Makefile.am
index 7474b7f375..69c35a0478 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -345,6 +345,7 @@ EXAMPLES =                                  \
   gnu/system/examples/desktop.tmpl             \
   gnu/system/examples/lightweight-desktop.tmpl \
   gnu/system/examples/docker-image.tmpl                \
+  gnu/system/examples/pinebook-pro.tmpl                \
   gnu/system/examples/vm-image.tmpl
 
 GOBJECTS = $(MODULES:%.scm=%.go) guix/config.go $(dist_noinst_DATA:%.scm=%.go)
diff --git a/gnu/bootloader/u-boot.scm b/gnu/bootloader/u-boot.scm
index 3e892c5475..e7683601da 100644
--- a/gnu/bootloader/u-boot.scm
+++ b/gnu/bootloader/u-boot.scm
@@ -1,6 +1,7 @@
 ;;; GNU Guix --- Functional package management for GNU
 ;;; Copyright © 2017 David Craven <address@hidden>
 ;;; Copyright © 2017, 2019 Mathieu Othacehe <address@hidden>
+;;; Copyright © 2020 Jan (janneke) Nieuwenhuizen <address@hidden>
 ;;;
 ;;; This file is part of GNU Guix.
 ;;;
@@ -35,6 +36,7 @@
             u-boot-pine64-plus-bootloader
             u-boot-pine64-lts-bootloader
             u-boot-pinebook-bootloader
+            u-boot-pinebook-pro-rk3399-bootloader
             u-boot-puma-rk3399-bootloader
             u-boot-rock64-rk3328-bootloader
             u-boot-rockpro64-rk3399-bootloader
@@ -121,6 +123,8 @@
         (write-file-on-device u-boot (stat:size (stat u-boot))
                               device (* 16384 512)))))
 
+(define install-pinebook-pro-rk3399-u-boot install-rockpro64-rk3399-u-boot)
+
 
 
 ;;;
@@ -236,3 +240,10 @@
    (inherit u-boot-bootloader)
    (package u-boot-rockpro64-rk3399)
    (installer install-rockpro64-rk3399-u-boot)))
+
+(define u-boot-pinebook-pro-rk3399-bootloader
+  ;; SD and eMMC use the same format
+  (bootloader
+   (inherit u-boot-bootloader)
+   (package u-boot-pinebook-pro-rk3399)
+   (installer install-pinebook-pro-rk3399-u-boot)))
diff --git a/gnu/packages/bootloaders.scm b/gnu/packages/bootloaders.scm
index c072ff8c8e..a3ce4a943f 100644
--- a/gnu/packages/bootloaders.scm
+++ b/gnu/packages/bootloaders.scm
@@ -11,6 +11,7 @@
 ;;; Copyright © 2019 nee <address@hidden>
 ;;; Copyright © 2019 Mathieu Othacehe <address@hidden>
 ;;; Copyright © 2020 Björn Höfling <address@hidden>
+;;; Copyright © 2020 Jan (janneke) Nieuwenhuizen <address@hidden>
 ;;;
 ;;; This file is part of GNU Guix.
 ;;;
@@ -68,7 +69,8 @@
   #:use-module (guix utils)
   #:use-module (srfi srfi-1)
   #:use-module (srfi srfi-26)
-  #:use-module (ice-9 regex))
+  #:use-module (ice-9 regex)
+  #:export (make-u-boot-package))
 
 (define unifont
   ;; GNU Unifont, <http://gnu.org/s/unifont>.
@@ -529,7 +531,7 @@ def test_ctrl_c"))
 also initializes the boards (RAM etc).  This package provides its
 board-independent tools.")))
 
-(define-public (make-u-boot-package board triplet)
+(define* (make-u-boot-package board triplet #:key (u-boot u-boot))
   "Returns a u-boot package for BOARD cross-compiled for TRIPLET."
   (let ((same-arch? (lambda ()
                       (string=? (%current-system)
@@ -809,6 +811,45 @@ to Novena upstream, does not load u-boot.img from the 
first partition.")
        `(("firmware" ,arm-trusted-firmware-rk3399)
          ,@(package-native-inputs base))))))
 
+(define u-boot-pbp
+  (let ((commit "365495a329c8e92ca4c134562d091df71b75845e"))
+    (package
+      (inherit u-boot)
+      (name "u-boot")
+      (version (git-version (package-version u-boot) "pinebook-pro-1" commit))
+      (source (origin
+                ;; XXX: Snapshots are available but changes timestamps every 
download.
+                (method git-fetch)
+                (uri (git-reference
+                      (url "https://git.eno.space/pbp-uboot.git";)
+                      (commit commit)))
+                (file-name (string-append name "-" version "-checkout"))
+                (sha256
+                 (base32
+                  "092dxcvsk40fclks0lrg2caigzjhw9axjg936w5fs6aj7c0qxzjy")))))))
+
+(define-public u-boot-pinebook-pro-rk3399
+  (let ((base (make-u-boot-package "pinebook_pro-rk3399" "aarch64-linux-gnu"
+                                   #:u-boot u-boot-pbp)))
+    (package
+      (inherit base)
+      (arguments
+        (substitute-keyword-arguments (package-arguments base)
+          ((#:phases phases)
+           `(modify-phases ,phases
+              (add-after 'unpack 'set-environment
+                (lambda* (#:key inputs #:allow-other-keys)
+                  (setenv "CPATH" (string-join (cdr (string-split (getenv 
"CPATH") #\:)) ":"))
+                  (setenv "BL31" (string-append (assoc-ref inputs "firmware")
+                                                "/bl31.elf"))
+                  #t))
+              ;; Phases do not succeed on the bl31 ELF.
+              (delete 'strip)
+              (delete 'validate-runpath)))))
+      (native-inputs
+       `(("firmware" ,arm-trusted-firmware-rk3399)
+         ,@(package-native-inputs base))))))
+
 (define-public vboot-utils
   (package
     (name "vboot-utils")
diff --git a/gnu/system/examples/pinebook-pro.tmpl 
b/gnu/system/examples/pinebook-pro.tmpl
new file mode 100644
index 0000000000..ca27728b15
--- /dev/null
+++ b/gnu/system/examples/pinebook-pro.tmpl
@@ -0,0 +1,57 @@
+;; This is an operating system configuration template
+;; for a "bare bones" pinebook pro
+
+;; The default image's kernel 4.4.190 has
+;;    microSD: /dev/mmcblk0
+;;    eMMC: /dev/mmcblk1
+;;
+;; Note that after booting the Guix System with linux-libre
+;; 5.5-pinebook-pro this changes to
+;;    microSD: /dev/mmcblk1
+;;    eMMC: /dev/mmcblk2
+
+;; Assuming https://gitlab.com/janneke/guix.git wip-pinebook-pro
+;; has been built in .
+;; cp gnu/system/examples/pinebook-pro.tmpl arm-baar.scm
+;; sudo -E ./pre-inst-env guix system init arm-baar.scm /mnt --fallback
+
+(use-modules (gnu) (gnu bootloader u-boot))
+(use-service-modules avahi networking ssh)
+(use-package-modules admin bootloaders certs linux ssh)
+
+(operating-system
+  (host-name "armzalig")
+  (timezone "Europe/Amsterdam")
+  (locale "en_US.utf8")
+
+  ;; Assuming not using a typewriter that needs qwerty slowdown
+  (keyboard-layout (keyboard-layout "us" "dvorak"
+                                    #:options '("ctrl:nocaps" "compose:menu")))
+
+  ;; Assuming /dev/mmcblk0 is the microSD...
+  (bootloader (bootloader-configuration
+               (target "/dev/mmcblk0")
+               (bootloader u-boot-pinebook-pro-rk3399-bootloader)))
+  ;; ...and /dev/mmcblk0p1 is the root file system
+  (file-systems (cons* (file-system (device "/dev/mmcblk1p1")
+                                    (mount-point "/")
+                                    (type "ext4"))
+                       %base-file-systems))
+
+  (kernel linux-libre-pinebook-pro)
+  (kernel-arguments '("ethaddr=${ethaddr}" "eth1addr=${eth1addr}" 
"serial=${serial#}"
+                      "video=HDMI-A-1:1920x1080@60" "video=eDP-1:1920x1080@60"
+                      "vga=current"))
+  (initrd-modules '())
+
+  (users (cons* (user-account (name "guix")
+                              (group "users")
+                              (supplementary-groups '("wheel")))
+                %base-user-accounts))
+  (name-service-switch %mdns-host-lookup-nss)
+  (packages (cons* nss-certs openssh wpa-supplicant-minimal %base-packages))
+  (services (cons* (service dhcp-client-service-type)
+                   (service openssh-service-type
+                            (openssh-configuration
+                             (port-number 2222)))
+                   %base-services)))
-- 
2.24.0






reply via email to

[Prev in Thread] Current Thread [Next in Thread]