diff --git a/src/bootloaders/bootloader.h b/src/bootloaders/bootloader.h index 00dd1e5c..63c6f725 100644 --- a/src/bootloaders/bootloader.h +++ b/src/bootloaders/bootloader.h @@ -35,12 +35,13 @@ typedef int (*boot_loader_caps)(const BootManager *); typedef enum { BOOTLOADER_CAP_MIN = 1 << 0, - BOOTLOADER_CAP_UEFI = 1 << 1, /**update_efi_vars; } +bool check_partitionless_boot(const BootManager *self, const char *boot_dir) +{ + assert(self != NULL); + return ((self->bootloader->get_capabilities(self) & BOOTLOADER_CAP_PARTLESS) + && !(self->sysconfig->wanted_boot_mask & BOOTLOADER_CAP_UEFI) + && !cbm_is_dir_empty(boot_dir)); +} + /* * Editor modelines - https://www.wireshark.org/tools/modelines.html * diff --git a/src/bootman/bootman_private.h b/src/bootman/bootman_private.h index 38df20b7..50745304 100644 --- a/src/bootman/bootman_private.h +++ b/src/bootman/bootman_private.h @@ -82,6 +82,15 @@ int kernel_compare_reverse(const void *a, const void *b); */ const char *cbm_get_fstype_name(const char *boot_device); +/** + * Check if the system supports a "partitionless" (the system has no /boot partition) boot. + * Conditions are: + * - The bootloader supports this. + * - The system is not UEFI. + * - The /boot folder is not empty. + */ +bool check_partitionless_boot(const BootManager *self, const char *boot_dir); + /* * Editor modelines - https://www.wireshark.org/tools/modelines.html *