From mboxrd@z Thu Jan 1 00:00:00 1970 From: =?utf-8?B?VG9tw6HFoSDEjGVjaA==?= Subject: Re: [PATCH] system: grub: Introduce foreign-menu-entry. Date: Wed, 3 Aug 2016 11:05:19 +0200 Message-ID: <20160803090519.GA14600@venom> References: <20160803064249.7433-1-sleep_walker@gnu.org> <87eg66kzkr.fsf@gmail.com> Mime-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha256; protocol="application/pgp-signature"; boundary="1yeeQ81UyVL57Vl7" Return-path: Received: from eggs.gnu.org ([2001:4830:134:3::10]:36469) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bUs7B-00005e-MP for guix-devel@gnu.org; Wed, 03 Aug 2016 05:05:26 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1bUs77-0007QU-DX for guix-devel@gnu.org; Wed, 03 Aug 2016 05:05:24 -0400 Received: from mx2.suse.de ([195.135.220.15]:53360) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bUs77-0007QQ-1n for guix-devel@gnu.org; Wed, 03 Aug 2016 05:05:21 -0400 Content-Disposition: inline In-Reply-To: <87eg66kzkr.fsf@gmail.com> 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: Chris Marusich Cc: guix-devel@gnu.org --1yeeQ81UyVL57Vl7 Content-Type: text/plain; charset=utf-8; format=flowed Content-Disposition: inline Content-Transfer-Encoding: quoted-printable On Wed, Aug 03, 2016 at 01:48:36AM -0700, Chris Marusich wrote: >Hi Tom=C3=A1=C5=A1, > >Tom=C3=A1=C5=A1 =C4=8Cech writes: > >> foreign-menu-entry is very similar but is intended for entering other >> distributions so it doesn't limit the name and allows kernel and initrd = to be >> placed in different device (in Grub syntax). > >What is the use case which motivates this change? How do you intend to >use this after making the proposed changes? I'd like to store configuration of other linux distribution and so far I haven't found how to override hardcoded bzImage suffix. With this change I can have configuration: (bootloader (grub-configuration (device "/dev/sda") (menu-entries (list (foreign-menu-entry (label "openSUSE") (device "(hd0,1)") (linux "/vmlinuz") (linux-arguments (list "root=3D/dev/venom/opensuse" "init=3D/usr/lib/systemd/systemd")) (initrd "/initrd") ))))) which will transform to: menuentry "openSUSE" { linux (hd0,1)/vmlinuz root=3D/dev/venom/opensuse init=3D/usr/lib/systemd/= systemd initrd (hd0,1)/initrd } I asked on IRC how can I achieve adding such entry but never got answer. So= I made a patch. > >> +(define-record-type* >> + foreign-menu-entry make-foreign-menu-entry >> + foreign-menu-entry? >> + (label foreign-menu-entry-label) >> + (device foreign-menu-entry-device (default "")) >> + (linux foreign-menu-entry-linux) >> + (linux-arguments foreign-menu-entry-linux-arguments >> + (default '())) ; list of string-val= ued gexps >> + (initrd foreign-menu-entry-initrd)) ; file name of the i= nitrd as a gexp >> + > >This is identical to the existing record type; however, it >adds the "device" parameter: > >--8<---------------cut here---------------start------------->8--- > >(define-record-type* > menu-entry make-menu-entry > menu-entry? > (label menu-entry-label) > (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 >--8<---------------cut here---------------end--------------->8--- Your observation is correct. My intention was to introduce new record type to distinguish between menu-entry and foreign-menu-entry later in the code. Different type, different interpretation. >Would it be possible to accomplish the same thing by adding a "device" >parameter to the existing record type? That way, we >wouldn't have to add a new record type which seems largely redundant. > >> #~(string-append #$linux "/" >> #$linux-image-name= )) >> #$linux #$linux-image-name (string-join (list #$@argume= nts)) >> - #$initrd)))) >> + #$initrd)) >> + (($ label device linux arguments initrd) >> + #~(format port "menuentry ~s { >> + linux ~a ~a >> + initrd ~a >> +}~%" >> + #$label >> + (string-append #$device #$linux) > >Don't we need to insert a separator of some kind between #$device and >#$linux? Also, don't we need to include the linux image name (e.g., >"bzImage")? That is the point. User can specify whatever suits him. For the case with separate boot partition it can look like /vmlinuz-4.3.3-5-default for the case with boot directory on the same partition as different linux distribution it would look like /boot/vmlinuz-4.3.3-5-default Note that installed kernel in other distribution has never name 'bzImage'. > >> + (string-join (list #$@arguments)) >> + (string-append #$device #$initrd))))) >> >> (mlet %store-monad ((sugar (eye-candy config store-fs system #~port))) >> (define builder > >Isn't a separator of some kind needed between #$device and #$initrd? This kernel or partition with it is not searched, absolute path is expected, so no. Code was using match-lambda so defining new type to distinguish the cases seemed to me natural. Again, I'm new to Guile and I'd like to see how to do that right. This worked for me as first solution. Thanks for your review. S_W --1yeeQ81UyVL57Vl7 Content-Type: application/pgp-signature; name="signature.asc" -----BEGIN PGP SIGNATURE----- Version: GnuPG v2 iQIcBAEBCAAGBQJXobPNAAoJEEoj40+gM0NtwGgP/i5DOexPYBjg7VBRC7g/fdsA Ndsjwgk8/ftxsmmHnYtb02bSD94sxRym1HYva9jGu+6G8pQVnnSzHVsTkJxwfLqd iisGI2DKJdiLXnV6aj5u4X9ltoD9QUEZ3FuCKi3o3SF9Bai3aTbAmF2cqZwy3Psk SL4A/hoKKsl517pXTnjL5PFBi8AZY5vOCFURqgKCwh4dIGCb0DZYsvGp1EQkXv9N Eu2/Nq8ac9PfJOvZQrKfh3fDvyOtr8iy20EnU4vmfYvZMViIqYoquojEGtZP0Hcl bfZCHKVNOIi5eEW75+sv3wNV5QUpb8cRMkafBxslcRKPxdvj0v9Y23+jQGW4m+i4 b3nypJAG+R6jGESGWzUh3IyJagebMajencrAQ32yIh30Q58l4ARn4E1UApi6hHTH PWE7CNNkms33pRGs8ckh3uW7ZRI9v5bk4MT0IJStaH6sMf1sAVZkizvFkCnvfqjp cMnrLpdvvF+/G4JWTO7ZDC7dZ+r+3gGP92RGQChVLnWVurmb8wV51u4bjYstcUR4 iYZUFDd7M/N9IyILKMSCR98Wlcs0ErFPMtIdxg0j8qOhkNvPFRl1MWjBVtJkgdSK M2q9OmXxB0Bp02JpwwwIL0qlG7lTSSrNYdsceLzCTk/6n3NnAWKlhEXqL5fKaBlp H6TCYL4A69Ckk9NdvLhv =ju5u -----END PGP SIGNATURE----- --1yeeQ81UyVL57Vl7--