guix-patches
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[bug#29409] [PATCH 4/4] bootloader: Factorize write-file-on-device.


From: Ludovic Courtès
Subject: [bug#29409] [PATCH 4/4] bootloader: Factorize write-file-on-device.
Date: Mon, 11 Dec 2017 17:40:00 +0100
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/25.3 (gnu/linux)

address@hidden skribis:

> From: Mathieu Othacehe <address@hidden>
>
> * gnu/bootloader/extlinux.scm (install-extlinux): Factorize bootloader
>   writing in a new procedure ...
> * gnu/bootloader.scm (write-file-on-device): ... defined and exported here.

LGTM!

> +(define write-file-on-device
> +  #~(lambda (file size device offset)
> +      ;; Write SIZE bytes from FILE to DEVICE starting at OFFSET.
> +      (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))))))

Eventually we might want to move it to (gnu build vm) or to create a new
(gnu build bootloader) module with build-side code for bootloaders.

Thanks!

Ludo’.





reply via email to

[Prev in Thread] Current Thread [Next in Thread]