From ce5d6089aff0cf6c31260ac2bbe0aeb2803eb8a0 Mon Sep 17 00:00:00 2001
From: Marius Bakke
Date: Tue, 20 Feb 2018 04:02:23 +0100
Subject: [PATCH] gnu: Pass "--target" to EFI-less GRUB only when EFI variables
are present.
Fixes .
* gnu/bootloader/grub.scm (install-grub): Make "--target" argument
conditional on the presence of "/sys/firmware/efi".
---
gnu/bootloader/grub.scm | 7 ++++++-
1 file changed, 6 insertions(+), 1 deletion(-)
diff --git a/gnu/bootloader/grub.scm b/gnu/bootloader/grub.scm
index 3b01125c7..2b8458161 100644
--- a/gnu/bootloader/grub.scm
+++ b/gnu/bootloader/grub.scm
@@ -386,8 +386,13 @@ submenu \"GNU system, old configurations...\" {~%")
;; root partition.
(setenv "GRUB_ENABLE_CRYPTODISK" "y")
- (unless (zero? (system* grub "--no-floppy" "--target=i386-pc"
+ (unless (zero? (system* grub "--no-floppy"
"--boot-directory" install-dir
+ ;; Explicitly pass target if the non-EFI
+ ;; GRUB is requested on an EFI system.
+ ;; See .
+ ,@(if (file-exists? "/sys/firmware/efi")
+ "--target=i386-pc")
device))
(error "failed to install GRUB (BIOS)")))))
--
2.16.2