Gentoo Forums
Gentoo Forums
Gentoo Forums
Quick Search: in
Modifying distribution configuration
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
user7719
n00b
n00b


Joined: 19 Feb 2021
Posts: 69

PostPosted: Fri Aug 09, 2024 3:58 pm    Post subject: Modifying distribution configuration Reply with quote

Hi,

I want to enable the following option in my kernel.

Code:
CONFIG_I8K


I've see this guide: https://wiki.gentoo.org/wiki/Project:Distribution_Kernel#Using_.2Fetc.2Fkernel.2Fconfig.d

Is it as simple as adding a file called something like: /etc/kernel/config.d/50laptop.config

which contains:

Code:
CONFIG_I8K=y


and emerging sys-kernel/gentoo-kernel??
Back to top
View user's profile Send private message
eschwartz
Developer
Developer


Joined: 29 Oct 2023
Posts: 133

PostPosted: Fri Aug 09, 2024 4:25 pm    Post subject: Reply with quote

Yes, it really and truly is that simple. :)
Back to top
View user's profile Send private message
pietinger
Moderator
Moderator


Joined: 17 Oct 2006
Posts: 4845
Location: Bavaria

PostPosted: Fri Aug 09, 2024 9:12 pm    Post subject: Reply with quote

user7719,

Enabling (or disabling) configuration options for the kernel configuration is not as easy as you think, because many options depends on other options. I strongly recommend to do:

1. emerge gentoo-sources (No, you dont must use this; it is only for checking of parameters)
2. cd into /usr/src/linux-X-Y-Z-gentoo
3. make menuconfig
4. Hit the / key
5. Search for I8K (a leading CONFIG_ is not necessary)
6. Check the output - especially lines which begins with "Selects:" and "Depends on:"
=>
I have gotten this on my machine:
Code:
Depends on: HWMON [=y] && SENSORS_DELL_SMM [=n] && PROC_FS [=y]


If you WOULD configure your kernel completely in "make menuconfig" you WOULD NOT be able to enable I8K BEFORE you enable SENSORS_DELL_SMM - you will find in:
> Device Drivers
-> Hardware Monitoring support (HWMON [=y])
-> Dell laptop SMM BIOS hwmon driver (SENSORS_DELL_SMM [=n])

So you must first enable this, and then you would be able to enable I8K:

-> Device Drivers
-> Hardware Monitoring support (HWMON [=y])
-> Dell laptop SMM BIOS hwmon driver (SENSORS_DELL_SMM [=n])
-> Legacy /proc/i8k interface of Dell laptop SMM BIOS hwmon driver (I8K [=n])

No comes the bad news: If you want configure your kernel BY EDITING the .config you MUST ensure that all dependencies are configured correctly !!

Ask why our best experts always advise never to configure the kernel by editing the .config file:
https://forums.gentoo.org/viewtopic-p-8686380.html#8686380

So: You must check your current kernel configuration IF all 3 options are enabled by default ... and IF NOT then you must alos enable the missing options ... AND NOW ... you must check if there are dependencies for these 3 missing options ... yes, this can go many rounds ... :lol:
.
_________________
https://wiki.gentoo.org/wiki/User:Pietinger
Back to top
View user's profile Send private message
user7719
n00b
n00b


Joined: 19 Feb 2021
Posts: 69

PostPosted: Sat Aug 10, 2024 8:40 pm    Post subject: Reply with quote

pietinger wrote:
user7719,

Enabling (or disabling) configuration options for the kernel configuration is not as easy as you think, because many options depends on other options. I strongly recommend to do:

1. emerge gentoo-sources (No, you dont must use this; it is only for checking of parameters)
2. cd into /usr/src/linux-X-Y-Z-gentoo
3. make menuconfig
4. Hit the / key
5. Search for I8K (a leading CONFIG_ is not necessary)
6. Check the output - especially lines which begins with "Selects:" and "Depends on:"
=>
I have gotten this on my machine:
Code:
Depends on: HWMON [=y] && SENSORS_DELL_SMM [=n] && PROC_FS [=y]


If you WOULD configure your kernel completely in "make menuconfig" you WOULD NOT be able to enable I8K BEFORE you enable SENSORS_DELL_SMM - you will find in:
> Device Drivers
-> Hardware Monitoring support (HWMON [=y])
-> Dell laptop SMM BIOS hwmon driver (SENSORS_DELL_SMM [=n])

So you must first enable this, and then you would be able to enable I8K:

-> Device Drivers
-> Hardware Monitoring support (HWMON [=y])
-> Dell laptop SMM BIOS hwmon driver (SENSORS_DELL_SMM [=n])
-> Legacy /proc/i8k interface of Dell laptop SMM BIOS hwmon driver (I8K [=n])

No comes the bad news: If you want configure your kernel BY EDITING the .config you MUST ensure that all dependencies are configured correctly !!

Ask why our best experts always advise never to configure the kernel by editing the .config file:
https://forums.gentoo.org/viewtopic-p-8686380.html#8686380

So: You must check your current kernel configuration IF all 3 options are enabled by default ... and IF NOT then you must alos enable the missing options ... AND NOW ... you must check if there are dependencies for these 3 missing options ... yes, this can go many rounds ... :lol:
.


OK sounds like it would be safest to switch to building and installing a kernel from the gentoo sources.

Where can I find the distribution kernels .config as a starting point?

I'm currently running 6.6.41-gentoo-dist but the latest gentoo sources are linux-6.6.38-gentoo. So will I have to install the 6.6.41-gentoo sources, which are currently testing, so the copied .config isn't newer that the one in the gentoo sources?
Back to top
View user's profile Send private message
pietinger
Moderator
Moderator


Joined: 17 Oct 2006
Posts: 4845
Location: Bavaria

PostPosted: Sat Aug 10, 2024 9:28 pm    Post subject: Reply with quote

user7719 wrote:
OK sounds like it would be safest to switch to building and installing a kernel from the gentoo sources.

Hmmm ... yes ... it depends ... If you want only one single change ... I dont think its worth ... but yes, the safest method is using gentoo-sources ... and having a working "backup" kernel ;-)

user7719 wrote:
Where can I find the distribution kernels .config as a starting point?

AFAIK our distribution kernel is configured with enabled CONFIG_IKCONFIG_PROC (I hope I am not wrong here), so you can easily get it with:
Code:
zcat /proc/config.gz > dist-kernel.config


user7719 wrote:
I'm currently running 6.6.41-gentoo-dist but the latest gentoo sources are linux-6.6.38-gentoo. So will I have to install the 6.6.41-gentoo sources, which are currently testing, so the copied .config isn't newer that the one in the gentoo sources?

Dont worry ... 6.6 is 6.6 ... :lol: ... You will use "make oldconfig" ... maybe you want read before:
https://wiki.gentoo.org/wiki/User:Pietinger/Tutorials/Manual_kernel_configuration

(You can also have gentoo-sources-6.6.44 if you want -> https://wiki.gentoo.org/wiki/User:Pietinger/Tutorials/Selecting_a_convenient_kernel_version#Option_3:_Choosing_the_newest_version_of_current_LTS_series )

I dont know how much you know about an initramfs ... yes, our distribution kernel uses (of course) an initramfs ... so don't be surprised if I don't use one because it's not needed for a manual installation ... unless you use LVM and/or an encrypted root partition.

(Maybe read also the first chapter of: https://wiki.gentoo.org/wiki/User:Pietinger/Tutorials/Initramfs_Overview )
_________________
https://wiki.gentoo.org/wiki/User:Pietinger
Back to top
View user's profile Send private message
sublogic
Apprentice
Apprentice


Joined: 21 Mar 2022
Posts: 265
Location: Pennsylvania, USA

PostPosted: Sat Aug 10, 2024 10:20 pm    Post subject: Reply with quote

If you start with the distribution kernel's .config as pietinger showed, you may have to change
Code:
CONFIG_MODULE_SIG_KEY="certs/signing_key.pem"
That value is special-cased in the certs/Makefile to generate a key if none exists.

(Later you're supposed to move the signing_key.pem to removable media and update MODULE_SIG_KEY, so an attacker can't sign malware modules without said removable media.)
Back to top
View user's profile Send private message
eschwartz
Developer
Developer


Joined: 29 Oct 2023
Posts: 133

PostPosted: Sun Aug 11, 2024 5:06 am    Post subject: Reply with quote

pietinger wrote:
user7719,

Enabling (or disabling) configuration options for the kernel configuration is not as easy as you think, because many options depends on other options. I strongly recommend to do:

[...]

No comes the bad news: If you want configure your kernel BY EDITING the .config you MUST ensure that all dependencies are configured correctly !!

Ask why our best experts always advise never to configure the kernel by editing the .config file:
https://forums.gentoo.org/viewtopic-p-8686380.html#8686380

So: You must check your current kernel configuration IF all 3 options are enabled by default ... and IF NOT then you must alos enable the missing options ... AND NOW ... you must check if there are dependencies for these 3 missing options ... yes, this can go many rounds ... :lol:
.



IMO this feels a bit blown out of proportion. You have to be careful when editing a .config file by hand because if you don't do anything to resolve it to a valid config, it can be totally broken... but the /etc/kernel/config.d tooling DOES in fact run a thing to generate a valid config. It uses the kernel's inbuilt tooling for merging config snippets.

This is actually the same thing that the kernel ebuilds use to merge config snippets for the gentoo base options on top of the fedora example config. Also, how gentoo overlays debug, hardened, big-endian, and secureboot snippets on top of the combination of fedora + gentoo-base.

It's perfectly safe in your snippets will be merged in, and then dependencies will be resolved and maybe your snippets can't be satisfied but at least the kernel itself will then back out those changes.

Of course, to successfully apply any given change to your kernel, you MIGHT need to also set dependent options inside that snippet, but this isn't a real challenge IMO.
Back to top
View user's profile Send private message
Zucca
Moderator
Moderator


Joined: 14 Jun 2007
Posts: 3609
Location: Rasi, Finland

PostPosted: Sun Aug 11, 2024 1:57 pm    Post subject: Reply with quote

eschwartz wrote:
IMO this feels a bit blown out of proportion. You have to be careful when editing a .config file by hand because if you don't do anything to resolve it to a valid config, it can be totally broken... but the /etc/kernel/config.d tooling DOES in fact run a thing to generate a valid config. It uses the kernel's inbuilt tooling for merging config snippets.
This was something I just assumed.
I've been using config snippets practically from day-1 when gentoo-kernel ebuilds were available*. I've encountered zero problems so far.

*) I switched to gentoo-kernel from gentoo-sources, because
  • more automated kernel updates, yay
  • I can still run make menuconfig and use diffconfig to create a config snippet

_________________
..: Zucca :..
Gentoo IRC channels reside on Libera.Chat.
--
Quote:
I am NaN! I am a man!
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