kernel-package
dpkg-dev
debianutils
libc6-dev
gcc
make
kernel-source-x.x.xx
binutils
task-tcltk-dev (if you want the X configuration interface)
libncurses5-dev (if you want the menu-driven interface; highly recommended)
bin86 (for x86 platforms only)
Get to a terminal, either under X or in a full-screen console. Under KDE and GNOME, this can be accomplished by clicking a button on the panel that looks like a monitor. To go full-screen, press CTRL-ALT-F1.
Log in as root. If you are using a terminal window, type 'su'. On a full screen, just log in as root.
Type 'adduser username src', replacing username with the name of your normal user account. (You do have one and use it, don't you?) Since, under Linux, we want to avoid doing more than we have to as root, we try to make it so that we can do more as an unprivileged user. This command adds your normal user account to the src group so you can access /usr/src as a normal user. The root account has no security!
Press CTRL-D to exit/log out. If you are prompted to log in, log in as a normal user.
Type 'cd /usr/src' to go to the source code directory.
Type 'ls'. If you see something like 'kernel-source-2.4.18.tar.bz2' listed, you're okay. If not, check to see that all the packages above are installed.
If you've compiled a kernel before, type 'rm linux' to remove the old 'linux' link.
Type 'tar -jxvf kernel-source-x.xx.tar.bz2', replacing 'x.xx' with the version number. Alternatively, you can type part of the filename and press TAB to auto-complete it. This command unpacks the kernel source code. If you are using a 486 or 386, this will take a long time. If you are using a Pentium or newer, this will take a few seconds.
Type 'ln -s kernel-source-x.xx linux', following the tips for the name in the previous step. This creates a link to the kernel source so that any device drivers you install from source code can find the kernel source.
Type 'cd linux'.
Type 'make-kpkg clean' to clean out the kernel source tree.
Now it's time to configure the kernel. What you do now depends on whether you want the Hard Way, the Text-Menu Way, or the Point-and-Click Way. For the Hard Way, which I do NOT recommend, type 'make config'. This method asks you the questions in order and does not let you go back. For the Text-Menu Way, which is the way I recommend, type 'make menuconfig'. This method is very easy to use. For the Point-and-Click Way, you must be in a console window, and type 'make xconfig'.
Select what you want to compile into the kernel. If you compile something as a module, you can load and unload it as you please using an easy-to-use, menu-based utility called 'modconf'. However, there are some things you MUST compile directly into the kernel, like the driver for your root filesystem and the drivers for anything else that must be loaded immediately upon booting. Use your judgement. If you're unsure about something, there is a help function. Under menuconfig, you can press SHIFT-? to get help. Under xconfig, there should be a Help button you can click. The help is very good.
When you're done going through all the options, exit the configuration utility and, if asked to save the configuration, select Yes.
When you see a command prompt again, type 'su' to become root.
When you're root, type
make-kpkg --revision=custom.1.0 kernel_image
Type this literally! That is, do not substitute anything for 'kernel_image'. If this is not your first time compiling a custom kernel, you may have to increase the revision number. I've compiled my kernel several times without having to increase the version number, but the document that taught me how to do this said I would have to. Anyway, this command compiles the kernel and makes a nice Debian package of it. This will take a while, so relax. The kernel package build script runs through all the configuration questions first. If it gets stuck while it's doing that, just hit ENTER and it will continue without an error.
When it finishes, type 'cd /lib/modules', type 'ls', and look for a directory for the kernel version you just compiled. If you see a directory for that version (without any suffix like 2.4.18-bf24, just a number like 2.4.18), rename it with something like 'mv 2.4.18 2.4.18.backup'. This will get any old modules out of the way so that you can install the new package you just built.
Type 'cd /usr/src' to get back to the source directory.
Type 'ls *.deb' to see the name of the kernel package you made.
Type 'dpkg -i package_name.deb' substituting the name of the package you compiled for package_name.deb.
Follow the prompts, and, when you're done, type 'reboot'.
Log in as root to a console session, and type 'modconf' to configure your modules.
STEPS FOR RECOMPILING A KERNEL USING THE OLD SOURCE CODE IN DEBIAN GNU/LINUX
Get to a terminal, either under X or in a full-screen console. Under KDE and GNOME, this can be accomplished by clicking a button on the panel that looks like a monitor. To go full-screen, press CTRL-ALT-F1.
Log in as a normal user if you have to log in.
Type 'cd /usr/src' to go to the source code directory.
Type 'cd linux'.
Type 'make-kpkg clean' to clean out the kernel source tree.
Now it's time to configure the kernel. What you do now depends on whether you want the Hard Way, the Text-Menu Way, or the Point-and-Click Way. For the Hard Way, which I do NOT recommend, type 'make config'. This method asks you the questions in order and does not let you go back. For the Text-Menu Way, which is the way I recommend, type 'make menuconfig'. This method is very easy to use. For the Point-and-Click Way, you must be in a console window, and type 'make xconfig'.
Select what you want to compile into the kernel. If you compile something as a module, you can load and unload it as you please using an easy-to-use, menu-based utility called 'modconf'. However, there are some things you MUST compile directly into the kernel, like the driver for your root filesystem and the drivers for anything else that must be loaded immediately upon booting. Use your judgement. If you're unsure about something, there is a help function. Under menuconfig, you can press SHIFT-? to get help. Under xconfig, there should be a Help button you can click. The help is very good.
When you're done, exit the configuration utility and, if asked to save the configuration, select Yes.
When you see a command prompt again, type 'su' to become root.
When you're root, type
make-kpkg --revision=custom.1.0 kernel_image
Type this literally! That is, do not substitute anything for 'kernel_image'. If this is not your first time compiling a custom kernel, you may have to increase the revision number. I've compiled my kernel several times without having to increase the version number, but the document that taught me how to do this said I would have to. Anyway, this command compiles the kernel and makes a nice Debian package of it. This will take a while, so relax. The kernel package build script runs through all the configuration questions first. If it gets stuck while it's doing that, just hit ENTER and it will continue without an error.
When it finishes, type 'cd /lib/modules', type 'ls', and look for a directory for the kernel version you just compiled. If you see a directory for that version (without any suffix like 2.4.18-bf24, just a number like 2.4.18), rename it with something like 'mv 2.4.18 2.4.18.backup'. This will get any old modules out of the way so that you can install the new package you just built.
Type 'cd /usr/src' to get back to the source directory.
Type 'ls *.deb' to see the name of the kernel package you made.
Type 'dpkg -i package_name.deb' substituting the name of the package you compiled for package_name.deb.
Follow the prompts, and, when you're done, type 'reboot'.
Log in as root to a console session, and type 'modconf' to configure your modules.
Get to a terminal, either under X or in a full-screen console. Under KDE and GNOME, this can (sometimes) be accomplished by clicking a button on the panel that looks like a monitor. Under Red Hat, you need to go to the menu (lower left corner) and click on 'Terminal' under 'System Tools'. To go full-screen, press CTRL-ALT-F1.
Log in as root. If you are using a terminal window, type 'su'. On a full screen, just log in as root.
If you downloaded the source code from the Internet and did not go through your package manager (if any), copy or move your source code to /usr/src.
Type 'cd /usr/src' to go to the source code directory.
Type 'ls'. If you see something like 'kernel-source-2.4.18.tar.bz2' or 'linux-2.4.26.tar.bz2' listed, you're okay. If not, check to see that all the packages above are installed. If you used an RPM, look for a directory under /usr/src/RPM.
If you've compiled a kernel before, type 'rm linux' to remove the old 'linux' link.
Type 'tar -jxvf kernel-source-x.xx.tar.bz2' or 'tar -jxvf linux-x.xx.tar.bz2', replacing 'x.xx' with the version number. Alternatively, you can type part of the filename and press TAB to auto-complete it. This command unpacks the kernel source code. If you are using a 486 or 386, this will take a long time. If you are using a Pentium or newer, this will take a few seconds. If you used an RPM, ignore this step.
Type 'ln -s kernel-source-x.xx linux' or 'ln -s linux-x.xx linux', following the tips for the name in the previous step. This creates a link to the kernel source so that any device drivers you install from source code can find the kernel source. If you used an RPM, make sure you're in /usr/src and do an 'ln -s RPM/linux-x.xx linux' or 'ln -s RPM/kernel-source-x.xx linux' (depending on what you saw when you checked the RPM directory.
Type 'cd linux'.
Now it's time to configure the kernel. What you do now depends on whether you want the Hard Way, the Text-Menu Way, or the Point-and-Click Way. For the Hard Way, which I do NOT recommend, type 'make config'. This method asks you the questions in order and does not let you go back. For the Text-Menu Way, which is the way I recommend, type 'make menuconfig'. This method is very easy to use. For the Point-and-Click Way, you must be in a console window, and type 'make xconfig'.
Select what you want to compile into the kernel. If you compile something as a module, you can load and unload it as you please using an easy-to-use, menu-based utility called 'modconf'. However, there are some things you MUST compile directly into the kernel, like the driver for your root filesystem and the drivers for anything else that must be loaded immediately upon booting. Use your judgement. If you're unsure about something, there is a help function. Under menuconfig, you can press SHIFT-? to get help. Under xconfig, there should be a Help button you can click. The help is very good.
When you're done going through all the options, exit the configuration utility and, if asked to save the configuration, select Yes.
Type 'cd /lib/modules', type 'ls', and look for a directory for the kernel version you just compiled. If you see a directory for that version (without any suffix like 2.4.18-bf24, just a number like 2.4.18), back it up with something like 'mv 2.4.18 2.4.18.backup'. This will get any old modules out of the way so that you can install the new kernel you just built.
Type 'cd /usr/src/linux'
Type these commands in this order: 'make dep', 'make clean', 'make bzImage', 'make modules'
Type the following to install the new kernel:
cd /usr/src/linux
make modules_install
cp arch/i386/boot/bzImage /boot/vmlinuz-version
If your distribution uses GRUB, edit /etc/grub.conf and copy the structure of the existing kernel and modify it to suit your new kernel. (Make sure you change any 'root=LABEL=/' to 'root=/dev/hda2' or something similar!)
If your distribution uses LILO, edit /etc/lilo.conf and copy the structure of your existing kernel and modify it to suit your new kernel. (Again, make sure you change any 'root=LABEL=/' to 'root=/dev/hda2' or something similar!) Make sure that after your done editing you need to type 'lilo' at the command prompt as root to activate your changes!
When it finishes, type 'cd /lib/modules', type 'ls', and look for a directory for the kernel version you just compiled. If you see a directory for that version (without any suffix like 2.4.18-bf24, just a number like 2.4.18), rename it with something like 'mv 2.4.18 2.4.18.backup'. This will get any old modules out of the way so that you can install the new package you just built.
Type 'cd /usr/src' to get back to the source directory.
Type 'ls *.deb' to see the name of the kernel package you made.
Type 'dpkg -i package_name.deb' substituting the name of the package you compiled for package_name.deb.
Follow the prompts, and, when you're done, type 'reboot'.
Log in as root to a console session, and type 'modconf' to configure your modules. This might not work on a non-Debian system.
STEPS FOR RECOMPILING A KERNEL USING THE OLD SOURCE CODE ON A NON-DEBIAN SYSTEM
Get to a terminal, either under X or in a full-screen console. Under KDE and GNOME, this can be accomplished by clicking a button on the panel that looks like a monitor. To go full-screen, press CTRL-ALT-F1.
Log in as root.
Type 'cd /usr/src' to go to the source code directory.
Type 'cd linux'.
Type 'make-kpkg clean' to clean out the kernel source tree.
Now it's time to configure the kernel. What you do now depends on whether you want the Hard Way, the Text-Menu Way, or the Point-and-Click Way. For the Hard Way, which I do NOT recommend, type 'make config'. This method asks you the questions in order and does not let you go back. For the Text-Menu Way, which is the way I recommend, type 'make menuconfig'. This method is very easy to use. For the Point-and-Click Way, you must be in a console window, and type 'make xconfig'.
Select what you want to compile into the kernel. If you compile something as a module, you can load and unload it as you please using an easy-to-use, menu-based utility called 'modconf'. However, there are some things you MUST compile directly into the kernel, like the driver for your root filesystem and the drivers for anything else that must be loaded immediately upon booting. Use your judgement. If you're unsure about something, there is a help function. Under menuconfig, you can press SHIFT-? to get help. Under xconfig, there should be a Help button you can click. The help is very good.
When you're done, exit the configuration utility and, if asked to save the configuration, select Yes.
Type these commands in this order: 'make dep', 'make clean', 'make bzImage', 'make modules'
When it finishes, type 'cd /lib/modules', type 'ls', and look for a directory for the kernel version you just compiled. If you see a directory for that version (without any suffix like 2.4.18-bf24, just a number like 2.4.18), rename it with something like 'mv 2.4.18 2.4.18.backup'. This will get any old modules out of the way so that you can install the new package you just built.
Type the following to install the new kernel:
cd /usr/src/linux
make modules_install
cp arch/i386/boot/bzImage /boot/vmlinuz-version
If your distribution uses GRUB, edit /etc/grub.conf and copy the structure of the existing kernel and modify it to suit your new kernel. (Make sure you change any 'root=LABEL=/' to 'root=/dev/hda2' or something similar!)
If your distribution uses LILO, edit /etc/lilo.conf and copy the structure of your existing kernel and modify it to suit your new kernel. (Again, make sure you change any 'root=LABEL=/' to 'root=/dev/hda2' or something similar!) Make sure that after your done editing you need to type 'lilo' at the command prompt as root to activate your changes!
When you're done, type 'reboot'.
Log in as root to a console session, and type 'modconf' to configure your modules.