66 lines
2.1 KiB
Scheme
66 lines
2.1 KiB
Scheme
|
(define-module (skg packages u-boot)
|
||
|
#:use-module (gnu bootloader extlinux)
|
||
|
#:use-module (gnu bootloader)
|
||
|
#:use-module (skg packages bootloaders)
|
||
|
#:use-module (guix gexp)
|
||
|
#:use-module (ice-9 match)
|
||
|
#:export (u-boot-bootloader
|
||
|
u-boot-rg35xx-bootloader))
|
||
|
|
||
|
(define (make-u-boot-installer file)
|
||
|
(let ((file
|
||
|
(match file
|
||
|
((? string?)
|
||
|
(list #~(install-file (string-append bootloader #$file)
|
||
|
install-dir)))
|
||
|
((? file-like?) (list #~(install-file #$file install-dir)))
|
||
|
(#f '()))))
|
||
|
#~(lambda (bootloader device mount-point)
|
||
|
(let ((install-dir (string-append mount-point "/boot")))
|
||
|
#$@file))))
|
||
|
|
||
|
(define install-u-boot
|
||
|
#~(lambda (bootloader root-index image)
|
||
|
(if bootloader
|
||
|
(error "Failed to install U-Boot"))))
|
||
|
|
||
|
(define install-allwinner-u-boot
|
||
|
#~(lambda (bootloader root-index image)
|
||
|
(let ((u-boot (string-append bootloader
|
||
|
"/libexec/u-boot-sunxi-with-spl.bin")))
|
||
|
(write-file-on-device u-boot (stat:size (stat u-boot))
|
||
|
image (* 8 1024)))))
|
||
|
|
||
|
(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)))))
|
||
|
|
||
|
|
||
|
(define u-boot-bootloader
|
||
|
(bootloader
|
||
|
(inherit extlinux-bootloader)
|
||
|
(name 'u-boot)
|
||
|
(package #f)
|
||
|
(installer #f)
|
||
|
(disk-image-installer install-u-boot)))
|
||
|
|
||
|
(define u-boot-allwinner-bootloader
|
||
|
(bootloader
|
||
|
(inherit u-boot-bootloader)
|
||
|
(disk-image-installer install-allwinner-u-boot)))
|
||
|
|
||
|
(define u-boot-allwinner64-bootloader
|
||
|
(bootloader
|
||
|
(inherit u-boot-bootloader)
|
||
|
(disk-image-installer install-allwinner64-u-boot)))
|
||
|
|
||
|
(define u-boot-rg35xx-bootloader
|
||
|
(bootloader
|
||
|
(inherit u-boot-allwinner64-bootloader)
|
||
|
(package u-boot-rg35xx)))
|