From dbaef95aabfd8a90f11f513b65a8ebfe8d0b93c2 Mon Sep 17 00:00:00 2001
From: Mathieu Othacehe <m.othacehe@gmail.com>
Date: Thu, 18 May 2017 12:06:36 +0200
Subject: [PATCH] bootloader: extlinux: Add extlinux-bootloader-gpt.

* gnu/bootloader/extlinux.scm (extlinux-bootloader-gpt): New exported
  variable.
 (install-extlinux)[mbr]: New argument.
 (install-extlinux-mbr, install-extlinux-gpt): New variables.
 (extlinux-bootloader)[installer]: Use install-extlinux-mbr.
---
 gnu/bootloader/extlinux.scm | 20 ++++++++++++++++----
 1 file changed, 16 insertions(+), 4 deletions(-)

diff --git a/gnu/bootloader/extlinux.scm b/gnu/bootloader/extlinux.scm
index 0a1263aed72..219b058e53e 100644
--- a/gnu/bootloader/extlinux.scm
+++ b/gnu/bootloader/extlinux.scm
@@ -25,7 +25,8 @@ (define-module (gnu bootloader extlinux)
   #:use-module (guix monads)
   #:use-module (guix records)
   #:use-module (guix utils)
-  #:export (extlinux-bootloader))
+  #:export (extlinux-bootloader
+            extlinux-bootloader-gpt))
 
 (define* (extlinux-configuration-file config entries
                                       #:key
@@ -93,7 +94,7 @@ (define dd
                       (string-append "if=" if)
                       (string-append "of=" of)))))
 
-(define install-extlinux
+(define (install-extlinux mbr)
   #~(lambda (bootloader device mount-point)
       (let ((extlinux (string-append bootloader "/sbin/extlinux"))
             (install-dir (string-append mount-point "/boot/extlinux"))
@@ -103,9 +104,15 @@ (define install-extlinux
                   (find-files syslinux-dir "\\.c32$"))
 
         (unless (and (zero? (system* extlinux "--install" install-dir))
-                     (#$dd 440 1 (string-append syslinux-dir "/mbr.bin") device))
+                     (#$dd 440 1 (string-append syslinux-dir "/" #$mbr) device))
           (error "failed to install SYSLINUX")))))
 
+(define install-extlinux-mbr
+  (install-extlinux "mbr.bin"))
+
+(define install-extlinux-gpt
+  (install-extlinux "gptmbr.bin"))
+
 
 
 ;;;
@@ -116,6 +123,11 @@ (define extlinux-bootloader
   (bootloader
    (name 'extlinux)
    (package syslinux)
-   (installer install-extlinux)
+   (installer install-extlinux-mbr)
    (configuration-file "/boot/extlinux/extlinux.conf")
    (configuration-file-generator extlinux-configuration-file)))
+
+(define extlinux-bootloader-gpt
+  (bootloader
+   (inherit extlinux-bootloader)
+   (installer install-extlinux-gpt)))
-- 
GitLab