Debian Image Debian people appear to be blessed with three ways to install a kernel, the generic way, a pre-compiled deb image way and a make your own deb compile way (if you need SMP/IPSEC support etc).
Pre-compiled - manual
The pre-compiled way is incredibly easy (for linux) and for newbies and the vast majority number of people out there the easiest way to upgrade a kernel.
1) Download a kernel image say kernel-image-2.4.27-4-686-smp.deb (-686 signifies a Pentium Pro, PII, P4, Duo or later) using apt or manually via ftp or http. eg apt-get install kernel-image-2.4.27-4-686-smp.deb
1a) If you downlaoded it manually then copy it to /usr/src/ if its not already there type mv kernel-image-2.4.18-686.deb /usr/src/ if you need to.
1b) Type dpkg --install kernel-image-2.4.18-686.debor dpkg -i kernel-image-2.4.18-686.deb
1c) After its done that it should know be completed and will ask you to make a bootable floppy (advisable if you do not have one)
2a) If you are still(!) using lilo, next alter lilo and install lilo (ie say yes)
2b) now type lilo (not usually needed but a safety check) make sure lilo reports no errors.
3) If using grub, edit /boot/grub/menu.1st to pick the kernel you want to reboot with.
4) Finally reboot, type shutdown -r now or reboot
On rebooting, your kernel should appear as 2.2.19 #2 or (2.4.27 SMP etc) just after you login (or type uname -a).
Debian Source Compile your own
This is now easy to understand (the articles and instructions I had were wrong!) These days its dead easy (honest!) to make a debianised custom kernel, you need a few things), 1) the kernel header, 2) the complete source and 3) the kernel-package manager, so run apt and download and install all of these.
apt-get install gcc kernel-package kernel-headers-2.4.27-4-686-smp kernel-build-2.4.27-4
apt-get install kernel-tree-2.4.27 kernel-patch-debian-2.4.27
and finally, apt-get install build-essential libncurses5-dev
Setup
The correct kernel source is contained in, kernel-build. It normally comes as a bz2 compressed file inside the .deb so move to /usr/src and issue the command tar jxvf kernel-source-2.4.27.tar.bz2 to unpack it.
An option is to downlaod the deb file and install it, dpkg -i kernel-source-2.4.27_2.4.27-10sarge7_all.deb
The kernel package manager contains the script to build the kernel package, and provides the capability to create a Debian kernel-image package just by running several commands. Get it with apt-get install kernel-package if you have not already.
When you install the sources from deb's it untars the deb kernel to /usr/src/kernel-source-2.4.5, which is fine, but now suppose you want 2.4.7 and it is not available as a .deb? Well its still easy, go get the 2.4.18.tar.bz2 kernel source and expand it with bunzip2 kernrl2.4.18.tar.bz2 this produces a tar file so untar with tar xvvf kernel-2.4.18.tar, this will produce a directory under /usr/src called linux eg /usr/src/linux, now to make it standard debian issue this command, ln -s kernel-source-2.4.27 linux, this makes a symbolic link. Alternatively you can simply use mv to rename linux to kernel-source-2.4.18. The file supplied as a Debian .deb will be patched, ie usually end in -5 or something, make sure you have the latest patched source.
Adding a 3rd party module In this case we will add a module for the sk98lin from Asus's Linux drivers for a new motherboard.
This module cannot be compiled into a kernel (2.4.27-10sarge7) as it is broken, it can be built as a seperate addon module though.
It is shown here as an example
Collect the x.zip, move it to /usr/src/asus and unzip it,
tar jxvf install-8_41.tar.bz2
cd /usr/src/asus/Lan/8056/v8.41.2.3/DriverInstall
Here we will patch the kernel, so run ./install.sh and select generate a patch rather than an install.
Finally apply the patch,
cd /usr/src/linux
cat /usr/src/asus/Lan/8056/v8.41.2.3/DriverInstall/sk98lin_v8.41.2.3_2.4.27_patch | patch -p1
Configuration
Some useful notes are here (for 2.4.x), http://www.falkotimme.com/howtos/debian_kernel2.4_compile/index.php
Some useful notes are here (for 2.4.x), http://www.debian.org/doc/FAQ/ch-kernel.en.html
Some useful notes are here (for 2.4.x), http://www.holtmann.org/linux/kernel/debian.html
Some useful notes are here (for 2.6.x), http://www.howtoforge.com/forums/showthread.php?t=21
Patch the kernel with debian patches
First cd into the source tree top, cd /usr/src/linux
and execute this, ../kernel-patches/all/2.4.27/apply/debian
First in the linux or kernel-source directory run make mrproper (but inly if you want to start from scratch) then, either run make menuconfig or make config and pick your options, if you want firewalling see the firewall IPCHAINS page for the options you need to set. Choose the options you wish to add, for IPCHAINS / IPMASQ see my article for items to enable in the kernel. If you definately want something consider loading it direct ie (*) not (M) network cards I would leave as modules though as they sometimes need 'adjusting'. NB older SMP kernels (pre 2.2.16) dont do APMI well, never ever use advanced power management on a smp kerne) or printer support so use (*) not (M) if you will be printing via the parallel port.
Type make dep, you then get lots of lines fly past (unless your doing it on a P133 like me in which case they crawl past :).
Kernel packager
The Debian kernel packager tool is called make-kpkg the man page is man make-kpkg The other important file your need is the README in /usr/doc/kernel-package, this page is based on this document which explains far more options.
Install the needed packages,
Type make-kpkg clean you then get lots of lines fly past
again (only a few seconds worth).
Ok and this is the long one type make-kpkg --revision=custom.1.0 kernel_image
Now I am assuming you want to make a kernel.deb kernel_image does that so dont forget it! I did first time round....duh.
--revision= is for setting the name of the kernel image that you want and is optional.
At the end of this process (45 minutes on a P133) there should be a nice shiney new kernel.image.deb in /usr/src/ that you can now install.
8) To install the new kernel type dpkg -i name_of_the_kernel.deb and then follow the instructions as the script runs.
9) Check /etc/lilo.conf points to the new kernel (default=2.4.18) and run lilo to make sure there are no errors and a * appears next to 2.4.18.
10) Now reboot with shutdown -r now.or reboot
3rd Party modules
Third party modules for NICs etc can be compiled outside of doing a full kernel compile. Here are three examples,
The standard modules may or may not work, so for new hardware compiling from source is not unusual.
e1000 or in this case e1000e which is used for the PCI-e PT dual Gigabyte card
Create a directory e1000 under /usr/src/ and cp the package into here and untar it.
Look for the readme which basically says cd into /usr/src/e1000/e1000e-0.2.9.5/src/ and run make install
The script will move this module into the kernel modules tree and from here can be installed using modconf
Realtek 8110SC
This is an embedded Gb NIC on the PCI bus (in this case)
mkdir /usr/src/realtek/ and un-tar the package. cd into r8169-6.005.00 and run make install, again modconf can be used to load and unload the module.
Marvel Yukon
This is an embedded Gb NIC on the PCI-e bus (in this case)
In this case we will use the source package provided by Asus as it works
cp the Linuxdrivers.zip into /usr/src/asus and unzip
cd /usr/src/asus/Lan/8056
Read the readme
cd v8.41.2.3/DriverInstall/
run the install.sh script and pick installation
(C)Copyright 2003-2006 Marvell(R).
====================================================
Add to your trouble-report the logfile install.log
which is located in the DriverInstall directory.
====================================================
1) installation
2) generate patch
3) exit
Choose your favorite installation method: 1
Please read this carfully!
This script will automatically compile and load the sk98lin
driver on your host system. Before performing both compilation
and loading, it is necessary to shutdown any device using the
sk98lin kernel module and to unload the old sk98lin kernel
module. This script will do this automatically per default.
Please plug a card into your machine. Without a card we aren't
able to check the full driver functionality.
Do you want proceed? (y/N) y
Create tmp dir (/tmp/Sk98IKIQYaJSoaNlBTpQlbncn) [ OK ]
Check user id (0) [ OK ]
Check kernel version (2.4.27) [ OK ]
Check kernel symbol file (/proc/ksyms) [ OK ]
Check kernel type (SMP) [ OK ]
Check number of CPUs (2) [ OK ]
Check architecture (found) [ OK ]
Set architecture (i386) [ OK ]
Check compiler (/usr/bin/gcc) [ OK ]
Check mcmodel flags (none) [ OK ]
Check module support (/sbin/insmod) [ OK ]
Check make (/usr/bin/make) [ OK ]
Check archive file (sk98lin) [ OK ]
Check kernel gcc version (3.3.5) (Kernel:3.3.5 == gcc:3.3.5) [ OK ]
Check sk98lin driver availability (not loaded) [ OK ]
Check kernel header files (/usr/src/linux) [ OK ]
Unpack the sources (done) [ OK ]
Check sources for .config file (/usr/src/linux/.config) [ OK ]
Copy and check .config file (done) [ OK ]
Check the mem address space (highmem) [ OK ]
Change IOMMU (disabled) [ OK ]
Create new .config file (done) [ OK ]
Execute: make oldconfig (done) [ OK ]
Execute: make dep (done) [ OK ]
Check kernel header version (Kernel:2.4.27 == Header:2.4.27) [ OK ]
Check firmware availability (not available) [ OK ]
Check kernel functions (Changed: netdump) [ OK ]
ompile the driver (done) [ OK ]
Copy driver man page into /usr/share/man/man4/ (done) [ OK ]
Check the driver (done) [ OK ]
Delete old driver (done) [ OK ]
Copying driver (done) [ OK ]
Make dependency (done) [ OK ]
Delete temp directories (done) [ OK ]
All done. Driver installed and loaded.
To load the module manually, proceed as follows:
Enter "modprobe sk98lin"
Have fun...
At this point, again modconf can be used to load and unload the module
Warnings, the module is compiled for a specific kernel, so if you upgrade the kernel the module will need re-installing. So if you are relying on this module for a remote connection, you might find after a reboot, you cannot connect!!!!
Vmware ESX 3.5 tools First run apt-get update ; apt-get -y dist-upgrade if the kernel gets upgarded, reboot the server.
In the Vmware client connection to the server/Virtual Centre, click on install/upgrade VMware tools, go to the command line and mount the cdrom with mount /dev/hda /mnt/cdrom
Copy the VMware*.tar.gz to /usr/src/
Untar the package.
For the 2.6 kernel these will be needed,
apt-get install gcc kernel-package g++ g++-4.1 libc6-dev libstdc++6-4.1-dev linux-kernel-headers
Followed by these,
apt-get install apt-get install build-essential libncurses5-dev
Followed by these,
apt-get install linux-headers-2.6-686
Reading package lists... Done
Building dependency tree... Done
The following extra packages will be installed:
linux-headers-2.6.18-6 linux-headers-2.6.18-6-686 linux-kbuild-2.6.18
The following NEW packages will be installed:
linux-headers-2.6-686 linux-headers-2.6.18-6 linux-headers-2.6.18-6-686 linux-kbuild-2.6.18
0 upgraded, 4 newly installed, 0 to remove and 0 not upgraded.
Need to get 3617kB of archives.
After unpacking 20.1MB of additional disk space will be used.
Do you want to continue [Y/n]? y
Get:1 http://debian.ihug.co.nz etch/main linux-kbuild-2.6.18 2.6.18-1 [168kB]
Get:2 http://debian.ihug.co.nz etch/main linux-headers-2.6-686 2.6.18+6etch3 [2316B]
Get:3 http://security.debian.org etch/updates/main linux-headers-2.6.18-6 2.6.18.dfsg.1-18etch3 [3168kB]
Get:4 http://security.debian.org etch/updates/main linux-headers-2.6.18-6-686 2.6.18.dfsg.1-18etch3 [279kB]
Fetched 3617kB in 45s (80.1kB/s)
Selecting previously deselected package linux-headers-2.6.18-6.
(Reading database ... 76779 files and directories currently installed.)
Unpacking linux-headers-2.6.18-6 (from .../linux-headers-2.6.18-6_2.6.18.dfsg.1-18etch3_i386.deb) ...
Selecting previously deselected package linux-kbuild-2.6.18.
Unpacking linux-kbuild-2.6.18 (from .../linux-kbuild-2.6.18_2.6.18-1_i386.deb) ...
Selecting previously deselected package linux-headers-2.6.18-6-686.
Unpacking linux-headers-2.6.18-6-686 (from .../linux-headers-2.6.18-6-686_2.6.18.dfsg.1-18etch3_i386.deb) ...
Selecting previously deselected package linux-headers-2.6-686.
Unpacking linux-headers-2.6-686 (from .../linux-headers-2.6-686_2.6.18+6etch3_i386.deb) ...
Setting up linux-headers-2.6.18-6 (2.6.18.dfsg.1-18etch3) ...
Setting up linux-kbuild-2.6.18 (2.6.18-1) ...
Setting up linux-headers-2.6.18-6-686 (2.6.18.dfsg.1-18etch3) ...
Setting up linux-headers-2.6-686 (2.6.18+6etch3) ...
We will now need to run the VMware tool installer,
Creating a new installer database using the tar4 format.
Installing the content of the package. This may take from several minutes to
over an hour depending on the size of the package.
In which directory do you want to install the binary files?
[/usr/bin]
What is the directory that contains the init directories (rc0.d/ to rc6.d/)?
[/etc]
What is the directory that contains the init scripts?
[/etc/init.d]
In which directory do you want to install the daemon files?
[/usr/sbin]
In which directory do you want to install the library files?
[/usr/lib/vmware-tools]
The path "/usr/lib/vmware-tools" does not exist currently. This program is
going to create it, including needed parent directories. Is this what you want?
[yes]
In which directory do you want to install the documentation files?
[/usr/share/doc/vmware-tools]
The path "/usr/share/doc/vmware-tools" does not exist currently. This program
is going to create it, including needed parent directories. Is this what you
want? [yes]
Before running VMware Tools for the first time, you need to configure it by
invoking the following command: "/usr/bin/vmware-config-tools.pl". Do you want
this program to invoke the command for you now? [no]
Before running VMware Tools for the first time, you need to configure it by
invoking the following command: "/usr/bin/vmware-config-tools.pl". Do you want
this program to invoke the command for you now? [yes] no
Enjoy,
--the VMware team
From here we will have to be on the local console as VMware will un-install the netowrk module and attempt to install its own. It is advisable that modconf is installed, so, apt-get install modconf if you have already not done so elsewhere.
We will now need to run the VMware module setup tool,
/usr/bin/vmware-config-tools.pl
Stopping VMware Tools services in the virtual machine:
Guest operating system daemon: done
Trying to find a suitable vmmemctl module for your running kernel.
None of the pre-built vmmemctl modules for VMware Tools is suitable for your
running kernel. Do you want this program to try to build the vmmemctl module
for your system (you need to have a C compiler installed on your system)?
[yes]
Using compiler "/usr/bin/gcc". Use environment variable CC to override.
What is the location of the directory of C header files that match your running
kernel? [/lib/modules/2.6.18-6-686/build/include]
Extracting the sources of the vmmemctl module.
Building the vmmemctl module.
Using 2.6.x kernel build system.
make: Entering directory `/tmp/vmware-config0/vmmemctl-only'
make -C /lib/modules/2.6.18-6-686/build/include/.. SUBDIRS=$PWD SRCROOT=$PWD/. modules
make[1]: Entering directory `/usr/src/linux-headers-2.6.18-6-686'
CC [M] /tmp/vmware-config0/vmmemctl-only/backdoorGcc32.o
CC [M] /tmp/vmware-config0/vmmemctl-only/os.o
CC [M] /tmp/vmware-config0/vmmemctl-only/vmballoon.o
LD [M] /tmp/vmware-config0/vmmemctl-only/vmmemctl.o
Building modules, stage 2.
MODPOST
CC /tmp/vmware-config0/vmmemctl-only/vmmemctl.mod.o
LD [M] /tmp/vmware-config0/vmmemctl-only/vmmemctl.ko
make[1]: Leaving directory `/usr/src/linux-headers-2.6.18-6-686'
cp -f vmmemctl.ko ./../vmmemctl.o
make: Leaving directory `/tmp/vmware-config0/vmmemctl-only'
The module loads perfectly in the running kernel.
Extracting the sources of the vmhgfs module.
Building the vmhgfs module.
Using 2.6.x kernel build system.
make: Entering directory `/tmp/vmware-config0/vmhgfs-only'
make -C /lib/modules/2.6.18-6-686/build/include/.. SUBDIRS=$PWD SRCROOT=$PWD/. modules
make[1]: Entering directory `/usr/src/linux-headers-2.6.18-6-686'
CC [M] /tmp/vmware-config0/vmhgfs-only/backdoor.o
CC [M] /tmp/vmware-config0/vmhgfs-only/backdoorGcc32.o
CC [M] /tmp/vmware-config0/vmhgfs-only/bdhandler.o
8><------etc etc-----
LD [M] /tmp/vmware-config0/vmhgfs-only/vmhgfs.ko
make[1]: Leaving directory `/usr/src/linux-headers-2.6.18-6-686'
cp -f vmhgfs.ko ./../vmhgfs.o
make: Leaving directory `/tmp/vmware-config0/vmhgfs-only'
The module loads perfectly in the running kernel.
pcnet32 30692 0
Unloading pcnet32 module
At this point the VMware tool disconnected the network.....Login to the local console and reboot the server, the networking should come up and be available, test with ping.
The Vmware tools may or may not be functioning, if not, first wait 5 minutes, if OK does not appear in the summary, reboot the server. If this fails, re-run the setup script, /usr/bin/vmware-config-tools.pl and reboot afterwards
Copyright Thing 26/08/2002 & 18/4/2008 to be used freely without restriction (aka GPL), however if this page is copied to your own web site please drop me a line with the URL - thanks.
The Debian and Red Hat logos are a trademark of Debian, and Red Hat respectively who in no way endorse or take responsibility for information on this site.