Gentoo Forums
Gentoo Forums
Gentoo Forums
Quick Search: in
Necessary and unnecessary modules for the kernel
View unanswered posts
View posts from last 24 hours

 
Reply to topic    Gentoo Forums Forum Index Kernel & Hardware
View previous topic :: View next topic  
Author Message
faeb5
n00b
n00b


Joined: 16 Jan 2022
Posts: 3

PostPosted: Sun Jan 16, 2022 6:40 pm    Post subject: Necessary and unnecessary modules for the kernel Reply with quote

Hi! First of all, big Gentoo fan! Built my very first customized kernel for a Desktop PC and it really was great experience.

However, I have a question regarding modules. How excactly do you determine what modules you should include (whether directly or as a module) in a custom kernel?

My laptop is currently running a Gentoo distribution kernel (the binary version). Before building a custom kernel I ran `lsmod` to see what modules are loaded, but there are a ton of them. Are they all necessary? Is every loaded module currently needed by some device or does the Gentoo distribution kernel load modules that are currently unsed but might be in the future?

I'm not afraid of leaving out modules, for example I don't plan on using bluetooth so I skip the bluetooh driver/module for my custom kernel, but I"m really unsure about the low-level stuff like I2C. How can you determine if this stuff is needed or not? Is it simply a matter of "if the machine runs and works then it's fine'?
Back to top
View user's profile Send private message
eccerr0r
Watchman
Watchman


Joined: 01 Jul 2004
Posts: 9679
Location: almost Mile High in the USA

PostPosted: Sun Jan 16, 2022 6:49 pm    Post subject: Reply with quote

Welcome to Gentoo and here starts the endless rabbit hole of install possibilities! But you knew that!

The main thing to consider is the difference between "runs" versus "runs with all the bells and whistles" like knowing your gpu temperatures and power supply voltages - you don't absolutely *need* them but it could make your life better...
_________________
Intel Core i7 2700K/Radeon R7 250/24GB DDR3/256GB SSD
What am I supposed watching?
Back to top
View user's profile Send private message
faeb5
n00b
n00b


Joined: 16 Jan 2022
Posts: 3

PostPosted: Sun Jan 16, 2022 7:02 pm    Post subject: Reply with quote

Your point makes sense. I certainly don't need everything in there, but it's good to have thermals and indicators especially for the laptop. I'm mostly concerned about accidently leaving our power-saving features that decrease battery runtime on the laptop.

I guess the best option is to go through each and every module and read up on what it does?
Back to top
View user's profile Send private message
Jaglover
Watchman
Watchman


Joined: 29 May 2005
Posts: 8291
Location: Saint Amant, Acadiana

PostPosted: Sun Jan 16, 2022 7:08 pm    Post subject: Reply with quote

Not everything is configured as a module in default configuration. There are many options in kernel you may not need. This is not for faint of heart, but you can start with 'make allnoconfig' and start enabling options and features you need. Instead of taking a big kernel and removing options.
_________________
My Gentoo installation notes.
Please learn how to denote units correctly!
Back to top
View user's profile Send private message
eccerr0r
Watchman
Watchman


Joined: 01 Jul 2004
Posts: 9679
Location: almost Mile High in the USA

PostPosted: Sun Jan 16, 2022 7:17 pm    Post subject: Reply with quote

Yes power saving features is also something that's not "world ending" (at least right away, like a missing disk, network, video, or keyboard driver) alas yes these nonfatal if missing drivers, you'll have to either know or go ahead and compile everything, they tend to automatically load when needed.

The unfortunate thing is that some of the power saving features could be controlled by i2c/smbus so leaving these things out will leave things on the table.
_________________
Intel Core i7 2700K/Radeon R7 250/24GB DDR3/256GB SSD
What am I supposed watching?


Last edited by eccerr0r on Sun Jan 16, 2022 7:19 pm; edited 1 time in total
Back to top
View user's profile Send private message
pietinger
Moderator
Moderator


Joined: 17 Oct 2006
Posts: 4148
Location: Bavaria

PostPosted: Sun Jan 16, 2022 7:18 pm    Post subject: Re: Necessary and unnecessary modules for the kernel Reply with quote

Hello faeb5,

welcome to Gentoo Forums !

faeb5 wrote:
Is it simply a matter of "if the machine runs and works then it's fine'?


Mostly - with few exceptions. Yes there are some modules I have not included because I dont need it; e.g.: Intel MEI (Management Engine Interface), Intel RAPL, I2C and even LPC (Low Pin Count). Also I dont have any modules for IPv6 (I dont want/use it; data privacy reasons), initramfs and a serial and a parallel interface (I also dont have).

My system have a SSD and a HD, no extra graphics adapter (taking GPU of Intel i7), no Blutooth, no WLAN, no WebCam. Take a look to my used modules:
Code:
# lspci -k
00:00.0 Host bridge: Intel Corporation Xeon E3-1200 v5/E3-1500 v5/6th Gen Core Processor Host Bridge/DRAM Registers (rev 07)
        Subsystem: Gigabyte Technology Co., Ltd Xeon E3-1200 v5/E3-1500 v5/6th Gen Core Processor Host Bridge/DRAM Registers
00:02.0 VGA compatible controller: Intel Corporation HD Graphics 530 (rev 06)
        DeviceName:  Onboard IGD
        Subsystem: Gigabyte Technology Co., Ltd HD Graphics 530
        Kernel driver in use: i915
00:08.0 System peripheral: Intel Corporation Xeon E3-1200 v5/v6 / E3-1500 v5 / 6th/7th/8th Gen Core Processor Gaussian Mixture Model
        Subsystem: Gigabyte Technology Co., Ltd Xeon E3-1200 v5/v6 / E3-1500 v5 / 6th/7th/8th Gen Core Processor Gaussian Mixture Model
00:14.0 USB controller: Intel Corporation 200 Series/Z370 Chipset Family USB 3.0 xHCI Controller
        Subsystem: Gigabyte Technology Co., Ltd 200 Series/Z370 Chipset Family USB 3.0 xHCI Controller
        Kernel driver in use: xhci_hcd
00:16.0 Communication controller: Intel Corporation 200 Series PCH CSME HECI #1
        Subsystem: Gigabyte Technology Co., Ltd 200 Series PCH CSME HECI
00:17.0 SATA controller: Intel Corporation 200 Series PCH SATA controller [AHCI mode]
        Subsystem: Gigabyte Technology Co., Ltd 200 Series PCH SATA controller [AHCI mode]
        Kernel driver in use: ahci
00:1b.0 PCI bridge: Intel Corporation 200 Series PCH PCI Express Root Port #17 (rev f0)
        Kernel driver in use: pcieport
00:1b.2 PCI bridge: Intel Corporation 200 Series PCH PCI Express Root Port #19 (rev f0)
        Kernel driver in use: pcieport
00:1b.4 PCI bridge: Intel Corporation 200 Series PCH PCI Express Root Port #21 (rev f0)
        Kernel driver in use: pcieport
00:1c.0 PCI bridge: Intel Corporation 200 Series PCH PCI Express Root Port #1 (rev f0)
        Kernel driver in use: pcieport
00:1c.2 PCI bridge: Intel Corporation 200 Series PCH PCI Express Root Port #3 (rev f0)
        Kernel driver in use: pcieport
00:1c.4 PCI bridge: Intel Corporation 200 Series PCH PCI Express Root Port #5 (rev f0)
        Kernel driver in use: pcieport
00:1d.0 PCI bridge: Intel Corporation 200 Series PCH PCI Express Root Port #9 (rev f0)
        Kernel driver in use: pcieport
00:1f.0 ISA bridge: Intel Corporation 200 Series PCH LPC Controller (Z270)
        Subsystem: Gigabyte Technology Co., Ltd 200 Series PCH LPC Controller (Z270)
00:1f.2 Memory controller: Intel Corporation 200 Series/Z370 Chipset Family Power Management Controller
        Subsystem: Gigabyte Technology Co., Ltd 200 Series/Z370 Chipset Family Power Management Controller
00:1f.3 Audio device: Intel Corporation 200 Series PCH HD Audio
        Subsystem: Gigabyte Technology Co., Ltd 200 Series PCH HD Audio
        Kernel driver in use: snd_hda_intel
00:1f.4 SMBus: Intel Corporation 200 Series/Z370 Chipset Family SMBus Controller
        Subsystem: Gigabyte Technology Co., Ltd 200 Series/Z370 Chipset Family SMBus Controller
        Kernel driver in use: i801_smbus
04:00.0 USB controller: ASMedia Technology Inc. ASM2142 USB 3.1 Host Controller
        Subsystem: Gigabyte Technology Co., Ltd ASM2142 USB 3.1 Host Controller
        Kernel driver in use: xhci_hcd
05:00.0 Ethernet controller: Qualcomm Atheros Killer E2500 Gigabit Ethernet Controller (rev 10)
        Subsystem: Gigabyte Technology Co., Ltd Killer E2500 Gigabit Ethernet Controller
        Kernel driver in use: alx


But there are also some settings which affects performance and security (I prioritize security over performance). Here you have decide by yourself what you want. Maybe some links will help you:

- https://kernsec.org/wiki/index.php/Kernel_Self_Protection_Project/Recommended_Settings
- https://wiki.gentoo.org/wiki/Power_management/Guide (for a desktop I recommend: "performance governor")
- https://wiki.gentoo.org/wiki/System_time (I let my kernel sync the system clock)

I have in my kernel also all needed modules for a firewall (netfilter modules), AppAprmor, IMA and encryption (dmcrypt).

Hint: If something is missing in your kernel you will notice it at once (because something doesnt work); if you have modules in your kernel you will never use, you will notice it never => Configure as less as possible for the beginning !
Back to top
View user's profile Send private message
pietinger
Moderator
Moderator


Joined: 17 Oct 2006
Posts: 4148
Location: Bavaria

PostPosted: Sun Jan 16, 2022 7:28 pm    Post subject: Reply with quote

Jaglover wrote:
[...] but you can start with 'make allnoconfig' [...]

I dont recommend this hard way ...

Start with the default config from your sources with "make menuconfig" and work through your "lspci -k" and "lsmod"-queries you did after booting with your gentoo minimal CD. Additionaly read the chapter "kernel configuration" from these articles and check it with present settings:

https://wiki.gentoo.org/wiki/Handbook:AMD64/Installation/Kernel
https://wiki.gentoo.org/wiki/HDD
https://wiki.gentoo.org/wiki/NVMe
https://wiki.gentoo.org/wiki/Intel
- or -
https://wiki.gentoo.org/wiki/Nouveau
- or -
https://wiki.gentoo.org/wiki/AMDGPU
https://wiki.gentoo.org/wiki/Intel_microcode
- or -
https://wiki.gentoo.org/wiki/AMD_microcode
https://wiki.gentoo.org/wiki/Libinput
https://wiki.gentoo.org/wiki/USB/Guide
https://wiki.gentoo.org/wiki/ALSA
Optional: https://wiki.gentoo.org/wiki/CDROM

Introduction in kernel configurations:
https://wiki.gentoo.org/wiki/Kernel/Gentoo_Kernel_Configuration_Guide
https://wiki.gentoo.org/wiki/Kernel/Configuration

For blutooth or WLAN or whatever search in the Gentoo Wiki.

Have fun !
Back to top
View user's profile Send private message
Jaglover
Watchman
Watchman


Joined: 29 May 2005
Posts: 8291
Location: Saint Amant, Acadiana

PostPosted: Sun Jan 16, 2022 7:58 pm    Post subject: Reply with quote

pietinger wrote:
Jaglover wrote:
[...] but you can start with 'make allnoconfig' [...]

I dont recommend this hard way ...


faeb5,

you make your own choices, don't listen to pietinger. He has a habit to evaluate everything from his own point of view without recognizing people are different. What is hard for him may be fun for someone else. In particular a moderator should not push his opinions.
_________________
My Gentoo installation notes.
Please learn how to denote units correctly!
Back to top
View user's profile Send private message
NeddySeagoon
Administrator
Administrator


Joined: 05 Jul 2003
Posts: 54234
Location: 56N 3W

PostPosted: Sun Jan 16, 2022 8:42 pm    Post subject: Reply with quote

faeb5,

The method that I like is still valid but the detail has changed since I posted that.
The kernel has got a lot bigger, so you need more coffee.

pappy_mcfae expanded that in his kernel seeds site.
Its the same method with a worked example based on what is now an old kernel.

-- edit --

The default kernel configuration is not useful to anyone, so if you start with all on, all off, or something in between, you still have to read all the help and make up you own mind if you need an option or not.
_________________
Regards,

NeddySeagoon

Computer users fall into two groups:-
those that do backups
those that have never had a hard drive fail.
Back to top
View user's profile Send private message
pietinger
Moderator
Moderator


Joined: 17 Oct 2006
Posts: 4148
Location: Bavaria

PostPosted: Sun Jan 16, 2022 8:54 pm    Post subject: Reply with quote

Jaglover wrote:
[...] don't listen to pietinger. [...]

I would never say something the other way around to anyone here.

My short answer you will find here: https://forums.gentoo.org/viewtopic-p-8688699.html#8688699
Back to top
View user's profile Send private message
faeb5
n00b
n00b


Joined: 16 Jan 2022
Posts: 3

PostPosted: Mon Jan 17, 2022 5:25 am    Post subject: Reply with quote

Thanks for the infos! I sure have a lot of reading to do! Looking forward to getting more basic knowledge about the different kernel stuff.

I'll guess that for my laptop I will try and include the stuff I think I'll definitely need on a daily or weekly basis and if I find out that I haven't used feature X for some time I'll think about kicking it out. My desktop kernel is a monolithic one but I'm beginning to like the idea of modules because it keeps the kernel lean without sacrificing the ability to load features when you need them.

Btw, I'm actually glad that I started to using Gentoo in 2021 because re-compiling kernels with 8 or 12 core CPUs is way more fun that it would have been may years back. :D
Back to top
View user's profile Send private message
eccerr0r
Watchman
Watchman


Joined: 01 Jul 2004
Posts: 9679
Location: almost Mile High in the USA

PostPosted: Mon Jan 17, 2022 8:16 am    Post subject: Reply with quote

faeb5 wrote:
Btw, I'm actually glad that I started to using Gentoo in 2021 because re-compiling kernels with 8 or 12 core CPUs is way more fun that it would have been may years back. :D

I don't think it really matters. My fastest kernel compile was 2 minutes, and that was back when I was using my dual celeron 450 (unfortunately this was prior to when I got into Gentoo).

I have not had a faster compile since then... Gcc just gets fatter and fatter, kernel gets fatter and fatter, computer gets faster but not that much as gcc/kernel have gotten fatter and fatter.
_________________
Intel Core i7 2700K/Radeon R7 250/24GB DDR3/256GB SSD
What am I supposed watching?
Back to top
View user's profile Send private message
Leonardo.b
Apprentice
Apprentice


Joined: 10 Oct 2020
Posts: 294

PostPosted: Mon Jan 17, 2022 2:02 pm    Post subject: Reply with quote

https://bellard.org/tcc/tccboot_readme.html
Back to top
View user's profile Send private message
Display posts from previous:   
Reply to topic    Gentoo Forums Forum Index Kernel & Hardware All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum