summary refs log tree commit diff
path: root/gnu/bootloader/u-boot.scm
diff options
context:
space:
mode:
authorZheng Junjie <zhengjunjie@iscas.ac.cn>2024-05-11 13:32:57 +0800
committerZheng Junjie <zhengjunjie@iscas.ac.cn>2024-05-22 11:15:30 +0800
commitc7aec90a916a99067fd9915337caf098ee8e5083 (patch)
tree4893c77f66705bc42505015e9eea63248de76bca /gnu/bootloader/u-boot.scm
parent08474ff6ecf9472b58d188ce2a03a1c4f3f1a146 (diff)
downloadguix-c7aec90a916a99067fd9915337caf098ee8e5083.tar.gz
bootloader: Add u-boot-starfive-visionfive2-bootloader.
* gnu/bootloader/u-boot.scm (u-boot-starfive-visionfive2-bootloader): New variable.

Change-Id: I4b73906fe18d481644102c271f5e0883167b3a50
Diffstat (limited to 'gnu/bootloader/u-boot.scm')
-rw-r--r--gnu/bootloader/u-boot.scm29
1 files changed, 29 insertions, 0 deletions
diff --git a/gnu/bootloader/u-boot.scm b/gnu/bootloader/u-boot.scm
index 8e7cc05191..c5437a7b63 100644
--- a/gnu/bootloader/u-boot.scm
+++ b/gnu/bootloader/u-boot.scm
@@ -49,6 +49,7 @@
             u-boot-rockpro64-rk3399-bootloader
             u-boot-sifive-unmatched-bootloader
             u-boot-qemu-riscv64-bootloader
+            u-boot-starfive-visionfive2-bootloader
             u-boot-ts7970-q-2g-1000mhz-c-bootloader
             u-boot-wandboard-bootloader))
 
@@ -159,6 +160,27 @@
         (write-file-on-device u-boot (stat:size (stat u-boot))
                               image (* 2082 512)))))
 
+(define install-starfive-visionfive2-u-boot
+  #~(lambda (bootloader root-index image)
+      (let ((spl (string-append
+                  bootloader "/libexec/spl/u-boot-spl.bin.normal.out"))
+            (u-boot (string-append bootloader "/libexec/u-boot.itb")))
+        (write-file-on-device spl (stat:size (stat spl))
+                              image (* 34 512))
+        (write-file-on-device u-boot (stat:size (stat u-boot))
+                              image (* 2082 512)))))
+
+(define install-starfive-visionfive2-uEnv.txt
+  #~(lambda (bootloader device mount-point)
+      (mkdir-p (string-append mount-point "/boot"))
+      (call-with-output-file (string-append mount-point "/boot/uEnv.txt")
+        (lambda (port)
+          (format port
+                  ;; if board SPI use vender's u-boot, will find
+                  ;; ""starfive/starfive_visionfive2.dtb"", We cannot guarantee
+                  ;; that users will update this u-boot, so set it.
+                  "fdtfile=starfive/jh7110-starfive-visionfive-2-v1.3b.dtb~%")))))
+
 (define install-qemu-riscv64-u-boot
   #~(lambda (bootloader device mount-point)
       (let ((u-boot.bin (string-append bootloader "/libexec/u-boot.bin"))
@@ -316,6 +338,13 @@
    (package u-boot-sifive-unmatched)
    (disk-image-installer install-sifive-unmatched-u-boot)))
 
+(define u-boot-starfive-visionfive2-bootloader
+  (bootloader
+   (inherit u-boot-bootloader)
+   (package u-boot-starfive-visionfive2)
+   (installer install-starfive-visionfive2-uEnv.txt)
+   (disk-image-installer install-starfive-visionfive2-u-boot)))
+
 (define u-boot-qemu-riscv64-bootloader
   (bootloader
    (inherit u-boot-bootloader)