From mboxrd@z Thu Jan 1 00:00:00 1970 From: Danny Milosavljevic Subject: Re: Kernel modules in initrd Date: Mon, 26 Feb 2018 17:26:47 +0100 Message-ID: <20180226172647.22d9e56b@scratchpost.org> References: <20180222211707.GB9758@jurong> <87eflck7ko.fsf@netris.org> <20180223020029.3babc4fa@scratchpost.org> <20180223152855.6a08f8bd@scratchpost.org> <20180223230239.GA6140@jurong> <20180225124330.2e706537@scratchpost.org> <87y3jfvkuv.fsf@gnu.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:4830:134:3::10]:57479) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1eqLcI-0006TM-TC for guix-devel@gnu.org; Mon, 26 Feb 2018 11:27:07 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1eqLcC-0007Mu-Fh for guix-devel@gnu.org; Mon, 26 Feb 2018 11:27:05 -0500 In-Reply-To: <87y3jfvkuv.fsf@gnu.org> List-Id: "Development of GNU Guix and the GNU System distribution." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: guix-devel-bounces+gcggd-guix-devel=m.gmane.org@gnu.org Sender: "Guix-devel" To: Ludovic =?ISO-8859-1?Q?Court=E8s?= Cc: guix-devel@gnu.org Hi Ludo, On Mon, 26 Feb 2018 16:20:08 +0100 ludo@gnu.org (Ludovic Court=C3=A8s) wrote: > I suppose the bits I=E2=80=99ve promised to detect necessary modules base= d on > modules.alias and /sys should be useful here? Definitely! I've posted a working patch series (v3, "Load Linux module only when suppor= ted hardware is present") of the current kmod-based autoloader to guix-patches. It's using an old-ish kmod - but otherwise it works fine. So what we would need next is something like modprobe written in guile. I think that ./gnu/build/linux-modules.scm load-linux-module* already does = that. The only part missing is to replace %modprobe-wrapper by a guile script which imports ./gnu/build/linux-modules.scm load-linux-module*, interprets some of the modprobe options and then masquerades as modprobe without invok= ing modprobe. The reason is that the kernel calls us back when it needs a module (for example when you mount something and it needs a charset converter or someth= ing). (the name of the executable invoked is configured via /proc/sys/kernel/modp= robe) This can happen quite early in the boot process - and it took me some time to get the order and also the environment variables right. We should be ab= le to reuse that for the pure Guile modprobe. After the patch we don't *manually* load any of the modules - and all the tests work. I booted my system with it - that also works. P.S. How come glibc is in the initrd? Shouldn't guile have statically link= ed it? glibc is like 50000 kiB. In that case saving 800 kiB is not really worth i= t...