From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:44142) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1cufxH-0002UB-On for guix-patches@gnu.org; Sun, 02 Apr 2017 09:54:11 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1cufxG-0000UF-I4 for guix-patches@gnu.org; Sun, 02 Apr 2017 09:54:07 -0400 Received: from debbugs.gnu.org ([208.118.235.43]:58374) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1cufxG-0000Ty-EO for guix-patches@gnu.org; Sun, 02 Apr 2017 09:54:06 -0400 Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1cufxG-0000cD-7d for guix-patches@gnu.org; Sun, 02 Apr 2017 09:54:06 -0400 Subject: bug#26339: [PATCH 11/18] bootloader: Add device and type to bootloader-configuration record. Resent-Message-ID: From: Mathieu Othacehe Date: Sun, 2 Apr 2017 15:52:35 +0200 Message-Id: <20170402135242.2958-11-m.othacehe@gmail.com> In-Reply-To: <20170402135242.2958-1-m.othacehe@gmail.com> References: <20170402135242.2958-1-m.othacehe@gmail.com> List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: guix-patches-bounces+kyle=kyleam.com@gnu.org Sender: "Guix-patches" To: 26339@debbugs.gnu.org * gnu/system.scm ()[device, type]: New fields. (boot-parameters-boot-device): New exported procedure. (boot-parameters-boot-type): Ditto. (operating-system-grub.cfg): Add new fields. (operating-system-parameters-file): Add new fields and replace GRUB by bootloader in doctype. (read-boot-parameters): Ditto. * gnu/system/bootloader.scm (extlinux-configuration-file): Adapt matching to new fields. --- gnu/system.scm | 29 ++++++++++++++++++++++++++++- gnu/system/bootloader.scm | 2 +- 2 files changed, 29 insertions(+), 2 deletions(-) diff --git a/gnu/system.scm b/gnu/system.scm index 6c41fe814..9775e5be8 100644 --- a/gnu/system.scm +++ b/gnu/system.scm @@ -105,6 +105,8 @@ boot-parameters? boot-parameters-label boot-parameters-root-device + boot-parameters-boot-device + boot-parameters-boot-type boot-parameters-store-device boot-parameters-store-mount-point boot-parameters-kernel @@ -736,8 +738,12 @@ populate the \"old entries\" menu." (mlet* %store-monad ((system (operating-system-derivation os)) (root-fs -> (operating-system-root-file-system os)) + (boot-device -> (bootloader-configuration-device + (operating-system-bootloader os))) (store-fs -> (operating-system-store-file-system os)) (label -> (kernel->boot-label (operating-system-kernel os))) + (boot-type -> (bootloader-configuration-type + (operating-system-bootloader os))) (kernel -> (operating-system-kernel-file os)) (initrd (operating-system-initrd-file os)) (root-device -> (if (eq? 'uuid (file-system-title root-fs)) @@ -746,12 +752,14 @@ populate the \"old entries\" menu." (entries -> (list (boot-parameters (label label) (root-device root-device) + (boot-device boot-device) ;; The device where the kernel and initrd live. (store-device (grub-device store-fs)) (store-mount-point (file-system-mount-point store-fs)) + (boot-type boot-type) (kernel kernel) (kernel-arguments (cons* (string-append "--root=" root-device) @@ -773,10 +781,15 @@ device in a ." (define (operating-system-parameters-file os) "Return a file that describes the boot parameters of OS. The primary use of -this file is the reconstruction of GRUB menu entries for old configurations." +this file is the reconstruction of bootloader menu entries for old +configurations." (mlet %store-monad ((initrd (operating-system-initrd-file os)) (root -> (operating-system-root-file-system os)) + (boot-device -> (bootloader-configuration-device + (operating-system-bootloader os))) (store -> (operating-system-store-file-system os)) + (boot-type -> (bootloader-configuration-type + (operating-system-bootloader os))) (label -> (kernel->boot-label (operating-system-kernel os)))) (gexp->file "parameters" @@ -788,6 +801,8 @@ this file is the reconstruction of GRUB menu entries for old configurations." (kernel-arguments #$(operating-system-kernel-arguments os)) (initrd #$initrd) + (boot-device #$boot-device) + (boot-type #$boot-type) (store (device #$(grub-device store)) (mount-point #$(file-system-mount-point store)))) @@ -809,6 +824,8 @@ this file is the reconstruction of GRUB menu entries for old configurations." ;; exactly to the device field of the object representing the ;; OS's root file system, so it might be a device path like "/dev/sda3". (root-device boot-parameters-root-device) + (boot-device boot-parameters-boot-device) + (boot-type boot-parameters-boot-type) (store-device boot-parameters-store-device) (store-mount-point boot-parameters-store-mount-point) (kernel boot-parameters-kernel) @@ -827,6 +844,16 @@ this file is the reconstruction of GRUB menu entries for old configurations." (label label) (root-device root) + (boot-device + (match (assq 'boot-device rest) + ((_ args) args) + (#f #f))) ; for compatibility reasons. + + (boot-type + (match (assq 'boot-type rest) + ((_ args) args) + (#f 'grub))) ; for compatibility reasons. + ;; In the past, we would store the directory name of the kernel instead ;; of the absolute file name of its image. Detect that and correct it. (kernel (if (string=? linux (direct-store-path linux)) diff --git a/gnu/system/bootloader.scm b/gnu/system/bootloader.scm index c2b23c380..b4774792e 100644 --- a/gnu/system/bootloader.scm +++ b/gnu/system/bootloader.scm @@ -104,7 +104,7 @@ corresponding to old generations of the system." (define boot-parameters->gexp (match-lambda - (($ label _ _ _ kernel kernel-arguments initrd) + (($ label _ _ _ _ _ kernel kernel-arguments initrd) #~(format port "LABEL ~a MENU LABEL ~a KERNEL ~a -- 2.12.2