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

RFC: Prospective Kernel-Compiling mini-HOWTO



Hello,

This file has been posted to this forum a few times before in earlier
versions.  I would very much appreciate feedback on it.  If enough people
think it's a good idea, I will attempt to contribute it to the LDP.

--BEGIN--
Kernel Compiling for Dummies
By Branden Robinson (branden@purdue.edu)
Version 1.3, Jun 16 1997, 5393 bytes

For Debian users, the "kernel-package" package is supposed to do these
things for you, but I have had rough going with it, especially in the
modules department. The following steps have worked for me on multiple
machines, with various kinds of hardware and booting methods (floppy,
loadlin, lilo). It makes a number of assumptions (i386 architecture,
use of loadable modules, installing a complete set of new kernel sources,
and not a patch, etc.). If anything looks inappropriate for
your setup, make backups and go with your instincts. Always, always,
always make sure you keep a known good booting kernel around on floppy
disk to save your bacon. It also makes sense to compile-in, rather than
modularize, things that are crucial to your system's operation. This
always includes the binary format you use, ELF or a.out, and I think
(can someone clarify?) it also includes the filesystem type of the root
disk, often ext2fs (a.k.a. e2fs); for your personal sanity compile
in things you can't live without (like your network card and mouse,
for example), until you're willing and ready to take the plunge with
modularizing as much of the kernel as you can.

Another tip: most people don't need to be told this, but it can save
many headaches -- make use of the comment character (usually '#') in
configuration files, like conf.modules or lilo.conf. If something
doesn't work, comment it out and mention why. You'll thank yourself
when you come back later to tweak things again.

I would appreciate feedback on this document.  I was thinking of adding a
longer, more explanatory section after the quick recipe version, but some
people seem to like this file short and sweet.  What do you think?

BEGIN

*) if upgrading and if possible, preserve your old kernel sources
   (if your /usr/src/linux is a symlink to the old sources, remove the
   link *before* extracting the tar file to /usr/src, otherwise just
   rename /usr/src/linux)

// if installing a Debian kernel-source package, do that (dpkg -i
// kernel-source-x.y.zz_x.y.zz.deb) instead of the next five steps

*) copy .tgz source file to /usr/src
*) cd /usr/src
*) tar xfz (or tar xfvz) source file (it sticks itself in /usr/src/linux)
*) mv linux kernel-source-x.y.zz
*) ln -s kernel-source-x.y.zz linux

// if you want to preserve the asm, linux, and scsi libraries that shipped
// with your libc, simply mv them before doing the symlink manipulations
// below

*) if necessary, cd /usr/include; ln -s asm-i386 asm
*) if necessary, cd /usr/include; ln -s ../src/linux/include/asm-i386
   asm-i386
*) if necessary, cd /usr/include; ln -s ../src/linux/include/linux linux
*) if necessary, cd /usr/include; ln -s ../src/linux/include/scsi scsi

*) if kernel version you're compiling is the same as current version,
   mv /lib/modules/x.y.zz /lib/modules/x.y.zz.old
*) cd /usr/src/linux; make mrproper; make (config|menuconfig|xconfig);
   (optionally edit Makefile); make dep; make (zImage|zlilo); make modules;
   make modules_install
*) depmod -a (depmod -a x.y.zz using new kernel version if applicable)

// NOTE: if your version of ps scans the System.map file, the psdatabase
// file may be considered redundant (see the WCHAN entry in your ps
// manpage to determine this).

*) backup your old system map, kernel image, and psdatabase:
  A) cd /boot
  B) cp System.map System.map.old
  C) cp vmlinuz vmlinuz.old
  D) cp psdatabase psdatabase.old
*) create new /boot :
  A) cd /usr/src/linux; cp System.map /boot/System.map-x.y.zz
  B) cd /usr/src/linux; cp arch/i386/boot/zImage /boot/vmlinuz-x.y.zz
  C) cd /; if necessary, ln -s boot/System.map-x.y.zz System.map
  D) cd /; if necessary, ln -s boot/vmlinuz-x.y.zz vmlinuz
*) cd /boot; psupdate (creates new /boot/psdatabase)
*) mv /boot/psdatabase /boot/psdatabse-x.y.zz
*) ln -s psdatabase-x.y.zz psdatabase
*) make sure psdatabase symlink in /etc is not broken (if you didn't have
   one before, you don't need it; don't bother creating it)
*) edit /etc/modules appropriately (if you're using kerneld and are lucky,
   "auto" may be all you need)
*) edit /etc/conf.modules (/etc/modules.conf on some systems) appropriately
   (for instance, you may need lines like "alias eth0 de4x5" and "options
   de4x5 io=0x0d")
*) if you use lilo, check /etc/lilo.conf for correct parameters (esp.
   things like "linear")
*) backup your old kernel image(s) and then put the new ones wherever you
   need them, e.g.:
   cp /usr/src/linux/arch/i386/boot/zImage /dev/fd0
   cp /usr/src/linux/arch/i386/boot/zImage /mnt/win95/Etc/Linux
*) reboot
*) if insmod complains about missing modules (but not "unresolved
   symbols"), try editing /etc/conf.modules and aliasing missing modules
   to off; e.g., "alias net-pf-4 off" or "alias char-major-10 off". These
   often correspond to devices/drivers your machine doesn't have or need.
*) in my experience, "unresolved symbols" errors often mean you have
   modules sitting in /lib/modules/x.y.zz that the kernel doesn't expect;
   if you moved your old ones and did a "make modules" and "make
   modules_install" this shouldn't happen...hopefully
*) reboot again and see if it worked

END

Disclaimer: Copyright (C) 1997 Branden Robinson.  This file is freely
redistributable by any means provided it remains complete and unchanged.
--END--

-- 
G. Branden Robinson
Purdue University
branden@purdue.edu
http://www.ecn.purdue.edu/~branden/


--
TO UNSUBSCRIBE FROM THIS MAILING LIST: e-mail the word "unsubscribe" to
debian-user-request@lists.debian.org . 
Trouble?  e-mail to templin@bucknell.edu .


Reply to: