Chinaunix首页 | 论坛 | 博客
  • 博客访问: 94791
  • 博文数量: 42
  • 博客积分: 2510
  • 博客等级: 少校
  • 技术积分: 480
  • 用 户 组: 普通用户
  • 注册时间: 2009-03-16 13:39
文章分类

全部博文(42)

文章存档

2011年(1)

2010年(6)

2009年(35)

我的朋友

分类: LINUX

2009-10-29 15:02:54

RedHat 4(2.6.26)内核编辑
老系统环境:Linux 2.6.9-89.ELsmp
需要编辑的内核版本:Linux 2.6.26
说明:在编辑过程中对老系统中的应用没有任何影响,只是最后需要重启有点影响
具体步骤:
[root@localhost ~]# uname -a
Linux localhost.localdomain 2.6.9-89.ELsmp #1 SMP Mon Apr 20 10:34:33 EDT 2009 i686 i686 i386 GNU/Linux
[root@localhost src]# mv linux-2.6.26.tar.bz2 /usr/src/
[root@localhost src]# tar -jxvf linux-2.6.26.tar.bz2
[root@localhost src]# ls
kernels  linux-2.6.26  linux-2.6.26.tar.bz2  redhat
[root@localhost src]# cd linux-2.6.26
[root@localhost linux-2.6.26]# make mrproper 确保源代码目录下没有不正确的.o文档连同文档的互相依赖,为创建新的内和配置做好准备
[root@localhost linux-2.6.26]# make menuconfig --配置内核

选择Enable Loadable Module support,其它默认不变,回车后出现如下

上图中一定选择Module unloading和Automatic kernel module loading这两项,其他默认不变,然后按ESC键盘回到上一菜单如下图
上图中选择Processor type and features,,其它默认不变,回车后,出现如下图
上图中选择Preemption Model,其它默认不变,回车后,出现如下图
 
上图中选择Preemptible Kernel选项,其它默认不变,按两次ESC后回到如下菜单
上图选择Device Drivers,其它默认保持不变,回车后出现如下图
上图中选择Block devices,其它默认保持不变,按回车后出现如下图
上图中选择Loopback device support和RAM disks,按ESC回到如下图

选择Multiple device ...support(RAID and LVM),其它默认保持不变,回车后出现如下图
上图中选择Device mapper support,其它默认保持不变,按ESC后出现如下图
上图中选择Input device support,其它默认保持不变,回车后出现如下图
上图中选择keyboards和mice,其它默认保持不变,按ESC后出现如下图
上图中滚动上下键,可选择Graphics support,其它默认保持不变,回车后出现如下图
上图中选择Support for frame buffer devices,其它默认保持不变,按ESC回到如下图
上图中滚动上下键,选择USB Support的所有内容,其它默认保持不变,按ESC回到如下图
在上图中的file systems中找到对NTFS的支持项
上图中选择DOS/FAT/NT Filesystems,其它默认保持不变,回车后出现
上图中选择所有和NTFS有关的,其它默认保持不变,按ESC直到出现如下图
按Yes,即可成功推出并保存
[root@localhost linux-2.6.26]# make
[root@localhost linux-2.6.26]# make modules_install  ---在您进行配置的过程中,在回答Enable loadable module support (CONFIG_MODULES)时选了“Yes”才是必要的
                                                        其作用是将模块拷贝到需要的目录中。
INSTALL sound/pci/vx222/snd-vx222.ko
  INSTALL sound/pci/ymfpci/snd-ymfpci.ko
  INSTALL sound/synth/emux/snd-emux-synth.ko
  INSTALL sound/synth/snd-util-mem.ko
  INSTALL sound/usb/snd-usb-audio.ko
  INSTALL sound/usb/snd-usb-lib.ko
  INSTALL sound/usb/usx2y/snd-usb-usx2y.ko
  DEPMOD  2.6.26
[root@localhost linux-2.6.26]# make install         --复制内核和System.map及修改Grub.conf
sh /usr/src/linux-2.6.26/arch/x86/boot/install.sh 2.6.26 arch/x86/boot/bzImage System.map "/boot"
WARNING: No module mptscsi found for kernel 2.6.26, continuing anyway
[root@localhost linux-2.6.26]# cd /boot
[root@localhost boot]# ls
System.map                 config-2.6.9-89.EL     initrd-2.6.9-89.EL.img     message                    vmlinuz
System.map-2.6.26          config-2.6.9-89.ELsmp  initrd-2.6.9-89.ELsmp.img  message.ja                 vmlinuz-2.6.26
System.map-2.6.9-89.EL     grub                   lost+found                 symvers-2.6.9-89.EL.gz     vmlinuz-2.6.9-89.EL
System.map-2.6.9-89.ELsmp  initrd-2.6.26.img      memtest86+-1.26            symvers-2.6.9-89.ELsmp.gz  vmlinuz-2.6.9-89.ELsmp
[root@localhost boot]# more /etc/grub.conf
# grub.conf generated by anaconda
#
# Note that you do not have to rerun grub after making changes to this file
# NOTICE:  You have a /boot partition.  This means that
#          all kernel and initrd paths are relative to /boot/, eg.
#          root (hd0,0)
#          kernel /vmlinuz-version ro root=/dev/rootvg/rootlv
#          initrd /initrd-version.img
#boot=/dev/sda
default=1
timeout=5
splashimage=(hd0,0)/grub/splash.xpm.gz
#hiddenmenu       ---一定要注释这里,否则启动时在grub里只可看到Red Hat Enterprise Linux AS (2.6.9-89.ELsmp)这个
title Red Hat Enterprise Linux AS (2.6.26)
        root (hd0,0)
        kernel /vmlinuz-2.6.26 ro root=/dev/rootvg/rootlv rhgb quiet
        initrd /initrd-2.6.26.img
title Red Hat Enterprise Linux AS (2.6.9-89.ELsmp)
        root (hd0,0)
        kernel /vmlinuz-2.6.9-89.ELsmp ro root=/dev/rootvg/rootlv rhgb quiet
        initrd /initrd-2.6.9-89.ELsmp.img
title Red Hat Enterprise Linux AS-up (2.6.9-89.EL)
        root (hd0,0)
        kernel /vmlinuz-2.6.9-89.EL ro root=/dev/rootvg/rootlv rhgb quiet
        initrd /initrd-2.6.9-89.EL.img
[root@localhost boot]#reboot
会发现grub.conf里多出一个内核,如下图中的2.6.26
选择2.6.26 启动后则就可以进入到自己编译的内核中了
[root@localhost ~]# uname -a
Linux localhost.localdomain 2.6.26 #1 SMP PREEMPT Wed Oct 21 02:54:59 CST 2009 i686 i686 i386 GNU/Linux
经过检查发现内核版本确实和以前不一样,说明编辑成功
 
make mrproper 为创建新的内和配置做好准备
make menuconfig 进行配置
make dep 检测是否有相关的软件包被使用
make clean 为新内核结构准备源目录树
make bzImage 创建内核引导映像
make modules、make modules_install 生成模块
阅读(875) | 评论(0) | 转发(0) |
给主人留下些什么吧!~~