unofficial mirror of guix-patches@gnu.org 
 help / color / mirror / code / Atom feed
* [bug#66448] [PATCH] image: Add 'lba partition label.
@ 2023-10-10 16:29 Gabriel Wicki
  2023-10-11  8:51 ` Mathieu Othacehe
  0 siblings, 1 reply; 6+ messages in thread
From: Gabriel Wicki @ 2023-10-10 16:29 UTC (permalink / raw)
  To: 66448

Some (embedded) system create FAT32/LBA partitions first, i thought this
is too easy to not include in Guix.

Please let me know if I can improve anything!

TIA for review and merge


From c5080162e8a77f60aaf9a967a896f57c113dde47 Mon Sep 17 00:00:00 2001
Message-ID: <c5080162e8a77f60aaf9a967a896f57c113dde47.1696954175.git.gabriel@erlikon.ch>
From: Gabriel Wicki <gabriel@erlikon.ch>
Date: Tue, 10 Oct 2023 18:02:04 +0200
Subject: [PATCH] image: Add 'lba partition label.

* gnu/image.scm (validate-partition-flags): Add lba to the valid flags.
* doc/guix.texi ('partition' Reference): Document it.
---
 doc/guix.texi | 10 ++++++----
 gnu/image.scm |  2 +-
 2 files changed, 7 insertions(+), 5 deletions(-)

diff --git a/doc/guix.texi b/doc/guix.texi
index ad26a29513..95aae6ac02 100644
--- a/doc/guix.texi
+++ b/doc/guix.texi
@@ -45590,10 +45590,12 @@ partition Reference
 
 @item @code{flags} (default: @code{'()})
 The partition flags as a list of symbols.  Possible values are
-@code{'boot} and @code{'esp}.  The @code{'boot} flags should be set if
-you want to boot from this partition.  Exactly one partition should have
-this flag set, usually the root one. The @code{'esp} flag identifies a
-UEFI System Partition.
+@code{'boot}, @code{'esp} and @code{'lba}.  The @code{'boot} flags
+should be set if you want to boot from this partition.  Exactly one
+partition should have this flag set, usually the root one. The
+@code{'esp} flag identifies a UEFI System Partition.  The @code{'lba}
+flag @acronym{LBA, Local Block Addressing} allows for bigger FAT
+partitions than 8GiB.
 
 @item @code{initializer} (default: @code{#false})
 The partition initializer procedure as a gexp.  This procedure is called
diff --git a/gnu/image.scm b/gnu/image.scm
index 523653dd77..493aea94cd 100644
--- a/gnu/image.scm
+++ b/gnu/image.scm
@@ -100,7 +100,7 @@ (define-with-syntax-properties (validate-partition-offset (value properties))
 
 ;; The supported partition flags.
 (define-with-syntax-properties (validate-partition-flags (value properties))
-  (let ((bad-flags (lset-difference eq? value '(boot esp))))
+  (let ((bad-flags (lset-difference eq? value '(boot esp lba))))
     (unless (and (list? value) (null? bad-flags))
       (raise
        (make-compound-condition

base-commit: f4e8baf3806e79d7111d2943859865ae4ee0b59d
-- 
2.41.0




^ permalink raw reply related	[flat|nested] 6+ messages in thread

* [bug#66448] [PATCH] image: Add 'lba partition label.
  2023-10-10 16:29 [bug#66448] [PATCH] image: Add 'lba partition label Gabriel Wicki
@ 2023-10-11  8:51 ` Mathieu Othacehe
  2023-10-11  8:55   ` Gabriel Wicki
  0 siblings, 1 reply; 6+ messages in thread
From: Mathieu Othacehe @ 2023-10-11  8:51 UTC (permalink / raw)
  To: Gabriel Wicki; +Cc: 66448


Hello,

> +  (let ((bad-flags (lset-difference eq? value '(boot esp lba))))

I may be missing something, but don't we need something in
make-vfat-image of (gnu build image) to take that one into account?

Thanks,

Mathieu




^ permalink raw reply	[flat|nested] 6+ messages in thread

* [bug#66448] [PATCH] image: Add 'lba partition label.
  2023-10-11  8:51 ` Mathieu Othacehe
@ 2023-10-11  8:55   ` Gabriel Wicki
  2023-10-13 13:02     ` Mathieu Othacehe
  0 siblings, 1 reply; 6+ messages in thread
From: Gabriel Wicki @ 2023-10-11  8:55 UTC (permalink / raw)
  To: Mathieu Othacehe; +Cc: 66448

I didn't follow the whole source tree to figure out how all of this
works, but this tiny change makes the image partition show up as LBA.




^ permalink raw reply	[flat|nested] 6+ messages in thread

* [bug#66448] [PATCH] image: Add 'lba partition label.
  2023-10-11  8:55   ` Gabriel Wicki
@ 2023-10-13 13:02     ` Mathieu Othacehe
  2023-10-17 12:27       ` Gabriel Wicki
  0 siblings, 1 reply; 6+ messages in thread
From: Mathieu Othacehe @ 2023-10-13 13:02 UTC (permalink / raw)
  To: Gabriel Wicki; +Cc: 66448


Hello,

> I didn't follow the whole source tree to figure out how all of this
> works, but this tiny change makes the image partition show up as LBA.

I had a closer look, this flag has no effect at all. If the 'esp flag is
set then the MBR partition type is set to 0xEF (EFI partition). If the
flag is removed, then depending on the file-system type: "fat16"
or "fat32", the partition type will be 0x0E or 0x0C which are
respectively FAT16 with LBA an FAT32 with LBA.

I guess that by removing the 'esp flag and adding the 'lba flag you
ended up with an LBA partition. That was the consequence of removing the
'esp flag, not adding the 'lba flag.

The partition type is specified in the partition->dos-type procedure of
(gnu system image). The corresponding types can be found here:
https://en.wikipedia.org/wiki/Partition_type.

We could improve the documentation here by stating that fat16 and fat32
partitions are by default LBA compatible, but the source modification in
not needed.

Thanks,

Mathieu




^ permalink raw reply	[flat|nested] 6+ messages in thread

* [bug#66448] [PATCH] image: Add 'lba partition label.
  2023-10-13 13:02     ` Mathieu Othacehe
@ 2023-10-17 12:27       ` Gabriel Wicki
  2023-10-17 13:12         ` bug#66448: " Mathieu Othacehe
  0 siblings, 1 reply; 6+ messages in thread
From: Gabriel Wicki @ 2023-10-17 12:27 UTC (permalink / raw)
  To: Mathieu Othacehe; +Cc: 66448

Hello Mathieu

Thanks for looking into it.  And yes, that was exactly what happened.
Plus i was tricked by my own setup (for once showing the LBA label and
another time not).  Oh well (:

I've attached a possible patch for the documentation.

Thanks again for the review and the clarification of the issue.

Best regards



From eacb1696cdc51350e3d5d223b94a2546c459d2ea Mon Sep 17 00:00:00 2001
Message-ID: <eacb1696cdc51350e3d5d223b94a2546c459d2ea.1697545310.git.gabriel@erlikon.ch>
From: Gabriel Wicki <gabriel@erlikon.ch>
Date: Tue, 17 Oct 2023 14:16:51 +0200
Subject: [PATCH] doc: Clarify partition LBA compatibility.

* doc/guix.texi (partition Reference): Clarify LBA compatibility.
---
 doc/guix.texi | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/doc/guix.texi b/doc/guix.texi
index 3517c95251..6b6d166290 100644
--- a/doc/guix.texi
+++ b/doc/guix.texi
@@ -45649,7 +45649,8 @@ partition Reference
 @item @code{file-system} (default: @code{"ext4"})
 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{"ext4"}.  @code{"vfat"}, @code{"fat16"} and @code{"fat32"}
+partitions without the @code{'esp} flag are by default LBA compatible.
 
 @item @code{file-system-options} (default: @code{'()})
 The partition file system creation options that should be passed to the

base-commit: d389f6777359aa44ef9c71989fc1f49e6b222f1d
-- 
2.41.0





^ permalink raw reply related	[flat|nested] 6+ messages in thread

* bug#66448: [PATCH] image: Add 'lba partition label.
  2023-10-17 12:27       ` Gabriel Wicki
@ 2023-10-17 13:12         ` Mathieu Othacehe
  0 siblings, 0 replies; 6+ messages in thread
From: Mathieu Othacehe @ 2023-10-17 13:12 UTC (permalink / raw)
  To: Gabriel Wicki; +Cc: 66448-done


Hello,

> I've attached a possible patch for the documentation.

Perfect. Applied!

Thanks,

Mathieu




^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2023-10-17 13:14 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2023-10-10 16:29 [bug#66448] [PATCH] image: Add 'lba partition label Gabriel Wicki
2023-10-11  8:51 ` Mathieu Othacehe
2023-10-11  8:55   ` Gabriel Wicki
2023-10-13 13:02     ` Mathieu Othacehe
2023-10-17 12:27       ` Gabriel Wicki
2023-10-17 13:12         ` bug#66448: " Mathieu Othacehe

Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/guix.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).