]> git.ipfire.org Git - people/pmueller/ipfire-2.x.git/commitdiff
installer: Create a flag that marks if EFI support is available
authorMichael Tremer <michael.tremer@ipfire.org>
Sun, 17 Jun 2018 17:15:08 +0000 (18:15 +0100)
committerMichael Tremer <michael.tremer@ipfire.org>
Sat, 14 Jul 2018 12:43:53 +0000 (13:43 +0100)
Signed-off-by: Michael Tremer <michael.tremer@ipfire.org>
src/installer/hw.c
src/installer/hw.h

index edf7aeb0b93b862db77ce3c7e06cb936c0639f25..0cfeb521fcff01271d2b54e7fb0c349959d61126 100644 (file)
@@ -81,7 +81,10 @@ struct hw* hw_init() {
        // Detect if we are running in EFI mode
        ret = access("/sys/firmware/efi", R_OK);
        if (ret == 0)
-               hw->efi = 1;
+               hw->efi_supported = 1;
+
+       // Should we install in EFI mode?
+       hw->efi = 1;
 
        return hw;
 }
@@ -1063,7 +1066,8 @@ int hw_install_bootloader(struct hw* hw, struct hw_destination* dest, const char
        // Install GRUB in EFI mode
        if (hw->efi) {
                snprintf(cmd, sizeof(cmd), "/usr/sbin/grub-install"
-                       " --target=%s-efi --efi-directory=%s", hw->arch, HW_PATH_BOOT_EFI);
+                       " --target=%s-efi --efi-directory=%s %s", hw->arch, HW_PATH_BOOT_EFI,
+                       (hw->efi_supported) ? "" : "--no-nvram");
 
                r = system_chroot(output, DESTINATION_MOUNT_PATH, cmd);
                if (r)
index f446d1c433bbf87dc25ac4c56c62d7ba93f6ce04..4e0afc431443df5c735b46224824de069d1dbaf7 100644 (file)
 struct hw {
        struct udev *udev;
        char arch[STRING_SIZE];
+
+       // Enabled if we should install in EFI mode
        int efi;
+
+       // Enabled if this system supports EFI
+       int efi_supported;
 };
 
 struct hw_disk {