Buildkernel QUICKSTART This script will automatically open up the source .tar.gz or .tar.bz2, patch, configure, build, and install a new kernel for you. It automatically cleans out code from other architectures. This document will get you going quickly on building a kernel for this Linux system. I encourage you to look to buildkernel.doc if you would like to customize the build process or learn how the script works. WARNING! This script _does_ attempt to rename, move, and/or delete a number of files, directories and symlinks on your system as part of the standard process of building a kernel. While it tries to be cautious, occasionally even exiting with an error if it really can't figure out how you have your system set up, there is a chance that this script _might_ do anything up to and including deleting files you wanted, making it impossible to boot, or destroying your filesystem. While I have put in a sincere effort to try to avoid this (I use it on my system too!), please understand this _could_ happen. The buildkernel.doc file documents what files, directories, and symlinks this script works with. Please refer to it if you'd like to understand what it will do. While it's generally a smart choice to run an unknown script as non-root, I'm not certain if it will work or not. I would guess that if you had sufficient rights on your system to build a kernel as non-root without this script, this script would also work. That said, here's a step by step first build. NOTE: if you do not use a system with pcmcia sockets, (generally just laptops), you can ignore every reference to pcmcia. 1. Download the package (you can find it at http://www.pobox.com/~wstearns/buildkernel/ ). 2. Place it in /usr/src 3. Install the package with the following: cd /usr/src tar -xzvf buildkernel-1.06.tar.gz cd buildkernel-1.06 make install 4. If you have already downloaded the kernel source for the kernel you want to build, place the file linux-x.y.zz.tar.gz in /usr/src/source/kernel/ . If you are building pcmcia modules as well, place pcmcia-cs-a.b.cc.tar.gz there as well. Keep reading if you do not yet have the kernel source. 5. If you want to apply one or more patches to the kernel (see http://www.linuxhq.com for some patches that might interest you), do the following: mkdir /usr/src/kpatches-x.y.zz Download the patches to this directory. Decide which patch to apply first and name it 00 . Decide which patch to apply next and name it 01 , and so on up to a maximum of 20 patches. I suggest reserving 00 to 05 for official kernel patches and using 06 to 20 for unofficial patches. The files 00 through 20 can also be links to files elsewhere in your filesystem. 6. If you already know what version of the kernel you want to build, start the build process with: buildkernel x.y.zz If you want to build the newest stable or development kernel, try: buildkernel NEWESTSTABLE or buildkernel NEWESTBETA If you don't know what a BETA kernel is, use the NEWESTSTABLE option. If your system _has_ pcmcia sockets, download pcmcia-cs-a.b.cc.tar.gz from hyper.stanford.edu from the /pub/pcmcia directory and put this file in /usr/src/source/kernel as well. Invoke the buildkernel script like this: buildkernel x.y.zz a.b.cc buildkernel NEWESTSTABLE a.b.cc or buildkernel NEWESTBETA a.b.cc (Someday I'll have NEWESTPCMCIA there too :-)) 7. Watch the fireworks^h^h^h^h^h^h^h^h^h^h fun! 8. If you'd like to customize the build process, please see /usr/share/doc/buildkernel-1.06/buildkernel.doc . It documents a number of variables that can be set in /etc/bkrc or ~/.bkrc (and /usr/src/configs/.bkrc.x.y.zz to change how kernel x.y.zz is built). As a general rule, _none_ of these variables need to be set until you have specific requirements. 9. If you have problems in the build process, please refer to buildkernel.doc and the kernel-HOWTO (at http://metalab.unc.edu/linux/HOWTO). If you can't figure out what's wrong, contact me. Time permitting, I'll try to offer a hand. Syntax: buildkernel kernel-version [pcmcia-cs-version] Example: buildkernel 2.1.62 2.9.11 Would build kernel 2.1.58 and pcmcia-cs 2.9.11 from the source files (linux-2.1.58.tar.gz and pcmcia-cs-2.9.11.tar.gz) you've already downloaded to /usr/src/source/kernel/ . Example: buildkernel 2.0.31 Would build just kernel 2.0.31. Example: buildkernel NEWESTSTABLE NEWESTPCMCIA * Instead of using specific kernel or pcmcia versions, you may simply ask for the lastest versions. The script will figure out what the latest versions are, download them if they are not already here, and continue as if you had specified the versions. NEWESTSTABLE or NEWESTBETA can be used instead of an actual kernel version, and NEWESTPCMCIA can be used instead of a pcmcia-cs version. You can mix NEWESTsomething and a real version on the command line. For this to work, you need an Internet connection from the start of the script until one or both files are downloaded. You obviously cannot have both NEWESTBETA and NEWESTSTABLE at the same time. Example: buildkernel NEWESTSTABLE Would build just the most recent stable kernel. * NOTE: NEWESTPCMCIA (pcmcia-cs autodownload) is not yet implemented... Sorry. For the moment you will need to download pcmcia-cs-x.y.zz.tar.gz from hyper.stanford.edu/pub/pcmcia yourself and specify the appropriate version. Copyleft: Buildkernel is used to create a new linux kernel from the raw source and patches. Copyright (C) 1997-2002 William Stearns This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. The author can also be reached at: William Stearns email: wstearns@pobox.com (preferred) web: http://www.stearns.org snail: 6 Manchester Dr. Lebanon NH, 03766