1. Download the latest kernel from kernel.orgThe kernel comes as a 20 to 30 MB tar.gz or tar.bz2 file. It will decompress to about 200 MB and during the later compilation you will need additional space.
Example:
wget http://www.kernel.org/pub/linux/kernel/v2.4/linux-2.4.19.tar.gz tar zxvf linux-2.4.19.tar.gz cd linux-2.4.19 |
2. Configure the kernel optionsThis is where you select all the features you want to compile into the kernel (e.g. SCSI support, sound support, networking, etc.)
make menuconfig |
make oldconfig
instead of menuconfig. This oldconfig process will carry over your previous settings, and prompt you if there are new features not covered by your earlier .config file. This is the best way to 'upgrade' your kernel, especially among relatively close version numbers. Another possibility is make xconfig
for a graphical version of menuconfig, if you are running X.3. Make dependenciesAfter saving your configuration above (it is stored in the ".config" file) you have to build the dependencies for your chosen configuration. This takes about 5 minutes on a 500 MHz system.
make dep |
4. Make the kernelYou can now compile the actual kernel. This can take about 15 minutes to complete on a 500 MHz system.
make bzImage |
5. Make the modulesModules are parts of the kernel that are loaded on the fly, as they are needed. They are stored in individual files (e.g. ext3.o). The more modules you have, the longer this will take to compile:
make modules |
6. Install the modulesThis will copy all the modules to a new directory, "/lib/modules/a.b.c" where a.b.c is the kernel version
make modules_install |
* In case you want to re-compile...If you want to re-configure the kernel from scratch and re-compile it, you must also issue a couple "make" commands that clean intermediate files. Note that "make mrproper" deletes your .config file. The complete process is:
make mrproper make menuconfig make dep make clean make bzImage make modules make modules_install |
* Installing and booting the new kernelFor the remainder of this discussion, I will assume that you have LILO installed on your boot sector. Throughout this process, always have a working bootable recovery floppy disk, andmake backups of any files you modify or replace. A good trick is to name all new files with -a.b.c (kernel version suffix) instead of overwriting files with the same name, although this is not shown in the example that follows.
On most Linux systems, the kernels are stored in the /boot directory. Copy your new kernel to that location and give it a unique name.
Example:
cp arch/i386/boot/bzImage /boot/vmlinuz-2.4.19 |
cp System.map /boot |
image = /boot/vmlinuz-2.4.19 label = "Linux 2.4.19" |
Tell lilo to read the changes and modify your boot sector:
lilo -v |
Summary of important files created during kernel build:
.config (kernel configuration options, for future reference) arch/i386/boot/bzImage (actual kernel, copy to /boot/vmlinuz-a.b.c) System.map (map file, copy to /boot/System.map) /lib/modules/a.b.c (kernel modules)
No comments:
Post a Comment