unofficial mirror of guix-devel@gnu.org 
 help / color / mirror / code / Atom feed
* Guix System on RockPro64
@ 2022-05-03 18:53 Tobias Platen
  2022-05-04 12:34 ` Tom Fitzhenry
  0 siblings, 1 reply; 4+ messages in thread
From: Tobias Platen @ 2022-05-03 18:53 UTC (permalink / raw)
  To: guix-devel

Hello,

I had a look at the guix page, there is a latest version image for the
PineBook Pro, which uses the same SoC. Unfortunately I was unable to
find the reciepe to build that image. The guix page is currently down,
I will try again tomorrow. Today I was able to install guix on top of
Debian which I have installed on my RockPro64.

Tobias



^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: Guix System on RockPro64
  2022-05-03 18:53 Guix System on RockPro64 Tobias Platen
@ 2022-05-04 12:34 ` Tom Fitzhenry
  2022-05-04 16:14   ` Vagrant Cascadian
  0 siblings, 1 reply; 4+ messages in thread
From: Tom Fitzhenry @ 2022-05-04 12:34 UTC (permalink / raw)
  To: Tobias Platen, guix-devel

[-- Attachment #1: Type: text/plain, Size: 1229 bytes --]

On 4/5/22 04:53, Tobias Platen wrote:
> I had a look at the guix page, there is a latest version image for the
> PineBook Pro, which uses the same SoC.
The SoC is the same, but the PineBook Pro and RockPro64 have different 
u-boot bootloaders: u-boot-rockpro64-rk3399-bootloader and 
u-boot-pinebook-pro-rk3399-bootloader, both in gnu/bootloader/u-boot.scm .

I have attached the image config that I used to build a RockPro64 image 
last week. See below for my plans to upstream.

> Unfortunately I was unable to
> find the reciepe to build that image. The guix page is currently down,
> I will try again tomorrow.

FWIW, the PineBook Pro image is at gnu/system/images/pinebook-pro.scm

> Today I was able to install guix on top of
> Debian which I have installed on my RockPro64.

That should be useful, to be able to build aarch64 images without having 
to do cross-compilation.


However, it's inconvenient that each aarch64 platform needs its own 
aarch64 image. To improve on this, I'm working on Tow-Boot[0] support 
for Guix. The result is that a single generic aarch64 image will work 
across all Tow-Boot supported devices[1], including the RockPro64.

0. https://tow-boot.org/
1. https://tow-boot.org/devices/index.html

[-- Attachment #2: rockpro64-image.patch --]
[-- Type: text/x-patch, Size: 2923 bytes --]

commit 397ee4242238905c8c1071aff6d345c600a709d6
Author: Tom Fitzhenry <tom@tom-fitzhenry.me.uk>
Date:   Mon Apr 25 16:51:52 2022 +1000

    add rockpro64 image

diff --git a/gnu/system/images/rockpro64.scm b/gnu/system/images/rockpro64.scm
new file mode 100644
index 0000000000..d03b4b90de
--- /dev/null
+++ b/gnu/system/images/rockpro64.scm
@@ -0,0 +1,69 @@
+
+;;; GNU Guix --- Functional package management for GNU
+;;; Copyright © 2021 Marius Bakke <marius@gnu.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/>.
+
+(define-module (gnu system images rockpro64)
+  #:use-module (gnu bootloader)
+  #:use-module (gnu bootloader u-boot)
+  #:use-module (gnu image)
+  #:use-module (gnu packages linux)
+  #:use-module (gnu 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 (rockpro64-barebones-os
+            rockpro64-image-type
+            rockpro64-barebones-raw-image))
+
+(define rockpro64-barebones-os
+  (operating-system
+    (host-name "jiehkkevarri")
+    (timezone "Europe/Oslo")
+    (locale "en_US.utf8")
+    (bootloader (bootloader-configuration
+                 (bootloader u-boot-rockpro64-rk3399-bootloader)
+                 (targets '("/dev/sda"))))
+    (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 (append (list (service dhcp-client-service-type))
+                      %base-services))))
+
+(define rockpro64-image-type
+  (image-type
+   (name 'rockpro64-raw)
+   (constructor (cut image-with-os
+                     (raw-with-offset-disk-image (expt 2 24))
+                     <>))))
+
+(define rockpro64-barebones-raw-image
+  (image
+   (inherit
+    (os+platform->image rockpro64-barebones-os aarch64-linux
+                        #:type rockpro64-image-type))
+   (name 'rockpro64-barebones-raw-image)))
+
+rockpro64-barebones-raw-image

^ permalink raw reply related	[flat|nested] 4+ messages in thread

* Re: Guix System on RockPro64
  2022-05-04 12:34 ` Tom Fitzhenry
@ 2022-05-04 16:14   ` Vagrant Cascadian
  2022-05-05  2:48     ` Tom Fitzhenry
  0 siblings, 1 reply; 4+ messages in thread
From: Vagrant Cascadian @ 2022-05-04 16:14 UTC (permalink / raw)
  To: Tom Fitzhenry, Tobias Platen, guix-devel

[-- Attachment #1: Type: text/plain, Size: 3403 bytes --]

On 2022-05-04, Tom Fitzhenry wrote:
> On 4/5/22 04:53, Tobias Platen wrote:
>> I had a look at the guix page, there is a latest version image for the
>> PineBook Pro, which uses the same SoC.
> The SoC is the same, but the PineBook Pro and RockPro64 have different 
> u-boot bootloaders: u-boot-rockpro64-rk3399-bootloader and 
> u-boot-pinebook-pro-rk3399-bootloader, both in gnu/bootloader/u-boot.scm .
...
> However, it's inconvenient that each aarch64 platform needs its own 
> aarch64 image.

You could create a "generic" image that supports UEFI or standard u-boot
methods, and the user can bring-their-own UEFI implementation
(e.g. tianocore, recent versions of u-boot with EFI) or install u-boot
or barebox or whatever manually.

Another approach used by debian-installer images is to ship the image
that is used by all the platforms, and then a small firmware portion
that is device-specific:

  https://d-i.debian.org/daily-images/arm64/daily/netboot/SD-card-images/README.concatenateable_images

It's a little more cumbersome to download two images and dump them onto
the media, although I imagine guix could implement this part and make it
relatively simple, while still having a shared substitute for the bulk
of the image.


> To improve on this, I'm working on Tow-Boot[0] support 
> for Guix. The result is that a single generic aarch64 image will work 
> across all Tow-Boot supported devices[1], including the RockPro64.
>
> 0. https://tow-boot.org/
> 1. https://tow-boot.org/devices/index.html

My understanding was tow-boot was mostly, at this point, something to
avoid installing as part of the distro image. You can basically do the
same thing with mainline u-boot, if you install u-boot to media other
than the distro media. Or does tow-boot have fancier features working
yet (e.g. menu interfaces from the firmware) ?


> +    (initrd-modules '())
> +    (kernel linux-libre-arm64-generic)

I've managed to get the default linux-libre working, installed with
rootfs on SATA. It does require a fairly extensive list of modules to
load in the initrd:

  (kernel linux-libre-5.17) ;; from before it was default
  (initrd-modules
   (append                                                                                                                                  (list
     ;; scsi modules
     "ahci"
     "libata"
     "sd_mod"
     "scsi_common"
     "t10_pi"
     ;; regulators and clocks
     "rk808-regulator"
     "clk-rk808"
     "fixed"
     "fan53555"
     "rk808"
     "i2c-rk3x"
     "pl330"
     "dwc3"
     "rtc-rk808"
     "sdhci"
     "sdhci-pltfm"
     "dw_mmc"
     "dw_mmc-pltfm"
     ;; "dw_mmc-rockchip"
     "phy_rockchip_pcie"
     "pcie_rockchip_host"
     "nvme")))

I've recently noticed it taking a long time on shutdown or reboot with
"dw_mmc_rockchip" still loaded, but I don't use the mmc bus for anything
other than the bootloader itself installed on microSD. If you're using
microSD or eMMC I'd be curious if that still happened.


Although using the generic kernel, with guix's primitive module handling
from the initrd (essentially looping through the list and manually
loading each one), it might be easier to support a single image with
linux-libre-arm64-generic kernel, where most features are built-in
rather than modular.


live well,
  vagrant

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 227 bytes --]

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: Guix System on RockPro64
  2022-05-04 16:14   ` Vagrant Cascadian
@ 2022-05-05  2:48     ` Tom Fitzhenry
  0 siblings, 0 replies; 4+ messages in thread
From: Tom Fitzhenry @ 2022-05-05  2:48 UTC (permalink / raw)
  To: Vagrant Cascadian, Tobias Platen, guix-devel

On Thu, 5 May 2022, at 2:14 AM, Vagrant Cascadian wrote:
> You could create a "generic" image that supports UEFI or standard u-boot
> methods, and the user can bring-their-own UEFI implementation
> (e.g. tianocore, recent versions of u-boot with EFI) or install u-boot
> or barebox or whatever manually.

Yes, this is the idea behind Tow-Boot. Tow-Boot is an opinionated build of u-boot that implements enough of EFI to be able to boot a generic UEFI image.

The same image would work for any aarch64 device supporting EFI: via Tianocore, via Tow-Boot, via ARM BBR, ...

I intend to write this up in more detail with my patches.

> My understanding was tow-boot was mostly, at this point, something to
> avoid installing as part of the distro image. You can basically do the
> same thing with mainline u-boot, if you install u-boot to media other
> than the distro media. Or does tow-boot have fancier features working
> yet (e.g. menu interfaces from the firmware) ?

Yes, the distro is not responsible for installing Tow-Boot on the SPI. If a user's device doesn't support EFI, and they want to install Tow-Boot on SPI, they would need to do that themselves (by following Tow-Boot's installation instructions). PostmarketOS are working on delivering Tow-Boot updates via LVFS: https://github.com/fwupd/fwupd/issues/4294

The only thing Guix needs to do is provide a generic aarch64 image that supports UEFI. I have something WIP for that.


^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2022-05-05  3:16 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-05-03 18:53 Guix System on RockPro64 Tobias Platen
2022-05-04 12:34 ` Tom Fitzhenry
2022-05-04 16:14   ` Vagrant Cascadian
2022-05-05  2:48     ` Tom Fitzhenry

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).