Gentoo Archives: gentoo-dev

From: Mike Pagano <mpagano@g.o>
To: gentoo-dev@l.g.o
Subject: Re: [gentoo-dev] Idea: User centric kernel configuration
Date: Fri, 12 Mar 2021 16:40:11
Message-Id: d08d7860-890b-935c-ed01-b5fb922ee366@gentoo.org
In Reply to: Re: [gentoo-dev] Idea: User centric kernel configuration by Gerion Entrup
1 On 3/12/21 11:34 AM, Gerion Entrup wrote:
2 > Am Donnerstag, 11. März 2021, 17:41:45 CET schrieb Peter Stuge:
3 >> Hi,
4 >>
5 >> Gerion Entrup wrote:
6 >>> the Linux kernel has _a lot of_ configuration options, way too many to configure them by hand.
7 >>
8 >> I actually disagree strongly with that; I think it's important to
9 >> actively decide what kernels include, and I routinely do, but of
10 >> course not everyone will. I've made sure to include a kernel build
11 >> when teaching systems administration courses and would again.
12 >>
13 >> As the kernel becomes more complex the threshold for the first
14 >> configuration also rises, but it's still completely possible to learn
15 >> what you need in order to successfully configure your own kernel.
16 >> I guess it's on the order of a weekend project given some basic
17 >> understanding of computer architecture and programming.
18 >
19 > I think, we mean two different things here. I for myself also configured
20 > my own kernel(s) for years. I also actively teach students to do so.
21 > However, I have never looked into all 18000 configuration options. I
22 > don't understand them all (by far).
23 >
24 > Actually, most of the times, I do a `make localmodconfig`, click through
25 > various subsystems and activate what I think that it is useful or sounds
26 > nice. Then, to update a kernel, I use `make oldconfig` and answer the
27 > questions as good as I can (taking the default otherwise).
28 >
29 > If my kernel is not capable to do something (for example run docker
30 > containers), I take a look in the Gentoo Wiki and "copy" the options
31 > into my own config.
32 >
33 > But for me, this is not an informed decision. Of course, I learn
34 > something in this process, maybe also more than a precompiled kernel
35 > user, but I have by far not created a minimal config or even begin
36 > to understand all subsystems and different configuration options.
37 >
38 > I'm sure that this is similar to most Gentoo users.
39 >
40 > BTW, here is a project to create a minimal config (kind of "ideal"
41 > config) based on a "golden run" [1]. However, I have not compared such
42 > a config with my own homegrown config.
43 >
44 >
45 >>> This requires a mapping between user oriented "features" and the kernel
46 >>> internal configuration options.
47 >>
48 >> So the challenge here is that the kernel is disjoint from user space,
49 >> and while the kernel API remains stable over time consumer requirements
50 >> such as "docker" or "cryptsetup" will mean different things for
51 >> different versions of particular user space software.
52 >>
53 >>
54 >>> Do you think that it is useful and feasible to combine these two mechanisms?
55 >>
56 >> AFAIK there's no generic method for formal kernel requirements in user
57 >> space packages and there's also no sanctioned method for quering
58 >> kernel capabilities. The only thing available is /proc/config if that
59 >> was enabled in the kernel build, and there are of course reasons to
60 >> leave it out, and it only applies to the particular running kernel,
61 >> e.g. useless for cross-compilation. There, it would be possible to
62 >> read the kernel configuration file if the kernel source code is
63 >> available when the userspace package is being built, but that's not
64 >> guaranteed.
65 >>
66 >> In Gentoo, linux-info.eclass provides linux_config_exists() to do all
67 >> of this, but order to become a widespread success there would have to
68 >> be one method for upstreams to maintain these requirements as part of
69 >> their packages, rather than forcing the burden on package maintainers
70 >> to repeat the same detective task in every single distribution.
71 >>
72 >> I think it would be very useful to create something generic for that,
73 >> but that's certainly no small task.
74 >>
75 >> And realistically I only see it succeeding if Linux Foundation decides
76 >> to push it onto the world.
77 >
78 > Sorry, I may have expressed this not clearly. I guess, we actually have
79 > the same opinion here. I don't want to do this mapping automatically. I
80 > don't want a "fully automatic" config or touch any (user space) ebuilds.
81 >
82 > My idea is to patch Kconfig (as part of gentoo-sources) to provide the
83 > same "features" (i.e. mappings) that are already present in the Gentoo
84 > wiki.
85 >
86 > For example this could result in this installation description for Docker
87 > (within the Wiki):
88 > "To enable kernel support for Docker, enable
89 > 'Gentoo Linux -> Support for user space programs -> Docker'"
90 >
91 > This Kconfig flag than depends on all options that are needed for proper
92 > Docker support (as already described in the Wiki) like cgroups etc..
93 >
94 > This would allow users to configure there kernels the same way as before
95 > but with some additional convenience shortcuts.
96 >
97 > Of course, this is a high maintenance burden for the kernel package
98 > maintainers. Therefore, this mechanism maybe can be automated:
99 > Grep the wiki pages for kernel config snippets and automatically
100 > condense that in a Kconfig readable configuration option.
101 >
102 >
103 >>> A possible way could be to automatically extract the kernel config
104 >>> flags from the wiki pages and map them to Kconfig options.
105 >>
106 >> At very best that will only be valid for some particular point in time,
107 >> like current CONFIG_CHECK in ebuilds using linux_config_exists() are
108 >> only valid for particular package versions. At worst it's plain wrong
109 >> because the requirements have to be reverse-engineered downstream.
110 >
111 > Of course, the already existing kernel config snippets in the Wiki are
112 > best effort. My idea is to combine these snippets directly with Kconfig.
113 >
114 >
115 > Best regards,
116 > Gerion
117 >
118 > [1] https://vamos.informatik.uni-erlangen.de/trac/undertaker/wiki/UndertakerTailor
119 >
120
121
122 Hello,
123
124 If I am reading this correctly, you are looking for something like we
125 have for systemd and openrc where you select something and we preselect
126 a bunch of required/suggested kernel configs options.
127
128 I'm happy to add this to gentoo-sources for Docker based on the
129 expertise of the gentoo developer individuals in the project.
130
131 Probably a bug to track this would be the best way for me to implement.
132
133 Or am I totally off base on your request?
134
135 Mike

Replies

Subject Author
Re: [gentoo-dev] Idea: User centric kernel configuration Gerion Entrup <gerion.entrup@×××××.de>
Re: [gentoo-dev] Idea: User centric kernel configuration Hans de Graaff <graaff@g.o>