From 27ef66cf4b183ed50f74b4e2dfc84fd33c38e737 Mon Sep 17 00:00:00 2001 From: Vishal Rao Date: Sat, 12 Sep 2020 13:30:05 +0530 Subject: [PATCH 1/4] Reduce required ESP partition size to just under 100 MiB --- src/Views/PartitioningView.vala | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Views/PartitioningView.vala b/src/Views/PartitioningView.vala index 48d7a58e5..cfacdfe5c 100644 --- a/src/Views/PartitioningView.vala +++ b/src/Views/PartitioningView.vala @@ -44,7 +44,7 @@ public class Installer.PartitioningView : AbstractInstallerView { EFI } - const uint64 REQUIRED_EFI_SECTORS = 524288; + const uint64 REQUIRED_EFI_SECTORS = 200000; construct { mounts = new Gee.ArrayList (); From 25389d8ab0cc99274cd6ec2ff2ff97c74d5fa193 Mon Sep 17 00:00:00 2001 From: Vishal Rao Date: Sat, 12 Sep 2020 14:59:37 +0530 Subject: [PATCH 2/4] Consider sector size for ESP minimum requirement --- src/Objects/Mount.vala | 4 +++- src/Views/PartitioningView.vala | 4 ++-- src/Widgets/PartitionBar.vala | 2 ++ src/Widgets/PartitionMenu.vala | 1 + 4 files changed, 8 insertions(+), 3 deletions(-) diff --git a/src/Objects/Mount.vala b/src/Objects/Mount.vala index 8e58374be..8edfd5105 100644 --- a/src/Objects/Mount.vala +++ b/src/Objects/Mount.vala @@ -23,6 +23,7 @@ public class Installer.Mount { public string parent_disk; public string mount_point; public uint64 sectors; + public uint64 sector_size; public Distinst.FileSystem filesystem; public Flags flags; public PartitionMenu menu; @@ -35,7 +36,7 @@ public class Installer.Mount { } public Mount (string partition, string parent_disk, string mount, - uint64 sectors, Flags flags, Distinst.FileSystem fs, + uint64 sectors, uint64 sector_size, Flags flags, Distinst.FileSystem fs, PartitionMenu menu) { filesystem = fs; mount_point = mount; @@ -44,6 +45,7 @@ public class Installer.Mount { this.menu = menu; this.parent_disk = parent_disk; this.sectors = sectors; + this.sector_size = sector_size; } public bool is_valid_boot_mount () { diff --git a/src/Views/PartitioningView.vala b/src/Views/PartitioningView.vala index cfacdfe5c..dc65f27d8 100644 --- a/src/Views/PartitioningView.vala +++ b/src/Views/PartitioningView.vala @@ -44,7 +44,7 @@ public class Installer.PartitioningView : AbstractInstallerView { EFI } - const uint64 REQUIRED_EFI_SECTORS = 200000; + const uint64 REQUIRED_EFI_SIZE = 98 * 1024 * 1024; construct { mounts = new Gee.ArrayList (); @@ -274,7 +274,7 @@ public class Installer.PartitioningView : AbstractInstallerView { if (mount.mount_point == "/boot/efi") { if (!mount.is_valid_boot_mount ()) { throw new GLib.IOError.FAILED (_("EFI partition has the wrong file system")); - } else if (mount.sectors < REQUIRED_EFI_SECTORS) { + } else if ((mount.sectors * mount.sector_size) < REQUIRED_EFI_SIZE) { throw new GLib.IOError.FAILED (_("EFI partition is too small")); } } else if (mount.mount_point == "/" && !mount.is_valid_root_mount ()) { diff --git a/src/Widgets/PartitionBar.vala b/src/Widgets/PartitionBar.vala index 84a6b8aa7..bfe907a78 100644 --- a/src/Widgets/PartitionBar.vala +++ b/src/Widgets/PartitionBar.vala @@ -24,6 +24,7 @@ public class Installer.PartitionBar : Gtk.EventBox { public uint64 start; public uint64 end; public uint64 used; + public uint64 sector_size; public new string path; public string? vg; @@ -38,6 +39,7 @@ public class Installer.PartitionBar : Gtk.EventBox { DecryptFn decrypt) { start = part->get_start_sector (); end = part->get_end_sector (); + this.sector_size = sector_size; var usage = part->sectors_used (sector_size); if (usage.tag == 1) { diff --git a/src/Widgets/PartitionMenu.vala b/src/Widgets/PartitionMenu.vala index b34bf8bf1..630e94964 100644 --- a/src/Widgets/PartitionMenu.vala +++ b/src/Widgets/PartitionMenu.vala @@ -287,6 +287,7 @@ public class Installer.PartitionMenu : Gtk.Popover { parent_disk, mount, partition_bar.end - partition_bar.start, + partition_bar.sector_size, (format_partition.active ? Mount.Flags.FORMAT : 0) + (is_lvm ? Mount.Flags.LVM : 0), filesystem, From 6f2ddf1ffa8efb9b9f61d6abb71b8bf9ada85a09 Mon Sep 17 00:00:00 2001 From: Vishal Rao Date: Sat, 12 Dec 2020 22:59:20 +0530 Subject: [PATCH 3/4] Tweak code constants --- src/Views/PartitioningView.vala | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/Views/PartitioningView.vala b/src/Views/PartitioningView.vala index dc65f27d8..22e7effab 100644 --- a/src/Views/PartitioningView.vala +++ b/src/Views/PartitioningView.vala @@ -44,7 +44,8 @@ public class Installer.PartitioningView : AbstractInstallerView { EFI } - const uint64 REQUIRED_EFI_SIZE = 98 * 1024 * 1024; + const uint64 ONE_MB = 1000 * 1000; + const uint64 MINIMUM_EFI_SIZE = 98 * ONE_MB; construct { mounts = new Gee.ArrayList (); @@ -274,7 +275,7 @@ public class Installer.PartitioningView : AbstractInstallerView { if (mount.mount_point == "/boot/efi") { if (!mount.is_valid_boot_mount ()) { throw new GLib.IOError.FAILED (_("EFI partition has the wrong file system")); - } else if ((mount.sectors * mount.sector_size) < REQUIRED_EFI_SIZE) { + } else if ((mount.sectors * mount.sector_size) < MINIMUM_EFI_SIZE) { throw new GLib.IOError.FAILED (_("EFI partition is too small")); } } else if (mount.mount_point == "/" && !mount.is_valid_root_mount ()) { From 53bebb96a33e788cc9af050d49b6ce26ec52ee7f Mon Sep 17 00:00:00 2001 From: Vishal Rao Date: Sat, 12 Dec 2020 23:07:38 +0530 Subject: [PATCH 4/4] Name the variable ESP aka EFI System Partition instead of just EFI --- src/Views/PartitioningView.vala | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/Views/PartitioningView.vala b/src/Views/PartitioningView.vala index 22e7effab..d7ac25184 100644 --- a/src/Views/PartitioningView.vala +++ b/src/Views/PartitioningView.vala @@ -45,7 +45,7 @@ public class Installer.PartitioningView : AbstractInstallerView { } const uint64 ONE_MB = 1000 * 1000; - const uint64 MINIMUM_EFI_SIZE = 98 * ONE_MB; + const uint64 MINIMUM_ESP_SIZE = 98 * ONE_MB; construct { mounts = new Gee.ArrayList (); @@ -275,7 +275,7 @@ public class Installer.PartitioningView : AbstractInstallerView { if (mount.mount_point == "/boot/efi") { if (!mount.is_valid_boot_mount ()) { throw new GLib.IOError.FAILED (_("EFI partition has the wrong file system")); - } else if ((mount.sectors * mount.sector_size) < MINIMUM_EFI_SIZE) { + } else if ((mount.sectors * mount.sector_size) < MINIMUM_ESP_SIZE) { throw new GLib.IOError.FAILED (_("EFI partition is too small")); } } else if (mount.mount_point == "/" && !mount.is_valid_root_mount ()) {