guix-devel
[Top][All Lists]
Advanced

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

Re: Distributing Guix System Pinebook Pro images


From: Vagrant Cascadian
Subject: Re: Distributing Guix System Pinebook Pro images
Date: Sun, 29 Aug 2021 13:41:06 -0700

On 2021-08-29, Vagrant Cascadian wrote:
> On 2021-08-29, Mathieu Othacehe wrote:
>> The Guix website now offers Pinebook Pro Guix System images[1]. Those
>> images can be directly copied on a micro-SD card and booted from. More
>> details here[2].
>
> It seems like I need to write up a hybrid pinebook/pinebook-pro
> bootloader definition, then that image could support *two* whole
> platforms. :)

Something like this, but that is valid guile and actually works :)

diff --git a/gnu/bootloader/u-boot.scm b/gnu/bootloader/u-boot.scm
index 6cad33b741..325618c5c5 100644
--- a/gnu/bootloader/u-boot.scm
+++ b/gnu/bootloader/u-boot.scm
@@ -127,6 +127,28 @@
 
 (define install-pinebook-pro-rk3399-u-boot install-rockpro64-rk3399-u-boot)
 
+(define install-pinebook-and-pinebook-pro-u-boot
+  ;; Install bootloaders for both pinebook pro and pinebook at compatible
+  ;; offsets.
+  ;;
+  ;; pinebook pro
+  #~(lambda (bootloader-pinebook-pro root-index image)
+      (let ((idb (string-append bootloader-pinebook-pro 
"/libexec/idbloader.img"))
+            (u-boot (string-append bootloader-pinebook-pro 
"/libexec/u-boot.itb")))
+        ;; Use alternate offset of 2112 to avoid conflicts with pinebook
+        (write-file-on-device idb (stat:size (stat idb))
+                              image (* 2112 512))
+        (write-file-on-device u-boot (stat:size (stat u-boot))
+                              image (* 16384 512))))
+  ;; pinebook
+  #~(lambda (bootloader-pinebook root-index image)
+      (let ((spl (string-append bootloader-pinebook 
"/libexec/u-boot-sunxi-with-spl.bin"))
+            (u-boot (string-append bootloader-pinebook 
"/libexec/u-boot-sunxi-with-spl.fit.itb")))
+        (write-file-on-device spl (stat:size (stat spl))
+                              image (* 8 1024))
+        (write-file-on-device u-boot (stat:size (stat u-boot))
+                              image (* 40 1024)))))
+

 
 ;;;
@@ -255,3 +277,9 @@
    (inherit u-boot-bootloader)
    (package u-boot-pinebook-pro-rk3399)
    (disk-image-installer install-pinebook-pro-rk3399-u-boot)))
+
+(define u-boot-pinebook-and-pinebook-pro-bootloader
+  (bootloader
+   (inherit u-boot-bootloader)
+   (packages '(u-boot-pinebook-pro-rk3399 u-boot-pinebook))
+   (disk-image-installer install-pinebook-and-pinebook-pro-uboot)))


live well,
  vagrant

Attachment: signature.asc
Description: PGP signature


reply via email to

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