This guide is how I custom compiled my kernel. My installation of FC4 can be found on my Personal Fedora Core 4 Installation Guide. Similar versions of this guide can be found for FC3, FC2. This page involves technical and involved processes. Keep in mind this works for me, so take care in doing proper backups to critical files whenever trying something.
Compiling your own kernel will allow you to thoroughly tweak your linux system. This involves add/remove various features that may or may not work or speeding up your system.
My system is an Athlon XP system with an NVidia video card, I use no extra kernel patches or drivers other than the Nvidia driver.
You will need about 350-450MB of free space on your system.
The official kernel provided on kernel.org is often referred to as a vanilla kernel, while most distributions modify their kernel. This is true for Redhat, Fedora, SuSE, etc. The modified distribution kernels usually have patches installed, which can change functionality. Some hardware may require unpatched kernels to work. For this guide I am compiling BOTH a vanilla kernel AND a Fedora kernel. Use whichever you find suitable.
I use the Fedora kernel source RPM to provide me with .config files to compile the kernel. Regardless of which kernel I compile, I usually keep a copy of the Fedora kernel source installed.
Verify you have a FC4 kernel.src.rpm properly installed. Install as stated in FC4: Install Kernel Source.
For convenience move the Fedora kernel source to /usr/src/.
[root@charon src]# cd /usr/src [root@charon src]# mv /usr/src/redhat/BUILD/kernel-2.6.11/linux-2.6.11 /usr/src/linux-2.6.11
If you wish to compile a vanilla kernel, obtain the latest 2.6 kernel source (FC4 uses a 2.6 based kernel) from kernel.org. Please make sure to use a mirror.
The latest stable version of the Linux kernel is: 126.96.36.199 2005-06-22 22:00 UTC
As root decompress it to /usr/src/
[root@charon download]# bzip2 -cd linux-188.8.131.52.tar.bz2 | tar xvf - -C /usr/src/
Change to the new kernel directory
[root@charon download]# cd /usr/src/linux-184.108.40.206/
If you wish to apply some kernel patch, do so before the next step. As an example:
[root@charon linux-220.127.116.11]# patch -p0 < kernel.patch
Put the kernel source in a proper/clean state:
[root@charon linux-18.104.22.168]# make mrproper
Note: Regardless of which kernel you are compiling make sure to have softlinks set up properly to use /usr/src/linux. This guide will perform all operations from there. You CANNOT link 2 directories to the same softlink.
[root@charon ~]# cd /usr/src/ [root@charon src]# pwd /usr/src (for Fedora kernel) [root@charon src]# ln -s linux-2.6.11 linux (for vanilla kernel) [root@charon src]# ln -s linux-22.214.171.124 linux
The .config file contains EVERYTHING specific to the kernel you compile. You must have a starting .config file or it will be too difficult to select the right set of options.
Use the previous Fedora .config file from the fedora kernel.src.rpm, this will be your starting point for customizing the kernel.
Some terms: SMP: Symetric Multiprocessor (2 cpu or more), PPC: Motorola PowerPC, x86_64: Athlon 64, xen: for Xen virtualization. Make sure you match what you use or want.
[root@charon src]# ls /usr/src/redhat/BUILD/kernel-2.6.11/linux-2.6.11/configs/ kernel-2.6.11-i586.config kernel-2.6.11-ppc64iseries.config kernel-2.6.11-i686.config kernel-2.6.11-ppc.config kernel-2.6.11-i686-smp.config kernel-2.6.11-ppc-smp.config kernel-2.6.11-i686-xen0.config kernel-2.6.11-s390.config kernel-2.6.11-i686-xenU.config kernel-2.6.11-s390x.config kernel-2.6.11-ia64.config kernel-2.6.11-x86_64.config kernel-2.6.11-ppc64.config kernel-2.6.11-x86_64-smp.config [root@charon src]# uname -m i686 [root@charon src]# cd /usr/src/linux [root@charon linux]# cp /usr/src/redhat/BUILD/kernel-2.6.11/linux-2.6.11/configs/kernel-2.6.11-i686.config .config
Note: If there is an existing .config file there but you did NOT create it, you CAN overwrite it.
Note: If you have another kernel source, either from another
RPM or a previously downloaded kernel source, you can use that .config
instead of Fedora's. For example:
[root@charon linux]# cp /usr/src/linux-2.6.10/.config /usr/src/linux/.config
As an option you can change the EXTRA name attached to the end of the kernel, for example: 1.1369_FC4. Open /usr/src/linux/Makefile in any editor (gedit, kwrite, nano, etc.), and go to line 4.
For Fedora kernel: EXTRAVERSION = -prep For vanilla kernel: EXTRAVERSION = .1
You can change this value to ANYTHING you like. The result will be that yourkernel name will be something like: 2.6.11-prep or 126.96.36.199. Sometimes for testing I use -mjm. Make sure you note any change when you install the Nvidia driver below.
Bring the .config file up to date to match the new kernel. This will prompt for many new options. If you know what they are, answer them correctly. Otherwise just hit [Enter]. It is okay if you see no prompts.
[root@charon linux]# make oldconfig
Once done, configure all the necessary options in the kernel by using any of the following:
text based questions: make config text based GUI: make menuconfig GTK based GUI: make gconfig QT based GUI: make xconfig (recommended)
Note: You must have the qt-devel RPM installed to run make xconfig.
Disable or enable anything that you may or may not want. Be VERY CAREFUL when changing things with which you are unfamiliar. If you do not know what it is, leave it to the default value. Some things I personally change:
* Processor type and features (IMPORTANT) - Processor family: Athlon/Duron/K7 (MK7) * Power management options (ACPI, APM) - Enable: Software Suspend - Disable: CPU Frequency scaling (my Athlon does not support this) * Hardware I DO NOT have or I cannot add. I disable ALL of these: - PCCARD (PCMCIA/CardBus) support - PCI Hotplug Support - Memory Technology Devices (MTD) - Fusion MPT device support - IEEE 1394 (FireWire) support - Amateur Radio Support - Bluetooth subsystem support - Token Ring devices - ATM drivers - ISDN subsystem - Watchdog Cards - Digital Video Broadcasting Devices - InfiniBand support * Some things I stronly recommend: - "File systems > DOS/FAT/NT Filesytems > NTFS file system support (NTFS_FS)" (do NOT enable NTFS read/write) - Things like "NFS", "SMB" and "CIFS" are needed to allow for things like network file access (Samba, etc.) * Kernel Hacking and Kernel Debugging -Disable Kernel debugging (DEBUG_KERNEL) This should NOT be set, but I found it set, make sure to disable. The kernel will be VERY LARGE if you leave this.
Note: IF you are updating from a RECENT kernel (ex: 2.6.10 to 2.6.11) AND you copied your .config correctly then most of these changes will be set and you need only to verify NEW features.
Save the .config, and compile.
This step may take between 15min - 2hours depending on the speed of your system.
[root@charon linux]# make all
If that did not work, research the error and try to disable the troublesome module or feature in the Configure step above. If that worked correctly install it.
[root@charon linux]# make modules_install [root@charon linux]# make install
You must install the Nvidia driver to the new kernel otherwise the X-server will not start once you reboot into your new kernel.
Obtain the EXACT SAME Nvidia driver that you installed in your current FC4 that you are using (FC4: Nvidia Driver). The following tells the installer to compile the Nvidia driver for your NEW kernel.
[root@charon fc4]# sh NVIDIA-Linux-x86-1.0-7667-pkg1.run -a -n -K -k [KERNEL_NAME]
You must first know the kernel name from above. If you used the Fedora kernel this will be whatever was set in the Makefile above, ex: 2.6.11-prep. If you used the vanilla kernel this will be the version number, ex: 188.8.131.52. If you cannot figure it out, look in /lib/modules/.
[root@charon fc4]# ls /lib/modules/ 2.6.11-1.1369_FC4 2.6.11-prep 184.108.40.206 (for Fedora kernel) [root@charon fc4]# sh NVIDIA-Linux-x86-1.0-7667-pkg1.run -a -n -K -k 2.6.11-prep (for vanilla kernel) [root@charon fc4]# sh NVIDIA-Linux-x86-1.0-7667-pkg1.run -a -n -K -k 220.127.116.11
To verify the Nvidia module before rebooting, use modinfo. I have both outputs listed below:
[root@charon fc4]# modinfo -F vermagic /lib/modules/2.6.11-prep/kernel/drivers/video/nvidia.ko 2.6.11-prep K7 REGPARM gcc-4.0 [root@charon fc4]# modinfo -F vermagic /lib/modules/18.104.22.168/kernel/drivers/video/nvidia.ko 22.214.171.124 K7 REGPARM gcc-4.0
Note: If the above method does not work for you or you find you have DIFFERENT versions of the Nvidia driver, then you should use the instructions found on my FC3 Kernel Notes (read and scroll near the end). The difference is you force the X-server NOT to start when you reboot into the new kernel, then you manually install the driver.
Reboot into your new kernel, but before you do, make sure you have the Nvidia driver (or any other driver) easy to access. If it fails to boot into the new kernel, read the data provided in the error and go back to your previous kernel. Go to the Configure step and try to change the device or feature that may have caused the problem.
Once in the new kernel, any other drivers that you may have been added should be re-installed. EVERY driver that did not come default in the kernel or in Fedora, will most likely require re-installation.
To set the default to the new kernel, edit /boot/grub/grub.conf. Chance the line: default=1 to default=0. This maybe slightly different per each computer.
Help Out: If you found this guide or any Resource helpful, please consider supporting this site by recommending this page to others or linking to this page. I appreciate all the support I receive. Thank you in advance.
Disclaimer: The author makes no claim to the accuracy of the information provided. This information is provided in the hope that it will be useful, but WITHOUT ANY WARRANTY. There is no implied support from referencing this guide. Any help that is provided is at will. Use this information at your own risk. Always make proper backups and use caution when modifying critical system files.
PLEASE DO NOT mirror, translate or duplicate this page without contacting me.
Copyright © 2003-2013 by Mauriat Miranda (mjmwired.net).