Size: 2538
Comment:
|
Size: 3686
Comment:
|
Deletions are marked like this. | Additions are marked like this. |
Line 5: | Line 5: |
* Download your tarball from ftp.XX.kernel.org where XX is your country code. If there isn't a mirror for your country, just pick a near one. | * Download your tarball from the index page at http://kernel.org , which links to the latest versions. If you are using FTP, go to ftp.kernel.org/pub/linux/kernel/[version] -- these subdirectories all contain an empty file named LATEST_IS_[version] to help you find the latest. Kernel.org has almost-complete kernel archives back to version 0.99 if you're feeling really adventurous. |
Line 8: | Line 8: |
bzip2 -dc linux-2.6.0.tar.bz2 | tar xvf - | tar xivf linux-2.6.0.tar.bz2 |
Line 10: | Line 10: |
(Replace bzip2 with gzip if you downloaded the .gz) | (Replace xivf with xzvf if you downloaded the .gz) |
Line 16: | Line 16: |
(Useful only if you kept a .config from a previous kernel build) |
(Useful only if you kept a .config from a previous kernel build. With the newest kernels, the .config of the currently-running kernel is used by default if it's available, so you usually won't need this feature.) |
Line 30: | Line 29: |
* Wait. When its finished, it will have build both the kernel (bzImage) and the modules (for older kernels like 2.4.x, you need to run "make bzImage ; make modules"). | * Wait. When its finished, it will have built both the kernel (bzImage) and the modules (for older kernels like 2.4.x, you need to run "make bzImage ; make modules"). |
Line 39: | Line 38: |
cp arch/i386/boot/bzImage /boot/vmlinuz-2.6.0 cp System.map /boot/System.map-2.6.0 |
make install |
Line 42: | Line 40: |
If your distribution uses '''lilo''': |
|
Line 50: | Line 50: |
* Run /sbin/lilo, reboot, and enjoy. | |
Line 51: | Line 52: |
* Run /sbin/lilo, reboot, and enjoy. If you get modversion problems (symbols ending in _Rxxxxxxxx), have a look at [http://www.tux.org/lkml/#s8-8 this question] in the linux-kernel mailing list FAQ to solve the problem. | If your distribution uses '''grub''': * Edit /boot/grub/grub.conf: {{{ title=Linux 2.6.0 root (hd0,1) # or whatever your current root is kernel /boot/vmlinuz-2.6.26 root=/dev/hda1 # or whatever... }}} * Most distributions have an installation routine that links a new ''/boot/vmlinuz-[version]'' to simply ''vmlinuz'', so you may want to add a stanza like this to grub.conf: {{{ title=My very latest kernel install root (hd0,1) # or whatever your current root is kernel /boot/vmlinuz root=/dev/hda1 # or whatever... }}} This will let you boot fresh kernels for testing without constantly editing grub.conf. ''Note: This will work for lilo, too, but you still have to run /sbin/lilo after every install.'' If you get modversion problems (symbols ending in _Rxxxxxxxx), have a look at [http://www.tux.org/lkml/#s8-8 this question] in the linux-kernel mailing list FAQ to solve the problem. |
How do I compile a kernel?
(These instructions assume we are installing version 2.6.0 of the kernel, replace all instances with the version you are trying to build. These instructions are also x86-specific; other architecture's build procedures may differ.)
Download your tarball from the index page at http://kernel.org , which links to the latest versions. If you are using FTP, go to ftp.kernel.org/pub/linux/kernel/[version] -- these subdirectories all contain an empty file named LATEST_IS_[version] to help you find the latest. Kernel.org has almost-complete kernel archives back to version 0.99 if you're feeling really adventurous.
- Unpack the tarball in your home directory
tar xivf linux-2.6.0.tar.bz2
- (Replace xivf with xzvf if you downloaded the .gz)
- cd into the linux directory. You'll now need to configure the kernel to select the features you want/need. There are several ways to do this..
- make config
- Command line questions.
- make oldconfig
- (Useful only if you kept a .config from a previous kernel build. With the newest kernels, the .config of the currently-running kernel is used by default if it's available, so you usually won't need this feature.)
- make menuconfig
- (ncurses based)
- make gconfig
- (GTK+ based X-Windows configuration)
- make xconfig
- (QT based X-Windows configuration)
- make config
- Now we can build the kernel (for older kernel like 2.4.x first build the dependencies with "make dep").
make
- Wait. When its finished, it will have built both the kernel (bzImage) and the modules (for older kernels like 2.4.x, you need to run "make bzImage ; make modules").
- Become root to be able to install modules and kernel. Everything before this point can and should be done as a normal user, there is really no need to be root to compile a kernel. It's actually a very bad idea to do everything as root because root is too powerful, one single mistake is enough to ruin your system completely.
- Install the modules.
make modules_install
- Install the new kernel..
make install
If your distribution uses lilo:
- Edit /etc/lilo.conf, and add these lines...
image = /boot/vmlinuz-2.6.0 label = 2.6.0
- Also copy your root=/dev/??? line here too.
- Run /sbin/lilo, reboot, and enjoy.
If your distribution uses grub:
- Edit /boot/grub/grub.conf:
title=Linux 2.6.0 root (hd0,1) # or whatever your current root is kernel /boot/vmlinuz-2.6.26 root=/dev/hda1 # or whatever...
Most distributions have an installation routine that links a new /boot/vmlinuz-[version] to simply vmlinuz, so you may want to add a stanza like this to grub.conf:
title=My very latest kernel install root (hd0,1) # or whatever your current root is kernel /boot/vmlinuz root=/dev/hda1 # or whatever...
- This will let you boot fresh kernels for testing without constantly editing grub.conf.
Note: This will work for lilo, too, but you still have to run /sbin/lilo after every install.
If you get modversion problems (symbols ending in _Rxxxxxxxx), have a look at [http://www.tux.org/lkml/#s8-8 this question] in the linux-kernel mailing list FAQ to solve the problem.
Still not getting it? Try this [http://www.digitalhermit.com/linux/Kernel-Build-HOWTO.html more indepth tutorial]
["CategoryFAQ"]