diff options
| author | Mathieu Othacehe <othacehe@gnu.org> | 2020-06-13 14:01:18 +0200 |
|---|---|---|
| committer | Mathieu Othacehe <othacehe@gnu.org> | 2020-06-13 15:20:52 +0200 |
| commit | f292d4719dead6a615187f325fbc0bb0e99d10b4 (patch) | |
| tree | 1c24c9dabcf98907d64979ba070832679253d814 | |
| parent | 7ca533c7237622d70b423033c4506217d9ce4014 (diff) | |
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.
| -rw-r--r-- | gnu/image.scm | 3 | ||||
| -rw-r--r-- | gnu/system/image.scm | 66 |
2 files changed, 43 insertions, 26 deletions
diff --git a/gnu/image.scm b/gnu/image.scm index 0a92d168e96..19b466527bc 100644 --- a/gnu/image.scm +++ b/gnu/image.scm | |||
| @@ -33,6 +33,7 @@ | |||
| 33 | image | 33 | image |
| 34 | image-name | 34 | image-name |
| 35 | image-format | 35 | image-format |
| 36 | image-target | ||
| 36 | image-size | 37 | image-size |
| 37 | image-operating-system | 38 | image-operating-system |
| 38 | image-partitions | 39 | image-partitions |
| @@ -67,6 +68,8 @@ | |||
| 67 | image make-image | 68 | image make-image |
| 68 | image? | 69 | image? |
| 69 | (format image-format) ;symbol | 70 | (format image-format) ;symbol |
| 71 | (target image-target | ||
| 72 | (default #f)) | ||
| 70 | (size image-size ;size in bytes as integer | 73 | (size image-size ;size in bytes as integer |
| 71 | (default 'guess)) | 74 | (default 'guess)) |
| 72 | (operating-system image-operating-system ;<operating-system> | 75 | (operating-system image-operating-system ;<operating-system> |
diff --git a/gnu/system/image.scm b/gnu/system/image.scm index be8b6e67f75..97e4bb0e3ca 100644 --- a/gnu/system/image.scm +++ b/gnu/system/image.scm | |||
| @@ -104,6 +104,7 @@ | |||
| 104 | (define hurd-disk-image | 104 | (define hurd-disk-image |
| 105 | (image | 105 | (image |
| 106 | (format 'disk-image) | 106 | (format 'disk-image) |
| 107 | (target "i586-pc-gnu") | ||
| 107 | (partitions | 108 | (partitions |
| 108 | (list (partition | 109 | (list (partition |
| 109 | (size 'guess) | 110 | (size 'guess) |
| @@ -519,6 +520,14 @@ it can be used for bootloading." | |||
| 519 | (type root-file-system-type)) | 520 | (type root-file-system-type)) |
| 520 | file-systems-to-keep))))) | 521 | file-systems-to-keep))))) |
| 521 | 522 | ||
| 523 | (define-syntax-rule (maybe-with-target image exp ...) | ||
| 524 | (let ((target (image-target image))) | ||
| 525 | (if target | ||
| 526 | (with-parameters ((%current-target-system target)) | ||
| 527 | exp ...) | ||
| 528 | (begin | ||
| 529 | exp ...)))) | ||
| 530 | |||
| 522 | (define* (system-image image) | 531 | (define* (system-image image) |
| 523 | "Return the derivation of IMAGE. It can be a raw disk-image or an ISO9660 | 532 | "Return the derivation of IMAGE. It can be a raw disk-image or an ISO9660 |
| 524 | image, depending on IMAGE format." | 533 | image, depending on IMAGE format." |
| @@ -530,32 +539,33 @@ image, depending on IMAGE format." | |||
| 530 | (bootcfg (operating-system-bootcfg os)) | 539 | (bootcfg (operating-system-bootcfg os)) |
| 531 | (bootloader (bootloader-configuration-bootloader | 540 | (bootloader (bootloader-configuration-bootloader |
| 532 | (operating-system-bootloader os)))) | 541 | (operating-system-bootloader os)))) |
| 533 | (case (image-format image) | 542 | (maybe-with-target image |
| 534 | ((disk-image) | 543 | (case (image-format image) |
| 535 | (system-disk-image image* | 544 | ((disk-image) |
| 536 | #:bootcfg bootcfg | 545 | (system-disk-image image* |
| 537 | #:bootloader bootloader | 546 | #:bootcfg bootcfg |
| 538 | #:register-closures? register-closures? | 547 | #:bootloader bootloader |
| 539 | #:inputs `(("system" ,os) | 548 | #:register-closures? register-closures? |
| 540 | ("bootcfg" ,bootcfg)))) | 549 | #:inputs `(("system" ,os) |
| 541 | ((iso9660) | 550 | ("bootcfg" ,bootcfg)))) |
| 542 | (system-iso9660-image | 551 | ((iso9660) |
| 543 | image* | 552 | (system-iso9660-image |
| 544 | #:bootcfg bootcfg | 553 | image* |
| 545 | #:bootloader bootloader | 554 | #:bootcfg bootcfg |
| 546 | #:register-closures? register-closures? | 555 | #:bootloader bootloader |
| 547 | #:inputs `(("system" ,os) | 556 | #:register-closures? register-closures? |
| 548 | ("bootcfg" ,bootcfg)) | 557 | #:inputs `(("system" ,os) |
| 549 | ;; Make sure to use a mode that does no imply | 558 | ("bootcfg" ,bootcfg)) |
| 550 | ;; HFS+ tree creation that may fail with: | 559 | ;; Make sure to use a mode that does no imply |
| 551 | ;; | 560 | ;; HFS+ tree creation that may fail with: |
| 552 | ;; "libisofs: FAILURE : Too much files to mangle, | 561 | ;; |
| 553 | ;; cannot guarantee unique file names" | 562 | ;; "libisofs: FAILURE : Too much files to mangle, |
| 554 | ;; | 563 | ;; cannot guarantee unique file names" |
| 555 | ;; This happens if some limits are exceeded, see: | 564 | ;; |
| 556 | ;; https://lists.gnu.org/archive/html/grub-devel/2020-06/msg00048.html | 565 | ;; This happens if some limits are exceeded, see: |
| 557 | #:grub-mkrescue-environment | 566 | ;; https://lists.gnu.org/archive/html/grub-devel/2020-06/msg00048.html |
| 558 | '(("MKRESCUE_SED_MODE" . "mbr_only"))))))) | 567 | #:grub-mkrescue-environment |
| 568 | '(("MKRESCUE_SED_MODE" . "mbr_only")))))))) | ||
| 559 | 569 | ||
| 560 | (define (find-image file-system-type target) | 570 | (define (find-image file-system-type target) |
| 561 | "Find and return an image built that could match the given FILE-SYSTEM-TYPE, | 571 | "Find and return an image built that could match the given FILE-SYSTEM-TYPE, |
| @@ -570,4 +580,8 @@ addition of the <image> record." | |||
| 570 | (else | 580 | (else |
| 571 | efi-disk-image))))) | 581 | efi-disk-image))))) |
| 572 | 582 | ||
| 583 | ;;; Local Variables: | ||
| 584 | ;;; eval: (put 'maybe-with-target 'scheme-indent-function 1) | ||
| 585 | ;;; End: | ||
| 586 | |||
| 573 | ;;; image.scm ends here | 587 | ;;; image.scm ends here |
