unofficial mirror of guix-devel@gnu.org 
 help / color / mirror / code / Atom feed
From: Efraim Flashner <efraim@flashner.co.il>
To: guix-devel@gnu.org
Subject: universal aarch64/riscv64 images
Date: Mon, 27 Feb 2023 22:09:38 +0200	[thread overview]
Message-ID: <Y/0OAngSsiyWMRrf@3900XT> (raw)

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

I've been thinking some about how we create our disk images for aarch64
devices and how we'll eventually create images for riscv64 devices.
Currently we use u-boot to load extlinux to boot linux. I propose we use
u-boot with its EFI interface to load grub-efi to boot linux.

Major benefit of this is that we can create one generic aarch64 image
using raw-with-offset to create the image and then ship a separate
script to flash either the SD card or an SPI chip or whatever someone
wants. We also don't need to reflash u-boot at every reconfigure (I
couldn't follow the code well enough to see if that's currently the
case), just regenerate extlinux or grub-efi like we do on x86_64.

Currently here's the script to install u-boot on the disk image for a pine64:

(define install-allwinner64-u-boot
  #~(lambda (bootloader root-index image)
      (let ((spl (string-append bootloader "/libexec/u-boot-sunxi-with-spl.bin"))
            (u-boot (string-append bootloader "/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)))))

And in the OS config:

    (bootloader (bootloader-configuration
                 (bootloader u-boot-pine64-lts-bootloader)
                 (targets '("/dev/vda"))))

This would transition to (work in progress):

(define install-allwinner64-u-boot
  #~(lambda (bootloader root-index image)
      (let ((spl (string-append bootloader "/libexec/u-boot-sunxi-with-spl.bin"))
            (u-boot (string-append bootloader "/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 needs to be fixed up to actually work!!
;; To be run (as root): 'u-boot-installer-pine64-lts /dev/sda'
(define-public u-boot-installer-pine64-lts
  (program-file "u-boot-installer-pine64-lts"
    #~((let ((bootloader u-boot-pine64-lts)
             (image $1)))
       #$(install-allwinner-u-boot))))

(bootloader (bootloader-configuration
             (bootloader grub-efi)
             (targets '("/dev/vda"))))

(extra-special-file `(("/sbin/flash-u-boot" ,u-boot-installer-pine64-lts)))



-- 
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:[~2023-02-27 20:10 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-02-27 20:09 Efraim Flashner [this message]
2023-02-27 23:46 ` universal aarch64/riscv64 images Vagrant Cascadian

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=Y/0OAngSsiyWMRrf@3900XT \
    --to=efraim@flashner.co.il \
    --cc=guix-devel@gnu.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).