From patchwork Sat Feb 15 18:52:09 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Janneke Nieuwenhuizen X-Patchwork-Id: 20259 Return-Path: X-Original-To: patchwork@mira.cbaines.net Delivered-To: patchwork@mira.cbaines.net Received: by mira.cbaines.net (Postfix, from userid 113) id A245827BBE4; Sat, 15 Feb 2020 18:53:12 +0000 (GMT) X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on mira.cbaines.net X-Spam-Level: X-Spam-Status: No, score=-2.9 required=5.0 tests=BAYES_00,MAILING_LIST_MULTI, URIBL_BLOCKED autolearn=unavailable autolearn_force=no version=3.4.2 Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mira.cbaines.net (Postfix) with ESMTP id 0A36F174E9 for ; Sat, 15 Feb 2020 18:53:12 +0000 (GMT) Received: from localhost ([::1]:53634 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1j32Yx-0002fu-JY for patchwork@mira.cbaines.net; Sat, 15 Feb 2020 13:53:11 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]:33588) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1j32Yq-0002aZ-K1 for guix-patches@gnu.org; Sat, 15 Feb 2020 13:53:06 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1j32Yp-00069L-12 for guix-patches@gnu.org; Sat, 15 Feb 2020 13:53:04 -0500 Received: from debbugs.gnu.org ([209.51.188.43]:58643) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1j32Yo-00068y-UF for guix-patches@gnu.org; Sat, 15 Feb 2020 13:53:02 -0500 Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1j32Yo-00025g-Tj for guix-patches@gnu.org; Sat, 15 Feb 2020 13:53:02 -0500 X-Loop: help-debbugs@gnu.org Subject: [bug#39617] [PATCH 2/2] gnu: Add u-boot-pinebook-pro-rk3399. Resent-From: Jan Nieuwenhuizen Original-Sender: "Debbugs-submit" Resent-CC: guix-patches@gnu.org Resent-Date: Sat, 15 Feb 2020 18:53:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 39617 X-GNU-PR-Package: guix-patches X-GNU-PR-Keywords: patch To: 39617@debbugs.gnu.org Received: via spool by 39617-submit@debbugs.gnu.org id=B39617.15817927497988 (code B ref 39617); Sat, 15 Feb 2020 18:53:02 +0000 Received: (at 39617) by debbugs.gnu.org; 15 Feb 2020 18:52:29 +0000 Received: from localhost ([127.0.0.1]:36382 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1j32YB-00024c-Hs for submit@debbugs.gnu.org; Sat, 15 Feb 2020 13:52:29 -0500 Received: from eggs.gnu.org ([209.51.188.92]:46527) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1j32Y5-00024B-A7 for 39617@debbugs.gnu.org; Sat, 15 Feb 2020 13:52:17 -0500 Received: from fencepost.gnu.org ([2001:470:142:3::e]:53876) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1j32Y0-0005LN-3r; Sat, 15 Feb 2020 13:52:12 -0500 Received: from [2001:980:1b4f:1:42d2:832d:bb59:862] (port=39380 helo=dundal.fritz.box) by fencepost.gnu.org with esmtpa (Exim 4.82) (envelope-from ) id 1j32Xz-00039n-Kd; Sat, 15 Feb 2020 13:52:11 -0500 From: Jan Nieuwenhuizen Date: Sat, 15 Feb 2020 19:52:09 +0100 Message-Id: <20200215185209.28334-2-janneke@gnu.org> X-Mailer: git-send-email 2.24.0 In-Reply-To: <20200215185209.28334-1-janneke@gnu.org> References: <20200215185209.28334-1-janneke@gnu.org> MIME-Version: 1.0 X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 209.51.188.43 X-BeenThere: guix-patches@gnu.org List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: guix-patches-bounces+patchwork=mira.cbaines.net@gnu.org Sender: "Guix-patches" X-getmail-retrieved-from-mailbox: Patches * 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 ;;; Copyright © 2017, 2019 Mathieu Othacehe +;;; Copyright © 2020 Jan (janneke) Nieuwenhuizen ;;; ;;; 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 ;;; Copyright © 2019 Mathieu Othacehe ;;; Copyright © 2020 Björn Höfling +;;; Copyright © 2020 Jan (janneke) Nieuwenhuizen ;;; ;;; 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, . @@ -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)))