From mboxrd@z Thu Jan 1 00:00:00 1970 From: =?utf-8?Q?Ludovic_Court=C3=A8s?= Subject: Re: Loading modules built using linux-module-build-system Date: Tue, 22 Oct 2019 14:24:51 +0200 Message-ID: <87k18x3r3g.fsf@gnu.org> References: <877e8snntp.fsf@jlicht.xyz> <20191021202733.3c340770@scratchpost.org> <20191021204857.5dff6e9b@scratchpost.org> <20191021233925.0ba18a4c@scratchpost.org> Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable Return-path: Received: from eggs.gnu.org ([2001:470:142:3::10]:52309) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1iMtDb-0006yb-Gz for guix-devel@gnu.org; Tue, 22 Oct 2019 08:24:56 -0400 In-Reply-To: <20191021233925.0ba18a4c@scratchpost.org> (Danny Milosavljevic's message of "Mon, 21 Oct 2019 23:39:25 +0200") List-Id: "Development of GNU Guix and the GNU System distribution." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: guix-devel-bounces+gcggd-guix-devel=m.gmane.org@gnu.org Sender: "Guix-devel" To: Danny Milosavljevic Cc: guix-devel@gnu.org Hi Danny, Danny Milosavljevic skribis: > A patch to guix master which > > * Puts the kernel modules (including any other packages that have "lib/mo= dules" > inside their derivation) into /run/booted-system/profile/lib/modules > * Ensures that depmod is invoked on that > * Makes the modprobe wrapper use it > > is provided below. Nice! I=E2=80=99m wondering if we could avoid clobbering the global profile with = the kernel and module packages, though (as is currently the case.) > --- a/gnu/system.scm > +++ b/gnu/system.scm > @@ -887,9 +887,11 @@ 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)) > - (profile (fold-services services > - #:target-type profile-service-type))) > + ((kernel -> (operating-system-kernel os)) > + (services -> (operating-system-services os)) > + (profile (cons kernel (fold-services services > + #:target-type > + profile-service-type)))) > (match profile > (("profile" profile) > (return profile))))) The value of =E2=80=98profile=E2=80=99 above can never match this pattern, = or am I missing something? > +(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-26) > + (guix build utils) > + (guix build union) > + (ice-9 match)) > + (let ((destdir (string-append #$output "/lib/modules")) > + (dirs (filter file-exists? > + (map (cut string-append <> > + "/lib/modules") > + '#$(manifest-inputs manifest)))) > + (System.maps (filter file-exists? > + (map (cut string-append <> "/System.map") > + '#$(manifest-inputs manifest)))) > + (Module.symvers (filter file-exists? > + (map (cut string-append <> "/Module.symver= s") > + '#$(manifest-inputs manifest))))) > + (mkdir-p (string-append #$output "/lib")) > + (union-build destdir dirs #:create-all-directories? #t) > + (exit (zero? (system* (string-append #$kmod "/bin/depmod") > + "-e" ; Report symbols that aren't supplied > + "-w" ; Warn on duplicates > + "-b" destdir > + "-F" (match System.maps ((x) x)) > + "-E" (match Module.symvers ((x) x))))))))) > + (gexp->derivation "linux-module-database" build > + #:local-build? #t > + #:substitutable? #f > + #:properties > + `((type . profile-hook) > + (hook . linux-module-database))))) Note that this fails if =E2=80=98kmod=E2=80=99 is no in the profile. Besides, I wonder how much is missing from (gnu build linux-modules) to do this without resorting to kmod. :-) > (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 +1463,8 @@ MANIFEST." > gtk-im-modules > texlive-configuration > xdg-desktop-database > - xdg-mime-database)) > + xdg-mime-database > + linux-module-database)) Maybe we should not add this hook by default, to avoid overhead for a very unusual use case. The caller of =E2=80=98profile-derivation=E2=80=99 = could add it when needed. Thinking more about it, what about handling the union/profile thing in =E2=80=98operating-system-directory-base-entries=E2=80=99? We could still = use =E2=80=98profile-derivation=E2=80=99 with the hook you wrote, but we=E2=80= =99d be able to keep that here instead of adding it to (guix profiles). Also, if we take that route, we would probably need a =E2=80=98linux-module-packages=E2=80=99 field in . WDYT? Thanks, Ludo=E2=80=99.