Gentoo Archives: gentoo-dev

From: "Robin H. Johnson" <robbat2@g.o>
To: gentoo-dev@l.g.o
Subject: [gentoo-dev] linux-info.eclass: lacking sources, config checks and module building
Date: Sun, 30 Aug 2009 14:49:32
Message-Id: robbat2-20090830T192224-029701861Z@orbis-terrarum.net
1 Seeing the debate raised in the udev thread about checking for the
2 kernel, I'd like to propose that we revise the linux-info.eclass.
3
4 linux-info already checks a number of locations:
5 - KBUILD_OUTPUT,
6 - KERNEL_DIR, which defaults to /usr/src/linux/
7 - OUTPUT_DIR, which defaults to /lib/modules/`uname -r`/build/
8
9 It does NOT check /proc/config.gz presently. The original logic against
10 not checking /proc was that we were targeting the kernel being built,
11 but that's moot given the use of `uname -r` in OUTPUT_DIR.
12
13 Additionally, linux-info.eclass already has provisions for non-fatally
14 checking for kernel config options, by prefixing them with a tilde.
15
16 In parallel to what we actually check, we have the issue of systems that
17 may not have ANY of the above, or ANY kernel sources whatsoever.
18 The most common amongst these are:
19 - Hardened systems
20 - Virtual Machines
21
22 Proposed solution:
23 ------------------
24 We need to be able to reduce user error, so we cannot simply make it
25 trust the user by default. So I propose that we add an environment
26 variable (I'm not set on the name yet), eg:
27 EXTERNALLY_BUILT_KERNEL=1
28
29 This option will cause linux-info.eclass to consider ALL kernel option
30 checks non-fatal. That way we still get the warnings and logs, but it
31 does not stop the builds.
32
33 When is the above NOT enough?
34 -----------------------------
35 The only time that ANY kernel sources are required is when you are
36 building an out-of-tree module. For this purpose, they must be
37 configured.
38
39 The check for having configured kernel sources must only be executed
40 when the modules are about to be compiled. Putting it in pkg_preinst
41 would block use of binpkgs on (related) machines.
42
43 - If a package builds modules AND userspace, we should offer a way to
44 build the userspace only, as the user can build their modules
45 externally (or patch them into the kernel) [1]
46 - For packages that ONLY build modules, and no userspace at all, having
47 EXTERNALLY_BUILT_KERNEL=1 means that they should error out? [2]
48 (this case might be thrown into the above one).
49
50 Footnotes:
51 ----------
52 1. This has already been requested for ipset, bug #274577.
53 2. What about documentation? Is that enough of userspace still?
54
55 --
56 Robin Hugh Johnson
57 Gentoo Linux: Developer, Trustee & Infrastructure Lead
58 E-Mail : robbat2@g.o
59 GnuPG FP : 11AC BA4F 4778 E3F6 E4ED F38E B27B 944E 3488 4E85

Replies