发新话题
打印

[转载]linux2.6.7内核的升级

[转载]linux2.6.7内核的升级

信息来源:邪恶八进制信息安全团队(www.eviloctal.com

一 编译前准备

1)下载
一份内核源代码,我下的是linux-2.6.7.tar.bz2,你可在如下地址下载它或者是更新的版本.
http://kernel.org/pub/linux/kernel/v2.6/

2) 下载
最新版本的module-init-tools( "module-init-tools-3.0.tar.gz" and "modutils-2.4.21-23.src.rpm")
http://www.kernel.org/pub/linux/ker...ools-3.0.tar.gz
http://www.kernel.org/pub/linux/ker...4.21-23.src.rpm

3)
安装module-init-tools. 它会替代depmod [/sbin/depmod]和其他工具.
tar -zxvf module-init-tools-3.0.tar.gz
cd module-init-tools-3.0
./configure --prefix=/sbin
make
make install
./generate-modprobe.conf /etc/modprobe.conf
4)安装modutils-2.4.21-23.src.rpm. 你可能会看到"user rusty and group rusty not existing"的警告. 没关系,你只需强制安装就是了.如果你不对Redhat 9Redhat 8做这几步, 你将会在"make modules_install"这一步时出现问题.
rpm -i modutils-2.4.21-23.src.rpm
rpmbuild -bb /usr/src/redhat/SPECS/modutils.spec
rpm -Fi /usr/src/redhat/RPMS/i386/modutils-2.4.21-23.i386.rpm

5)
解压缩内核源代码.下载的源代码包放到目录/usr/src,然后
cd /usr/src
tar xvfj linux-2.6.7.tar.bz2
cd linux-2.6.7

二、 编译配置

在这一部分涉及几个重要模块的配置请,特别注意.一般用"make menuconfig"命令来配置内核.输入以上命令后出现一个菜单界面,用户可以对需要的模块.下面着重讲几个重要的配置。

1)
文件系统
请务必要选中ext3文件系统,
File systems--->
  • Ext3 journalling file system support
  • Ext3 Security Labels
  • JBD (ext3) debugging support
    以上三项一定要选上,而且要内建(即标*). 这个非常重要,在配置完后一定要检查一下.config文件有没有"CONFIG_EXT3_FS=y"这一项. 如果不是"CONFIG_EXT3_FS=y"而是"CONFIG_EXT3_FS=m",你在运行内核时就会遇上以下错误: pivotroot: pivot_root(/sysroot,/sysroot/initrd) failed

    2)
    网卡驱动
    请务必把自己网卡对应的驱动编译进内核,比较普遍的网卡是realtek 8139,以下就是这种网卡的配置,以供参考
    Device Drivers--->
    Networking support--->
    Ethernet (10 or 100Mbit) --->
    <*> RealTek RTL-8139 C+ PCI Fast Ethernet Adapter support (EXPERIMENTAL)
    <*> RealTek RTL-8139 PCI Fast Ethernet Adapter support

    3)
    声卡驱动
    也要选择自己声卡对应的驱动编译进内核,比较普遍的声卡是i810_audio,以下就是这种声卡的配置,以供参考
    Device Drivers --->
    Sound --->
    <*> Sound card support
    Advanced Linux Sound Architecture --->
    <*> Advanced Linux Sound Architecture
    <*> Sequencer support
    < > Sequencer dummy client
    <*> OSS Mixer API
    <*> OSS PCM (digital audio) API
  • OSS Sequencer API
    <*> RTC Timer support
    PCI devices --->
    <*> Intel i8x0/MX440, SiS 7012; Ali 5455; NForce Audio; AMD768/8111
    Open Sound System --->
    < > Open Sound System (DEPRECATED)
    以上三项配置关系到新内核能否正常运行,请备加注意.其他的配置如果不是很了解,大可以按默认的选择.

    三、 编译过程

    按如下命令编译,大概需要一个多小时,大可以好好放松一下:-)
    make bzImage
    make modules
    make modules_install
    make install

    运行新内核之前,请检查一下/boot/grub/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/hdc3
    # initrd /initrd-version.img
    #boot=/dev/hdc
    default=1
    timeout=10
    splashimage=(hd0,0)/grub/splash.xpm.gz
    title Red Hat Linux (2.6.7)
    root (hd0,0)
    kernel /vmlinuz-2.6.7 ro root=LABEL=/
    initrd /initrd-2.6.7.img
    title Red Hat Linux (2.4.20-8)
    root (hd0,0)
    kernel /vmlinuz-2.4.20-8 ro root=LABEL=/
    initrd /initrd-2.4.20-8.img
    四、 运行内核的常见问题

    1)RPM问题

    进入编译好的内核后,与RPM相关的命令有些不能使用,并出现下列错误:

    rpmdb: unable to join the environment
    error: db4 error(11) from dbenv->open: Resource temporarily unavailable
    error: cannot open Packages index using db3 - Resource temporarily unavailable (11)
    error: cannot open Packages database in /var/lib/rpm
    no packages
    解决方法是执行“export LD_ASSUME_KERNEL =2.2.25”命令,也可以将其写入/etc/bashrc

    2)Sound
    问题
    声音部分的模块名也改变了。我的笔记本原来的声卡驱动是i810_audio,现在已改为snd-intel8x0。因此需要把下面的内容添加到/etc/modprobe.conf中:

    alias char-major-14 soundcore
    alias sound snd-intel8x0
    alias sound-slot-0 snd-intel8x0
    alias snd-card-0 snd-intel8x0
    alias sound-service-0-0 snd-mixer-oss
    alias sound-service-0-1 snd-seq-oss
    alias sound-service-0-3 snd-pcm-oss
    alias sound-service-0-8 snd-seq-oss
    alias sound-service-0-12 snd-pcm-oss
    install snd-intel8x0 /sbin/modprobe --ignore-install sound-slot-0 &&
    { /bin/aumix-minimal -f /etc/.aumixrc -L >/dev/null 2>&1; /bin/true; }
    remove snd-intel8x0
    { /bin/aumix-minimal -f /etc/.aumixrc -S >/dev/null 2>&1; /bin/true; };
    /sbin/modprobe -r --ignore-remove sound-slot-0
    然后执行“modprobe sound”加载声音模块,并使用下列命令检验声卡驱动:
    #cat /proc/asound/cards

    显示结果如下:

    0 [SI7012]: ICH - SiS SI7012
    SiS SI7012 at 0xdc00, irq 11

    3)VMware
    问题

    解决方法是:

    ◆ 将/usr/bin/vmware-config.pl中所有的“/proc/ksyms”替换为“/proc/kallsyms”。使用“sed”命令可以达到这个目的。

    ◆ 重新运行该脚本,使用内核头文件编译新的内核模块。在编译过程中如发生错误,应该进入/usr/lib/vmware/modules/source,使用下面的命令将vmnet.tar解包:

    #tar xvf vmnet.tar

    ◆ 进入vmnet-only目录修改bridge.c文件。将“atomic_add(skb->truesize, &sk->wmem_alloc);”修改为“atomic_add(skb->truesize, &sk->sk_wmem_alloc);”,并用类似的方式将“protinfo”改为“sk_protinfo”

    ◆ 再次把vmnet-only目录用下面的命令重新打包为vmmon.tar

    #tar cvf vmmon.tar vmnet-only


    如果按照上面的操作依旧失败,另一解决方法是到var tagarray = ['逆向工程','IIS','rsa','收集','飘絮','源代码','PeakSharp','隐藏驱动','百度','90hackit','ratproxy','XSS','捆绑','资源','架构','内网','讨论','ms08-067','ms08067','驱动编程','感染','机器狗','DDoS','内核编程','Microsoft','Overflow','WPS','Office','Buffer','Serv-U','DataExplorer','EasyRecovery','Ghost','数据恢复','手机号','属主','猎头','招聘','Oracle','核心溢出'];var tagencarray = ['%E9%80%86%E5%90%91%E5%B7%A5%E7%A8%8B','IIS','rsa','%E6%94%B6%E9%9B%86','%E9%A3%98%E7%B5%AE','%E6%BA%90%E4%BB%A3%E7%A0%81','PeakSharp','%E9%9A%90%E8%97%8F%E9%A9%B1%E5%8A%A8','%E7%99%BE%E5%BA%A6','90hackit','ratproxy','XSS','%E6%8D%86%E7%BB%91','%E8%B5%84%E6%BA%90','%E6%9E%B6%E6%9E%84','%E5%86%85%E7%BD%91','%E8%AE%A8%E8%AE%BA','ms08-067','ms08067','%E9%A9%B1%E5%8A%A8%E7%BC%96%E7%A8%8B','%E6%84%9F%E6%9F%93','%E6%9C%BA%E5%99%A8%E7%8B%97','DDoS','%E5%86%85%E6%A0%B8%E7%BC%96%E7%A8%8B','Microsoft','Overflow','WPS','Office','Buffer','Serv-U','DataExplorer','EasyRecovery','Ghost','%E6%95%B0%E6%8D%AE%E6%81%A2%E5%A4%8D','%E6%89%8B%E6%9C%BA%E5%8F%B7','%E5%B1%9E%E4%B8%BB','%E7%8C%8E%E5%A4%B4','%E6%8B%9B%E8%81%98','Oracle','%E6%A0%B8%E5%BF%83%E6%BA%A2%E5%87%BA'];parsetag();
  • TOP

    发新话题