(原文地址:http://www.cyberciti.biz/tips/compiling-linux-kernel-26.html)How to: Compile Linux kernel 2.6
by NIXCRAFT on SEPTEMBER 29, 2005 · 131 COMMENTS
Compiling custom kernel has its own advantages and disadvantages. However, new Linux user / admin find it difficult to compile Linux kernel. Compiling kernel needs to understand few things and then just type couple of commands. This step by step howto covers compiling Linux kernel version 2.6.xx under Debian GNU Linux. However, instructions remains the same for any other distribution except for apt-get command.
Step # 1 Get Latest Linux kernel code
Visit http://kernel.org/ and download the latest source code. File name would be linux-x.y.z.tar.bz2, where x.y.z is actual version number. For example file inux-2.6.25.tar.bz2 represents 2.6.25 kernel version. Use wget command to download kernel source code:
$ cd /tmp
$ wget http://www.kernel.org/pub/linux/kernel/v2.6/linux-x.y.z.tar.bz2
Note: Replace x.y.z with actual version number.
Step # 2 Extract tar (.tar.bz3) file
Type the following command:
# tar -xjvf linux-2.6.25.tar.bz2 -C /usr/src
# cd /usr/src
Step # 3 Configure kernel
Before you configure kernel make sure you have development tools (gcc compilers and related tools) are installed on your system. If gcc compiler and tools are not installed then use apt-get command under Debian Linux to install development tools.
# apt-get install gcc
Now you can start kernel configuration by typing any one of the command:
$ make menuconfig - Text based color menus, radiolists & dialogs. This option also useful on remote server if you wanna compile kernel remotely.
$ make xconfig - X windows (Qt) based configuration tool, works best under KDE desktop
$ make gconfig - X windows (Gtk) based configuration tool, works best under Gnome Dekstop.
For example make menuconfig command launches following screen:
$ make menuconfig
You have to select different options as per your need. Each configuration option has HELP button associated with it so select help button to get help.
Step # 4 Compile kernel
Start compiling to create a compressed kernel image, enter:
$ make
Start compiling to kernel modules:
$ make modules
Install kernel modules (become a root user, use su command):
$ su -
# make modules_install
Step # 5 Install kernel
So far we have compiled kernel and installed kernel modules. It is time to install kernel itself.
# make install
It will install three files into /boot directory as well as modification to your kernel grub configuration file:
System.map-2.6.25
config-2.6.25
vmlinuz-2.6.25
Step # 6: Create an initrd image
Type the following command at a shell prompt:
# cd /boot
# mkinitrd -o initrd.img-2.6.25 2.6.25
initrd images contains device driver which needed to load rest of the operating system later on. Not all computer requires initrd, but it is safe to create one.
Step # 7 Modify Grub configuration file - /boot/grub/menu.lst
Open file using vi:
# vi /boot/grub/menu.lst
title Debian GNU/Linux, kernel 2.6.25 Default
root (hd0,0)
kernel /boot/vmlinuz root=/dev/hdb1 ro
initrd /boot/initrd.img-2.6.25
savedefault
boot
Remember to setup correct root=/dev/hdXX device. Save and close the file. If you think editing and writing all lines by hand is too much for you, try out update-grub command to update the lines for each kernel in /boot/grub/menu.lst file. Just type the command:
# update-grub
Neat. Huh?
Step # 8 : Reboot computer and boot into your new kernel
Just issue reboot command:
# reboot
分享到:
相关推荐
### 如何编译 Linux 内核 2.6 版本 随着技术的发展与进步,Linux 内核作为操作系统的核心部分,在系统管理、性能优化以及安全性方面起着至关重要的作用。对于想要深入了解 Linux 内核并对其进行定制化的用户来说,...
《Modutils 2.4.27:在嵌入式Linux Kernel 2.6下的编译通过详解》 在Linux操作系统的世界中,模块是内核功能的重要组成部分,它们允许用户根据需要动态加载或卸载内核功能。Modutils是管理这些模块的工具集,它在...
### Linux 2.6 Kernel 移植到 QEMU MIPS 的源代码文档 #### 知识点一:Linux 2.6 内核移植至 QEMU MIPS 的准备工作与环境配置 在进行 Linux 2.6 内核移植到 QEMU MIPS 的过程中,首先需要准备合适的开发环境。根据...
### Linux 2.6 Kernel 移植到 QEMU Mips 的源代码文档 #### 概述 本文档详细介绍了如何将 Linux 2.6 内核移植到 QEMU MIPS 平台上,使得开发者可以在没有实际 MIPS 硬件的情况下进行内核的调试与研究。通过本文档...
内核,是一个操作系统的核心。它负责管理系统的进程、内存、设备驱动程序、文件和网络系统,决定着系统的性能和稳定性...本文将以RedHat Linux 6.0(kernel 2.2.5)为操作系统平台,介绍在Linux上进行内核编译的方法。
**知识点详解:Linux-2.6.32.2内核在mini2440上的移植** 在深入探讨Linux-2.6.32.2内核如何在mini2440开发板上进行移植之前,让我们先了解几个关键概念与步骤。 ### 1. 构建自主开发环境 开发环境的搭建是任何...
### Linux-2.6.14.1内核移植到ARM9平台的详细攻略 #### 标题解析:Linux-2.6.14.1内核移植攻略 标题明确了文章的主要内容是关于如何将Linux-2.6.14.1版本的内核移植到ARM9平台上。Linux-2.6.14.1是一个较早的内核...
标题中的“Samsung Galaxy S: Compile CyanogenMod (Linux)”指的是在Linux操作系统上为Samsung Galaxy S手机编译CyanogenMod的过程。CyanogenMod是一种基于Android开源项目的第三方操作系统,它提供更多的自定义...
标题"compile_protobuf_protobuf:compile_protobuf_"指的是使用protobuf编译器来处理.proto文件的过程。这个过程涉及到将.proto文件编译成特定编程语言(如C++、Java或Python)的源代码,以便在程序中使用protobuf...
**知识点:Linux-2.6.34.1内核移植至UP2440平台** **一、下载源代码** 在进行内核移植前,首先需从官方网站http://www.kernel.org/下载所需版本的内核源代码。本例中采用的是Linux-2.6.34.1版本。下载命令为`wget ...
在本文中,我们将深入探讨如何将Linux内核版本2.6.32.2成功地移植到Mini2440开发板的过程。Mini2440是一款基于S3C2440处理器的嵌入式开发平台,广泛用于教学和项目开发。Linux内核移植是一项复杂但至关重要的任务,...
对于Linux-2.6内核移植,首先从官方FTP下载对应版本的内核源码,然后修改Makefile文件,设置目标架构(ARCH=arm)和交叉编译器路径(CROSS_COMPILE=/usr/local/arm-3.4.1/...)。修改后的Makefile确保编译过程使用...
- 选中`[*] Use the ARM EABI to compile the kernel` - 选中`[*] Allow old ABI binaries to run with this kernel (EXPERIMENTAL)` 2. **Networking**: - 选中`[*] Networking support` - 选中`Networking ...
- This section discusses how to compile and build the Linux kernel image. It covers the necessary tools, configurations, and steps required to create a custom kernel tailored for specific needs. 2. ...
How to build compile server with virtualbox & samba
### Linux-2.6.25.3在S3C2410平台上的移植 #### 一、概述 在嵌入式系统开发过程中,将Linux内核移植到特定硬件平台是一项常见且重要的任务。本篇文章主要介绍了如何将Linux-2.6.25.3这一稳定版本的内核移植到S3C...
在Linux世界中,内核是操作系统的核心部分,它负责管理硬件资源、进程调度、内存管理等关键任务。对于开发者和系统管理员来说,了解并能够编译Linux内核是一项重要的技能。本文将详细介绍如何编译Linux内核,适用于...
### Linux 2.6.30.4 驱动移植详解 #### 一、概述 本文档将详细介绍如何在Linux 2.6.30.4内核下,针对S3C2410处理器进行LCD驱动、触摸屏驱动、网卡驱动以及声卡驱动的移植工作。此移植主要在Ubuntu 8.10操作系统环境...