On Mon, Jun 23, 2003 at 10:02:32AM -0400, daniel wrote:
> On June 23, 2003 08:53 am, Frank Hellmuth wrote:
> > I noticed today that I have linux-2.4.20-gentoo-r3, -r4 and -r5 sources
> > on my hard disk, working and backup kernel are both r5.
> >
> > or are the old versions (or at least the headers) still needed?
> >
> > If it's OK to clean them, why doesn't portage do it by itself when
> > updating?
> 
> to be honest, i don't entirely understand what the sources are for.  i know 
> they're required to build a module, but i don't know what files are needed, 
> or where the modules sit once compiled.  but what i do know is this:
> 
> a while back i compiled my kernel (a few times actually) and it kept panicking 
> on boot.  so i took a shot and did the following:
> 
> # emerge --unmerge gentoo-sources
> # rm -r /usr/src/*
> # emerge gentoo-sources
> # cd /usr/src/linux

    ^^^^^^^^^^^^^^^^^

Each kernel source stands on its own... it has no dependencies on other
kernel sources. The above line is critical - take a look at that file:

  ls -l /usr/src/linux

to see why! It points to the last kernel source you installed. This is
important for building the kernel, as well as for anything that might
want to point into the kernel source.


> # make menuconfig (or copy old .config back in)
> # make dep && make clean bzImage modules modules_install
> # mount /boot/
> # rm /boot/bzImage
> # cp arch/i386/boot/bzImage /boot/
> # reboot
> 
> and all worked out.  i'm pretty sure if i just blew away all of the sources 
> without re-emerging and recompiling, i'd be in trouble, but the above offered 
> me no problems.
> 
> ...too bad it looks like a windows solution.  some detailed explanation on the 
> usefulness of the kernel sources would be greatly appreciated.

That's an interesting description :-).

There's a lot more information out there about Linux kernels than you'll
ever find about Windows kernels - gentoo has the good sense not to try
to cram it all into its bootstrapping document.

The usefulness is simply this: you use the sources to build the kernel
and the loadable drivers. After going through build and installation,
the kernel will be in the /boot directory, and the drivers will be under
/lib/modules/XXXXX/, where XXXXX is a version ID string for the kernel
you've compiled.

Once you've built and installed your kernel and drivers, you're basically
done with the sources. It's best to keep them around, though, in case
you need to change any kernel parameters and rebuild. Once you have
a new set of kernel sources, you generally don't need older ones. The
exception is if you've got some software that explicitly depends on the
older sources... which is unlikely to be the case without your having
explicitly created that dependency yourself.

It used to be common practice in Linux that the .h files installed
under /usr/src/linux were also referenced during compilation of
applications that need to know kernel structures... so you still needed
the kernel source to compile just about anything. That's considered Bad
Practice, however, and most distros (including gentoo) ship a separate
"kernel-headers" package that provides that information - essentially,
duplication of what's in the kernel source - without creating a dependency
on having the kernel source installed.

Nathan Meyers
[EMAIL PROTECTED]

--
[EMAIL PROTECTED] mailing list

Reply via email to