mirror of
https://git.in.rschanz.org/ryan77627/guix.git
synced 2024-11-07 07:26:13 -05:00
image: Add 'target' support.
* gnu/image.scm (<image>)[target]: New field, (image-target): new public method. * gnu/system/image.scm (hurd-disk-image): Set "i586-pc-gnu" as image 'target' field, (maybe-with-target): new procedure, (system-image): honor image 'target' field using the above procedure.
This commit is contained in:
parent
7ca533c723
commit
f292d4719d
2 changed files with 43 additions and 26 deletions
|
@ -33,6 +33,7 @@ (define-module (gnu image)
|
||||||
image
|
image
|
||||||
image-name
|
image-name
|
||||||
image-format
|
image-format
|
||||||
|
image-target
|
||||||
image-size
|
image-size
|
||||||
image-operating-system
|
image-operating-system
|
||||||
image-partitions
|
image-partitions
|
||||||
|
@ -67,6 +68,8 @@ (define-record-type* <image>
|
||||||
image make-image
|
image make-image
|
||||||
image?
|
image?
|
||||||
(format image-format) ;symbol
|
(format image-format) ;symbol
|
||||||
|
(target image-target
|
||||||
|
(default #f))
|
||||||
(size image-size ;size in bytes as integer
|
(size image-size ;size in bytes as integer
|
||||||
(default 'guess))
|
(default 'guess))
|
||||||
(operating-system image-operating-system ;<operating-system>
|
(operating-system image-operating-system ;<operating-system>
|
||||||
|
|
|
@ -104,6 +104,7 @@ (define hurd-initialize-root-partition
|
||||||
(define hurd-disk-image
|
(define hurd-disk-image
|
||||||
(image
|
(image
|
||||||
(format 'disk-image)
|
(format 'disk-image)
|
||||||
|
(target "i586-pc-gnu")
|
||||||
(partitions
|
(partitions
|
||||||
(list (partition
|
(list (partition
|
||||||
(size 'guess)
|
(size 'guess)
|
||||||
|
@ -519,6 +520,14 @@ (define (root-uuid os)
|
||||||
(type root-file-system-type))
|
(type root-file-system-type))
|
||||||
file-systems-to-keep)))))
|
file-systems-to-keep)))))
|
||||||
|
|
||||||
|
(define-syntax-rule (maybe-with-target image exp ...)
|
||||||
|
(let ((target (image-target image)))
|
||||||
|
(if target
|
||||||
|
(with-parameters ((%current-target-system target))
|
||||||
|
exp ...)
|
||||||
|
(begin
|
||||||
|
exp ...))))
|
||||||
|
|
||||||
(define* (system-image image)
|
(define* (system-image image)
|
||||||
"Return the derivation of IMAGE. It can be a raw disk-image or an ISO9660
|
"Return the derivation of IMAGE. It can be a raw disk-image or an ISO9660
|
||||||
image, depending on IMAGE format."
|
image, depending on IMAGE format."
|
||||||
|
@ -530,6 +539,7 @@ (define substitutable? (image-substitutable? image))
|
||||||
(bootcfg (operating-system-bootcfg os))
|
(bootcfg (operating-system-bootcfg os))
|
||||||
(bootloader (bootloader-configuration-bootloader
|
(bootloader (bootloader-configuration-bootloader
|
||||||
(operating-system-bootloader os))))
|
(operating-system-bootloader os))))
|
||||||
|
(maybe-with-target image
|
||||||
(case (image-format image)
|
(case (image-format image)
|
||||||
((disk-image)
|
((disk-image)
|
||||||
(system-disk-image image*
|
(system-disk-image image*
|
||||||
|
@ -555,7 +565,7 @@ (define substitutable? (image-substitutable? image))
|
||||||
;; This happens if some limits are exceeded, see:
|
;; This happens if some limits are exceeded, see:
|
||||||
;; https://lists.gnu.org/archive/html/grub-devel/2020-06/msg00048.html
|
;; https://lists.gnu.org/archive/html/grub-devel/2020-06/msg00048.html
|
||||||
#:grub-mkrescue-environment
|
#:grub-mkrescue-environment
|
||||||
'(("MKRESCUE_SED_MODE" . "mbr_only")))))))
|
'(("MKRESCUE_SED_MODE" . "mbr_only"))))))))
|
||||||
|
|
||||||
(define (find-image file-system-type target)
|
(define (find-image file-system-type target)
|
||||||
"Find and return an image built that could match the given FILE-SYSTEM-TYPE,
|
"Find and return an image built that could match the given FILE-SYSTEM-TYPE,
|
||||||
|
@ -570,4 +580,8 @@ (define (find-image file-system-type target)
|
||||||
(else
|
(else
|
||||||
efi-disk-image)))))
|
efi-disk-image)))))
|
||||||
|
|
||||||
|
;;; Local Variables:
|
||||||
|
;;; eval: (put 'maybe-with-target 'scheme-indent-function 1)
|
||||||
|
;;; End:
|
||||||
|
|
||||||
;;; image.scm ends here
|
;;; image.scm ends here
|
||||||
|
|
Loading…
Reference in a new issue