Gentoo Archives: gentoo-dev

From: "Robin H. Johnson" <robbat2@g.o>
To: gentoo-dev@l.g.o
Subject: Re: [gentoo-dev] linux-info.eclass: lacking sources, config checks and module building
Date: Sun, 30 Aug 2009 16:20:57
Message-Id: robbat2-20090830T204430-253756533Z@orbis-terrarum.net
In Reply to: Re: [gentoo-dev] linux-info.eclass: lacking sources, config checks and module building by Mike Auty
1 On Sun, Aug 30, 2009 at 09:21:24PM +0100, Mike Auty wrote:
2 > [ "${KV_MAJOR}.${KV_MINOR}.${KV_PATCH}${KV_EXTRA}" == "$(uname -r)" ] && \
3 > OUTPUT_DIR="${OUTPUT_DIR:-/lib/modules/${KV_MAJOR}.${KV_MINOR}.${KV_PATCH}${KV_EXTRA}/build}"
4 This check is inside the get_version call, and is ultimately used to set
5 KV_OUT_DIR, which is in turn used for all the config checks.
6
7 The conditional part of the check means that it's only used if the
8 running kernel is also the one currently pointed to by the sources
9 variables (which were used further up in the function to populate KV_*).
10
11 I also realize on closer reading, that the above bit will never even be
12 reached unless the kernel sources are present.
13
14 > Otherwise it's taken from the KBUILD_DIR and then it even checks inside
15 > the KV_DIR's Makefile to find one. So not checking /proc/config.gz
16 > isn't a moot point anymore, which is not to say it's not a good idea,
17 > but the reason against doing it still stands. To deal with running
18 > kernel's, there's a get_running_version function, that will use uname to
19 > fill out the KV_* variables appropriately.
20 FYI:
21 get_running_version is used in one single ebuild, in the entire tree:
22 sys-fs/evms/evms-2.5.5-r10.ebuild
23 And there it's only for a warning.
24
25 > > Proposed solution:
26 > > ------------------
27 > > We need to be able to reduce user error, so we cannot simply make it
28 > > trust the user by default. So I propose that we add an environment
29 > > variable (I'm not set on the name yet), eg:
30 > > EXTERNALLY_BUILT_KERNEL=1
31 > >
32 > > This option will cause linux-info.eclass to consider ALL kernel option
33 > > checks non-fatal. That way we still get the warnings and logs, but it
34 > > does not stop the builds.
35 > I'm not sure what this is solving? It doesn't seem to reduce user
36 > error, it just allows users a way to override portage errors? It seems
37 > unrelated to config.gz and the discussion going on in the previous
38 > thread. I do like the idea of being able to override portage when it's
39 > stopping us from building (incorrectly), but surely with the capability
40 > to have non-fatal checks, we can try to minimize the times when
41 > portage/the ebuild is wrong using that, instead of a whole new override?
42 The great majority of CONFIG_CHECK usage in the tree is fatal already.
43 It only actually needs to be fatal only when it's being used to build a
44 module.
45
46 However, past bugs have shown lots of users complaining that a package
47 doesn't work, simply because they did not have the relevant option
48 enabled in their kernel.
49
50 This leaves us between hand-holding the basic user's kernel configuration
51 (exiting if the kernel config option is not enabled), and changing all
52 non-module instances in the tree to be non-fatal.
53
54 If we make all the non-module uses non-fatal, there will be an increase of bugs
55 due to users not reading the warnings.
56
57 > > When is the above NOT enough?
58 > > -----------------------------
59 > > The only time that ANY kernel sources are required is when you are
60 > > building an out-of-tree module. For this purpose, they must be
61 > > configured.
62 > There's a lot of ebuilds that use linux-info, and they can't all be
63 > out-of-tree modules. Are they misusing linux-info, or are you saying
64 > there's a specific instance in which linux-info requires configured
65 > kernel sources?
66 Here's a few that I know of, off the top of my head:
67
68 app-mobilephone/gnokii/gnokii-0.6.27-r4.ebuild:
69 CONFIG_CHECK="UNIX98_PTYS"
70
71 /usr/portage/net-print/hplip/hplip-3.9.4b-r1.ebuild:
72 CONFIG_CHECK="PARPORT PPDEV"
73
74 /usr/portage/net-firewall/conntrack-tools/conntrack-tools-0.9.13.ebuild:
75 CONFIG_CHECK="IP_NF_CONNTRACK_NETLINK"
76 CONFIG_CHECK="NF_CT_NETLINK"
77 CONFIG_CHECK="${CONFIG_CHECK} NF_CONNTRACK
78 linux_chkconfig_present "NF_CONNTRACK_IPV4" || \
79 linux_chkconfig_present "NF_CONNTRACK_IPV6" || \
80
81 If you don't have configured kernel sources, all of these ebuilds fail right
82 now. They are not building modules, simply userspace. The CONFIG_CHECK elements
83 are not prefixed with tilde to make them non-fatal.
84
85 conntrack-tools is actually even worse, as it has a kernel version check before
86 the config checks, which would also fail without kernel sources.
87
88 > > The check for having configured kernel sources must only be executed
89 > > when the modules are about to be compiled. Putting it in pkg_preinst
90 > > would block use of binpkgs on (related) machines.
91 > >
92 > > - If a package builds modules AND userspace, we should offer a way to
93 > > build the userspace only, as the user can build their modules
94 > > externally (or patch them into the kernel) [1]
95 > > - For packages that ONLY build modules, and no userspace at all, having
96 > > EXTERNALLY_BUILT_KERNEL=1 means that they should error out? [2]
97 > > (this case might be thrown into the above one).
98 >
99 > That all seems fine, but again these just seem like standard guidelines.
100 > Is there not already some "how to write kernel module ebuilds" page
101 > somewhere that documents how you're supposed to use linux-info?
102 If you're building modules, most of the time you're using linux-mod, not just
103 linux-info. There's no document or recommended behavior in the tree for the
104 above actually, and I'd like to introduce one.
105
106 Packages w/ USE=modules
107 -----------------------
108 app-emulation/kvm
109 media-libs/libifp
110 sys-block/open-iscsi
111 x11-drivers/ati-drivers
112 x11-drivers/linuxwacom
113
114 No choice, modules and userspace
115 --------------------------------
116 net-firewall/ipset
117 media-tv/ivtv
118 media-tv/wis-go7007
119 net-dialup/intel-536ep
120 (partial list, I just looked for a few).
121
122 --
123 Robin Hugh Johnson
124 Gentoo Linux: Developer, Trustee & Infrastructure Lead
125 E-Mail : robbat2@g.o
126 GnuPG FP : 11AC BA4F 4778 E3F6 E4ED F38E B27B 944E 3488 4E85

Replies