diff options
| author | Denis 'GNUtoo' Carikli <GNUtoo@cyberdimension.org> | 2025-10-13 02:19:26 +0200 |
|---|---|---|
| committer | Ludovic Courtès <ludo@gnu.org> | 2025-11-24 23:22:52 +0100 |
| commit | 35770c78a2db5cced15f651fdf31ed9aae349899 (patch) | |
| tree | 0bc7cc1ca30bebbaa1e94d0550b593e056258b12 /gnu/build | |
| parent | 5e5ac81e9562c9f77910766f3a1c857b3da36472 (diff) | |
image: Add support for swap.
* gnu/build/image.scm (make-swap-image): New variable.
(make-partition-image): Support swap.
* gnu/system/image.scm (system-disk-image): Support swap.
* doc/guix.texi: (partition Reference): Support swap.
Change-Id: I1c201e6aa5dd207d53e5732617910860ee894990
Signed-off-by: Denis 'GNUtoo' Carikli <GNUtoo@cyberdimension.org>
Signed-off-by: Ludovic Courtès <ludo@gnu.org>
Diffstat (limited to 'gnu/build')
| -rw-r--r-- | gnu/build/image.scm | 19 |
1 files changed, 19 insertions, 0 deletions
diff --git a/gnu/build/image.scm b/gnu/build/image.scm index c7cf72be91d..c99446f7382 100644 --- a/gnu/build/image.scm +++ b/gnu/build/image.scm @@ -175,6 +175,23 @@ turn doesn't take any constant overhead into account, force a 1-MiB minimum." (string-append "::" file)))) (scandir root)))) +(define* (make-swap-image partition target) + "Make a swap partition of a certain size." + (let ((size (partition-size partition)) + (label (partition-label partition)) + (uuid (partition-uuid partition)) + (fs-options (partition-file-system-options partition))) + (apply invoke "fakeroot" "mkswap" + "--pagesize" "4096" + "--endianness" "little" + "-L" label + "--file" target + "--size" (number->string size) + `(,@(if uuid + `("-U" ,(uuid->string uuid)) + '()) + ,@fs-options)))) + (define* (make-unformatted-image partition target) "Make an unformatted partition of a certain size." (let ((size (partition-size partition))) @@ -199,6 +216,8 @@ ROOT directory to populate the image." (make-vfat-image partition target root 16)) ((string=? type "fat32") (make-vfat-image partition target root 32)) + ((string=? "swap" type) + (make-swap-image partition target)) ((string=? type "unformatted") (make-unformatted-image partition target)) (else |
