linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* Pass modules to Linux kernel without initrd
@ 2020-12-08  9:24 Paul Menzel
  2020-12-08  9:38 ` Enrico Weigelt, metux IT consult
                   ` (2 more replies)
  0 siblings, 3 replies; 6+ messages in thread
From: Paul Menzel @ 2020-12-08  9:24 UTC (permalink / raw)
  To: LKML; +Cc: Luis Chamberlain, Hans de Goede, Ben Hutchings

Dear Linux folks,


Trying to reduce the boot time of standard distributions, I would like 
to get rid of the initrd. The initrd is for mounting the root file 
system and on most end user systems with standard distributions that 
means loading the bus driver for the drive and the file system driver. 
Everyone could build their own Linux kernel and build the drivers into 
the Linux kernel, but most users enjoy using the distribution Linux 
kernel, which build the drivers as modules to support a lot of systems. 
(I think Fedora builds the default file system driver (of the installer) 
into the Linux kernel.)

A custom minimal initrd init script only loading the modules would also 
work, but as libkmod depends on libcrypto, which as a shared library is 
already three megabytes in size. Building libkmod statically would mean 
for distributions, that you need hooks to rebuild libkmod each time 
OpenSSL is updated (to get the changes).

Similar to passing firmware and microcode update files to Linux or 
building these into the Linux kernel image, would it be possible to 
append the required modules to the Linux kernel image, and Linux would 
load these?

Probably you are going to say, that is not how it works, but maybe I am 
lucky and you know a solution, or could point me to the right direction 
how such a think could be implemented.


Kind regards,

Paul

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: Pass modules to Linux kernel without initrd
  2020-12-08  9:24 Pass modules to Linux kernel without initrd Paul Menzel
@ 2020-12-08  9:38 ` Enrico Weigelt, metux IT consult
  2020-12-08 10:58   ` Paul Menzel
  2020-12-08 18:10 ` Ben Hutchings
  2020-12-08 18:53 ` Theodore Y. Ts'o
  2 siblings, 1 reply; 6+ messages in thread
From: Enrico Weigelt, metux IT consult @ 2020-12-08  9:38 UTC (permalink / raw)
  To: Paul Menzel, LKML; +Cc: Luis Chamberlain, Hans de Goede, Ben Hutchings

On 08.12.20 10:24, Paul Menzel wrote:

> Similar to passing firmware and microcode update files to Linux or
> building these into the Linux kernel image, would it be possible to
> append the required modules to the Linux kernel image, and Linux would
> load these?

Indeed, yes it does. Just set the corresponding CONFIG_ symbols to 'y'
instead of 'm'. If you don't need to dynamically load any modules
(already have everything you need compiled-in), you can completely
disable module support via disabling CONFIG_MODULES.

For embedded systems, this is quite common. I'm also using it for
trimmed down virtualized workloads that don't ever need to dynamically
load modules.

--mtx

-- 
---
Hinweis: unverschlüsselte E-Mails können leicht abgehört und manipuliert
werden ! Für eine vertrauliche Kommunikation senden Sie bitte ihren
GPG/PGP-Schlüssel zu.
---
Enrico Weigelt, metux IT consult
Free software and Linux embedded engineering
info@metux.net -- +49-151-27565287

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: Pass modules to Linux kernel without initrd
  2020-12-08  9:38 ` Enrico Weigelt, metux IT consult
@ 2020-12-08 10:58   ` Paul Menzel
  2020-12-08 13:19     ` Enrico Weigelt, metux IT consult
  0 siblings, 1 reply; 6+ messages in thread
From: Paul Menzel @ 2020-12-08 10:58 UTC (permalink / raw)
  To: Enrico Weigelt, metux IT consult, LKML
  Cc: Luis Chamberlain, Hans de Goede, Ben Hutchings

Dear Enrico,


Am 08.12.20 um 10:38 schrieb Enrico Weigelt, metux IT consult:
> On 08.12.20 10:24, Paul Menzel wrote:
> 
>> Similar to passing firmware and microcode update files to Linux or
>> building these into the Linux kernel image, would it be possible to
>> append the required modules to the Linux kernel image, and Linux would
>> load these?
> 
> Indeed, yes it does. Just set the corresponding CONFIG_ symbols to 'y'
> instead of 'm'. If you don't need to dynamically load any modules
> (already have everything you need compiled-in), you can completely
> disable module support via disabling CONFIG_MODULES.

[…]

Thank you. I know this and do it myself. But, the requirement is to use 
the distribution Linux kernel (package). I am sorry for being unclear.


Kind regards,

Paul

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: Pass modules to Linux kernel without initrd
  2020-12-08 10:58   ` Paul Menzel
@ 2020-12-08 13:19     ` Enrico Weigelt, metux IT consult
  0 siblings, 0 replies; 6+ messages in thread
From: Enrico Weigelt, metux IT consult @ 2020-12-08 13:19 UTC (permalink / raw)
  To: Paul Menzel, LKML; +Cc: Luis Chamberlain, Hans de Goede, Ben Hutchings

On 08.12.20 11:58, Paul Menzel wrote:

> Thank you. I know this and do it myself. But, the requirement is to use
> the distribution Linux kernel (package). I am sorry for being unclear.

What about rebuilding the distro package ?

Actually, I wonder why using a generic (bloated) full-blown distro
when resources are that scarce.


--mtx

-- 
---
Hinweis: unverschlüsselte E-Mails können leicht abgehört und manipuliert
werden ! Für eine vertrauliche Kommunikation senden Sie bitte ihren
GPG/PGP-Schlüssel zu.
---
Enrico Weigelt, metux IT consult
Free software and Linux embedded engineering
info@metux.net -- +49-151-27565287

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: Pass modules to Linux kernel without initrd
  2020-12-08  9:24 Pass modules to Linux kernel without initrd Paul Menzel
  2020-12-08  9:38 ` Enrico Weigelt, metux IT consult
@ 2020-12-08 18:10 ` Ben Hutchings
  2020-12-08 18:53 ` Theodore Y. Ts'o
  2 siblings, 0 replies; 6+ messages in thread
From: Ben Hutchings @ 2020-12-08 18:10 UTC (permalink / raw)
  To: Paul Menzel, LKML; +Cc: Luis Chamberlain, Hans de Goede

[-- Attachment #1: Type: text/plain, Size: 887 bytes --]

On Tue, 2020-12-08 at 10:24 +0100, Paul Menzel wrote:
Dear Linux folks,


Trying to reduce the boot time of standard distributions, I would like 
to get rid of the initrd. The initrd is for mounting the root file 
system and on most end user systems with standard distributions that 
means loading the bus driver for the drive and the file system driver.
[...]

I would expect most end user systems to use at least one of LVM and
cryptsetup, which need user-space to configure them.

Debian has the "tiny-initramfs" package that covers the simple cases
you're targetting, and can be used instead of initramfs-tools or
dracut.  The upstream of that is:
<https://github.com/chris-se/tiny-initramfs/>.

But I don't anticipate that we would change the default initramfs
builder any time soon.

Ben.

-- 
Ben Hutchings
The world is coming to an end.	Please log off.

[-- Attachment #2: This is a digitally signed message part --]
[-- Type: application/pgp-signature, Size: 833 bytes --]

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: Pass modules to Linux kernel without initrd
  2020-12-08  9:24 Pass modules to Linux kernel without initrd Paul Menzel
  2020-12-08  9:38 ` Enrico Weigelt, metux IT consult
  2020-12-08 18:10 ` Ben Hutchings
@ 2020-12-08 18:53 ` Theodore Y. Ts'o
  2 siblings, 0 replies; 6+ messages in thread
From: Theodore Y. Ts'o @ 2020-12-08 18:53 UTC (permalink / raw)
  To: Paul Menzel; +Cc: LKML, Luis Chamberlain, Hans de Goede, Ben Hutchings

On Tue, Dec 08, 2020 at 10:24:08AM +0100, Paul Menzel wrote:
> Dear Linux folks,
> 
> Trying to reduce the boot time of standard distributions, I would like to
> get rid of the initrd. The initrd is for mounting the root file system and
> on most end user systems with standard distributions that means loading the
> bus driver for the drive and the file system driver. Everyone could build
> their own Linux kernel and build the drivers into the Linux kernel, but most
> users enjoy using the distribution Linux kernel, which build the drivers as
> modules to support a lot of systems. (I think Fedora builds the default file
> system driver (of the installer) into the Linux kernel.)

It's unclear what you are trying to speed up by replacing the initrd
with "appending the required modules to the Linux kernel image".  Why
do you think this will speed things up?  What do you think is
currently slow with using an initrd?

If what you are concerned about is the speed to load an initrd which
has all of the kernel modules shipped by the distribution, including
those not needed by a particular hardware platform, there are
distributions which can be configured to automatically include only
those kernel modules needed for a particular system.

There are also some shell scripts which some people have written that
will automatically create a kernel config file which only has the
device drivers needed for a particular system.  Creating a system
which used such a script, and then compiled a custom kernel image
would also not be hard.

You seem to be assuming that building a custom kernel image ish
hard(tm), and so no user would want to do this.  If this were 
automated, what is your objection to such an approach?

Without a clear understanding what part of the boot process you think
is slow, and which you are trying to optimize, and what precisely your
constraints are, or at least, what you *think* your constraints are,
and why you think things have to be that way, it's going to be hard to
comment further.

Cheers,

					- Ted

^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2020-12-08 20:26 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-12-08  9:24 Pass modules to Linux kernel without initrd Paul Menzel
2020-12-08  9:38 ` Enrico Weigelt, metux IT consult
2020-12-08 10:58   ` Paul Menzel
2020-12-08 13:19     ` Enrico Weigelt, metux IT consult
2020-12-08 18:10 ` Ben Hutchings
2020-12-08 18:53 ` Theodore Y. Ts'o

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).