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: Efraim Flashner
Subject: Re: Distributing Guix System Pinebook Pro images
Date: Mon, 30 Aug 2021 14:07:57 +0300

On Sun, Aug 29, 2021 at 01:41:06PM -0700, Vagrant Cascadian wrote:
> 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 :)

I've been looking at this a bit since I'm actually nearing the point of
having something to write for the HiFive Unmatched. write-file-on-device
can be called multiple times, we've only needed it twice for all the
other cases though.

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

This could probably be (very untested)

(define install-pinebook-and-pinebook-pro-u-boot
  ;; Install bootloaders for both the pinebook and pinebook pro at compatible
  ;; offsets.
  #~(lambda (bootloader-pinebook-pro 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"))
            (idb (string-append bootloader-pinebook-pro 
"/libexec/idbloader.img"))
            (u-boot-pro (string-append bootloader-pinebook-pro 
"/libexec/u-boot.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))
        ;; 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-pro))
                              image (* 16384 512)))))
> 
>  
>  ;;;
> @@ -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)
not sure what to do with this one though
> +   (packages '(u-boot-pinebook-pro-rk3399 u-boot-pinebook))
> +   (disk-image-installer install-pinebook-and-pinebook-pro-uboot)))
> 
> 
> live well,
>   vagrant



-- 
Efraim Flashner   <efraim@flashner.co.il>   רנשלפ םירפא
GPG key = A28B F40C 3E55 1372 662D  14F7 41AA E7DC CA3D 8351
Confidentiality cannot be guaranteed on emails sent or received unencrypted

Attachment: signature.asc
Description: PGP signature


reply via email to

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