[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
universal aarch64/riscv64 images
From: |
Efraim Flashner |
Subject: |
universal aarch64/riscv64 images |
Date: |
Mon, 27 Feb 2023 22:09:38 +0200 |
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
signature.asc
Description: PGP signature
- universal aarch64/riscv64 images,
Efraim Flashner <=