Gentoo Archives: gentoo-user

From: Gregory Shearman <zekeyg@×××××.com>
To: gentoo-user@l.g.o
Subject: Re: [gentoo-user] Gentoo-sources: can't make menuconfig with user? User can't access ncurses?
Date: Tue, 03 Jan 2012 01:15:03
Message-Id: 20120103011317.GA8670@pacific.net.au
1 In linux.gentoo.user, you wrote:
2 > On Mon, 2 Jan 2012 20:58:18 -0200
3 > Claudio Roberto França Pereira <spideybr@×××××.com> wrote:
4 >
5 >> I'm not currently at my Gentoo box, sorry for this, but if I don't
6 >> post this now I'll probably forget to post it at all.
7 >> Anyways, last time I tried upgrading my kernel, I copied my .config
8 >> and ran make menuconfig as my main user, but it whined about missing
9 >> ncurses libraries or something. After su'ing, everything went better
10 >> than expected.
11 >> Was that normal behavior? I remember configuring my kernel as user
12 >> before. Even compiling it as user.
13 >
14 >
15 > How did you install the kernel sources?
16 >
17 > If you downloaded them as a normal user you should be able to make
18 > menuconfig; make; sudo make install just fine.
19 >
20 > If portage installed the sources, then you should
21 > configure/compile/install as root. The sources are owned by portage
22 > (IIRC) and you can't su to that user, leaving only root. Or, try adding
23 > yourself to the portage group. Personally I think that's too much
24 > effort for zero gain so I always do it as root.
25
26 I use a separate output directory that is under control of the user.
27 What I do as an ordinary user:
28
29 mkdir <kerneloutputdir>
30
31 zcat /proc/config.gz > <kerneloutputdir>/.config
32
33 # assuming you have this option set in your kernel ie the current kernel
34 # config saved in /proc/config.gz
35
36 cd /usr/src/linux
37
38 # assuming that /usr/src/linux is a soft link to your new kernel
39 # directory.
40
41 make O=<kerneloutputdir> oldconfig
42
43 # The "O=" makes sure that any kernel output goes to the directory under
44 # the permissions and control of the kernel builder user rather than in
45 # the kernel directory under root permissions.
46
47 # If you want to make changes to the new kernel then:
48
49 make O=<kerneleoutputdir> menuconfig
50
51 You can then proceed with building kernel and modules. Yes, I know that
52 "make" without a command will automatically build both kernel image and
53 modules but I prefer to do things explicitly.
54
55 make O=<kerneleoutputdir> bzImage
56 make O=<kerneleoutputdir> modules
57
58 You can then install the new kernel and modules as root:
59
60 make O=<kerneleoutputdir> modules_install
61 make O=<kerneleoutputdir> install
62
63 You need to set the following environment variable:
64
65 KBUILD_OUTPUT=<kerneloutputdir>
66
67 This variable ensures that any emerged app can find the kernel output if
68 necessary. I've created a script in /etc/profile.d that automatically
69 keeps this environment variable up to date. Oh, remember to unset this
70 variable if you do *anything* requiring a busybox build (eg genkernel).
71
72 An enjoyable side-effect of this system is that when you remove an
73 obselete kernel from your system using "emerge -C <oldkernelversion>",
74 everything will be removed because there are no changes, no files added
75 to those portage added kernel directory.
76
77 The kernel builder user does nothing but build new kernels. This user's
78 home directory is a hierarchy containing current kernel builds.
79
80 I've been using this system for years now, on all my gentoo systems. It
81 is second nature. Of course, the .bash_history of the kernel builder
82 user is *very* useful for quickly doing all this from the command line.
83
84 I used to have a script to automate all this, but it is just as easy to
85 do from the command line.
86
87 --
88 Regards,
89 Gregory.

Replies