mirror of
https://codeberg.org/guix/guix.git
synced 2025-10-02 02:15:12 +00:00
image: Add support for btrfs.
* gnu/build/image.scm (make-btrfs-image): New variable. * gnu/system/image.scm (system-disk-image): Support btrfs. Change-Id: I80a5b52ec478ce5927d6208e324cbb70282c647a Signed-off-by: Ludovic Courtès <ludo@gnu.org>
This commit is contained in:
parent
727a72c5e2
commit
886b410e6f
3 changed files with 26 additions and 3 deletions
|
@ -48340,7 +48340,7 @@ there is no offset applied.
|
||||||
The partition file system as a string, defaulting to @code{"ext4"}.
|
The partition file system as a string, defaulting to @code{"ext4"}.
|
||||||
|
|
||||||
The supported values are @code{"vfat"}, @code{"fat16"}, @code{"fat32"},
|
The supported values are @code{"vfat"}, @code{"fat16"}, @code{"fat32"},
|
||||||
and @code{"ext4"}.
|
@code{"btrfs"}, and @code{"ext4"}.
|
||||||
|
|
||||||
@code{"vfat"}, @code{"fat16"}, and @code{"fat32"} partitions without the
|
@code{"vfat"}, @code{"fat16"}, and @code{"fat32"} partitions without the
|
||||||
@code{'esp} flag are by default LBA compatible.
|
@code{'esp} flag are by default LBA compatible.
|
||||||
|
|
|
@ -73,6 +73,23 @@ turn doesn't take any constant overhead into account, force a 1-MiB minimum."
|
||||||
(max (ash 1 20)
|
(max (ash 1 20)
|
||||||
(* 1.25 (file-size root))))
|
(* 1.25 (file-size root))))
|
||||||
|
|
||||||
|
(define* (make-btrfs-image partition target root)
|
||||||
|
"Handle the creation of BTRFS partition images. See
|
||||||
|
'make-partition-image'."
|
||||||
|
(let ((size (partition-size partition))
|
||||||
|
(fs-options (partition-file-system-options partition))
|
||||||
|
(label (partition-label partition))
|
||||||
|
(uuid (partition-uuid partition)))
|
||||||
|
(apply invoke
|
||||||
|
`("fakeroot" "mkfs.btrfs" "-r" ,root
|
||||||
|
"-L" ,label
|
||||||
|
,@(if uuid
|
||||||
|
`("-U" ,(uuid->string uuid))
|
||||||
|
'())
|
||||||
|
"--shrink"
|
||||||
|
,@fs-options
|
||||||
|
,target))))
|
||||||
|
|
||||||
(define* (make-ext-image partition target root
|
(define* (make-ext-image partition target root
|
||||||
#:key
|
#:key
|
||||||
(owner-uid 0)
|
(owner-uid 0)
|
||||||
|
@ -141,6 +158,8 @@ ROOT directory to populate the image."
|
||||||
(let* ((partition (sexp->partition partition-sexp))
|
(let* ((partition (sexp->partition partition-sexp))
|
||||||
(type (partition-file-system partition)))
|
(type (partition-file-system partition)))
|
||||||
(cond
|
(cond
|
||||||
|
((string=? "btrfs" type)
|
||||||
|
(make-btrfs-image partition target root))
|
||||||
((string-prefix? "ext" type)
|
((string-prefix? "ext" type)
|
||||||
(make-ext-image partition target root))
|
(make-ext-image partition target root))
|
||||||
((or (string=? type "vfat") (string=? type "fat16"))
|
((or (string=? type "vfat") (string=? type "fat16"))
|
||||||
|
|
|
@ -402,7 +402,8 @@ used in the image."
|
||||||
(file-system (partition-file-system partition)))
|
(file-system (partition-file-system partition)))
|
||||||
(cond
|
(cond
|
||||||
((member 'esp flags) "0xEF")
|
((member 'esp flags) "0xEF")
|
||||||
((string-prefix? "ext" file-system) "0x83")
|
((or (string=? file-system "btrfs")
|
||||||
|
(string-prefix? "ext" file-system)) "0x83")
|
||||||
((or (string=? file-system "vfat")
|
((or (string=? file-system "vfat")
|
||||||
(string=? file-system "fat16")) "0x0E")
|
(string=? file-system "fat16")) "0x0E")
|
||||||
((string=? file-system "fat32") "0x0C")
|
((string=? file-system "fat32") "0x0C")
|
||||||
|
@ -421,7 +422,8 @@ used in the image."
|
||||||
(file-system (partition-file-system partition)))
|
(file-system (partition-file-system partition)))
|
||||||
(cond
|
(cond
|
||||||
((member 'esp flags) "U")
|
((member 'esp flags) "U")
|
||||||
((string-prefix? "ext" file-system) "L")
|
((or (string=? file-system "btrfs")
|
||||||
|
(string-prefix? "ext" file-system)) "L")
|
||||||
((or (string=? file-system "vfat")
|
((or (string=? file-system "vfat")
|
||||||
(string=? file-system "fat16")
|
(string=? file-system "fat16")
|
||||||
(string=? file-system "fat32")) "F")
|
(string=? file-system "fat32")) "F")
|
||||||
|
@ -453,6 +455,8 @@ used in the image."
|
||||||
(let ((initializer (or #$(partition-initializer partition)
|
(let ((initializer (or #$(partition-initializer partition)
|
||||||
initialize-root-partition))
|
initialize-root-partition))
|
||||||
(inputs '#+(cond
|
(inputs '#+(cond
|
||||||
|
((string=? type "btrfs")
|
||||||
|
(list btrfs-progs fakeroot))
|
||||||
((string-prefix? "ext" type)
|
((string-prefix? "ext" type)
|
||||||
(list e2fsprogs fakeroot))
|
(list e2fsprogs fakeroot))
|
||||||
((or (string=? type "vfat")
|
((or (string=? type "vfat")
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue