From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:58778) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1eYpAb-0005mV-0M for guix-patches@gnu.org; Tue, 09 Jan 2018 03:22:06 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1eYpAY-0003Tt-9P for guix-patches@gnu.org; Tue, 09 Jan 2018 03:22:05 -0500 Received: from debbugs.gnu.org ([208.118.235.43]:33387) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1eYpAY-0003Tf-5K for guix-patches@gnu.org; Tue, 09 Jan 2018 03:22:02 -0500 Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1eYpAX-0007kB-Vo for guix-patches@gnu.org; Tue, 09 Jan 2018 03:22:02 -0500 Subject: [bug#29932] [PATCH 0/2] Clean up operating-system-kernel-arguments. Resent-Message-ID: Date: Tue, 9 Jan 2018 09:21:33 +0100 From: Danny Milosavljevic Message-ID: <20180109092133.3f740ba3@scratchpost.org> In-Reply-To: <878td8k8f5.fsf@gnu.org> References: <20180101132200.26157-1-dannym@scratchpost.org> <878td8k8f5.fsf@gnu.org> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable 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: Ludovic =?UTF-8?Q?Court=C3=A8s?= Cc: 29932@debbugs.gnu.org Hi Ludo, On Mon, 08 Jan 2018 10:26:54 +0100 ludo@gnu.org (Ludovic Court=C3=A8s) wrote: > Danny Milosavljevic skribis: >=20 > > Previously, the accessor for the field "kernel-arguments" in the struct= ure > > was called "operating-system-user-kernel-arguments". > > > > The procedure "operating-system-kernel-arguments" made sure to add argu= ments > > that made the system boot from a given device. > > > > After some reflection I think I was mistaken in that. > > > > It's nicer if the accessor is called "operating-system-kernel-argmuents" > > and if the users just use "bootable-kernel-arguments" on their own in o= rder to > > amend them. > > > > That's what this patch does. =20 >=20 > I find =E2=80=98bootable-kernel-arguments=E2=80=99 to be quite unusual fo= r a public > interface. >=20 > It=E2=80=99d feel more idiomatic to me if, instead, we had an > =E2=80=98operating-system-boot-kernel-arguments=E2=80=99 procedure that t= akes an OS and > returns (list --root --system =E2=80=A6). Then it=E2=80=99d be up to the= caller to > append that to what =E2=80=98operating-system-kernel-arguments=E2=80=99 r= eturns. Yeah, but looking at it some more, it doesn't really need an OS. It needs = the system derivation (and root device). Do we still call it "operating-system-..." when it won't get an OS (or anyt= hing from it) as parameter? What it does now is (define (bootable-kernel-arguments kernel-arguments system.drv root-device) "Prepend extra arguments to KERNEL-ARGUMENTS that allow SYSTEM.DRV to be booted from ROOT-DEVICE" (cons* (string-append "--root=3D" (if (uuid? root-device) ;; Note: Always use the DCE format because that= 's ;; what (gnu build linux-boot) expects for the ;; '--root' kernel command-line option. (uuid->string (uuid-bytevector root-device) 'dc= e) root-device)) #~(string-append "--system=3D" #$system.drv) #~(string-append "--load=3D" #$system.drv "/boot") kernel-arguments)) We could make it do (define (bootable-kernel-arguments* system.drv root-device) "Return extra boot arguments that allow SYSTEM.DRV to be booted from ROOT-DEVICE" (list (string-append "--root=3D" (if (uuid? root-device) ;; Note: Always use the DCE format because that= 's ;; what (gnu build linux-boot) expects for the ;; '--root' kernel command-line option. (uuid->string (uuid-bytevector root-device) 'dc= e) root-device)) #~(string-append "--system=3D" #$system.drv) #~(string-append "--load=3D" #$system.drv "/boot"))) But then it doesn't take anything from . The current users are: (define (operating-system-kernel-arguments os system.drv root-device) "Return all the kernel arguments, including the ones not specified directly by the user." (bootable-kernel-arguments (operating-system-user-kernel-arguments os) system.drv root-device)) Of that, the current users are: (define (operating-system-boot-parameters os system.drv root-device) "Return a monadic record that describes the boot parame= ters of OS. SYSTEM.DRV is either a derivation or #f. If it's a derivation, adds kernel arguments for that derivation to ." (mlet* %store-monad ((initrd (operating-system-initrd-file os)) (store -> (operating-system-store-file-system os)) (bootloader -> (bootloader-configuration-bootloader (operating-system-bootloader os))) (bootloader-name -> (bootloader-name bootloader)) (label -> (kernel->boot-label (operating-system-kernel os)))) (return (boot-parameters (label label) (root-device root-device) (kernel (operating-system-kernel-file os)) (kernel-arguments (if system.drv (operating-system-kernel-arguments os system.drv root-devic= e) (operating-system-user-kernel-arguments os))) (initrd initrd) (bootloader-name bootloader-name) (store-device (ensure-not-/dev (fs->boot-device store))) (store-mount-point (file-system-mount-point store)))))) (define* (system-qemu-image/shared-store-script os #:key (qemu qemu) (graphic? #t) (memory-size 256) (mappings '()) full-boot? (disk-image-size (* (if full-boot? 500 70) (expt 2 20))) (options '())) ... (define kernel-arguments #~(list #$@(if graphic? #~() #~("console=3DttyS0")) #+@(operating-system-kernel-arguments os os-drv "/dev/vda1"))) ...