GNU bug report logs -
#73612
[PATCH 0/2] Add btrfs support and vfat file system options
Previous Next
To add a comment to this bug, you must first unarchive it, by sending
a message to control AT debbugs.gnu.org, with unarchive 73612 in the body.
You can then email your comments to 73612 AT debbugs.gnu.org in the normal way.
Toggle the display of automated, internal messages from the tracker.
Report forwarded
to
pelzflorian <at> pelzflorian.de, ludo <at> gnu.org, maxim.cournoyer <at> gmail.com, guix-patches <at> gnu.org
:
bug#73612
; Package
guix-patches
.
(Thu, 03 Oct 2024 12:12:02 GMT)
Full text and
rfc822 format available.
Acknowledgement sent
to
Roman Scherer <roman <at> burningswell.com>
:
New bug report received and forwarded. Copy sent to
pelzflorian <at> pelzflorian.de, ludo <at> gnu.org, maxim.cournoyer <at> gmail.com, guix-patches <at> gnu.org
.
(Thu, 03 Oct 2024 12:12:02 GMT)
Full text and
rfc822 format available.
Message #5 received at submit <at> debbugs.gnu.org (full text, mbox):
Hello Guix,
I'm building a disk image for the Asahi Linux installer using Guix.
The Asahi Linux installer has 2 requirements for its disk image:
- It needs a btrfs root partition, so the installer can resize it.
- The block sizes of the vfat and btrfs filesystems need to be 4k.
To create this image, I created my own image type like this:
```
(define asahi-efi-partition
(partition
(size (* 500 (expt 2 20)))
(offset root-offset)
(label "EFI")
(file-system "vfat")
(file-system-options (list "-S" "4096"))
(flags '(esp))
(initializer (with-extensions (list guile-zlib)
(with-imported-modules (source-module-closure
'((asahi guix build bootloader m1n1))
#:select? import-asahi-module?)
#~(lambda* (root . args)
(use-modules (asahi guix build bootloader m1n1))
(apply m1n1-initialize-efi-partition root args)))))))
(define asahi-root-partition
(partition
(size 'guess)
(label root-label)
(file-system "btrfs")
(file-system-options (list "-s" "4096"))
(flags '(boot))
(uuid "fef23143-fe46-4f7f-bbb9-efc46a2a5e48")
(initializer (gexp initialize-root-partition))))
```
Unfortuanatly Guix does not support setting file system options for vfat
partitions, nor btrfs as the root file system of an image. The following 2
patches add support for this.
The first one adds support for file-system-options on vfat file systems. The
code works the same as before, defaulting to 512 block size if no -S option is
provided and the file system is an EFI partition, otherwise it uses the user
provided block size.
The 2nd patch adds support for btrfs to Guix disk images.
With those 2 patches I was able to build a disk image that is compatible with
the Asahi Linux installer. I tested the code by building this image, putting
it on a web server, and then using it with the Asahi Linux installer to
install a Guix system.
Could you please review the patch series and help me to get this into Guix?
Thanks, Roman.
Roman Scherer (2):
image: Use file system options in make-vfat-image.
image: Add support for btrfs.
doc/guix.texi | 5 +++--
gnu/build/image.scm | 43 +++++++++++++++++++++++++++++++++----------
gnu/system/image.scm | 8 ++++++--
3 files changed, 42 insertions(+), 14 deletions(-)
base-commit: b522b468cbefcae6170e260ffadadb57f6f5ca54
--
2.46.0
Information forwarded
to
pelzflorian <at> pelzflorian.de, ludo <at> gnu.org, maxim.cournoyer <at> gmail.com, guix-patches <at> gnu.org
:
bug#73612
; Package
guix-patches
.
(Thu, 03 Oct 2024 12:15:02 GMT)
Full text and
rfc822 format available.
Message #8 received at 73612 <at> debbugs.gnu.org (full text, mbox):
* gnu/build/image.scm (make-btrfs-image): New variable.
* gnu/system/image.scm (system-disk-image): Support btrfs.
Change-Id: I80a5b52ec478ce5927d6208e324cbb70282c647a
---
doc/guix.texi | 2 +-
gnu/build/image.scm | 19 +++++++++++++++++++
gnu/system/image.scm | 8 ++++++--
3 files changed, 26 insertions(+), 3 deletions(-)
diff --git a/doc/guix.texi b/doc/guix.texi
index 87904761f0..34970fa398 100644
--- a/doc/guix.texi
+++ b/doc/guix.texi
@@ -47910,7 +47910,7 @@ partition Reference
The partition file system as a string, defaulting to @code{"ext4"}.
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{'esp} flag are by default LBA compatible.
diff --git a/gnu/build/image.scm b/gnu/build/image.scm
index 50518585f8..2332b72b17 100644
--- a/gnu/build/image.scm
+++ b/gnu/build/image.scm
@@ -73,6 +73,23 @@ (define (estimate-partition-size root)
(max (ash 1 20)
(* 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
#:key
(owner-uid 0)
@@ -141,6 +158,8 @@ (define* (make-partition-image partition-sexp target root)
(let* ((partition (sexp->partition partition-sexp))
(type (partition-file-system partition)))
(cond
+ ((string=? "btrfs" type)
+ (make-btrfs-image partition target root))
((string-prefix? "ext" type)
(make-ext-image partition target root))
((or (string=? type "vfat") (string=? type "fat16"))
diff --git a/gnu/system/image.scm b/gnu/system/image.scm
index b0c96c60f0..af0f3eb354 100644
--- a/gnu/system/image.scm
+++ b/gnu/system/image.scm
@@ -402,7 +402,8 @@ (define* (system-disk-image image
(file-system (partition-file-system partition)))
(cond
((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")
(string=? file-system "fat16")) "0x0E")
((string=? file-system "fat32") "0x0C")
@@ -421,7 +422,8 @@ (define* (system-disk-image image
(file-system (partition-file-system partition)))
(cond
((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")
(string=? file-system "fat16")
(string=? file-system "fat32")) "F")
@@ -453,6 +455,8 @@ (define* (system-disk-image image
(let ((initializer (or #$(partition-initializer partition)
initialize-root-partition))
(inputs '#+(cond
+ ((string=? type "btrfs")
+ (list btrfs-progs fakeroot))
((string-prefix? "ext" type)
(list e2fsprogs fakeroot))
((or (string=? type "vfat")
--
2.46.0
Information forwarded
to
pelzflorian <at> pelzflorian.de, ludo <at> gnu.org, maxim.cournoyer <at> gmail.com, guix-patches <at> gnu.org
:
bug#73612
; Package
guix-patches
.
(Thu, 03 Oct 2024 12:15:03 GMT)
Full text and
rfc822 format available.
Message #11 received at 73612 <at> debbugs.gnu.org (full text, mbox):
* gnu/build/image.scm (make-vfat-image): Use file system options.
Change-Id: I791aadd2803d1ef96fc79cf8910a74a0083d2b6e
---
doc/guix.texi | 3 ++-
gnu/build/image.scm | 24 ++++++++++++++----------
2 files changed, 16 insertions(+), 11 deletions(-)
diff --git a/doc/guix.texi b/doc/guix.texi
index 52e36e4354..87904761f0 100644
--- a/doc/guix.texi
+++ b/doc/guix.texi
@@ -47918,7 +47918,8 @@ partition Reference
@item @code{file-system-options} (default: @code{'()})
The partition file system creation options that should be passed to the
partition creation tool, as a list of strings. This is only supported
-when creating @code{"ext4"} partitions.
+when creating @code{"vfat"}, @code{"fat16"}, @code{"fat32"} or
+@code{"ext4"} partitions.
See the @code{"extended-options"} man page section of the
@code{"mke2fs"} tool for a more complete reference.
diff --git a/gnu/build/image.scm b/gnu/build/image.scm
index 6ca0a428e0..50518585f8 100644
--- a/gnu/build/image.scm
+++ b/gnu/build/image.scm
@@ -105,17 +105,21 @@ (define* (make-vfat-image partition target root fs-bits)
"Handle the creation of VFAT partition images. See 'make-partition-image'."
(let ((size (partition-size partition))
(label (partition-label partition))
- (flags (partition-flags partition)))
+ (flags (partition-flags partition))
+ (fs-options (partition-file-system-options partition)))
(apply invoke "fakeroot" "mkdosfs" "-n" label "-C" target
- "-F" (number->string fs-bits)
- (size-in-kib
- (if (eq? size 'guess)
- (estimate-partition-size root)
- size))
- ;; u-boot in particular needs the formatted block
- ;; size and the physical block size to be equal.
- ;; TODO: What about 4k blocks?
- (if (member 'esp flags) (list "-S" "512") '()))
+ "-F" (number->string fs-bits)
+ (size-in-kib
+ (if (eq? size 'guess)
+ (estimate-partition-size root)
+ size))
+ ;; u-boot in particular needs the formatted block
+ ;; size and the physical block size to be equal.
+ ;; TODO: What about 4k blocks?
+ (if (and (member 'esp flags)
+ (not (member "-S" fs-options)))
+ (append (list "-S" "512") fs-options)
+ fs-options))
(for-each (lambda (file)
(unless (member file '("." ".."))
(invoke "mcopy" "-bsp" "-i" target
--
2.46.0
Reply sent
to
Ludovic Courtès <ludo <at> gnu.org>
:
You have taken responsibility.
(Mon, 14 Oct 2024 11:31:02 GMT)
Full text and
rfc822 format available.
Notification sent
to
Roman Scherer <roman <at> burningswell.com>
:
bug acknowledged by developer.
(Mon, 14 Oct 2024 11:31:02 GMT)
Full text and
rfc822 format available.
Message #16 received at 73612-done <at> debbugs.gnu.org (full text, mbox):
Hi,
Roman Scherer <roman <at> burningswell.com> skribis:
> The first one adds support for file-system-options on vfat file systems. The
> code works the same as before, defaulting to 512 block size if no -S option is
> provided and the file system is an EFI partition, otherwise it uses the user
> provided block size.
>
> The 2nd patch adds support for btrfs to Guix disk images.
>
> With those 2 patches I was able to build a disk image that is compatible with
> the Asahi Linux installer. I tested the code by building this image, putting
> it on a web server, and then using it with the Asahi Linux installer to
> install a Guix system.
>
> Could you please review the patch series and help me to get this into Guix?
>
> Thanks, Roman.
>
> Roman Scherer (2):
> image: Use file system options in make-vfat-image.
> image: Add support for btrfs.
Both look good to me. Applied, thanks!
Ludo’.
bug archived.
Request was from
Debbugs Internal Request <help-debbugs <at> gnu.org>
to
internal_control <at> debbugs.gnu.org
.
(Mon, 11 Nov 2024 12:24:06 GMT)
Full text and
rfc822 format available.
This bug report was last modified 214 days ago.
Previous Next
GNU bug tracking system
Copyright (C) 1999 Darren O. Benham,
1997,2003 nCipher Corporation Ltd,
1994-97 Ian Jackson.