summaryrefslogtreecommitdiff
path: root/gnu
diff options
context:
space:
mode:
authorMathieu Othacehe <othacehe@gnu.org>2021-04-25 19:06:31 +0200
committerMathieu Othacehe <othacehe@gnu.org>2021-04-28 15:52:20 +0200
commitc254af8c73ca0aa6e2179112cdd1ea70800fa5ea (patch)
tree8ad87ff39d509a90205202a0458e50e095c4bb79 /gnu
parent2b645e359e18742c7aed90eeb96a412ae5130a5a (diff)
installer: Add MSDOS disk label support on UEFI systems.
Fixes: <https://issues.guix.gnu.org/47889>. * gnu/installer/parted.scm (esp-partition?): Remove the MSDOS check. (auto-partition!): On MSDOS disks, check if an ESP partition is present. If that's the case, do not remove it. Otherwise, if UEFI is supported, create one.
Diffstat (limited to 'gnu')
-rw-r--r--gnu/installer/parted.scm45
1 files changed, 19 insertions, 26 deletions
diff --git a/gnu/installer/parted.scm b/gnu/installer/parted.scm
index 9ef263d1f96..6d6e500d717 100644
--- a/gnu/installer/parted.scm
+++ b/gnu/installer/parted.scm
@@ -70,6 +70,7 @@
70 small-freespace-partition? 70 small-freespace-partition?
71 esp-partition? 71 esp-partition?
72 boot-partition? 72 boot-partition?
73 efi-installation?
73 default-esp-mount-point 74 default-esp-mount-point
74 75
75 with-delay-device-in-use? 76 with-delay-device-in-use?
@@ -193,12 +194,8 @@ inferior to MAX-SIZE, #f otherwise."
193(define (esp-partition? partition) 194(define (esp-partition? partition)
194 "Return #t if partition has the ESP flag, return #f otherwise." 195 "Return #t if partition has the ESP flag, return #f otherwise."
195 (let* ((disk (partition-disk partition)) 196 (let* ((disk (partition-disk partition))
196 (disk-type (disk-disk-type disk)) 197 (disk-type (disk-disk-type disk)))
197 (has-extended? (disk-type-check-feature
198 disk-type
199 DISK-TYPE-FEATURE-EXTENDED)))
200 (and (data-partition? partition) 198 (and (data-partition? partition)
201 (not has-extended?)
202 (partition-is-flag-available? partition PARTITION-FLAG-ESP) 199 (partition-is-flag-available? partition PARTITION-FLAG-ESP)
203 (partition-get-flag partition PARTITION-FLAG-ESP)))) 200 (partition-get-flag partition PARTITION-FLAG-ESP))))
204 201
@@ -918,30 +915,26 @@ exists."
918 ;; disk space. Otherwise, set the swap size to 5% of the disk space. 915 ;; disk space. Otherwise, set the swap size to 5% of the disk space.
919 (swap-size (min default-swap-size five-percent-disk))) 916 (swap-size (min default-swap-size five-percent-disk)))
920 917
921 (if has-extended? 918 ;; Remove everything but esp if it exists.
922 ;; msdos - remove everything. 919 (for-each
923 (disk-remove-all-partitions disk) 920 (lambda (partition)
924 ;; gpt - remove everything but esp if it exists. 921 (and (data-partition? partition)
925 (for-each 922 (disk-remove-partition* disk partition)))
926 (lambda (partition) 923 non-boot-partitions)
927 (and (data-partition? partition)
928 (disk-remove-partition* disk partition)))
929 non-boot-partitions))
930 924
931 (let* ((start-partition 925 (let* ((start-partition
932 (and (not has-extended?) 926 (if (efi-installation?)
933 (if (efi-installation?) 927 (and (not esp-partition)
934 (and (not esp-partition)
935 (user-partition
936 (fs-type 'fat32)
937 (esp? #t)
938 (size new-esp-size)
939 (mount-point (default-esp-mount-point))))
940 (user-partition 928 (user-partition
941 (fs-type 'ext4) 929 (fs-type 'fat32)
942 (bootable? #t) 930 (esp? #t)
943 (bios-grub? #t) 931 (size new-esp-size)
944 (size bios-grub-size))))) 932 (mount-point (default-esp-mount-point))))
933 (user-partition
934 (fs-type 'ext4)
935 (bootable? #t)
936 (bios-grub? #t)
937 (size bios-grub-size))))
945 (new-partitions 938 (new-partitions
946 (cond 939 (cond
947 ((or (eq? scheme 'entire-root) 940 ((or (eq? scheme 'entire-root)