From 968ccb27e40ce683ec469f3ac7973827a7e8ddf5 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 | 12 +++++++++---
1 file changed, 9 insertions(+), 3 deletions(-)
diff --git a/gnu/bootloader/grub.scm b/gnu/bootloader/grub.scm
index 3b01125c7..17ded5f6d 100644
--- a/gnu/bootloader/grub.scm
+++ b/gnu/bootloader/grub.scm
@@ -386,9 +386,15 @@ submenu \"GNU system, old configurations...\" {~%")
;; root partition.
(setenv "GRUB_ENABLE_CRYPTODISK" "y")
- (unless (zero? (system* grub "--no-floppy" "--target=i386-pc"
- "--boot-directory" install-dir
- device))
+ (unless (zero? (apply system* grub
+ (list "--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)")))))
(define install-grub-efi
--
2.16.2