Welcome 微信登录
编程资源 图片资源库 蚂蚁家优选 PDF转换器

首页 / 操作系统 / Linux / Linux内核简单编译

Linux内核,顾名思义,就是linux系统的核心,负责管理系统的进程、内存、设备驱动程序、文件和网络系统,决定着系统的性能和稳定性。简单的介绍点内核的相关知识,如有不当之处,还请大家批评指正!本文以我实验的系统为例,系统为Red Hat 5.5[root@localhost yum.repos.d]# lsb_release  -a
LSB Version:    :core-3.1-ia32:core-3.1-noarch:graphics-3.1-ia32:graphics-3.1-noarch
Distributor ID: RedHatEnterpriseServer
Description:    Red Hat Enterprise Linux Server release 5.5 (Tikanga)
Release:        5.5
Codename:      Tikanga
######内核的简单介绍###########
在RHEL5.5 Linux系统中内核文件存放的路径是/boot目录下,文件名字为vmlinuz-2.6.18-194.el5[root@localhost boot]# pwd
/boot
[root@localhost boot]# ls
config-2.6.18-194.el5      symvers-2.6.18-194.el5.gz
grub                      System.map-2.6.18-194.el5
initrd-2.6.18-194.el5.img  vmlinuz-2.6.18-194.el5
lost+found
[root@localhost boot]# ll -h vmlinuz-2.6.18-194.el5
-rw-r--r-- 1 root root 1.8M  3?17  2010 vmlinuz-2.6.18-194.el5如何查看内核版本?[root@localhost boot]# uname -r
2.6.18-194.el5
我们来详细分析一下这些数字代表的什么2表示主版本号,其实这点跟目前最新的微信5.0.2是一致的;6是次版本号;18是修正号;-194是redhat对内核官方网站发布的内核版本进行修正的修正号;el5是redhat linux的发行版本,代表的enterprise linux 5 的缩写。#########编译内核##################在编译内核前,关于内核定制的必要性就不必多讲了,无非是给漏洞打补丁或者增加新的功能。编译前,必须要确认gcc环境已经安装好[root@localhost ~]# rpm -qa | grep gcc
libgcc-4.1.2-48.el5
gcc-4.1.2-48.el5
compat-libgcc-296-2.96-138
gcc-gfortran-4.1.2-48.el5
gcc-c++-4.1.2-48.el5如果没有装的话可以yum install  -y  *gcc*  ncurses-devel(这个也是必须的)开始编译1、我们从官网上下载新的内核源码文件包 [root@localhost ~]#  wget https://www.kernel.org/pub/linux/kernel/v2.6/linux-2.6.39.4.tar.bz2 --no-check-certificate[root@localhost ~]# tar xf linux-2.6.39.4.tar.bz2[root@localhost ~]# cd linux-2.6.39.4
[root@localhost linux-2.6.39.4]# pwd
/root/linux-2.6.39.4
[root@localhost linux-2.6.39.4]# ls
arch          fs      MAINTAINERS    security
block          include  Makefile        sound
COPYING        init    mm              tools
CREDITS        ipc      net            usr
crypto        Kbuild  README          virt
Documentation  Kconfig  REPORTING-BUGS
drivers        kernel  samples
firmware      lib      scripts2、配置内核的准备工作 make  mrproper此目的是删除所有此前编译生成的文件和内核配置文件,如果你的内核跟我的一样是刚下载的就不需要执行这一步了;3、配置内核[root@localhost ~]# make menuconfig当输入这个命令时,会自动弹出下面的桌面对话,所以我不确定这个能不能用在ssh远程客户端进行编译。Linux Kernel 的详细介绍:请点这里
Linux Kernel 的下载地址:请点这里推荐阅读:怎样在 Ubuntu 上安装 Linux 3.11 内核 http://www.linuxidc.com/Linux/2013-09/89674.htmUbuntu 13.10 (Saucy Salamander) 内核已升级至 Linux Kernel 3.10 RC5 http://www.linuxidc.com/Linux/2013-06/86110.htmLinux内核参数设置文件sysctl.conf  http://www.linuxidc.com/Linux/2013-08/89384.htm 更多精彩内容请看下一页:http://www.linuxidc.com/Linux/2013-09/90703p2.htm