Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Consider sector size for ESP and reduce minimum size required #449

Closed
wants to merge 14 commits into from
Closed
4 changes: 3 additions & 1 deletion src/Objects/Mount.vala
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -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;
Expand All @@ -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 () {
Expand Down
5 changes: 3 additions & 2 deletions src/Views/PartitioningView.vala
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,8 @@ public class Installer.PartitioningView : AbstractInstallerView {
EFI
}

const uint64 REQUIRED_EFI_SECTORS = 524288;
const uint64 ONE_MB = 1000 * 1000;
const uint64 MINIMUM_ESP_SIZE = 98 * ONE_MB;

construct {
mounts = new Gee.ArrayList<Installer.Mount> ();
Expand Down Expand Up @@ -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 < REQUIRED_EFI_SECTORS) {
} 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 ()) {
Expand Down
2 changes: 2 additions & 0 deletions src/Widgets/PartitionBar.vala
Original file line number Diff line number Diff line change
Expand Up @@ -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;

Expand All @@ -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) {
Expand Down
1 change: 1 addition & 0 deletions src/Widgets/PartitionMenu.vala
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down