Re: Still learning! (kernel help)

From: Arthur Corliss <acorliss@nevaeh-linux.org>
Date: Mon Jan 02 2006 - 13:09:09 AKST

On Mon, 2 Jan 2006, Damien Hull wrote:

> It sounds like I should skip "make oldconfig" and just copy the kernel
> config from /boot.
>
> I'm going to look at distcc before I do any kernel building. If I can
> get it to work I should be able to compile a kernel before I get to old.

FYI: if you're running a 2.6 kernel and you've configured support for it in
there you can get the *currently* running kernel's config parameters from
/proc/config.gz, which may be necessary if you haven't backed up your last
kernel config into /boot|whatever.

In either case you still need to run "make oldconfig" if you're migrating to a
newer kernel. The whole point of this is just to import *your* settings along
with setting (supposedly) sane defaults for new features along with their
internal dependencies on other kernel features. That said, if you're just
making changes in a previously configured kernel tree (such as if you want to
enable new hardware support, etc.) you don't need to do this.

Assuming you have a valid build environment building a kernel is a *lot*
simpler than some of you may think. This may have been already discussed (and
if so, I apologise) but let's go through a quick kernel compile using the pure
kernel sources downloaded from kernel.org:

   1) Start from a clean, unconfigured source tree and configure it
      for your architecture (assuming you've installed and symlinked it
      as /usr/src/linux):

      cd /usr/src/linux
      make mrproper
      make include/linux/version.h
      make include/asm # make symlinks on 2.4 source trees
      make include/linux/autoconf.h

   2) Import your previous kernel config:

      gzip -dc /proc/config.gz > .config # or cp /boot/config-whatever \
      # ./.config
      yes "" | make oldconfig # You don't need the 'yes "" |' on 2.4 trees

   3) Configure your kernel, review import for correctness, etc.:

      make {config|menuconfig|xconfig}

   4) Make & install your kernel:

      make # make bzImage on 2.4 kernels
      # make modules on 2.4 kernels
      # make backups of previous /boot files, configure bootloader to
      # load those for backups
      cp System.map /boot/
      cp arch/i386/boot/bzImage /boot/vmlinuz
      cp .config /boot/vmlinux/current-config
      make modules_install

   5) Recover disk space (optional):

      make clean

The above scenario does not anticipate initrds, etc., just straight kernel
loads via the bootloader.

At this point, if you are just make alterations to your current config all you
need to do are steps 3-5. Go through the entire bit if you're starting with a
new kernel source tree.

Things can be more entertaining when you run a 64 bit kernel with 32 bit
userland, in which case you need to manually set the ARCH and CROSS_COMPILE
make variables.

Again: I haven't been watching this thread closely, so I apologise if I've
just reiterated what others have posted. It just seemed that since the thread
is continuing there's still some confusion. What I've described here is
roughly what I do for my own distro and it works reliably. Though the 2.6
kernel has seen enough radical changes that one can no longer blindly believe
that a simple make oldconfig and compile will produce a working kernel. You
*must* review what's configured to make sure it'll work. Oh, and don't mix
I2O & Fusion MPT drivers. :-P

         --Arthur Corliss
           Bolverk's Lair -- http://arthur.corlissfamily.org/
           Digital Mages -- http://www.digitalmages.com/
           "Live Free or Die, the Only Way to Live" -- NH State Motto
---------
To unsubscribe, send email to <aklug-request@aklug.org>
with 'unsubscribe' in the message body.
Received on Mon Jan 2 13:09:51 2006

This archive was generated by hypermail 2.1.8 : Mon Jan 02 2006 - 13:09:51 AKST