From mboxrd@z Thu Jan 1 00:00:00 1970 From: Oleg Pykhalov Subject: Re: Dualbooting with guixsd not handling grub installation Date: Thu, 01 Feb 2018 09:14:54 +0300 Message-ID: <87h8r1me1t.fsf@gmail.com> References: <55149c20-6f4c-8b37-9b9f-43879f2d038f@uni-bremen.de> <878teabyjb.fsf@gmail.com> <87bmj54n8z.fsf@gnu.org> <1e2b47c5-6c2d-02c9-16bf-e633317d09c5@uni-bremen.de> <87po7gghyw.fsf@gnu.org> <87a7yhv8pj.fsf@gmail.com> <877etkxufy.fsf@gnu.org> Mime-Version: 1.0 Content-Type: multipart/signed; boundary="==-=-="; micalg=pgp-sha512; protocol="application/pgp-signature" Return-path: Received: from eggs.gnu.org ([2001:4830:134:3::10]:59396) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1eh89J-0008Uh-Ff for guix-devel@gnu.org; Thu, 01 Feb 2018 01:15:06 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1eh89G-0001iL-8m for guix-devel@gnu.org; Thu, 01 Feb 2018 01:15:05 -0500 In-Reply-To: <877etkxufy.fsf@gnu.org> ("Ludovic \=\?utf-8\?Q\?Court\=C3\=A8s\=22'\?\= \=\?utf-8\?Q\?s\?\= message of "Mon, 18 Dec 2017 10:21:37 +0100") List-Id: "Development of GNU Guix and the GNU System distribution." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: guix-devel-bounces+gcggd-guix-devel=m.gmane.org@gnu.org Sender: "Guix-devel" To: Ludovic =?utf-8?Q?Court=C3=A8s?= Cc: guix-devel --==-=-= Content-Type: multipart/mixed; boundary="=-=-=" --=-=-= Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable Hello Ludovic, ludo@gnu.org (Ludovic Court=C3=A8s) writes: > Oleg Pykhalov skribis: [...] >> Are linux linux-arguments initrd in menu-entry required? > > Currently yes: this is how you tell GRUB what to boot. I see an issue with it, because not always you want them. >> Maybe we could have configfile field? >> https://www.gnu.org/software/grub/manual/grub/html_node/configfile.html > > Yes, we could do that. One question is how to integrated properly since > =E2=80=98menu-entry=E2=80=99 is now bootloader-independent. Perhaps Math= ieu or Danny > have ideas? We could start by adding a way to add anything. Here is a patch. Probably ugly, but as a draft and idea about additional-options. --=-=-= Content-Type: text/x-patch Content-Disposition: attachment; filename=0001-bootloader-Add-additional-options-to-menu-entry.patch Content-Transfer-Encoding: quoted-printable Content-Description: bootloader: Add additional-options to menu-entry. From=207d7162a8ec78c84e7eba3ae9f7c4fbf07703617e Mon Sep 17 00:00:00 2001 From: Oleg Pykhalov Date: Thu, 1 Feb 2018 08:59:30 +0300 Subject: [PATCH] bootloader: Add additional-options to menu-entry. * gnu/bootloader.scm ()[additional-options]: New field. * gnu/bootloader/grub.scm (grub-configuration-file): Handle this. =2D-- gnu/bootloader.scm | 19 +++++++++++-------- gnu/bootloader/grub.scm | 27 +++++++++++++++++++-------- 2 files changed, 30 insertions(+), 16 deletions(-) diff --git a/gnu/bootloader.scm b/gnu/bootloader.scm index 736f11952..9a3c29a88 100644 =2D-- a/gnu/bootloader.scm +++ b/gnu/bootloader.scm @@ -31,6 +31,7 @@ menu-entry-linux-arguments menu-entry-initrd menu-entry-device-mount-point + menu-entry-additional-options =20 bootloader bootloader? @@ -65,15 +66,17 @@ (define-record-type* menu-entry make-menu-entry menu-entry? =2D (label menu-entry-label) =2D (device menu-entry-device ; file system uuid, label, or= #f =2D (default #f)) + (label menu-entry-label) + (device menu-entry-device ; file system uuid, label, or= #f + (default #f)) (device-mount-point menu-entry-device-mount-point =2D (default #f)) =2D (linux menu-entry-linux) =2D (linux-arguments menu-entry-linux-arguments =2D (default '())) ; list of string-valued gexps =2D (initrd menu-entry-initrd)) ; file name of the initrd as = a gexp + (default #f)) + (linux menu-entry-linux) + (linux-arguments menu-entry-linux-arguments + (default '())) ; list of string-valued gexps + (initrd menu-entry-initrd) ; file name of the initrd as = a gexp + (additional-options menu-entry-additional-options + (default '()))) ; list of string-valued gexps =20 ;;; diff --git a/gnu/bootloader/grub.scm b/gnu/bootloader/grub.scm index 96e53c5c2..7613c2a84 100644 =2D-- a/gnu/bootloader/grub.scm +++ b/gnu/bootloader/grub.scm @@ -324,22 +324,33 @@ entries corresponding to old generations of the syste= m." (label (menu-entry-label entry)) (kernel (menu-entry-linux entry)) (arguments (menu-entry-linux-arguments entry)) =2D (initrd (menu-entry-initrd entry))) + (initrd (menu-entry-initrd entry)) + (additional-options (menu-entry-additional-options entry))) ;; Here DEVICE is the store and DEVICE-MOUNT-POINT is its mount poin= t. ;; Use the right file names for KERNEL and INITRD in case ;; DEVICE-MOUNT-POINT is not "/", meaning that the store is on a ;; separate partition. =2D (let ((kernel (strip-mount-point device-mount-point kernel)) =2D (initrd (strip-mount-point device-mount-point initrd))) =2D #~(format port "menuentry ~s { + (if (and (file-append? kernel) (file-append? initrd)) + (let ((kernel (strip-mount-point device-mount-point kernel)) + (initrd (strip-mount-point device-mount-point initrd))) + #~(format port "menuentry ~s { ~a linux ~a ~a initrd ~a + ~a +}~%" + #$label + #$(grub-root-search device kernel) + #$kernel (string-join (list #$@arguments)) + #$initrd + (string-join (list #$@additional-options) "\n"))) + #~(format port "menuentry ~s { + ~a + ~a }~%" =2D #$label =2D #$(grub-root-search device kernel) =2D #$kernel (string-join (list #$@arguments)) =2D #$initrd)))) + #$label + #$(grub-root-search device kernel) + (string-join (list #$@additional-options) "\n"))))) (mlet %store-monad ((sugar (eye-candy config (menu-entry-device (first all-entries)) =2D-=20 2.15.1 --=-=-= Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable Which allows to use additional-options in menu-entry: =2D-8<---------------cut here---------------start------------->8--- (operating-system =E2=80=A6 (bootloader (bootloader-configuration (bootloader grub-efi-bootloader) (target "/boot/efi") (menu-entries (list (menu-entry (label "Another distro") (linux "") (initrd "") (additional-options '("search --label --set another-disk-label" "configfile /boot/grub/grub.cfg"))))))) =E2=80=A6) =2D-8<---------------cut here---------------end--------------->8--- Will produce the following Grub menuentry: =2D-8<---------------cut here---------------start------------->8--- menuentry "Another distro" { =20=20 search --label --set another-disk-label configfile /boot/grub/grub.cfg } =2D-8<---------------cut here---------------end--------------->8--- I successfully reconfigured and dualbooted with attached patch. Oleg. --=-=-=-- --==-=-= Content-Type: application/pgp-signature; name="signature.asc" -----BEGIN PGP SIGNATURE----- iQIzBAEBCgAdFiEEc+OyAXw1EaDPCmAPckbhHGm3lWkFAlpysF4ACgkQckbhHGm3 lWlDfA//Q0amutC9N96OQ+EwzfC8SBba8g6cw+bF+qoLOVr30EUpewF6159QCUvQ 384rjnYWTH1ekzt1Jzh4MlOLY2EiPifstdipe8qPZBf7d48xn53myphQt0u5Z2b1 jFOO4Wz6g1fEgIiv3J7zME4TdJKkgQgAnCsss6ritDMBEYpEul1geVbenBU3QZqO bt8IR6as9qofw1+/P5rxSfVzCoEhobj4mC2bZhAUTXnElGbC75IBkt2eD+y38bnC S3aQVVavGI4AKzMVlpQViQ+hnecgl1Vxc2pUck2Q1hEjd1E27axtYvvKfS9cVi3E kVVVSuQPcm9H8vGfXs/EF3I1BfaLFAbFSCJIWEfjSfHQwY6D7HF7bFdX+3mY4Zm4 G4RRcmp7Z3Q7cv+1EgxWOvf6GV56dzZYdzquIEYDq/W+6L6IXTboYtfLL5yDSRni W5jzOBKyjxcnCm5kUaZ/6V2NfPzXIUvrafbtZMt+/NqBFd/tswbGYXMwJah39t4d 4SMzGJ8nk2EZB3haMgW3xlj5qkLMolk8ImgjJ6WC+QBaPB3pHmMO5tSmsm14pdR7 WQAA/tQLIJ7l7Sl9bq2yxj3Bte8yO1HC2Wm/ZUEHVAHa0KECdSdTAq9SOKBkMENy HRZeMbE0XEYGEgJhzf/b5BQLRk0AQ5RYeP9mrb4FmOutlgk5kq0= =jBR7 -----END PGP SIGNATURE----- --==-=-=--