unofficial mirror of guix-patches@gnu.org 
 help / color / mirror / code / Atom feed
From: Jan Nieuwenhuizen <janneke@gnu.org>
To: 39617@debbugs.gnu.org
Subject: [bug#39617] [PATCH 2/2] gnu: Add u-boot-pinebook-pro-rk3399.
Date: Sat, 15 Feb 2020 19:52:09 +0100	[thread overview]
Message-ID: <20200215185209.28334-2-janneke@gnu.org> (raw)
In-Reply-To: <20200215185209.28334-1-janneke@gnu.org>

* 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 <david@craven.ch>
 ;;; Copyright © 2017, 2019 Mathieu Othacehe <m.othacehe@gmail.com>
+;;; Copyright © 2020 Jan (janneke) Nieuwenhuizen <janneke@gnu.org>
 ;;;
 ;;; 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)
+
 \f
 
 ;;;
@@ -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 <nee@cock.li>
 ;;; Copyright © 2019 Mathieu Othacehe <m.othacehe@gmail.com>
 ;;; Copyright © 2020 Björn Höfling <bjoern.hoefling@bjoernhoefling.de>
+;;; Copyright © 2020 Jan (janneke) Nieuwenhuizen <janneke@gnu.org>
 ;;;
 ;;; 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	other threads:[~2020-02-15 18:53 UTC|newest]

Thread overview: 19+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-02-15 18:49 [bug#39617] [PATCH 0/2] Add initial Pinebook Pro support Jan Nieuwenhuizen
2020-02-15 18:52 ` [bug#39617] [PATCH 1/2] gnu: Add linux-libre-pinebook-pro Jan Nieuwenhuizen
2020-02-15 18:52   ` Jan Nieuwenhuizen [this message]
2020-02-20  4:04   ` Vagrant Cascadian
2020-02-20  6:26     ` Jan Nieuwenhuizen
2020-02-15 21:51 ` [bug#39617] [PATCH 0/2] Add initial Pinebook Pro support Mike Rosset
2020-02-16 18:19 ` Danny Milosavljevic
2020-02-16 18:22   ` Danny Milosavljevic
2020-02-16 19:04   ` Jan Nieuwenhuizen
2020-02-20  4:12   ` Vagrant Cascadian
2020-02-20  6:29     ` Jan Nieuwenhuizen
2020-02-28  1:03   ` Vagrant Cascadian
2020-02-16 18:21 ` [bug#39617] Fw: " Danny Milosavljevic
2020-02-16 18:27 ` [bug#39617] " Danny Milosavljevic
2020-02-18 21:48   ` Danny Milosavljevic
2020-05-20  6:29 ` Brian Woodcox
2020-05-20  7:15   ` Jan Nieuwenhuizen
2020-05-20 16:06     ` Brian Woodcox
2020-05-20  6:29 ` Brian Woodcox

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://guix.gnu.org/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20200215185209.28334-2-janneke@gnu.org \
    --to=janneke@gnu.org \
    --cc=39617@debbugs.gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/guix.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).