mirror of
https://codeberg.org/guix/guix.git
synced 2026-01-25 03:55:08 -06:00
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>
This commit is contained in:
parent
5e5ac81e95
commit
35770c78a2
3 changed files with 24 additions and 1 deletions
|
|
@ -54288,7 +54288,7 @@ there is no offset applied.
|
|||
The partition file system as a string, defaulting to @code{"ext4"}.
|
||||
|
||||
The supported values are @code{"btrfs"}, @code{"ext4"}, @code{"fat16"},
|
||||
@code{"fat32"}, and @code{"vfat"}.
|
||||
@code{"f2fs"}, @code{"fat32"}, @code{"vfat"}, and @code{"swap"}.
|
||||
|
||||
@code{"vfat"}, @code{"fat16"}, and @code{"fat32"} partitions without the
|
||||
@code{'esp} flag are by default LBA compatible.
|
||||
|
|
|
|||
|
|
@ -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
|
||||
|
|
|
|||
|
|
@ -403,6 +403,7 @@ used in the image."
|
|||
(file-system (partition-file-system partition)))
|
||||
(cond
|
||||
((member 'esp flags) "0xEF")
|
||||
((string=? file-system "swap") "0x82")
|
||||
((or (string=? file-system "btrfs")
|
||||
(string-prefix? "ext" file-system)
|
||||
(string=? file-system "f2fs")) "0x83")
|
||||
|
|
@ -430,6 +431,7 @@ used in the image."
|
|||
((or (string=? file-system "vfat")
|
||||
(string=? file-system "fat16")
|
||||
(string=? file-system "fat32")) "F")
|
||||
((string=? file-system "swap") "S")
|
||||
((and (string=? file-system "unformatted")
|
||||
(partition-uuid partition))
|
||||
(uuid->string (partition-uuid partition)))
|
||||
|
|
@ -464,6 +466,8 @@ used in the image."
|
|||
(list e2fsprogs fakeroot))
|
||||
((string=? type "f2fs")
|
||||
(list f2fs-tools fakeroot))
|
||||
((string=? type "swap")
|
||||
(list fakeroot util-linux))
|
||||
((or (string=? type "vfat")
|
||||
(string-prefix? "fat" type))
|
||||
(list dosfstools fakeroot mtools))
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue