[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: Permissions on /usr/src/kernel-source-x.y.z and compiling as an ordinary user



"Doug MacFarlane" <madmac@covad.net> writes:
> Up to now, I've been building my kernels as root.  In fact, doing everything
> as root.  Installing the source, compiling, and installing the resultant
> kernel.
>
> But this group seems to think that sound practice would be to only use root
> to download/install the kernel-source (via apt-get) and install the kernel
> (via dpkg -i) and do everything else as an ordinary user, via fakeroot.

So, here's what I do:

(1) Acquire a kernel source tarball.  (Install
    {i2c,lm-sensors,openafs,alsa}-source.)

(2) Unpack it, as myself, anywhere I feel like.  (My desktop uses
    /usr/local/src/kernel-source-$KVERS; my laptop uses
    $HOME/src/kernel-source-$KVERS.)  Completely ignore
    /usr/src/linux.  (Put myself in group src and unpack the module
    tarballs in /usr/src.  Or unpack the module tarballs somewhere
    else, say in $HOME/src, and set MODULE_LOC=$HOME/src/modules.)

(3) 'make menuconfig' from the top of the kernel source tree as
    myself.

(4) 'make-kpkg kernel-image --rootcmd=fakeroot' as myself.

(5) 'fakeroot make-kpkg modules-image' as myself.[1]

(6) 'dpkg --install ../*.deb' as root.[2]

...so the only step out of this that actually requires being real root
is running dpkg to install the final binaries, and possibly installing
the original kernel-source .deb if you use Debian's source.


[1] In unstable, you can almost do 'make-kpkg modules-image
--rootcmd=fakeroot'; there are only one or two packages left that
don't support this.  This doesn't work so well in stable.

[2] ...or use make-kpkg buildpackage and modules, which generates and
signs .changes files, which you can then drop into a mini-dinstall
repository (still not as root) and then run a normal APT
upgrade/install to get the new kernel.  You may consider this a bit on
the gratuitous side, though.  :-)

-- 
David Maze         dmaze@debian.org      http://people.debian.org/~dmaze/
"Theoretical politics is interesting.  Politicking should be illegal."
	-- Abra Mitchell



Reply to: