I use
DebianGnuLinux? as the main
OperatingSystem on my
WorkStation?. My
KernelConfiguration? is a little bit nonstandard, though, as I use
KernelPatches? and
KernelModules? that are available through Debian, but which are not part of the main kernel tree.
As such, my method for building new kernels is a little more complicated than it is on most systems.
First, pick a local kernel revision. Something like {hostname}{revision} is good. This way, you can install multiple versions of the same kernel, each with their own configuration and modules directory, and switch between them at will.
First-Time Only Setup
You'll need to have installed a few packages before you can begin. In all likelihood, most of them are already present on your system. If they're not, it's a simple matter to install them.
- kernel-package
- initrd-tools
- cramfsprogs
- gcc
- libc-dev
- debianutils
- make
- libdb3-dev
- libncurses-dev
You can install all of these in one batch by typing:
apt-get install kernel-package initrd-tools cramfsprogs gcc libc-dev debianutils make libdb3-dev libncurses-dev
Variables Used Below
| Name | Example | Explanation |
| $version | 2.4.19 | The main kernel version, i.e. 2.4.19, i.e. |
| $local | myhost1 | The local kernel revision as mentioned above, i.e. myhost1 |
| $fullVersion | 2.4.19myhost1 | The concatenated $version and $local strings, i.e. 2.4.19myhost1 |
Download The Source
- Get a list of kernels available for installation. This command will show you a list of possibilities.
apt-get install kernel-source
- Download the Debian source package for the version you've chosen:
apt-get install kernel-source-$version
Build Your Kernel!
Once you've installed those, you're ready to start:
- Go to the source parent directory.
cd /usr/src
- Extract the kernel package you downloaded earlier.
tar xvjf kernel-source-$version.tar.bz
- Make linux a symlink to the kernel source. This isn't absolutely necessary, but it's a very common practice:
ln -s kernel-source-$version linux
- Extract any additional kernel module TarBalls you may wish to install.
tar xvzf nvidia-kernel-src.tar.gz
- Tell make-kpkg to apply any extra kernel patches you've installed before configuration and building.
export PATCH_THE_KERNEL="YES"
- Configure your kernel options. This method substitutes for the normal 'make {whatever}config' step. It patches the kernel with your local additions before running the config tool.
cd linux
make-kpkg --config {config|xconfig|menuconfig} configure
- Remove any extraneous files from the kernel source before building.
make-kpkg clean
- Big step #1: build the kernel package.
- You'll probably get a warning about using the initrd option. This warning does not apply to you, so you can safely ignore it.
make-kpkg --us --uc --initrd --append-to-version $local kernel_image
- Big step #2: build the module packages.
- You may get another warning here. Ignore it also.
make-kpkg --us --uc --append-to-version $local modules_image
- Look at the list of packages built by the previous two steps.
- There will be, at the least, kernel-image-$fullVersion_10.00.Custom_i386.deb
- There may also be additional module packages depending on whether you built any.
cd ..
ls -lart *.deb
- Almost finished! Install your new kernel and modules packages.
dpkg -i {list of .deb packages from the previous step}
- Finally, update the bootloader to tell it about your new kernel. Both of these commands update a particular bootloader. Use the command appropriate for the one you have installed.
lilo -v
or
update-grub
--
KirkStrauser - 13 Sep 2002