summary refs log tree commit diff
path: root/gnu/build
diff options
context:
space:
mode:
authorMathieu Othacehe <othacehe@gnu.org>2020-10-05 10:58:55 +0200
committerMathieu Othacehe <othacehe@gnu.org>2020-10-05 11:10:35 +0200
commitb97b423e3f61c80d5877dadc95b3f316cd61788f (patch)
treeb0ba2a1458875c8e33e1430a0e04dad14ca833d8 /gnu/build
parent525a351efaea52dbd4f93321a490397ebeb2130f (diff)
downloadguix-b97b423e3f61c80d5877dadc95b3f316cd61788f.tar.gz
bootloader: Fix u-boot installation.
This is a follow-up of f19cf27c2b9ff92e2c0fd931ef7fde39c376adaa. The
bootloader installation must be done on the final disk-image, hence using
"disk-image-installer" instead of "installer" callback.

* gnu/bootloader/u-boot.scm: Turn all installer callbacks into
disk-image-installer callbacks.
* gnu/build/bootloader.scm (write-file-on-device): Open the output file with
'no-truncate and 'no-create options.
* gnu/system/image.scm (with-imported-modules*): Add (gnu build bootloader)
module.
Diffstat (limited to 'gnu/build')
-rw-r--r--gnu/build/bootloader.scm15
1 files changed, 10 insertions, 5 deletions
diff --git a/gnu/build/bootloader.scm b/gnu/build/bootloader.scm
index 498022f6db..5ec839f902 100644
--- a/gnu/build/bootloader.scm
+++ b/gnu/build/bootloader.scm
@@ -22,6 +22,8 @@
   #:use-module (guix utils)
   #:use-module (ice-9 binary-ports)
   #:use-module (ice-9 format)
+  #:use-module (rnrs io ports)
+  #:use-module (rnrs io simple)
   #:export (write-file-on-device
             install-efi-loader))
 
@@ -35,11 +37,14 @@
   (call-with-input-file file
     (lambda (input)
       (let ((bv (get-bytevector-n input size)))
-        (call-with-output-file device
-          (lambda (output)
-            (seek output offset SEEK_SET)
-            (put-bytevector output bv))
-          #:binary #t)))))
+        (call-with-port
+         (open-file-output-port device
+                                (file-options no-truncate no-create)
+                                (buffer-mode block)
+                                (native-transcoder))
+         (lambda (output)
+           (seek output offset SEEK_SET)
+           (put-bytevector output bv)))))))
 
 
 ;;;