linux-2.6内核升级文档全

来源:网络  作者:网络转载   2019-10-08 阅读:392

做一件事情,首先要知道自己在干什么,而不是盲目得升级内核,现在升级内核有点泛滥,sigh       首先让我们先了解一下2.6内核的新特性       一、01.模块子系统(Module Subsystem)、统一设备模型(Unified Device Model)和 PnP 支持       模块子系统发生了重大变化。           02.稳定性有所提高           为了彻底避免内核加载或者导出正在被使用的内核模块,或者至少为了减少加载或者卸载模块的同时使用该模块的可能性       (这有时会导致系统崩溃),内核加载和导出内核模块的过程都得到了改进。           03.统一设备模型       统一设备模型的创建是 2.6 内核zui重要的变化之一。它促进了模块接口的标准化,其目的是更好地控制和管理设备,例如:               更准确地确定系统设备。       电源管理和设备电源状态。       改进的系统总线结构管理。           04.即插即用(PnP)支持           1.1.1 和 1.1.2 小节中提及的变化使得运行 2.6 内核的 LINUX 成为一个真正即插即用的 OS。       例如,对 ISA PnP 扩展、 MCA 和 EISA 总线以及热插拔设备的 PnP 支持。           05.内核基础设施的变化                     为了区别以 .o 为扩展名的常规对象文件,内核模块现在使用的扩展名是 .ko。       创建了新的 sysfs 文件系统,当内核发现设备树时就会描述它。       内存支持,NUMA 支持       支持更大数量的 RAM              2.6 内核支持更大数量的 RAM,在分页模式下zui高可达 64GB。           06.NUMA       对非一致内核访问(Non-Uniform Memory Access - NUMA)系统的支持是 2.6 内核中新出现的。           07.线程模型,NPTL       相对于 v2.4 的 LinuxThreads,在版本 2.6 中新出现的是 NPTL(Native POSIX Threading Library)。        NPTL 为 Linux 带来了企业级线程支持,提供的性能远远超过了 LinuxThreads。它所基于的用户与内核线程的比率是 1:1。              在 2003 年 10 月,GNU C 程序库 glibc 中融入了 NPTL 支持,Red Hat 在 Red Hat Linux 9 和        Red Hat Enterprise Linux 中使用定制的 v2.4 内核实现了 NPTL。           08.性能改进              新的调度器算法           2.6 Linux 内核引入了新的 O1 算法。在高负载情况下它运行得特别好。新的调度器基于每个 CPU 来分布时间片,       这样就消除了全局同步和重新分配循环,从而提高了性能。              内核抢占(Kernel Preemption)       新的 2.6 内核是抢占式的。这将显著地提高交互式和多媒体应用程序的性能。              I/O 性能改进           Linux 的 I/O 子系统也发生了重大的变化,通过修改 I/O 调度器来确保不会有进程驻留在队列中过长时间等待进行输入/输出操作,       这样就使得 I/O 操作的响应更为迅速。              快速用户空间互斥(Fast User-Space Mutexes)          “futexes”(快速用户空间互斥)可以使线程串行化以避免竞态条件,引入它也提高了响应速度。       通过在内核空间中部分实现“futexes”以允许基于竞争设置等待任务的优先级而实现改进。

    09.扩展性改进              处理器数目更多       Linux 内核 2.6 zui多可以支持 64 个 CPU。支持更大的内存,归功于 PAE(物理地址扩展,Physical Address Extensions),在 32-位系统上分页模式下所支持的内存增加到了 64GB。

       用户和组       惟一用户和组的数量从 65,000 增至 40 多亿,也就是从 16-位增加到了 32-位。

       PID 的数量       PID 的zui大数量从 32,000 增至 10 亿。

       打开文件描述符的数量       打开文件描述符的数量没有增加,但是不再需要事先设置该参数,它将自行调节。

    10.支持更多的设备           在 Linux 内核 2.6 之前,内核中有可以约束大型系统的限制,比如每条链 256 个设备。v2.6 内核彻底地打破了这些限制,       不但可以支持更多类型的设备,而且支持更多同类型的设备。在 Linux 2.6 系统中,可以支持 4095 种主要的设备类型,       每一个单独的类型可以有超过一百万个子设备。       文件系统大小       Linux 内核 2.6 所允许的可寻址文件系统大小zui大为 16 TB。

    11.文件系统           ext2、ext3 和 ReiserFS 等传统 Linux 文件系统得到了显著的改进。zui值得注意的改进是扩展属性(或文件元数据)的引入。       zui重要的是 POSIX ACL 的实现,这是对普通 UNIX 权限的扩展,可以支持更细化的用户访问控制。           12.除了对传统 Linux 文件系统的改进支持以外,新的内核完全支持在 Linux 中相对较新的 XFS 文件系统。              Linux 2.6 内核现在还引入了对 NTFS 文件系统的改进的支持,现在允许以读/写模式安装 NTFS 文件系统。

    基于以上2.6的新特性,我决定用2.6的内核,我的系统为Red Hat Enterprise Linux AS release 3 Taroon Update 3硬件环境为DELL 2850

一、下载解压并打上内核补丁我以2.6.10为例子,patche以bk4的例子,目的只是让大家知道怎么打patch,其实本人用的是2.6.6的内核,因为在AS3.0上升级到2.6.9以上的内核,mount大的nfs网络硬盘时,df 显示不正确,明明是800G的盘变成4.2G,不过还是能正常用,我升级过nfs和mount的包都没用,/var/log/message里提示是kernel: nfs warning: mount version older than kernel,还望知道的 告知一声,谢 :    BTW:2.6.8的内核没用过

    内核源代码:/pub/linux/kernel/v2.6/linux-2.6.10.tar.bz2    zui新内核补丁:/pub/linux/ ... atch-2.6.10-bk4.bz2

    cd /usr/src    rm -rf linux    tar jxf /download/linux-2.6.10.tar.bz2    ln -s linux-2.6.10 linux    cd linux    bunzip2 -dv /download/patch-2.6.10-bk4.bz2 |patch -p1    如果在/usr/src目录下就用patch -p0

二、修改内核源代码 升级2.6就是为了优化,干脆连源代码也改了吧       1.修改/usr/src/linux/include/linux/posix_types.h       设置fd_set支持的zui大数量        #define __FD_SETSIZE 1024 --->; 65536             2.修改/usr/src/linux/include/linux/fs.h       设置zui大打开文件数量(TCP连接数量)      #define INR_OPEN 1024 --->; 65536       #define NR_FILE 8192 --->; 65536       #define NR_RESERVED_FILES 10 --->; 128          3.修改/usr/src/linux/include/net/tcp.h       设置TIMEOUT的时间为1秒      #define TCP_TIMEWAIT_LEN 60*HZ 60 --->; 1*HZ       设置在backlog队列里的半连接的重试次数,每次都会花相应的时间,本质上 也是减少重试时间       #define TCP_SYNACK_RETRIES  5 --->; 3

针对RHEL-AS3本来就是稳定+优化的,不过就算你用 RHEL-AS3 自己的内核,那也要修改一下上面的参数才好呀 :

三、安装必要的工具

    1.下载module-init-tools-3.1.tar.bz2  /pub/linux/ ... t-tools-3.1.tar.bz2CODE:[Copy to clipboard]        ./configure --prefix=/        make moveold        make all install        ./generate-modprobe.conf /etc/modprobe.conf2.下载新的mkinitrd   ftp://195.220.108.108/linux/6/fe ... d-4.1.18-2.i386.rpm它需要lvm2 device-mapperftp://195.220.108.108/linux/6/fe ... -1.00.19-2.i386.rpmftp://195.220.108.108/linux/6/fe ... 00.25-1.01.i386.rpm如果不更新这个包在make install时会提示以下错误:CODE:[Copy to clipboard]        No module mptbase found for kernel 2.6.10-bk4, aborting.        mkinitrd failed        make[1]: *** [install] Error 1        make: *** [install] Error 2安装lvm2-2.00.25-1.01.i386.rpm时请用rpm -ivh --nodeps package name

四、make menuconfigCODE:[Copy to clipboard]01.Code maturity level options         --->;        [*] prompt for development and/or incomplete code/drivers                          [*]   Select only drivers expected to compile cleanly                                02.General setup  --->;        [*] Support for paging of anonymous memory swap                              [*] System V IPC                                                                         [*] POSIX Message Queues                                                                 [ ] BSD Process Accounting                                                              [*] Sysctl support                                                                         [ ] Auditing support                                                                        [ ] Support for hot-pluggable devices                                                       [*] Kernel Userspace Events                                                                [ ] Kernel .config support                                                                 [*] Configure standard kernel features for small systems  --->;                 [*]   Load all symbols for debugging/kksymoops                                                      [ ]     Do an extra kallsyms pass                                                                   [*]   Enable futex support                                                                          [*]   Enable eventpoll support                                                                      [ ]   Optimize for size                                                                             [*]   Use full shmem filesystem    03.Loadable module support  --->;                 [*] Enable loadable module support                                                 [*]   Module unloading                                                                [ ]     Forced module unloading                                                      [ ]   Module versioning support EXPERIMENTAL                                       [ ]   Source checksum for all modules                                                [*]   Automatic kernel module loading     04.Processor typefeatures  --->;             Subarchitecture Type PC-compatible  --->;              Processor family Pentium-4/CeleronP4-based/Pentium-4 M/Xeon  --->;          [*] Generic x86 support                                           [ ] HPET Timer Support                                            [*] Symmetric multi-processing support      多CPU                      8   Maximum number of CPUs 2-255                              [*]   SMT Hyperthreading scheduler support                      [*] Preemptible Kernel                     抢占式内核,请选上它           [ ] Machine Check Exception                                       < >; Toshiba Laptop support                                        < >; Dell laptop support                                           < >; /dev/cpu/microcode - In IA32 CPU microcode support         < >; /dev/cpu/*/msr - Model-specific register support              < >; /dev/cpu/*/cpuid - CPU information support                        Firmware Drivers  --->;                                            High Memory Support 4GB  --->;         高内存                     [ ] Allocate 3rd-level pagetables from highmem                    [ ] Math emulation                                                [*] MTRR Memory Type Range Register support                     [*] Enable kernel irq balancing                                   [ ] Use register arguments EXPERIMENTAL           05.Power management options ACPI, APM  --->;    电源管理 自定 偶没选     06.Bus options PCI, PCMCIA, EISA, MCA, ISA  --->; 板卡支持  自定        [*] PCI support                                                                           PCI access mode Any  --->;                                                       [ ] Message Signaled Interrupts MSIMSI-X                                        [*] Legacy /proc/pci interface                                                            [*] PCI device name database                                                              [ ] ISA support                                                                           [ ] MCA support                                                                           < >; NatSemi SCx200 support    07.Executable file formats  --->;        [*] Kernel support for ELF binaries                                                       ; Kernel support for a.outECOFF binaries                                          ; Kernel support for MISC binaries           08.Device Drivers  --->;   设备驱动及网络支持              Generic Driver Options  --->;  默认            [*] Select only drivers that don''t need compile-time external firmware                                [*] Prevent firmware from being built                                             Memory Technology Devices MTD  --->;  不选              Parallel port support  --->;    并行端口   自定偶没选               PlugPlay support  --->;    支持热插拔 自定偶没选              Block devices  --->;            <*>; Normal floppy disk support                                                 < >; Compaq SMART2 support                                                      < >; Compaq Smart Array 5xxx support                                            < >; Mylex DAC960/DAC1100 PCI RAID Controller support                           < >; Micro Memory MM5415 Battery Backed RAM support EXPERIMENTAL              ; Loopback device support                                                    < >;   Cryptoloop Support                                                       ; Network block device support                                               < >; Promise SATA SX8 support                                                   ; RAM disk support                                                           16  Default number of RAM disks                                              4096 Default RAM disk size kbytes                                            Source directory of cpio_list                                              [ ] Support for Large Block Devices                                            < >; Packet writing on CD/DVD media                                                  IO Schedulers  --->;   IO调度器,都选上吧 可以在grub.conf指定用IO调度哪种方式,后面会讲的                                                  <*>; Anticipatory I/O scheduler                                                  <*>; Deadline I/O scheduler                                                      <*>; CFQ I/O scheduler                         ATA/ATAPI/MFM/RLL support  --->;   ATA设备 自定 偶没选              SCSI device support  --->;       SCSI设备 自定我有scsi的设备所以有以下选项            <*>; SCSI device support                                                                            [*]   legacy /proc/scsi/ support                                                                    ---   SCSI support type disk, tape, CD-ROM                                                        <*>;   SCSI disk support                                             因为偶式MPT的SCSI,所以以下都没选,省略之              Multi-device support RAIDLVM  --->;  支持RAID和LVM逻辑卷  自定            [*] Multiple devices driver support RAIDLVM                   <*>;   RAID support                                                   < >;     Linear append mode                                         <*>;     RAID-0 striping mode                                       < >;     RAID-1 mirroring mode                                      < >;     RAID-10 mirrored striping mode EXPERIMENTAL              <*>;     RAID-4/RAID-5 mode                                           < >;     RAID-6 mode EXPERIMENTAL                                   <*>;     Multipath I/O support                                        < >;     Faulty test module for MD                                    <*>;   Device mapper support                                          < >;     Crypt target support                                         < >;     Snapshot target EXPERIMENTAL                               < >;     Mirror target EXPERIMENTAL                                 < >;     Zero target EXPERIMENTAL                               Fusion MPT device support  --->;    偶的SCSI是这个,所以选了 还是自定                                                               <*>; Fusion MPT base + ScsiHost drivers                                              40  Maximum number of scatter gather entries                                          <*>;   Fusion MPT misc device ioctl driver                 IEEE 1394 FireWire support  --->;  自定  偶没选              I2O device support  --->;     自定  偶没选              Networking support  --->;     网络选项                              [*] Networking support                                                                                  Networking options  --->;                                                                                                                  <*>; Packet socket                                                                                            [ ]   Packet socket: mmapped IO                                                                              < >; Netlink device emulation                                                                                 <*>; Unix domain sockets        如果你有网络就选                                                                              < >; PF_KEY sockets                                                                                           [*] TCP/IP networking                                                                                        [ ]   IP: multicasting                                                                                       [ ]   IP: advanced router                                                                                    [ ]   IP: kernel level autoconfiguration                                                                     < >;   IP: tunneling                                                                                          < >;   IP: GRE tunnels over IP                                                                                [ ] IP: ARP daemon support EXPERIMENTAL                                                                    [*] IP: TCP syncookie support disabled per default     能防DOS攻击,但会降低一点性能,总的说性价比不错                                                    < >; IP: AH transformation                                                                                    < >; IP: ESP transformation                                                               ,                    < >; IP: IPComp transformation                                                                                < >; IP: tunnel transformation                                                                                <*>; IP: TCP socket monitoring interface                                                                       IP: Virtual Server Configuration  --->;                   lvs 支持                                                < >; The IPv6 protocol EXPERIMENTAL                                                                         [*] Network packet filtering replaces ipchains  --->;    包过滤省略知道的自己选,不熟悉的都选上                                                                                                                              以下都没选,省略                                    [ ] Amateur Radio support  --->;                                                                    < >; IrDA infrared subsystem support  --->;                                                        < >; Bluetooth subsystem support  --->;                                                              [*] Network device support                                                                         < >;   Dummy net driver support                这个是nis服务器的吧,不大清楚,没用过                                                     <*>;   Bonding driver support                  双网卡绑定的                                                     < >;   EQL serial line load balancing support                                                     < >;   Universal TUN/TAP device driver support                                      ARCnet devices  --->;                                                                              Ethernet 10 or 100Mbit  --->;                                                                    Ethernet 1000 Mbit  --->;                                             < >; Alteon AceNIC/3Com 3C985/NetGear GA620 Gigabit support                                                        < >; D-link DL2000-based Gigabit Ethernet support                                                                  < >; InR PRO/1000 Gigabit Ethernet support                                                                    < >; National Semiconduct DP83820 support                                 &n, bsp;                                        < >; Packet Engines Hamachi GNIC-II support                                                                        < >; Packet Engines Yellowfin Gigabit-NIC support EXPERIMENTAL                                                   < >; Realtek 8169 gigabit ethernet support                                                                         < >; Marvell Yukon Chipset / SysKonnect SK-98xx Support                                                            <*>; Broadcom Tigon3 support                    以下都没选,省略           ISDN subsystem  --->;                                                  ephony Support  --->;         Input device support  --->;                                                        Character devices  --->;                                                       I2C support  --->;                      Dallas''s 1-wire bus  --->;              Misc devices  --->;                     Multimedia devices  --->;               Graphics support  --->;                 Sound  --->;                            USB support  --->;                      MMC/SD Card support  --->;    以上都没选,需要的自己选    09.File systems  --->;        文件系统              < >; Second extended fs support                                                                       <*>; Ext3 journalling file system support                                                           [ ]   Ext3 extended attributes                                                                     [*] JBD ext3 debugging support                                                                   < >; Reiserfs support                                                                               < >; JFS filesystem support                                                                         < >; XFS filesystem support                                                                         < >; Minix fs support                                                                               < >; ROM file system support                                                                        [ ] Quota support                                                                                  < >; Kernel automounter support                                                                     <*>; Kernel automounter version 4 support also supports v3                                            CD-ROM/DVD Filesystems  --->;                                                              <*>; ISO 9660 CDROM file system support                                                              [ ]   Microsoft Joliet CDROM extensions                                                           [ ]   Transparent decompression extension                                                         < >; UDF file system support              DOS/FAT/NT Filesystems  --->;             floppy要用到的文件格式                <*>; MSDOS fs support                                                                                                                                    <*>; VFAT Windows-95 fs support                                                                   437 Default codepage for FAT NEW                                                               iso8859-1 Default iocharset for FAT NEW                                                        < >; NTFS file system support                                                                     Pseudo filesystems  --->;                [*] /proc file system support                             proc文件系统支持                                              [ ]   /proc/kcore support                                                                               [ ] /dev file system support OBSOLETE                                                                 [ ] /dev/pts Extended Attributes                                                                        [*] Virtual memory file system support former shm fs     虚拟内存支持                                             [ ]   tmpfs Extended Attributes                                                                         [ ] HugeTLB file system support                                                                          Miscellaneous filesystems  --->;                                                  Network File Systems  --->;                                                                         <*>; NFS file system support                      nfs客户端支持                                                                             [*]   Provide NFSv3 client support                                                                                            [ ]   Provide NFSv4 client support EXPERIMENTAL                                                                             [ ]   Allow direct I/O on NFS files EXPERIMENTAL                                                                            < >; NFS server support                           nfs服务端支持                                                                            < >; Secure RPC: Kerberos V mechanism EXPERIMENTAL                                                                           < >; Secure RPC: SPKM3 mechanism EXPERIMENTAL                                                                                < >; SMB file system support to mount Windows shares etc.       samba支持                                                             < >; CIFS support advanced network filesystem for Samba, Windowother CIFS compliant servers                             < >; NCP file system support to mount NetWare volumes                                                                        < >; Coda file system support advanced network fs                                                                            < >; Andrew File System support AFS Experimental                               Partition Types  --->;                   Native Language Support  --->;                 自己选         10.Profiling support  --->;                             没选                                                  11.Kernel hacking  --->;                                没选                                                                                                 12.Security options  --->;                              没选    13.Cryptographic options  --->;                         没选       14.Library routines  --->;                                                 < >; CRC-CCITT functions                                         <*>; CRC32 functions                                             ; CRC32c Castagnoli, et al Cyclic Redundancy-Check五、编译安装    步骤:make -jnn代表同时编译的进程,可以加快编译速度,n由你的配置决定,我的配置用15-25         make modules_install         make install

六、grub的设置    设置之前先介绍一下2.6的I/O调度器        2.6包含的四个I/O调度器分别是No-op I/O scheduler、Anticipatory I/O scheduler、Deadline I/O scheduler与CFQ I/O scheduler。    在后文中分别简称为ns、as、ds与cfq。

        ns是一个简化的调度程序它只作zui基本的合并与排序。与桌面系统的关系不是很大,主要用在一些特殊的软件    与硬件环境下,这些软件与硬件一般都拥有自己的调度机制对内核支持的要求很小,这很适合一些嵌入式系统环境。作为桌面用户我们一般不会选择它。

        as是当前内核中默认的I/O调度器。它拥有非常好的性能,在2.5中它就相当引人注意。在与2.4内核进行的对比测试中,在2.4中多项以分钟为单位    完成的任务,它则是以秒为单位来完成的。正因为如此它成为目前2.6测试版中默认的I/O调度器。但它也存在着弱点,它本身是比较庞大与复杂的,    在一些特殊的情况下,特别是在数据吞吐量非常大的数据库系统中它会变的比较缓慢。

        ds就是针对as的缺点进行改善而来的,还处于测试阶段,但已经很稳定了。目前表现出的性能几乎与as一样好。加之比as更加小巧,    是相当有前途的调度器,值得一试:

        cfq为系统内的所有任务分配相同的带宽,提供一个公平的工作环境,它比较适合桌面环境。事实上在测试中它也有不错的表现,    mplayer xmms等多媒体播放器与它配合的相当好,回放平滑几乎没有因访问磁盘而出现的跳帧现象。对于喜欢在Linux下听音乐看电影的朋友不妨尝试一下。        好了,下面说说怎么设置:参数的格式为elevator=调度器名

    修改/boot/grub/grub.conf,在kernel那行后门加入elevator=deadline        例如:kernel /boot/vmlinuz-2.6.10-bk4 ro root=/dev/你的根分区 elevator=deadline

七、reboot

标签: linux
打赏

免责声明:
本站部份内容系网友自发上传与转载,不代表本网赞同其观点;
如涉及内容、版权等问题,请在30日内联系,我们将在第一时间删除内容!

购物指南

支付方式

商家合作

关于我们

微信扫一扫

(c)2008-2018 DESTOON B2B SYSTEM All Rights Reserved
免责声明:以上信息由相关企业或个人自行免费发布,其真实性、准确性及合法性未证实。请谨慎采用,风险自负。本网对此不承担任何法律责任。

在线咨询

在线咨询:

QQ交流群

微信公众号