From unknown Tue Jun 17 20:21:49 2025 Content-Disposition: inline Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 X-Mailer: MIME-tools 5.509 (Entity 5.509) Content-Type: text/plain; charset=utf-8 From: bug#37868 <37868@debbugs.gnu.org> To: bug#37868 <37868@debbugs.gnu.org> Subject: Status: [PATCH] guix: Allow multiple packages to provide Linux modules in the system profile. Reply-To: bug#37868 <37868@debbugs.gnu.org> Date: Wed, 18 Jun 2025 03:21:49 +0000 retitle 37868 [PATCH] guix: Allow multiple packages to provide Linux module= s in the system profile. reassign 37868 guix-patches submitter 37868 Danny Milosavljevic severity 37868 normal tag 37868 patch thanks From debbugs-submit-bounces@debbugs.gnu.org Tue Oct 22 11:22:50 2019 Received: (at submit) by debbugs.gnu.org; 22 Oct 2019 15:22:50 +0000 Received: from localhost ([127.0.0.1]:60338 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1iMvzm-0006Eg-4N for submit@debbugs.gnu.org; Tue, 22 Oct 2019 11:22:50 -0400 Received: from lists.gnu.org ([209.51.188.17]:59101) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1iMvzk-0006EZ-6s for submit@debbugs.gnu.org; Tue, 22 Oct 2019 11:22:48 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:55953) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1iMvzi-0006rO-JI for guix-patches@gnu.org; Tue, 22 Oct 2019 11:22:48 -0400 X-Spam-Checker-Version: SpamAssassin 3.3.2 (2011-06-06) on eggs.gnu.org X-Spam-Level: X-Spam-Status: No, score=0.1 required=5.0 tests=BAYES_50,RCVD_IN_DNSWL_LOW, URIBL_BLOCKED autolearn=disabled version=3.3.2 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1iMvzg-0003hE-Dt for guix-patches@gnu.org; Tue, 22 Oct 2019 11:22:46 -0400 Received: from dd26836.kasserver.com ([85.13.145.193]:60970) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1iMvzg-0003fg-19 for guix-patches@gnu.org; Tue, 22 Oct 2019 11:22:44 -0400 Received: from localhost.localdomain (213162073022.public.t-mobile.at [213.162.73.22]) by dd26836.kasserver.com (Postfix) with ESMTPSA id AC53533622B7; Tue, 22 Oct 2019 17:22:40 +0200 (CEST) From: Danny Milosavljevic To: guix-patches@gnu.org Subject: [PATCH] guix: Allow multiple packages to provide Linux modules in the system profile. Date: Tue, 22 Oct 2019 17:22:38 +0200 Message-Id: <20191022152238.12856-1-dannym@scratchpost.org> X-Mailer: git-send-email 2.23.0 MIME-Version: 1.0 Tags: patch Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] [fuzzy] X-Received-From: 85.13.145.193 X-Spam-Score: -2.3 (--) X-Debbugs-Envelope-To: submit Cc: Danny Milosavljevic X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -3.3 (---) * guix/profiles.scm (linux-module-database): New procedure. (%default-profile-hooks): Add it. * gnu/system.scm (operating-system-profile): Add kernel to what profile-service-type gives. * gnu/services.scm (%modprobe-wrapper): Use that profile. * guix/build/linux-module-build-system.scm (install): Disable DEPMOD. --- gnu/services.scm | 7 ++- gnu/system.scm | 8 ++- guix/build/linux-module-build-system.scm | 5 +- guix/profiles.scm | 75 +++++++++++++++++++++++- 4 files changed, 87 insertions(+), 8 deletions(-) diff --git a/gnu/services.scm b/gnu/services.scm index 6ee05d4580..2a6d2bc464 100644 --- a/gnu/services.scm +++ b/gnu/services.scm @@ -491,7 +491,12 @@ ACTIVATION-SCRIPT-TYPE." (program-file "modprobe" #~(begin (setenv "LINUX_MODULE_DIRECTORY" - "/run/booted-system/kernel/lib/modules") + (if (file-exists? + "/run/booted-system/profile/lib/modul= es") + "/run/booted-system/profile/lib/module= s" + ;; Provides compatibility with previou= s + ;; Guix generations. + "/run/booted-system/kernel/lib/modules= ")) (apply execl #$modprobe (cons #$modprobe (cdr (command-line)))))))) =20 diff --git a/gnu/system.scm b/gnu/system.scm index a353b1a5c8..66270b38bb 100644 --- a/gnu/system.scm +++ b/gnu/system.scm @@ -887,12 +887,14 @@ we're running in the final root." (define* (operating-system-profile os) "Return a derivation that builds the system profile of OS." (mlet* %store-monad - ((services -> (operating-system-services os)) + ((kernel -> (operating-system-kernel os)) + (services -> (operating-system-services os)) (profile (fold-services services - #:target-type profile-service-type))) + #:target-type + profile-service-type))) (match profile (("profile" profile) - (return profile))))) + (return (cons kernel profile)))))) ; FIXME: Doesn't work for some= reason. I don't think this place is ever reached. =20 (define (operating-system-root-file-system os) "Return the root file system of OS." diff --git a/guix/build/linux-module-build-system.scm b/guix/build/linux-= module-build-system.scm index cd76df2de7..e4e6993a49 100644 --- a/guix/build/linux-module-build-system.scm +++ b/guix/build/linux-module-build-system.scm @@ -60,15 +60,14 @@ ;; part. (define* (install #:key inputs native-inputs outputs #:allow-other-keys) (let* ((out (assoc-ref outputs "out")) - (moddir (string-append out "/lib/modules")) - (kmod (assoc-ref (or native-inputs inputs) "kmod"))) + (moddir (string-append out "/lib/modules"))) ;; Install kernel modules (mkdir-p moddir) (invoke "make" "-C" (string-append (assoc-ref inputs "linux-module-builder") "/lib/modules/build") (string-append "M=3D" (getcwd)) - (string-append "DEPMOD=3D" kmod "/bin/depmod") + "DEPMOD=3Dtrue" ; disable depmod. (string-append "MODULE_DIR=3D" moddir) (string-append "INSTALL_PATH=3D" out) (string-append "INSTALL_MOD_PATH=3D" out) diff --git a/guix/profiles.scm b/guix/profiles.scm index cd3b21e390..fd77392588 100644 --- a/guix/profiles.scm +++ b/guix/profiles.scm @@ -9,6 +9,7 @@ ;;; Copyright =C2=A9 2017 Huang Ying ;;; Copyright =C2=A9 2017 Maxim Cournoyer ;;; Copyright =C2=A9 2019 Kyle Meyer +;;; Copyright =C2=A9 2019 Danny Milosavljevic ;;; ;;; This file is part of GNU Guix. ;;; @@ -1125,6 +1126,77 @@ for both major versions of GTK+." (hook . gtk-im-modules))) (return #f))))) =20 +(define (linux-module-database manifest) + (mlet %store-monad + ((kmod (manifest-lookup-package manifest "kmod"))) + (define build + (with-imported-modules '((guix build utils) + (guix build union)) + #~(begin + (use-modules (srfi srfi-1) + (srfi srfi-26) + (guix build utils) + (guix build union) + (ice-9 ftw) + (ice-9 match)) + (let* ((inputs '#$(manifest-inputs manifest)) + (input-files (lambda (path) + (filter file-exists? + (map (cut string-append <> path) input= s)))) + (module-directories (input-files "/lib/modules")) + (System.maps (input-files "/System.map")) + (Module.symverss (input-files "/Module.symvers")) + (directory-entries (lambda (directory-name) + (filter (lambda (basename) + (not (string-prefix? ".= " + ba= sename))) + (scandir directory-name))= )) + ;; Note: Should result in one entry. + (versions (append-map directory-entries module-director= ies))) + ;; TODO: if len(module-directories) =3D=3D 1: return modul= e-directories[0] + (mkdir-p (string-append #$output "/lib/modules")) + ;; Iterate over each kernel version directory (usually one= ). + (for-each (lambda (version) + (let ((destination-directory (string-append #$= output "/lib/modules/" version))) + (when (not (file-exists? destination-directo= ry)) ; unique + (union-build destination-directory + ;; All directories with the s= ame version as us. + (filter-map (lambda (director= y-name) + (if (member ver= sion + (di= rectory-entries directory-name)) + (string-app= end directory-name "/" version) + #f)) + module-directorie= s) + #:create-all-directories? #t) + ;; Delete generated files (they will be re= created shortly). + (for-each (lambda (basename) + (when (string-prefix? "modules= ." basename) + (false-if-file-not-found + (delete-file + (string-append + destination-directory "/= " + basename))))) + (directory-entries destination-d= irectory)) + (unless (zero? (system* (string-append #$k= mod "/bin/depmod") + "-e" ; Report symb= ols that aren't supplied + "-w" ; Warn on dup= licates + "-b" #$output ; de= stination-directory + "-F" (match System= .maps + ((x) x)) + "-E" (match Module= .symverss + ((x) x)) + version)) + (display "FAILED\n" (current-error-port)= ) + (exit #f))))) + versions) + (exit #t))))) + (gexp->derivation "linux-module-database" build + #:local-build? #t + #:substitutable? #f + #:properties + `((type . profile-hook) + (hook . linux-module-database))))) + (define (xdg-desktop-database manifest) "Return a derivation that builds the @file{mimeinfo.cache} database fr= om desktop files. It's used to query what applications can handle a given @@ -1425,7 +1497,8 @@ MANIFEST." gtk-im-modules texlive-configuration xdg-desktop-database - xdg-mime-database)) + xdg-mime-database + linux-module-database)) =20 (define* (profile-derivation manifest #:key From debbugs-submit-bounces@debbugs.gnu.org Tue Nov 12 11:21:00 2019 Received: (at 37868) by debbugs.gnu.org; 12 Nov 2019 16:21:00 +0000 Received: from localhost ([127.0.0.1]:58273 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1iUYua-0003f7-EG for submit@debbugs.gnu.org; Tue, 12 Nov 2019 11:21:00 -0500 Received: from dd26836.kasserver.com ([85.13.145.193]:43310) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1iUYuY-0003eu-Cu for 37868@debbugs.gnu.org; Tue, 12 Nov 2019 11:20:59 -0500 Received: from localhost (178.113.252.33.wireless.dyn.drei.com [178.113.252.33]) by dd26836.kasserver.com (Postfix) with ESMTPSA id 0778533602AF; Tue, 12 Nov 2019 17:20:55 +0100 (CET) Date: Tue, 12 Nov 2019 17:20:48 +0100 From: Danny Milosavljevic To: 37868@debbugs.gnu.org Subject: Re: [PATCH] guix: Allow multiple packages to provide Linux modules in the system profile. Message-ID: <20191112172048.61ba69eb@scratchpost.org> In-Reply-To: <20191022152238.12856-1-dannym@scratchpost.org> References: <20191022152238.12856-1-dannym@scratchpost.org> X-Mailer: Claws Mail 3.17.3 (GTK+ 2.24.32; x86_64-unknown-linux-gnu) MIME-Version: 1.0 Content-Type: multipart/signed; boundary="Sig_/qu1DN1Qhm2k5.PJPpewGUAc"; protocol="application/pgp-signature"; micalg=pgp-sha256 X-Spam-Score: -0.7 (/) X-Debbugs-Envelope-To: 37868 Cc: Mark H Weaver , ludo@gnu.org X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -1.7 (-) --Sig_/qu1DN1Qhm2k5.PJPpewGUAc Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: quoted-printable Hi, any comments about this patch? I don't want to just push this to guix master without any discussion since = it establishes an interface that has to keep working for a long time. Rationale of the patch: * Make Linux more modular, allowing the user to specify a union of Guix pac= kages to use as "the kernel" (especially kernel modules). Summary of the patch: * Add a profile hook "linux-module-database" which creates the union of all system packages that have a subdirectory "lib/modules" in their derivation, then invokes depmod on that union and then provides the result in the system profile. * Adapt modprobe to check "lib/modules" inside the system profile, if avail= able. Fall back to "/run/booted-system/kernel/lib/modules" otherwise. For the case where a person has just reconfigured Guix but doesn't want to = reboot, modprobe will still work, taking the modules of the old generation (which d= oesn't necessarily have Linux kernel modules inside the profile yet--because it do= esn't necessarily have this patch yet. But maybe it does). * Adapt operating-system-profile to automatically add the Kernel's modules = to the system profile (since the system profile would be the only place search= ed, not doing so would be very bad). * Adapt linux-build-system not to invoke depmod again. Also, its worldview would be incomplete anyway because it wouldn't have the entire system profi= le. Open questions: * Why doesn't operating-system-profile successfully add linux-libre ? It should. I don't think Guix ever gets there in the first place. (adding linux-libre to operating-system's "packages" field manually does work) * Do we want to have this stuff in the system profile or do we want to have a "kernel profile" instead or something? I don't think the latter would he= lp us much, but if we want it, better do it now. * Do we want to be able to add kernel modules in this fashion without requi= ring a reboot? If so, that would make the situation a lot more complicated and I don't see a safe way to do that. --Sig_/qu1DN1Qhm2k5.PJPpewGUAc Content-Type: application/pgp-signature Content-Description: OpenPGP digital signature -----BEGIN PGP SIGNATURE----- iQEzBAEBCAAdFiEEds7GsXJ0tGXALbPZ5xo1VCwwuqUFAl3K2+AACgkQ5xo1VCww uqUm7QgAifa//EJFZvzHDhsRmwBHcxu57lTXixAKCKE/AwOUqBLKzwcuhcw7FzMS +lYtMBncVhAzRQxI+9nINYocY0i2UQVD5UrcQa7DoDvfH897Sfn1IZgq0pJJhzVk EfGD8iUg9MYez4OucIJCj+iRIKLDuA0Gdr9+ZXtIGY/dCSQEyVpFpi6MtfEhlh6J HJSqjdr3pmxJb79UTchOYUXQbYO+mV/BQGARriSbIUholojir/PhBg85VvQ4UVAx SU04apwOIqMeqpuwbwuklNGP/a/YjxXeuf6LPqsyNyUSSOciVaVreZADrlZI741Z wJg12spSgSWb7naC7IP8F5cnV4F/dw== =qwvK -----END PGP SIGNATURE----- --Sig_/qu1DN1Qhm2k5.PJPpewGUAc-- From debbugs-submit-bounces@debbugs.gnu.org Tue Nov 12 12:48:29 2019 Received: (at 37868) by debbugs.gnu.org; 12 Nov 2019 17:48:29 +0000 Received: from localhost ([127.0.0.1]:58330 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1iUaHE-0005q9-VF for submit@debbugs.gnu.org; Tue, 12 Nov 2019 12:48:29 -0500 Received: from ns13.heimat.it ([46.4.214.66]:37398) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1iUaHC-0005pu-5n for 37868@debbugs.gnu.org; Tue, 12 Nov 2019 12:48:27 -0500 Received: from localhost (ip6-localhost [127.0.0.1]) by ns13.heimat.it (Postfix) with ESMTP id 1A364300FA3; Tue, 12 Nov 2019 17:48:20 +0000 (UTC) X-Virus-Scanned: Debian amavisd-new at ns13.heimat.it Received: from ns13.heimat.it ([127.0.0.1]) by localhost (ns13.heimat.it [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id WBJQO3clyOlO; Tue, 12 Nov 2019 17:47:59 +0000 (UTC) Received: from bourrache.mug.xelera.it (unknown [93.56.161.211]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by ns13.heimat.it (Postfix) with ESMTPSA id 8C591300F9D; Tue, 12 Nov 2019 17:47:59 +0000 (UTC) Received: from roquette.mug.biscuolo.net (roquette [10.38.2.14]) by bourrache.mug.xelera.it (Postfix) with SMTP id BE9F5300A05; Tue, 12 Nov 2019 18:47:57 +0100 (CET) Received: (nullmailer pid 23947 invoked by uid 1000); Tue, 12 Nov 2019 17:47:57 -0000 From: Giovanni Biscuolo To: Danny Milosavljevic , 37868@debbugs.gnu.org Subject: Re: [bug#37868] [PATCH] guix: Allow multiple packages to provide Linux modules in the system profile. In-Reply-To: <20191112172048.61ba69eb@scratchpost.org> Organization: Xelera.eu References: <20191022152238.12856-1-dannym@scratchpost.org> <20191112172048.61ba69eb@scratchpost.org> Date: Tue, 12 Nov 2019 18:47:57 +0100 Message-ID: <874kz9ouk2.fsf@roquette.mug.biscuolo.net> MIME-Version: 1.0 Content-Type: multipart/mixed; boundary="=-=-=" X-Spam-Score: 0.0 (/) X-Debbugs-Envelope-To: 37868 Cc: Mark H Weaver , ludo@gnu.org X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -1.0 (-) --=-=-= Content-Type: text/plain Hi Danny, Danny Milosavljevic writes: [...] > any comments about this patch? I still don't understand the internals of Guix to be able to comment yout patch, anyway... [...] > Rationale of the patch: > > * Make Linux more modular, allowing the user to specify a union of Guix packages > to use as "the kernel" (especially kernel modules). this would be a nice to have feature! > > Summary of the patch: > > * Add a profile hook "linux-module-database" which creates the union of all > system packages that have a subdirectory "lib/modules" in their derivation, > then invokes depmod on that union and then provides the result in the system > profile. > > * Adapt modprobe to check "lib/modules" inside the system profile, if available. > Fall back to "/run/booted-system/kernel/lib/modules" otherwise. > > For the case where a person has just reconfigured Guix but doesn't want to reboot, > modprobe will still work, taking the modules of the old generation (which doesn't > necessarily have Linux kernel modules inside the profile yet--because it doesn't > necessarily have this patch yet. But maybe it does). > > * Adapt operating-system-profile to automatically add the Kernel's modules to > the system profile (since the system profile would be the only place searched, > not doing so would be very bad). > > * Adapt linux-build-system not to invoke depmod again. Also, its worldview > would be incomplete anyway because it wouldn't have the entire system profile. > > Open questions: > > * Why doesn't operating-system-profile successfully add linux-libre ? > It should. I don't think Guix ever gets there in the first place. (adding > linux-libre to operating-system's "packages" field manually does work) > > * Do we want to have this stuff in the system profile or do we want to have > a "kernel profile" instead or something? I don't think the latter would help > us much, but if we want it, better do it now. > > * Do we want to be able to add kernel modules in this fashion without requiring > a reboot? If so, that would make the situation a lot more complicated and I > don't see a safe way to do that. --=-=-= Content-Type: multipart/signed; boundary="==-=-="; micalg=pgp-sha512; protocol="application/pgp-signature" --==-=-= Content-Type: text/plain Content-Transfer-Encoding: quoted-printable =2D-=20 Giovanni Biscuolo Xelera IT Infrastructures --==-=-= Content-Type: application/pgp-signature; name="signature.asc" -----BEGIN PGP SIGNATURE----- iQIzBAEBCgAdFiEERcxjuFJYydVfNLI5030Op87MORIFAl3K8E0ACgkQ030Op87M ORK7Sw//eY58xlU477UID0nj71YpeDziEtcLhtmDUmlVsg1jcU1/0NNNOuhAw+ys GRSwR8HXbKTpe1yZgdTo9sszEF1WhEXiTTL2VV1xYj8XtiqwpYDpnwsKYewsBScf ehHmQBbK7Y91EDpp64sWkCFYS7SB/DaRyChLbgWcQ3/xMw7TtFKpUl/8UZTp6GJM NV8xtKjVH4dnv554cISppIvArR5DsEAUn+r47KcgxCwdPStNvV//niGNHSw+KFi/ 1Y3fy6jZhuooD+SgN0DxlrPCQfqtktlMSxHmocc4PY48o2IScdSAkKuJ8bcnEnxH 2OPcC5+bXfykXDmK4t2paykfUlU/fSSuOMs8DTYvbHO2L2A3Heqfu20EZy4Wg3Ee 9IMGTY8najcfACXvfEt6TcFBfyzOR0NgTsOiCfubk5Lb0S/fHUOmjDlIMdM3mjX1 3DQK8UaAsxnsDaFgloerSXmFsQOmLK+DH6xS5z60TVwPqKbsX5gYo41m2ncCfBsc rEO/NUsht+EUd3rrLCDPxKG418NOLIaKIFIoAT7mkTzJcr4z+F7PfGImPhtIgmfc 00DYs1Ql8MTeNt/QFJET0yCzvWtMyiRmyrtv8SaVazlGFZIGbD9Xob+pUQedh4Vf lPjKeADJIpO9buWzOOwJMsKRHhKKh1N+/yzMPjQwe86w7FYnyOk= =DfZ9 -----END PGP SIGNATURE----- --==-=-=-- --=-=-=-- From debbugs-submit-bounces@debbugs.gnu.org Tue Nov 12 13:12:08 2019 Received: (at 37868) by debbugs.gnu.org; 12 Nov 2019 18:12:08 +0000 Received: from localhost ([127.0.0.1]:58361 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1iUae8-0006S4-FX for submit@debbugs.gnu.org; Tue, 12 Nov 2019 13:12:08 -0500 Received: from ns13.heimat.it ([46.4.214.66]:37638) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1iUae7-0006RV-1N for 37868@debbugs.gnu.org; Tue, 12 Nov 2019 13:12:07 -0500 Received: from localhost (ip6-localhost [127.0.0.1]) by ns13.heimat.it (Postfix) with ESMTP id 1077F300FA8; Tue, 12 Nov 2019 18:12:01 +0000 (UTC) X-Virus-Scanned: Debian amavisd-new at ns13.heimat.it Received: from ns13.heimat.it ([127.0.0.1]) by localhost (ns13.heimat.it [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id nDxQC2-99hyY; Tue, 12 Nov 2019 18:11:59 +0000 (UTC) Received: from bourrache.mug.xelera.it (unknown [93.56.161.211]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by ns13.heimat.it (Postfix) with ESMTPSA id 83C63300FA7; Tue, 12 Nov 2019 18:11:59 +0000 (UTC) Received: from roquette.mug.biscuolo.net (roquette [10.38.2.14]) by bourrache.mug.xelera.it (Postfix) with SMTP id 7CB30300A05; Tue, 12 Nov 2019 19:11:55 +0100 (CET) Received: (nullmailer pid 24311 invoked by uid 1000); Tue, 12 Nov 2019 18:11:55 -0000 From: Giovanni Biscuolo To: Danny Milosavljevic , 37868@debbugs.gnu.org Subject: Re: [bug#37868] [PATCH] guix: Allow multiple packages to provide Linux modules in the system profile. In-Reply-To: <20191112172048.61ba69eb@scratchpost.org> Organization: Xelera.eu References: <20191022152238.12856-1-dannym@scratchpost.org> <20191112172048.61ba69eb@scratchpost.org> Date: Tue, 12 Nov 2019 19:11:55 +0100 Message-ID: <8736etotg4.fsf@roquette.mug.biscuolo.net> MIME-Version: 1.0 Content-Type: text/plain X-Spam-Score: 0.0 (/) X-Debbugs-Envelope-To: 37868 Cc: Mark H Weaver , ludo@gnu.org X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -1.0 (-) [sorry for the double posting, I sent my previuos message incomplete] Hi Danny, Danny Milosavljevic writes: [...] > any comments about this patch? I still don't understand the internals of Guix to be able to comment your patch, but... [...] > Rationale of the patch: > > * Make Linux more modular, allowing the user to specify a union of Guix packages > to use as "the kernel" (especially kernel modules). this would be a nice to have feature! [...] > * Do we want to be able to add kernel modules in this fashion without requiring > a reboot? If so, that would make the situation a lot more complicated and I > don't see a safe way to do that. maybe I'm asking too much... but would it be possible to load and boot into the new (or another) kernel from the currently running kernel without a reboot, via kexec? something like https://wiki.archlinux.org/index.php/Kexec#Manually but with a clean stop/restart of system services? I know it could take some time (and maybe other things to patch) to have this feature, but maybe it is worth thinking of it in connection with this design change Thanks! Gio' -- Giovanni Biscuolo Xelera IT Infrastructures From debbugs-submit-bounces@debbugs.gnu.org Wed Nov 13 08:31:07 2019 Received: (at 37868) by debbugs.gnu.org; 13 Nov 2019 13:31:07 +0000 Received: from localhost ([127.0.0.1]:58913 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1iUsji-0006jE-Pk for submit@debbugs.gnu.org; Wed, 13 Nov 2019 08:31:07 -0500 Received: from eggs.gnu.org ([209.51.188.92]:35450) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1iUsjh-0006il-8o for 37868@debbugs.gnu.org; Wed, 13 Nov 2019 08:31:05 -0500 Received: from fencepost.gnu.org ([2001:470:142:3::e]:57071) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1iUsjb-00070p-TE; Wed, 13 Nov 2019 08:30:59 -0500 Received: from [2a01:e0a:1d:7270:af76:b9b:ca24:c465] (port=38948 helo=ribbon) by fencepost.gnu.org with esmtpsa (TLS1.2:RSA_AES_256_CBC_SHA1:256) (Exim 4.82) (envelope-from ) id 1iUsjb-0003DD-3n; Wed, 13 Nov 2019 08:30:59 -0500 From: =?utf-8?Q?Ludovic_Court=C3=A8s?= To: Danny Milosavljevic Subject: Re: [bug#37868] [PATCH] guix: Allow multiple packages to provide Linux modules in the system profile. References: <20191022152238.12856-1-dannym@scratchpost.org> <20191112172048.61ba69eb@scratchpost.org> Date: Wed, 13 Nov 2019 14:30:56 +0100 In-Reply-To: <20191112172048.61ba69eb@scratchpost.org> (Danny Milosavljevic's message of "Tue, 12 Nov 2019 17:20:48 +0100") Message-ID: <87a78zq4xb.fsf@gnu.org> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/26.3 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Spam-Score: -2.3 (--) X-Debbugs-Envelope-To: 37868 Cc: Mark H Weaver , 37868@debbugs.gnu.org X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -3.3 (---) Hi Danny, Danny Milosavljevic skribis: > any comments about this patch? I commented on an earlier version of this patch at . Let me know what you think! > I don't want to just push this to guix master without any discussion sinc= e it > establishes an interface that has to keep working for a long time. I agree, thanks for the heads-up. > Open questions: > > * Why doesn't operating-system-profile successfully add linux-libre ? What do you mean? Currently =E2=80=98linux-libre=E2=80=99 is not added to = the global profile, and I think it=E2=80=99s nicer this way (we=E2=80=99re not clobber= ing the profile). > * Do we want to be able to add kernel modules in this fashion without req= uiring > a reboot? If so, that would make the situation a lot more complicated an= d I > don't see a safe way to do that. If we arrange for those kernel modules to show up in /run/current-system/kernel as I suggested in the message linked above, it should work (assuming the running kernel and the target kernel are the same, of course). Thanks, Ludo=E2=80=99. From debbugs-submit-bounces@debbugs.gnu.org Thu Nov 14 11:21:31 2019 Received: (at 37868) by debbugs.gnu.org; 14 Nov 2019 16:21:31 +0000 Received: from localhost ([127.0.0.1]:35069 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1iVHsB-0004Mg-46 for submit@debbugs.gnu.org; Thu, 14 Nov 2019 11:21:31 -0500 Received: from dd26836.kasserver.com ([85.13.145.193]:53928) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1iVHs8-0004MU-Jr for 37868@debbugs.gnu.org; Thu, 14 Nov 2019 11:21:29 -0500 Received: from localhost (77.117.161.1.wireless.dyn.drei.com [77.117.161.1]) by dd26836.kasserver.com (Postfix) with ESMTPSA id 717083362A7B; Thu, 14 Nov 2019 17:21:26 +0100 (CET) Date: Thu, 14 Nov 2019 17:21:16 +0100 From: Danny Milosavljevic To: Ludovic =?ISO-8859-1?Q?Court=E8s?= Subject: Re: [bug#37868] [PATCH] guix: Allow multiple packages to provide Linux modules in the system profile. Message-ID: <20191114172116.7f565f7d@scratchpost.org> In-Reply-To: <87a78zq4xb.fsf@gnu.org> References: <20191022152238.12856-1-dannym@scratchpost.org> <20191112172048.61ba69eb@scratchpost.org> <87a78zq4xb.fsf@gnu.org> X-Mailer: Claws Mail 3.17.3 (GTK+ 2.24.32; x86_64-unknown-linux-gnu) MIME-Version: 1.0 Content-Type: multipart/signed; boundary="Sig_/lqQ7HZFFXTA0sK97fl6E/+Y"; protocol="application/pgp-signature"; micalg=pgp-sha256 X-Spam-Score: -0.7 (/) X-Debbugs-Envelope-To: 37868 Cc: Mark H Weaver , 37868@debbugs.gnu.org X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -1.7 (-) --Sig_/lqQ7HZFFXTA0sK97fl6E/+Y Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable Hi Ludo, On Wed, 13 Nov 2019 14:30:56 +0100 Ludovic Court=C3=A8s wrote: > > * Why doesn't operating-system-profile successfully add linux-libre ? = =20 >=20 > What do you mean? Currently =E2=80=98linux-libre=E2=80=99 is not added t= o the global > profile, and I think it=E2=80=99s nicer this way (we=E2=80=99re not clobb= ering the > profile). I've modified it to automatically add linux-libre to the system profile but= it doesn't work for some reason. > > * Do we want to be able to add kernel modules in this fashion without r= equiring > > a reboot? If so, that would make the situation a lot more complicated = and I > > don't see a safe way to do that. =20 >=20 > If we arrange for those kernel modules to show up in > /run/current-system/kernel as I suggested in the message linked above, > it should work (assuming the running kernel and the target kernel are > the same, of course). Hmm... I'll read it now :) --Sig_/lqQ7HZFFXTA0sK97fl6E/+Y Content-Type: application/pgp-signature Content-Description: OpenPGP digital signature -----BEGIN PGP SIGNATURE----- iQEzBAEBCAAdFiEEds7GsXJ0tGXALbPZ5xo1VCwwuqUFAl3NfvwACgkQ5xo1VCww uqU44Af9HixiuyU21XSnM38yd8Vm4aGTOjPuqpEAuVZLI0MelZ3mN4IBrW3xKmlT iXhiOXxEanWf3LSQHwYp1CXazy83nqBkAFYL1CivxNHDZQpaZd2c3jzI2+Kk4VlJ mn4DZH4T8FweGsOMOvQ6MzZze8eOdhpRSjAMUzgvQKSFLNzUE+CtRFOuMh9evIQS lpKq3trSCKhQoZdv/5hpHVFc0ZCUfaXVpl8d5d4ko1VI7irfbQxbFqtU7ms5aQJf wq7OIXJxcL3XRWE2a/+VU3LqdXP9CJ7QewBMM87QAQT/1wA0aJBjGBabXFM4A0Q9 hAganoZJLz4dOSu5m/KMUqMKmmRYdA== =iQlv -----END PGP SIGNATURE----- --Sig_/lqQ7HZFFXTA0sK97fl6E/+Y-- From debbugs-submit-bounces@debbugs.gnu.org Thu Nov 14 12:49:28 2019 Received: (at 37868) by debbugs.gnu.org; 14 Nov 2019 17:49:28 +0000 Received: from localhost ([127.0.0.1]:35179 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1iVJFI-0006cw-1L for submit@debbugs.gnu.org; Thu, 14 Nov 2019 12:49:28 -0500 Received: from world.peace.net ([64.112.178.59]:47780) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1iVJFG-0006cp-88 for 37868@debbugs.gnu.org; Thu, 14 Nov 2019 12:49:27 -0500 Received: from mhw by world.peace.net with esmtpsa (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.89) (envelope-from ) id 1iVJFC-0004Jn-50; Thu, 14 Nov 2019 12:49:22 -0500 From: Mark H Weaver To: Danny Milosavljevic Subject: Re: [PATCH] guix: Allow multiple packages to provide Linux modules in the system profile In-Reply-To: <20191112172048.61ba69eb@scratchpost.org> References: <20191022152238.12856-1-dannym@scratchpost.org> <20191112172048.61ba69eb@scratchpost.org> Date: Thu, 14 Nov 2019 12:48:17 -0500 Message-ID: <87tv7673ib.fsf@netris.org> MIME-Version: 1.0 Content-Type: text/plain X-Spam-Score: 0.0 (/) X-Debbugs-Envelope-To: 37868 Cc: Ludovic =?utf-8?Q?Court=C3=A8s?= , 37868@debbugs.gnu.org X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -1.0 (-) Hi Danny, Danny Milosavljevic wrote: > any comments about this patch? > > I don't want to just push this to guix master without any discussion since it > establishes an interface that has to keep working for a long time. Thanks very much for bringing this to my attention. Generally, it looks good to me, although I agree with the suggestions that Ludovic has made, both here and in the thread on guix-devel: https://lists.gnu.org/archive/html/guix-devel/2019-10/msg00514.html I'm overloaded with other tasks at the moment, so I might not comment on this thread again, but I expect that I'll be happy with whatever you and Ludovic can agree on. Thanks! Mark From debbugs-submit-bounces@debbugs.gnu.org Mon Dec 30 13:55:29 2019 Received: (at 37868) by debbugs.gnu.org; 30 Dec 2019 18:55:29 +0000 Received: from localhost ([127.0.0.1]:33403 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1im0CP-0008In-4Z for submit@debbugs.gnu.org; Mon, 30 Dec 2019 13:55:29 -0500 Received: from eggs.gnu.org ([209.51.188.92]:48307) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1im0CN-0008Ib-Bx for 37868@debbugs.gnu.org; Mon, 30 Dec 2019 13:55:27 -0500 Received: from fencepost.gnu.org ([2001:470:142:3::e]:39510) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1im0CH-00057a-F4; Mon, 30 Dec 2019 13:55:21 -0500 Received: from [2a01:e0a:1d:7270:af76:b9b:ca24:c465] (port=44286 helo=ribbon) by fencepost.gnu.org with esmtpsa (TLS1.2:RSA_AES_256_CBC_SHA1:256) (Exim 4.82) (envelope-from ) id 1im0CE-0003Gw-Iu; Mon, 30 Dec 2019 13:55:20 -0500 From: =?utf-8?Q?Ludovic_Court=C3=A8s?= To: Danny Milosavljevic Subject: Re: Loading modules built using linux-module-build-system References: <877e8snntp.fsf@jlicht.xyz> <20191021202733.3c340770@scratchpost.org> <20191021204857.5dff6e9b@scratchpost.org> <20191021233925.0ba18a4c@scratchpost.org> <87k18x3r3g.fsf@gnu.org> <20191114173143.6924e46e@scratchpost.org> <87bltakzqj.fsf@gnu.org> <20191222210627.63fe1388@scratchpost.org> X-URL: http://www.fdn.fr/~lcourtes/ X-Revolutionary-Date: 10 =?utf-8?Q?Niv=C3=B4se?= an 228 de la =?utf-8?Q?R?= =?utf-8?Q?=C3=A9volution?= X-PGP-Key-ID: 0x090B11993D9AEBB5 X-PGP-Key: http://www.fdn.fr/~lcourtes/ludovic.asc X-PGP-Fingerprint: 3CE4 6455 8A84 FDC6 9DB4 0CFB 090B 1199 3D9A EBB5 X-OS: x86_64-pc-linux-gnu Date: Mon, 30 Dec 2019 19:55:16 +0100 In-Reply-To: <20191222210627.63fe1388@scratchpost.org> (Danny Milosavljevic's message of "Sun, 22 Dec 2019 21:06:27 +0100") Message-ID: <87sgl163u3.fsf@gnu.org> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/26.3 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Spam-Score: -2.3 (--) X-Debbugs-Envelope-To: 37868 Cc: guix-devel@gnu.org, Mark H Weaver , Jelle Licht , 37868@debbugs.gnu.org X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -3.3 (---) Hello, Danny Milosavljevic skribis: > On Sun, 17 Nov 2019 21:35:32 +0100 > Ludovic Court=C3=A8s wrote: >> Rather than a list, we could have a =E2=80=98make-linux-libre-union=E2= =80=99 procedure >> returning a , so that we preserve consistent typing. >>=20 >> That is, people could write: >>=20 >> (kernel linux-libre) >>=20 >> or: >>=20 >> (kernel (make-linux-libre-union linux-libre some-package)) >>=20 >> WDYT? > > Hmm, isn't it more like a profile? I mean it would work the way above but > there's (presumably) some reason why SOME-PACKAGE was an extra package. You=E2=80=99re right, the union thing above is like a profile. > We don't have to use the /run/current-system/profile for that, it could be > a new one. > > What are the downside of using a profile vs. using a package in that way? No downside to using a profile, as long as it=E2=80=99s not /run/current-system/profile. The only remaining question is the programming interface. Possible options include =E2=80=98make-linux-libre-union=E2=80=99 above or = a new =E2=80=98linux-module-packages=E2=80=99 field in as disc= ussed at . HTH, Ludo=E2=80=99. From debbugs-submit-bounces@debbugs.gnu.org Mon Feb 17 12:10:52 2020 Received: (at 37868) by debbugs.gnu.org; 17 Feb 2020 17:10:52 +0000 Received: from localhost ([127.0.0.1]:39138 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1j3jv1-0007gZ-OR for submit@debbugs.gnu.org; Mon, 17 Feb 2020 12:10:52 -0500 Received: from dd26836.kasserver.com ([85.13.145.193]:34786) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1j3juz-0007gP-KH for 37868@debbugs.gnu.org; Mon, 17 Feb 2020 12:10:50 -0500 Received: from localhost (guest17.ersteit.com [213.150.31.17]) by dd26836.kasserver.com (Postfix) with ESMTPSA id 4F99D336593A; Mon, 17 Feb 2020 18:10:48 +0100 (CET) Date: Mon, 17 Feb 2020 18:10:45 +0100 From: Danny Milosavljevic To: Ludovic =?ISO-8859-1?Q?Court=E8s?= Subject: Re: [bug#37868] [PATCH] guix: Allow multiple packages to provide Linux modules in the system profile. Message-ID: <20200217181045.7d41f231@scratchpost.org> In-Reply-To: <87a78zq4xb.fsf@gnu.org> References: <20191022152238.12856-1-dannym@scratchpost.org> <20191112172048.61ba69eb@scratchpost.org> <87a78zq4xb.fsf@gnu.org> X-Mailer: Claws Mail 3.17.3 (GTK+ 2.24.32; x86_64-unknown-linux-gnu) MIME-Version: 1.0 Content-Type: multipart/signed; boundary="Sig_/.R9wu+HpELz9kIF08Atvk+i"; protocol="application/pgp-signature"; micalg=pgp-sha256 X-Spam-Score: 2.9 (++) X-Spam-Report: Spam detection software, running on the system "debbugs.gnu.org", has NOT identified this incoming email as spam. The original message has been attached to this so you can view it or label similar future email. If you have any questions, see the administrator of that system for details. Content preview: Hi Ludo, should the following work (patch to guix master attached)? Because I get Content analysis details: (2.9 points, 10.0 required) pts rule name description ---- ---------------------- -------------------------------------------------- 0.0 URIBL_BLOCKED ADMINISTRATOR NOTICE: The query to URIBL was blocked. See http://wiki.apache.org/spamassassin/DnsBlocklists#dnsbl-block for more information. [URIs: scratchpost.org] 3.6 RCVD_IN_SBL_CSS RBL: Received via a relay in Spamhaus SBL-CSS [213.150.31.17 listed in zen.spamhaus.org] -0.7 RCVD_IN_DNSWL_LOW RBL: Sender listed at https://www.dnswl.org/, low trust [85.13.145.193 listed in list.dnswl.org] 0.0 SPF_NONE SPF: sender does not publish an SPF Record 0.0 SPF_HELO_NONE SPF: HELO does not publish an SPF Record X-Debbugs-Envelope-To: 37868 Cc: Mark H Weaver , 37868@debbugs.gnu.org X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: 1.9 (+) X-Spam-Report: Spam detection software, running on the system "debbugs.gnu.org", has NOT identified this incoming email as spam. The original message has been attached to this so you can view it or label similar future email. If you have any questions, see the administrator of that system for details. Content preview: Hi Ludo, should the following work (patch to guix master attached)? Because I get Content analysis details: (1.9 points, 10.0 required) pts rule name description ---- ---------------------- -------------------------------------------------- 0.0 URIBL_BLOCKED ADMINISTRATOR NOTICE: The query to URIBL was blocked. See http://wiki.apache.org/spamassassin/DnsBlocklists#dnsbl-block for more information. [URIs: kyleam.com] -0.7 RCVD_IN_DNSWL_LOW RBL: Sender listed at https://www.dnswl.org/, low trust [85.13.145.193 listed in list.dnswl.org] 3.6 RCVD_IN_SBL_CSS RBL: Received via a relay in Spamhaus SBL-CSS [213.150.31.17 listed in zen.spamhaus.org] 0.0 SPF_NONE SPF: sender does not publish an SPF Record 0.0 SPF_HELO_NONE SPF: HELO does not publish an SPF Record -1.0 MAILING_LIST_MULTI Multiple indicators imply a widely-seen list manager --Sig_/.R9wu+HpELz9kIF08Atvk+i Content-Type: multipart/mixed; boundary="MP_/2=U6mP85rb71MR6_coVFDnO" --MP_/2=U6mP85rb71MR6_coVFDnO Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: quoted-printable Content-Disposition: inline Hi Ludo, should the following work (patch to guix master attached)? Because I get=20 guix system: error: #: invalid G-expression input on ./pre-inst-env guix system vm /etc/config.scm --MP_/2=U6mP85rb71MR6_coVFDnO Content-Type: text/x-patch Content-Transfer-Encoding: quoted-printable Content-Disposition: attachment; filename=a.patch diff --git a/gnu/system.scm b/gnu/system.scm index 01baa248a2..9874861041 100644 --- a/gnu/system.scm +++ b/gnu/system.scm @@ -164,6 +164,8 @@ =20 (kernel operating-system-kernel ; package (default linux-libre)) + (kernel-module-packages operating-system-kernel-module-packages + (default '())) ; list of packages (kernel-arguments operating-system-user-kernel-arguments (default '("quiet"))) ; list of gexps/strings (bootloader operating-system-bootloader) ; @@ -469,9 +471,18 @@ OS." value of the SYSTEM-SERVICE-TYPE service." (let ((locale (operating-system-locale-directory os))) (mlet %store-monad ((kernel -> (operating-system-kernel os)) + (kernel-module-packages -> + (operating-system-kernel-module-packages os)) (initrd -> (operating-system-initrd-file os)) (params (operating-system-boot-parameters-file = os))) (return `(("kernel" ,kernel) + ("kernel-modules" + ,(profile-derivation + (packages->manifest (cons kernel kernel-module-packages= )) + ; TODO: system, target. + #:hooks (list linux-module-database) + #:system #f + #:target #f)) ("parameters" ,params) ("initrd" ,initrd) ("locale" ,locale)))))) ;used by libc diff --git a/guix/profiles.scm b/guix/profiles.scm index 0d38b2513f..ecc0d3ae5a 100644 --- a/guix/profiles.scm +++ b/guix/profiles.scm @@ -9,6 +9,7 @@ ;;; Copyright =C2=A9 2017 Huang Ying ;;; Copyright =C2=A9 2017 Maxim Cournoyer ;;; Copyright =C2=A9 2019 Kyle Meyer +;;; Copyright =C2=A9 2019 Danny Milosavljevic ;;; Copyright =C2=A9 2019 Mathieu Othacehe ;;; ;;; This file is part of GNU Guix. @@ -139,7 +140,9 @@ %current-profile ensure-profile-directory canonicalize-profile - user-friendly-profile)) + user-friendly-profile + + linux-module-database)) =20 ;;; Commentary: ;;; @@ -1137,6 +1140,77 @@ for both major versions of GTK+." (hook . gtk-im-modules))) (return #f))))) =20 +(define (linux-module-database manifest) + (mlet %store-monad + ((kmod (manifest-lookup-package manifest "kmod"))) + (define build + (with-imported-modules '((guix build utils) + (guix build union)) + #~(begin + (use-modules (srfi srfi-1) + (srfi srfi-26) + (guix build utils) + (guix build union) + (ice-9 ftw) + (ice-9 match)) + (let* ((inputs '#$(manifest-inputs manifest)) + (input-files (lambda (path) + (filter file-exists? + (map (cut string-append <> path) inputs)= ))) + (module-directories (input-files "/lib/modules")) + (System.maps (input-files "/System.map")) + (Module.symverss (input-files "/Module.symvers")) + (directory-entries (lambda (directory-name) + (filter (lambda (basename) + (not (string-prefix? "." + base= name))) + (scandir directory-name)))) + ;; Note: Should result in one entry. + (versions (append-map directory-entries module-directorie= s))) + ;; TODO: if len(module-directories) =3D=3D 1: return module-= directories[0] + (mkdir-p (string-append #$output "/lib/modules")) + ;; Iterate over each kernel version directory (usually one). + (for-each (lambda (version) + (let ((destination-directory (string-append #$ou= tput "/lib/modules/" version))) + (when (not (file-exists? destination-directory= )) ; unique + (union-build destination-directory + ;; All directories with the sam= e version as us. + (filter-map (lambda (directory-= name) + (if (member versi= on + (dire= ctory-entries directory-name)) + (string-appen= d directory-name "/" version) + #f)) + module-directories) + #:create-all-directories? #t) + ;; Delete generated files (they will be recr= eated shortly). + (for-each (lambda (basename) + (when (string-prefix? "modules."= basename) + (false-if-file-not-found + (delete-file + (string-append + destination-directory "/" + basename))))) + (directory-entries destination-dir= ectory)) + (unless (zero? (system* (string-append #$kmo= d "/bin/depmod") + "-e" ; Report symbol= s that aren't supplied + "-w" ; Warn on dupli= cates + "-b" #$output ; dest= ination-directory + "-F" (match System.m= aps + ((x) x)) + "-E" (match Module.s= ymverss + ((x) x)) + version)) + (display "FAILED\n" (current-error-port)) + (exit #f))))) + versions) + (exit #t))))) + (gexp->derivation "linux-module-database" build + #:local-build? #t + #:substitutable? #f + #:properties + `((type . profile-hook) + (hook . linux-module-database))))) + (define (xdg-desktop-database manifest) "Return a derivation that builds the @file{mimeinfo.cache} database from desktop files. It's used to query what applications can handle a given --MP_/2=U6mP85rb71MR6_coVFDnO-- --Sig_/.R9wu+HpELz9kIF08Atvk+i Content-Type: application/pgp-signature Content-Description: OpenPGP digital signature -----BEGIN PGP SIGNATURE----- iQEzBAEBCAAdFiEEds7GsXJ0tGXALbPZ5xo1VCwwuqUFAl5KyRUACgkQ5xo1VCww uqVEFQf9GFlM7I4B9PGp5AmjpX/P1NtogHcDqRO4Hx457+CAeeJoKj7nLgbIJi8U 2ztELh8Q8AU42Lz6fr5gJd0waswegVGMLd4ohcN9MOKtwtTzu3RoOidkPv1rJkj3 CuOV+Lis3FCVMUR0COVadqbr0wfR/KYLFW5ISR9WnJOeJ/c85/Wuf59upxtk2V72 mcNHKZjMDsgIvRflZC/jd6jf0SqEMHGUJRLQTRiGEtAiJ68w3RGLOEpNGWZv+jQm C+Vmpnl8WNt7rqKWDRiDFhXx3w2mQP7OncsevUT2JZ2eCSPBxM6n2E5DbvmejGSu qlIhUBA6jTeq2h8hr30hYTqv5dsGKg== =UdIf -----END PGP SIGNATURE----- --Sig_/.R9wu+HpELz9kIF08Atvk+i-- From debbugs-submit-bounces@debbugs.gnu.org Tue Feb 18 03:31:17 2020 Received: (at 37868) by debbugs.gnu.org; 18 Feb 2020 08:31:18 +0000 Received: from localhost ([127.0.0.1]:39525 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1j3yHl-0006l9-MS for submit@debbugs.gnu.org; Tue, 18 Feb 2020 03:31:17 -0500 Received: from eggs.gnu.org ([209.51.188.92]:47183) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1j3yHk-0006ku-2j for 37868@debbugs.gnu.org; Tue, 18 Feb 2020 03:31:16 -0500 Received: from fencepost.gnu.org ([2001:470:142:3::e]:42653) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1j3yHe-0006Sl-Hb; Tue, 18 Feb 2020 03:31:10 -0500 Received: from [2001:660:6102:320:e120:2c8f:8909:cdfe] (port=58434 helo=ribbon) by fencepost.gnu.org with esmtpsa (TLS1.2:RSA_AES_256_CBC_SHA1:256) (Exim 4.82) (envelope-from ) id 1j3yHd-0006ve-3b; Tue, 18 Feb 2020 03:31:09 -0500 From: =?utf-8?Q?Ludovic_Court=C3=A8s?= To: Danny Milosavljevic Subject: Re: [bug#37868] [PATCH] guix: Allow multiple packages to provide Linux modules in the system profile. References: <20191022152238.12856-1-dannym@scratchpost.org> <20191112172048.61ba69eb@scratchpost.org> <87a78zq4xb.fsf@gnu.org> <20200217181045.7d41f231@scratchpost.org> X-URL: http://www.fdn.fr/~lcourtes/ X-Revolutionary-Date: 30 =?utf-8?Q?Pluvi=C3=B4se?= an 228 de la =?utf-8?Q?R=C3=A9volution?= X-PGP-Key-ID: 0x090B11993D9AEBB5 X-PGP-Key: http://www.fdn.fr/~lcourtes/ludovic.asc X-PGP-Fingerprint: 3CE4 6455 8A84 FDC6 9DB4 0CFB 090B 1199 3D9A EBB5 X-OS: x86_64-pc-linux-gnu Date: Tue, 18 Feb 2020 09:31:06 +0100 In-Reply-To: <20200217181045.7d41f231@scratchpost.org> (Danny Milosavljevic's message of "Mon, 17 Feb 2020 18:10:45 +0100") Message-ID: <87lfp0nvp1.fsf@gnu.org> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/26.3 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Spam-Score: -0.7 (/) X-Debbugs-Envelope-To: 37868 Cc: Mark H Weaver , 37868@debbugs.gnu.org X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -1.7 (-) Hi, Danny Milosavljevic skribis: > guix system: error: #: invalid G-expression input That means you=E2=80=99re using a procedure in a gexp, as in: #~(foo bar #$proc) where =E2=80=98proc=E2=80=99 is a procedure. Given the location info and argument name, we can tell that procedure comes from =E2=80=98profile-derivation=E2=80=99, right=E2=80=A6 > (mlet %store-monad ((kernel -> (operating-system-kernel os)) > + (kernel-module-packages -> > + (operating-system-kernel-module-packages os)) > (initrd -> (operating-system-initrd-file os)) > (params (operating-system-boot-parameters-fil= e os))) > (return `(("kernel" ,kernel) > + ("kernel-modules" > + ,(profile-derivation > + (packages->manifest (cons kernel kernel-module-packag= es)) =E2=80=A6 here. =E2=86=91 This is because =E2=80=98profile-derivation=E2=80=99 is a monadic procedure= , so it=E2=80=99s result is a =E2=80=9Cmonadic value=E2=80=9D, which is technically a procedu= re. You need to move the =E2=80=98profile-derivation=E2=80=99 call within the = =E2=80=98mlet=E2=80=99. HTH! Ludo=E2=80=99. From debbugs-submit-bounces@debbugs.gnu.org Tue Feb 18 04:42:20 2020 Received: (at 37868) by debbugs.gnu.org; 18 Feb 2020 09:42:21 +0000 Received: from localhost ([127.0.0.1]:39559 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1j3zOW-0000DC-Kb for submit@debbugs.gnu.org; Tue, 18 Feb 2020 04:42:20 -0500 Received: from dd26836.kasserver.com ([85.13.145.193]:59828) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1j3zOU-0000Cv-6L for 37868@debbugs.gnu.org; Tue, 18 Feb 2020 04:42:18 -0500 Received: from dayas.lan (80-110-118-191.cgn.dynamic.surfer.at [80.110.118.191]) by dd26836.kasserver.com (Postfix) with ESMTPSA id 628F53366A86; Tue, 18 Feb 2020 10:42:15 +0100 (CET) From: Danny Milosavljevic To: 37868@debbugs.gnu.org, ludo@gnu.org, Mark H Weaver Subject: [PATCH v2 0/2] system: Add kernel-module-packages to operating-system and use it. Date: Tue, 18 Feb 2020 10:42:05 +0100 Message-Id: <20200218094207.6196-1-dannym@scratchpost.org> X-Mailer: git-send-email 2.23.0 In-Reply-To: <20191112172048.61ba69eb@scratchpost.org> References: <20191112172048.61ba69eb@scratchpost.org> MIME-Version: 1.0 Tags: patch Content-Transfer-Encoding: 8bit X-Spam-Score: -0.7 (/) X-Debbugs-Envelope-To: 37868 Cc: Danny Milosavljevic X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -1.7 (-) Danny Milosavljevic (2): build-system/linux-module: Disable depmod. system: Add kernel-module-packages to operating-system. gnu/system.scm | 26 ++++++-- guix/build/linux-module-build-system.scm | 5 +- guix/profiles.scm | 76 +++++++++++++++++++++++- 3 files changed, 99 insertions(+), 8 deletions(-) From debbugs-submit-bounces@debbugs.gnu.org Tue Feb 18 04:42:21 2020 Received: (at 37868) by debbugs.gnu.org; 18 Feb 2020 09:42:21 +0000 Received: from localhost ([127.0.0.1]:39561 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1j3zOW-0000DJ-Sk for submit@debbugs.gnu.org; Tue, 18 Feb 2020 04:42:21 -0500 Received: from dd26836.kasserver.com ([85.13.145.193]:59840) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1j3zOU-0000Cy-UY for 37868@debbugs.gnu.org; Tue, 18 Feb 2020 04:42:19 -0500 Received: from dayas.lan (80-110-118-191.cgn.dynamic.surfer.at [80.110.118.191]) by dd26836.kasserver.com (Postfix) with ESMTPSA id 23C2E3366D24; Tue, 18 Feb 2020 10:42:18 +0100 (CET) From: Danny Milosavljevic To: 37868@debbugs.gnu.org, ludo@gnu.org, Mark H Weaver Subject: [PATCH v2 1/2] build-system/linux-module: Disable depmod. Date: Tue, 18 Feb 2020 10:42:06 +0100 Message-Id: <20200218094207.6196-2-dannym@scratchpost.org> X-Mailer: git-send-email 2.23.0 In-Reply-To: <20200218094207.6196-1-dannym@scratchpost.org> References: <20191112172048.61ba69eb@scratchpost.org> <20200218094207.6196-1-dannym@scratchpost.org> MIME-Version: 1.0 Tags: patch Content-Transfer-Encoding: 8bit X-Spam-Score: -0.7 (/) X-Debbugs-Envelope-To: 37868 Cc: Danny Milosavljevic X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -1.7 (-) * guix/build/linux-module-build-system.scm (install): Disable depmod. --- guix/build/linux-module-build-system.scm | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/guix/build/linux-module-build-system.scm b/guix/build/linux-module-build-system.scm index cd76df2de7..525851372e 100644 --- a/guix/build/linux-module-build-system.scm +++ b/guix/build/linux-module-build-system.scm @@ -60,15 +60,14 @@ ;; part. (define* (install #:key inputs native-inputs outputs #:allow-other-keys) (let* ((out (assoc-ref outputs "out")) - (moddir (string-append out "/lib/modules")) - (kmod (assoc-ref (or native-inputs inputs) "kmod"))) + (moddir (string-append out "/lib/modules"))) ;; Install kernel modules (mkdir-p moddir) (invoke "make" "-C" (string-append (assoc-ref inputs "linux-module-builder") "/lib/modules/build") (string-append "M=" (getcwd)) - (string-append "DEPMOD=" kmod "/bin/depmod") + "DEPMOD=true" ; disable depmod. (string-append "MODULE_DIR=" moddir) (string-append "INSTALL_PATH=" out) (string-append "INSTALL_MOD_PATH=" out) From debbugs-submit-bounces@debbugs.gnu.org Tue Feb 18 04:42:24 2020 Received: (at 37868) by debbugs.gnu.org; 18 Feb 2020 09:42:24 +0000 Received: from localhost ([127.0.0.1]:39563 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1j3zOa-0000DY-4J for submit@debbugs.gnu.org; Tue, 18 Feb 2020 04:42:24 -0500 Received: from dd26836.kasserver.com ([85.13.145.193]:59852) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1j3zOV-0000DA-Uf for 37868@debbugs.gnu.org; Tue, 18 Feb 2020 04:42:20 -0500 Received: from dayas.lan (80-110-118-191.cgn.dynamic.surfer.at [80.110.118.191]) by dd26836.kasserver.com (Postfix) with ESMTPSA id 257FE3366D23; Tue, 18 Feb 2020 10:42:19 +0100 (CET) From: Danny Milosavljevic To: 37868@debbugs.gnu.org, ludo@gnu.org, Mark H Weaver Subject: [PATCH v2 2/2] system: Add kernel-module-packages to operating-system. Date: Tue, 18 Feb 2020 10:42:07 +0100 Message-Id: <20200218094207.6196-3-dannym@scratchpost.org> X-Mailer: git-send-email 2.23.0 In-Reply-To: <20200218094207.6196-1-dannym@scratchpost.org> References: <20191112172048.61ba69eb@scratchpost.org> <20200218094207.6196-1-dannym@scratchpost.org> MIME-Version: 1.0 Tags: patch Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Spam-Score: -0.7 (/) X-Debbugs-Envelope-To: 37868 Cc: Danny Milosavljevic X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -1.7 (-) * gnu/system.scm (): Add kernel-module-packages. (operating-system-directory-base-entries): Use it. * guix/profiles.scm (linux-module-database): New procedure. Export it. --- gnu/system.scm | 26 +++++++++++++--- guix/profiles.scm | 76 ++++++++++++++++++++++++++++++++++++++++++++++- 2 files changed, 97 insertions(+), 5 deletions(-) diff --git a/gnu/system.scm b/gnu/system.scm index 01baa248a2..b1cd278044 100644 --- a/gnu/system.scm +++ b/gnu/system.scm @@ -5,6 +5,7 @@ ;;; Copyright © 2016 Chris Marusich ;;; Copyright © 2017 Mathieu Othacehe ;;; Copyright © 2019 Meiyo Peng +;;; Copyright © 2020 Danny Milosavljevic ;;; ;;; This file is part of GNU Guix. ;;; @@ -164,6 +165,8 @@ (kernel operating-system-kernel ; package (default linux-libre)) + (kernel-module-packages operating-system-kernel-module-packages + (default '())) ; list of packages (kernel-arguments operating-system-user-kernel-arguments (default '("quiet"))) ; list of gexps/strings (bootloader operating-system-bootloader) ; @@ -468,10 +471,25 @@ OS." "Return the basic entries of the 'system' directory of OS for use as the value of the SYSTEM-SERVICE-TYPE service." (let ((locale (operating-system-locale-directory os))) - (mlet %store-monad ((kernel -> (operating-system-kernel os)) - (initrd -> (operating-system-initrd-file os)) - (params (operating-system-boot-parameters-file os))) - (return `(("kernel" ,kernel) + (mlet* %store-monad ((kernel -> (operating-system-kernel os)) + (kernel-module-packages -> + (operating-system-kernel-module-packages os)) + (kernel* + (if (null? kernel-module-packages) + kernel + (profile-derivation + (packages->manifest + (cons kernel kernel-module-packages)) + #:hooks (list linux-module-database) + #:locales? #f + #:allow-collisions? #f + #:relative-symlinks? #t + ; TODO: system, target. + #:system #f + #:target #f))) + (initrd -> (operating-system-initrd-file os)) + (params (operating-system-boot-parameters-file os))) + (return `(("kernel" ,kernel*) ("parameters" ,params) ("initrd" ,initrd) ("locale" ,locale)))))) ;used by libc diff --git a/guix/profiles.scm b/guix/profiles.scm index 0d38b2513f..3e25cd7639 100644 --- a/guix/profiles.scm +++ b/guix/profiles.scm @@ -10,6 +10,7 @@ ;;; Copyright © 2017 Maxim Cournoyer ;;; Copyright © 2019 Kyle Meyer ;;; Copyright © 2019 Mathieu Othacehe +;;; Copyright © 2020 Danny Milosavljevic ;;; ;;; This file is part of GNU Guix. ;;; @@ -139,7 +140,9 @@ %current-profile ensure-profile-directory canonicalize-profile - user-friendly-profile)) + user-friendly-profile + + linux-module-database)) ;;; Commentary: ;;; @@ -1137,6 +1140,77 @@ for both major versions of GTK+." (hook . gtk-im-modules))) (return #f))))) +(define (linux-module-database manifest) + (mlet %store-monad + ((kmod (manifest-lookup-package manifest "kmod"))) + (define build + (with-imported-modules '((guix build utils) + (guix build union)) + #~(begin + (use-modules (srfi srfi-1) + (srfi srfi-26) + (guix build utils) + (guix build union) + (ice-9 ftw) + (ice-9 match)) + (let* ((inputs '#$(manifest-inputs manifest)) + (input-files (lambda (path) + (filter file-exists? + (map (cut string-append <> path) inputs)))) + (module-directories (input-files "/lib/modules")) + (System.maps (input-files "/System.map")) + (Module.symverss (input-files "/Module.symvers")) + (directory-entries (lambda (directory-name) + (filter (lambda (basename) + (not (string-prefix? "." + basename))) + (scandir directory-name)))) + ;; Note: Should result in one entry. + (versions (append-map directory-entries module-directories))) + ;; TODO: if len(module-directories) == 1: return module-directories[0] + (mkdir-p (string-append #$output "/lib/modules")) + ;; Iterate over each kernel version directory (usually one). + (for-each (lambda (version) + (let ((destination-directory (string-append #$output "/lib/modules/" version))) + (when (not (file-exists? destination-directory)) ; unique + (union-build destination-directory + ;; All directories with the same version as us. + (filter-map (lambda (directory-name) + (if (member version + (directory-entries directory-name)) + (string-append directory-name "/" version) + #f)) + module-directories) + #:create-all-directories? #t) + ;; Delete generated files (they will be recreated shortly). + (for-each (lambda (basename) + (when (string-prefix? "modules." basename) + (false-if-file-not-found + (delete-file + (string-append + destination-directory "/" + basename))))) + (directory-entries destination-directory)) + (unless (zero? (system* (string-append #$kmod "/bin/depmod") + "-e" ; Report symbols that aren't supplied + "-w" ; Warn on duplicates + "-b" #$output ; destination-directory + "-F" (match System.maps + ((x) x)) + "-E" (match Module.symverss + ((x) x)) + version)) + (display "FAILED\n" (current-error-port)) + (exit #f))))) + versions) + (exit #t))))) + (gexp->derivation "linux-module-database" build + #:local-build? #t + #:substitutable? #f + #:properties + `((type . profile-hook) + (hook . linux-module-database))))) + (define (xdg-desktop-database manifest) "Return a derivation that builds the @file{mimeinfo.cache} database from desktop files. It's used to query what applications can handle a given From debbugs-submit-bounces@debbugs.gnu.org Tue Feb 18 07:31:58 2020 Received: (at submit) by debbugs.gnu.org; 18 Feb 2020 12:31:58 +0000 Received: from localhost ([127.0.0.1]:39612 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1j422f-0005rb-TE for submit@debbugs.gnu.org; Tue, 18 Feb 2020 07:31:58 -0500 Received: from lists.gnu.org ([209.51.188.17]:33916) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1j422e-0005qg-Pl for submit@debbugs.gnu.org; Tue, 18 Feb 2020 07:31:57 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]:37455) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1j422d-0006ME-Ot for guix-patches@gnu.org; Tue, 18 Feb 2020 07:31:56 -0500 X-Spam-Checker-Version: SpamAssassin 3.3.2 (2011-06-06) on eggs.gnu.org X-Spam-Level: X-Spam-Status: No, score=0.8 required=5.0 tests=BAYES_50,FREEMAIL_FROM, URIBL_BLOCKED autolearn=disabled version=3.3.2 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1j422c-0002TU-KP for guix-patches@gnu.org; Tue, 18 Feb 2020 07:31:55 -0500 Received: from mail-wr1-x443.google.com ([2a00:1450:4864:20::443]:41655) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1j422a-0002Rv-HC; Tue, 18 Feb 2020 07:31:52 -0500 Received: by mail-wr1-x443.google.com with SMTP id c9so23733117wrw.8; Tue, 18 Feb 2020 04:31:52 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=references:user-agent:from:to:cc:subject:in-reply-to:date :message-id:mime-version; bh=zGrGrHPmdytSyNCviw2x4NoXD6aSDWCseQbivaQ9E1g=; b=ZMwWwz3J7mMliDa2jw/68X0EM377UGOzDRLWc0L5h2OC/KEEonwBOND+8FmdS1tXQ4 0M/KB1aHUlN8NyGzRSRtusBObnrQbdPshdy5a2NOdBwOeSwUQazd4EMEWfjjxfEihPI6 nGUjG3a4M/tg6EcaImBWdq7LyiEqUhx772INMk9gK2jO/xkfoyqwcfAVbErn6kcfH1oX mdxmEQ0wL7QaSaPmu0m1C8+K7BFHTDrAFBYdgd+EyIo9XaahS5Jf2Z9TsHyOlkISDy3Z iW80u89/Ejt+5R3XtHk9tgXdUpydL0/yYjJjlA7YRy/EDFuicHHKyH0N4gd1OOMr4+t6 jQCA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:references:user-agent:from:to:cc:subject :in-reply-to:date:message-id:mime-version; bh=zGrGrHPmdytSyNCviw2x4NoXD6aSDWCseQbivaQ9E1g=; b=nV3DleQ/NfQi9dMLAUC8RMfn7tYLFD8DXxBuvbyX48/Gg4mSKQNlR0tGYoQsiUHzuZ XKKsHubQPgYcX7u53/1h1JPs7akCPDO/kVG/5MSk516WFlFIUo7LB/Uw4u7KFW0SYEYL JlJa/cqJ4wq5fwhdlasyvYcN4Nwm9bmxRoYES+Eh+TKLh7lj8lCXuBbHnWoBx5EQh7UU PyeneZMZjTJzTNwpFmt+dcWHjH5JPzfEZRfS6Ys9qcX/0SYR+bCEEENQl6NebGdE5MSf 7mmaWSFDMsGM2FpzFmqD0X/GLXsyXXbcXDfq8q5l+7fuf1ojcaMf1664YMhm8SO7P+7x pSig== X-Gm-Message-State: APjAAAW4g5rZFZziXF3kV6DzrGm/4YpKHF8PiBd4zpBeumJ0NeNLPdjs dmQFsyisVL5jv3aMkAS65Mo= X-Google-Smtp-Source: APXvYqyso/AinrVhXGEO+kh7DLIPhPl0E2rcwdpY7wza1WvWawfcpx2EfP8oQjFScJ79Gd9Fq6Bwgg== X-Received: by 2002:adf:ffc5:: with SMTP id x5mr29363920wrs.92.1582029110778; Tue, 18 Feb 2020 04:31:50 -0800 (PST) Received: from meru (lfbn-ann-1-292-23.w86-200.abo.wanadoo.fr. [86.200.245.23]) by smtp.gmail.com with ESMTPSA id g15sm5810339wro.65.2020.02.18.04.31.49 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 18 Feb 2020 04:31:50 -0800 (PST) References: <20191112172048.61ba69eb@scratchpost.org> <20200218094207.6196-1-dannym@scratchpost.org> <20200218094207.6196-3-dannym@scratchpost.org> User-agent: mu4e 1.2.0; emacs 26.3 From: Mathieu Othacehe To: guix-patches@gnu.org Subject: Re: [bug#37868] [PATCH v2 2/2] system: Add kernel-module-packages to operating-system. In-reply-to: <20200218094207.6196-3-dannym@scratchpost.org> Date: Tue, 18 Feb 2020 13:31:49 +0100 Message-ID: <87pnecnkju.fsf@gmail.com> MIME-Version: 1.0 Content-Type: text/plain X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 2a00:1450:4864:20::443 X-Spam-Score: 0.3 (/) X-Debbugs-Envelope-To: submit Cc: Mark H Weaver , ludo@gnu.org, Danny Milosavljevic , 37868@debbugs.gnu.org X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -0.7 (/) Hello Danny, Thanks for this patch! A few remarks below. > + ; TODO: system, target. > + #:system #f > + #:target #f))) We need to figure out what #:system and #:target to pass, otherwise it will break system compilation with --system and --target. This is somehow linked to this thread[1]. > +(define (linux-module-database manifest) This is a rather long and over 80 columns procedure. Maybe you should consider split it into several functions. > + (display "FAILED\n" (current-error-port)) This could be more specific and would need to be translated. Mathieu [1]: https://lists.gnu.org/archive/html/guix-patches/2019-12/msg00416.html From debbugs-submit-bounces@debbugs.gnu.org Sun Feb 23 11:22:12 2020 Received: (at 37868) by debbugs.gnu.org; 23 Feb 2020 16:22:12 +0000 Received: from localhost ([127.0.0.1]:51524 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1j5u1E-00088d-82 for submit@debbugs.gnu.org; Sun, 23 Feb 2020 11:22:12 -0500 Received: from eggs.gnu.org ([209.51.188.92]:44257) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1j5u1B-00088R-Hl for 37868@debbugs.gnu.org; Sun, 23 Feb 2020 11:22:10 -0500 Received: from fencepost.gnu.org ([2001:470:142:3::e]:38646) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1j5u16-0001nW-60; Sun, 23 Feb 2020 11:22:04 -0500 Received: from [2a01:e0a:1d:7270:af76:b9b:ca24:c465] (port=47928 helo=ribbon) by fencepost.gnu.org with esmtpsa (TLS1.2:RSA_AES_256_CBC_SHA1:256) (Exim 4.82) (envelope-from ) id 1j5u15-0001U2-Hx; Sun, 23 Feb 2020 11:22:03 -0500 From: =?utf-8?Q?Ludovic_Court=C3=A8s?= To: Danny Milosavljevic Subject: Re: [PATCH v2 1/2] build-system/linux-module: Disable depmod. References: <20191112172048.61ba69eb@scratchpost.org> <20200218094207.6196-1-dannym@scratchpost.org> <20200218094207.6196-2-dannym@scratchpost.org> X-URL: http://www.fdn.fr/~lcourtes/ X-Revolutionary-Date: 5 =?utf-8?Q?Vent=C3=B4se?= an 228 de la =?utf-8?Q?R?= =?utf-8?Q?=C3=A9volution?= X-PGP-Key-ID: 0x090B11993D9AEBB5 X-PGP-Key: http://www.fdn.fr/~lcourtes/ludovic.asc X-PGP-Fingerprint: 3CE4 6455 8A84 FDC6 9DB4 0CFB 090B 1199 3D9A EBB5 X-OS: x86_64-pc-linux-gnu Date: Sun, 23 Feb 2020 17:22:02 +0100 In-Reply-To: <20200218094207.6196-2-dannym@scratchpost.org> (Danny Milosavljevic's message of "Tue, 18 Feb 2020 10:42:06 +0100") Message-ID: <87ftf1s28l.fsf@gnu.org> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/26.3 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Spam-Score: -0.7 (/) X-Debbugs-Envelope-To: 37868 Cc: Mark H Weaver , 37868@debbugs.gnu.org X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -1.7 (-) Hi Danny, Danny Milosavljevic skribis: > * guix/build/linux-module-build-system.scm (install): Disable depmod. [...] > - (string-append "DEPMOD=3D" kmod "/bin/depmod") > + "DEPMOD=3Dtrue" ; disable depmod. Could you make the comment something like: ;; Disable depmod because X and Y. Think of our future selves. :-) Otherwise LGTM. Ludo=E2=80=99. From debbugs-submit-bounces@debbugs.gnu.org Sun Feb 23 11:36:50 2020 Received: (at 37868) by debbugs.gnu.org; 23 Feb 2020 16:36:50 +0000 Received: from localhost ([127.0.0.1]:51533 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1j5uFN-00007q-QJ for submit@debbugs.gnu.org; Sun, 23 Feb 2020 11:36:50 -0500 Received: from eggs.gnu.org ([209.51.188.92]:45414) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1j5uFM-00007Z-RH for 37868@debbugs.gnu.org; Sun, 23 Feb 2020 11:36:49 -0500 Received: from fencepost.gnu.org ([2001:470:142:3::e]:38904) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1j5uFH-0002fB-FK; Sun, 23 Feb 2020 11:36:43 -0500 Received: from [2a01:e0a:1d:7270:af76:b9b:ca24:c465] (port=47932 helo=ribbon) by fencepost.gnu.org with esmtpsa (TLS1.2:RSA_AES_256_CBC_SHA1:256) (Exim 4.82) (envelope-from ) id 1j5uFH-0005lC-0q; Sun, 23 Feb 2020 11:36:43 -0500 From: =?utf-8?Q?Ludovic_Court=C3=A8s?= To: Danny Milosavljevic Subject: Re: [PATCH v2 2/2] system: Add kernel-module-packages to operating-system. References: <20191112172048.61ba69eb@scratchpost.org> <20200218094207.6196-1-dannym@scratchpost.org> <20200218094207.6196-3-dannym@scratchpost.org> X-URL: http://www.fdn.fr/~lcourtes/ X-Revolutionary-Date: 5 =?utf-8?Q?Vent=C3=B4se?= an 228 de la =?utf-8?Q?R?= =?utf-8?Q?=C3=A9volution?= X-PGP-Key-ID: 0x090B11993D9AEBB5 X-PGP-Key: http://www.fdn.fr/~lcourtes/ludovic.asc X-PGP-Fingerprint: 3CE4 6455 8A84 FDC6 9DB4 0CFB 090B 1199 3D9A EBB5 X-OS: x86_64-pc-linux-gnu Date: Sun, 23 Feb 2020 17:36:40 +0100 In-Reply-To: <20200218094207.6196-3-dannym@scratchpost.org> (Danny Milosavljevic's message of "Tue, 18 Feb 2020 10:42:07 +0100") Message-ID: <875zfxs1k7.fsf@gnu.org> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/26.3 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Spam-Score: -0.7 (/) X-Debbugs-Envelope-To: 37868 Cc: Mark H Weaver , 37868@debbugs.gnu.org X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -1.7 (-) Danny Milosavljevic skribis: > * gnu/system.scm (): Add kernel-module-packages. > (operating-system-directory-base-entries): Use it. > * guix/profiles.scm (linux-module-database): New procedure. Export it. [...] > + (kernel-module-packages operating-system-kernel-module-packages > + (default '())) ; list of packages Technically we don=E2=80=99t require them to be objects, right? = Any lowerable object, like , would work? Thus, I=E2=80=99d be tempted to remove =E2=80=9Cpackages=E2=80=9D from the = field name. =E2=80=98kernel-modules=E2=80=99 is not a good idea because one may assume = it=E2=80=99s a list of .ko file names. Perhaps =E2=80=98kernel-loadable-modules=E2=80=99? Could you also add an entry in guix.texi? > + (mlet* %store-monad ((kernel -> (operating-system-kernel os)) > + (kernel-module-packages -> > + (operating-system-kernel-module-packages os)) Please use short names for local variables; =E2=80=98modules=E2=80=99 is en= ough here. > + (kernel* s/kernel*/kernel/ since there=E2=80=99s no ambiguity. > + (if (null? kernel-module-packages) > + kernel > + (profile-derivation > + (packages->manifest > + (cons kernel kernel-module-packages)) > + #:hooks (list linux-module-database) > + #:locales? #f > + #:allow-collisions? #f > + #:relative-symlinks? #t > + ; TODO: system, target. > + #:system #f > + #:target #f))) You can omit the =E2=80=98null?=E2=80=99 case. Also, rather leave out #:sy= stem and #:target so that they take their default value. > +(define (linux-module-database manifest) > + (mlet %store-monad > + ((kmod (manifest-lookup-package manifest "kmod"))) Please add a docstring and make the =E2=80=98mlet=E2=80=99 a single line. > + (define build > + (with-imported-modules '((guix build utils) > + (guix build union)) > + #~(begin > + (use-modules (srfi srfi-1) > + (srfi srfi-26) > + (guix build utils) > + (guix build union) > + (ice-9 ftw) > + (ice-9 match)) > + (let* ((inputs '#$(manifest-inputs manifest)) > + (input-files (lambda (path) > + (filter file-exists? > + (map (cut string-append <> path) input= s)))) s/path/file/ + use of =E2=80=98filter-map=E2=80=99 > + (module-directories (input-files "/lib/modules")) > + (System.maps (input-files "/System.map")) > + (Module.symverss (input-files "/Module.symvers")) ^ Typo. Also perhaps just =E2=80=98maps-file=E2=80=99 and =E2=80=98symvers-file=E2= =80=99. > + (directory-entries (lambda (directory-name) > + (filter (lambda (basename) > + (not (string-prefix? "." > + ba= sename))) > + (scandir directory-name))= )) > + ;; Note: Should result in one entry. > + (versions (append-map directory-entries module-director= ies))) > + ;; TODO: if len(module-directories) =3D=3D 1: return modul= e-directories[0] > + (mkdir-p (string-append #$output "/lib/modules")) > + ;; Iterate over each kernel version directory (usually one= ). > + (for-each (lambda (version) > + (let ((destination-directory (string-append #$= output "/lib/modules/" version))) > + (when (not (file-exists? destination-directo= ry)) ; unique > + (union-build destination-directory > + ;; All directories with the s= ame version as us. > + (filter-map (lambda (director= y-name) > + (if (member ver= sion > + (di= rectory-entries directory-name)) > + (string-app= end directory-name "/" version) > + #f)) > + module-directorie= s) > + #:create-all-directories? #t) > + ;; Delete generated files (they will be re= created shortly). > + (for-each (lambda (basename) > + (when (string-prefix? "modules= ." basename) > + (false-if-file-not-found > + (delete-file > + (string-append > + destination-directory "/" > + basename))))) > + (directory-entries destination-d= irectory)) > + (unless (zero? (system* (string-append #$k= mod "/bin/depmod") > + "-e" ; Report symb= ols that aren't supplied > + "-w" ; Warn on dup= licates > + "-b" #$output ; de= stination-directory > + "-F" (match System= .maps > + ((x) x)) > + "-E" (match Module= .symverss > + ((x) x)) > + version)) > + (display "FAILED\n" (current-error-port)) > + (exit #f))))) Like Mathieu wrote, I think this should be shortened and/or decomposed in several functions, with all the effects (=E2=80=98for-each=E2=80=99, =E2= =80=98when=E2=80=99, =E2=80=98unless=E2=80=99) happening at the very end. I wonder what=E2=80=99s missing form (gnu build linux-modules) to do the =E2=80=9Cdepmod=E2=80=9D bit entirely in Scheme. It would be nice for seve= ral reasons, one of which is that we wouldn=E2=80=99t need the =E2=80=98manifest-lookup-= package=E2=80=99 hack, which in turn would allow us to keep this procedure out of (guix profiles). Thoughts? Ludo=E2=80=99. From debbugs-submit-bounces@debbugs.gnu.org Mon Feb 24 11:18:25 2020 Received: (at 37868) by debbugs.gnu.org; 24 Feb 2020 16:18:25 +0000 Received: from localhost ([127.0.0.1]:53979 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1j6GR7-0006o5-3g for submit@debbugs.gnu.org; Mon, 24 Feb 2020 11:18:25 -0500 Received: from dd26836.kasserver.com ([85.13.145.193]:59232) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1j6GR5-0006nv-CW for 37868@debbugs.gnu.org; Mon, 24 Feb 2020 11:18:24 -0500 Received: from localhost (guest17.ersteit.com [213.150.31.17]) by dd26836.kasserver.com (Postfix) with ESMTPSA id C4ADE3360724; Mon, 24 Feb 2020 17:18:21 +0100 (CET) Date: Mon, 24 Feb 2020 17:18:18 +0100 From: Danny Milosavljevic To: Ludovic =?ISO-8859-1?Q?Court=E8s?= Subject: Re: [PATCH v2 2/2] system: Add kernel-module-packages to operating-system. Message-ID: <20200224171818.039a4cef@scratchpost.org> In-Reply-To: <875zfxs1k7.fsf@gnu.org> References: <20191112172048.61ba69eb@scratchpost.org> <20200218094207.6196-1-dannym@scratchpost.org> <20200218094207.6196-3-dannym@scratchpost.org> <875zfxs1k7.fsf@gnu.org> X-Mailer: Claws Mail 3.17.3 (GTK+ 2.24.32; x86_64-unknown-linux-gnu) MIME-Version: 1.0 Content-Type: multipart/signed; boundary="Sig_/qy1.JLJrwy6SnXA9jGh6V=l"; protocol="application/pgp-signature"; micalg=pgp-sha256 X-Spam-Score: -0.7 (/) X-Debbugs-Envelope-To: 37868 Cc: Mark H Weaver , 37868@debbugs.gnu.org X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -1.7 (-) --Sig_/qy1.JLJrwy6SnXA9jGh6V=l Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable Hi Ludo, On Sun, 23 Feb 2020 17:36:40 +0100 Ludovic Court=C3=A8s wrote: > Could you also add an entry in guix.texi? OK! > > + (module-directories (input-files "/lib/modules")) > > + (System.maps (input-files "/System.map")) > > + (Module.symverss (input-files "/Module.symvers")) =20 > ^ > Typo. Not really. The file is called "Module.symvers" and those are multiple "Module.symvers"s. It's my naming convention for lists. If we don't want that then I can change it here. > I wonder what=E2=80=99s missing form (gnu build linux-modules) to do the > =E2=80=9Cdepmod=E2=80=9D bit entirely in Scheme. Probably not a lot, but there are quite a few binary cache files (.bin) generated by depmod and not by us--not sure whether we want to replicate that complexity given the problems we had even with the initrd stuff. I'm not sure whether those bin files are mandatory or optional to have. > It would be nice for several reasons, > one of which is that we wouldn=E2=80=99t need the =E2=80=98manifest-looku= p-package=E2=80=99 > hack, which in turn would allow us to keep this procedure out of (guix > profiles). Yeah. --Sig_/qy1.JLJrwy6SnXA9jGh6V=l Content-Type: application/pgp-signature Content-Description: OpenPGP digital signature -----BEGIN PGP SIGNATURE----- iQEzBAEBCAAdFiEEds7GsXJ0tGXALbPZ5xo1VCwwuqUFAl5T90oACgkQ5xo1VCww uqX/yQf/b4V7ynuhS+QbYuS4QaJJDw1GAX0RKEBHa4UFEu+uxq3tNVaGqg/Cd2ni nVprw/XLavSn/nrBkXlinegsptagdX9XeJmDkXMu2YLLIIWfQ7ysY50rhzP2nKjD NS7H3aljNC7yUFc+QhL2xC2b+kAypRAG2i67BlPhe8NX4mxs2pV3XCvcqt0jUYKe 117U9Zs34puBUJkcvY2GtG3PT6HkC2W58QuXkYZunByus2xGGoBw2i7QQhT3ftZU q3/VI3lMrUhYjkWA/LsG1sTnL/Qjc5ucG94CjSTB2mH9nwb/AN8PS4C3nLI077+G QhN2uRnHLAtPm1opOzFvjgl74jgEDA== =GcAL -----END PGP SIGNATURE----- --Sig_/qy1.JLJrwy6SnXA9jGh6V=l-- From debbugs-submit-bounces@debbugs.gnu.org Tue Feb 25 05:11:54 2020 Received: (at 37868) by debbugs.gnu.org; 25 Feb 2020 10:11:54 +0000 Received: from localhost ([127.0.0.1]:54439 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1j6XBx-0002kz-Qi for submit@debbugs.gnu.org; Tue, 25 Feb 2020 05:11:53 -0500 Received: from dd26836.kasserver.com ([85.13.145.193]:57830) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1j6XBw-0002kq-0f for 37868@debbugs.gnu.org; Tue, 25 Feb 2020 05:11:52 -0500 Received: from localhost (80-110-118-191.cgn.dynamic.surfer.at [80.110.118.191]) by dd26836.kasserver.com (Postfix) with ESMTPSA id 8C5EF3360650; Tue, 25 Feb 2020 11:11:49 +0100 (CET) Date: Tue, 25 Feb 2020 11:11:48 +0100 From: Danny Milosavljevic To: Ludovic =?ISO-8859-1?Q?Court=E8s?= Subject: Re: [PATCH v2 1/2] build-system/linux-module: Disable depmod. Message-ID: <20200225111148.485e6c38@scratchpost.org> In-Reply-To: <87ftf1s28l.fsf@gnu.org> References: <20191112172048.61ba69eb@scratchpost.org> <20200218094207.6196-1-dannym@scratchpost.org> <20200218094207.6196-2-dannym@scratchpost.org> <87ftf1s28l.fsf@gnu.org> X-Mailer: Claws Mail 3.17.3 (GTK+ 2.24.32; x86_64-unknown-linux-gnu) MIME-Version: 1.0 Content-Type: multipart/signed; boundary="Sig_/ZlrkTkg/mJPrL9gTsBD5hz."; protocol="application/pgp-signature"; micalg=pgp-sha256 X-Spam-Score: -0.7 (/) X-Debbugs-Envelope-To: 37868 Cc: Mark H Weaver , 37868@debbugs.gnu.org X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -1.7 (-) --Sig_/ZlrkTkg/mJPrL9gTsBD5hz. Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: quoted-printable Hi, > [comment] Otherwise LGTM. Pushed only this patch to guix master as commit 12f0aefd1418443823450fdd111= 259269ad3d9cb. Thanks for the review! --Sig_/ZlrkTkg/mJPrL9gTsBD5hz. Content-Type: application/pgp-signature Content-Description: OpenPGP digital signature -----BEGIN PGP SIGNATURE----- iQEzBAEBCAAdFiEEds7GsXJ0tGXALbPZ5xo1VCwwuqUFAl5U8uQACgkQ5xo1VCww uqUZtggAnlKqVPNKD1DgYEDYeN2M1JI7lamINIpDCe9G15dVZQwQf5illEdwBUZm XmclrJTJmMWsQW7pagmmrPz2bKrDUjyIYLggMclQAmICZpxITmJXC1j4kp+hqEej 4wQJGLYI0gQeVMWfXq3dgryza5SxD/ESuitq+KvBlRDGWeojdqvFvEO7ABVbBqSs KI8MvQWC41vGa9aGa+PPndxzSjn0dyaE4ACFiEgpHQCiMWtOw55Wo1yqqxmWtnIh l1cX9aDrt+6oF1rxmSc2KfQlawGH14d6VA7NCk4ewXU2OF5cX1fS2hgifLJku0ZR xYi+XR9DG58/KAATbzSTKw5fazWAfg== =2b6u -----END PGP SIGNATURE----- --Sig_/ZlrkTkg/mJPrL9gTsBD5hz.-- From debbugs-submit-bounces@debbugs.gnu.org Tue Feb 25 05:22:34 2020 Received: (at 37868) by debbugs.gnu.org; 25 Feb 2020 10:22:35 +0000 Received: from localhost ([127.0.0.1]:54447 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1j6XMF-00032M-45 for submit@debbugs.gnu.org; Tue, 25 Feb 2020 05:22:34 -0500 Received: from dd26836.kasserver.com ([85.13.145.193]:58798) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1j6XMA-000329-7J for 37868@debbugs.gnu.org; Tue, 25 Feb 2020 05:22:29 -0500 Received: from dayas.lan (80-110-118-191.cgn.dynamic.surfer.at [80.110.118.191]) by dd26836.kasserver.com (Postfix) with ESMTPSA id DEC213360650; Tue, 25 Feb 2020 11:22:24 +0100 (CET) From: Danny Milosavljevic To: 37868@debbugs.gnu.org, ludo@gnu.org, Mark H Weaver Subject: [PATCH v3] system: Add kernel-module-packages to operating-system. Date: Tue, 25 Feb 2020 11:21:54 +0100 Message-Id: <20200225102154.29415-1-dannym@scratchpost.org> X-Mailer: git-send-email 2.23.0 In-Reply-To: <20200218094207.6196-1-dannym@scratchpost.org> References: <20200218094207.6196-1-dannym@scratchpost.org> MIME-Version: 1.0 Tags: patch Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Spam-Score: -0.7 (/) X-Debbugs-Envelope-To: 37868 Cc: Danny Milosavljevic X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -1.7 (-) * gnu/system.scm (): Add kernel-module-packages. (operating-system-directory-base-entries): Use it. * doc/guix.texi (operating-system Reference): Document KERNEL-LOADABLE-MODULES. * gnu/build/linux-modules.scm (depmod!): New procedure. (ensure-linux-module-directory!): New procedure. Export it. * guix/profiles.scm (linux-module-database): New procedure. Export it. * gnu/tests/linux-modules.scm: New file. * gnu/local.mk (GNU_SYSTEM_MODULES): Add it. --- doc/guix.texi | 3 ++ gnu/build/linux-modules.scm | 53 ++++++++++++++++++- gnu/local.mk | 1 + gnu/system.scm | 20 +++++-- gnu/tests/linux-modules.scm | 102 ++++++++++++++++++++++++++++++++++++ guix/profiles.scm | 49 ++++++++++++++++- 6 files changed, 222 insertions(+), 6 deletions(-) create mode 100644 gnu/tests/linux-modules.scm diff --git a/doc/guix.texi b/doc/guix.texi index a66bb3d646..01e2d1ab57 100644 --- a/doc/guix.texi +++ b/doc/guix.texi @@ -11197,6 +11197,9 @@ The package object of the operating system kernel to use@footnote{Currently only the Linux-libre kernel is supported. In the future, it will be possible to use the GNU@tie{}Hurd.}. +@item @code{kernel-loadable-modules} (default: '()) +A list of objects (usually packages) to collect loadable kernel modules from. + @item @code{kernel-arguments} (default: @code{'("quiet")}) List of strings or gexps representing additional arguments to pass on the command-line of the kernel---e.g., @code{("console=ttyS0")}. diff --git a/gnu/build/linux-modules.scm b/gnu/build/linux-modules.scm index a149eff329..f5f5a0255c 100644 --- a/gnu/build/linux-modules.scm +++ b/gnu/build/linux-modules.scm @@ -22,12 +22,14 @@ #:use-module (guix elf) #:use-module (guix glob) #:use-module (guix build syscalls) - #:use-module ((guix build utils) #:select (find-files)) + #:use-module ((guix build utils) #:select (find-files invoke false-if-file-not-found)) + #:use-module (guix build union) #:use-module (rnrs io ports) #:use-module (rnrs bytevectors) #:use-module (srfi srfi-1) #:use-module (srfi srfi-11) #:use-module (srfi srfi-26) + #:use-module (ice-9 ftw) #:use-module (ice-9 vlist) #:use-module (ice-9 match) #:use-module (ice-9 rdelim) @@ -56,7 +58,9 @@ write-module-name-database write-module-alias-database - write-module-device-database)) + write-module-device-database + + ensure-linux-module-directory!)) ;;; Commentary: ;;; @@ -631,4 +635,49 @@ be loaded on-demand, such as file system modules." module devname type major minor))) aliases)))) +(define (input-files inputs path) + "Given a list of directories INPUTS, return all entries with PATH in it." + ;; TODO: Use filter-map. + (filter file-exists? + (map (lambda (x) + (string-append x path)) + inputs))) + +(define (depmod! kmod inputs destination-directory output version) + (let ((System.maps (input-files inputs "/System.map")) + (Module.symverss (input-files inputs "/Module.symvers"))) + ;; Delete generated files (they will be recreated shortly). + (for-each (lambda (basename) + (when (string-prefix? "modules." basename) + (false-if-file-not-found + (delete-file + (string-append destination-directory "/" basename))))) + (scandir destination-directory)) + (invoke (string-append kmod "/bin/depmod") + "-e" ; Report symbols that aren't supplied + "-w" ; Warn on duplicates + "-b" output + "-F" (match System.maps + ((System.map) System.map)) + "-E" (match Module.symverss + ((Module.symvers) Module.symvers)) + version))) + +(define (ensure-linux-module-directory! inputs output version kmod) + "Ensures that the directory OUTPUT...VERSION can be used by the Linux +kernel to load modules via KMOD. The modules to put into +OUTPUT...VERSION are taken from INPUTS." + (let ((destination-directory (string-append output "/lib/modules/" + version))) + (when (not (file-exists? destination-directory)) ; unique + (union-build destination-directory + ;; All directories with the same version as us. + (filter-map (lambda (directory-name) + (if (member version (scandir directory-name)) + (string-append directory-name "/" version) + #f)) + (input-files inputs "/lib/modules")) + #:create-all-directories? #t) + (depmod! kmod inputs destination-directory output version)))) + ;;; linux-modules.scm ends here diff --git a/gnu/local.mk b/gnu/local.mk index 857345cfad..b25c3ceea5 100644 --- a/gnu/local.mk +++ b/gnu/local.mk @@ -631,6 +631,7 @@ GNU_SYSTEM_MODULES = \ %D%/tests/nfs.scm \ %D%/tests/install.scm \ %D%/tests/ldap.scm \ + %D%/tests/linux-modules.scm \ %D%/tests/mail.scm \ %D%/tests/messaging.scm \ %D%/tests/networking.scm \ diff --git a/gnu/system.scm b/gnu/system.scm index 01baa248a2..17b6e667d5 100644 --- a/gnu/system.scm +++ b/gnu/system.scm @@ -5,6 +5,7 @@ ;;; Copyright © 2016 Chris Marusich ;;; Copyright © 2017 Mathieu Othacehe ;;; Copyright © 2019 Meiyo Peng +;;; Copyright © 2020 Danny Milosavljevic ;;; ;;; This file is part of GNU Guix. ;;; @@ -164,6 +165,8 @@ (kernel operating-system-kernel ; package (default linux-libre)) + (kernel-loadable-modules operating-system-kernel-loadable-modules + (default '())) ; list of packages (kernel-arguments operating-system-user-kernel-arguments (default '("quiet"))) ; list of gexps/strings (bootloader operating-system-bootloader) ; @@ -468,9 +471,20 @@ OS." "Return the basic entries of the 'system' directory of OS for use as the value of the SYSTEM-SERVICE-TYPE service." (let ((locale (operating-system-locale-directory os))) - (mlet %store-monad ((kernel -> (operating-system-kernel os)) - (initrd -> (operating-system-initrd-file os)) - (params (operating-system-boot-parameters-file os))) + (mlet* %store-monad ((kernel -> (operating-system-kernel os)) + (modules -> + (operating-system-kernel-loadable-modules os)) + (kernel + ;; TODO: system, target. + (profile-derivation + (packages->manifest + (cons kernel modules)) + #:hooks (list linux-module-database) + #:locales? #f + #:allow-collisions? #f + #:relative-symlinks? #t)) + (initrd -> (operating-system-initrd-file os)) + (params (operating-system-boot-parameters-file os))) (return `(("kernel" ,kernel) ("parameters" ,params) ("initrd" ,initrd) diff --git a/gnu/tests/linux-modules.scm b/gnu/tests/linux-modules.scm new file mode 100644 index 0000000000..f0e92f5c8f --- /dev/null +++ b/gnu/tests/linux-modules.scm @@ -0,0 +1,102 @@ +;;; GNU Guix --- Functional package management for GNU +;;; Copyright © 2019 Jakob L. Kreuze +;;; +;;; This file is part of GNU Guix. +;;; +;;; GNU Guix is free software; you can redistribute it and/or modify it +;;; under the terms of the GNU General Public License as published by +;;; the Free Software Foundation; either version 3 of the License, or (at +;;; your option) any later version. +;;; +;;; GNU Guix is distributed in the hope that it will be useful, but +;;; WITHOUT ANY WARRANTY; without even the implied warranty of +;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +;;; GNU General Public License for more details. +;;; +;;; You should have received a copy of the GNU General Public License +;;; along with GNU Guix. If not, see . + +(define-module (gnu tests linux-modules) + #:use-module (gnu packages linux) + #:use-module (gnu system) + #:use-module (gnu system vm) + #:use-module (gnu tests) + #:use-module (guix derivations) + #:use-module (guix gexp) + #:use-module (guix modules) + #:use-module (guix monads) + #:use-module (guix store) + #:export (%test-loadable-kernel-modules-0 + %test-loadable-kernel-modules-1 + %test-loadable-kernel-modules-2)) + +;;; Commentary: +;;; +;;; Test in-place system reconfiguration: advancing the system generation on a +;;; running instance of the Guix System. +;;; +;;; Code: + +(define* (module-loader-program os modules) + "Return an executable store item that, upon being evaluated, will dry-run +load MODULES." + (program-file + "load-kernel-modules.scm" + (with-imported-modules (source-module-closure '((guix build utils))) + #~(begin + (use-modules (guix build utils)) + (for-each (lambda (module) + (invoke (string-append #$kmod "/bin/modprobe") "-n" "--" module)) + '#$modules))))) + +(define* (run-loadable-kernel-modules-test module-packages module-names) + "Run a test of an OS having MODULE-PACKAGES, and modprobe MODULE-NAMES." + (define os + (marionette-operating-system + (operating-system + (inherit (simple-operating-system)) + (kernel-loadable-modules module-packages)) + #:imported-modules '((guix combinators)))) + (define vm (virtual-machine os)) + (define (test script) + (with-imported-modules '((gnu build marionette)) + #~(begin + (use-modules (gnu build marionette) + (srfi srfi-64)) + (define marionette + (make-marionette (list #$vm))) + (mkdir #$output) + (chdir #$output) + (test-begin "loadable-kernel-modules") + (test-assert "script successfully evaluated" + (marionette-eval + '(primitive-load #$script) + marionette)) + (test-end) + (exit (= (test-runner-fail-count (test-runner-current)) 0))))) + (gexp->derivation "loadable-kernel-modules" (test (module-loader-program os module-names)))) + +(define %test-loadable-kernel-modules-0 + (system-test + (name "loadable-kernel-modules-0") + (description "Tests loadable kernel modules facility of +with no extra modules.") + (value (run-loadable-kernel-modules-test '() '())))) + +(define %test-loadable-kernel-modules-1 + (system-test + (name "loadable-kernel-modules-1") + (description "Tests loadable kernel modules facility of +with one extra module.") + (value (run-loadable-kernel-modules-test + (list ddcci-driver-linux) + '("ddcci"))))) + +(define %test-loadable-kernel-modules-2 + (system-test + (name "loadable-kernel-modules-2") + (description "Tests loadable kernel modules facility of +with two extra modules.") + (value (run-loadable-kernel-modules-test + (list acpi-call-linux-module ddcci-driver-linux) + '("acpi_call" "ddcci"))))) diff --git a/guix/profiles.scm b/guix/profiles.scm index 0d38b2513f..5274a7f5c2 100644 --- a/guix/profiles.scm +++ b/guix/profiles.scm @@ -10,6 +10,7 @@ ;;; Copyright © 2017 Maxim Cournoyer ;;; Copyright © 2019 Kyle Meyer ;;; Copyright © 2019 Mathieu Othacehe +;;; Copyright © 2020 Danny Milosavljevic ;;; ;;; This file is part of GNU Guix. ;;; @@ -139,7 +140,9 @@ %current-profile ensure-profile-directory canonicalize-profile - user-friendly-profile)) + user-friendly-profile + + linux-module-database)) ;;; Commentary: ;;; @@ -1137,6 +1140,50 @@ for both major versions of GTK+." (hook . gtk-im-modules))) (return #f))))) +;; XXX: Dupe in gnu/build/linux-modules.scm . +(define (input-files inputs path) + "Given a list of directories INPUTS, return all entries with PATH in it." + ;; TODO: Use filter-map. + #~(begin + (use-modules (srfi srfi-1)) + (filter file-exists? + (map (lambda (x) + (string-append x #$path)) + '#$inputs)))) + +(define (linux-module-database manifest) + "Return a derivation that unions all the kernel modules in the manifest +and creates the dependency graph for all these kernel modules." + (mlet %store-monad ((kmod (manifest-lookup-package manifest "kmod"))) + (define build + (with-imported-modules (source-module-closure '((guix build utils) (gnu build linux-modules))) + #~(begin + (use-modules (ice-9 ftw)) + (use-modules (srfi srfi-1)) ; append-map + (use-modules (guix build utils)) ; mkdir-p + (use-modules (gnu build linux-modules)) + (let* ((inputs '#$(manifest-inputs manifest)) + (module-directories #$(input-files (manifest-inputs manifest) "/lib/modules")) + (directory-entries + (lambda (directory-name) + (scandir directory-name (lambda (basename) + (not (string-prefix? "." basename)))))) + ;; Note: Should usually result in one entry. + (versions (append-map directory-entries module-directories))) + ;; TODO: if len(module-directories) == 1: return module-directories[0] + (mkdir-p (string-append #$output "/lib/modules")) + ;; Iterate over each kernel version directory (usually one). + (for-each (lambda (version) + (ensure-linux-module-directory! inputs #$output version #$kmod)) + versions) + (exit #t))))) + (gexp->derivation "linux-module-database" build + #:local-build? #t + #:substitutable? #f + #:properties + `((type . profile-hook) + (hook . linux-module-database))))) + (define (xdg-desktop-database manifest) "Return a derivation that builds the @file{mimeinfo.cache} database from desktop files. It's used to query what applications can handle a given From debbugs-submit-bounces@debbugs.gnu.org Tue Feb 25 05:56:09 2020 Received: (at 37868) by debbugs.gnu.org; 25 Feb 2020 10:56:09 +0000 Received: from localhost ([127.0.0.1]:54471 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1j6Xsj-0003qY-Pt for submit@debbugs.gnu.org; Tue, 25 Feb 2020 05:56:09 -0500 Received: from dd26836.kasserver.com ([85.13.145.193]:33426) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1j6Xse-0003q2-KK for 37868@debbugs.gnu.org; Tue, 25 Feb 2020 05:56:04 -0500 Received: from dayas.lan (80-110-118-191.cgn.dynamic.surfer.at [80.110.118.191]) by dd26836.kasserver.com (Postfix) with ESMTPSA id F093B33603FF; Tue, 25 Feb 2020 11:55:58 +0100 (CET) From: Danny Milosavljevic To: 37868@debbugs.gnu.org, ludo@gnu.org, Mark H Weaver Subject: [PATCH v4] system: Add kernel-module-packages to operating-system. Date: Tue, 25 Feb 2020 11:55:49 +0100 Message-Id: <20200225105549.30115-1-dannym@scratchpost.org> X-Mailer: git-send-email 2.23.0 In-Reply-To: <20200218094207.6196-1-dannym@scratchpost.org> References: <20200218094207.6196-1-dannym@scratchpost.org> MIME-Version: 1.0 Tags: patch Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Spam-Score: -0.7 (/) X-Debbugs-Envelope-To: 37868 Cc: Danny Milosavljevic X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -1.7 (-) * gnu/system.scm (): Add kernel-module-packages. (operating-system-directory-base-entries): Use it. * doc/guix.texi (operating-system Reference): Document KERNEL-LOADABLE-MODULES. * gnu/build/linux-modules.scm (depmod!): New procedure. (ensure-linux-module-directory!): New procedure. Export it. * guix/profiles.scm (linux-module-database): New procedure. Export it. * gnu/tests/linux-modules.scm: New file. * gnu/local.mk (GNU_SYSTEM_MODULES): Add it. --- doc/guix.texi | 3 ++ gnu/build/linux-modules.scm | 46 +++++++++++++++- gnu/local.mk | 1 + gnu/system.scm | 20 +++++-- gnu/tests/linux-modules.scm | 102 ++++++++++++++++++++++++++++++++++++ guix/profiles.scm | 49 ++++++++++++++++- 6 files changed, 215 insertions(+), 6 deletions(-) create mode 100644 gnu/tests/linux-modules.scm diff --git a/doc/guix.texi b/doc/guix.texi index a66bb3d646..01e2d1ab57 100644 --- a/doc/guix.texi +++ b/doc/guix.texi @@ -11197,6 +11197,9 @@ The package object of the operating system kernel to use@footnote{Currently only the Linux-libre kernel is supported. In the future, it will be possible to use the GNU@tie{}Hurd.}. +@item @code{kernel-loadable-modules} (default: '()) +A list of objects (usually packages) to collect loadable kernel modules from. + @item @code{kernel-arguments} (default: @code{'("quiet")}) List of strings or gexps representing additional arguments to pass on the command-line of the kernel---e.g., @code{("console=ttyS0")}. diff --git a/gnu/build/linux-modules.scm b/gnu/build/linux-modules.scm index a149eff329..004804df36 100644 --- a/gnu/build/linux-modules.scm +++ b/gnu/build/linux-modules.scm @@ -22,12 +22,14 @@ #:use-module (guix elf) #:use-module (guix glob) #:use-module (guix build syscalls) - #:use-module ((guix build utils) #:select (find-files)) + #:use-module ((guix build utils) #:select (find-files invoke false-if-file-not-found)) + #:use-module (guix build union) #:use-module (rnrs io ports) #:use-module (rnrs bytevectors) #:use-module (srfi srfi-1) #:use-module (srfi srfi-11) #:use-module (srfi srfi-26) + #:use-module (ice-9 ftw) #:use-module (ice-9 vlist) #:use-module (ice-9 match) #:use-module (ice-9 rdelim) @@ -56,7 +58,9 @@ write-module-name-database write-module-alias-database - write-module-device-database)) + write-module-device-database + + ensure-linux-module-directory!)) ;;; Commentary: ;;; @@ -631,4 +635,42 @@ be loaded on-demand, such as file system modules." module devname type major minor))) aliases)))) +(define (input-files inputs path) + "Given a list of directories INPUTS, return all entries with PATH in it." + ;; TODO: Use filter-map. + (filter file-exists? + (map (lambda (x) + (string-append x path)) + inputs))) + +(define (depmod! kmod inputs destination-directory output version) + (let ((System.maps (input-files inputs "/System.map")) + (Module.symverss (input-files inputs "/Module.symvers"))) + (invoke (string-append kmod "/bin/depmod") + "-e" ; Report symbols that aren't supplied + "-w" ; Warn on duplicates + "-b" output + "-F" (match System.maps + ((System.map) System.map)) + "-E" (match Module.symverss + ((Module.symvers) Module.symvers)) + version))) + +(define (ensure-linux-module-directory! inputs output version kmod) + "Ensures that the directory OUTPUT...VERSION can be used by the Linux +kernel to load modules via KMOD. The modules to put into +OUTPUT...VERSION are taken from INPUTS." + (let ((destination-directory (string-append output "/lib/modules/" + version))) + (when (not (file-exists? destination-directory)) ; unique + (union-build destination-directory + ;; All directories with the same version as us. + (filter-map (lambda (directory-name) + (if (member version (scandir directory-name)) + (string-append directory-name "/" version) + #f)) + (input-files inputs "/lib/modules")) + #:create-all-directories? #t) + (depmod! kmod inputs destination-directory output version)))) + ;;; linux-modules.scm ends here diff --git a/gnu/local.mk b/gnu/local.mk index 857345cfad..b25c3ceea5 100644 --- a/gnu/local.mk +++ b/gnu/local.mk @@ -631,6 +631,7 @@ GNU_SYSTEM_MODULES = \ %D%/tests/nfs.scm \ %D%/tests/install.scm \ %D%/tests/ldap.scm \ + %D%/tests/linux-modules.scm \ %D%/tests/mail.scm \ %D%/tests/messaging.scm \ %D%/tests/networking.scm \ diff --git a/gnu/system.scm b/gnu/system.scm index 01baa248a2..17b6e667d5 100644 --- a/gnu/system.scm +++ b/gnu/system.scm @@ -5,6 +5,7 @@ ;;; Copyright © 2016 Chris Marusich ;;; Copyright © 2017 Mathieu Othacehe ;;; Copyright © 2019 Meiyo Peng +;;; Copyright © 2020 Danny Milosavljevic ;;; ;;; This file is part of GNU Guix. ;;; @@ -164,6 +165,8 @@ (kernel operating-system-kernel ; package (default linux-libre)) + (kernel-loadable-modules operating-system-kernel-loadable-modules + (default '())) ; list of packages (kernel-arguments operating-system-user-kernel-arguments (default '("quiet"))) ; list of gexps/strings (bootloader operating-system-bootloader) ; @@ -468,9 +471,20 @@ OS." "Return the basic entries of the 'system' directory of OS for use as the value of the SYSTEM-SERVICE-TYPE service." (let ((locale (operating-system-locale-directory os))) - (mlet %store-monad ((kernel -> (operating-system-kernel os)) - (initrd -> (operating-system-initrd-file os)) - (params (operating-system-boot-parameters-file os))) + (mlet* %store-monad ((kernel -> (operating-system-kernel os)) + (modules -> + (operating-system-kernel-loadable-modules os)) + (kernel + ;; TODO: system, target. + (profile-derivation + (packages->manifest + (cons kernel modules)) + #:hooks (list linux-module-database) + #:locales? #f + #:allow-collisions? #f + #:relative-symlinks? #t)) + (initrd -> (operating-system-initrd-file os)) + (params (operating-system-boot-parameters-file os))) (return `(("kernel" ,kernel) ("parameters" ,params) ("initrd" ,initrd) diff --git a/gnu/tests/linux-modules.scm b/gnu/tests/linux-modules.scm new file mode 100644 index 0000000000..f0e92f5c8f --- /dev/null +++ b/gnu/tests/linux-modules.scm @@ -0,0 +1,102 @@ +;;; GNU Guix --- Functional package management for GNU +;;; Copyright © 2019 Jakob L. Kreuze +;;; +;;; This file is part of GNU Guix. +;;; +;;; GNU Guix is free software; you can redistribute it and/or modify it +;;; under the terms of the GNU General Public License as published by +;;; the Free Software Foundation; either version 3 of the License, or (at +;;; your option) any later version. +;;; +;;; GNU Guix is distributed in the hope that it will be useful, but +;;; WITHOUT ANY WARRANTY; without even the implied warranty of +;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +;;; GNU General Public License for more details. +;;; +;;; You should have received a copy of the GNU General Public License +;;; along with GNU Guix. If not, see . + +(define-module (gnu tests linux-modules) + #:use-module (gnu packages linux) + #:use-module (gnu system) + #:use-module (gnu system vm) + #:use-module (gnu tests) + #:use-module (guix derivations) + #:use-module (guix gexp) + #:use-module (guix modules) + #:use-module (guix monads) + #:use-module (guix store) + #:export (%test-loadable-kernel-modules-0 + %test-loadable-kernel-modules-1 + %test-loadable-kernel-modules-2)) + +;;; Commentary: +;;; +;;; Test in-place system reconfiguration: advancing the system generation on a +;;; running instance of the Guix System. +;;; +;;; Code: + +(define* (module-loader-program os modules) + "Return an executable store item that, upon being evaluated, will dry-run +load MODULES." + (program-file + "load-kernel-modules.scm" + (with-imported-modules (source-module-closure '((guix build utils))) + #~(begin + (use-modules (guix build utils)) + (for-each (lambda (module) + (invoke (string-append #$kmod "/bin/modprobe") "-n" "--" module)) + '#$modules))))) + +(define* (run-loadable-kernel-modules-test module-packages module-names) + "Run a test of an OS having MODULE-PACKAGES, and modprobe MODULE-NAMES." + (define os + (marionette-operating-system + (operating-system + (inherit (simple-operating-system)) + (kernel-loadable-modules module-packages)) + #:imported-modules '((guix combinators)))) + (define vm (virtual-machine os)) + (define (test script) + (with-imported-modules '((gnu build marionette)) + #~(begin + (use-modules (gnu build marionette) + (srfi srfi-64)) + (define marionette + (make-marionette (list #$vm))) + (mkdir #$output) + (chdir #$output) + (test-begin "loadable-kernel-modules") + (test-assert "script successfully evaluated" + (marionette-eval + '(primitive-load #$script) + marionette)) + (test-end) + (exit (= (test-runner-fail-count (test-runner-current)) 0))))) + (gexp->derivation "loadable-kernel-modules" (test (module-loader-program os module-names)))) + +(define %test-loadable-kernel-modules-0 + (system-test + (name "loadable-kernel-modules-0") + (description "Tests loadable kernel modules facility of +with no extra modules.") + (value (run-loadable-kernel-modules-test '() '())))) + +(define %test-loadable-kernel-modules-1 + (system-test + (name "loadable-kernel-modules-1") + (description "Tests loadable kernel modules facility of +with one extra module.") + (value (run-loadable-kernel-modules-test + (list ddcci-driver-linux) + '("ddcci"))))) + +(define %test-loadable-kernel-modules-2 + (system-test + (name "loadable-kernel-modules-2") + (description "Tests loadable kernel modules facility of +with two extra modules.") + (value (run-loadable-kernel-modules-test + (list acpi-call-linux-module ddcci-driver-linux) + '("acpi_call" "ddcci"))))) diff --git a/guix/profiles.scm b/guix/profiles.scm index 0d38b2513f..5274a7f5c2 100644 --- a/guix/profiles.scm +++ b/guix/profiles.scm @@ -10,6 +10,7 @@ ;;; Copyright © 2017 Maxim Cournoyer ;;; Copyright © 2019 Kyle Meyer ;;; Copyright © 2019 Mathieu Othacehe +;;; Copyright © 2020 Danny Milosavljevic ;;; ;;; This file is part of GNU Guix. ;;; @@ -139,7 +140,9 @@ %current-profile ensure-profile-directory canonicalize-profile - user-friendly-profile)) + user-friendly-profile + + linux-module-database)) ;;; Commentary: ;;; @@ -1137,6 +1140,50 @@ for both major versions of GTK+." (hook . gtk-im-modules))) (return #f))))) +;; XXX: Dupe in gnu/build/linux-modules.scm . +(define (input-files inputs path) + "Given a list of directories INPUTS, return all entries with PATH in it." + ;; TODO: Use filter-map. + #~(begin + (use-modules (srfi srfi-1)) + (filter file-exists? + (map (lambda (x) + (string-append x #$path)) + '#$inputs)))) + +(define (linux-module-database manifest) + "Return a derivation that unions all the kernel modules in the manifest +and creates the dependency graph for all these kernel modules." + (mlet %store-monad ((kmod (manifest-lookup-package manifest "kmod"))) + (define build + (with-imported-modules (source-module-closure '((guix build utils) (gnu build linux-modules))) + #~(begin + (use-modules (ice-9 ftw)) + (use-modules (srfi srfi-1)) ; append-map + (use-modules (guix build utils)) ; mkdir-p + (use-modules (gnu build linux-modules)) + (let* ((inputs '#$(manifest-inputs manifest)) + (module-directories #$(input-files (manifest-inputs manifest) "/lib/modules")) + (directory-entries + (lambda (directory-name) + (scandir directory-name (lambda (basename) + (not (string-prefix? "." basename)))))) + ;; Note: Should usually result in one entry. + (versions (append-map directory-entries module-directories))) + ;; TODO: if len(module-directories) == 1: return module-directories[0] + (mkdir-p (string-append #$output "/lib/modules")) + ;; Iterate over each kernel version directory (usually one). + (for-each (lambda (version) + (ensure-linux-module-directory! inputs #$output version #$kmod)) + versions) + (exit #t))))) + (gexp->derivation "linux-module-database" build + #:local-build? #t + #:substitutable? #f + #:properties + `((type . profile-hook) + (hook . linux-module-database))))) + (define (xdg-desktop-database manifest) "Return a derivation that builds the @file{mimeinfo.cache} database from desktop files. It's used to query what applications can handle a given From debbugs-submit-bounces@debbugs.gnu.org Tue Feb 25 06:32:54 2020 Received: (at 37868) by debbugs.gnu.org; 25 Feb 2020 11:32:54 +0000 Received: from localhost ([127.0.0.1]:54488 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1j6YSM-0004l0-3g for submit@debbugs.gnu.org; Tue, 25 Feb 2020 06:32:54 -0500 Received: from dd26836.kasserver.com ([85.13.145.193]:36664) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1j6YSJ-0004kq-Dx for 37868@debbugs.gnu.org; Tue, 25 Feb 2020 06:32:52 -0500 Received: from localhost (guest17.ersteit.com [213.150.31.17]) by dd26836.kasserver.com (Postfix) with ESMTPSA id 4CB9D3360623; Tue, 25 Feb 2020 12:32:48 +0100 (CET) Date: Tue, 25 Feb 2020 12:32:45 +0100 From: Danny Milosavljevic To: 37868@debbugs.gnu.org, ludo@gnu.org, Mark H Weaver Subject: Re: [PATCH v4] system: Add kernel-module-packages to operating-system. Message-ID: <20200225123245.724af21e@scratchpost.org> In-Reply-To: <20200225105549.30115-1-dannym@scratchpost.org> References: <20200218094207.6196-1-dannym@scratchpost.org> <20200225105549.30115-1-dannym@scratchpost.org> X-Mailer: Claws Mail 3.17.3 (GTK+ 2.24.32; x86_64-unknown-linux-gnu) MIME-Version: 1.0 Content-Type: multipart/signed; boundary="Sig_/PeJicKFwxtHj+vv+0QZHySj"; protocol="application/pgp-signature"; micalg=pgp-sha256 X-Spam-Score: -0.7 (/) X-Debbugs-Envelope-To: 37868 X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -1.7 (-) --Sig_/PeJicKFwxtHj+vv+0QZHySj Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: quoted-printable Some extra comments: * I have to really really prevent myself from just making the field KERNEL a list. Because that's what happens at runtime anyway. It's just an union of those things, then it runs depmod. The separation into KERNEL and KERNEL-LOADABLE-MODULES is artificial. * There's a collision warning: warning: collision encountered: /gnu/store/3ar8aym8khxh1rdjf5gxqsk0hv7r9p96-linux-module-database/lib/mod= ules/5.4.22-gnu/modules.symbols.bin /gnu/store/4r0fz0f37bp1zqbqclgrq1l4sm1acy4p-linux-libre-5.4.22/lib/module= s/5.4.22-gnu/modules.symbols.bin warning: choosing /gnu/store/3ar8aym8khxh1rdjf5gxqsk0hv7r9p96-linux-module-= database/lib/modules/5.4.22-gnu/modules.symbols.bin I think that's because the Linux kernel linux-libre we build already has th= ose files. Those files in linux-libre are stale cache files when you have extra modules (because they don't list those extra modules). @Ludo: You said I should remove the null? case (check if there are no extra= modules). I did, so actually, these modules.*.bin files in linux-libre are useless si= nce the profile-derivation of linux-module-database will rebuild them anyway (v= ia depmod), also in the case with no extra modules. The reason I had the null? case before is in order to leave the case with no extra modules unchanged from before (defensive programming). But now that we don't do that, should we make linux-libre not invoke depmod? Or should we filter those files out manually in the profile hook? --Sig_/PeJicKFwxtHj+vv+0QZHySj Content-Type: application/pgp-signature Content-Description: OpenPGP digital signature -----BEGIN PGP SIGNATURE----- iQEzBAEBCAAdFiEEds7GsXJ0tGXALbPZ5xo1VCwwuqUFAl5VBd0ACgkQ5xo1VCww uqVUAwf+NPUCOu7M5UWsbWlGYLoVojKbCORqfO5MP5qUF4JOf2Jyap5YorcbMlV4 KlW9W7qn9K6LB4sXtrWSB/t82kr0LtzRHBElwymeZNopEICPqH86gBFFbAgptPcB 7qZUzaWFVocWM8YaI+uM8Qhta/f3YrJVzWTl14ZExbLNpRBcNGlU4k5sys+ypXki 0p03Je0oUk7LBudvYnhG6h8mCDZScaXEYXGy494NRKN4iWs+qfRbxEjnvuavvJ/3 Vz50+fsRJsWpOTnQ31HOr0ktiMYJM+rfvxzltJJS5894QVvjq39HwJlW/QYZ/Lwq jQaOd0KWgSs3q6oJnyLlBP8detcB4Q== =YwKJ -----END PGP SIGNATURE----- --Sig_/PeJicKFwxtHj+vv+0QZHySj-- From debbugs-submit-bounces@debbugs.gnu.org Tue Feb 25 08:34:42 2020 Received: (at 37868) by debbugs.gnu.org; 25 Feb 2020 13:34:42 +0000 Received: from localhost ([127.0.0.1]:54569 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1j6aMD-0001Nv-Ti for submit@debbugs.gnu.org; Tue, 25 Feb 2020 08:34:42 -0500 Received: from dd26836.kasserver.com ([85.13.145.193]:46780) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1j6aMB-0001Nn-QJ for 37868@debbugs.gnu.org; Tue, 25 Feb 2020 08:34:40 -0500 Received: from localhost (guest17.ersteit.com [213.150.31.17]) by dd26836.kasserver.com (Postfix) with ESMTPSA id 07AB633635CD; Tue, 25 Feb 2020 14:34:38 +0100 (CET) Date: Tue, 25 Feb 2020 14:34:35 +0100 From: Danny Milosavljevic To: 37868@debbugs.gnu.org, ludo@gnu.org, Mark H Weaver Subject: Re: [PATCH v4] system: Add kernel-module-packages to operating-system. Message-ID: <20200225143435.756a5ed3@scratchpost.org> In-Reply-To: <20200225123245.724af21e@scratchpost.org> References: <20200218094207.6196-1-dannym@scratchpost.org> <20200225105549.30115-1-dannym@scratchpost.org> <20200225123245.724af21e@scratchpost.org> X-Mailer: Claws Mail 3.17.3 (GTK+ 2.24.32; x86_64-unknown-linux-gnu) MIME-Version: 1.0 Content-Type: multipart/signed; boundary="Sig_/o/_uTLQy0bTiexqaI.fBMrx"; protocol="application/pgp-signature"; micalg=pgp-sha256 X-Spam-Score: -0.7 (/) X-Debbugs-Envelope-To: 37868 X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -1.7 (-) --Sig_/o/_uTLQy0bTiexqaI.fBMrx Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: quoted-printable > I think that's because the Linux kernel linux-libre we build already has = those > files. Those files in linux-libre are stale cache files when you have ex= tra > modules (because they don't list those extra modules). It is. Setting DEPMOD=3Dtrue in the "install" phase of make-linux-libre* m= akes almost all of those go away, except for the ones for "build" and "source". The latter point to /tmp/guix-build*linux-libre*, so we could just remove t= hose, too. diff --git a/gnu/packages/linux.scm b/gnu/packages/linux.scm index 78182555c1..d1be57fded 100644 --- a/gnu/packages/linux.scm +++ b/gnu/packages/linux.scm @@ -760,12 +760,14 @@ for ARCH and optionally VARIANT, or #f if there is no= such configuration." ;; Install kernel modules (mkdir-p moddir) (invoke "make" - (string-append "DEPMOD=3D" kmod "/bin/depmod") + "DEPMOD=3Dtrue" (string-append "MODULE_DIR=3D" moddir) (string-append "INSTALL_PATH=3D" out) (string-append "INSTALL_MOD_PATH=3D" out) "INSTALL_MOD_STRIP=3D1" - "modules_install"))))) + "modules_install") + ;; TODO: delete-file moddir/*/build, moddir/*/source (they = are symlinks to tmp files anyway) + )))) #:tests? #f)) (home-page "https://www.gnu.org/software/linux-libre/") (synopsis "100% free redistribution of a cleaned Linux kernel") --Sig_/o/_uTLQy0bTiexqaI.fBMrx Content-Type: application/pgp-signature Content-Description: OpenPGP digital signature -----BEGIN PGP SIGNATURE----- iQEzBAEBCAAdFiEEds7GsXJ0tGXALbPZ5xo1VCwwuqUFAl5VImsACgkQ5xo1VCww uqUjQwf/csGxZg4o1PfW3wHH2gaIZ5TpZVQLEMnWIHkxPAeOskO6Z3qXVl9HYNt8 4My0oTFdaXjbkUkSQYjNzkfakiV5PPq3z4VLWS/TSRC05xoVJ94UWtfFZvl2ZxYK Ttp9en6JLryd9kz/znAjZO4rW99PI7FUxXqNtTNuadYGik3kFYvU//4mlYTnZlZK ypH3cTZ8OrUY7+UCJG1rpgnnm1kHp1+ixUB9dRjOZxIoBF594IJGujA+UvoGXu5b zbRIc39h89ibQtE1QBJr/F/1mHVCnHSnPQ3C+uZGV6oNTsnJkIYvzSGDWWNa4Jy7 f2yXvW/LwawXYeSC/hOnAmKUTED4Zw== =Fbza -----END PGP SIGNATURE----- --Sig_/o/_uTLQy0bTiexqaI.fBMrx-- From debbugs-submit-bounces@debbugs.gnu.org Wed Feb 26 14:59:49 2020 Received: (at 37868) by debbugs.gnu.org; 26 Feb 2020 19:59:49 +0000 Received: from localhost ([127.0.0.1]:57719 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1j72qP-0004w8-CV for submit@debbugs.gnu.org; Wed, 26 Feb 2020 14:59:49 -0500 Received: from dd26836.kasserver.com ([85.13.145.193]:51974) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1j72qK-0004vt-5f for 37868@debbugs.gnu.org; Wed, 26 Feb 2020 14:59:43 -0500 Received: from dayas.in.linuxteam.at (ip077244240040.rev.nessus.at [77.244.240.40]) by dd26836.kasserver.com (Postfix) with ESMTPSA id 901BB3361364; Wed, 26 Feb 2020 20:59:38 +0100 (CET) From: Danny Milosavljevic To: 37868@debbugs.gnu.org, ludo@gnu.org, Mark H Weaver Subject: [PATCH v5] system: Add kernel-module-packages to operating-system. Date: Wed, 26 Feb 2020 20:59:29 +0100 Message-Id: <20200226195929.3615-1-dannym@scratchpost.org> X-Mailer: git-send-email 2.23.0 In-Reply-To: <20200225105549.30115-1-dannym@scratchpost.org> References: <20200225105549.30115-1-dannym@scratchpost.org> MIME-Version: 1.0 Tags: patch Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Spam-Score: -0.7 (/) X-Debbugs-Envelope-To: 37868 Cc: Danny Milosavljevic X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -1.0 (-) * gnu/system.scm (): Add kernel-module-packages. (operating-system-directory-base-entries): Use it. * doc/guix.texi (operating-system Reference): Document KERNEL-LOADABLE-MODULES. * gnu/build/linux-modules.scm (depmod!): New procedure. (ensure-linux-module-directory!): New procedure. Export it. * guix/profiles.scm (linux-module-database): New procedure. Export it. * gnu/tests/linux-modules.scm: New file. * gnu/local.mk (GNU_SYSTEM_MODULES): Add it. * gnu/packages/linux.scm (make-linux-libre*)[arguments]<#:phases>[install]: Disable depmod. Remove "build" and "source" symlinks. --- doc/guix.texi | 3 ++ gnu/build/linux-modules.scm | 54 ++++++++++++++++++- gnu/local.mk | 1 + gnu/packages/linux.scm | 19 ++++++- gnu/system.scm | 20 +++++-- gnu/tests/linux-modules.scm | 103 ++++++++++++++++++++++++++++++++++++ guix/profiles.scm | 49 ++++++++++++++++- 7 files changed, 241 insertions(+), 8 deletions(-) create mode 100644 gnu/tests/linux-modules.scm diff --git a/doc/guix.texi b/doc/guix.texi index a66bb3d646..01e2d1ab57 100644 --- a/doc/guix.texi +++ b/doc/guix.texi @@ -11197,6 +11197,9 @@ The package object of the operating system kernel to use@footnote{Currently only the Linux-libre kernel is supported. In the future, it will be possible to use the GNU@tie{}Hurd.}. +@item @code{kernel-loadable-modules} (default: '()) +A list of objects (usually packages) to collect loadable kernel modules from. + @item @code{kernel-arguments} (default: @code{'("quiet")}) List of strings or gexps representing additional arguments to pass on the command-line of the kernel---e.g., @code{("console=ttyS0")}. diff --git a/gnu/build/linux-modules.scm b/gnu/build/linux-modules.scm index a149eff329..69a4b75a08 100644 --- a/gnu/build/linux-modules.scm +++ b/gnu/build/linux-modules.scm @@ -22,12 +22,14 @@ #:use-module (guix elf) #:use-module (guix glob) #:use-module (guix build syscalls) - #:use-module ((guix build utils) #:select (find-files)) + #:use-module ((guix build utils) #:select (find-files invoke false-if-file-not-found)) + #:use-module (guix build union) #:use-module (rnrs io ports) #:use-module (rnrs bytevectors) #:use-module (srfi srfi-1) #:use-module (srfi srfi-11) #:use-module (srfi srfi-26) + #:use-module (ice-9 ftw) #:use-module (ice-9 vlist) #:use-module (ice-9 match) #:use-module (ice-9 rdelim) @@ -56,7 +58,9 @@ write-module-name-database write-module-alias-database - write-module-device-database)) + write-module-device-database + + ensure-linux-module-directory!)) ;;; Commentary: ;;; @@ -631,4 +635,50 @@ be loaded on-demand, such as file system modules." module devname type major minor))) aliases)))) +(define (input-files inputs file) + "Given a list of directories INPUTS, return all entries with FILE in it." + ;; TODO: Use filter-map. + (filter file-exists? + (map (lambda (x) + (string-append x file)) + inputs))) + +(define (depmod! kmod inputs destination-directory output version) + (let ((maps-files (input-files inputs "/System.map")) + (symvers-files (input-files inputs "/Module.symvers"))) + (for-each (lambda (basename) + (when (and (string-prefix? "modules." basename) + (not (string=? "modules.builtin" basename)) + (not (string=? "modules.order" basename))) + (false-if-file-not-found + (delete-file + (string-append destination-directory "/" basename))))) + (scandir destination-directory)) + (invoke (string-append kmod "/bin/depmod") + "-e" ; Report symbols that aren't supplied + "-w" ; Warn on duplicates + "-b" output + "-F" (match maps-files + ((System.map) System.map)) + "-E" (match symvers-files + ((Module.symvers) Module.symvers)) + version))) + +(define (ensure-linux-module-directory! inputs output version kmod) + "Ensures that the directory OUTPUT...VERSION can be used by the Linux +kernel to load modules via KMOD. The modules to put into +OUTPUT...VERSION are taken from INPUTS." + (let ((destination-directory (string-append output "/lib/modules/" + version))) + (when (not (file-exists? destination-directory)) ; unique + (union-build destination-directory + ;; All directories with the same version as us. + (filter-map (lambda (directory-name) + (if (member version (scandir directory-name)) + (string-append directory-name "/" version) + #f)) + (input-files inputs "/lib/modules")) + #:create-all-directories? #t) + (depmod! kmod inputs destination-directory output version)))) + ;;; linux-modules.scm ends here diff --git a/gnu/local.mk b/gnu/local.mk index 857345cfad..b25c3ceea5 100644 --- a/gnu/local.mk +++ b/gnu/local.mk @@ -631,6 +631,7 @@ GNU_SYSTEM_MODULES = \ %D%/tests/nfs.scm \ %D%/tests/install.scm \ %D%/tests/ldap.scm \ + %D%/tests/linux-modules.scm \ %D%/tests/mail.scm \ %D%/tests/messaging.scm \ %D%/tests/networking.scm \ diff --git a/gnu/packages/linux.scm b/gnu/packages/linux.scm index 78182555c1..32b802bab4 100644 --- a/gnu/packages/linux.scm +++ b/gnu/packages/linux.scm @@ -675,6 +675,7 @@ for ARCH and optionally VARIANT, or #f if there is no such configuration." (guix build utils) (srfi srfi-1) (srfi srfi-26) + (ice-9 ftw) (ice-9 match)) #:phases (modify-phases %standard-phases @@ -760,12 +761,26 @@ for ARCH and optionally VARIANT, or #f if there is no such configuration." ;; Install kernel modules (mkdir-p moddir) (invoke "make" - (string-append "DEPMOD=" kmod "/bin/depmod") + ;; Disable depmod because the Guix system's module directory + ;; is an union of potentially multiple packages. It is not + ;; possible to use depmod to usefully calculate a dependency + ;; graph while building only one of those packages. + "DEPMOD=true" (string-append "MODULE_DIR=" moddir) (string-append "INSTALL_PATH=" out) (string-append "INSTALL_MOD_PATH=" out) "INSTALL_MOD_STRIP=1" - "modules_install"))))) + "modules_install") + (let* ((versions (filter (lambda (name) + (not (string-prefix? "." name))) + (scandir moddir))) + (version (match versions + ((x) x)))) + (false-if-file-not-found + (delete-file (string-append moddir "/" version "/build"))) + (false-if-file-not-found + (delete-file (string-append moddir "/" version "/source")))) + #t)))) #:tests? #f)) (home-page "https://www.gnu.org/software/linux-libre/") (synopsis "100% free redistribution of a cleaned Linux kernel") diff --git a/gnu/system.scm b/gnu/system.scm index 01baa248a2..17b6e667d5 100644 --- a/gnu/system.scm +++ b/gnu/system.scm @@ -5,6 +5,7 @@ ;;; Copyright © 2016 Chris Marusich ;;; Copyright © 2017 Mathieu Othacehe ;;; Copyright © 2019 Meiyo Peng +;;; Copyright © 2020 Danny Milosavljevic ;;; ;;; This file is part of GNU Guix. ;;; @@ -164,6 +165,8 @@ (kernel operating-system-kernel ; package (default linux-libre)) + (kernel-loadable-modules operating-system-kernel-loadable-modules + (default '())) ; list of packages (kernel-arguments operating-system-user-kernel-arguments (default '("quiet"))) ; list of gexps/strings (bootloader operating-system-bootloader) ; @@ -468,9 +471,20 @@ OS." "Return the basic entries of the 'system' directory of OS for use as the value of the SYSTEM-SERVICE-TYPE service." (let ((locale (operating-system-locale-directory os))) - (mlet %store-monad ((kernel -> (operating-system-kernel os)) - (initrd -> (operating-system-initrd-file os)) - (params (operating-system-boot-parameters-file os))) + (mlet* %store-monad ((kernel -> (operating-system-kernel os)) + (modules -> + (operating-system-kernel-loadable-modules os)) + (kernel + ;; TODO: system, target. + (profile-derivation + (packages->manifest + (cons kernel modules)) + #:hooks (list linux-module-database) + #:locales? #f + #:allow-collisions? #f + #:relative-symlinks? #t)) + (initrd -> (operating-system-initrd-file os)) + (params (operating-system-boot-parameters-file os))) (return `(("kernel" ,kernel) ("parameters" ,params) ("initrd" ,initrd) diff --git a/gnu/tests/linux-modules.scm b/gnu/tests/linux-modules.scm new file mode 100644 index 0000000000..4a79ed5550 --- /dev/null +++ b/gnu/tests/linux-modules.scm @@ -0,0 +1,103 @@ +;;; GNU Guix --- Functional package management for GNU +;;; Copyright © 2019 Jakob L. Kreuze +;;; Copyright © 2020 Danny Milosavljevic +;;; +;;; This file is part of GNU Guix. +;;; +;;; GNU Guix is free software; you can redistribute it and/or modify it +;;; under the terms of the GNU General Public License as published by +;;; the Free Software Foundation; either version 3 of the License, or (at +;;; your option) any later version. +;;; +;;; GNU Guix is distributed in the hope that it will be useful, but +;;; WITHOUT ANY WARRANTY; without even the implied warranty of +;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +;;; GNU General Public License for more details. +;;; +;;; You should have received a copy of the GNU General Public License +;;; along with GNU Guix. If not, see . + +(define-module (gnu tests linux-modules) + #:use-module (gnu packages linux) + #:use-module (gnu system) + #:use-module (gnu system vm) + #:use-module (gnu tests) + #:use-module (guix derivations) + #:use-module (guix gexp) + #:use-module (guix modules) + #:use-module (guix monads) + #:use-module (guix store) + #:export (%test-loadable-kernel-modules-0 + %test-loadable-kernel-modules-1 + %test-loadable-kernel-modules-2)) + +;;; Commentary: +;;; +;;; Test in-place system reconfiguration: advancing the system generation on a +;;; running instance of the Guix System. +;;; +;;; Code: + +(define* (module-loader-program os modules) + "Return an executable store item that, upon being evaluated, will dry-run +load MODULES." + (program-file + "load-kernel-modules.scm" + (with-imported-modules (source-module-closure '((guix build utils))) + #~(begin + (use-modules (guix build utils)) + (for-each (lambda (module) + (invoke (string-append #$kmod "/bin/modprobe") "-n" "--" module)) + '#$modules))))) + +(define* (run-loadable-kernel-modules-test module-packages module-names) + "Run a test of an OS having MODULE-PACKAGES, and modprobe MODULE-NAMES." + (define os + (marionette-operating-system + (operating-system + (inherit (simple-operating-system)) + (kernel-loadable-modules module-packages)) + #:imported-modules '((guix combinators)))) + (define vm (virtual-machine os)) + (define (test script) + (with-imported-modules '((gnu build marionette)) + #~(begin + (use-modules (gnu build marionette) + (srfi srfi-64)) + (define marionette + (make-marionette (list #$vm))) + (mkdir #$output) + (chdir #$output) + (test-begin "loadable-kernel-modules") + (test-assert "script successfully evaluated" + (marionette-eval + '(primitive-load #$script) + marionette)) + (test-end) + (exit (= (test-runner-fail-count (test-runner-current)) 0))))) + (gexp->derivation "loadable-kernel-modules" (test (module-loader-program os module-names)))) + +(define %test-loadable-kernel-modules-0 + (system-test + (name "loadable-kernel-modules-0") + (description "Tests loadable kernel modules facility of +with no extra modules.") + (value (run-loadable-kernel-modules-test '() '())))) + +(define %test-loadable-kernel-modules-1 + (system-test + (name "loadable-kernel-modules-1") + (description "Tests loadable kernel modules facility of +with one extra module.") + (value (run-loadable-kernel-modules-test + (list ddcci-driver-linux) + '("ddcci"))))) + +(define %test-loadable-kernel-modules-2 + (system-test + (name "loadable-kernel-modules-2") + (description "Tests loadable kernel modules facility of +with two extra modules.") + (value (run-loadable-kernel-modules-test + (list acpi-call-linux-module ddcci-driver-linux) + '("acpi_call" "ddcci"))))) diff --git a/guix/profiles.scm b/guix/profiles.scm index 0d38b2513f..5274a7f5c2 100644 --- a/guix/profiles.scm +++ b/guix/profiles.scm @@ -10,6 +10,7 @@ ;;; Copyright © 2017 Maxim Cournoyer ;;; Copyright © 2019 Kyle Meyer ;;; Copyright © 2019 Mathieu Othacehe +;;; Copyright © 2020 Danny Milosavljevic ;;; ;;; This file is part of GNU Guix. ;;; @@ -139,7 +140,9 @@ %current-profile ensure-profile-directory canonicalize-profile - user-friendly-profile)) + user-friendly-profile + + linux-module-database)) ;;; Commentary: ;;; @@ -1137,6 +1140,50 @@ for both major versions of GTK+." (hook . gtk-im-modules))) (return #f))))) +;; XXX: Dupe in gnu/build/linux-modules.scm . +(define (input-files inputs path) + "Given a list of directories INPUTS, return all entries with PATH in it." + ;; TODO: Use filter-map. + #~(begin + (use-modules (srfi srfi-1)) + (filter file-exists? + (map (lambda (x) + (string-append x #$path)) + '#$inputs)))) + +(define (linux-module-database manifest) + "Return a derivation that unions all the kernel modules in the manifest +and creates the dependency graph for all these kernel modules." + (mlet %store-monad ((kmod (manifest-lookup-package manifest "kmod"))) + (define build + (with-imported-modules (source-module-closure '((guix build utils) (gnu build linux-modules))) + #~(begin + (use-modules (ice-9 ftw)) + (use-modules (srfi srfi-1)) ; append-map + (use-modules (guix build utils)) ; mkdir-p + (use-modules (gnu build linux-modules)) + (let* ((inputs '#$(manifest-inputs manifest)) + (module-directories #$(input-files (manifest-inputs manifest) "/lib/modules")) + (directory-entries + (lambda (directory-name) + (scandir directory-name (lambda (basename) + (not (string-prefix? "." basename)))))) + ;; Note: Should usually result in one entry. + (versions (append-map directory-entries module-directories))) + ;; TODO: if len(module-directories) == 1: return module-directories[0] + (mkdir-p (string-append #$output "/lib/modules")) + ;; Iterate over each kernel version directory (usually one). + (for-each (lambda (version) + (ensure-linux-module-directory! inputs #$output version #$kmod)) + versions) + (exit #t))))) + (gexp->derivation "linux-module-database" build + #:local-build? #t + #:substitutable? #f + #:properties + `((type . profile-hook) + (hook . linux-module-database))))) + (define (xdg-desktop-database manifest) "Return a derivation that builds the @file{mimeinfo.cache} database from desktop files. It's used to query what applications can handle a given From debbugs-submit-bounces@debbugs.gnu.org Thu Feb 27 06:15:36 2020 Received: (at 37868) by debbugs.gnu.org; 27 Feb 2020 11:15:36 +0000 Received: from localhost ([127.0.0.1]:58781 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1j7H8i-00021v-KC for submit@debbugs.gnu.org; Thu, 27 Feb 2020 06:15:36 -0500 Received: from dd26836.kasserver.com ([85.13.145.193]:39742) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1j7H8g-00021m-3b for 37868@debbugs.gnu.org; Thu, 27 Feb 2020 06:15:34 -0500 Received: from localhost (80-110-118-191.cgn.dynamic.surfer.at [80.110.118.191]) by dd26836.kasserver.com (Postfix) with ESMTPSA id 575F03361364; Thu, 27 Feb 2020 12:15:32 +0100 (CET) Date: Thu, 27 Feb 2020 12:15:29 +0100 From: Danny Milosavljevic To: 37868@debbugs.gnu.org, ludo@gnu.org, Mark H Weaver Subject: Re: [PATCH v5] system: Add kernel-module-packages to operating-system. Message-ID: <20200227121529.70af6d24@scratchpost.org> In-Reply-To: <20200226195929.3615-1-dannym@scratchpost.org> References: <20200225105549.30115-1-dannym@scratchpost.org> <20200226195929.3615-1-dannym@scratchpost.org> X-Mailer: Claws Mail 3.17.3 (GTK+ 2.24.32; x86_64-unknown-linux-gnu) MIME-Version: 1.0 Content-Type: multipart/signed; boundary="Sig_/QzDL7/TAGnIFSGlynaE2Jvo"; protocol="application/pgp-signature"; micalg=pgp-sha256 X-Spam-Score: -0.7 (/) X-Debbugs-Envelope-To: 37868 X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -1.7 (-) --Sig_/QzDL7/TAGnIFSGlynaE2Jvo Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: quoted-printable > + ;; Iterate over each kernel version directory (usually o= ne). It might make sense not to iterate but rather to insist that there be only = one kernel version directory in that profile derivation. The reason is that it would catch misconfiguration (modules for the wrong kernel would not be able to be configured into guix system, instead of fail= ing at runtime because it's in the wrong directory) --Sig_/QzDL7/TAGnIFSGlynaE2Jvo Content-Type: application/pgp-signature Content-Description: OpenPGP digital signature -----BEGIN PGP SIGNATURE----- iQEzBAEBCAAdFiEEds7GsXJ0tGXALbPZ5xo1VCwwuqUFAl5XpNEACgkQ5xo1VCww uqXu/QgAgFyCIxUKnG+rpgK7SAk6bMnn0eVbALn2gEizKyX/h/YYhAW4tETJ3GTZ Y4i6gbk+KVwkrhEbNDBuDA1QFbB2IXIA7DQFNJvOZ1vOGtlznn+7NVY8RRhTmfug DkVA3DdkZ69LXtlH1hEUZVCRR8voPgaXgqFBicE2wMriVTr0aXzB79giZS45axKk N3E1eyEslyqWItvH7XNO7MhW51CgiTuUqKcRUPVua62k79UCzNYa/JGEx/FprZOv fUo19pKJb2AfGA07euKARaRo/qG0+CTQFSkFs8++AbDs1YroRU0hCTJM4m0IGoe6 wJoIxcJxFgjW1qcHMySc6BtJQKi6DA== =n8X8 -----END PGP SIGNATURE----- --Sig_/QzDL7/TAGnIFSGlynaE2Jvo-- From debbugs-submit-bounces@debbugs.gnu.org Thu Feb 27 07:25:49 2020 Received: (at 37868) by debbugs.gnu.org; 27 Feb 2020 12:25:49 +0000 Received: from localhost ([127.0.0.1]:58805 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1j7IEb-00044V-HG for submit@debbugs.gnu.org; Thu, 27 Feb 2020 07:25:49 -0500 Received: from dd26836.kasserver.com ([85.13.145.193]:45552) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1j7IEX-00044G-8o for 37868@debbugs.gnu.org; Thu, 27 Feb 2020 07:25:44 -0500 Received: from dayas.lan (80-110-118-191.cgn.dynamic.surfer.at [80.110.118.191]) by dd26836.kasserver.com (Postfix) with ESMTPSA id C8FA03360AA1; Thu, 27 Feb 2020 13:25:38 +0100 (CET) From: Danny Milosavljevic To: 37868@debbugs.gnu.org, ludo@gnu.org, Mark H Weaver Subject: [PATCH v6] system: Add kernel-module-packages to operating-system. Date: Thu, 27 Feb 2020 13:25:19 +0100 Message-Id: <20200227122519.3226-1-dannym@scratchpost.org> X-Mailer: git-send-email 2.23.0 In-Reply-To: <20200226195929.3615-1-dannym@scratchpost.org> References: <20200226195929.3615-1-dannym@scratchpost.org> MIME-Version: 1.0 Tags: patch Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Spam-Score: -0.7 (/) X-Debbugs-Envelope-To: 37868 Cc: Danny Milosavljevic X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -1.7 (-) * gnu/system.scm (): Add kernel-module-packages. (operating-system-directory-base-entries): Use it. * doc/guix.texi (operating-system Reference): Document KERNEL-LOADABLE-MODULES. * gnu/build/linux-modules.scm (depmod!): New procedure. (make-linux-module-directory): New procedure. Export it. * guix/profiles.scm (linux-module-database): New procedure. Export it. * gnu/tests/linux-modules.scm: New file. * gnu/local.mk (GNU_SYSTEM_MODULES): Add it. * gnu/packages/linux.scm (make-linux-libre*)[arguments]<#:phases>[install]: Disable depmod. Remove "build" and "source" symlinks. --- doc/guix.texi | 3 ++ gnu/build/linux-modules.scm | 45 +++++++++++++++- gnu/local.mk | 1 + gnu/packages/linux.scm | 19 ++++++- gnu/system.scm | 20 +++++-- gnu/tests/linux-modules.scm | 103 ++++++++++++++++++++++++++++++++++++ guix/profiles.scm | 51 +++++++++++++++++- 7 files changed, 234 insertions(+), 8 deletions(-) create mode 100644 gnu/tests/linux-modules.scm diff --git a/doc/guix.texi b/doc/guix.texi index a66bb3d646..01e2d1ab57 100644 --- a/doc/guix.texi +++ b/doc/guix.texi @@ -11197,6 +11197,9 @@ The package object of the operating system kernel to use@footnote{Currently only the Linux-libre kernel is supported. In the future, it will be possible to use the GNU@tie{}Hurd.}. +@item @code{kernel-loadable-modules} (default: '()) +A list of objects (usually packages) to collect loadable kernel modules from. + @item @code{kernel-arguments} (default: @code{'("quiet")}) List of strings or gexps representing additional arguments to pass on the command-line of the kernel---e.g., @code{("console=ttyS0")}. diff --git a/gnu/build/linux-modules.scm b/gnu/build/linux-modules.scm index a149eff329..bbdf14fab7 100644 --- a/gnu/build/linux-modules.scm +++ b/gnu/build/linux-modules.scm @@ -22,12 +22,14 @@ #:use-module (guix elf) #:use-module (guix glob) #:use-module (guix build syscalls) - #:use-module ((guix build utils) #:select (find-files)) + #:use-module ((guix build utils) #:select (find-files invoke false-if-file-not-found)) + #:use-module (guix build union) #:use-module (rnrs io ports) #:use-module (rnrs bytevectors) #:use-module (srfi srfi-1) #:use-module (srfi srfi-11) #:use-module (srfi srfi-26) + #:use-module (ice-9 ftw) #:use-module (ice-9 vlist) #:use-module (ice-9 match) #:use-module (ice-9 rdelim) @@ -56,7 +58,9 @@ write-module-name-database write-module-alias-database - write-module-device-database)) + write-module-device-database + + make-linux-module-directory)) ;;; Commentary: ;;; @@ -631,4 +635,41 @@ be loaded on-demand, such as file system modules." module devname type major minor))) aliases)))) +(define (input-files inputs file) + "Given a list of directories INPUTS, return all entries with FILE in it." + ;; TODO: Use filter-map. + (filter file-exists? + (map (lambda (x) + (string-append x file)) + inputs))) + +(define (depmod! kmod inputs version destination-directory output) + (let ((maps-files (input-files inputs "/System.map")) + (symvers-files (input-files inputs "/Module.symvers"))) + (for-each (lambda (basename) + (when (and (string-prefix? "modules." basename) + (not (string=? "modules.builtin" basename)) + (not (string=? "modules.order" basename))) + (delete-file (string-append destination-directory "/" + basename)))) + (scandir destination-directory)) + (invoke (string-append kmod "/bin/depmod") + "-e" ; Report symbols that aren't supplied + "-w" ; Warn on duplicates + "-b" output + "-F" (match maps-files + ((System.map) System.map)) + "-E" (match symvers-files + ((Module.symvers) Module.symvers)) + version))) + +(define (make-linux-module-directory kmod inputs version output) + "Ensures that the directory OUTPUT...VERSION can be used by the Linux +kernel to load modules via KMOD. The modules to put into +OUTPUT are taken from INPUTS." + (let ((destination-directory (string-append output "/lib/modules"))) + (union-build destination-directory (input-files inputs "/lib/modules") + #:create-all-directories? #t) + (depmod! kmod inputs version destination-directory output))) + ;;; linux-modules.scm ends here diff --git a/gnu/local.mk b/gnu/local.mk index 857345cfad..b25c3ceea5 100644 --- a/gnu/local.mk +++ b/gnu/local.mk @@ -631,6 +631,7 @@ GNU_SYSTEM_MODULES = \ %D%/tests/nfs.scm \ %D%/tests/install.scm \ %D%/tests/ldap.scm \ + %D%/tests/linux-modules.scm \ %D%/tests/mail.scm \ %D%/tests/messaging.scm \ %D%/tests/networking.scm \ diff --git a/gnu/packages/linux.scm b/gnu/packages/linux.scm index 78182555c1..32b802bab4 100644 --- a/gnu/packages/linux.scm +++ b/gnu/packages/linux.scm @@ -675,6 +675,7 @@ for ARCH and optionally VARIANT, or #f if there is no such configuration." (guix build utils) (srfi srfi-1) (srfi srfi-26) + (ice-9 ftw) (ice-9 match)) #:phases (modify-phases %standard-phases @@ -760,12 +761,26 @@ for ARCH and optionally VARIANT, or #f if there is no such configuration." ;; Install kernel modules (mkdir-p moddir) (invoke "make" - (string-append "DEPMOD=" kmod "/bin/depmod") + ;; Disable depmod because the Guix system's module directory + ;; is an union of potentially multiple packages. It is not + ;; possible to use depmod to usefully calculate a dependency + ;; graph while building only one of those packages. + "DEPMOD=true" (string-append "MODULE_DIR=" moddir) (string-append "INSTALL_PATH=" out) (string-append "INSTALL_MOD_PATH=" out) "INSTALL_MOD_STRIP=1" - "modules_install"))))) + "modules_install") + (let* ((versions (filter (lambda (name) + (not (string-prefix? "." name))) + (scandir moddir))) + (version (match versions + ((x) x)))) + (false-if-file-not-found + (delete-file (string-append moddir "/" version "/build"))) + (false-if-file-not-found + (delete-file (string-append moddir "/" version "/source")))) + #t)))) #:tests? #f)) (home-page "https://www.gnu.org/software/linux-libre/") (synopsis "100% free redistribution of a cleaned Linux kernel") diff --git a/gnu/system.scm b/gnu/system.scm index 01baa248a2..17b6e667d5 100644 --- a/gnu/system.scm +++ b/gnu/system.scm @@ -5,6 +5,7 @@ ;;; Copyright © 2016 Chris Marusich ;;; Copyright © 2017 Mathieu Othacehe ;;; Copyright © 2019 Meiyo Peng +;;; Copyright © 2020 Danny Milosavljevic ;;; ;;; This file is part of GNU Guix. ;;; @@ -164,6 +165,8 @@ (kernel operating-system-kernel ; package (default linux-libre)) + (kernel-loadable-modules operating-system-kernel-loadable-modules + (default '())) ; list of packages (kernel-arguments operating-system-user-kernel-arguments (default '("quiet"))) ; list of gexps/strings (bootloader operating-system-bootloader) ; @@ -468,9 +471,20 @@ OS." "Return the basic entries of the 'system' directory of OS for use as the value of the SYSTEM-SERVICE-TYPE service." (let ((locale (operating-system-locale-directory os))) - (mlet %store-monad ((kernel -> (operating-system-kernel os)) - (initrd -> (operating-system-initrd-file os)) - (params (operating-system-boot-parameters-file os))) + (mlet* %store-monad ((kernel -> (operating-system-kernel os)) + (modules -> + (operating-system-kernel-loadable-modules os)) + (kernel + ;; TODO: system, target. + (profile-derivation + (packages->manifest + (cons kernel modules)) + #:hooks (list linux-module-database) + #:locales? #f + #:allow-collisions? #f + #:relative-symlinks? #t)) + (initrd -> (operating-system-initrd-file os)) + (params (operating-system-boot-parameters-file os))) (return `(("kernel" ,kernel) ("parameters" ,params) ("initrd" ,initrd) diff --git a/gnu/tests/linux-modules.scm b/gnu/tests/linux-modules.scm new file mode 100644 index 0000000000..4a79ed5550 --- /dev/null +++ b/gnu/tests/linux-modules.scm @@ -0,0 +1,103 @@ +;;; GNU Guix --- Functional package management for GNU +;;; Copyright © 2019 Jakob L. Kreuze +;;; Copyright © 2020 Danny Milosavljevic +;;; +;;; This file is part of GNU Guix. +;;; +;;; GNU Guix is free software; you can redistribute it and/or modify it +;;; under the terms of the GNU General Public License as published by +;;; the Free Software Foundation; either version 3 of the License, or (at +;;; your option) any later version. +;;; +;;; GNU Guix is distributed in the hope that it will be useful, but +;;; WITHOUT ANY WARRANTY; without even the implied warranty of +;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +;;; GNU General Public License for more details. +;;; +;;; You should have received a copy of the GNU General Public License +;;; along with GNU Guix. If not, see . + +(define-module (gnu tests linux-modules) + #:use-module (gnu packages linux) + #:use-module (gnu system) + #:use-module (gnu system vm) + #:use-module (gnu tests) + #:use-module (guix derivations) + #:use-module (guix gexp) + #:use-module (guix modules) + #:use-module (guix monads) + #:use-module (guix store) + #:export (%test-loadable-kernel-modules-0 + %test-loadable-kernel-modules-1 + %test-loadable-kernel-modules-2)) + +;;; Commentary: +;;; +;;; Test in-place system reconfiguration: advancing the system generation on a +;;; running instance of the Guix System. +;;; +;;; Code: + +(define* (module-loader-program os modules) + "Return an executable store item that, upon being evaluated, will dry-run +load MODULES." + (program-file + "load-kernel-modules.scm" + (with-imported-modules (source-module-closure '((guix build utils))) + #~(begin + (use-modules (guix build utils)) + (for-each (lambda (module) + (invoke (string-append #$kmod "/bin/modprobe") "-n" "--" module)) + '#$modules))))) + +(define* (run-loadable-kernel-modules-test module-packages module-names) + "Run a test of an OS having MODULE-PACKAGES, and modprobe MODULE-NAMES." + (define os + (marionette-operating-system + (operating-system + (inherit (simple-operating-system)) + (kernel-loadable-modules module-packages)) + #:imported-modules '((guix combinators)))) + (define vm (virtual-machine os)) + (define (test script) + (with-imported-modules '((gnu build marionette)) + #~(begin + (use-modules (gnu build marionette) + (srfi srfi-64)) + (define marionette + (make-marionette (list #$vm))) + (mkdir #$output) + (chdir #$output) + (test-begin "loadable-kernel-modules") + (test-assert "script successfully evaluated" + (marionette-eval + '(primitive-load #$script) + marionette)) + (test-end) + (exit (= (test-runner-fail-count (test-runner-current)) 0))))) + (gexp->derivation "loadable-kernel-modules" (test (module-loader-program os module-names)))) + +(define %test-loadable-kernel-modules-0 + (system-test + (name "loadable-kernel-modules-0") + (description "Tests loadable kernel modules facility of +with no extra modules.") + (value (run-loadable-kernel-modules-test '() '())))) + +(define %test-loadable-kernel-modules-1 + (system-test + (name "loadable-kernel-modules-1") + (description "Tests loadable kernel modules facility of +with one extra module.") + (value (run-loadable-kernel-modules-test + (list ddcci-driver-linux) + '("ddcci"))))) + +(define %test-loadable-kernel-modules-2 + (system-test + (name "loadable-kernel-modules-2") + (description "Tests loadable kernel modules facility of +with two extra modules.") + (value (run-loadable-kernel-modules-test + (list acpi-call-linux-module ddcci-driver-linux) + '("acpi_call" "ddcci"))))) diff --git a/guix/profiles.scm b/guix/profiles.scm index 0d38b2513f..6d4aee3586 100644 --- a/guix/profiles.scm +++ b/guix/profiles.scm @@ -10,6 +10,7 @@ ;;; Copyright © 2017 Maxim Cournoyer ;;; Copyright © 2019 Kyle Meyer ;;; Copyright © 2019 Mathieu Othacehe +;;; Copyright © 2020 Danny Milosavljevic ;;; ;;; This file is part of GNU Guix. ;;; @@ -139,7 +140,9 @@ %current-profile ensure-profile-directory canonicalize-profile - user-friendly-profile)) + user-friendly-profile + + linux-module-database)) ;;; Commentary: ;;; @@ -1137,6 +1140,52 @@ for both major versions of GTK+." (hook . gtk-im-modules))) (return #f))))) +;; XXX: Dupe in gnu/build/linux-modules.scm . +(define (input-files inputs path) + "Given a list of directories INPUTS, return all entries with PATH in it." + ;; TODO: Use filter-map. + #~(begin + (use-modules (srfi srfi-1)) + (filter file-exists? + (map (lambda (x) + (string-append x #$path)) + '#$inputs)))) + +(define (linux-module-database manifest) + "Return a derivation that unions all the kernel modules in the manifest +and creates the dependency graph for all these kernel modules." + (mlet %store-monad ((kmod (manifest-lookup-package manifest "kmod"))) + (define build + (with-imported-modules (source-module-closure '((guix build utils) (gnu build linux-modules))) + #~(begin + (use-modules (ice-9 ftw)) + (use-modules (ice-9 match)) + (use-modules (srfi srfi-1)) ; append-map + (use-modules (guix build utils)) ; mkdir-p + (use-modules (gnu build linux-modules)) + (let* ((inputs '#$(manifest-inputs manifest)) + (module-directories #$(input-files (manifest-inputs manifest) "/lib/modules")) + (directory-entries + (lambda (directory-name) + (scandir directory-name (lambda (basename) + (not (string-prefix? "." basename)))))) + ;; Note: Should usually result in one entry. + (versions (delete-duplicates + (append-map directory-entries + module-directories)))) + ;; TODO: if len(module-directories) == 1: return module-directories[0] + (mkdir-p (string-append #$output "/lib")) + (match versions + ((version) + (make-linux-module-directory #$kmod inputs version #$output))) + (exit #t))))) + (gexp->derivation "linux-module-database" build + #:local-build? #t + #:substitutable? #f + #:properties + `((type . profile-hook) + (hook . linux-module-database))))) + (define (xdg-desktop-database manifest) "Return a derivation that builds the @file{mimeinfo.cache} database from desktop files. It's used to query what applications can handle a given From debbugs-submit-bounces@debbugs.gnu.org Thu Feb 27 08:52:00 2020 Received: (at 37868) by debbugs.gnu.org; 27 Feb 2020 13:52:00 +0000 Received: from localhost ([127.0.0.1]:58880 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1j7Ja0-00046A-Mm for submit@debbugs.gnu.org; Thu, 27 Feb 2020 08:52:00 -0500 Received: from dd26836.kasserver.com ([85.13.145.193]:52548) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1j7JZv-00045s-6c for 37868@debbugs.gnu.org; Thu, 27 Feb 2020 08:51:54 -0500 Received: from dayas.hotspot.internet-for-guests.com (guest17.ersteit.com [213.150.31.17]) by dd26836.kasserver.com (Postfix) with ESMTPSA id 990E43365513; Thu, 27 Feb 2020 14:51:49 +0100 (CET) From: Danny Milosavljevic To: 37868@debbugs.gnu.org, ludo@gnu.org, Mark H Weaver Subject: [PATCH v7] system: Add kernel-module-packages to operating-system. Date: Thu, 27 Feb 2020 14:51:46 +0100 Message-Id: <20200227135146.5701-1-dannym@scratchpost.org> X-Mailer: git-send-email 2.23.0 In-Reply-To: <20200227122519.3226-1-dannym@scratchpost.org> References: <20200227122519.3226-1-dannym@scratchpost.org> MIME-Version: 1.0 Tags: patch Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Spam-Score: -0.7 (/) X-Debbugs-Envelope-To: 37868 Cc: Danny Milosavljevic X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -1.7 (-) * gnu/system.scm (): Add kernel-module-packages. (operating-system-directory-base-entries): Use it. * doc/guix.texi (operating-system Reference): Document KERNEL-LOADABLE-MODULES. * gnu/build/linux-modules.scm (depmod!): New procedure. (make-linux-module-directory): New procedure. Export it. * guix/profiles.scm (linux-module-database): New procedure. Export it. * gnu/tests/linux-modules.scm: New file. * gnu/local.mk (GNU_SYSTEM_MODULES): Add it. * gnu/packages/linux.scm (make-linux-libre*)[arguments]<#:phases>[install]: Disable depmod. Remove "build" and "source" symlinks. --- doc/guix.texi | 3 ++ gnu/build/linux-modules.scm | 46 +++++++++++++++- gnu/local.mk | 1 + gnu/packages/linux.scm | 19 ++++++- gnu/system.scm | 20 +++++-- gnu/tests/linux-modules.scm | 103 ++++++++++++++++++++++++++++++++++++ guix/profiles.scm | 50 ++++++++++++++++- 7 files changed, 234 insertions(+), 8 deletions(-) create mode 100644 gnu/tests/linux-modules.scm diff --git a/doc/guix.texi b/doc/guix.texi index a66bb3d646..01e2d1ab57 100644 --- a/doc/guix.texi +++ b/doc/guix.texi @@ -11197,6 +11197,9 @@ The package object of the operating system kernel to use@footnote{Currently only the Linux-libre kernel is supported. In the future, it will be possible to use the GNU@tie{}Hurd.}. +@item @code{kernel-loadable-modules} (default: '()) +A list of objects (usually packages) to collect loadable kernel modules from. + @item @code{kernel-arguments} (default: @code{'("quiet")}) List of strings or gexps representing additional arguments to pass on the command-line of the kernel---e.g., @code{("console=ttyS0")}. diff --git a/gnu/build/linux-modules.scm b/gnu/build/linux-modules.scm index a149eff329..fa8f639bb7 100644 --- a/gnu/build/linux-modules.scm +++ b/gnu/build/linux-modules.scm @@ -22,12 +22,14 @@ #:use-module (guix elf) #:use-module (guix glob) #:use-module (guix build syscalls) - #:use-module ((guix build utils) #:select (find-files)) + #:use-module ((guix build utils) #:select (find-files invoke)) + #:use-module (guix build union) #:use-module (rnrs io ports) #:use-module (rnrs bytevectors) #:use-module (srfi srfi-1) #:use-module (srfi srfi-11) #:use-module (srfi srfi-26) + #:use-module (ice-9 ftw) #:use-module (ice-9 vlist) #:use-module (ice-9 match) #:use-module (ice-9 rdelim) @@ -56,7 +58,9 @@ write-module-name-database write-module-alias-database - write-module-device-database)) + write-module-device-database + + make-linux-module-directory)) ;;; Commentary: ;;; @@ -631,4 +635,42 @@ be loaded on-demand, such as file system modules." module devname type major minor))) aliases)))) +(define (input-files inputs file) + "Given a list of directories INPUTS, return all entries with FILE in it." + ;; TODO: Use filter-map. + (filter file-exists? + (map (lambda (x) + (string-append x file)) + inputs))) + +(define (depmod! kmod inputs version output) + "Given an (existing) OUTPUT directory, invoke KMOD's depmod on it for +kernel version VERSION." + (let ((destination-directory (string-append output "/lib/modules/" version)) + (maps-files (input-files inputs "/System.map")) + (symvers-files (input-files inputs "/Module.symvers"))) + (for-each (lambda (basename) + (when (and (string-prefix? "modules." basename) + (not (string=? "modules.builtin" basename)) + (not (string=? "modules.order" basename))) + (delete-file (string-append destination-directory "/" + basename)))) + (scandir destination-directory)) + (invoke (string-append kmod "/bin/depmod") + "-e" ; Report symbols that aren't supplied + "-w" ; Warn on duplicates + "-b" output + "-F" (match maps-files + ((System.map) System.map)) + "-E" (match symvers-files + ((Module.symvers) Module.symvers)) + version))) + +(define (make-linux-module-directory kmod inputs version output) + "Ensure that the directory OUTPUT...VERSION can be used by the Linux +kernel to load modules via KMOD. The modules to put into +OUTPUT are taken from INPUTS." + (union-build output inputs #:create-all-directories? #t) + (depmod! kmod inputs version output)) + ;;; linux-modules.scm ends here diff --git a/gnu/local.mk b/gnu/local.mk index 857345cfad..b25c3ceea5 100644 --- a/gnu/local.mk +++ b/gnu/local.mk @@ -631,6 +631,7 @@ GNU_SYSTEM_MODULES = \ %D%/tests/nfs.scm \ %D%/tests/install.scm \ %D%/tests/ldap.scm \ + %D%/tests/linux-modules.scm \ %D%/tests/mail.scm \ %D%/tests/messaging.scm \ %D%/tests/networking.scm \ diff --git a/gnu/packages/linux.scm b/gnu/packages/linux.scm index 78182555c1..32b802bab4 100644 --- a/gnu/packages/linux.scm +++ b/gnu/packages/linux.scm @@ -675,6 +675,7 @@ for ARCH and optionally VARIANT, or #f if there is no such configuration." (guix build utils) (srfi srfi-1) (srfi srfi-26) + (ice-9 ftw) (ice-9 match)) #:phases (modify-phases %standard-phases @@ -760,12 +761,26 @@ for ARCH and optionally VARIANT, or #f if there is no such configuration." ;; Install kernel modules (mkdir-p moddir) (invoke "make" - (string-append "DEPMOD=" kmod "/bin/depmod") + ;; Disable depmod because the Guix system's module directory + ;; is an union of potentially multiple packages. It is not + ;; possible to use depmod to usefully calculate a dependency + ;; graph while building only one of those packages. + "DEPMOD=true" (string-append "MODULE_DIR=" moddir) (string-append "INSTALL_PATH=" out) (string-append "INSTALL_MOD_PATH=" out) "INSTALL_MOD_STRIP=1" - "modules_install"))))) + "modules_install") + (let* ((versions (filter (lambda (name) + (not (string-prefix? "." name))) + (scandir moddir))) + (version (match versions + ((x) x)))) + (false-if-file-not-found + (delete-file (string-append moddir "/" version "/build"))) + (false-if-file-not-found + (delete-file (string-append moddir "/" version "/source")))) + #t)))) #:tests? #f)) (home-page "https://www.gnu.org/software/linux-libre/") (synopsis "100% free redistribution of a cleaned Linux kernel") diff --git a/gnu/system.scm b/gnu/system.scm index 01baa248a2..17b6e667d5 100644 --- a/gnu/system.scm +++ b/gnu/system.scm @@ -5,6 +5,7 @@ ;;; Copyright © 2016 Chris Marusich ;;; Copyright © 2017 Mathieu Othacehe ;;; Copyright © 2019 Meiyo Peng +;;; Copyright © 2020 Danny Milosavljevic ;;; ;;; This file is part of GNU Guix. ;;; @@ -164,6 +165,8 @@ (kernel operating-system-kernel ; package (default linux-libre)) + (kernel-loadable-modules operating-system-kernel-loadable-modules + (default '())) ; list of packages (kernel-arguments operating-system-user-kernel-arguments (default '("quiet"))) ; list of gexps/strings (bootloader operating-system-bootloader) ; @@ -468,9 +471,20 @@ OS." "Return the basic entries of the 'system' directory of OS for use as the value of the SYSTEM-SERVICE-TYPE service." (let ((locale (operating-system-locale-directory os))) - (mlet %store-monad ((kernel -> (operating-system-kernel os)) - (initrd -> (operating-system-initrd-file os)) - (params (operating-system-boot-parameters-file os))) + (mlet* %store-monad ((kernel -> (operating-system-kernel os)) + (modules -> + (operating-system-kernel-loadable-modules os)) + (kernel + ;; TODO: system, target. + (profile-derivation + (packages->manifest + (cons kernel modules)) + #:hooks (list linux-module-database) + #:locales? #f + #:allow-collisions? #f + #:relative-symlinks? #t)) + (initrd -> (operating-system-initrd-file os)) + (params (operating-system-boot-parameters-file os))) (return `(("kernel" ,kernel) ("parameters" ,params) ("initrd" ,initrd) diff --git a/gnu/tests/linux-modules.scm b/gnu/tests/linux-modules.scm new file mode 100644 index 0000000000..4a79ed5550 --- /dev/null +++ b/gnu/tests/linux-modules.scm @@ -0,0 +1,103 @@ +;;; GNU Guix --- Functional package management for GNU +;;; Copyright © 2019 Jakob L. Kreuze +;;; Copyright © 2020 Danny Milosavljevic +;;; +;;; This file is part of GNU Guix. +;;; +;;; GNU Guix is free software; you can redistribute it and/or modify it +;;; under the terms of the GNU General Public License as published by +;;; the Free Software Foundation; either version 3 of the License, or (at +;;; your option) any later version. +;;; +;;; GNU Guix is distributed in the hope that it will be useful, but +;;; WITHOUT ANY WARRANTY; without even the implied warranty of +;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +;;; GNU General Public License for more details. +;;; +;;; You should have received a copy of the GNU General Public License +;;; along with GNU Guix. If not, see . + +(define-module (gnu tests linux-modules) + #:use-module (gnu packages linux) + #:use-module (gnu system) + #:use-module (gnu system vm) + #:use-module (gnu tests) + #:use-module (guix derivations) + #:use-module (guix gexp) + #:use-module (guix modules) + #:use-module (guix monads) + #:use-module (guix store) + #:export (%test-loadable-kernel-modules-0 + %test-loadable-kernel-modules-1 + %test-loadable-kernel-modules-2)) + +;;; Commentary: +;;; +;;; Test in-place system reconfiguration: advancing the system generation on a +;;; running instance of the Guix System. +;;; +;;; Code: + +(define* (module-loader-program os modules) + "Return an executable store item that, upon being evaluated, will dry-run +load MODULES." + (program-file + "load-kernel-modules.scm" + (with-imported-modules (source-module-closure '((guix build utils))) + #~(begin + (use-modules (guix build utils)) + (for-each (lambda (module) + (invoke (string-append #$kmod "/bin/modprobe") "-n" "--" module)) + '#$modules))))) + +(define* (run-loadable-kernel-modules-test module-packages module-names) + "Run a test of an OS having MODULE-PACKAGES, and modprobe MODULE-NAMES." + (define os + (marionette-operating-system + (operating-system + (inherit (simple-operating-system)) + (kernel-loadable-modules module-packages)) + #:imported-modules '((guix combinators)))) + (define vm (virtual-machine os)) + (define (test script) + (with-imported-modules '((gnu build marionette)) + #~(begin + (use-modules (gnu build marionette) + (srfi srfi-64)) + (define marionette + (make-marionette (list #$vm))) + (mkdir #$output) + (chdir #$output) + (test-begin "loadable-kernel-modules") + (test-assert "script successfully evaluated" + (marionette-eval + '(primitive-load #$script) + marionette)) + (test-end) + (exit (= (test-runner-fail-count (test-runner-current)) 0))))) + (gexp->derivation "loadable-kernel-modules" (test (module-loader-program os module-names)))) + +(define %test-loadable-kernel-modules-0 + (system-test + (name "loadable-kernel-modules-0") + (description "Tests loadable kernel modules facility of +with no extra modules.") + (value (run-loadable-kernel-modules-test '() '())))) + +(define %test-loadable-kernel-modules-1 + (system-test + (name "loadable-kernel-modules-1") + (description "Tests loadable kernel modules facility of +with one extra module.") + (value (run-loadable-kernel-modules-test + (list ddcci-driver-linux) + '("ddcci"))))) + +(define %test-loadable-kernel-modules-2 + (system-test + (name "loadable-kernel-modules-2") + (description "Tests loadable kernel modules facility of +with two extra modules.") + (value (run-loadable-kernel-modules-test + (list acpi-call-linux-module ddcci-driver-linux) + '("acpi_call" "ddcci"))))) diff --git a/guix/profiles.scm b/guix/profiles.scm index 0d38b2513f..add486556f 100644 --- a/guix/profiles.scm +++ b/guix/profiles.scm @@ -10,6 +10,7 @@ ;;; Copyright © 2017 Maxim Cournoyer ;;; Copyright © 2019 Kyle Meyer ;;; Copyright © 2019 Mathieu Othacehe +;;; Copyright © 2020 Danny Milosavljevic ;;; ;;; This file is part of GNU Guix. ;;; @@ -139,7 +140,9 @@ %current-profile ensure-profile-directory canonicalize-profile - user-friendly-profile)) + user-friendly-profile + + linux-module-database)) ;;; Commentary: ;;; @@ -1137,6 +1140,51 @@ for both major versions of GTK+." (hook . gtk-im-modules))) (return #f))))) +;; XXX: Dupe in gnu/build/linux-modules.scm . +(define (input-files inputs path) + "Given a list of directories INPUTS, return all entries with PATH in it." + ;; TODO: Use filter-map. + #~(begin + (use-modules (srfi srfi-1)) + (filter file-exists? + (map (lambda (x) + (string-append x #$path)) + '#$inputs)))) + +(define (linux-module-database manifest) + "Return a derivation that unions all the kernel modules in the manifest +and creates the dependency graph for all these kernel modules." + (mlet %store-monad ((kmod (manifest-lookup-package manifest "kmod"))) + (define build + (with-imported-modules (source-module-closure '((guix build utils) (gnu build linux-modules))) + #~(begin + (use-modules (ice-9 ftw)) + (use-modules (ice-9 match)) + (use-modules (srfi srfi-1)) ; append-map + (use-modules (guix build utils)) ; mkdir-p + (use-modules (gnu build linux-modules)) + (let* ((inputs '#$(manifest-inputs manifest)) + (module-directories #$(input-files (manifest-inputs manifest) "/lib/modules")) + (directory-entries + (lambda (directory-name) + (scandir directory-name (lambda (basename) + (not (string-prefix? "." basename)))))) + ;; Note: Should usually result in one entry. + (versions (delete-duplicates + (append-map directory-entries + module-directories)))) + ;; TODO: if len(module-directories) == 1: return module-directories[0] + (match versions + ((version) + (make-linux-module-directory #$kmod inputs version #$output))) + (exit #t))))) + (gexp->derivation "linux-module-database" build + #:local-build? #t + #:substitutable? #f + #:properties + `((type . profile-hook) + (hook . linux-module-database))))) + (define (xdg-desktop-database manifest) "Return a derivation that builds the @file{mimeinfo.cache} database from desktop files. It's used to query what applications can handle a given From debbugs-submit-bounces@debbugs.gnu.org Thu Feb 27 10:50:47 2020 Received: (at 37868) by debbugs.gnu.org; 27 Feb 2020 15:50:47 +0000 Received: from localhost ([127.0.0.1]:60146 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1j7LQy-0007ub-2W for submit@debbugs.gnu.org; Thu, 27 Feb 2020 10:50:47 -0500 Received: from dd26836.kasserver.com ([85.13.145.193]:33904) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1j7LQt-0007uM-Br for 37868@debbugs.gnu.org; Thu, 27 Feb 2020 10:50:42 -0500 Received: from dayas.hotspot.internet-for-guests.com (guest17.ersteit.com [213.150.31.17]) by dd26836.kasserver.com (Postfix) with ESMTPSA id C9AE33361430; Thu, 27 Feb 2020 16:50:37 +0100 (CET) From: Danny Milosavljevic To: 37868@debbugs.gnu.org, ludo@gnu.org, Mark H Weaver Subject: [PATCH v8] system: Add kernel-module-packages to operating-system. Date: Thu, 27 Feb 2020 16:50:29 +0100 Message-Id: <20200227155029.2542-1-dannym@scratchpost.org> X-Mailer: git-send-email 2.23.0 In-Reply-To: <20200227135146.5701-1-dannym@scratchpost.org> References: <20200227135146.5701-1-dannym@scratchpost.org> MIME-Version: 1.0 Tags: patch Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Spam-Score: -0.7 (/) X-Debbugs-Envelope-To: 37868 Cc: Danny Milosavljevic X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -1.7 (-) * gnu/system.scm (): Add kernel-module-packages. (operating-system-directory-base-entries): Use it. * doc/guix.texi (operating-system Reference): Document KERNEL-LOADABLE-MODULES. * gnu/build/linux-modules.scm (depmod!): New procedure. (make-linux-module-directory): New procedure. Export it. * guix/profiles.scm (linux-module-database): New procedure. Export it. (input-files): New procedure. * gnu/tests/linux-modules.scm: New file. * gnu/local.mk (GNU_SYSTEM_MODULES): Add it. * gnu/packages/linux.scm (make-linux-libre*)[arguments]<#:phases>[install]: Disable depmod. Remove "build" and "source" symlinks. --- doc/guix.texi | 3 ++ gnu/build/linux-modules.scm | 41 ++++++++++++++- gnu/local.mk | 1 + gnu/packages/linux.scm | 19 ++++++- gnu/system.scm | 20 +++++-- gnu/tests/linux-modules.scm | 102 ++++++++++++++++++++++++++++++++++++ guix/profiles.scm | 48 ++++++++++++++++- 7 files changed, 226 insertions(+), 8 deletions(-) create mode 100644 gnu/tests/linux-modules.scm diff --git a/doc/guix.texi b/doc/guix.texi index a66bb3d646..01e2d1ab57 100644 --- a/doc/guix.texi +++ b/doc/guix.texi @@ -11197,6 +11197,9 @@ The package object of the operating system kernel to use@footnote{Currently only the Linux-libre kernel is supported. In the future, it will be possible to use the GNU@tie{}Hurd.}. +@item @code{kernel-loadable-modules} (default: '()) +A list of objects (usually packages) to collect loadable kernel modules from. + @item @code{kernel-arguments} (default: @code{'("quiet")}) List of strings or gexps representing additional arguments to pass on the command-line of the kernel---e.g., @code{("console=ttyS0")}. diff --git a/gnu/build/linux-modules.scm b/gnu/build/linux-modules.scm index a149eff329..0b11c52103 100644 --- a/gnu/build/linux-modules.scm +++ b/gnu/build/linux-modules.scm @@ -22,12 +22,14 @@ #:use-module (guix elf) #:use-module (guix glob) #:use-module (guix build syscalls) - #:use-module ((guix build utils) #:select (find-files)) + #:use-module ((guix build utils) #:select (find-files invoke)) + #:use-module (guix build union) #:use-module (rnrs io ports) #:use-module (rnrs bytevectors) #:use-module (srfi srfi-1) #:use-module (srfi srfi-11) #:use-module (srfi srfi-26) + #:use-module (ice-9 ftw) #:use-module (ice-9 vlist) #:use-module (ice-9 match) #:use-module (ice-9 rdelim) @@ -56,7 +58,9 @@ write-module-name-database write-module-alias-database - write-module-device-database)) + write-module-device-database + + make-linux-module-directory)) ;;; Commentary: ;;; @@ -631,4 +635,37 @@ be loaded on-demand, such as file system modules." module devname type major minor))) aliases)))) +(define (depmod! kmod version output) + "Given an (existing) OUTPUT directory, invoke KMOD's depmod on it for +kernel version VERSION." + (let ((destination-directory (string-append output "/lib/modules/" version)) + ;; Note: "System.map" is an input file. + (maps-file (string-append output "/System.map")) + ;; Note: "Module.symvers" is an input file. + (symvers-file (string-append output "/Module.symvers"))) + (for-each (lambda (basename) + (when (and (string-prefix? "modules." basename) + ;; Note: "modules.builtin" is an input file. + (not (string=? "modules.builtin" basename)) + ;; Note: "modules.order" is an input file. + (not (string=? "modules.order" basename))) + (delete-file (string-append destination-directory "/" + basename)))) + (scandir destination-directory)) + (invoke (string-append kmod "/bin/depmod") + "-e" ; Report symbols that aren't supplied + ;"-w" ; Warn on duplicates + "-b" output + "-F" maps-file + "-E" symvers-file + version))) + +(define (make-linux-module-directory kmod inputs version output) + "Create a new directory OUTPUT and ensure that the directory +OUTPUT/lib/modules/VERSION can be used as a source of Linux +kernel modules for KMOD to eventually load. Take modules to +put into OUTPUT from INPUTS." + (union-build output inputs #:create-all-directories? #t) + (depmod! kmod version output)) + ;;; linux-modules.scm ends here diff --git a/gnu/local.mk b/gnu/local.mk index 857345cfad..b25c3ceea5 100644 --- a/gnu/local.mk +++ b/gnu/local.mk @@ -631,6 +631,7 @@ GNU_SYSTEM_MODULES = \ %D%/tests/nfs.scm \ %D%/tests/install.scm \ %D%/tests/ldap.scm \ + %D%/tests/linux-modules.scm \ %D%/tests/mail.scm \ %D%/tests/messaging.scm \ %D%/tests/networking.scm \ diff --git a/gnu/packages/linux.scm b/gnu/packages/linux.scm index 78182555c1..32b802bab4 100644 --- a/gnu/packages/linux.scm +++ b/gnu/packages/linux.scm @@ -675,6 +675,7 @@ for ARCH and optionally VARIANT, or #f if there is no such configuration." (guix build utils) (srfi srfi-1) (srfi srfi-26) + (ice-9 ftw) (ice-9 match)) #:phases (modify-phases %standard-phases @@ -760,12 +761,26 @@ for ARCH and optionally VARIANT, or #f if there is no such configuration." ;; Install kernel modules (mkdir-p moddir) (invoke "make" - (string-append "DEPMOD=" kmod "/bin/depmod") + ;; Disable depmod because the Guix system's module directory + ;; is an union of potentially multiple packages. It is not + ;; possible to use depmod to usefully calculate a dependency + ;; graph while building only one of those packages. + "DEPMOD=true" (string-append "MODULE_DIR=" moddir) (string-append "INSTALL_PATH=" out) (string-append "INSTALL_MOD_PATH=" out) "INSTALL_MOD_STRIP=1" - "modules_install"))))) + "modules_install") + (let* ((versions (filter (lambda (name) + (not (string-prefix? "." name))) + (scandir moddir))) + (version (match versions + ((x) x)))) + (false-if-file-not-found + (delete-file (string-append moddir "/" version "/build"))) + (false-if-file-not-found + (delete-file (string-append moddir "/" version "/source")))) + #t)))) #:tests? #f)) (home-page "https://www.gnu.org/software/linux-libre/") (synopsis "100% free redistribution of a cleaned Linux kernel") diff --git a/gnu/system.scm b/gnu/system.scm index 01baa248a2..17b6e667d5 100644 --- a/gnu/system.scm +++ b/gnu/system.scm @@ -5,6 +5,7 @@ ;;; Copyright © 2016 Chris Marusich ;;; Copyright © 2017 Mathieu Othacehe ;;; Copyright © 2019 Meiyo Peng +;;; Copyright © 2020 Danny Milosavljevic ;;; ;;; This file is part of GNU Guix. ;;; @@ -164,6 +165,8 @@ (kernel operating-system-kernel ; package (default linux-libre)) + (kernel-loadable-modules operating-system-kernel-loadable-modules + (default '())) ; list of packages (kernel-arguments operating-system-user-kernel-arguments (default '("quiet"))) ; list of gexps/strings (bootloader operating-system-bootloader) ; @@ -468,9 +471,20 @@ OS." "Return the basic entries of the 'system' directory of OS for use as the value of the SYSTEM-SERVICE-TYPE service." (let ((locale (operating-system-locale-directory os))) - (mlet %store-monad ((kernel -> (operating-system-kernel os)) - (initrd -> (operating-system-initrd-file os)) - (params (operating-system-boot-parameters-file os))) + (mlet* %store-monad ((kernel -> (operating-system-kernel os)) + (modules -> + (operating-system-kernel-loadable-modules os)) + (kernel + ;; TODO: system, target. + (profile-derivation + (packages->manifest + (cons kernel modules)) + #:hooks (list linux-module-database) + #:locales? #f + #:allow-collisions? #f + #:relative-symlinks? #t)) + (initrd -> (operating-system-initrd-file os)) + (params (operating-system-boot-parameters-file os))) (return `(("kernel" ,kernel) ("parameters" ,params) ("initrd" ,initrd) diff --git a/gnu/tests/linux-modules.scm b/gnu/tests/linux-modules.scm new file mode 100644 index 0000000000..82b9627639 --- /dev/null +++ b/gnu/tests/linux-modules.scm @@ -0,0 +1,102 @@ +;;; GNU Guix --- Functional package management for GNU +;;; Copyright © 2019 Jakob L. Kreuze +;;; Copyright © 2020 Danny Milosavljevic +;;; +;;; This file is part of GNU Guix. +;;; +;;; GNU Guix is free software; you can redistribute it and/or modify it +;;; under the terms of the GNU General Public License as published by +;;; the Free Software Foundation; either version 3 of the License, or (at +;;; your option) any later version. +;;; +;;; GNU Guix is distributed in the hope that it will be useful, but +;;; WITHOUT ANY WARRANTY; without even the implied warranty of +;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +;;; GNU General Public License for more details. +;;; +;;; You should have received a copy of the GNU General Public License +;;; along with GNU Guix. If not, see . + +(define-module (gnu tests linux-modules) + #:use-module (gnu packages linux) + #:use-module (gnu system) + #:use-module (gnu system vm) + #:use-module (gnu tests) + #:use-module (guix derivations) + #:use-module (guix gexp) + #:use-module (guix modules) + #:use-module (guix monads) + #:use-module (guix store) + #:export (%test-loadable-kernel-modules-0 + %test-loadable-kernel-modules-1 + %test-loadable-kernel-modules-2)) + +;;; Commentary: +;;; +;;; Test kernel-loadable-modules. +;;; +;;; Code: + +(define* (module-loader-program os modules) + "Return an executable store item that, upon being evaluated, will dry-run +load MODULES." + (program-file + "load-kernel-modules.scm" + (with-imported-modules (source-module-closure '((guix build utils))) + #~(begin + (use-modules (guix build utils)) + (for-each (lambda (module) + (invoke (string-append #$kmod "/bin/modprobe") "-n" "--" module)) + '#$modules))))) + +(define* (run-loadable-kernel-modules-test module-packages module-names) + "Run a test of an OS having MODULE-PACKAGES, and modprobe MODULE-NAMES." + (define os + (marionette-operating-system + (operating-system + (inherit (simple-operating-system)) + (kernel-loadable-modules module-packages)) + #:imported-modules '((guix combinators)))) + (define vm (virtual-machine os)) + (define (test script) + (with-imported-modules '((gnu build marionette)) + #~(begin + (use-modules (gnu build marionette) + (srfi srfi-64)) + (define marionette + (make-marionette (list #$vm))) + (mkdir #$output) + (chdir #$output) + (test-begin "loadable-kernel-modules") + (test-assert "script successfully evaluated" + (marionette-eval + '(primitive-load #$script) + marionette)) + (test-end) + (exit (= (test-runner-fail-count (test-runner-current)) 0))))) + (gexp->derivation "loadable-kernel-modules" (test (module-loader-program os module-names)))) + +(define %test-loadable-kernel-modules-0 + (system-test + (name "loadable-kernel-modules-0") + (description "Tests loadable kernel modules facility of +with no extra modules.") + (value (run-loadable-kernel-modules-test '() '())))) + +(define %test-loadable-kernel-modules-1 + (system-test + (name "loadable-kernel-modules-1") + (description "Tests loadable kernel modules facility of +with one extra module.") + (value (run-loadable-kernel-modules-test + (list ddcci-driver-linux) + '("ddcci"))))) + +(define %test-loadable-kernel-modules-2 + (system-test + (name "loadable-kernel-modules-2") + (description "Tests loadable kernel modules facility of +with two extra modules.") + (value (run-loadable-kernel-modules-test + (list acpi-call-linux-module ddcci-driver-linux) + '("acpi_call" "ddcci"))))) diff --git a/guix/profiles.scm b/guix/profiles.scm index 0d38b2513f..e39067db04 100644 --- a/guix/profiles.scm +++ b/guix/profiles.scm @@ -10,6 +10,7 @@ ;;; Copyright © 2017 Maxim Cournoyer ;;; Copyright © 2019 Kyle Meyer ;;; Copyright © 2019 Mathieu Othacehe +;;; Copyright © 2020 Danny Milosavljevic ;;; ;;; This file is part of GNU Guix. ;;; @@ -139,7 +140,9 @@ %current-profile ensure-profile-directory canonicalize-profile - user-friendly-profile)) + user-friendly-profile + + linux-module-database)) ;;; Commentary: ;;; @@ -1137,6 +1140,49 @@ for both major versions of GTK+." (hook . gtk-im-modules))) (return #f))))) +(define (input-files inputs path) + "Given a list of directories INPUTS, return all entries with PATH in it." + ;; TODO: Use filter-map. + #~(begin + (use-modules (srfi srfi-1)) + (filter file-exists? + (map (lambda (x) + (string-append x #$path)) + '#$inputs)))) + +(define (linux-module-database manifest) + "Return a derivation that unions all the kernel modules in the manifest +and creates the dependency graph for all these kernel modules." + (mlet %store-monad ((kmod (manifest-lookup-package manifest "kmod"))) + (define build + (with-imported-modules (source-module-closure '((guix build utils) (gnu build linux-modules))) + #~(begin + (use-modules (ice-9 ftw)) + (use-modules (ice-9 match)) + (use-modules (srfi srfi-1)) ; append-map + (use-modules (guix build utils)) ; mkdir-p + (use-modules (gnu build linux-modules)) ; make-linux-module-directory + (let* ((inputs '#$(manifest-inputs manifest)) + (module-directories #$(input-files (manifest-inputs manifest) "/lib/modules")) + (directory-entries + (lambda (directory-name) + (scandir directory-name (lambda (basename) + (not (string-prefix? "." basename)))))) + ;; Note: Should usually result in one entry. + (versions (delete-duplicates + (append-map directory-entries + module-directories)))) + (match versions + ((version) + (make-linux-module-directory #$kmod inputs version #$output))) + (exit #t))))) + (gexp->derivation "linux-module-database" build + #:local-build? #t + #:substitutable? #f + #:properties + `((type . profile-hook) + (hook . linux-module-database))))) + (define (xdg-desktop-database manifest) "Return a derivation that builds the @file{mimeinfo.cache} database from desktop files. It's used to query what applications can handle a given From debbugs-submit-bounces@debbugs.gnu.org Sat Mar 14 14:41:02 2020 Received: (at 37868) by debbugs.gnu.org; 14 Mar 2020 18:41:02 +0000 Received: from localhost ([127.0.0.1]:34004 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1jDBiY-0000xu-9E for submit@debbugs.gnu.org; Sat, 14 Mar 2020 14:41:02 -0400 Received: from dd26836.kasserver.com ([85.13.145.193]:48852) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1jDBiV-0000xS-V2 for 37868@debbugs.gnu.org; Sat, 14 Mar 2020 14:41:01 -0400 Received: from localhost (unknown [185.17.13.127]) by dd26836.kasserver.com (Postfix) with ESMTPSA id 7E56C3360821; Sat, 14 Mar 2020 19:40:58 +0100 (CET) Date: Sat, 14 Mar 2020 19:40:55 +0100 From: Danny Milosavljevic To: 37868@debbugs.gnu.org Subject: Re: [PATCH v8] system: Add kernel-module-packages to operating-system. Message-ID: <20200314194055.6d857037@scratchpost.org> In-Reply-To: <20200227155029.2542-1-dannym@scratchpost.org> References: <20200227135146.5701-1-dannym@scratchpost.org> <20200227155029.2542-1-dannym@scratchpost.org> X-Mailer: Claws Mail 3.17.5 (GTK+ 2.24.32; x86_64-unknown-linux-gnu) MIME-Version: 1.0 Content-Type: multipart/signed; boundary="Sig_/zox=x1jMf6BR8iiZHMx8RyM"; protocol="application/pgp-signature"; micalg=pgp-sha256 X-Spam-Score: -0.7 (/) X-Debbugs-Envelope-To: 37868 Cc: Mark H Weaver , ludo@gnu.org X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -1.7 (-) --Sig_/zox=x1jMf6BR8iiZHMx8RyM Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: quoted-printable Hello, I'd like to push the patch to master on tuesday (with some minimal changes to the commit message). The only part I'm still unsure about is: ;; TODO: system, target. (profile-derivation (packages->manifest (cons kernel modules)) #:hooks (list linux-module-database) #:locales? #f #:allow-collisions? #f #:relative-symlinks? #t)) Will Guix do the derivation (especially the invocation of depmod) for the intended system and target? Apparently, module-init-tools are supposed to be cross-platform anyway and = work when invoking depmod for files of an other architecture than the architectu= re depmod is invoked on (and was compiled for). So maybe we can also just ign= ore the entire system/target propagation in this case. To test that, I tried ./pre-inst-env guix build -s armhf-linux -m etc/system-tests.scm and that seems to hang while compiling the kernel (?). I'm confident that that has no connection to the patch because it hangs ear= lier (at "AR drivers/net/built-in.a"). Then I tried ./pre-inst-env guix build --target=3Dxxx -m etc/system-tests.scm and that seems to ignore target entirely. [1] http://lists.busybox.net/pipermail/uclibc/2005-May/032671.html --Sig_/zox=x1jMf6BR8iiZHMx8RyM Content-Type: application/pgp-signature Content-Description: OpenPGP digital signature -----BEGIN PGP SIGNATURE----- iQEzBAEBCAAdFiEEds7GsXJ0tGXALbPZ5xo1VCwwuqUFAl5tJTcACgkQ5xo1VCww uqWS7Qf8CFJf3ZADwZD1RnVMVANWMAj7m6ffpB7pdcj9v4hhu9LTsZ8/JWCwX6XU Cvs6uqeZsVWrsrsecTZxS5gM79+ijvay7xwPAqb+p9Slvq3tJEYIatis/5SwCd6Z Wzgv2P9yQRQ2Z180Vjksa0yQDOQGtmao6b8QOkvRVNGGTzZPDX+xsKDYZqFsKrsp yN9KKsRy96W5wdA8x9ov9K4XJj3vhFsj7qm0mnl7eUxHv+UhVRlL7oDRdUPQ9l9Q 93PZF4dinfwYp4S8NW1G+nNwws2jlWeqj2OSIUc/nvMHLUTN7z8OX5ZCN0U8uSWw Kw7pdhXE/Jad3lFBjz5UocA0CVIBdw== =16bD -----END PGP SIGNATURE----- --Sig_/zox=x1jMf6BR8iiZHMx8RyM-- From debbugs-submit-bounces@debbugs.gnu.org Sun Mar 15 06:28:49 2020 Received: (at submit) by debbugs.gnu.org; 15 Mar 2020 10:28:49 +0000 Received: from localhost ([127.0.0.1]:34259 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1jDQVk-0005wr-SG for submit@debbugs.gnu.org; Sun, 15 Mar 2020 06:28:49 -0400 Received: from lists.gnu.org ([209.51.188.17]:38016) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1jDQVi-0005wb-41 for submit@debbugs.gnu.org; Sun, 15 Mar 2020 06:28:46 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:42853) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1jDQVg-0003pX-Lu for guix-patches@gnu.org; Sun, 15 Mar 2020 06:28:45 -0400 X-Spam-Checker-Version: SpamAssassin 3.3.2 (2011-06-06) on eggs.gnu.org X-Spam-Level: X-Spam-Status: No, score=0.8 required=5.0 tests=BAYES_50,FREEMAIL_FROM autolearn=disabled version=3.3.2 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1jDQVf-0001se-C5 for guix-patches@gnu.org; Sun, 15 Mar 2020 06:28:44 -0400 Received: from mail-wr1-x431.google.com ([2a00:1450:4864:20::431]:40677) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1jDQVd-0001co-IN; Sun, 15 Mar 2020 06:28:41 -0400 Received: by mail-wr1-x431.google.com with SMTP id f3so10547294wrw.7; Sun, 15 Mar 2020 03:28:41 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=references:user-agent:from:to:cc:subject:in-reply-to:date :message-id:mime-version; bh=sYAhIGqI8UkD+tJhJuGGaxUZ5ZMr3szTP36huDBwgPM=; b=ZYJHOf2VF3sp7NZZdmGDXFEIJh/3h+y84MPXeY4bRM+BxMZEe7q2gW7+zloRimA9QB YtunZxBBpo74PNxniqlI3sVpXScB25c8Fz580nXfzUBFsP9CCiLX6jA50zVWHiX57he0 Kpsb1Hy/C3HJaafjzn6DKWFLD7dE0Yk5rCx8pirR1frowux6Du75OsYPwiWtf+jz1xOn PVuk94UZG9C6WFRIKfooTuQ/7eM9IVskI0fBekr/LkiQwbsKONUB50M4EFp0NB+Cdl9a Oesj+83M1MDPjwd3KooX03bqlqZxsUobWSIeq/d6BTEaPQgXdz09w4fnBJKI6Uo+ssRp 1x5w== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:references:user-agent:from:to:cc:subject :in-reply-to:date:message-id:mime-version; bh=sYAhIGqI8UkD+tJhJuGGaxUZ5ZMr3szTP36huDBwgPM=; b=KGzz+1xp/9WQdqlVEnXLW/rBOGWFpKxyN0N8h/A4C6c/eX/rAqUHjvCp03dSVT16F1 Le59xGqGbifOykiZDIj2CBbf01Hk3Gzlvu0StDmlk509FOG3D1kOQA1tcvjYH14laY6I Qc3gcyTet90MzxKwzX7CmIEVRNwmvLeydTTD0VKRKVV7n10nHAc/E+lpEPz9kwUwuTrL YD0+VS3Ui9JypgWpcUuJARu7hwzIiZ6K5UqUi88GPn/s/vM6DHO3HEDtfj++VD9Rsy33 zNLvs53geBCsZm4Ht6kliNCszjVM6V2qW8rv5h4rtHhWRWsUUxMmW3ROnJ3/qQbpI2/Q Pi3A== X-Gm-Message-State: ANhLgQ3IUE55Uacmc+DndwxaPq9dVywdmvMpXQc+OnF6kZT+OnlUU/2/ bFGdfrEPsrpCgP8ccNdY0Mkyy22/ X-Google-Smtp-Source: ADFU+vtAR1u3xlExcO3jlIUsPwY7wTwzusHvjJZ8FHhCnrG4VXIb8Btu8Nmv2KIf6aqvBwH2D6NwIw== X-Received: by 2002:adf:e6ce:: with SMTP id y14mr24602935wrm.152.1584268119285; Sun, 15 Mar 2020 03:28:39 -0700 (PDT) Received: from cervin ([2a01:e0a:fa:a50:709f:c263:3a05:fdf9]) by smtp.gmail.com with ESMTPSA id b16sm86589057wrq.14.2020.03.15.03.28.37 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 15 Mar 2020 03:28:38 -0700 (PDT) References: <20200227135146.5701-1-dannym@scratchpost.org> <20200227155029.2542-1-dannym@scratchpost.org> <20200314194055.6d857037@scratchpost.org> User-agent: mu4e 1.2.0; emacs 26.3 From: Mathieu Othacehe To: guix-patches@gnu.org Subject: Re: [bug#37868] [PATCH v8] system: Add kernel-module-packages to operating-system. In-reply-to: <20200314194055.6d857037@scratchpost.org> Date: Sun, 15 Mar 2020 11:28:37 +0100 Message-ID: <877dzlgbe2.fsf@gmail.com> MIME-Version: 1.0 Content-Type: text/plain X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 2a00:1450:4864:20::431 X-Spam-Score: 0.3 (/) X-Debbugs-Envelope-To: submit Cc: Mark H Weaver , ludo@gnu.org, 37868@debbugs.gnu.org X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -0.7 (/) Hello Danny, > Will Guix do the derivation (especially the invocation of depmod) for the > intended system and target? Yes, "profile-derivation" should use the current system or target if the #:system and #:target arguments are #f. > Apparently, module-init-tools are supposed to be cross-platform anyway and work > when invoking depmod for files of an other architecture than the architecture > depmod is invoked on (and was compiled for). So maybe we can also just ignore > the entire system/target propagation in this case. In that case, you should use #+kmod instead of #$kmod. This way, when cross-compiling, the native kmod would be used. > Then I tried > > ./pre-inst-env guix build --target=xxx -m etc/system-tests.scm > > and that seems to ignore target entirely. I'm not sure this has ever been tested. Support of cross-compilation for Guix System is still wip, even if since a few days, core-updates is in a good shape. Anyway, if you're willing to wait a few days, I can test your patch does not break system cross-compilation on core-updates. Regarding --system, producing disk-images is currently broken on all branches[1], so it will be harder to test it for now. Also, here are a few remarks about your patch. +(define (depmod! kmod version output) + "Given an (existing) OUTPUT directory, invoke KMOD's depmod on it for +kernel version VERSION." "OUTPUT" is maybe not the best naming as you read multiple "input" files from it. Maybe just "DIRECTORY"? + (let ((destination-directory (string-append output "/lib/modules/" version)) + ;; Note: "System.map" is an input file. + (maps-file (string-append output "/System.map")) + ;; Note: "Module.symvers" is an input file. + (symvers-file (string-append output "/Module.symvers"))) + (for-each (lambda (basename) + (when (and (string-prefix? "modules." basename) + ;; Note: "modules.builtin" is an input file. + (not (string=? "modules.builtin" basename)) + ;; Note: "modules.order" is an input file. + (not (string=? "modules.order" basename))) + (delete-file (string-append destination-directory "/" + basename)))) You can maybe add a comment explaining what's the point of this operation. + (scandir destination-directory)) + (invoke (string-append kmod "/bin/depmod") + "-e" ; Report symbols that aren't supplied + ;"-w" ; Warn on duplicates + "-b" output + "-F" maps-file + "-E" symvers-file The man page of depmod says that '-F' and '-E' options are mutually exclusive. + (let* ((versions (filter (lambda (name) + (not (string-prefix? "." name))) + (scandir moddir))) + (version (match versions + ((x) x)))) If versions only contains one element, then you can use find instead of filtering and matching. + ;; TODO: system, target. + (profile-derivation + (packages->manifest + (cons kernel modules)) + #:hooks (list linux-module-database) + #:locales? #f + #:allow-collisions? #f + #:relative-symlinks? #t)) + (initrd -> (operating-system-initrd-file os)) + (params (operating-system-boot-parameters-file os))) As stated above, I think you are fine removing the TODO. +(define (input-files inputs path) + "Given a list of directories INPUTS, return all entries with PATH in it." + ;; TODO: Use filter-map. + #~(begin + (use-modules (srfi srfi-1)) + (filter file-exists? + (map (lambda (x) + (string-append x #$path)) + '#$inputs)))) + This TODO can be resolved I think :) +(define (linux-module-database manifest) + "Return a derivation that unions all the kernel modules in the manifest +and creates the dependency graph for all these kernel modules." + (mlet %store-monad ((kmod (manifest-lookup-package manifest "kmod"))) + (define build + (with-imported-modules (source-module-closure '((guix build utils) (gnu build linux-modules))) + #~(begin + (use-modules (ice-9 ftw)) + (use-modules (ice-9 match)) + (use-modules (srfi srfi-1)) ; append-map + (use-modules (guix build utils)) ; mkdir-p + (use-modules (gnu build linux-modules)) ; make-linux-module-directory + (let* ((inputs '#$(manifest-inputs manifest)) + (module-directories #$(input-files (manifest-inputs manifest) "/lib/modules")) + (directory-entries + (lambda (directory-name) + (scandir directory-name (lambda (basename) + (not (string-prefix? "." basename)))))) + ;; Note: Should usually result in one entry. + (versions (delete-duplicates + (append-map directory-entries + module-directories)))) This part is over the column limit. + (match versions + ((version) + (make-linux-module-directory #$kmod inputs version #$output))) If depmod output is system agnostic, then we should use #+kmod. If that's not the case, this will be an issue as running #$kmod won't work when cross-compiling. Thanks, Mathieu From debbugs-submit-bounces@debbugs.gnu.org Sun Mar 15 06:33:50 2020 Received: (at submit) by debbugs.gnu.org; 15 Mar 2020 10:33:51 +0000 Received: from localhost ([127.0.0.1]:34265 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1jDQac-00067B-M0 for submit@debbugs.gnu.org; Sun, 15 Mar 2020 06:33:50 -0400 Received: from lists.gnu.org ([209.51.188.17]:55580) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1jDQaa-00066w-LF for submit@debbugs.gnu.org; Sun, 15 Mar 2020 06:33:48 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:54477) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1jDQaZ-0004Id-JB for guix-patches@gnu.org; Sun, 15 Mar 2020 06:33:48 -0400 X-Spam-Checker-Version: SpamAssassin 3.3.2 (2011-06-06) on eggs.gnu.org X-Spam-Level: X-Spam-Status: No, score=0.8 required=5.0 tests=BAYES_50,FREEMAIL_FROM, URIBL_BLOCKED autolearn=disabled version=3.3.2 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1jDQaX-0007CI-LY for guix-patches@gnu.org; Sun, 15 Mar 2020 06:33:47 -0400 Received: from mail-wr1-x443.google.com ([2a00:1450:4864:20::443]:41696) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1jDQaW-00071K-6q; Sun, 15 Mar 2020 06:33:44 -0400 Received: by mail-wr1-x443.google.com with SMTP id f11so774160wrp.8; Sun, 15 Mar 2020 03:33:44 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=references:user-agent:from:to:cc:subject:in-reply-to:date :message-id:mime-version; bh=TPlbRLRc9pLj+lo8DfakykOy1o4JpmE9M/sd/QpoZDQ=; b=Jpxtl2yJFF3pRV9bDj9s+JyWdhpMtz9erM4WhsTmNA3XztAOCiFFYE/mTLKqRzKN79 BPhIwLUZCNYv+RYZzq5x+PkGjT4/K7FN1170nh6L31petiFCGxN0Ug4bQkAO4cJKzalb c7Ts+U6TjeooGwAZVB3pscTFpMzVTBLcK6k69+4lZ6VtjlMmvFC5CGZU4WCEyjBHIXf3 4pXlv6+AYBdkLB7Pokk2yIo1C5XND49Rs8DuUV0oDfxomeCq+ceyCyh003uJ3Z6iCqIR /opmKYV1TEIhLBE5hN43mNjlskgV7ICU0Tl4dGUYlKCY+flWjd3QzJu2SVSWkGY1i8R0 83Mw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:references:user-agent:from:to:cc:subject :in-reply-to:date:message-id:mime-version; bh=TPlbRLRc9pLj+lo8DfakykOy1o4JpmE9M/sd/QpoZDQ=; b=K0YxEhykgew4l+I7kmDY7dt7FIVcFeFspqVb0/Scpbq6rrLpbBISXljghbfhmMPzxW subH5eJ4Y5PW7GWOKqUQMZ9gVSBUUOfPHAlwy4XJpLgQZ7cWSiUVYIfB3YsMGNOhewZr 5K/XhyGlWQGCHnaEs+24Rn71ysOOJhBlH847GVjZTnX5awCurWuaaYIlWYHp8I2tfW5y f8sFnmIRsTtkFXrFFW5e0ebgWyLC6pvP23zmTxCpL9uzsIQ9cdr84Ux6uarOQgHbV2VX lKYnbekK/CYVHHYm7Z/RQRu/XwxQ4ksbzSeScpdcjJWhLJGU9j6IttrIyrEpkkQT78Hj Y82A== X-Gm-Message-State: ANhLgQ1jN4gsbArwZKgn7lkZUc06ryLAsB5Uw2g9c12zL3uCK8wNyjUO v7znM7Vlz3txJmGzhpr5kGMkZWli X-Google-Smtp-Source: ADFU+vt2n3c3X0+sKNcxBocFJ9q+IGj97FRYyv70BSVBLyrv34E99+B1fTuJqbX8t73uH6YwgoHbPg== X-Received: by 2002:adf:f58f:: with SMTP id f15mr30691149wro.16.1584268422989; Sun, 15 Mar 2020 03:33:42 -0700 (PDT) Received: from cervin ([2a01:e0a:fa:a50:709f:c263:3a05:fdf9]) by smtp.gmail.com with ESMTPSA id l8sm25634209wmj.2.2020.03.15.03.33.42 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 15 Mar 2020 03:33:42 -0700 (PDT) References: <20200227135146.5701-1-dannym@scratchpost.org> <20200227155029.2542-1-dannym@scratchpost.org> <20200314194055.6d857037@scratchpost.org> <877dzlgbe2.fsf@gmail.com> User-agent: mu4e 1.2.0; emacs 26.3 From: Mathieu Othacehe To: guix-patches@gnu.org Subject: Re: [bug#37868] [PATCH v8] system: Add kernel-module-packages to operating-system. In-reply-to: <877dzlgbe2.fsf@gmail.com> Date: Sun, 15 Mar 2020 11:33:41 +0100 Message-ID: <875zf5gb5m.fsf@gmail.com> MIME-Version: 1.0 Content-Type: text/plain X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 2a00:1450:4864:20::443 X-Spam-Score: 0.3 (/) X-Debbugs-Envelope-To: submit Cc: Mark H Weaver , ludo@gnu.org, 37868@debbugs.gnu.org X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -0.7 (/) > Regarding --system, producing disk-images is currently broken on all > branches[1], so it will be harder to test it for now. And the forgotten link! [1]: https://lists.gnu.org/archive/html/guix-devel/2019-12/msg00099.html Mathieu From debbugs-submit-bounces@debbugs.gnu.org Sun Mar 15 14:17:46 2020 Received: (at 37868) by debbugs.gnu.org; 15 Mar 2020 18:17:46 +0000 Received: from localhost ([127.0.0.1]:35512 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1jDXpZ-0003su-Bb for submit@debbugs.gnu.org; Sun, 15 Mar 2020 14:17:46 -0400 Received: from dd26836.kasserver.com ([85.13.145.193]:50234) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1jDXpW-0003sh-WE for 37868@debbugs.gnu.org; Sun, 15 Mar 2020 14:17:43 -0400 Received: from localhost (unknown [185.17.13.127]) by dd26836.kasserver.com (Postfix) with ESMTPSA id 88C583363472; Sun, 15 Mar 2020 19:17:41 +0100 (CET) Date: Sun, 15 Mar 2020 19:17:36 +0100 From: Danny Milosavljevic To: Mathieu Othacehe Subject: Re: [bug#37868] [PATCH v8] system: Add kernel-module-packages to operating-system. Message-ID: <20200315191736.33ed8abf@scratchpost.org> In-Reply-To: <877dzlgbe2.fsf@gmail.com> References: <20200227135146.5701-1-dannym@scratchpost.org> <20200227155029.2542-1-dannym@scratchpost.org> <20200314194055.6d857037@scratchpost.org> <877dzlgbe2.fsf@gmail.com> X-Mailer: Claws Mail 3.17.5 (GTK+ 2.24.32; x86_64-unknown-linux-gnu) MIME-Version: 1.0 Content-Type: multipart/signed; boundary="Sig_/zPeYuyrtERVkVbl_LBAZ.0R"; protocol="application/pgp-signature"; micalg=pgp-sha256 X-Spam-Score: -0.7 (/) X-Debbugs-Envelope-To: 37868 Cc: mhw@netris.org, ludo@gnu.org, 37868@debbugs.gnu.org X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -1.7 (-) --Sig_/zPeYuyrtERVkVbl_LBAZ.0R Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: quoted-printable Hi Mathieu, On Sun, 15 Mar 2020 11:28:37 +0100 Mathieu Othacehe wrote: > Yes, "profile-derivation" should use the current system or target if the > #:system and #:target arguments are #f. OK! > In that case, you should use #+kmod instead of #$kmod. This way, when > cross-compiling, the native kmod would be used. > Anyway, if you're willing to wait a few days, I can test your patch does > not break system cross-compilation on core-updates. Sure. > The man page of depmod says that '-F' and '-E' options are mutually > exclusive. Linus Torvalds seems to be in favor of not supporting Module.symvers anymor= e, so let's use "-F"... >=20 > + (let* ((versions (filter (lambda (name) > + (not (string-prefix? "." name)= )) > + (scandir moddir))) > + (version (match versions > + ((x) x)))) >=20 > If versions only contains one element, then you can use find instead of > filtering and matching. I don't really know that it only contains one element. In normal supported operation it should--but if the user does something stupid (put kernel version A and module version B into the operating-system, where A !=3D B), I want it to fail and not depmod half the things (neither all the things, f= or that matter). > As stated above, I think you are fine removing the TODO. Cool! --Sig_/zPeYuyrtERVkVbl_LBAZ.0R Content-Type: application/pgp-signature Content-Description: OpenPGP digital signature -----BEGIN PGP SIGNATURE----- iQEzBAEBCAAdFiEEds7GsXJ0tGXALbPZ5xo1VCwwuqUFAl5ucUAACgkQ5xo1VCww uqVidgf/a/Q3RJEAZUsFuElmRQuRshz2+gw2JNAwemJKhLQasWPqsDErIqrNfAhU mdrAGGEI3LaFwuPldrgAxZKBTIKCunjmZcgX9s8GqFds2ayQOSPhkqKrLg+vTt8G QXGtWuZuLXY3KPGfb/wXGFy0K3EGvOfRnFC6b29XB8rVb+wFpZ2X9wz6TOpGUZBz c8oaTqq7BulOgoyu+tJTSGGLcju99rlSTYDiVbd+wluUV+P8O5CLn3uxNw521Slg QrbZYmMqr1r6QjdDzGblr+Yub36VN8tSNA13meyu3AJenmoAvFiOaMn/Z6G7SnAm 22QPMZ89z27DCHdSbT73L9gTqtR1iA== =9DR3 -----END PGP SIGNATURE----- --Sig_/zPeYuyrtERVkVbl_LBAZ.0R-- From debbugs-submit-bounces@debbugs.gnu.org Sun Mar 15 17:00:28 2020 Received: (at 37868) by debbugs.gnu.org; 15 Mar 2020 21:00:28 +0000 Received: from localhost ([127.0.0.1]:35685 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1jDaN1-0008Pp-O3 for submit@debbugs.gnu.org; Sun, 15 Mar 2020 17:00:28 -0400 Received: from eggs.gnu.org ([209.51.188.92]:59487) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1jDaMw-0008PZ-QG for 37868@debbugs.gnu.org; Sun, 15 Mar 2020 17:00:26 -0400 Received: from fencepost.gnu.org ([2001:470:142:3::e]:59710) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1jDaMi-0000RL-P9; Sun, 15 Mar 2020 17:00:15 -0400 Received: from [2a01:e0a:1d:7270:af76:b9b:ca24:c465] (port=41596 helo=ribbon) by fencepost.gnu.org with esmtpsa (TLS1.2:RSA_AES_256_CBC_SHA1:256) (Exim 4.82) (envelope-from ) id 1jDaMg-0003vJ-HU; Sun, 15 Mar 2020 17:00:08 -0400 From: =?utf-8?Q?Ludovic_Court=C3=A8s?= To: Danny Milosavljevic Subject: Re: [PATCH v6] system: Add kernel-module-packages to operating-system. References: <20200226195929.3615-1-dannym@scratchpost.org> <20200227122519.3226-1-dannym@scratchpost.org> X-URL: http://www.fdn.fr/~lcourtes/ X-Revolutionary-Date: 26 =?utf-8?Q?Vent=C3=B4se?= an 228 de la =?utf-8?Q?R?= =?utf-8?Q?=C3=A9volution?= X-PGP-Key-ID: 0x090B11993D9AEBB5 X-PGP-Key: http://www.fdn.fr/~lcourtes/ludovic.asc X-PGP-Fingerprint: 3CE4 6455 8A84 FDC6 9DB4 0CFB 090B 1199 3D9A EBB5 X-OS: x86_64-pc-linux-gnu Date: Sun, 15 Mar 2020 22:00:04 +0100 In-Reply-To: <20200227122519.3226-1-dannym@scratchpost.org> (Danny Milosavljevic's message of "Thu, 27 Feb 2020 13:25:19 +0100") Message-ID: <877dzlibaj.fsf@gnu.org> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/26.3 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Spam-Score: -0.7 (/) X-Debbugs-Envelope-To: 37868 Cc: Mark H Weaver , 37868@debbugs.gnu.org X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -1.7 (-) Hi! Danny Milosavljevic skribis: > * gnu/system.scm (): Add kernel-module-packages. > (operating-system-directory-base-entries): Use it. > * doc/guix.texi (operating-system Reference): Document KERNEL-LOADABLE-MO= DULES. > * gnu/build/linux-modules.scm (depmod!): New procedure. > (make-linux-module-directory): New procedure. Export it. > * guix/profiles.scm (linux-module-database): New procedure. Export it. > * gnu/tests/linux-modules.scm: New file. > * gnu/local.mk (GNU_SYSTEM_MODULES): Add it. > * gnu/packages/linux.scm (make-linux-libre*)[arguments]<#:phases>[install= ]: > Disable depmod. Remove "build" and "source" symlinks. [...] > +@item @code{kernel-loadable-modules} (default: '()) > +A list of objects (usually packages) to collect loadable kernel modules = from. Perhaps you can add an example. > +(define (input-files inputs file) > + "Given a list of directories INPUTS, return all entries with FILE in i= t." > + ;; TODO: Use filter-map. > + (filter file-exists? > + (map (lambda (x) > + (string-append x file)) > + inputs))) =E2=80=9CInput=E2=80=9D in Guix is usually used to describe association lis= ts. To avoid confusion, I propose: (define (existing-files directories base) "Return the absolute file name of every file named BASE under the DIRECTORIES." (filter-map (lambda (directory) (let ((file (string-append directory "/" base))) (and (file-exists? file) file))) inputs) > +(define (depmod! kmod inputs version destination-directory output) There=E2=80=99s shouldn=E2=80=99t be a bang, by convention. Also please ad= d a docstring. > + (let ((maps-files (input-files inputs "/System.map")) > + (symvers-files (input-files inputs "/Module.symvers"))) > + (for-each (lambda (basename) > + (when (and (string-prefix? "modules." basename) > + (not (string=3D? "modules.builtin" basename)) > + (not (string=3D? "modules.order" basename))) > + (delete-file (string-append destination-directory "/" > + basename)))) > + (scandir destination-directory)) > + (invoke (string-append kmod "/bin/depmod") Generally, for this kind of utility function, we assume that the tool is in $PATH, which allows us to avoid carrying its file name throughout the API. I=E2=80=99d suggest doing the same here. > +(define (make-linux-module-directory kmod inputs version output) > + "Ensures that the directory OUTPUT...VERSION can be used by the Linux > +kernel to load modules via KMOD. The modules to put into > +OUTPUT are taken from INPUTS." Perhaps be more specific as to the fact that it=E2=80=99s creating =E2=80= =98System.maps=E2=80=99 etc. databases? > (let ((locale (operating-system-locale-directory os))) > - (mlet %store-monad ((kernel -> (operating-system-kernel os)) > - (initrd -> (operating-system-initrd-file os)) > - (params (operating-system-boot-parameters-fil= e os))) > + (mlet* %store-monad ((kernel -> (operating-system-kernel os)) > + (modules -> > + (operating-system-kernel-loadable-modules os)) > + (kernel > + ;; TODO: system, target. > + (profile-derivation > + (packages->manifest > + (cons kernel modules)) > + #:hooks (list linux-module-database) > + #:locales? #f > + #:allow-collisions? #f > + #:relative-symlinks? #t)) I think the system and target will be correct, but perhaps you can double-check why doing =E2=80=98guix system build -s =E2=80=A6 -d=E2=80=99 = and checking the relevant .drv. :-) I don=E2=80=99t think #:allow-collisions?, #:locales? and #:relative-symlin= ks? are needed, so I=E2=80=99d recommend removing them. > +++ b/gnu/tests/linux-modules.scm Nice! > +;; XXX: Dupe in gnu/build/linux-modules.scm . > +(define (input-files inputs path) > + "Given a list of directories INPUTS, return all entries with PATH in i= t." > + ;; TODO: Use filter-map. > + #~(begin > + (use-modules (srfi srfi-1)) > + (filter file-exists? > + (map (lambda (x) > + (string-append x #$path)) > + '#$inputs)))) Same comment as above. :-) > +(define (linux-module-database manifest) > + "Return a derivation that unions all the kernel modules in the manifest > +and creates the dependency graph for all these kernel modules." Perhaps explicitly write =E2=80=9CThis is meant to be used as a profile hoo= k.=E2=80=9D or similar. > + (define build > + (with-imported-modules (source-module-closure '((guix build utils)= (gnu build linux-modules))) 80 chars please. :-) > + #~(begin > + (use-modules (ice-9 ftw)) > + (use-modules (ice-9 match)) > + (use-modules (srfi srfi-1)) ; append-map > + (use-modules (guix build utils)) ; mkdir-p > + (use-modules (gnu build linux-modules)) Please make it only one =E2=80=98use-modules=E2=80=99 form. > + (let* ((inputs '#$(manifest-inputs manifest)) > + (module-directories #$(input-files (manifest-inputs m= anifest) "/lib/modules")) > + (directory-entries > + (lambda (directory-name) > + (scandir directory-name (lambda (basename) > + (not (string-prefix? "."= basename)))))) 80 chars please, and also one-word identifiers are preferred for local variables. > + ;; Note: Should usually result in one entry. > + (versions (delete-duplicates > + (append-map directory-entries > + module-directories)))) > + ;; TODO: if len(module-directories) =3D=3D 1: return mod= ule-directories[0] > + (mkdir-p (string-append #$output "/lib")) > + (match versions > + ((version) > + (make-linux-module-directory #$kmod inputs version #$o= utput))) > + (exit #t))))) No need for =E2=80=98exit=E2=80=99, but perhaps and =E2=80=98error=E2=80=99= call in the unmatched case? Thanks, and apologies for the delay! Ludo=E2=80=99. From debbugs-submit-bounces@debbugs.gnu.org Sun Mar 15 17:03:02 2020 Received: (at 37868) by debbugs.gnu.org; 15 Mar 2020 21:03:03 +0000 Received: from localhost ([127.0.0.1]:35693 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1jDaPW-0008Ud-Mv for submit@debbugs.gnu.org; Sun, 15 Mar 2020 17:03:02 -0400 Received: from eggs.gnu.org ([209.51.188.92]:36719) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1jDaPQ-0008U4-TB for 37868@debbugs.gnu.org; Sun, 15 Mar 2020 17:03:02 -0400 Received: from fencepost.gnu.org ([2001:470:142:3::e]:59757) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1jDaPJ-0000DC-1Z; Sun, 15 Mar 2020 17:02:49 -0400 Received: from [2a01:e0a:1d:7270:af76:b9b:ca24:c465] (port=41598 helo=ribbon) by fencepost.gnu.org with esmtpsa (TLS1.2:RSA_AES_256_CBC_SHA1:256) (Exim 4.82) (envelope-from ) id 1jDaPH-0004to-Fs; Sun, 15 Mar 2020 17:02:47 -0400 From: =?utf-8?Q?Ludovic_Court=C3=A8s?= To: Danny Milosavljevic Subject: Re: [PATCH v8] system: Add kernel-module-packages to operating-system. References: <20200227135146.5701-1-dannym@scratchpost.org> <20200227155029.2542-1-dannym@scratchpost.org> <20200314194055.6d857037@scratchpost.org> X-URL: http://www.fdn.fr/~lcourtes/ X-Revolutionary-Date: 26 =?utf-8?Q?Vent=C3=B4se?= an 228 de la =?utf-8?Q?R?= =?utf-8?Q?=C3=A9volution?= X-PGP-Key-ID: 0x090B11993D9AEBB5 X-PGP-Key: http://www.fdn.fr/~lcourtes/ludovic.asc X-PGP-Fingerprint: 3CE4 6455 8A84 FDC6 9DB4 0CFB 090B 1199 3D9A EBB5 X-OS: x86_64-pc-linux-gnu Date: Sun, 15 Mar 2020 22:02:45 +0100 In-Reply-To: <20200314194055.6d857037@scratchpost.org> (Danny Milosavljevic's message of "Sat, 14 Mar 2020 19:40:55 +0100") Message-ID: <8736a9ib62.fsf@gnu.org> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/26.3 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Spam-Score: -0.7 (/) X-Debbugs-Envelope-To: 37868 Cc: Mark H Weaver , 37868@debbugs.gnu.org X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -1.7 (-) Hi, Danny Milosavljevic skribis: > The only part I'm still unsure about is: > > ;; TODO: system, target. > (profile-derivation > (packages->manifest > (cons kernel modules)) > #:hooks (list linux-module-database) > #:locales? #f > #:allow-collisions? #f > #:relative-symlinks? #t)) > > Will Guix do the derivation (especially the invocation of depmod) for the > intended system and target? I would just write a test OS definition, and then run: ./pre-inst-env guix system build test.scm -nd -s armhf-linux >From there, you can inspect the =E2=80=98linux-module-database=E2=80=99 der= ivation, check its system type, and check the kmod referred to in its =E2=80=9C-buil= der=E2=80=9D file (is it the file name of the armhf-linux kmod?). Likewise for cross-compilation. HTH! Ludo=E2=80=99. From debbugs-submit-bounces@debbugs.gnu.org Sun Mar 15 18:09:10 2020 Received: (at 37868) by debbugs.gnu.org; 15 Mar 2020 22:09:10 +0000 Received: from localhost ([127.0.0.1]:35768 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1jDbRV-0001pg-OS for submit@debbugs.gnu.org; Sun, 15 Mar 2020 18:09:09 -0400 Received: from dd26836.kasserver.com ([85.13.145.193]:41554) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1jDbRU-0001pZ-IL for 37868@debbugs.gnu.org; Sun, 15 Mar 2020 18:09:09 -0400 Received: from localhost (unknown [185.17.13.127]) by dd26836.kasserver.com (Postfix) with ESMTPSA id 037623363472; Sun, 15 Mar 2020 23:09:06 +0100 (CET) Date: Sun, 15 Mar 2020 23:09:04 +0100 From: Danny Milosavljevic To: Ludovic =?ISO-8859-1?Q?Court=E8s?= Subject: Re: [PATCH v6] system: Add kernel-module-packages to operating-system. Message-ID: <20200315224832.5f2e336c@scratchpost.org> In-Reply-To: <877dzlibaj.fsf@gnu.org> References: <20200226195929.3615-1-dannym@scratchpost.org> <20200227122519.3226-1-dannym@scratchpost.org> <877dzlibaj.fsf@gnu.org> X-Mailer: Claws Mail 3.17.5 (GTK+ 2.24.32; x86_64-unknown-linux-gnu) MIME-Version: 1.0 Content-Type: multipart/signed; boundary="Sig_/Iz1xf+8kjDBAUP0p7xi0vGN"; protocol="application/pgp-signature"; micalg=pgp-sha256 X-Spam-Score: -0.7 (/) X-Debbugs-Envelope-To: 37868 Cc: Mark H Weaver , 37868@debbugs.gnu.org X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -1.7 (-) --Sig_/Iz1xf+8kjDBAUP0p7xi0vGN Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable Hi Ludo, On Sun, 15 Mar 2020 22:00:04 +0100 Ludovic Court=C3=A8s wrote: > I don=E2=80=99t think #:allow-collisions?, #:locales? and #:relative-syml= inks? > are needed, so I=E2=80=99d recommend removing them. Removing allow-collisions. Otherwise the defaults are different. I'm pretty sure that we don't need locales for Linux kernel modules, for example :) That said, I can do it--but it would increase build dependencies. > > + (let* ((inputs '#$(manifest-inputs manifest)) > > + (module-directories #$(input-files (manifest-inputs= manifest) "/lib/modules")) > > + (directory-entries > > + (lambda (directory-name) > > + (scandir directory-name (lambda (basename) > > + (not (string-prefix? "= ." basename)))))) =20 >=20 > also one-word identifiers are preferred for local > variables. I'd like to do that but it would lose information here. "modules" would be too vague. "directories" would be non-unique. (What "module-directories" means is "'/lib/modules'-directories", literally) "entries" would be too vague too. Entries of what? (Especially since that's a procedure). I'll make it say "directory" instead of "directory-name" there. Note: The "existing-files" procedure exists only in order to allow us to build Linux kernels without any modules (neither in linux-libre nor anywhere else) and have the profile hook succeed. Maybe it's written in an overly general way for that? What do you think? (It's actually kinda bad that I ignore kernel-loadable-modules which have no "/lib/modules" in it (better would be an error)--but I wasn't sure whether manifest-inputs is guaranteed to keep the original order of the entries--which would be: linux-libre first) --Sig_/Iz1xf+8kjDBAUP0p7xi0vGN Content-Type: application/pgp-signature Content-Description: OpenPGP digital signature -----BEGIN PGP SIGNATURE----- iQEzBAEBCAAdFiEEds7GsXJ0tGXALbPZ5xo1VCwwuqUFAl5up4AACgkQ5xo1VCww uqXoSwf/XSlyTXoS5uD8S9OQwdr8Q0jN9HI6ZX18Buw3mn9ZY6c5rxlIthCvgUaJ eEmd7KONWBHpNzwqLi8miBSkfYziDyv80BHt8qJuiY9sLK4xPl810XL0eMqB5QN2 U1Mpsj8IiIyZ2DzuZKV4FB3Wh+z7f+yWdjpBrbqWVZty9UpQrDrE2rA8JyRgGAxY HShfTtduD82zm6nZg/ChOGe2mixe/eeqcF6cvRDv/o8f5Hzfw2QRpA1TZT3PyZBo Ceejq1UFj7rQ0o7BubcIsrcHMrEbV8y5nMOczB4lf4UaV0wHYJVBmcf4EH99j/YC FYjN3fZN4HhGYnvIOayf6KBmwa7gtg== =Lrsc -----END PGP SIGNATURE----- --Sig_/Iz1xf+8kjDBAUP0p7xi0vGN-- From debbugs-submit-bounces@debbugs.gnu.org Mon Mar 16 04:55:47 2020 Received: (at 37868) by debbugs.gnu.org; 16 Mar 2020 08:55:47 +0000 Received: from localhost ([127.0.0.1]:36038 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1jDlXH-0003q8-4H for submit@debbugs.gnu.org; Mon, 16 Mar 2020 04:55:47 -0400 Received: from eggs.gnu.org ([209.51.188.92]:40732) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1jDlXF-0003pt-5r for 37868@debbugs.gnu.org; Mon, 16 Mar 2020 04:55:46 -0400 Received: from fencepost.gnu.org ([2001:470:142:3::e]:39145) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1jDlX9-0003Je-GV; Mon, 16 Mar 2020 04:55:39 -0400 Received: from [2a01:e0a:1d:7270:af76:b9b:ca24:c465] (port=43010 helo=ribbon) by fencepost.gnu.org with esmtpsa (TLS1.2:RSA_AES_256_CBC_SHA1:256) (Exim 4.82) (envelope-from ) id 1jDlX8-0001Yj-TP; Mon, 16 Mar 2020 04:55:39 -0400 From: =?utf-8?Q?Ludovic_Court=C3=A8s?= To: Danny Milosavljevic Subject: Re: [PATCH v6] system: Add kernel-module-packages to operating-system. References: <20200226195929.3615-1-dannym@scratchpost.org> <20200227122519.3226-1-dannym@scratchpost.org> <877dzlibaj.fsf@gnu.org> <20200315224832.5f2e336c@scratchpost.org> X-URL: http://www.fdn.fr/~lcourtes/ X-Revolutionary-Date: 27 =?utf-8?Q?Vent=C3=B4se?= an 228 de la =?utf-8?Q?R?= =?utf-8?Q?=C3=A9volution?= X-PGP-Key-ID: 0x090B11993D9AEBB5 X-PGP-Key: http://www.fdn.fr/~lcourtes/ludovic.asc X-PGP-Fingerprint: 3CE4 6455 8A84 FDC6 9DB4 0CFB 090B 1199 3D9A EBB5 X-OS: x86_64-pc-linux-gnu Date: Mon, 16 Mar 2020 09:55:35 +0100 In-Reply-To: <20200315224832.5f2e336c@scratchpost.org> (Danny Milosavljevic's message of "Sun, 15 Mar 2020 23:09:04 +0100") Message-ID: <874kuofzlk.fsf@gnu.org> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/26.3 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Spam-Score: -0.7 (/) X-Debbugs-Envelope-To: 37868 Cc: Mark H Weaver , 37868@debbugs.gnu.org X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -1.7 (-) Hi Danny, Danny Milosavljevic skribis: > On Sun, 15 Mar 2020 22:00:04 +0100 > Ludovic Court=C3=A8s wrote: > >> I don=E2=80=99t think #:allow-collisions?, #:locales? and #:relative-sym= links? >> are needed, so I=E2=80=99d recommend removing them. > > Removing allow-collisions. > > Otherwise the defaults are different. > > I'm pretty sure that we don't need locales for Linux kernel modules, > for example :) #:locales? tells whether to install locales in the Guile process that builds the profile so that it can handle non-ASCII file names, for example. > That said, I can do it--but it would increase build dependencies. IMO it matters less than maintainability and conciseness in this case. :-) >> > + (let* ((inputs '#$(manifest-inputs manifest)) >> > + (module-directories #$(input-files (manifest-input= s manifest) "/lib/modules")) >> > + (directory-entries >> > + (lambda (directory-name) >> > + (scandir directory-name (lambda (basename) >> > + (not (string-prefix? = "." basename))))))=20=20 >>=20 >> also one-word identifiers are preferred for local >> variables. > > I'd like to do that but it would lose information here. > > "modules" would be too vague. "directories" would be non-unique. > (What "module-directories" means is "'/lib/modules'-directories", literal= ly) > > "entries" would be too vague too. Entries of what? > (Especially since that's a procedure). > > I'll make it say "directory" instead of "directory-name" there. Your call. My point is: if we keep with the general guideline of keeping functions small, then one-word identifiers are usually good enough because in the context of the function it should be clear and non-ambiguous. > Note: > > The "existing-files" procedure exists only in order to allow us to > build Linux kernels without any modules (neither in linux-libre nor anywh= ere > else) and have the profile hook succeed. > > Maybe it's written in an overly general way for that? What do you think? Yeah, maybe. It certainly looks weird to me to have a top-level procedure for something that=E2=80=99s in fact quite specific to the proble= m at hand (I realized when attempting to write a docstring that it=E2=80=99s a w= eird interface, and that=E2=80=99s because it=E2=80=99s in fact very specific to= what we=E2=80=99re doing here.) > (It's actually kinda bad that I ignore kernel-loadable-modules > which have no "/lib/modules" in it (better would be an error)--but I wasn= 't > sure whether manifest-inputs is guaranteed to keep the original order of > the entries--which would be: linux-libre first) Dunno, I guess it would be fine to error out when =E2=80=98kernel-loadable-modules=E2=80=99 is passed a package that doesn=E2= =80=99t have any modules. Thanks, Ludo=E2=80=99. From debbugs-submit-bounces@debbugs.gnu.org Mon Mar 16 05:56:07 2020 Received: (at 37868) by debbugs.gnu.org; 16 Mar 2020 09:56:07 +0000 Received: from localhost ([127.0.0.1]:36076 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1jDmTe-0005Ps-U7 for submit@debbugs.gnu.org; Mon, 16 Mar 2020 05:56:07 -0400 Received: from mail-wr1-f65.google.com ([209.85.221.65]:42684) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1jDmTc-0005PO-UL for 37868@debbugs.gnu.org; Mon, 16 Mar 2020 05:56:05 -0400 Received: by mail-wr1-f65.google.com with SMTP id v11so20344691wrm.9 for <37868@debbugs.gnu.org>; Mon, 16 Mar 2020 02:56:04 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=references:user-agent:from:to:cc:subject:in-reply-to:date :message-id:mime-version; bh=/VhjMf0DbkEYTjbvDygGoFGGp7jXAer3LDhalpW+TAs=; b=NLAO8zTSvs87LDveQQi9mqaTeBUAApJmU4YCDUk6ycDak+sXCpAFbK67cH3uYM84cU Z4awTVKCSkI7RRKwKMoeiFnKicNR2hdluBKWX0Q/6wm4jYVOjvHyCu8aA35/AEd8QNii 0egOfWij3vurv6PQASdv9mkqbSEES65yvzzt1iFkeZQG4fRrTYJ5MLMHQiLM1EU9LUh5 8JBR9TyCA/Ocnb2G2gdiJjwe80niZcq7REoXlCnm5sImaw0ubU/hbHGDBj57nImO+rG7 Ic5hhm9vXyc7tLMAx0TTj6p/W4PipaqkN2Cmpzh1946OQzURbz0jTD+nvM8koni+bj8V ySWQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:references:user-agent:from:to:cc:subject :in-reply-to:date:message-id:mime-version; bh=/VhjMf0DbkEYTjbvDygGoFGGp7jXAer3LDhalpW+TAs=; b=LYeAhe11roDSn2159fiCV7xlX1Hch2bGBNYazWc9Ok4A8MVb8r0s5uobqf6q3nQnLY 0km4pQIS8h69I+X+SuwmOW6eabBaHbmpKE/QZBMEMiDuAFcp7dCBD+9fgrIeVALTMvV3 HS3LwAT44BkahRD5FVVRwnyEDj014Tfnz7/kHgNisoZC5d3aYmgIGZ8nTyMTGclkE5B3 AM1NsZF7ofBfc4Agm/iaAsLJX3i4007eXmoPEdIqPL2ZON0MKrybZ+gaL7z3PH8FUVzB uX8G0ewkUxlwytiAYXN06fhagtpL+4DYzF4AQkE1YMrLWfO5EanTl5g986aPo4W00br8 BUUA== X-Gm-Message-State: ANhLgQ29f5a6XUG8xxIK8EWfF8RMaeBCIpUPfkbQaztEbSVVOCTPJSjb nqAluG6dxSRhPhLAoeAU6Ug= X-Google-Smtp-Source: ADFU+vtK3RHjtIkQFh2olt/xazfv/+87il3i94jeoSXahoMrLt8bMzoYChl/WC7OYZFQOfHFmQX4iA== X-Received: by 2002:a5d:56c4:: with SMTP id m4mr22047296wrw.182.1584352558948; Mon, 16 Mar 2020 02:55:58 -0700 (PDT) Received: from meru ([2a01:e0a:fa:a50:b890:ea6c:fbe7:6602]) by smtp.gmail.com with ESMTPSA id y189sm30814665wmb.26.2020.03.16.02.55.57 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 16 Mar 2020 02:55:58 -0700 (PDT) References: <20200227135146.5701-1-dannym@scratchpost.org> <20200227155029.2542-1-dannym@scratchpost.org> <20200314194055.6d857037@scratchpost.org> <877dzlgbe2.fsf@gmail.com> <20200315191736.33ed8abf@scratchpost.org> User-agent: mu4e 1.2.0; emacs 26.3 From: Mathieu Othacehe To: Danny Milosavljevic Subject: Re: [bug#37868] [PATCH v8] system: Add kernel-module-packages to operating-system. In-reply-to: <20200315191736.33ed8abf@scratchpost.org> Date: Mon, 16 Mar 2020 10:55:57 +0100 Message-ID: <87y2s0ei8i.fsf@gmail.com> MIME-Version: 1.0 Content-Type: text/plain X-Spam-Score: 0.0 (/) X-Debbugs-Envelope-To: 37868 Cc: mhw@netris.org, ludo@gnu.org, 37868@debbugs.gnu.org X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -1.0 (-) Hello Danny, I tested you patch by cross-compiling a simple system for aarch64-gnu-linux with: --8<---------------cut here---------------start------------->8--- (kernel-loadable-modules (list acpi-call-linux-module)) --8<---------------cut here---------------end--------------->8--- However, I have the following error: --8<---------------cut here---------------start------------->8--- guix system: error: gnu/packages/linux.scm:886:2: acpi-call-linux-module@3.17: build system `linux-module' does not support cross builds --8<---------------cut here---------------end--------------->8--- This is not caused by your patch, but it prevents me from testing :( Thanks, Mathieu From debbugs-submit-bounces@debbugs.gnu.org Mon Mar 16 16:04:39 2020 Received: (at 37868) by debbugs.gnu.org; 16 Mar 2020 20:04:39 +0000 Received: from localhost ([127.0.0.1]:37900 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1jDvyZ-0002Rd-Mm for submit@debbugs.gnu.org; Mon, 16 Mar 2020 16:04:39 -0400 Received: from dd26836.kasserver.com ([85.13.145.193]:38430) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1jDvyY-0002RV-Ko for 37868@debbugs.gnu.org; Mon, 16 Mar 2020 16:04:39 -0400 Received: from localhost (80-110-126-163.cgn.dynamic.surfer.at [80.110.126.163]) by dd26836.kasserver.com (Postfix) with ESMTPSA id 2330233679FB; Mon, 16 Mar 2020 21:04:37 +0100 (CET) Date: Mon, 16 Mar 2020 21:04:25 +0100 From: Danny Milosavljevic To: Mark H Weaver Subject: Re: [PATCH v6] system: Add kernel-module-packages to operating-system. Message-ID: <20200316210425.5a90e0cc@scratchpost.org> In-Reply-To: <874kuofzlk.fsf@gnu.org> References: <20200226195929.3615-1-dannym@scratchpost.org> <20200227122519.3226-1-dannym@scratchpost.org> <877dzlibaj.fsf@gnu.org> <20200315224832.5f2e336c@scratchpost.org> <874kuofzlk.fsf@gnu.org> X-Mailer: Claws Mail 3.17.5 (GTK+ 2.24.32; x86_64-unknown-linux-gnu) MIME-Version: 1.0 Content-Type: multipart/signed; boundary="Sig_/R+ZNVtE/qo6ZwrYrLd4GfWk"; protocol="application/pgp-signature"; micalg=pgp-sha256 X-Spam-Score: -0.7 (/) X-Debbugs-Envelope-To: 37868 Cc: Ludovic =?ISO-8859-1?Q?Court=E8s?= , 37868@debbugs.gnu.org X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -1.7 (-) --Sig_/R+ZNVtE/qo6ZwrYrLd4GfWk Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: quoted-printable Hi Mark, should it be possible to have a kernel without module support in Guix? Is there a system test already that tests that case? I ask because I don't know what depmod would do when passed such a kernel. (I'm trying pretty hard here to not break that case--but actually I don't e= ven know whether it works in the first place) Is it easily possible to build such a kernel? --Sig_/R+ZNVtE/qo6ZwrYrLd4GfWk Content-Type: application/pgp-signature Content-Description: OpenPGP digital signature -----BEGIN PGP SIGNATURE----- iQEzBAEBCAAdFiEEds7GsXJ0tGXALbPZ5xo1VCwwuqUFAl5v28kACgkQ5xo1VCww uqUy9ggAiUEUSS0wD21ybvErqI3X1qb0oZiYaa/KYbTSsIfykA7Vx2OtbblJ3Aut +uJmXvgwI8hNpE27BgLw1Cx7uov4yoofdvP1G9LaX6sVkvl3oow8RupM/Q94pLr3 lJg8rwBWMX8h4yunux5Rm27uVu88RwgAM0lVoMMf0FBLdluR09Fc0x9o6DJN9RbI hRk3ILCWoa14tnf4fXGUQzAEnLYJYToaJ2PSEXTX1HOpFJ0mC68OfGnFQd2xfNVF g5Uy9Yywv6R9NBqj+iEzz7nV/+RFOfBUlbCShm6Dgpcc4oTxsVKZ2xvRNx19x0uX V8iF7LeJKv4F+PIIbiZHn5LJxg7a5A== =Qbgy -----END PGP SIGNATURE----- --Sig_/R+ZNVtE/qo6ZwrYrLd4GfWk-- From debbugs-submit-bounces@debbugs.gnu.org Mon Mar 16 16:10:56 2020 Received: (at 37868) by debbugs.gnu.org; 16 Mar 2020 20:10:56 +0000 Received: from localhost ([127.0.0.1]:37904 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1jDw4e-0002bN-BF for submit@debbugs.gnu.org; Mon, 16 Mar 2020 16:10:56 -0400 Received: from dd26836.kasserver.com ([85.13.145.193]:38882) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1jDw4d-0002bE-37 for 37868@debbugs.gnu.org; Mon, 16 Mar 2020 16:10:55 -0400 Received: from localhost (80-110-126-163.cgn.dynamic.surfer.at [80.110.126.163]) by dd26836.kasserver.com (Postfix) with ESMTPSA id 8B31733679FB; Mon, 16 Mar 2020 21:10:53 +0100 (CET) Date: Mon, 16 Mar 2020 21:10:52 +0100 From: Danny Milosavljevic To: Mathieu Othacehe Subject: Re: [bug#37868] [PATCH v8] system: Add kernel-module-packages to operating-system. Message-ID: <20200316211052.5d4e29a2@scratchpost.org> In-Reply-To: <87y2s0ei8i.fsf@gmail.com> References: <20200227135146.5701-1-dannym@scratchpost.org> <20200227155029.2542-1-dannym@scratchpost.org> <20200314194055.6d857037@scratchpost.org> <877dzlgbe2.fsf@gmail.com> <20200315191736.33ed8abf@scratchpost.org> <87y2s0ei8i.fsf@gmail.com> X-Mailer: Claws Mail 3.17.5 (GTK+ 2.24.32; x86_64-unknown-linux-gnu) MIME-Version: 1.0 Content-Type: multipart/signed; boundary="Sig_/uFEdfTyjv+=40PlgFDSTNKh"; protocol="application/pgp-signature"; micalg=pgp-sha256 X-Spam-Score: -0.7 (/) X-Debbugs-Envelope-To: 37868 Cc: mhw@netris.org, ludo@gnu.org, 37868@debbugs.gnu.org X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -1.7 (-) --Sig_/uFEdfTyjv+=40PlgFDSTNKh Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: quoted-printable Hi Mathieu, On Mon, 16 Mar 2020 10:55:57 +0100 Mathieu Othacehe wrote: > --8<---------------cut here---------------start------------->8--- > guix system: error: gnu/packages/linux.scm:886:2: acpi-call-linux-module@= 3.17: build system `linux-module' does not support cross builds > --8<---------------cut here---------------end--------------->8--- >=20 > This is not caused by your patch, but it prevents me from testing :( That's too bad. I tried to preserve cross-compilation in guix/build-system/linux-module.scm but apparently I missed something. Sorry! It could just be the (not target) ;XXX: no cross-compilation in guix/build-system/linux-module.scm - because the other file should suppo= rt it just fine. --Sig_/uFEdfTyjv+=40PlgFDSTNKh Content-Type: application/pgp-signature Content-Description: OpenPGP digital signature -----BEGIN PGP SIGNATURE----- iQEzBAEBCAAdFiEEds7GsXJ0tGXALbPZ5xo1VCwwuqUFAl5v3UwACgkQ5xo1VCww uqV9GQf+N58I5b+hb5DL1S8Oy93BCCXP+CV2yyqb4MHeXi75Y85UnxYb30f9DXg1 rDl3mCnvel/PVtp0TJSFrvdmq4KhgOEeQr20iNUyjk6HpC4v0K8r3sCLhJ82/VZ0 41oUJ4Y7vVYMThFlONnV6GlvcdyqJ4GX/tZktcelVzdMeUlcJqpvNCKCC1ksTDYo avB2lu9mXMcC9HFRefbtFa1oWJ439vu/mrKMVn1jJo9hfAKkbDDTBXRQ7U5ocbRR BF+FNweu4V4VeJx2XRj/A4SHZfex2P8JQzuBr4XU7/qID3QqNdt16/aRUoKejjF2 KWIXX9oDMC+q4ZI/TvMlDg/lDfQg6g== =ccxM -----END PGP SIGNATURE----- --Sig_/uFEdfTyjv+=40PlgFDSTNKh-- From debbugs-submit-bounces@debbugs.gnu.org Mon Mar 16 16:22:48 2020 Received: (at 37868) by debbugs.gnu.org; 16 Mar 2020 20:22:48 +0000 Received: from localhost ([127.0.0.1]:37918 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1jDwG4-0002uq-TA for submit@debbugs.gnu.org; Mon, 16 Mar 2020 16:22:48 -0400 Received: from dd26836.kasserver.com ([85.13.145.193]:39852) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1jDwG0-0002uc-12 for 37868@debbugs.gnu.org; Mon, 16 Mar 2020 16:22:43 -0400 Received: from dayas.lan (80-110-126-163.cgn.dynamic.surfer.at [80.110.126.163]) by dd26836.kasserver.com (Postfix) with ESMTPSA id A6D8633679FB; Mon, 16 Mar 2020 21:22:38 +0100 (CET) From: Danny Milosavljevic To: 37868@debbugs.gnu.org Subject: [PATCH v9] system: Add kernel-loadable-modules to operating-system. Date: Mon, 16 Mar 2020 21:17:19 +0100 Message-Id: <20200316201719.11392-1-dannym@scratchpost.org> X-Mailer: git-send-email 2.25.1 MIME-Version: 1.0 Tags: patch Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Spam-Score: -0.7 (/) X-Debbugs-Envelope-To: 37868 Cc: Danny Milosavljevic X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -1.7 (-) * gnu/system.scm (): Add kernel-loadable-modules. (operating-system-directory-base-entries): Use it. * doc/guix.texi (operating-system Reference): Document KERNEL-LOADABLE-MODULES. * gnu/build/linux-modules.scm (depmod!): New procedure. (make-linux-module-directory): New procedure. Export it. * guix/profiles.scm (linux-module-database): New procedure. Export it. * gnu/tests/linux-modules.scm: New file. * gnu/local.mk (GNU_SYSTEM_MODULES): Add it. * gnu/packages/linux.scm (make-linux-libre*)[arguments]<#:phases>[install]: Disable depmod. Remove "build" and "source" symlinks. --- doc/guix.texi | 4 ++ gnu/build/linux-modules.scm | 46 +++++++++++++++- gnu/local.mk | 1 + gnu/packages/linux.scm | 22 +++++++- gnu/system.scm | 16 ++++-- gnu/tests/linux-modules.scm | 103 ++++++++++++++++++++++++++++++++++++ guix/profiles.scm | 48 ++++++++++++++++- 7 files changed, 232 insertions(+), 8 deletions(-) create mode 100644 gnu/tests/linux-modules.scm diff --git a/doc/guix.texi b/doc/guix.texi index 9a5b5f7fbe..4e4bdbf73c 100644 --- a/doc/guix.texi +++ b/doc/guix.texi @@ -11223,6 +11223,10 @@ The package object of the operating system kernel to use@footnote{Currently only the Linux-libre kernel is supported. In the future, it will be possible to use the GNU@tie{}Hurd.}. +@item @code{kernel-loadable-modules} (default: '()) +A list of objects (usually packages) to collect loadable kernel modules +from--e.g. @code{(list ddcci-driver-linux)}. + @item @code{kernel-arguments} (default: @code{'("quiet")}) List of strings or gexps representing additional arguments to pass on the command-line of the kernel---e.g., @code{("console=ttyS0")}. diff --git a/gnu/build/linux-modules.scm b/gnu/build/linux-modules.scm index a149eff329..56c1991c0b 100644 --- a/gnu/build/linux-modules.scm +++ b/gnu/build/linux-modules.scm @@ -22,12 +22,14 @@ #:use-module (guix elf) #:use-module (guix glob) #:use-module (guix build syscalls) - #:use-module ((guix build utils) #:select (find-files)) + #:use-module ((guix build utils) #:select (find-files invoke)) + #:use-module (guix build union) #:use-module (rnrs io ports) #:use-module (rnrs bytevectors) #:use-module (srfi srfi-1) #:use-module (srfi srfi-11) #:use-module (srfi srfi-26) + #:use-module (ice-9 ftw) #:use-module (ice-9 vlist) #:use-module (ice-9 match) #:use-module (ice-9 rdelim) @@ -56,7 +58,9 @@ write-module-name-database write-module-alias-database - write-module-device-database)) + write-module-device-database + + make-linux-module-directory)) ;;; Commentary: ;;; @@ -631,4 +635,42 @@ be loaded on-demand, such as file system modules." module devname type major minor))) aliases)))) +(define (depmod kmod version directory) + "Given an (existing) DIRECTORY, invoke KMOD's depmod on it for +kernel version VERSION." + (let ((destination-directory (string-append directory "/lib/modules/" + version)) + ;; Note: "System.map" is an input file. + (maps-file (string-append directory "/System.map")) + ;; Note: "Module.symvers" is an input file. + (symvers-file (string-append directory "/Module.symvers"))) + ;; These files will be regenerated by depmod below. + (for-each (lambda (basename) + (when (and (string-prefix? "modules." basename) + ;; Note: "modules.builtin" is an input file. + (not (string=? "modules.builtin" basename)) + ;; Note: "modules.order" is an input file. + (not (string=? "modules.order" basename))) + (delete-file (string-append destination-directory "/" + basename)))) + (scandir destination-directory)) + (invoke (string-append kmod "/bin/depmod") + "-e" ; Report symbols that aren't supplied + ;"-w" ; Warn on duplicates + "-b" directory + "-F" maps-file + ;"-E" symvers-file ; using both "-E" and "-F" is not possible. + version))) + +(define (make-linux-module-directory kmod inputs version output) + "Create a new directory OUTPUT and ensure that the directory +OUTPUT/lib/modules/VERSION can be used as a source of Linux +kernel modules for KMOD to eventually load. Take modules to +put into OUTPUT from INPUTS. + +Right now that means it creates @code{modules.*.bin} which +modprobe will use to find loadable modules." + (union-build output inputs #:create-all-directories? #t) + (depmod kmod version output)) + ;;; linux-modules.scm ends here diff --git a/gnu/local.mk b/gnu/local.mk index 99baddea92..0e068ef17a 100644 --- a/gnu/local.mk +++ b/gnu/local.mk @@ -632,6 +632,7 @@ GNU_SYSTEM_MODULES = \ %D%/tests/nfs.scm \ %D%/tests/install.scm \ %D%/tests/ldap.scm \ + %D%/tests/linux-modules.scm \ %D%/tests/mail.scm \ %D%/tests/messaging.scm \ %D%/tests/networking.scm \ diff --git a/gnu/packages/linux.scm b/gnu/packages/linux.scm index 7f293a9071..7fa72020d8 100644 --- a/gnu/packages/linux.scm +++ b/gnu/packages/linux.scm @@ -678,6 +678,7 @@ for ARCH and optionally VARIANT, or #f if there is no such configuration." (guix build utils) (srfi srfi-1) (srfi srfi-26) + (ice-9 ftw) (ice-9 match)) #:phases (modify-phases %standard-phases @@ -763,12 +764,29 @@ for ARCH and optionally VARIANT, or #f if there is no such configuration." ;; Install kernel modules (mkdir-p moddir) (invoke "make" - (string-append "DEPMOD=" kmod "/bin/depmod") + ;; Disable depmod because the Guix system's module directory + ;; is an union of potentially multiple packages. It is not + ;; possible to use depmod to usefully calculate a dependency + ;; graph while building only one of those packages. + "DEPMOD=true" (string-append "MODULE_DIR=" moddir) (string-append "INSTALL_PATH=" out) (string-append "INSTALL_MOD_PATH=" out) "INSTALL_MOD_STRIP=1" - "modules_install"))))) + "modules_install") + (let* ((versions (filter (lambda (name) + (not (string-prefix? "." name))) + (scandir moddir))) + (version (match versions + ((x) x)))) + ;; There are symlinks to the build and source directory, + ;; both of which will point to target /tmp/guix-build* + ;; and thus not be useful in a profile. Delete the symlinks. + (false-if-file-not-found + (delete-file (string-append moddir "/" version "/build"))) + (false-if-file-not-found + (delete-file (string-append moddir "/" version "/source")))) + #t)))) #:tests? #f)) (home-page "https://www.gnu.org/software/linux-libre/") (synopsis "100% free redistribution of a cleaned Linux kernel") diff --git a/gnu/system.scm b/gnu/system.scm index cfc730a41c..e2a9869e86 100644 --- a/gnu/system.scm +++ b/gnu/system.scm @@ -5,6 +5,7 @@ ;;; Copyright © 2016 Chris Marusich ;;; Copyright © 2017 Mathieu Othacehe ;;; Copyright © 2019 Meiyo Peng +;;; Copyright © 2020 Danny Milosavljevic ;;; ;;; This file is part of GNU Guix. ;;; @@ -167,6 +168,8 @@ (kernel operating-system-kernel ; package (default linux-libre)) + (kernel-loadable-modules operating-system-kernel-loadable-modules + (default '())) ; list of packages (kernel-arguments operating-system-user-kernel-arguments (default '("quiet"))) ; list of gexps/strings (bootloader operating-system-bootloader) ; @@ -471,9 +474,16 @@ OS." "Return the basic entries of the 'system' directory of OS for use as the value of the SYSTEM-SERVICE-TYPE service." (let ((locale (operating-system-locale-directory os))) - (mlet %store-monad ((kernel -> (operating-system-kernel os)) - (initrd -> (operating-system-initrd-file os)) - (params (operating-system-boot-parameters-file os))) + (mlet* %store-monad ((kernel -> (operating-system-kernel os)) + (modules -> + (operating-system-kernel-loadable-modules os)) + (kernel + (profile-derivation + (packages->manifest + (cons kernel modules)) + #:hooks (list linux-module-database))) + (initrd -> (operating-system-initrd-file os)) + (params (operating-system-boot-parameters-file os))) (return `(("kernel" ,kernel) ("parameters" ,params) ("initrd" ,initrd) diff --git a/gnu/tests/linux-modules.scm b/gnu/tests/linux-modules.scm new file mode 100644 index 0000000000..39e11587c6 --- /dev/null +++ b/gnu/tests/linux-modules.scm @@ -0,0 +1,103 @@ +;;; GNU Guix --- Functional package management for GNU +;;; Copyright © 2019 Jakob L. Kreuze +;;; Copyright © 2020 Danny Milosavljevic +;;; +;;; This file is part of GNU Guix. +;;; +;;; GNU Guix is free software; you can redistribute it and/or modify it +;;; under the terms of the GNU General Public License as published by +;;; the Free Software Foundation; either version 3 of the License, or (at +;;; your option) any later version. +;;; +;;; GNU Guix is distributed in the hope that it will be useful, but +;;; WITHOUT ANY WARRANTY; without even the implied warranty of +;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +;;; GNU General Public License for more details. +;;; +;;; You should have received a copy of the GNU General Public License +;;; along with GNU Guix. If not, see . + +(define-module (gnu tests linux-modules) + #:use-module (gnu packages linux) + #:use-module (gnu system) + #:use-module (gnu system vm) + #:use-module (gnu tests) + #:use-module (guix derivations) + #:use-module (guix gexp) + #:use-module (guix modules) + #:use-module (guix monads) + #:use-module (guix store) + #:export (%test-loadable-kernel-modules-0 + %test-loadable-kernel-modules-1 + %test-loadable-kernel-modules-2)) + +;;; Commentary: +;;; +;;; Test kernel-loadable-modules. +;;; +;;; Code: + +(define* (module-loader-program os modules) + "Return an executable store item that, upon being evaluated, will dry-run +load MODULES." + (program-file + "load-kernel-modules.scm" + (with-imported-modules (source-module-closure '((guix build utils))) + #~(begin + (use-modules (guix build utils)) + (for-each (lambda (module) + (invoke (string-append #$kmod "/bin/modprobe") "-n" "--" + module)) + '#$modules))))) + +(define* (run-loadable-kernel-modules-test module-packages module-names) + "Run a test of an OS having MODULE-PACKAGES, and modprobe MODULE-NAMES." + (define os + (marionette-operating-system + (operating-system + (inherit (simple-operating-system)) + (kernel-loadable-modules module-packages)) + #:imported-modules '((guix combinators)))) + (define vm (virtual-machine os)) + (define (test script) + (with-imported-modules '((gnu build marionette)) + #~(begin + (use-modules (gnu build marionette) + (srfi srfi-64)) + (define marionette + (make-marionette (list #$vm))) + (mkdir #$output) + (chdir #$output) + (test-begin "loadable-kernel-modules") + (test-assert "script successfully evaluated" + (marionette-eval + '(primitive-load #$script) + marionette)) + (test-end) + (exit (= (test-runner-fail-count (test-runner-current)) 0))))) + (gexp->derivation "loadable-kernel-modules" (test (module-loader-program os module-names)))) + +(define %test-loadable-kernel-modules-0 + (system-test + (name "loadable-kernel-modules-0") + (description "Tests loadable kernel modules facility of +with no extra modules.") + (value (run-loadable-kernel-modules-test '() '())))) + +(define %test-loadable-kernel-modules-1 + (system-test + (name "loadable-kernel-modules-1") + (description "Tests loadable kernel modules facility of +with one extra module.") + (value (run-loadable-kernel-modules-test + (list ddcci-driver-linux) + '("ddcci"))))) + +(define %test-loadable-kernel-modules-2 + (system-test + (name "loadable-kernel-modules-2") + (description "Tests loadable kernel modules facility of +with two extra modules.") + (value (run-loadable-kernel-modules-test + (list acpi-call-linux-module ddcci-driver-linux) + '("acpi_call" "ddcci"))))) diff --git a/guix/profiles.scm b/guix/profiles.scm index 0d38b2513f..6123730498 100644 --- a/guix/profiles.scm +++ b/guix/profiles.scm @@ -10,6 +10,7 @@ ;;; Copyright © 2017 Maxim Cournoyer ;;; Copyright © 2019 Kyle Meyer ;;; Copyright © 2019 Mathieu Othacehe +;;; Copyright © 2020 Danny Milosavljevic ;;; ;;; This file is part of GNU Guix. ;;; @@ -139,7 +140,9 @@ %current-profile ensure-profile-directory canonicalize-profile - user-friendly-profile)) + user-friendly-profile + + linux-module-database)) ;;; Commentary: ;;; @@ -1137,6 +1140,49 @@ for both major versions of GTK+." (hook . gtk-im-modules))) (return #f))))) +(define (linux-module-database manifest) + "Return a derivation that unions all the kernel modules in the manifest +and creates the dependency graph for all these kernel modules. + +This is meant to be used as a profile hook." + (mlet %store-monad ((kmod (manifest-lookup-package manifest "kmod"))) + (define build + (with-imported-modules + (source-module-closure '((guix build utils) + (gnu build linux-modules))) + #~(begin + (use-modules (ice-9 ftw) + (ice-9 match) + (srfi srfi-1) ; append-map + (guix build utils) ; mkdir-p + (gnu build linux-modules)) + (let* ((inputs '#$(manifest-inputs manifest)) + (module-directories + (map (lambda (directory) + (string-append directory "/lib/modules")) + inputs)) + (directory-entries + (lambda (directory) + (scandir directory (lambda (basename) + (not + (string-prefix? "." basename)))))) + ;; Note: Should usually result in one entry. + (versions (delete-duplicates + (append-map directory-entries + module-directories)))) + (match versions + ((version) + (make-linux-module-directory #+kmod inputs version + #$output)) + (_ (error "Specified Linux kernel and Linux kernel modules +are not all of the same version"))))))) + (gexp->derivation "linux-module-database" build + #:local-build? #t + #:substitutable? #f + #:properties + `((type . profile-hook) + (hook . linux-module-database))))) + (define (xdg-desktop-database manifest) "Return a derivation that builds the @file{mimeinfo.cache} database from desktop files. It's used to query what applications can handle a given From debbugs-submit-bounces@debbugs.gnu.org Mon Mar 16 16:31:18 2020 Received: (at 37868) by debbugs.gnu.org; 16 Mar 2020 20:31:18 +0000 Received: from localhost ([127.0.0.1]:37923 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1jDwOM-00039L-Dr for submit@debbugs.gnu.org; Mon, 16 Mar 2020 16:31:18 -0400 Received: from dd26836.kasserver.com ([85.13.145.193]:40572) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1jDwOK-00039D-LP for 37868@debbugs.gnu.org; Mon, 16 Mar 2020 16:31:17 -0400 Received: from localhost (80-110-126-163.cgn.dynamic.surfer.at [80.110.126.163]) by dd26836.kasserver.com (Postfix) with ESMTPSA id 35B4D33679FB; Mon, 16 Mar 2020 21:31:15 +0100 (CET) Date: Mon, 16 Mar 2020 21:31:12 +0100 From: Danny Milosavljevic To: Ludovic =?ISO-8859-1?Q?Court=E8s?= Subject: Re: [PATCH v6] system: Add kernel-module-packages to operating-system. Message-ID: <20200316213112.39b97c4e@scratchpost.org> In-Reply-To: <877dzlibaj.fsf@gnu.org> References: <20200226195929.3615-1-dannym@scratchpost.org> <20200227122519.3226-1-dannym@scratchpost.org> <877dzlibaj.fsf@gnu.org> X-Mailer: Claws Mail 3.17.5 (GTK+ 2.24.32; x86_64-unknown-linux-gnu) MIME-Version: 1.0 Content-Type: multipart/signed; boundary="Sig_/NRAIhZob8OfMsjdJP+C9Ku4"; protocol="application/pgp-signature"; micalg=pgp-sha256 X-Spam-Score: -0.7 (/) X-Debbugs-Envelope-To: 37868 Cc: Mark H Weaver , 37868@debbugs.gnu.org X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -1.7 (-) --Sig_/NRAIhZob8OfMsjdJP+C9Ku4 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable Hi Ludo, On Sun, 15 Mar 2020 22:00:04 +0100 Ludovic Court=C3=A8s wrote: > > + (invoke (string-append kmod "/bin/depmod") =20 >=20 > Generally, for this kind of utility function, we assume that the tool is > in $PATH, which allows us to avoid carrying its file name throughout the > API. I=E2=80=99d suggest doing the same here. Hmm, does that mean I should also change PATH in the profile hook? --Sig_/NRAIhZob8OfMsjdJP+C9Ku4 Content-Type: application/pgp-signature Content-Description: OpenPGP digital signature -----BEGIN PGP SIGNATURE----- iQEzBAEBCAAdFiEEds7GsXJ0tGXALbPZ5xo1VCwwuqUFAl5v4hAACgkQ5xo1VCww uqUGYAf/c2W17VVCNlZO3h4vtRkfW/eXJZFz+Y0clUAf+b9xi0juiBDULzEAZWqN CMwdJ4KYoALNNYUuTvdALSCW8eR/U8FoQ/gA330b6zWmJA7snjVA4B2nNC9clD+F fPbhLFUe5ink2IBVR/wQAKlP9aJ5rU6vuZg5TVNBePUdr2VGrQ2S5db+2NhMoMi1 3CBJ4hpMbGg8i/YW+2KJmz1Mf9klF4rhki+BLUllN0rBp6Jt9993qKq4ijfNpHN3 SE4Yv8pb24blEVNXTL7nZqTuroUL3OPb4VL9hd0XywXO/jKssc+zv+TO7Hfj6t8V +k2TFfhrCnFQMtRyAah2gy4lJDjezQ== =CwgN -----END PGP SIGNATURE----- --Sig_/NRAIhZob8OfMsjdJP+C9Ku4-- From debbugs-submit-bounces@debbugs.gnu.org Tue Mar 17 05:20:54 2020 Received: (at 37868) by debbugs.gnu.org; 17 Mar 2020 09:20:54 +0000 Received: from localhost ([127.0.0.1]:38176 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1jE8P8-0006OA-2z for submit@debbugs.gnu.org; Tue, 17 Mar 2020 05:20:54 -0400 Received: from eggs.gnu.org ([209.51.188.92]:39209) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1jE8P5-0006Nq-Lc for 37868@debbugs.gnu.org; Tue, 17 Mar 2020 05:20:52 -0400 Received: from fencepost.gnu.org ([2001:470:142:3::e]:60202) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1jE8Oz-0005d1-Pt; Tue, 17 Mar 2020 05:20:45 -0400 Received: from [2a01:e0a:1d:7270:af76:b9b:ca24:c465] (port=45886 helo=ribbon) by fencepost.gnu.org with esmtpsa (TLS1.2:RSA_AES_256_CBC_SHA1:256) (Exim 4.82) (envelope-from ) id 1jE8Oz-0000rR-Cv; Tue, 17 Mar 2020 05:20:45 -0400 From: =?utf-8?Q?Ludovic_Court=C3=A8s?= To: Danny Milosavljevic Subject: Re: [PATCH v6] system: Add kernel-module-packages to operating-system. References: <20200226195929.3615-1-dannym@scratchpost.org> <20200227122519.3226-1-dannym@scratchpost.org> <877dzlibaj.fsf@gnu.org> <20200316213112.39b97c4e@scratchpost.org> X-URL: http://www.fdn.fr/~lcourtes/ X-Revolutionary-Date: 28 =?utf-8?Q?Vent=C3=B4se?= an 228 de la =?utf-8?Q?R?= =?utf-8?Q?=C3=A9volution?= X-PGP-Key-ID: 0x090B11993D9AEBB5 X-PGP-Key: http://www.fdn.fr/~lcourtes/ludovic.asc X-PGP-Fingerprint: 3CE4 6455 8A84 FDC6 9DB4 0CFB 090B 1199 3D9A EBB5 X-OS: x86_64-pc-linux-gnu Date: Tue, 17 Mar 2020 10:20:43 +0100 In-Reply-To: <20200316213112.39b97c4e@scratchpost.org> (Danny Milosavljevic's message of "Mon, 16 Mar 2020 21:31:12 +0100") Message-ID: <871rpre3ro.fsf@gnu.org> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/26.3 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Spam-Score: -0.7 (/) X-Debbugs-Envelope-To: 37868 Cc: Mark H Weaver , 37868@debbugs.gnu.org X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -1.7 (-) Hi Danny, Danny Milosavljevic skribis: > On Sun, 15 Mar 2020 22:00:04 +0100 > Ludovic Court=C3=A8s wrote: > >> > + (invoke (string-append kmod "/bin/depmod")=20=20 >>=20 >> Generally, for this kind of utility function, we assume that the tool is >> in $PATH, which allows us to avoid carrying its file name throughout the >> API. I=E2=80=99d suggest doing the same here. > > Hmm, does that mean I should also change PATH in the profile hook? Yes, I think that=E2=80=99s the only change you have to do: (setenv "PATH" #+(file-append kmod "/bin")) in the profile hook. HTH, Ludo=E2=80=99. From debbugs-submit-bounces@debbugs.gnu.org Tue Mar 17 05:29:19 2020 Received: (at 37868) by debbugs.gnu.org; 17 Mar 2020 09:29:19 +0000 Received: from localhost ([127.0.0.1]:38180 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1jE8XG-0006br-Vs for submit@debbugs.gnu.org; Tue, 17 Mar 2020 05:29:19 -0400 Received: from eggs.gnu.org ([209.51.188.92]:48211) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1jE8XF-0006be-7g for 37868@debbugs.gnu.org; Tue, 17 Mar 2020 05:29:17 -0400 Received: from fencepost.gnu.org ([2001:470:142:3::e]:60241) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1jE8X9-000767-JT; Tue, 17 Mar 2020 05:29:11 -0400 Received: from [2a01:e0a:1d:7270:af76:b9b:ca24:c465] (port=45888 helo=ribbon) by fencepost.gnu.org with esmtpsa (TLS1.2:RSA_AES_256_CBC_SHA1:256) (Exim 4.82) (envelope-from ) id 1jE8X8-0004j7-8l; Tue, 17 Mar 2020 05:29:10 -0400 From: =?utf-8?Q?Ludovic_Court=C3=A8s?= To: Danny Milosavljevic Subject: Re: [bug#37868] [PATCH v8] system: Add kernel-module-packages to operating-system. References: <20200227135146.5701-1-dannym@scratchpost.org> <20200227155029.2542-1-dannym@scratchpost.org> <20200314194055.6d857037@scratchpost.org> <877dzlgbe2.fsf@gmail.com> <20200315191736.33ed8abf@scratchpost.org> <87y2s0ei8i.fsf@gmail.com> <20200316211052.5d4e29a2@scratchpost.org> X-URL: http://www.fdn.fr/~lcourtes/ X-Revolutionary-Date: 28 =?utf-8?Q?Vent=C3=B4se?= an 228 de la =?utf-8?Q?R?= =?utf-8?Q?=C3=A9volution?= X-PGP-Key-ID: 0x090B11993D9AEBB5 X-PGP-Key: http://www.fdn.fr/~lcourtes/ludovic.asc X-PGP-Fingerprint: 3CE4 6455 8A84 FDC6 9DB4 0CFB 090B 1199 3D9A EBB5 X-OS: x86_64-pc-linux-gnu Date: Tue, 17 Mar 2020 10:29:08 +0100 In-Reply-To: <20200316211052.5d4e29a2@scratchpost.org> (Danny Milosavljevic's message of "Mon, 16 Mar 2020 21:10:52 +0100") Message-ID: <87v9n3cot7.fsf@gnu.org> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/26.3 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Spam-Score: -0.7 (/) X-Debbugs-Envelope-To: 37868 Cc: mhw@netris.org, Mathieu Othacehe , 37868@debbugs.gnu.org X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -1.7 (-) Danny Milosavljevic skribis: > On Mon, 16 Mar 2020 10:55:57 +0100 > Mathieu Othacehe wrote: > >> --8<---------------cut here---------------start------------->8--- >> guix system: error: gnu/packages/linux.scm:886:2: acpi-call-linux-module= @3.17: build system `linux-module' does not support cross builds >> --8<---------------cut here---------------end--------------->8--- >>=20 >> This is not caused by your patch, but it prevents me from testing :( > > That's too bad. > > I tried to preserve cross-compilation in guix/build-system/linux-module.s= cm > but apparently I missed something. Sorry! > > It could just be the > > (not target) ;XXX: no cross-compilation Yes, it means that =E2=80=98linux-module-build-system=E2=80=99 does not ret= urn a bag when cross-compiling. See =E2=80=98gnu-build-system=E2=80=99 for how to support cross-compilation. In the meantime, Mathieu, perhaps you can test system cross-compilation by using a =E2=80=98computed-file=E2=80=99 (instead of a package) as a fake= package providing modules? Thanks, Ludo=E2=80=99. From debbugs-submit-bounces@debbugs.gnu.org Wed Mar 18 10:50:23 2020 Received: (at 37868) by debbugs.gnu.org; 18 Mar 2020 14:50:23 +0000 Received: from localhost ([127.0.0.1]:41015 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1jEa1X-0003yC-97 for submit@debbugs.gnu.org; Wed, 18 Mar 2020 10:50:23 -0400 Received: from mail-wm1-f68.google.com ([209.85.128.68]:51683) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1jEa1U-0003xz-5c for 37868@debbugs.gnu.org; Wed, 18 Mar 2020 10:50:20 -0400 Received: by mail-wm1-f68.google.com with SMTP id c187so2428665wme.1 for <37868@debbugs.gnu.org>; Wed, 18 Mar 2020 07:50:20 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=references:user-agent:from:to:cc:subject:in-reply-to:date :message-id:mime-version; bh=PUO5SzRfSg4yQbJVwis/7dz+RjuBdxdgwEONiHdafOc=; b=ZCUrvdUOUvmQnKmXrkM9ZEwBDyY6euk+LdHTqMdRm81hu958qqpOFppGfLTSM4XjqL 10jGHX86+O5k/ieNzB8Nzw1wBuXS9udIMOxGDTZ+ttEEr7wsDO3wdazl7KIasaDK5lZz q+EOTroTChWg/3VbLDgr/5VGbkLKFlxsc5L6l1d6SxI85nnjnMYifaSYDCybRlXnl5C5 olzxSpwmm+ngVhbPNpIy6mEvsMokEslrn261fW40zQa+q2w314ufM+Tib/zUPUfQVSmP RRR2mtstVGWgq6U8CnWiJ1pdYdDE8zc+899mn/p/VwMR7gYr1V0+O/5ldW3jaD8pJaaj /YJA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:references:user-agent:from:to:cc:subject :in-reply-to:date:message-id:mime-version; bh=PUO5SzRfSg4yQbJVwis/7dz+RjuBdxdgwEONiHdafOc=; b=mvuZA1b49KAlRNGW9D/Jb1f8vR3+hClONyZPhmX3FL5dMQLmpYU8nG20/SFpyvlb4J dTdycJhmJcauMk+19m6Sp4Hz1SXhEpbRlUL252KaeK3A+Cnl6ZxynnTnppZXoMh/kakZ EwGcs5dq2umjC3iHgiZf8uWGxgcwkqDTYFYc9Aq2BiUAfU0UiDDuReEgX3Mkfug0PTjf 0i+F7Ljd25Rt/9Ozc6iMa4G0VG8RyAkkBllD93s8HHoL0/3IWpzo1390wQcsg5A/HAk9 1uF6vD7BGafRa4ZoEMYi9aNRq51ixnzNQvfCIeaQKOL1f+x3wKUNmSDQEuH/4AmpmGys B1MA== X-Gm-Message-State: ANhLgQ2hbue93I/9/Bk0oh7S7D3GHGBW6u1Z8Tb9u0XKzstb5pBKNi9P kTHYJiQF+Up3Yhrrox677Aw= X-Google-Smtp-Source: ADFU+vurHi9UTi9mZfGnDfOLczU//hf8RF3Yb5Gg0ofshhSU9qwKYFAi7Zq+Retn4eX8cn6Wj2m8ww== X-Received: by 2002:a1c:b4c6:: with SMTP id d189mr5436843wmf.132.1584543014155; Wed, 18 Mar 2020 07:50:14 -0700 (PDT) Received: from meru ([2a01:cb18:832e:5f00:dd38:c2ad:2d88:5b4d]) by smtp.gmail.com with ESMTPSA id g2sm10227098wrs.42.2020.03.18.07.50.12 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 18 Mar 2020 07:50:13 -0700 (PDT) References: <20200227135146.5701-1-dannym@scratchpost.org> <20200227155029.2542-1-dannym@scratchpost.org> <20200314194055.6d857037@scratchpost.org> <877dzlgbe2.fsf@gmail.com> <20200315191736.33ed8abf@scratchpost.org> <87y2s0ei8i.fsf@gmail.com> <20200316211052.5d4e29a2@scratchpost.org> User-agent: mu4e 1.2.0; emacs 26.3 From: Mathieu Othacehe To: Danny Milosavljevic Subject: Re: [bug#37868] [PATCH v8] system: Add kernel-module-packages to operating-system. In-reply-to: <20200316211052.5d4e29a2@scratchpost.org> Date: Wed, 18 Mar 2020 15:50:12 +0100 Message-ID: <87v9n1d8ez.fsf@gmail.com> MIME-Version: 1.0 Content-Type: text/plain X-Spam-Score: 0.0 (/) X-Debbugs-Envelope-To: 37868 Cc: mhw@netris.org, ludo@gnu.org, 37868@debbugs.gnu.org X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -1.0 (-) Hello Danny, > It could just be the > > (not target) ;XXX: no cross-compilation > > in guix/build-system/linux-module.scm - because the other file should support > it just fine. Removing the (not target) is enough to make it build. However, when running: --8<---------------cut here---------------start------------->8--- guix build --target=aarch64-linux-gnu acpi-call-linux-module --8<---------------cut here---------------end--------------->8--- the produced module does not seem to be cross-compiled: --8<---------------cut here---------------start------------->8--- mathieu@meru:~/guix$ file /gnu/store/fkk5cd746xxh1nx4qvi7arzhznf37yxw-acpi-call-linux-module-3.17/lib/modules/5.4.25-gnu/extra/acpi_call.ko /gnu/store/fkk5cd746xxh1nx4qvi7arzhznf37yxw-acpi-call-linux-module-3.17/lib/modules/5.4.25-gnu/extra/acpi_call.ko: ELF 64-bit LSB relocatable, x86-64, version 1 (SYSV), BuildID[sha1]=a1d9e0ec7b8ef5096a4e1b5c2e7ca6a8bd524cf9, not stripped --8<---------------cut here---------------end--------------->8--- Thanks, Mathieu From debbugs-submit-bounces@debbugs.gnu.org Wed Mar 18 12:06:15 2020 Received: (at 37868) by debbugs.gnu.org; 18 Mar 2020 16:06:15 +0000 Received: from localhost ([127.0.0.1]:41070 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1jEbCx-0005mD-C3 for submit@debbugs.gnu.org; Wed, 18 Mar 2020 12:06:15 -0400 Received: from dd26836.kasserver.com ([85.13.145.193]:35422) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1jEbCt-0005m3-PM for 37868@debbugs.gnu.org; Wed, 18 Mar 2020 12:06:14 -0400 Received: from localhost (80-110-126-163.cgn.dynamic.surfer.at [80.110.126.163]) by dd26836.kasserver.com (Postfix) with ESMTPSA id CE1603367C72; Wed, 18 Mar 2020 17:06:09 +0100 (CET) Date: Wed, 18 Mar 2020 17:06:07 +0100 From: Danny Milosavljevic To: Mathieu Othacehe Subject: Re: [bug#37868] [PATCH v8] system: Add kernel-module-packages to operating-system. Message-ID: <20200318170602.590139aa@scratchpost.org> In-Reply-To: <87v9n1d8ez.fsf@gmail.com> References: <20200227135146.5701-1-dannym@scratchpost.org> <20200227155029.2542-1-dannym@scratchpost.org> <20200314194055.6d857037@scratchpost.org> <877dzlgbe2.fsf@gmail.com> <20200315191736.33ed8abf@scratchpost.org> <87y2s0ei8i.fsf@gmail.com> <20200316211052.5d4e29a2@scratchpost.org> <87v9n1d8ez.fsf@gmail.com> X-Mailer: Claws Mail 3.17.5 (GTK+ 2.24.32; x86_64-unknown-linux-gnu) MIME-Version: 1.0 Content-Type: multipart/signed; boundary="Sig_/jp=ZsCkZsz2_uW1/rzBC6si"; protocol="application/pgp-signature"; micalg=pgp-sha256 X-Spam-Score: -0.7 (/) X-Debbugs-Envelope-To: 37868 Cc: mhw@netris.org, ludo@gnu.org, 37868@debbugs.gnu.org X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -1.7 (-) --Sig_/jp=ZsCkZsz2_uW1/rzBC6si Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: quoted-printable Whoops. weird. guix/build/linux-module-build-system.scm sets CROSS_COMPILE up so it should have worked. Did it print the message (format #t "`CROSS_COMPILE' set to `~a'~%" (getenv "CROSS_COMPILE"))) ? --Sig_/jp=ZsCkZsz2_uW1/rzBC6si Content-Type: application/pgp-signature Content-Description: OpenPGP digital signature -----BEGIN PGP SIGNATURE----- iQEzBAEBCAAdFiEEds7GsXJ0tGXALbPZ5xo1VCwwuqUFAl5yRu8ACgkQ5xo1VCww uqWfWAf+Ls3ZskhFH/HmbvZd+ZSore0qrTWJpXLanfuLs6MXRxBZzm/hEDftoPok 7LgFaY38yl+WsQc4QlLIErRnP7tTtN8dVGipwplxmFZ4AlNAaJ3BDogxaUxfI7DS Ez84X9/xfmldy8GdL5mx1HKBf9pwCw8cPbiavMfNSlqBmvDqV3N5O9gDMEKLpEQG lbQaOOirX6iGQNeAkC5MLjBZXbIZp6o9nOuD4HVI7v6v/PyOBL6CAVcaBZkHFy9G XI051i9RuH3sCePGNb0gcpgWyP6HkInFAtOm6xUmh9LpM0L7JS7J8rbCIakjRUHH 6PMOdk5SlbzE9jdEpPr98n34p8fm0A== =FsVv -----END PGP SIGNATURE----- --Sig_/jp=ZsCkZsz2_uW1/rzBC6si-- From debbugs-submit-bounces@debbugs.gnu.org Wed Mar 18 13:00:15 2020 Received: (at 37868) by debbugs.gnu.org; 18 Mar 2020 17:00:15 +0000 Received: from localhost ([127.0.0.1]:41265 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1jEc3D-0007BW-NJ for submit@debbugs.gnu.org; Wed, 18 Mar 2020 13:00:15 -0400 Received: from dd26836.kasserver.com ([85.13.145.193]:40070) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1jEc3C-0007BN-0m for 37868@debbugs.gnu.org; Wed, 18 Mar 2020 13:00:14 -0400 Received: from localhost (80-110-126-163.cgn.dynamic.surfer.at [80.110.126.163]) by dd26836.kasserver.com (Postfix) with ESMTPSA id 3C4E83367CEA; Wed, 18 Mar 2020 18:00:12 +0100 (CET) Date: Wed, 18 Mar 2020 18:00:11 +0100 From: Danny Milosavljevic To: Mathieu Othacehe Subject: Re: [bug#37868] [PATCH v8] system: Add kernel-module-packages to operating-system. Message-ID: <20200318180011.48de079f@scratchpost.org> In-Reply-To: <20200318170602.590139aa@scratchpost.org> References: <20200227135146.5701-1-dannym@scratchpost.org> <20200227155029.2542-1-dannym@scratchpost.org> <20200314194055.6d857037@scratchpost.org> <877dzlgbe2.fsf@gmail.com> <20200315191736.33ed8abf@scratchpost.org> <87y2s0ei8i.fsf@gmail.com> <20200316211052.5d4e29a2@scratchpost.org> <87v9n1d8ez.fsf@gmail.com> <20200318170602.590139aa@scratchpost.org> X-Mailer: Claws Mail 3.17.5 (GTK+ 2.24.32; x86_64-unknown-linux-gnu) MIME-Version: 1.0 Content-Type: multipart/signed; boundary="Sig_/=KVp.4VGe3iC3pv_NW6Qp4N"; protocol="application/pgp-signature"; micalg=pgp-sha256 X-Spam-Score: -0.7 (/) X-Debbugs-Envelope-To: 37868 Cc: mhw@netris.org, ludo@gnu.org, 37868@debbugs.gnu.org X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -1.7 (-) --Sig_/=KVp.4VGe3iC3pv_NW6Qp4N Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: quoted-printable Ohhhh, try adding (target target) to the bag in guix/build-system/linux-mod= ule.scm --Sig_/=KVp.4VGe3iC3pv_NW6Qp4N Content-Type: application/pgp-signature Content-Description: OpenPGP digital signature -----BEGIN PGP SIGNATURE----- iQEzBAEBCAAdFiEEds7GsXJ0tGXALbPZ5xo1VCwwuqUFAl5yU5sACgkQ5xo1VCww uqX7Awf/advBVb0n56lKPHBtFy6lxySxqpTFjm23MdJI/DVhywuNO1+FzBvzvREH l6m3YZ70ETO6bGga3plBpXdwAM/5OgGaxLY0UbqlYyqzSDEeSjLJ4WDmiM6bhHFJ 6XFA+E8npwWC3QEcnXIuLnLh9AeHZ+z1lnf7tUMqefXvR93rZFfT7gi5sTfxy7I0 TwdykthaZNopvRXzzaxFq1ZvV5AcN3SPfhTTanUlqdtSQOrlGWEGH0voHd2y8pSa CNlZFYQ53W9UOLD50VYJ8u5ytiLMCMYt2ubpH6qIx6pzjkl/qMh00UNUmVmRNP85 I5bYpeTFbWc6NPxZBXc2kp2bNrnsrA== =fxXA -----END PGP SIGNATURE----- --Sig_/=KVp.4VGe3iC3pv_NW6Qp4N-- From debbugs-submit-bounces@debbugs.gnu.org Wed Mar 18 13:36:08 2020 Received: (at 37868) by debbugs.gnu.org; 18 Mar 2020 17:36:08 +0000 Received: from localhost ([127.0.0.1]:41308 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1jEcbw-0001dw-Aw for submit@debbugs.gnu.org; Wed, 18 Mar 2020 13:36:08 -0400 Received: from eggs.gnu.org ([209.51.188.92]:55043) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1jEcbr-0001dQ-UT for 37868@debbugs.gnu.org; Wed, 18 Mar 2020 13:36:07 -0400 Received: from fencepost.gnu.org ([2001:470:142:3::e]:58932) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1jEcbm-0003Er-FK; Wed, 18 Mar 2020 13:35:58 -0400 Received: from [2a01:e0a:1d:7270:af76:b9b:ca24:c465] (port=35756 helo=ribbon) by fencepost.gnu.org with esmtpsa (TLS1.2:RSA_AES_256_CBC_SHA1:256) (Exim 4.82) (envelope-from ) id 1jEcbl-0004pi-R9; Wed, 18 Mar 2020 13:35:58 -0400 From: =?utf-8?Q?Ludovic_Court=C3=A8s?= To: Mathieu Othacehe Subject: Re: [bug#37868] [PATCH v8] system: Add kernel-module-packages to operating-system. References: <20200227135146.5701-1-dannym@scratchpost.org> <20200227155029.2542-1-dannym@scratchpost.org> <20200314194055.6d857037@scratchpost.org> <877dzlgbe2.fsf@gmail.com> <20200315191736.33ed8abf@scratchpost.org> <87y2s0ei8i.fsf@gmail.com> <20200316211052.5d4e29a2@scratchpost.org> <87v9n1d8ez.fsf@gmail.com> X-URL: http://www.fdn.fr/~lcourtes/ X-Revolutionary-Date: 29 =?utf-8?Q?Vent=C3=B4se?= an 228 de la =?utf-8?Q?R?= =?utf-8?Q?=C3=A9volution?= X-PGP-Key-ID: 0x090B11993D9AEBB5 X-PGP-Key: http://www.fdn.fr/~lcourtes/ludovic.asc X-PGP-Fingerprint: 3CE4 6455 8A84 FDC6 9DB4 0CFB 090B 1199 3D9A EBB5 X-OS: x86_64-pc-linux-gnu Date: Wed, 18 Mar 2020 18:35:54 +0100 In-Reply-To: <87v9n1d8ez.fsf@gmail.com> (Mathieu Othacehe's message of "Wed, 18 Mar 2020 15:50:12 +0100") Message-ID: <87d0997eh1.fsf@gnu.org> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/26.3 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Spam-Score: -0.7 (/) X-Debbugs-Envelope-To: 37868 Cc: Danny Milosavljevic , mhw@netris.org, 37868@debbugs.gnu.org X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -1.7 (-) Hey! Mathieu Othacehe skribis: >> It could just be the >> >> (not target) ;XXX: no cross-compilation >> >> in guix/build-system/linux-module.scm - because the other file should su= pport >> it just fine. > > Removing the (not target) is enough to make it build. But then it=E2=80=99s a native build. :-) Ludo=E2=80=99. From debbugs-submit-bounces@debbugs.gnu.org Thu Mar 19 10:22:43 2020 Received: (at 37868) by debbugs.gnu.org; 19 Mar 2020 14:22:43 +0000 Received: from localhost ([127.0.0.1]:43452 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1jEw4G-00084I-91 for submit@debbugs.gnu.org; Thu, 19 Mar 2020 10:22:43 -0400 Received: from dd26836.kasserver.com ([85.13.145.193]:36502) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1jEw4B-000845-D0 for 37868@debbugs.gnu.org; Thu, 19 Mar 2020 10:22:39 -0400 Received: from dayas.lan (80-110-126-163.cgn.dynamic.surfer.at [80.110.126.163]) by dd26836.kasserver.com (Postfix) with ESMTPSA id 2A1FE3367ECD; Thu, 19 Mar 2020 15:22:33 +0100 (CET) From: Danny Milosavljevic To: 37868@debbugs.gnu.org Subject: [PATCH v10] system: Add kernel-loadable-modules to operating-system. Date: Thu, 19 Mar 2020 15:22:19 +0100 Message-Id: <20200319142219.2618-1-dannym@scratchpost.org> X-Mailer: git-send-email 2.25.1 MIME-Version: 1.0 Tags: patch Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Spam-Score: -0.7 (/) X-Debbugs-Envelope-To: 37868 Cc: Danny Milosavljevic X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -1.7 (-) * gnu/system.scm (): Add kernel-loadable-modules. (operating-system-directory-base-entries): Use it. * doc/guix.texi (operating-system Reference): Document KERNEL-LOADABLE-MODULES. * gnu/build/linux-modules.scm (depmod): New procedure. (make-linux-module-directory): New procedure. Export it. * guix/profiles.scm (linux-module-database): New procedure. Export it. * gnu/tests/linux-modules.scm: New file. * gnu/local.mk (GNU_SYSTEM_MODULES): Add it. * gnu/packages/linux.scm (make-linux-libre*)[arguments]<#:phases>[install]: Disable depmod. Remove "build" and "source" symlinks. --- doc/guix.texi | 4 ++ gnu/build/linux-modules.scm | 46 +++++++++++++++- gnu/local.mk | 1 + gnu/packages/linux.scm | 22 +++++++- gnu/system.scm | 16 ++++-- gnu/tests/linux-modules.scm | 103 ++++++++++++++++++++++++++++++++++++ guix/profiles.scm | 49 ++++++++++++++++- 7 files changed, 233 insertions(+), 8 deletions(-) create mode 100644 gnu/tests/linux-modules.scm diff --git a/doc/guix.texi b/doc/guix.texi index c2eff582f8..10fd7b3312 100644 --- a/doc/guix.texi +++ b/doc/guix.texi @@ -11226,6 +11226,10 @@ The package object of the operating system kernel to use@footnote{Currently only the Linux-libre kernel is supported. In the future, it will be possible to use the GNU@tie{}Hurd.}. +@item @code{kernel-loadable-modules} (default: '()) +A list of objects (usually packages) to collect loadable kernel modules +from--e.g. @code{(list ddcci-driver-linux)}. + @item @code{kernel-arguments} (default: @code{'("quiet")}) List of strings or gexps representing additional arguments to pass on the command-line of the kernel---e.g., @code{("console=ttyS0")}. diff --git a/gnu/build/linux-modules.scm b/gnu/build/linux-modules.scm index a149eff329..aa1c7cfeae 100644 --- a/gnu/build/linux-modules.scm +++ b/gnu/build/linux-modules.scm @@ -22,12 +22,14 @@ #:use-module (guix elf) #:use-module (guix glob) #:use-module (guix build syscalls) - #:use-module ((guix build utils) #:select (find-files)) + #:use-module ((guix build utils) #:select (find-files invoke)) + #:use-module (guix build union) #:use-module (rnrs io ports) #:use-module (rnrs bytevectors) #:use-module (srfi srfi-1) #:use-module (srfi srfi-11) #:use-module (srfi srfi-26) + #:use-module (ice-9 ftw) #:use-module (ice-9 vlist) #:use-module (ice-9 match) #:use-module (ice-9 rdelim) @@ -56,7 +58,9 @@ write-module-name-database write-module-alias-database - write-module-device-database)) + write-module-device-database + + make-linux-module-directory)) ;;; Commentary: ;;; @@ -631,4 +635,42 @@ be loaded on-demand, such as file system modules." module devname type major minor))) aliases)))) +(define (depmod version directory) + "Given an (existing) DIRECTORY, invoke depmod on it for +kernel version VERSION." + (let ((destination-directory (string-append directory "/lib/modules/" + version)) + ;; Note: "System.map" is an input file. + (maps-file (string-append directory "/System.map")) + ;; Note: "Module.symvers" is an input file. + (symvers-file (string-append directory "/Module.symvers"))) + ;; These files will be regenerated by depmod below. + (for-each (lambda (basename) + (when (and (string-prefix? "modules." basename) + ;; Note: "modules.builtin" is an input file. + (not (string=? "modules.builtin" basename)) + ;; Note: "modules.order" is an input file. + (not (string=? "modules.order" basename))) + (delete-file (string-append destination-directory "/" + basename)))) + (scandir destination-directory)) + (invoke "depmod" + "-e" ; Report symbols that aren't supplied + ;"-w" ; Warn on duplicates + "-b" directory + "-F" maps-file + ;"-E" symvers-file ; using both "-E" and "-F" is not possible. + version))) + +(define (make-linux-module-directory inputs version output) + "Create a new directory OUTPUT and ensure that the directory +OUTPUT/lib/modules/VERSION can be used as a source of Linux +kernel modules for the first kmod in PATH now to eventually +load. Take modules to put into OUTPUT from INPUTS. + +Right now that means it creates @code{modules.*.bin} which +@command{modprobe} will use to find loadable modules." + (union-build output inputs #:create-all-directories? #t) + (depmod version output)) + ;;; linux-modules.scm ends here diff --git a/gnu/local.mk b/gnu/local.mk index ca3f2664aa..b00e0bcf72 100644 --- a/gnu/local.mk +++ b/gnu/local.mk @@ -633,6 +633,7 @@ GNU_SYSTEM_MODULES = \ %D%/tests/nfs.scm \ %D%/tests/install.scm \ %D%/tests/ldap.scm \ + %D%/tests/linux-modules.scm \ %D%/tests/mail.scm \ %D%/tests/messaging.scm \ %D%/tests/networking.scm \ diff --git a/gnu/packages/linux.scm b/gnu/packages/linux.scm index 0e649d0fe3..1bae26f0a5 100644 --- a/gnu/packages/linux.scm +++ b/gnu/packages/linux.scm @@ -678,6 +678,7 @@ for ARCH and optionally VARIANT, or #f if there is no such configuration." (guix build utils) (srfi srfi-1) (srfi srfi-26) + (ice-9 ftw) (ice-9 match)) #:phases (modify-phases %standard-phases @@ -763,12 +764,29 @@ for ARCH and optionally VARIANT, or #f if there is no such configuration." ;; Install kernel modules (mkdir-p moddir) (invoke "make" - (string-append "DEPMOD=" kmod "/bin/depmod") + ;; Disable depmod because the Guix system's module directory + ;; is an union of potentially multiple packages. It is not + ;; possible to use depmod to usefully calculate a dependency + ;; graph while building only one of those packages. + "DEPMOD=true" (string-append "MODULE_DIR=" moddir) (string-append "INSTALL_PATH=" out) (string-append "INSTALL_MOD_PATH=" out) "INSTALL_MOD_STRIP=1" - "modules_install"))))) + "modules_install") + (let* ((versions (filter (lambda (name) + (not (string-prefix? "." name))) + (scandir moddir))) + (version (match versions + ((x) x)))) + ;; There are symlinks to the build and source directory, + ;; both of which will point to target /tmp/guix-build* + ;; and thus not be useful in a profile. Delete the symlinks. + (false-if-file-not-found + (delete-file (string-append moddir "/" version "/build"))) + (false-if-file-not-found + (delete-file (string-append moddir "/" version "/source")))) + #t)))) #:tests? #f)) (home-page "https://www.gnu.org/software/linux-libre/") (synopsis "100% free redistribution of a cleaned Linux kernel") diff --git a/gnu/system.scm b/gnu/system.scm index 06c58c27ba..c90d8c6cbc 100644 --- a/gnu/system.scm +++ b/gnu/system.scm @@ -5,6 +5,7 @@ ;;; Copyright © 2016 Chris Marusich ;;; Copyright © 2017 Mathieu Othacehe ;;; Copyright © 2019 Meiyo Peng +;;; Copyright © 2020 Danny Milosavljevic ;;; ;;; This file is part of GNU Guix. ;;; @@ -168,6 +169,8 @@ (kernel operating-system-kernel ; package (default linux-libre)) + (kernel-loadable-modules operating-system-kernel-loadable-modules + (default '())) ; list of packages (kernel-arguments operating-system-user-kernel-arguments (default '("quiet"))) ; list of gexps/strings (bootloader operating-system-bootloader) ; @@ -472,9 +475,16 @@ OS." "Return the basic entries of the 'system' directory of OS for use as the value of the SYSTEM-SERVICE-TYPE service." (let ((locale (operating-system-locale-directory os))) - (mlet %store-monad ((kernel -> (operating-system-kernel os)) - (initrd -> (operating-system-initrd-file os)) - (params (operating-system-boot-parameters-file os))) + (mlet* %store-monad ((kernel -> (operating-system-kernel os)) + (modules -> + (operating-system-kernel-loadable-modules os)) + (kernel + (profile-derivation + (packages->manifest + (cons kernel modules)) + #:hooks (list linux-module-database))) + (initrd -> (operating-system-initrd-file os)) + (params (operating-system-boot-parameters-file os))) (return `(("kernel" ,kernel) ("parameters" ,params) ("initrd" ,initrd) diff --git a/gnu/tests/linux-modules.scm b/gnu/tests/linux-modules.scm new file mode 100644 index 0000000000..39e11587c6 --- /dev/null +++ b/gnu/tests/linux-modules.scm @@ -0,0 +1,103 @@ +;;; GNU Guix --- Functional package management for GNU +;;; Copyright © 2019 Jakob L. Kreuze +;;; Copyright © 2020 Danny Milosavljevic +;;; +;;; This file is part of GNU Guix. +;;; +;;; GNU Guix is free software; you can redistribute it and/or modify it +;;; under the terms of the GNU General Public License as published by +;;; the Free Software Foundation; either version 3 of the License, or (at +;;; your option) any later version. +;;; +;;; GNU Guix is distributed in the hope that it will be useful, but +;;; WITHOUT ANY WARRANTY; without even the implied warranty of +;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +;;; GNU General Public License for more details. +;;; +;;; You should have received a copy of the GNU General Public License +;;; along with GNU Guix. If not, see . + +(define-module (gnu tests linux-modules) + #:use-module (gnu packages linux) + #:use-module (gnu system) + #:use-module (gnu system vm) + #:use-module (gnu tests) + #:use-module (guix derivations) + #:use-module (guix gexp) + #:use-module (guix modules) + #:use-module (guix monads) + #:use-module (guix store) + #:export (%test-loadable-kernel-modules-0 + %test-loadable-kernel-modules-1 + %test-loadable-kernel-modules-2)) + +;;; Commentary: +;;; +;;; Test kernel-loadable-modules. +;;; +;;; Code: + +(define* (module-loader-program os modules) + "Return an executable store item that, upon being evaluated, will dry-run +load MODULES." + (program-file + "load-kernel-modules.scm" + (with-imported-modules (source-module-closure '((guix build utils))) + #~(begin + (use-modules (guix build utils)) + (for-each (lambda (module) + (invoke (string-append #$kmod "/bin/modprobe") "-n" "--" + module)) + '#$modules))))) + +(define* (run-loadable-kernel-modules-test module-packages module-names) + "Run a test of an OS having MODULE-PACKAGES, and modprobe MODULE-NAMES." + (define os + (marionette-operating-system + (operating-system + (inherit (simple-operating-system)) + (kernel-loadable-modules module-packages)) + #:imported-modules '((guix combinators)))) + (define vm (virtual-machine os)) + (define (test script) + (with-imported-modules '((gnu build marionette)) + #~(begin + (use-modules (gnu build marionette) + (srfi srfi-64)) + (define marionette + (make-marionette (list #$vm))) + (mkdir #$output) + (chdir #$output) + (test-begin "loadable-kernel-modules") + (test-assert "script successfully evaluated" + (marionette-eval + '(primitive-load #$script) + marionette)) + (test-end) + (exit (= (test-runner-fail-count (test-runner-current)) 0))))) + (gexp->derivation "loadable-kernel-modules" (test (module-loader-program os module-names)))) + +(define %test-loadable-kernel-modules-0 + (system-test + (name "loadable-kernel-modules-0") + (description "Tests loadable kernel modules facility of +with no extra modules.") + (value (run-loadable-kernel-modules-test '() '())))) + +(define %test-loadable-kernel-modules-1 + (system-test + (name "loadable-kernel-modules-1") + (description "Tests loadable kernel modules facility of +with one extra module.") + (value (run-loadable-kernel-modules-test + (list ddcci-driver-linux) + '("ddcci"))))) + +(define %test-loadable-kernel-modules-2 + (system-test + (name "loadable-kernel-modules-2") + (description "Tests loadable kernel modules facility of +with two extra modules.") + (value (run-loadable-kernel-modules-test + (list acpi-call-linux-module ddcci-driver-linux) + '("acpi_call" "ddcci"))))) diff --git a/guix/profiles.scm b/guix/profiles.scm index 0d38b2513f..c0fd8ddc35 100644 --- a/guix/profiles.scm +++ b/guix/profiles.scm @@ -10,6 +10,7 @@ ;;; Copyright © 2017 Maxim Cournoyer ;;; Copyright © 2019 Kyle Meyer ;;; Copyright © 2019 Mathieu Othacehe +;;; Copyright © 2020 Danny Milosavljevic ;;; ;;; This file is part of GNU Guix. ;;; @@ -139,7 +140,9 @@ %current-profile ensure-profile-directory canonicalize-profile - user-friendly-profile)) + user-friendly-profile + + linux-module-database)) ;;; Commentary: ;;; @@ -1137,6 +1140,50 @@ for both major versions of GTK+." (hook . gtk-im-modules))) (return #f))))) +(define (linux-module-database manifest) + "Return a derivation that unions all the kernel modules in the manifest +and creates the dependency graph for all these kernel modules. + +This is meant to be used as a profile hook." + (mlet %store-monad ((kmod (manifest-lookup-package manifest "kmod"))) + (define build + (with-imported-modules + (source-module-closure '((guix build utils) + (gnu build linux-modules))) + #~(begin + (use-modules (ice-9 ftw) + (ice-9 match) + (srfi srfi-1) ; append-map + (gnu build linux-modules)) + (let* ((inputs '#$(manifest-inputs manifest)) + (module-directories + (map (lambda (directory) + (string-append directory "/lib/modules")) + inputs)) + (directory-entries + (lambda (directory) + (scandir directory (lambda (basename) + (not + (string-prefix? "." basename)))))) + ;; Note: Should usually result in one entry. + (versions (delete-duplicates + (append-map directory-entries + module-directories)))) + (match versions + ((version) + (let ((old-path (getenv "PATH"))) + (setenv "PATH" #+(file-append kmod "/bin")) + (make-linux-module-directory inputs version #$output) + (setenv "PATH" old-path))) + (_ (error "Specified Linux kernel and Linux kernel modules +are not all of the same version"))))))) + (gexp->derivation "linux-module-database" build + #:local-build? #t + #:substitutable? #f + #:properties + `((type . profile-hook) + (hook . linux-module-database))))) + (define (xdg-desktop-database manifest) "Return a derivation that builds the @file{mimeinfo.cache} database from desktop files. It's used to query what applications can handle a given From debbugs-submit-bounces@debbugs.gnu.org Fri Mar 20 06:19:42 2020 Received: (at 37868) by debbugs.gnu.org; 20 Mar 2020 10:19:42 +0000 Received: from localhost ([127.0.0.1]:44003 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1jFEkg-0007KY-5m for submit@debbugs.gnu.org; Fri, 20 Mar 2020 06:19:42 -0400 Received: from dd26836.kasserver.com ([85.13.145.193]:50942) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1jFEke-0007KO-M4 for 37868@debbugs.gnu.org; Fri, 20 Mar 2020 06:19:41 -0400 Received: from localhost (80-110-126-163.cgn.dynamic.surfer.at [80.110.126.163]) by dd26836.kasserver.com (Postfix) with ESMTPSA id 57EA33367A6C; Fri, 20 Mar 2020 11:19:39 +0100 (CET) Date: Fri, 20 Mar 2020 11:19:38 +0100 From: Danny Milosavljevic To: Mathieu Othacehe Subject: Re: [bug#37868] [PATCH v8] system: Add kernel-module-packages to operating-system. Message-ID: <20200320111938.4472f145@scratchpost.org> In-Reply-To: <87v9n1d8ez.fsf@gmail.com> References: <20200227135146.5701-1-dannym@scratchpost.org> <20200227155029.2542-1-dannym@scratchpost.org> <20200314194055.6d857037@scratchpost.org> <877dzlgbe2.fsf@gmail.com> <20200315191736.33ed8abf@scratchpost.org> <87y2s0ei8i.fsf@gmail.com> <20200316211052.5d4e29a2@scratchpost.org> <87v9n1d8ez.fsf@gmail.com> X-Mailer: Claws Mail 3.17.5 (GTK+ 2.24.32; x86_64-unknown-linux-gnu) MIME-Version: 1.0 Content-Type: multipart/signed; boundary="Sig_/Vovf+ouRUzX=eFOp3uT/SJJ"; protocol="application/pgp-signature"; micalg=pgp-sha256 X-Spam-Score: -0.7 (/) X-Debbugs-Envelope-To: 37868 Cc: mhw@netris.org, ludo@gnu.org, 37868@debbugs.gnu.org X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -1.7 (-) --Sig_/Vovf+ouRUzX=eFOp3uT/SJJ Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: quoted-printable Hi Mathieu, what happen if there are no kernel-module-packages and one is cross-compili= ng? Then (native) depmod should still be invoked on linux-libre's modules. I think that that case is the most important to test in order to avoid regressions. --Sig_/Vovf+ouRUzX=eFOp3uT/SJJ Content-Type: application/pgp-signature Content-Description: OpenPGP digital signature -----BEGIN PGP SIGNATURE----- iQEzBAEBCAAdFiEEds7GsXJ0tGXALbPZ5xo1VCwwuqUFAl50mLoACgkQ5xo1VCww uqWpWwf+LCwOohJVmcQHhAf8h0+kMDwPMGjQfGrIOBkupbWPKmbysXMIu7kyzGJr d9mceBuRWDg908kszQoiYpkIBFFeg/CTnwepf4qbY1utBPRz/BXha41hMO8bR/EP Mtj+ytt6Z++3lPnvLUHpZJExHfv2A1+JTVxsFg+5u62tV7XX4Ooe3NZ0zM0oS9ql dcPsBYmjZJCDcyuIU0tCi/pW5zHNDpwL77pZsSl35ut5mNxLMuegk5FKLogb1wQ9 p+DJLRMc+g5S6uaD71ebe3MgYa9Pr7FAEdiuz7xQDgb54m2gdLeq6DwITmCbPEI+ RnhfcaN7HYjMaaQ6bq0a9X6o7kOoMQ== =45UY -----END PGP SIGNATURE----- --Sig_/Vovf+ouRUzX=eFOp3uT/SJJ-- From debbugs-submit-bounces@debbugs.gnu.org Fri Mar 20 06:32:48 2020 Received: (at 37868) by debbugs.gnu.org; 20 Mar 2020 10:32:48 +0000 Received: from localhost ([127.0.0.1]:44008 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1jFExM-0007mc-Ds for submit@debbugs.gnu.org; Fri, 20 Mar 2020 06:32:48 -0400 Received: from mail-wm1-f67.google.com ([209.85.128.67]:51355) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1jFExK-0007mM-6j for 37868@debbugs.gnu.org; Fri, 20 Mar 2020 06:32:46 -0400 Received: by mail-wm1-f67.google.com with SMTP id c187so5908625wme.1 for <37868@debbugs.gnu.org>; Fri, 20 Mar 2020 03:32:46 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=references:user-agent:from:to:cc:subject:in-reply-to:date :message-id:mime-version; bh=0aHUpoUNJGblGVgPpiBy2rQ/m2ZKx5Li41+dKVzWDsw=; b=f2gX+GGaIAjJijNAMtkgUf2bxhg6qAR3s3e5mg+ymEhJdnmcQ2Z78su5z/SCXi9KeB WaAK8fpHUvrwDZk29l70IWBzPv/ZON2LyTyf5NvcoeMcY+u7AmtxtcKkTnVoEbGoPGqY eI3PblxNXEMzRVX9ng5/EGhia9iBzjWY4IZVQPd74fFwG7y3sq5bJQ56t9WKKulTQYlK s0gKk0CgO2DjiniFcbjs2FySasNHi6aGp0XFu0eG5TGgh2WBPV7KbiJu8RiRCuMmwkzy roY52cr2I4XJK7Ad9WkdYNMZC8TgZ5wFuOVQ/rDwlOuQzhNcnJ0xxjsDup4vHgiH0j39 LD/A== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:references:user-agent:from:to:cc:subject :in-reply-to:date:message-id:mime-version; bh=0aHUpoUNJGblGVgPpiBy2rQ/m2ZKx5Li41+dKVzWDsw=; b=EbdvTLv8dU6fO/V1Nbg62ledUEQBoVXECnHJoF5E+FeQM1XTmiLb1EUXWdLQ6TPIPJ n8XZz8W6sJWTh1FLunLndc7BHNxb1H+rFyCIQ61evjZKUK1lcbMKjl4hsrQlArC+SyUz tL9hfPE0rbm9s7u/U8SdHc1yIZydFi2eHUdjyvl86067gVZE9+uSzLrwUG5go02b/63l RgQw7FotDZoiVpjQtNJIhlEZkB1jJIioLMK5eCpQXwPqZybTMPmyf3RlrXnDu7hlIZqF dtFzona3KUVu85iIVH7dkott8YZwx8hi0GbNb/jBddfG99QUZGGRG3Qn708VjOuPaL7I 4mpw== X-Gm-Message-State: ANhLgQ0dE/wYRcg647UG4VELAmuuKEel7KZpozD/oPyJrayZhGew0iZY XORB+HWYtfqDB9Qnhh3BZ+g= X-Google-Smtp-Source: ADFU+vt0BpL2+5guxg6eagHwBx0lvuNsdJ+buIF6ZzplTb8l+A+Nln0D8WsGLtsvJ7XSpimyuaRb7Q== X-Received: by 2002:a1c:a950:: with SMTP id s77mr9222470wme.176.1584700360231; Fri, 20 Mar 2020 03:32:40 -0700 (PDT) Received: from meru ([2a01:cb18:832e:5f00:b0f7:cdca:88af:9474]) by smtp.gmail.com with ESMTPSA id y189sm7424871wmb.26.2020.03.20.03.32.38 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 20 Mar 2020 03:32:39 -0700 (PDT) References: <20200227135146.5701-1-dannym@scratchpost.org> <20200227155029.2542-1-dannym@scratchpost.org> <20200314194055.6d857037@scratchpost.org> <877dzlgbe2.fsf@gmail.com> <20200315191736.33ed8abf@scratchpost.org> <87y2s0ei8i.fsf@gmail.com> <20200316211052.5d4e29a2@scratchpost.org> <87v9n1d8ez.fsf@gmail.com> <20200320111938.4472f145@scratchpost.org> User-agent: mu4e 1.2.0; emacs 26.3 From: Mathieu Othacehe To: Danny Milosavljevic Subject: Re: [bug#37868] [PATCH v8] system: Add kernel-module-packages to operating-system. In-reply-to: <20200320111938.4472f145@scratchpost.org> Date: Fri, 20 Mar 2020 11:32:38 +0100 Message-ID: <87lfnvjozd.fsf@gmail.com> MIME-Version: 1.0 Content-Type: text/plain X-Spam-Score: 0.0 (/) X-Debbugs-Envelope-To: 37868 Cc: mhw@netris.org, ludo@gnu.org, 37868@debbugs.gnu.org X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -1.0 (-) Hello Danny, > Then (native) depmod should still be invoked on linux-libre's modules. > > I think that that case is the most important to test in order to avoid > regressions. You are right and it that case, everything seems to work fine! It would be nice to fix linux-module-build-system cross-compilation, but I think that it can be done later. Mathieu From debbugs-submit-bounces@debbugs.gnu.org Fri Mar 20 11:13:30 2020 Received: (at 37868) by debbugs.gnu.org; 20 Mar 2020 15:13:30 +0000 Received: from localhost ([127.0.0.1]:45369 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1jFJL0-0000eB-7W for submit@debbugs.gnu.org; Fri, 20 Mar 2020 11:13:30 -0400 Received: from mail-wr1-f65.google.com ([209.85.221.65]:39958) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1jFJKy-0000dr-Lq for 37868@debbugs.gnu.org; Fri, 20 Mar 2020 11:13:29 -0400 Received: by mail-wr1-f65.google.com with SMTP id f3so7911839wrw.7 for <37868@debbugs.gnu.org>; Fri, 20 Mar 2020 08:13:28 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=references:user-agent:from:to:cc:subject:in-reply-to:date :message-id:mime-version; bh=IOMbRg1h5pGIzJo2CQImhuHMwf+c1wM8khVu1aYLqxg=; b=lT6Yg6aoDSC1prbt6MggFL3Tsup15FJYMTsQlrH3O+BVpVbfamVd67fSSPuHZyXm0J BmSEJXp5+MxNFildWepJs4gBJ0vvL+pN/BaIfbkHMpmNaIfuoe6iw07jMiA0kZUpuicV L0eZf9RrJD/eaOAL8mBNxFHKbhlo8saMEvQj2oHfTRELElZ67ktt7BYLJ+WmKOK4632n lXgxxmOzdJNLVMG8yEcXuMR/aRrE2OvH+y85NBgcqDXytIRHMHMH2C94qNRsmZH6Mntp zMIsE8rGuhhQRJDMJ6QtoSNrntOWiS10+u4DvD9IX83vhHZFS0k+t0/V14yHxuh5A/aN N8Nw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:references:user-agent:from:to:cc:subject :in-reply-to:date:message-id:mime-version; bh=IOMbRg1h5pGIzJo2CQImhuHMwf+c1wM8khVu1aYLqxg=; b=H6/IYWUtVEKvWAWa4jTvINBrN+1zhG8uVZenIO+eSCkyLoHUQGEy2fBdTsc2POKhKC nzml/a/AunXPznpWBC+pVLmUuv+jgCyQFrmPW9izZZ7lgjGlVTLzIKMckS4UFTxAnJdz RKtyOLHJ4tf7nvQ7IjQ5tguFDUWrK4OSOyKCy/zLUO72mdtLYfkUTpiBqKTuhoW9pjP6 cAuLrAUvefY6Pwj5/UAGnYDBxC46RRcdYPavwCNYAqDFHkcmN/LWyGz+Uqu4P72VkGMa jvjKZW2IVRdyd0IqTB0jA3wSBrEgEeTL26BNyXeLqP+bO/5dATFtz6vVcOvI87THIzzd Shaw== X-Gm-Message-State: ANhLgQ2ZU3CLZ14DByCp8y1cfduEwGoIWWQ5VHkAfLqVOVJtTJUobIwk 2v3n6J5L2Y3rdqR0fMm8GeQ= X-Google-Smtp-Source: ADFU+vt7NnmLuhH2B12sjAJPiiExIeShLOt/5PLGCm4yji2KHUnM8WD0KKo7DcGISTavUdwmthU4YQ== X-Received: by 2002:adf:aac5:: with SMTP id i5mr2938266wrc.285.1584717202805; Fri, 20 Mar 2020 08:13:22 -0700 (PDT) Received: from meru ([2a01:cb18:832e:5f00:b0f7:cdca:88af:9474]) by smtp.gmail.com with ESMTPSA id g128sm8381052wmf.27.2020.03.20.08.13.21 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 20 Mar 2020 08:13:21 -0700 (PDT) References: <20200227135146.5701-1-dannym@scratchpost.org> <20200227155029.2542-1-dannym@scratchpost.org> <20200314194055.6d857037@scratchpost.org> <877dzlgbe2.fsf@gmail.com> <20200315191736.33ed8abf@scratchpost.org> <87y2s0ei8i.fsf@gmail.com> <20200316211052.5d4e29a2@scratchpost.org> <87v9n1d8ez.fsf@gmail.com> <20200320111938.4472f145@scratchpost.org> User-agent: mu4e 1.2.0; emacs 26.3 From: Mathieu Othacehe To: Danny Milosavljevic Subject: Re: [bug#37868] [PATCH v8] system: Add kernel-module-packages to operating-system. In-reply-to: <20200320111938.4472f145@scratchpost.org> Date: Fri, 20 Mar 2020 16:13:20 +0100 Message-ID: <87fte3jbzj.fsf@gmail.com> MIME-Version: 1.0 Content-Type: multipart/mixed; boundary="=-=-=" X-Spam-Score: 0.0 (/) X-Debbugs-Envelope-To: 37868 Cc: mhw@netris.org, ludo@gnu.org, 37868@debbugs.gnu.org X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -1.0 (-) --=-=-= Content-Type: text/plain Hey, Here's a patch that fixes linux-module-build-system cross-compilation. I tested it on acpi-call-linux-module, ddcci-driver-linux, vhba-module and rtl8812au-aircrack-ng-linux-module, seems to work fine! Now, I'll try to rebase it on top of your patch and see if it works for a cross-compiled system. Thanks, Mathieu --=-=-= Content-Type: text/x-diff; charset=utf-8 Content-Disposition: inline; filename=0001-build-system-linux-module-Fix-cross-compilation.patch Content-Transfer-Encoding: quoted-printable >From 0331acf8494cc8404a23c0bdd516ef7c5bf854ad Mon Sep 17 00:00:00 2001 From: Mathieu Othacehe Date: Fri, 20 Mar 2020 16:01:02 +0100 Subject: [PATCH] build-system: linux-module: Fix cross-compilation. * guix/build-system/linux-module.scm (default-kmod, default-gcc): Remove as unused, (system->arch): new procedure, (make-linux-module-builder)[native-inputs]: move linux ... [inputs]: ... to here, (lower): allow cross-compilation, move "linux" and "linux-module-builder" to host-inputs, add target-inputs, call linux-module-build-cross if target is set, linux-module-build otherwise, (linux-module-build): add a target argument, pass target and arch to build side linux-module-build call, (linux-module-build-cross): new procedure. * guix/build/linux-module-build-system.scm (configure): Add arch argument a= nd use it to set ARCH environment variable, (linux-module-build): fill comment. --- guix/build-system/linux-module.scm | 162 +++++++++++++++++------ guix/build/linux-module-build-system.scm | 17 +-- 2 files changed, 132 insertions(+), 47 deletions(-) diff --git a/guix/build-system/linux-module.scm b/guix/build-system/linux-m= odule.scm index 1e1a07d0a2..ca104f7c75 100644 --- a/guix/build-system/linux-module.scm +++ b/guix/build-system/linux-module.scm @@ -1,5 +1,6 @@ ;;; GNU Guix --- Functional package management for GNU ;;; Copyright =C2=A9 2019 Danny Milosavljevic +;;; Copyright =C2=A9 2020 Mathieu Othacehe ;;; ;;; This file is part of GNU Guix. ;;; @@ -45,27 +46,16 @@ (let ((module (resolve-interface '(gnu packages linux)))) (module-ref module 'linux-libre))) =20 -(define (default-kmod) - "Return the default kmod package." - - ;; Do not use `@' to avoid introducing circular dependencies. +(define (system->arch system) (let ((module (resolve-interface '(gnu packages linux)))) - (module-ref module 'kmod))) - -(define (default-gcc) - "Return the default gcc package." - - ;; Do not use `@' to avoid introducing circular dependencies. - (let ((module (resolve-interface '(gnu packages gcc)))) - (module-ref module 'gcc-7))) + ((module-ref module 'system->linux-architecture) system))) =20 (define (make-linux-module-builder linux) (package (inherit linux) (name (string-append (package-name linux) "-module-builder")) - (native-inputs - `(("linux" ,linux) - ,@(package-native-inputs linux))) + (inputs + `(("linux" ,linux))) (arguments (substitute-keyword-arguments (package-arguments linux) ((#:phases phases) @@ -97,33 +87,43 @@ #:rest arguments) "Return a bag for NAME." (define private-keywords - '(#:source #:target #:gcc #:kmod #:linux #:inputs #:native-inputs)) - - (and (not target) ;XXX: no cross-compilati= on - (bag - (name name) - (system system) - (host-inputs `(,@(if source - `(("source" ,source)) - '()) - ,@inputs - ,@(standard-packages))) - (build-inputs `(("linux" ,linux) ; for "Module.symvers". - ("linux-module-builder" - ,(make-linux-module-builder linux)) - ,@native-inputs - ;; TODO: Remove "gmp", "mpfr", "mpc" since they a= re - ;; only needed to compile the gcc plugins. Maybe - ;; remove "flex", "bison", "elfutils", "perl", - ;; "openssl". That leaves very little ("bc", "gc= c", - ;; "kmod"). - ,@(package-native-inputs linux))) - (outputs outputs) - (build linux-module-build) - (arguments (strip-keyword-arguments private-keywords arguments)))= )) + `(#:source #:target #:gcc #:kmod #:linux #:inputs #:native-inputs + ,@(if target '() '(#:target)))) + + (bag + (name name) + (system system) (target target) + (build-inputs `(,@(if source + `(("source" ,source)) + '()) + ,@native-inputs + ;; TODO: Remove "gmp", "mpfr", "mpc" since they are + ;; only needed to compile the gcc plugins. Maybe + ;; remove "flex", "bison", "elfutils", "perl", + ;; "openssl". That leaves very little ("bc", "gcc", + ;; "kmod"). + ,@(package-native-inputs linux) + ,@(if target + ;; Use the standard cross inputs of + ;; 'gnu-build-system'. + (standard-cross-packages target 'host) + '()) + ;; Keep the standard inputs of 'gnu-build-system'. + ,@(standard-packages))) + (host-inputs `(,@inputs + ("linux" ,linux) + ("linux-module-builder" + ,(make-linux-module-builder linux)))) + (target-inputs (if target + (standard-cross-packages target 'target) + '())) + (outputs outputs) + (build (if target linux-module-build-cross linux-module-build)) + (arguments (strip-keyword-arguments private-keywords arguments)))) =20 (define* (linux-module-build store name inputs #:key + target (search-paths '()) (tests? #t) (phases '(@ (guix build linux-module-build-sy= stem) @@ -152,6 +152,8 @@ search-paths) #:phases ,phases #:system ,system + #:target ,target + #:arch ,(system->arch (or target system)) #:tests? ,tests? #:outputs %outputs #:inputs %build-inputs))) @@ -173,6 +175,88 @@ #:guile-for-build guile-for-build #:substitutable? substitutable?)) =20 +(define* (linux-module-build-cross + store name + #:key + target native-drvs target-drvs + (guile #f) + (outputs '("out")) + (search-paths '()) + (native-search-paths '()) + (tests? #f) + (phases '(@ (guix build linux-module-build-system) + %standard-phases)) + (system (%current-system)) + (substitutable? #t) + (imported-modules + %linux-module-build-system-modules) + (modules '((guix build linux-module-build-system) + (guix build utils)))) + (define builder + `(begin + (use-modules ,@modules) + (let () + (define %build-host-inputs + ',(map (match-lambda + ((name (? derivation? drv) sub ...) + `(,name . ,(apply derivation->output-path drv sub))) + ((name path) + `(,name . ,path))) + native-drvs)) + + (define %build-target-inputs + ',(map (match-lambda + ((name (? derivation? drv) sub ...) + `(,name . ,(apply derivation->output-path drv sub))) + ((name (? package? pkg) sub ...) + (let ((drv (package-cross-derivation store pkg + target system))) + `(,name . ,(apply derivation->output-path drv sub))= )) + ((name path) + `(,name . ,path))) + target-drvs)) + + (linux-module-build #:name ,name + #:source ,(match (assoc-ref native-drvs "sour= ce") + (((? derivation? source)) + (derivation->output-path source)) + ((source) + source) + (source + source)) + #:system ,system + #:target ,target + #:arch ,(system->arch (or target system)) + #:outputs %outputs + #:inputs %build-target-inputs + #:native-inputs %build-host-inputs + #:search-paths + ',(map search-path-specification->sexp + search-paths) + #:native-search-paths + ',(map + search-path-specification->sexp + native-search-paths) + #:phases ,phases + #:tests? ,tests?)))) + + (define guile-for-build + (match guile + ((? package?) + (package-derivation store guile system #:graft? #f)) + (#f ; the default + (let* ((distro (resolve-interface '(gnu packages commencement))) + (guile (module-ref distro 'guile-final))) + (package-derivation store guile system #:graft? #f))))) + + (build-expression->derivation store name builder + #:system system + #:inputs (append native-drvs target-drvs) + #:outputs outputs + #:modules imported-modules + #:guile-for-build guile-for-build + #:substitutable? substitutable?)) + (define linux-module-build-system (build-system (name 'linux-module) diff --git a/guix/build/linux-module-build-system.scm b/guix/build/linux-mo= dule-build-system.scm index 8145d5a724..73d6b101f6 100644 --- a/guix/build/linux-module-build-system.scm +++ b/guix/build/linux-module-build-system.scm @@ -1,5 +1,6 @@ ;;; GNU Guix --- Functional package management for GNU ;;; Copyright =C2=A9 2019 Danny Milosavljevic +;;; Copyright =C2=A9 2020 Mathieu Othacehe ;;; ;;; This file is part of GNU Guix. ;;; @@ -33,14 +34,13 @@ ;; Code: =20 ;; Copied from make-linux-libre's "configure" phase. -(define* (configure #:key inputs target #:allow-other-keys) +(define* (configure #:key inputs target arch #:allow-other-keys) (setenv "KCONFIG_NOTIMESTAMP" "1") (setenv "KBUILD_BUILD_TIMESTAMP" (getenv "SOURCE_DATE_EPOCH")) - ;(let ((arch ,(system->linux-architecture - ; (or (%current-target-system) - ; (%current-system))))) - ; (setenv "ARCH" arch) - ; (format #t "`ARCH' set to `~a'~%" (getenv "ARCH"))) + + (setenv "ARCH" arch) + (format #t "`ARCH' set to `~a'~%" (getenv "ARCH")) + (when target (setenv "CROSS_COMPILE" (string-append target "-")) (format #t "`CROSS_COMPILE' set to `~a'~%" @@ -85,8 +85,9 @@ (replace 'install install))) =20 (define* (linux-module-build #:key inputs (phases %standard-phases) - #:allow-other-keys #:rest args) - "Build the given package, applying all of PHASES in order, with a Linux = kernel in attendance." + #:allow-other-keys #:rest args) + "Build the given package, applying all of PHASES in order, with a Linux +kernel in attendance." (apply gnu:gnu-build #:inputs inputs #:phases phases args)) --=20 2.25.1 --=-=-=-- From debbugs-submit-bounces@debbugs.gnu.org Fri Mar 20 13:52:40 2020 Received: (at 37868) by debbugs.gnu.org; 20 Mar 2020 17:52:40 +0000 Received: from localhost ([127.0.0.1]:45527 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1jFLp1-0002ce-V6 for submit@debbugs.gnu.org; Fri, 20 Mar 2020 13:52:40 -0400 Received: from mail-lj1-f195.google.com ([209.85.208.195]:33381) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1jFLoz-0002cN-OR for 37868@debbugs.gnu.org; Fri, 20 Mar 2020 13:52:38 -0400 Received: by mail-lj1-f195.google.com with SMTP id r22so330066ljh.0 for <37868@debbugs.gnu.org>; Fri, 20 Mar 2020 10:52:37 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc:content-transfer-encoding; bh=S2fd5Efgh3JypQ4us7dyF2TALuow3uf+LZOw2sebT3w=; b=T3RB3RSp1UOzPBfy9mwPO73Y2kX9e/OYcZ/pD4S8t1WR/6BWyCn5XPFujvTPxwXL/a ZNcZ5MKDvboObBegH/axkGDloaf2CmZTY3s1ARSSCtiMPN57V/ObEd+Db7ITa5zwqbyf VyI+gFm6kN0Oe5CBGkFbeSavGPkHXxj5vEGlRT6XixLxg5ApZNsEPxIYCKGVgjr+Jm4q U/861p/yGTxYEKoYzLQpAhh0NH8QyY2UlztTITl8Op2oXZ+5OqvjOyTjZtfHgETNh9RF 2dRhgM8y0ESJSKGIHml8tEDbi06FEQC8rl3nYA1tXrdPP2gfkd+FYM+LSfW3vzc/xT9r 5XXg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc:content-transfer-encoding; bh=S2fd5Efgh3JypQ4us7dyF2TALuow3uf+LZOw2sebT3w=; b=ixfyZmphFieyEh6dhzzIe0kv8GaWdbhQx4V+juDIGS/WY8fHngTWrZktEvzctnL98J O0C+5wJd+Lv40jI2jdAqfwlnEcfsUI6qM2zOuZNUgUPuZcXXWiPLoptZs809y8vaGK8Q /G1roeDynxT2MpbXfk0Oap8Jd0EUJjIuMGc4Fa2hr7snG+UwgtDF4ThflxZXF0VDcrjm apnAPenN3QgDRsY7+dZsm2pYJinKs2ZYo7hhYxwcywJAvxRSjKpAILhBIAUHkxnsCwjY tcot/WWXt0P4thDWiRmJyGqvsrN7NhWZfIw5WiY6GXVb6CvexmPlePatvAYuuNL9IPBo GYDw== X-Gm-Message-State: ANhLgQ0jp6WwA5JeUx+g4McQGJsTDaL47Ki3TpgNCSzaAX13DN0WbR1s 9svERUiIQ7saKx0wRvyBGLynEmmXmwQDM6cosJc= X-Google-Smtp-Source: ADFU+vvl5Cqxfi9Q3VATCogHERQXH7Z+ET3fW/wcQXsf9uT6ayeJW0HhfAMeQh692RSwMat0Vy3YD1fh3bYIUGV64Bs= X-Received: by 2002:a2e:8105:: with SMTP id d5mr6164933ljg.172.1584726751683; Fri, 20 Mar 2020 10:52:31 -0700 (PDT) MIME-Version: 1.0 References: <20200227135146.5701-1-dannym@scratchpost.org> <20200227155029.2542-1-dannym@scratchpost.org> <20200314194055.6d857037@scratchpost.org> <877dzlgbe2.fsf@gmail.com> <20200315191736.33ed8abf@scratchpost.org> <87y2s0ei8i.fsf@gmail.com> <20200316211052.5d4e29a2@scratchpost.org> <87v9n1d8ez.fsf@gmail.com> <20200320111938.4472f145@scratchpost.org> <87fte3jbzj.fsf@gmail.com> In-Reply-To: <87fte3jbzj.fsf@gmail.com> From: Mathieu Othacehe Date: Fri, 20 Mar 2020 18:52:20 +0100 Message-ID: Subject: Re: [bug#37868] [PATCH v8] system: Add kernel-module-packages to operating-system. To: Danny Milosavljevic Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable X-Spam-Score: 0.0 (/) X-Debbugs-Envelope-To: 37868 Cc: Mark H Weaver , =?UTF-8?Q?Ludovic_Court=C3=A8s?= , 37868@debbugs.gnu.org X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -1.0 (-) Yes I confirm that I'm now able to "modprobe acpi_call" on a cross-compiled system. Any further test I could run? Thanks, Mathieu Le ven. 20 mars 2020 =C3=A0 16:13, Mathieu Othacehe = a =C3=A9crit : > > > Hey, > > Here's a patch that fixes linux-module-build-system cross-compilation. I > tested it on acpi-call-linux-module, ddcci-driver-linux, vhba-module and > rtl8812au-aircrack-ng-linux-module, seems to work fine! > > Now, I'll try to rebase it on top of your patch and see if it works for > a cross-compiled system. > > Thanks, > > Mathieu From debbugs-submit-bounces@debbugs.gnu.org Sat Mar 21 06:06:35 2020 Received: (at 37868) by debbugs.gnu.org; 21 Mar 2020 10:06:35 +0000 Received: from localhost ([127.0.0.1]:45967 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1jFb1W-0007W9-Pp for submit@debbugs.gnu.org; Sat, 21 Mar 2020 06:06:34 -0400 Received: from dd26836.kasserver.com ([85.13.145.193]:57136) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1jFb1U-0007Vy-9V for 37868@debbugs.gnu.org; Sat, 21 Mar 2020 06:06:32 -0400 Received: from localhost (unknown [185.17.13.127]) by dd26836.kasserver.com (Postfix) with ESMTPSA id A370D33603FF; Sat, 21 Mar 2020 11:06:30 +0100 (CET) Date: Sat, 21 Mar 2020 11:06:27 +0100 From: Danny Milosavljevic To: Mathieu Othacehe Subject: Re: [bug#37868] [PATCH v8] system: Add kernel-module-packages to operating-system. Message-ID: <20200321110602.7efdb7e0@scratchpost.org> In-Reply-To: References: <20200227135146.5701-1-dannym@scratchpost.org> <20200227155029.2542-1-dannym@scratchpost.org> <20200314194055.6d857037@scratchpost.org> <877dzlgbe2.fsf@gmail.com> <20200315191736.33ed8abf@scratchpost.org> <87y2s0ei8i.fsf@gmail.com> <20200316211052.5d4e29a2@scratchpost.org> <87v9n1d8ez.fsf@gmail.com> <20200320111938.4472f145@scratchpost.org> <87fte3jbzj.fsf@gmail.com> X-Mailer: Claws Mail 3.17.5 (GTK+ 2.24.32; x86_64-unknown-linux-gnu) MIME-Version: 1.0 Content-Type: multipart/signed; boundary="Sig_/fNPn3y98HyaKua_sgiUKzbX"; protocol="application/pgp-signature"; micalg=pgp-sha256 X-Spam-Score: -0.7 (/) X-Debbugs-Envelope-To: 37868 Cc: Mark H Weaver , Ludovic =?ISO-8859-1?Q?Court=E8s?= , 37868@debbugs.gnu.org X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -1.7 (-) --Sig_/fNPn3y98HyaKua_sgiUKzbX Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: quoted-printable Hi Mathieu, On Fri, 20 Mar 2020 18:52:20 +0100 Mathieu Othacehe wrote: > Yes I confirm that I'm now able to "modprobe acpi_call" on a > cross-compiled system. Any further test I could run? that's great! That pretty much covers it. If you want and it's easy for you to do, you can also try make check-system TESTS=3D"loadable-kernel-modules-0 loadable-kernel-module= s-1 loadable-kernel-modules-2" It tests 0 extra module packages, 1 extra module package, 2 extra module pa= ckage. Thanks! --Sig_/fNPn3y98HyaKua_sgiUKzbX Content-Type: application/pgp-signature Content-Description: OpenPGP digital signature -----BEGIN PGP SIGNATURE----- iQEzBAEBCAAdFiEEds7GsXJ0tGXALbPZ5xo1VCwwuqUFAl515yMACgkQ5xo1VCww uqVyzgf8DywugtNJ953q6xGV7a/EEps66xaEzTxrw4RSZDn/knW3Bc/5nJwj0J5u aPsTPdErlexmoQPWVTOWiZbZ9ZIgGxtF2conv/pLyQeM9Xb2QXCVs1OIYh2RtXac 9oX1JL1K5n2SxixX5LHx1wJGpWbuLxJeZQkwbT1+sEzJhWYd5rdVujwdS8kn25Hv az7xlgAG5uQ7B0PAvQ+Rof2i6Ek0j9/9NH1mNi7QwZ17uQn/P+HFyX6Krq3Ad72l oK+GgwRUPtJ8Dm+cY5ZuB5YJ2UiO0CXCF1vbZ/BBTNvJHjWCrfQQ54cTfosPJAqN RK3E+7njDg+U+mTg+a/4U40z4R1PQA== =1Z6R -----END PGP SIGNATURE----- --Sig_/fNPn3y98HyaKua_sgiUKzbX-- From debbugs-submit-bounces@debbugs.gnu.org Sun Mar 22 08:01:33 2020 Received: (at 37868-done) by debbugs.gnu.org; 22 Mar 2020 12:01:33 +0000 Received: from localhost ([127.0.0.1]:48685 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1jFzIK-0003D0-OI for submit@debbugs.gnu.org; Sun, 22 Mar 2020 08:01:32 -0400 Received: from dd26836.kasserver.com ([85.13.145.193]:41274) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1jFzIJ-0003B1-2A for 37868-done@debbugs.gnu.org; Sun, 22 Mar 2020 08:01:31 -0400 Received: from localhost (unknown [185.17.13.127]) by dd26836.kasserver.com (Postfix) with ESMTPSA id A2E7A336803C for <37868-done@debbugs.gnu.org>; Sun, 22 Mar 2020 13:01:29 +0100 (CET) Date: Sun, 22 Mar 2020 13:01:27 +0100 From: Danny Milosavljevic To: 37868-done@debbugs.gnu.org Subject: Re: [PATCH v10] system: Add kernel-loadable-modules to operating-system. Message-ID: <20200322130127.2abc0497@scratchpost.org> In-Reply-To: <20200319142219.2618-1-dannym@scratchpost.org> References: <20200319142219.2618-1-dannym@scratchpost.org> X-Mailer: Claws Mail 3.17.5 (GTK+ 2.24.32; x86_64-unknown-linux-gnu) MIME-Version: 1.0 Content-Type: multipart/signed; boundary="Sig_/a/.w2L/+snN.idjsej_4yZC"; protocol="application/pgp-signature"; micalg=pgp-sha256 X-Spam-Score: -0.7 (/) X-Debbugs-Envelope-To: 37868-done X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -1.7 (-) --Sig_/a/.w2L/+snN.idjsej_4yZC Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: quoted-printable Pushed a variant of this to guix master as commit 5c79f238634c5adb6657f1b4b1bb4ddb8bb73ef1. Changes: * linux-module-database: Use kmod directly via (gnu packages linux) and not via the manifest. --Sig_/a/.w2L/+snN.idjsej_4yZC Content-Type: application/pgp-signature Content-Description: OpenPGP digital signature -----BEGIN PGP SIGNATURE----- iQEzBAEBCAAdFiEEds7GsXJ0tGXALbPZ5xo1VCwwuqUFAl53U5cACgkQ5xo1VCww uqVHkAf/VkdNXMfC9QNwJ5WtM3UzbMHPXucGkSLDJDFmyrm5vnjOFJZDfMA6KAb3 4ubkZ2/QmiNMoIwsiIxuVBao9haVNGO3OOceXRLSyrtAMldBvWZ84FdDs29uDokr y80FkFNu3Cqj1Q64t+5ZI4ZJ3TJOGc8C+bRa34IhvbIy5rscySvRWvZT+xlCapQp zmgHaCFN9P+bRM0P6DZYfHmSVmr1sP8VpxgpeKp6bbnIrcoSsYtA8iFJLVhg4T0R kfZ0HmAViPtruXNbsb8cFpGG9yzvHusi433ill120cvWdzpfaMkWdRRSktDlG+pM tFtlq6xYNFbvBqDJ7lw5PToCzZ+cUA== =X+TM -----END PGP SIGNATURE----- --Sig_/a/.w2L/+snN.idjsej_4yZC-- From debbugs-submit-bounces@debbugs.gnu.org Sun Mar 22 09:36:26 2020 Received: (at 37868) by debbugs.gnu.org; 22 Mar 2020 13:36:26 +0000 Received: from localhost ([127.0.0.1]:48709 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1jG0mA-0006ke-IA for submit@debbugs.gnu.org; Sun, 22 Mar 2020 09:36:26 -0400 Received: from dd26836.kasserver.com ([85.13.145.193]:49092) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1jG0m8-0006kT-NA for 37868@debbugs.gnu.org; Sun, 22 Mar 2020 09:36:25 -0400 Received: from localhost (unknown [185.17.13.127]) by dd26836.kasserver.com (Postfix) with ESMTPSA id D153B3367EC9; Sun, 22 Mar 2020 14:36:22 +0100 (CET) Date: Sun, 22 Mar 2020 14:36:17 +0100 From: Danny Milosavljevic To: Mathieu Othacehe Subject: Re: [bug#37868] [PATCH v8] system: Add kernel-module-packages to operating-system. Message-ID: <20200322143617.7b57d08f@scratchpost.org> In-Reply-To: <87fte3jbzj.fsf@gmail.com> References: <20200227135146.5701-1-dannym@scratchpost.org> <20200227155029.2542-1-dannym@scratchpost.org> <20200314194055.6d857037@scratchpost.org> <877dzlgbe2.fsf@gmail.com> <20200315191736.33ed8abf@scratchpost.org> <87y2s0ei8i.fsf@gmail.com> <20200316211052.5d4e29a2@scratchpost.org> <87v9n1d8ez.fsf@gmail.com> <20200320111938.4472f145@scratchpost.org> <87fte3jbzj.fsf@gmail.com> X-Mailer: Claws Mail 3.17.5 (GTK+ 2.24.32; x86_64-unknown-linux-gnu) MIME-Version: 1.0 Content-Type: multipart/signed; boundary="Sig_/XYxWCm49SVI6MzZ2GB5ZCBM"; protocol="application/pgp-signature"; micalg=pgp-sha256 X-Spam-Score: -0.7 (/) X-Debbugs-Envelope-To: 37868 Cc: mhw@netris.org, ludo@gnu.org, 37868@debbugs.gnu.org X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -1.7 (-) --Sig_/XYxWCm49SVI6MzZ2GB5ZCBM Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: quoted-printable Hi, I've verified that the non-cross linux module builder still works. So I've pushed a variant of your patch (with adjusted commit message) and also v10 of the guix kernel module patch to guix master. Thanks! --Sig_/XYxWCm49SVI6MzZ2GB5ZCBM Content-Type: application/pgp-signature Content-Description: OpenPGP digital signature -----BEGIN PGP SIGNATURE----- iQEzBAEBCAAdFiEEds7GsXJ0tGXALbPZ5xo1VCwwuqUFAl53adEACgkQ5xo1VCww uqVfAgf+OWQGcXYuYc6VRmCg3eBVyqyIfgDi1aHcpNpSqb1zdlHo1pIigz8Zg//C zhUvN+RktfnDpJCOg2Do3uNDbR2/+jGjz84uozRNAeYjDvxc2u+1DVmKzSTesBCS QBPkGVLCQ/m3/pdRXTyr6XEw/YxToo0cw7SyoAx7fMJtBKx+xUK5OFBx1fGuYZML A/KqsI4jKwSGP26FrcpqBjnZ+OZFejC6fFpyWfQHDij3p0mNaysRQZ6T6yFL/yr4 MFZRjyhZx8g1GT1FHYHxWAHk7fb4Tx68/1UQkuSxl5tQpGSk0c3DW4ufPaiDLDIF Ob/TK2mI7ZiJeUsKVCr9IkQ58WZ/lA== =nCOa -----END PGP SIGNATURE----- --Sig_/XYxWCm49SVI6MzZ2GB5ZCBM-- From debbugs-submit-bounces@debbugs.gnu.org Sun Mar 22 17:12:03 2020 Received: (at 37868) by debbugs.gnu.org; 22 Mar 2020 21:12:03 +0000 Received: from localhost ([127.0.0.1]:51047 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1jG7t5-0006FS-8s for submit@debbugs.gnu.org; Sun, 22 Mar 2020 17:12:03 -0400 Received: from eggs.gnu.org ([209.51.188.92]:55195) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1jG7t4-0006Ev-Cp for 37868@debbugs.gnu.org; Sun, 22 Mar 2020 17:12:02 -0400 Received: from fencepost.gnu.org ([2001:470:142:3::e]:40517) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1jG7sx-0007mc-Hz; Sun, 22 Mar 2020 17:11:56 -0400 Received: from [2a01:e0a:1d:7270:af76:b9b:ca24:c465] (port=38646 helo=ribbon) by fencepost.gnu.org with esmtpsa (TLS1.2:RSA_AES_256_CBC_SHA1:256) (Exim 4.82) (envelope-from ) id 1jG7sw-0007Ey-VY; Sun, 22 Mar 2020 17:11:55 -0400 From: =?utf-8?Q?Ludovic_Court=C3=A8s?= To: Danny Milosavljevic Subject: Re: [bug#37868] [PATCH v8] system: Add kernel-module-packages to operating-system. References: <20200227135146.5701-1-dannym@scratchpost.org> <20200227155029.2542-1-dannym@scratchpost.org> <20200314194055.6d857037@scratchpost.org> <877dzlgbe2.fsf@gmail.com> <20200315191736.33ed8abf@scratchpost.org> <87y2s0ei8i.fsf@gmail.com> <20200316211052.5d4e29a2@scratchpost.org> <87v9n1d8ez.fsf@gmail.com> <20200320111938.4472f145@scratchpost.org> <87fte3jbzj.fsf@gmail.com> <20200322143617.7b57d08f@scratchpost.org> X-URL: http://www.fdn.fr/~lcourtes/ X-Revolutionary-Date: 3 Germinal an 228 de la =?utf-8?Q?R=C3=A9volution?= X-PGP-Key-ID: 0x090B11993D9AEBB5 X-PGP-Key: http://www.fdn.fr/~lcourtes/ludovic.asc X-PGP-Fingerprint: 3CE4 6455 8A84 FDC6 9DB4 0CFB 090B 1199 3D9A EBB5 X-OS: x86_64-pc-linux-gnu Date: Sun, 22 Mar 2020 22:11:51 +0100 In-Reply-To: <20200322143617.7b57d08f@scratchpost.org> (Danny Milosavljevic's message of "Sun, 22 Mar 2020 14:36:17 +0100") Message-ID: <871rpkt7qg.fsf@gnu.org> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/26.3 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Spam-Score: -0.7 (/) X-Debbugs-Envelope-To: 37868 Cc: mhw@netris.org, Mathieu Othacehe , 37868@debbugs.gnu.org X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -1.7 (-) Hi, Danny Milosavljevic skribis: > I've verified that the non-cross linux module builder still works. > > So I've pushed a variant of your patch (with adjusted commit message) and > also v10 of the guix kernel module patch to guix master. Awesome, thank you! Ludo=E2=80=99. From unknown Tue Jun 17 20:21:49 2025 Received: (at fakecontrol) by fakecontrolmessage; To: internal_control@debbugs.gnu.org From: Debbugs Internal Request Subject: Internal Control Message-Id: bug archived. Date: Mon, 20 Apr 2020 11:24:08 +0000 User-Agent: Fakemail v42.6.9 # This is a fake control message. # # The action: # bug archived. thanks # This fakemail brought to you by your local debbugs # administrator