diff options
Diffstat (limited to 'gnu/bootloader/u-boot.scm')
| -rw-r--r-- | gnu/bootloader/u-boot.scm | 84 |
1 files changed, 29 insertions, 55 deletions
diff --git a/gnu/bootloader/u-boot.scm b/gnu/bootloader/u-boot.scm index 5ea5f418b47..5d5fc1bff26 100644 --- a/gnu/bootloader/u-boot.scm +++ b/gnu/bootloader/u-boot.scm | |||
| @@ -66,6 +66,22 @@ | |||
| 66 | (let ((install-dir (string-append mount-point "/boot"))) | 66 | (let ((install-dir (string-append mount-point "/boot"))) |
| 67 | #$@file)))) | 67 | #$@file)))) |
| 68 | 68 | ||
| 69 | (define (write-u-boot-image files block-size) | ||
| 70 | "FILES is a list of (FILE COUNT OFFSET) tuples. Each FILE is written | ||
| 71 | to the target image at BLOCK-SIZE * OFFSET. The number of bytes written | ||
| 72 | is BLOCK-SIZE * COUNT, or FILE size if COUNT is not given." | ||
| 73 | (define (write-file-to-image file) | ||
| 74 | (match file | ||
| 75 | ((file count ... offset) | ||
| 76 | (let* ((file #~(string-append bootloader "/libexec/" #$file)) | ||
| 77 | (size (match count | ||
| 78 | (() #~(stat:size (stat #$file))) | ||
| 79 | ((count) (* count block-size))))) | ||
| 80 | #~(write-file-on-device #$file #$size image | ||
| 81 | #$(* offset block-size)))))) | ||
| 82 | #~(lambda (bootloader _ image) | ||
| 83 | #$@(map write-file-to-image files))) | ||
| 84 | |||
| 69 | (define install-u-boot | 85 | (define install-u-boot |
| 70 | #~(lambda (bootloader root-index image) | 86 | #~(lambda (bootloader root-index image) |
| 71 | (if bootloader | 87 | (if bootloader |
| @@ -78,75 +94,33 @@ | |||
| 78 | ;; the MLO and is expected at 0x60000. Write both first stage ("MLO") and | 94 | ;; the MLO and is expected at 0x60000. Write both first stage ("MLO") and |
| 79 | ;; second stage ("u-boot.img") images, read in BOOTLOADER directory, to the | 95 | ;; second stage ("u-boot.img") images, read in BOOTLOADER directory, to the |
| 80 | ;; specified DEVICE. | 96 | ;; specified DEVICE. |
| 81 | #~(lambda (bootloader root-index image) | 97 | (write-u-boot-image '(("MLO" 256 256) ("u-boot.img" 768 1024)) 512)) |
| 82 | (let ((mlo (string-append bootloader "/libexec/MLO")) | ||
| 83 | (u-boot (string-append bootloader "/libexec/u-boot.img"))) | ||
| 84 | (write-file-on-device mlo (* 256 512) | ||
| 85 | image (* 256 512)) | ||
| 86 | (write-file-on-device u-boot (* 1024 512) | ||
| 87 | image (* 768 512))))) | ||
| 88 | 98 | ||
| 89 | (define install-allwinner-u-boot | 99 | (define install-allwinner-u-boot |
| 90 | #~(lambda (bootloader root-index image) | 100 | (write-u-boot-image '(("u-boot-sunxi-with-spl.bin" 8)) 1024)) |
| 91 | (let ((u-boot (string-append bootloader | ||
| 92 | "/libexec/u-boot-sunxi-with-spl.bin"))) | ||
| 93 | (write-file-on-device u-boot (stat:size (stat u-boot)) | ||
| 94 | image (* 8 1024))))) | ||
| 95 | 101 | ||
| 96 | (define install-allwinner64-u-boot | 102 | (define install-allwinner64-u-boot |
| 97 | #~(lambda (bootloader root-index image) | 103 | (write-u-boot-image '(("u-boot-sunxi-with-spl.bin" 8) |
| 98 | (let ((spl (string-append bootloader "/libexec/u-boot-sunxi-with-spl.bin")) | 104 | ("u-boot-sunxi-with-spl.fit.itb" 40)) |
| 99 | (u-boot (string-append bootloader "/libexec/u-boot-sunxi-with-spl.fit.itb"))) | 105 | 1024)) |
| 100 | (write-file-on-device spl (stat:size (stat spl)) | ||
| 101 | image (* 8 1024)) | ||
| 102 | (write-file-on-device u-boot (stat:size (stat u-boot)) | ||
| 103 | image (* 40 1024))))) | ||
| 104 | 106 | ||
| 105 | (define install-imx-u-boot | 107 | (define install-imx-u-boot |
| 106 | #~(lambda (bootloader root-index image) | 108 | (write-u-boot-image '(("SPL" 1) ("u-boot.img" 69)) 1024)) |
| 107 | (let ((spl (string-append bootloader "/libexec/SPL")) | ||
| 108 | (u-boot (string-append bootloader "/libexec/u-boot.img"))) | ||
| 109 | (write-file-on-device spl (stat:size (stat spl)) | ||
| 110 | image (* 1 1024)) | ||
| 111 | (write-file-on-device u-boot (stat:size (stat u-boot)) | ||
| 112 | image (* 69 1024))))) | ||
| 113 | 109 | ||
| 114 | (define install-puma-rk3399-u-boot | 110 | (define install-puma-rk3399-u-boot |
| 115 | #~(lambda (bootloader root-index image) | 111 | (write-u-boot-image '(("idbloader.img" 64) ("u-boot.itb" 512)) 512)) |
| 116 | (let ((spl (string-append bootloader "/libexec/idbloader.img")) | ||
| 117 | (u-boot (string-append bootloader "/libexec/u-boot.itb"))) | ||
| 118 | (write-file-on-device spl (stat:size (stat spl)) | ||
| 119 | image (* 64 512)) | ||
| 120 | (write-file-on-device u-boot (stat:size (stat u-boot)) | ||
| 121 | image (* 512 512))))) | ||
| 122 | 112 | ||
| 123 | (define install-rockchip-u-boot | 113 | (define install-rockchip-u-boot |
| 124 | #~(lambda (bootloader root-index image) | 114 | (write-u-boot-image '(("idbloader.img" 64) ("u-boot.itb" 16384)) 512)) |
| 125 | (let ((idb (string-append bootloader "/libexec/idbloader.img")) | ||
| 126 | (u-boot (string-append bootloader "/libexec/u-boot.itb"))) | ||
| 127 | (write-file-on-device idb (stat:size (stat idb)) | ||
| 128 | image (* 64 512)) | ||
| 129 | (write-file-on-device u-boot (stat:size (stat u-boot)) | ||
| 130 | image (* 16384 512))))) | ||
| 131 | 115 | ||
| 132 | (define install-sifive-unmatched-u-boot | 116 | (define install-sifive-unmatched-u-boot |
| 133 | #~(lambda (bootloader root-index image) | 117 | (write-u-boot-image '(("spl/u-boot-spl.bin" 34) ("u-boot.itb" 2082)) |
| 134 | (let ((spl (string-append bootloader "/libexec/spl/u-boot-spl.bin")) | 118 | 512)) |
| 135 | (u-boot (string-append bootloader "/libexec/u-boot.itb"))) | ||
| 136 | (write-file-on-device spl (stat:size (stat spl)) | ||
| 137 | image (* 34 512)) | ||
| 138 | (write-file-on-device u-boot (stat:size (stat u-boot)) | ||
| 139 | image (* 2082 512))))) | ||
| 140 | 119 | ||
| 141 | (define install-starfive-visionfive2-u-boot | 120 | (define install-starfive-visionfive2-u-boot |
| 142 | #~(lambda (bootloader root-index image) | 121 | (write-u-boot-image '(("spl/u-boot-spl.bin.normal.out" 34) |
| 143 | (let ((spl (string-append | 122 | ("u-boot.itb" 2082)) |
| 144 | bootloader "/libexec/spl/u-boot-spl.bin.normal.out")) | 123 | 512)) |
| 145 | (u-boot (string-append bootloader "/libexec/u-boot.itb"))) | ||
| 146 | (write-file-on-device spl (stat:size (stat spl)) | ||
| 147 | image (* 34 512)) | ||
| 148 | (write-file-on-device u-boot (stat:size (stat u-boot)) | ||
| 149 | image (* 2082 512))))) | ||
| 150 | 124 | ||
| 151 | (define install-starfive-visionfive2-uEnv.txt | 125 | (define install-starfive-visionfive2-uEnv.txt |
| 152 | (make-u-boot-installer | 126 | (make-u-boot-installer |
