unofficial mirror of guix-devel@gnu.org 
 help / color / mirror / code / Atom feed
From: Efraim Flashner <efraim@flashner.co.il>
To: Vagrant Cascadian <vagrant@debian.org>
Cc: guix-devel <guix-devel@gnu.org>, Mathieu Othacehe <othacehe@gnu.org>
Subject: Re: Distributing Guix System Pinebook Pro images
Date: Mon, 30 Aug 2021 14:07:57 +0300	[thread overview]
Message-ID: <YSy8DT2ju7F7j1/m@3900XT> (raw)
In-Reply-To: <87sfysrnkt.fsf@yucca>

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

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 #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 833 bytes --]

  reply	other threads:[~2021-08-30 11:10 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-08-29  9:09 Distributing Guix System Pinebook Pro images Mathieu Othacehe
2021-08-29 15:16 ` Maxim Cournoyer
2021-08-29 20:15 ` Vagrant Cascadian
2021-08-29 20:41   ` Vagrant Cascadian
2021-08-30 11:07     ` Efraim Flashner [this message]
2021-08-30 11:00   ` Efraim Flashner
2021-08-30  9:52 ` Mathieu Othacehe
2021-08-30 14:01   ` Vagrant Cascadian
2021-08-30 14:52     ` Mathieu Othacehe
2021-08-30 19:13       ` André A. Gomes
2021-08-30 14:37 ` Katherine Cox-Buday

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=YSy8DT2ju7F7j1/m@3900XT \
    --to=efraim@flashner.co.il \
    --cc=guix-devel@gnu.org \
    --cc=othacehe@gnu.org \
    --cc=vagrant@debian.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).