编译linux核心的几个问题:Kernel-2.6.x Rebuild document(转)

我想把redhat linux9.0的核心由2.4.8升级到2.6.16-21看能否解决我的sedY890手机在系统中认不到的问题,下面是一篇转帖。

发信人: xxxss (?nbsp;野  硐  ?, 信区: LinuxApp

标  题: Kernel-2.6.x Rebuild document

发信站: BBS 水木清华站 (Sun Apr 18 22:07:04 2004), 转信

 

                The Kernel Rebuild document. v0.27

                

 

首先你要知道2.6需要注意的几件事情: 

多了一个sysfs虚拟文件系统 

老版本的modutils不能用了,module-init-tools要安装。 

modules.conf和modprobe.conf是怎么回事儿? 

USB模块名都变了 

声卡配置怎么办?kernel-2.6采用alsa, alsa的配置工具是什么? 

升级kernel会导致一些软件不能使用吗? 

什么版本的gcc都行吗? 

。。。。。。

 

 

准备工作

 

先看看这两个东西的结果,保存一下

/sbin/lspci

cat /proc/cpuinfo

 

这样呆会儿config的时候可以知道自己该选哪些设备

 

如果要打patch,现在据说是解压之后这样作:

patch -p1 <../patch-2.6.x....

 

看看文档:源码解开以后的README

还有看/usr/src/linux-2.6.5/Documentation/Changes

 

    linux 2.6.5需要一些软件更新到一定版本才可以:

 

o  Gnu C                  2.95.3                  # gcc --version

o  Gnu make               3.79.1                  # make --version

o  binutils               2.12                    # ld -v

o  util-linux             2.10o                   # fdformat --version

o  module-init-tools      0.9.10                  # depmod -V

o  e2fsprogs              1.29                    # tune2fs

o  jfsutils               1.1.3                   # fsck.jfs -V

o  reiserfsprogs          3.6.3                   # reiserfsck -V 2>&1|grep reiserfsprogs

o  xfsprogs               2.6.0                   # xfs_db -V

o  pcmcia-cs              3.1.21                  # cardmgr -V

o  quota-tools            3.09                    # quota -V

o  PPP                    2.4.0                   # pppd --version

o  isdn4k-utils           3.1pre1                 # isdnctrl 2>&1|grep version

o  nfs-utils              1.0.5                   # showmount --version

o  procps                 3.2.0                   # ps --version

o  oprofile               0.5.3                   # oprofiled --version

 

把该升的都升了。。。有些如果本来就不需要的就算了.

其中最重要的一个module-init-tool

 

☆──────────────────────────────────────☆

                        关于module-init-tool

 

    在编译安装modules,即make modules_install时,如果module-init-tools

没有到最新版本的话,(比如0.9.14或者3.0).在最开始有一行提示,让升级

module-init-tools的,并且会出错,symbol......

        并且。。就算通过了,也没法加载模块。。总之这个必须升级.

        2004年2月的版本是3.0

 

    还有一个问题是,module-init-tools 的默认安装路径是/usr/local/

会把lsmod装到/usr/local/bin/

其他几个文件装到/usr/local/sbin/

而系统原有的是在/sbin/

并且原有的lsmod是个link,  /sbin/lsmod -> insmod

所以这里即使你装了module-init-tools,也会在make modules_install的时候遇难。

所以看README

 

正确的安装module-init-tools的方法是

        tar -zxvf modules-init-tools-3.0.tar.gz

        cd modules-init-tools-3.0

        ./configure --prefix=/                  

        make

        make moveold

        make install

        ./generate-modprobe.conf /etc/modprobe.conf

        mv /etc/modules.conf /etc/modules.conf.bak

 

剩下几步不知道是否必须:

        4) If you are using devfs, copy modprobe.devfs to /etc 

 

        5) You will need to run "depmod" for your new kernel, eg: 

 

        depmod 2.5.50 

 

        6) If you want to hack on the source: 

        aclocal && automake --add-missing --copy && autoconf 

 

还有mkinitrd需要用高版本的

 

☆──────────────────────────────────────☆

 

                        编译

 

据说不要在/usr/src/下面编译内核,所以我方在了别处

/home/xxxss/linux-2.6.5

 

编译之前,可以先改个名字,编辑Makefile

EXTRAVERSION =

这个后面来个名字啥的,比如-1xxxss

 

linux 2.6.5的编译步骤是:

    cd linux-2.6.5

    make mrproper

 

    make menuconfig             (或者xconfig config oldconfig .等等。。)

    make

    cp -af /lib/modules /lib/modules.bak        (备份老版的模块)

    make modules_install

切换到root

    make install

 

   (如果是制定输出目录,那么以上几步换成:)

    mkdir /home/xxxss/build;mkdir /home/xxxss/build/kernel;

    make O=/home/xxxss/build/kernel menuconfig;       (注意这里是大写O,不是0)

    make O=/home/xxxss/build/kernel;

    cp -af /lib/modules /lib/modules.bak;

    make O=/home/xxxss/build/kernel modules_install;

切换到root

    make O=/home/xxxss/build/kernel install;

    

☆──────────────────────────────────────☆

 

                        config的大概(我自己的一些改动,后面有个x都是我N掉的)

                        

Code maturity level options  --->

        [*] Prompt for development and/or incomplete code/drivers

        这条本来是建议"除非要帮助测试或者尝试新功能才选",不过据说

        用了也没有什么问题,所以干脆保持默认编进内核吧。如果确实觉得

        对稳定有影响,就可以N掉

        

General setup ->

        全保持默认

        Support for hot-pluggable devices   如果有usb设备就加上这条吧

        

Processor type and features  --->

        Processor family --->

                (X) Pentium-III/Celeron(Coppermine)

        [ ] Local APIC support on uniprocessors

                这条在某些机子上有,如果不选会出条interupt信息

        < >Toshiba laptop support       去掉,

        < > Dell laptop support         去掉,

        High Memory Support (off)  --->

                (X) off                 这里改成off,因为内存不到4G

Power Management options

        -> Power Mangement support x

Bus options

 #        -> ISA Support x

Device Drivers

        -> Parallel port support

            ->Suport for pcmicia management for pc-style ports x

        -> SCSI Device support

                SCSI 支持不止是scsi设备需要,IDE的刻录机驱动也需要模拟

                成scsi模式,所以如果有这个,就得选上。

                另外如果你的root分区在scsi硬盘上,就必须把scsi支持编进

                内核,而不是编成模块。

            -> PCMICIA SCSI adapter support x

        -> Networking Support

            -> Networking options

                -> [*] Network packet filtering (replaces ipchains) 

            -> Ethernet 1000 MBit x

            -> FDDI driver support x

            -> PPP Filtering x

            -> Token ring devices x

            -> Wan interfaces x

            -> Pcmcia network device support x

            -> ISDN??subsystem x

            -> Talephone Support x

            

        -> USB Support

            -> OHCI HCD Support M

            -> UHCI HCD Support M

 

        -> Input device support 

            -> Mice

                -> PS2 mouse       这个编到内核里

 

file system ->

            ext3   编译进内核

            反正是把root分区的文件系统编进内核,否则initrd没法启动

Kernel Hacking x

 

        

☆──────────────────────────────────────☆

 

                        loopback devices

                        

    接着遇到的问题是,make install内核的时候,有很大几率碰到

All of your loopback devices are in use.

mkinitrd failed

    这个问题很复杂...可能是当时系统内确实有东西使用光了loopback devices.

也可能是新换的modprobe和lsmod等无法正常工作导致.

    这个问题也不晓得怎么解决...

    大概modprobe loop;insmod loop 能解决?不知道了

 

☆──────────────────────────────────────☆

 

                        文件系统

                        

    如果没遇到这个问题,那么内核编译安装完成后,重启后第一个问题是

    - mount: error 2 mounting ext3

    - pivotroot: pivot_root (/sysroot, /sysroot/initrd) failed : 2

    - umount /initrd/proc failed : 2

    - Freeing unused kernel memory: 212k freed

    - Kernel panic: No init found. Try passing init= option to kernel

 

    这个问题是由于redhat 7.3以后大家基本都用的是ext3文件系统,但是内核选项里面

ext3文件系统是默认作为模块编译的.并没有编译在内核里面,所以启动时没加载上模块

就会导致无法mount 到/文件系统.

    所以解决的一个简单方法是,把ext3编进内核.

    或者还有别的方法,比如利用mkinitrd创建 Initial RAMDisk

    

    这个initrd是解决那个启动时"鸡生蛋,蛋生鸡"问题的--驱动需要加载/分区

    文件系统,但是驱动自己又在/分区文件系统里,所以没法被加载.

    mkinitrd就是创建一个文件系统镜像,这个ramdisk镜像可以用来预加载

    块设备的模块(比如IDE,SCSI,或者RAID)以访问root文件系统,mkinitrd

    会自动加载/etc/modules.conf里面关于文件系统的模块(比如ext3或者jbd),

    IDE模块.scsi卡等的条目.

    不过这个需要编译内核时把ramdisk那两条编译到内核里.

    

    使用方法:

    mkinitrd /boot/initrd-2.6.5.img 2.6.5

 

        这里请注意,只有当你把根分区文件系统的支持编译成模块时,才需要initrd

        否则grub.conf里面不要带这条:

        initrd /boot/initrd-2.6.x.img

 

☆──────────────────────────────────────☆

 

    这个问题解决以后,下一个问题是

 'spurious 8259A interrupt: IRQ7'

还未解决..

    这个不知道到底有没有影响,似乎是说这个APIC不enable那么系统也照样走。

    所以不管了。。

 

☆──────────────────────────────────────☆

 

                        关于module和设备问题

 

    下一个问题是在开机自检是竟然检测到了ps/2鼠标,而这台机子上根本没有鼠标.

 

    还有就是usb-uhci 显示没有正常加载,虽然编译内核时选了usb

但是这两个模块默认没有被选上

        所以在内核里注意把usb uhci和ohci都选上,<M>就可以了

    然后还要改几个地方:

    1, mkdir /sys 

    2, 在/etc/rc.sysinit中,只要有mount -f /proc就在下面加上mount -f /sys 

    3, 在/etc/rc.sysinit中,找到: 

   将其中所有的/proc/ksyms替换为/proc/kallsyms。

   将其中所有的/proc/sys/kernel/modprobe 替换为/sbin/modprobe

在文件中的action $"Mounting proc filesystem: " mount -n -t proc /proc /proc 这一

句的下面添加 action $"Mounting sysfs filesystem: " mount -n -t sysfs /sys /sys

    4,在/etc/fstab中加上: 

   none    /sys  sysfs   defaults  0 0 

    5,把/etc/rc.d/init.d/halt中的: 

   awk '$2 ~ /^/$|^/proc|^/dev/{next} 

   修改成: 

   awk '$2 ~ /^/$|^/proc|^/sys|^/dev/{next} 

   

   如果不是上面那个样子,而是这样:

   awk '!/(^#|proc|loopfs|autofs|^none|^\/dev\/root| \/ )/ {print $2}' /proc/mounts

 

就改成:

 

   awk '!/(^#|proc|loopfs|sys|autofs|^none|^\/dev\/root| \/ )/ {print $2}' /proc/mounts

 

 

        修改/etc/rc.sysinit

        找到下面这段:

        

*******************************************************************

usb=0 

if ! LC_ALL=C grep -iq "nousb" /proc/cmdline 2>/dev/null && ! LC_ALL=C grep -q "usb" /proc/devices 2>/dev/null ; then 

    aliases=`/sbin/modprobe -c | awk '/^alias usb-controller/ { print $3 }'` 

    if [ -n "$aliases" -a "$aliases" != "off" ]; then 

      modprobe usbcore 

      for alias in $aliases ; do 

        [ "$alias" != "off" ] && action $"Initializing USB controller ($alias): " modprobe $alias 

      done 

      [ $? -eq 0 -a -n "$aliases" ] && usb=1 

    fi 

fi 

 

if ! LC_ALL=C grep -iq "nousb" /proc/cmdline 2>/dev/null && LC_ALL=C grep -q "usb" /proc/devices 2>/dev/null ; then 

  usb=1 

fi 

 

if [ $usb = 1 -a ! -f /proc/bus/usb/devices ]; then 

    action $"Mounting USB filesystem: "  mount -t usbdevfs usbdevfs /proc/bus/usb 

fi 

 

needusbstorage= 

if [ $usb = "1" ]; then 

    needusbstorage=`LC_ALL=C grep -e "^I.*Cls=08" /proc/bus/usb/devices 2>/dev/null` 

    LC_ALL=C grep 'hid' /proc/bus/usb/drivers || action $"Initializing USB HID interface: " modprobe hid 2> /dev/null 

    action $"Initializing USB keyboard: " modprobe keybdev 2> /dev/null 

    action $"Initializing USB mouse: " modprobe mousedev 2> /dev/null 

fi 

***********************************************************************

 

改成:

 

*********************************************************************

modprobe usbcore 

action $"Initializing USB controller (uhci-hcd): " modprobe uhci-hcd 

usb=1 

 

if [ $usb = 1 -a ! -f /sys/bus/usb/devices ]; then 

    action $"Mounting USB filesystem: "  mount -t usbdevfs usbdevfs /sys/bus/usb 

fi 

 

needusbstorage= 

if [ $usb = "1" ]; then 

    needusbstorage=`LC_ALL=C grep -e "^I.*Cls=08" /sys/bus/usb/devices 2>/dev/null` 

    action $"Initializing USB HID interface: " modprobe hid 2> /dev/null 

    action $"Initializing USB keyboard: " modprobe usbkbd 2> /dev/null 

    action $"Initializing USB mouse: " modprobe usbmouse 2> /dev/null 

fi 

**********************************************************************

 

然后检查一下rc.sysinit和/etc/rc.d/init.d/halt脚本,看看还有没有/proc/bus/usb的定义,通通搞成/sys/bus/usb. 

在/etc/modprobe.conf里面手动改动一条,把

alias usb-controller usb-uhci

换成

alias usb-controller uhci-hcd

 

这样修改的原因是

1,/proc/sys/usb定义是错的,应该是/sys 

2,modprobe -c 能不能找到alias usb-controller,从而定义变量aliases为usb-uhci, 运行一下是不能的。 

3,模块名不对,usbcore, uhci-hcd(也就是usb-uhci的新版本) ,usbmouse和usbkbd才对。 

 

上面贴的几段大概是rh9.0左右版本的,其他发行版本的如果不配套,那么根据

需要自己修改吧。。

一个处理2.4和2.6内核共存的简单办法:

对于kernel 2.4/2.6需要有不同处理的引导过程(包括有些模块加载过程), 

可以在引导shell中判断uname -r值分别处理.

 将/etc/rc.d/rc.sysinit复制为rc.sysinit-2.4和rc.sysinit-2.6然后把rc.sysinit-2.6根据需要修改, 

 最后建立新的/etc/rc.d/rc.sysinit:

#!/bin/sh

if [ `uname -r` = "2.6.5" ]; then

exec /etc/rc.d/rc.sysinit-2.6

else

exec /etc/rc.d/rc.sysinit-2.4

fi

 

注意,那个uname -r 出来的别写错。。

还有别直接改/etc/rc.sysinit,因为这个是个链接,指向/etc/rc.d/rc.sysinit

 

☆──────────────────────────────────────☆

 

                                关于声卡

                                

以前一直用oss,现在内核提供的是alsa. 

找出一个配置工具alsaconf,这个是alsa-drivers的utils 

 

配置,不行,找不到声卡,问题在于kernel-2.6的模块不再是.o而是.ko 

 

修改alsaconf中所有的.o为.ko. 

配置,OK,找到声卡为i810内嵌的,也就是ac97音效,正确的写入了 

/etc/modules.conf, 

lsmod一看,内核模块没有马上载入,说明alsaconf还是有点问题, 

modprobe一下: 

modprobe snd-intel8x0,OK了,内核驱动载入。 

用alsa play播放: 

aplay sample.wav 

有声音了。 

 

 

重启,lsmod看看,snd-intel8x0没有载入,/etc/modules.conf里不是有了吗? 

以我的判断,肯定是正确的,试试generate-modprobe.conf,刚才那个 

char-major-188的错误就是这么解决的。 

 

做完之后,再重启,再lsmod看看,还是没有载入声卡驱动。 

modprobe snd-intel8x0,出错,看来是modprobe.conf导致的, 

把里面的sound相关配置通通删掉,重启后modprobe又可以出声了。 

 

没有办法,好好读读alsaconf代码,发现了以前单独安装alsa的时候一个经典的东西: 

alsasound启动进程。 

 

这个东西也在alsadrivers的utils目录,找出来。 

 

./alsasound start自动载入所有模块 

./alsasound stop 自动卸载所有模块 

OK,目的达到。 

cp alsasound /etc/rc.d/init.d 

chkconfig --add alsasound 

 

再看看alsaconf原来可以进行测试声音的播放,只是以前从来没有把wav文件装上过, 

拷贝一个wav文件,再次运行: 

alsaconf 

配置成功,然后自动载入模块成功,然后就是aplay这个wav. 

 

还有两个东西可以参考:

        运行cat /proc/asound/cards看看声卡是否正常加载,

        运行alsamixer看看设备是否打开

 

还不行去http://www.alsa-project.org/

 

OK,至此为止,基本的kernel-2.6升级工作完成了。 

 

不对的程序:

 usbmodules  

lsusb, usbview, kde 信息中心中usb目录定义仍然不对,所以通过这些命令你看不到系统任何usb信息 

自己修正吧,其他的软件问题也不少,所以以上的工作是最基础的,所以建议大家没事不要赶什么潮流。 

 

对了,忘了说了,kernel-2.6安装后,我测试重新编译kernel-2.6,gcc出现异常,连续测试7次,每次 

都在随机的位置退出编译,说明gcc已经不能正常工作,可能又要LD_ASSUME_KERNEL,始终不是一件好事。 

继续升级glibc, gcc再所难免' 

 

☆──────────────────────────────────────☆

 

                        关于rpm

 

        rh9.0升级了内核之后,有没有发现没法装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

warning: xxxxx.x.x.x.x.x.rpm: V3 DSA signature: NOKEY, key ID db42a60e

rpmdb: unable to join the environment

error: db4 error(11) from dbenv->open: Resource temporarily unavailable

error: cannot open Packages database in /var/lib/rpm

**********************************************************************

 

这个问题的解决办法是:

run "export LD_ASSUME_KERNEL=2.2.5", before running rpm.

This is thought to be a bug related to db4 and O_DIRECT interaction

 

如果你的realplay 不能用了,可能也是同样的问题,同样处理方法.

 

参考以下:

**********************************************************************

Here's what Penelope Fudd had to say about this problem:

 

The original RH9 glibc has the problem, the updated RH9 glibc is fine:

 

ftp://ftp.rpmfind.net/linux/redhat/updates/9/en/os/i386/glibc-2.3.2-27.9.i386.rpm

 

And when you update that, you need to update these:

 

ftp://ftp.rpmfind.net/linux/redhat/updates/9/en/os/i386/glibc-common-2.3.2-27.9.i386.rpm

ftp://ftp.rpmfind.net/linux/redhat/updates/9/en/os/i386/glibc-devel-2.3.2-27.9.i386.rpm

ftp://ftp.rpmfind.net/linux/redhat/updates/9/en/os/i386/glibc-utils-2.3.2-27.9.i386.rpm

 

I tried rpm -Uvh glibc*, but it was not a pain-free process, as rpm

choked halfway through.  I had to rpm -e the old one and rpm -Uvh --force

the new one.  That got it working.

***********************************************************************

 

☆──────────────────────────────────────☆

 

                                电源管理

 

        有没有发现关机shutdown以后电源不断了?

        内核里面记得选上:

            <*>   Advanced Power Management BIOS support                  

            [*]     Ignore USER SUSPEND                                  

            [*]     Enable PM at boot time                                

            [*]     Make CPU Idle calls when idle                        

            [ ]     Enable console blanking using APM                    

            [ ]     RTC stores time in GMT                                

            [ ]     Allow interrupts during APM BIOS calls                

            [ ]     Use real mode APM BIOS call to power off              

 

        [ ] Symmetric multi-processing support绝对不要选

 

解释如下:

[*] Power Management support │ │//这一项必选,它就管你的关机 

[ ] ACPI support │ │ //如果你的机器较新可以使用它,关于它的设置一会再说 

<×> Advanced Power Management BIOS support │ │//如果你使用APM选这一项,适合老机器 

[ ] Ignore USER SUSPEND │ │ 

[ ] Enable PM at boot time │ │//这一项一般不用选,原因看我以前的贴子 

[X ] Make CPU Idle calls when idle │ │//这一项请选它让你的机器在空闲时省电,不过作用嘛不大,至于如何更好的省电,以后我再讲 

[ ] Enable console blanking using APM │ │//这一项基本用不到,主要用来关闭LCD的背光,还经常不起作用 

[X ] RTC stores time in GMT │ │这一项如果想让时间正确请选 

[ ] Allow interrupts during APM BIOS calls │ │这一项,如果你的机器在休眠后醒不了请选 

[ ] Use real mode APM BIOS call to power off //这一项如果你的机器老的只用上面的选项不能关机请选,不过一般不要用它。 

这样基本上你的机器就能够正常的进行关机休眠等操作了,当然你要有apmd这个守护程序,不过一般的发行版都有了,不用你操心  

再来看ACPI 

[*] Power Management support //同上面一样这一项必选 

[*] ACPI support //这个不用说了吧 

[ ] ACPI Debug Statements //这个你愿意研究的话就选,大数人用不着 

<*> ACPI Bus Manager //想省电必选 

<*> System //同上 

<×> Processor //建议为Y,原因同上 

<X> Button //建议为Y,默认情况下它的动作为按下电源钮就自动关机,当然你可以自定义,以后再讲。 

< > AC Adapter //桌面电脑永远都使用交流电不用这一项,如果你用笔记本那么选吧,其实没用。 

< > Embedded Controller //这一项,2.6中没有我就不知是作什么的了  

如上你就可以使用ACPI了,不过请注意RH没有装ACPID这个守护程序,所以不管你怎么设置ACPI都不起作用(别人的不知,我的就没装害的我纳闷了很久)  。所以请下载个最新的RPM包装上重启就OK了。

 

☆──────────────────────────────────────☆

 

还有,如果你有刻录机,看到"ide-scsi"这种东西就不要留了,比如装rh9.0时可能

遇到的,2.6内核已经broken这个东西了

 

☆──────────────────────────────────────☆

 

                                VMware

 

    首先, 把/usr/bin/vmware-config.pl文件里所有``/proc/ksyms'' 替换成

     ``/proc/kallsyms''.运行 vmware-config.pl,会有错误信息. 解压

     vmnet.tar到/usr/lib/vmware/modules/source目录. 

这会在那里创建一个vmnet-only目录.在那个目录里编辑bridge.c文件. 

在368行附近, 找到下面这行: 

 

atomic_add(skb->truesize, &sk->wmem_alloc);

替换成:

atomic_add(skb->truesize, &sk->sk_wmem_alloc);

同样的, 在618行和817行,把 protinfo 替换成 sk_protinfo. 

然后把vmnet-only目录打包,替换掉老版本的vmnet.tar,然后重新运行

vmware-config.pl. 请确认vmware-config.pl使用了和你编译内核时相同的编译器.

 

下面是关于使用gcc 3.x的

*********************************************************************

[...]

And second, a recent change in struct task_struct makes the compilation of

vmware net modules fail. The workaround is simple: untar vmmon.tar, edit file

vmmon-only/linux/driver.c and substitue any occurrence of: current->uid,

current->euid, current->fsuid, current->egid, current->gid and

current->fsgid

                                                                                

for

                                                                                

current->__uid, current->__euid, current->__fsuid,

current->__egid, current->__gid and current->__fsgid, respectively.

                                                                                

PS1: the change in struct tast_struct took place in 2.6.0-test6-mm1, but

is not present in 2.6.0-test6.

                                                                                

PS2: kernel and VMware modules compiled with gcc 3.2.3 from Debian Sid

there's someting out there to get vmware-config.pl to run against the kernel using GCC 3.x. It's available at http://ftp.cvut.cz/vmware/ He says the latest tarball (named vmware-any-any-updateXX.tar.gz) needs to be untarred and run instead of the usual vmware-config.pl. I didn't try this myself, though. 

 

***********************************************************************

 

☆──────────────────────────────────────☆

 

                                防火墙

        netfilter ipt_unclean 的规则没有用了,所以remove the chain[s]

否则开机防火墙启动时会失败.

 

☆──────────────────────────────────────☆

                        mii-tool配置网卡

 

        你如果是使用 mii-tool 来配置网卡 ,现在可能就不行了,(as in my case). 

安装使用 [ethtool] and using in lieu 就足够了 (甚至可能更好, 因为ethtool 

看上去更强大).

http://sourceforge.net/project/showfiles.php?group_id=3242&package_id=19201

 

☆──────────────────────────────────────☆

                        update和bdflush() 

 

        在启动的日志里你可能能看到这些:

kernel: warning: process `update' used the obsolete bdflush system call

'update'是个使用bdflush()来清理硬盘的,现在这个已经被2.6的内核废除了,现在

改为使用内核控制pdflush

所以在 /etc/inittab 里面注释掉这行:

        #ud::once:/sbin/update

        

☆──────────────────────────────────────☆

                        一些工具程序

        如果你升级了很多工具到GNU发布的最新版本,并且选择了默认安装路径

(/usr/local/bin),并且把这个路径包含在了$PATH里第一条.有些工具却还是运行的

老版本.比如awk.

这样改:

1.      cd /usr/bin/

2.      mv awk awkORIG

3.      ln -s /usr/local/bin/gawk awk

 

这样就把旧版的awk保存为awkORIG,并且建了symlink到new GNU version 上.

其他hard coded的工具也类似处理.

 

☆──────────────────────────────────────☆

                                named

                                

在boot logs里还有关于'named'以及它的控制器'rndc'的错误信息:

        process `named' is using obsolete setsockopt SO_BSDCOMPAT

去下载最新的 [bind source code 9.2.3], 

http://www.isc.org/index.pl?/sw/bind/

解压,在/lib/isc/unix/socket.c里面找到需要修改的代码:

首先找到这个 (在1297行附近): 

 

        #if defined(USE_CMSG) || defined(SO_BSDCOMPAT)

                int on = 1;

 

改成:

        #if defined(USE_CMSG)

                int on = 1;

 

再找到这段子程序(在1384行附近):

*********************************************************************

 #ifdef SO_BSDCOMPAT

        if (setsockopt(sock->fd, SOL_SOCKET, SO_BSDCOMPAT,

                       (void *)&on, sizeof on) < 0) {

                isc__strerror(errno, strbuf, sizeof(strbuf));

                UNEXPECTED_ERROR(__FILE__, __LINE__,

                                 "setsockopt(%d, SO_BSDCOMPAT) %s: %s",

                                 sock->fd,

                                 isc_msgcat_get(isc_msgcat, ISC_MSGSET_GENERAL,

                                                ISC_MSG_FAILED, "failed"),

                                 strbuf);

 

 

                /* Press on... /*

        }

 #endif

**********************************************************************

把这段全部注释掉,然后build ,install

这个版本在redhat上还有一个问题,我试图将named.pid 放在/var/run下面,但是

root是它的属主,'named'没有权限建立它.

 

所以在named.conf文件里添加

pid-file "/var/run/named/named.pid"; 

这一段到

 options {

           directory 

 

 

                    }

这里就可以了

 

☆──────────────────────────────────────☆

 

                        USB存储设备

        

        数码相机的flash card reader.是个usb storage devices.

在编译内核时必须选上以下几项:

Device drivers 

        -> USB Support

            -> [*]USB device file system

            -> USB mass storage support M

并且,usb mass storage 设备是像scsi设备一样对待的,所以还需要

编译内核时加上

scsi_mod etc

 

但是,如果就这样,你cat /proc/scsi/scsi 

会发现'Generic Model: USB SD Reader',

这是因为这种多个设备一个槽的被认为是一个设备.

所以还需要在内核里加上:

        SCSI device support 

                -> Probe alls LUNs on each SCSI device

这样在/proc/scsi/scsi里有四个槽,用/dev/sdb1就很容易mount上CF card 了

 

☆──────────────────────────────────────☆

 

                        硬盘dma

      hdparm测试

hdparm -tT /dev/hda

/dev/hda:

 Timing buffer-cache reads:   128 MB in  0.40 seconds =322.47 MB/sec

 Timing buffered disk reads:  64 MB in 13.73 seconds =  4.66 MB/sec

 

如果hdparm的dma 参数没法设置,在内核编译上

ATA/ATAPI/API/MFM/RLL support

        -> PCI IDE chipset support

                -> Generic PCI bus-master DMA support

                        -> Intel PIIXn chipset support

根据自己设备的实际情况选择.

然后就可以用hdparm -d1 /dev/hda设置dma了

 

☆──────────────────────────────────────☆

 

        键盘、鼠标的支持记得编译进内核,而不要编译成模块。

cd刻录需要scsi 设备支持,因为是模拟成scsi设备驱动的。

 

☆──────────────────────────────────────☆

        有些系统上grub.conf 会没法引导需要去掉"root=LABEL=/"

#kernel /vmlinuz-2.6.0-test10 ro root=LABEL=/

kernel /vmlinuz-2.6.0-test10 ro

 

☆──────────────────────────────────────☆

                        有些可能会启动时黑屏的  

In the Character devices menu, if you don't see Virtual terminal as you first 

selection, go back to the previous section (Input device support) and select 

Input devices for compilation into the kernel then return here. Select 

Virtual terminal to compile into the kernel. Also ensure you select Unix98 

PTY support. Other selections are at your option. NOTE: you will want the 

following line in your /etc/fstab file:

 

devpts     /dev/pts     devpts     default     0    0

 

Without the above line, those programs requiring a psuedo-terminal won't work. 

There is another gotcha waiting below, but if you're impatient, see the 

graphics support.

 

Graphics support has changed considerably and will cause confusion and a lack 

of a working monitor for many. I highly suggest you choose frame buffer 

device support. I use the boot parameter vga=791 on almost all my systems. 

Choosing support for frame buffer devices will allow you to select the 

generic VESA VGA graphics support. If you have a particular video card on the 

list, I suggest you also choose that (or don't choose agpgart or dri support 

or your kernel may fail to compile).

 

Regardless of whether or not you chose to include support for frame buffer 

devices, the console display driver support will still be available. Make 

sure you enter this subsection and choose VGA text console or you won't have 

a console at all. If you chose frame buffer device support, I recommend you 

compile Framebuffer Console support either into the kernel or as a module. 

If you choose module, make sure it loads early on. If you use VGA=791 and 

load the frame buffer console support as a module (as I do), you won't have 

anything visible on the screen until fbcon is loaded. If this concerns you, 

compile framebuffer console support into the kernel.

 

The Logo configuration subsection is for those who want to see a logo at 

bootup. Note that, for this to work, you'll need the frame buffer console 

support compiled into the kernel.

 

 

- Blank screen after decompressing kernel?

  Make sure your .config has

   CONFIG_INPUT=y

   CONFIG_VT=y

   CONFIG_VGA_CONSOLE=y

   CONFIG_VT_CONSOLE=y

  A lot of people have discovered that taking their .config from 2.4 and

  running make oldconfig to pick up new options leads to problems, notably

  with CONFIG_VT not being set.

 

☆──────────────────────────────────────☆

                网卡无法接收数据包?

An additional bug biting some people is that NICs fail to receive packets

  (usually notable by a NIC not getting a DHCP lease for eg, despite being

   sent one by the server). Booting with "noapic" "acpi=off" or a combination

  of both fixes this for most people.

 

☆──────────────────────────────────────☆

 

(Possibly linked to above bug) VIA APIC routing is currently broken.

  boot with 'noapic'.

 

☆──────────────────────────────────────☆

 

还有,如果你有刻录机,看到"ide-scsi"这种东西就不要留了,比如装rh9.0时可能

遇到的,2.6内核已经broken这个东西了

 

☆──────────────────────────────────────☆

quota升级了,需要新tools,去安装最新的吧

http://www.sf.net/projects/linuxquota/

 

☆──────────────────────────────────────☆

刻录cd据说比2.4快很多,而且buffer underrun的情况会少很多,据说。

这里有cdda2wav工具,ripping audio tracks 用的

*.kernel.org/pub/linux/kernel/people/axboe/tools/

Currently only 'open by device name' works in cdrecord.

  cdrecord -dev=/dev/hdX -inq

 

☆──────────────────────────────────────☆

 

top阿,ps阿之类的命令需要更新到最新版,因为/proc/meminfo 的格式变了一些。

到http://procps.sourceforge.net/

下载新版,

这个http://tech9.net/rml/procps/

似乎没更新

 

☆──────────────────────────────────────☆

 

ext3文件系统支持indexed directory,索引目录?据说使包含大量文件的

目录性能得到很大改观,这个对开基于文件系统的bbs的来说非常有用。

在reiserfs 4 稳定之前值得试试看.

使用htree 功能需要1.32版本以上的e2fsprogs.

去http://prdownloads.sourceforge.net/e2fsprogs

下载最新版

已经存在的文件系统可以用下面的命令转换

    tune2fs -O dir_index /dev/hdXXX

 

据说2.6内核下建立子目录会比原来快。。因为子目录都放在比较接近的地方。

 

☆──────────────────────────────────────☆

 

NVidia的配合2.6内核的显卡驱动可以在这里找到

http://www.minion.de/

安装方法:

#sh NVIDIA-Linux-x86-1.0-5336-pkg1.run 

#sh NVIDIA-Linux-x86-1.0-5336-pkg1.run -x 

#cd NVIDIA-Linux-x86-1.0-5336-pkg1/usr/X11R6/lib/modules/extensions 

#cp libglx.so.1.0.5336 /usr/X11R6/lib/modules/extensions 

Overwrite (y/n): y 

#exit 

$startx 

 

Now, you have your system ready to execute glx apps., open a shell from XWindows and try 

 

TESTING: glxgears -> will show glx graphics and you will be ready to execute any glx app. 

 

$glxgears 

 

☆──────────────────────────────────────☆

 

据说还可以这样定制自己的声音设置:

建立一个/etc/aumixrc文件,内容类似下面的:

vol:75:75:P

pcm:75:75:P

speaker:75:75:P

line:75:75:P

mic:75:75:R

cd:75:75:P

igain:75:75:P

line1:75:75:P

phin:75:75:P

video:75:75:P

 

然后再rc.local里加上这条 

/bin/aumix-minimal -f /etc/aumixrc -L >/dev/null 2>&1;

 

 

 

☆──────────────────────────────────────☆

 

Revision history:

0.27 - fix some error of share rc.sysinit

0.26 - fix some error

        change the sequence of some paragragh 

0.25 - added more experience search from google

0.24 - added experience from internal forum

0.1->0.23 - experience of upgrage by myself

 

--------------------------------------------------------------------------------

 

Feedback

Comments and corrections

The current maintainer of this document is xxxss. Please send corrections, additions, comments and criticisms to <xxxss@sina.com>. 

 

The maintainer would also appreciate e-mails from people that have sucessfully used this document to configure and use the DocBook . Please state the version of the document you used, your Linux distribution and its version. 

 

The document's maintainer is not a professional writer. If you find some parts of this document difficult to comprehend then let the maintainer know. 

 

--------------------------------------------------------------------------------

reference

 

Other Links.

 

http://www.codemonkey.org.uk/post-halloween-2.5.txt

http://www.digitalhermit.com/~kwan/kernel.html

http://thomer.com/linux/migrate-to-2.6.html

http://kerneltrap.org/node/view/799

http://www.hants.lug.org.uk/cgi-bin/wiki.pl?RedHat_2.4_To_2.6_Kernel_Upgrade

about framebuffer & VGA:

http://linuxbooks.pananix.com/kernel2.6.html     

 

http://www.linuxfans.org/nuke/modules.php?name=Forums&file=viewtopic&t=43117

www.linuxfans.org/nuke/modules.php?name=News&file=article&op=view&sid=1490

 

 

 

 

 

 

                        附B :

                        The post-halloween document. v0.49

                        (aka, 2.6 - what to expect)

                        部分内容

 

Regressions.

~~~~~~~~~~~~

(Things not expected to work just yet)

- The hptraid/promise drivers for proprietary RAID formats are currently

  non functional, and will probably be converted to use device-mapper.

- Some filesystems still need work (Intermezzo, UFS, HFS, HPFS..)

  - UMSDOS fs is currently missing, pending rewrite.

  - EFS (has a blocksize problem, depending on the device that the

    filesystem is being mounted on)

- A number of drivers don't compile currently due to them needing various

  work to convert them to the new APIs

- The format of /proc/stat changed, which could break some

  applications that still depend on the old layout.

 

 

Removed features.

~~~~~~~~~~~~~~~~~

- khttpd is gone.

- Older Direct Rendering Manager (DRM) support (For XFree86 4.0)

  has been removed. Upgrade to XFree86 4.1.0 or higher.

- LVM1 has been removed. See Device-mapper below.

- The system call table is no longer exported. Any module that relied

  on this previously will no longer work.

- Soundmodem hamradio support has been removed. Its functionality

  has been superceded by a userspace replacement.

  http://www.baycom.org/~tom/ham/soundmodem

- Direct booting from floppy is no longer supported.

  You should now use a boot loader program such as syslinux instead.

  "make bzdisk" continues to work (now using syslinux).

- Callout tty devices (/dev/cua) have been deprecated since 2.1.90pre2.

  Support is now removed.

 

 

Deprecated/obsolete features.

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

- devfs will be obsoleted in favour of udev (http://www.kernel.org/pub/linux/utils/kernel/hotplug/)

- boot time root= parsing changed.

  ramdisks are now ram<n> instead of rd<n> and cm206 is cm206cd (instead of

  cm206).

  Additionally, cciss driver needs the numeric device ID passed instead of

  the device name.

- usbdevfs will be going away in 2.7. The same filesystem can

  be mounted as 'usbfs' in recent 2.4 kernels, and in 2.5.52

  and above, which is what the filesystem will furthermore be

  known as.

- elvtune is deprecated (as are the ioctl's it used).

  Instead, the io scheduler tunables are exported in sysfs (see below)

  in the /sys/block/<device>/queue/iosched directory.

  Jens wrote a document explaining the tunables of the new scheduler at

  http://www.lib.uaa.alaska.edu/linux-kernel/archive/2002-Week-44/att-deadline-iosched.txt

- Using sysctls by numeric values is deprecated, and will go away

  in the next development series.

 

        

Modules.

~~~~~~~~

- The in-kernel module loader was reimplemented.

- You need replacement module utilities from

  http://www.kernel.org/pub/linux/kernel/people/rusty/modules/

- A backwards compatible set of module utilities is also available

  from the same URL in RPM format.

- Debian sarge/sid or Conectiva snapshot users can just use

  'apt-get install module-init-tools'

- Modules now free stuff marked with __init or __initdata.

- For Red Hat users, there's another pitfall in "/etc/rc.sysinit".

  During startup, the script sets up the binary used to dynamically load

  modules stored at "/proc/sys/kernel/modprobe". The initscript looks

  for "/proc/ksyms", but since it doesn't exist in 2.6 kernels, the

  binary used is "/sbin/true" instead.

 

  This, eventually, will keep modules from working. Red Hat users will

  have to patch the "/etc/rc.sysinit" script to set

  "/proc/sys/kernel/modprobe" to "/sbin/modprobe", even

  when "/proc/ksyms" doesn't exist.

- Modules now have a .ko suffix instead of .o

- Some (older) versions of 'mkinitrd' don't search for modules

  that end with .ko, so update your mkinitrd if this is a problem.

        

        

Kernel build system.

~~~~~~~~~~~~~~~~~~~~

- The build system is much improved compared to 2.4.

  You should notice quicker builds, and less spontaneous rebuilds

  of files on subsequent builds from already built trees.

- There are new graphical config tools.

  "make xconfig" now requires the qt libraries.

  "make gconfig" uses gtk libraries.

- Make menuconfig/oldconfig has no user-visible changes other than speed,

  whilst numerous improvements have been made.

- Several new debug targets exist: 'allyesconfig' 'allnoconfig' 'allmodconfig'.

- Note: The new configuration system is not CML2 related.

- Also note: Whilst some ideas were taken from it, Keith Owens'

  kbuild-2.5 project was not integrated.

- "make" is now the preferred command, without a target; it does <arch-zimage>

  and modules.

- "make -jN" is now the preferred parallel-make execution.

  Do not bother to provide "MAKE=xxx"

- The build is now much less verbose.  If you want to see exactly what's

  going on, try "make V=1" or set KBUILD_VERBOSE=1 in your environment.

- 'make kernel/mm.o' will build the named file, provided a

  corresponding source exists. This also works for (non-composite)

  modules. (FIXME: broken for modules right now?)

- 'make kernel/' will compile all files in a subdirectory and below.

- There is no need to run 'make dep' at any stage.

- 'make help' provides a list of typical targets, including debugging targets.

- You can now build in a separate tree from the source by doing

  make O=builddir

 

IO subsystem.

~~~~~~~~~~~~~

- You should notice considerable throughput improvements over 2.4 due

  to much reworking of the block and the memory management layers.

- Report any regressions in this area to Jens Axboe <axboe@suse.de>

  and Andrew Morton <akpm@osdl.org>

- Two different IO elevators are available. The default is the

  anticipatory IO scheduler. You can select the deadline scheduler by

  booting with "elevator=deadline" on the kernel command line.

- For some workloads the anticipatory scheduler is around 10% slower

  than deadline. Most notably, database workloads which seek all over the

  disk performing reads and synchronous writes. Database folks will likely

  want to boot with elevator=deadline to get that last bit of performance back.

- Assorted changes throughout the block layer meant various block

  device drivers had a large scale cleanup whilst being updated to

  newer APIs.

- The size and alignment of O_DIRECT file IO requests now matches that

  of the device, not the filesystem.  Typically this means that you

  can perform O_DIRECT IO with 512-byte granularity rather than 4k.

  But if you rely upon this, your application will not work on 2.4 kernels

  and will not work on some devices.

 

block device size support.

~~~~~~~~~~~~~~~~~~~~~~~~~~

- Thanks to work done by Peter Chubb, block devices can now access up to

  16TB on 32-bit architectures, and up to 8EB on 64-bit architectures.

- To use the new BLKGETSZ64 ioctls, you'll need updated file-utils.

  (Currently only jfsutils 1.0.20 has this change, patches for other

   filesystems are still pending merging)

- The old 'struct statfs' is not able to describe large devices - the

  statfs() system call will now return -EOVERFLOW for such devices.

  A new system call called statfs64() with a new structure has been added

  to support large devices. It it unknown at time of writing how many

  userspace utilities have been converted to take advantage of this

  syscall when available.

 

 

POSIX ACLs & Extended attributes.

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

- Userspace tools available at http://acl.bestbits.at/

 

 

VM Changes.

~~~~~~~~~~~

- Version zero swap partitions are no longer supported (everything is

  using v1 now anyway - rerun mkswap if in doubt).

  Linux 2.0.x requires v0 swap space, Linux v2.1.117 and later

  support v1.  mkswap(8) can format swap space in either format.

- The actual 'reverse mappings' part of Rik van Riel's rmap vm was merged.

  VM behaviour under certain loads should improve.

- VM misbehaviour should be reported to linux-mm@kvack.org

- The VM explicitly checks for sparse swapfiles, and aborts if one is found.

- /proc/sys/vm/swappiness defines the kernel's preference for pagecache over

  mapped memory. Setting it to 100 (percent) makes it treat both types of

  memory equally. Setting it to zero makes the kernel very much prefer to

  reclaim plain pagecache rather than mapped-into-pagetables memory.

- The bdflush() syscall is now officially deprecated. The syscall

  does nothing, and prints a stern warning to users. The functionality

  is replaced by the pdflush daemons.

- Due to various changes, swap files should be just as fast as swap partitions.

- In 2.4, up to 64 swap files were possible. In 2.6, this number is reduced

  to 32.  Like 2.4, these files can be up to 64GB in size, though you will

  need a recent util-linux to have a mkswap utility that supports >2GB

 

 

Kernel preemption.

~~~~~~~~~~~~~~~~~~

- The much talked about preemption patches made it into 2.6.

  With this included you should notice much lower latencies especially

  in demanding multimedia applications. 

- Note, there are still cases where preemption must be temporarily disabled

  where we do not. These areas occur in places where per-CPU data is used.

- If you get "xxx exited with preempt count=n" messages in syslog,

  don't panic, these are non fatal, but are somewhat unclean.

  (Something is taking a lock, and exiting without unlocking)

- If you DO notice high latency with kernel preemption enabled in

  a specific code path, please report that to Andrew Morton <akpm@osdl.org>

  and Robert Love <rml@tech9.net>.

  The report should be something like "the latency in my xyz application

  hits xxx ms when I do foo but is normally yyy" where foo is an action

  like "unlink a huge directory tree".

 

 

Process scheduler improvements.

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

- Another much talked about feature. Ingo Molnar reworked the process

  scheduler to use an O(1) algorithm.  In operation, you should notice

  no changes with low loads, and increased scalability with large numbers

  of processes, especially on large SMP systems.

- Scheduler is now Hyperthreading SMP aware and will disperse processes

  over physically different CPUs, instead of just over logical CPUs.

- Robert Love wrote various utilities for changing behaviour of the

  scheduler (binding processes to CPUs etc). You can find these tools at

  http://tech9.net/rml/schedutils

- The behavior of sched_yield() changed a lot.  A task that uses

  this system call should now expect to sleep for possibly a very

  long time.  Tasks that do not really desire to give up the

  processor for a while should probably not make heavy use of this

  function.  Unfortunately, some GUI programs (like Open Office)

  do make excessive use of this call and under load their

  performance is poor.  It seems this new 2.6 behavior is optimal

  but some user-space applications may need fixing.

- The above applies to use of yield() in the kernel, too.

- 2.6 adds system calls for manipulating a task's processor

  affinity: sched_getaffinity() and sched_setaffinity()

- Regressions to mingo@redhat.com and rml@tech9.net

- Debian users who encounter effects such as skips in mp3

  playback, jerky mouse movement may want to stop the

  X server from renicing itself to -10

  You can alter this permanently with 'dpkg-reconfigure xserver-common';

  if you elect not to have /etc/X11/Xwrapper.config managed by debconf,

  simply edit it directly.

- Balancing of IRQs between multiple CPUs should be handled using the

  irqbalance (http://people.redhat.com/arjanv/irqbalance/) program.

- David Mosberger maintains a webpage containing some current 'known gotchas'

  of the O(1) scheduler at http://www.hpl.hp.com/research/linux/kernel/o1.php

 

 

PCI.

~~~~

- PCI domain support has been added.  For most people, this just means that

  all PCI slot names are extended with "0000:" on the front, but for people

  with bigger servers it means they're able to access all their PCI devices.

- More hotplug drivers have been added, including a fake PCI hotplug driver

  so people without specialised hardware can test hotplug features.

 

Random.

~~~~~~~

- /dev/hwrandom got support for some new hardware (now also backported to 2.4)

  such as the HW RNG on newer VIA Cyrix CPUs.

- rng-tools can be found at http://sourceforge.net/projects/gkernel

 

 

Fast userspace mutexes (Futexes).

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

- Rusty Russell added functionality that allows userspace to have

  fast mutexes that only use syscalls when there is contention. Used by

  NPTL.

- Additional information on futexes can be found in Ulrich Dreppers

  paper on the subject at http://people.redhat.com/drepper/futex.pdf

- Bert Hubert has written some documentation on this functionality

  at http://ds9a.nl/futex-manpages

 

 

epoll

~~~~~

Davide Libenzi wrote an event based poll replacement that got

included in 2.6.  More info available at

http://www.xmailserver.org/linux-patches/nio-improve.html

http://lwn.net/Articles/13587/

 

 

Threading improvements.

~~~~~~~~~~~~~~~~~~~~~~~

- Ingo Molnar put a lot of work into threading improvements for 2.6.

  Some of the features of this work are:

  -  Generic pid allocator (arbitrary number of PIDs with no slowdown,

     unified pidhash).

  -  Thread Local Storage syscalls

  -  sys_clone() enhancements (CLONE_SETTLS, CLONE_PARENT_SETTID, CLONE_SETTID,

     CLONE_CLEARTID, CLONE_DETACHED)

  -  POSIX thread signals stuff (atomic signals, shared signals, etc.)

  -  Per-CPU GDT

  -  Threaded coredumping support

  -  sys_exit() speedups (O(1) exit)

  -  Generic, improved futexes, vcache

  -  New, threading related ptrace features

  -  exit/fork task cache

  -  /proc updates for threading

  -  API changes for threading.

- Users should notice a significant speedup in basic thread operations.

  This is true to a lesser extent even for old-threading userspace libraries 

  such as LinuxThreads.

- Regressions should go to Ingo Molnar <mingo@redhat.com> and

  phil-list@redhat.com.  Regressions could happen in the area of signal

  handling and related threading semantics, plus coredumping.

- Native Posix Threading Library (NPTL).

  Ulrich Drepper worked closely with Ingo on the threading enhancements, and

  developed a 1:1 model threading library. You can find out more about NPTL at

  http://people.redhat.com/drepper/nptl-design.pdf

 

 

Enhanced coredumping. 

~~~~~~~~~~~~~~~~~~~~~

- 2.6 offers you the ability to configure the way core files are

  named through a /proc/sys/kernel/core_pattern file.

  You can use various format identifiers in this name to affect

  how the core dump is named.

 

    %p - insert pid into filename

    %u - insert current uid into filename

    %g - insert current gid into filename

    %s - insert signal that caused the coredump into the filename

    %t - insert UNIX time that the coredump occurred into filename

    %h - insert hostname where the coredump happened into filename

    %e - insert coredumping executable name into filename

 

  You should ensure that the string does not exceed 64 bytes.

- Multithreaded processes can now dump core

 

 

 

Input layer.

~~~~~~~~~~~~

- Possibly the most visible change to the end user. If misconfigured,

  you'll find that your keyboard/mouse/other input device will no longer work.

  2.6 offers a much more flexible interface to devices such as keyboards.

- The downside is more confusing options.

  In the "Input device support" menu, be sure to enable at least the following.

 

                    --- Input I/O drivers

                    < > Serial i/o support

                    < >   i8042 PC Keyboard controller

                    [ ] Keyboards

                    [ ] Mice

 

  (Also choose the relevant keyboard/mouse from the list)

 

- If you find your keyboard/mouse still don't work, edit the file

  drivers/input/serio/i8042.c, and replace the #undef DEBUG

  with a #define DEBUG, recompile and reinstall.

 

  When you boot, you should now see a lot more debugging information.

  Forward this information to Vojtech Pavlik <vojtech@suse.cz>

 

- If you use a KVM switcher, and experience problems, booting with the boot

  time argument 'psmouse_noext' should fix your problems.

- Users of multimedia keys without X will see changes in how the kernel

  handles those keys. People who customize keymaps or keycodes in 2.4

  may need to make some changes in 2.6

- Users wanting support for the PC speaker need to enable CONFIG_INPUT_PCSPKR,

  or you won't get a single beep.

- Synaptics touchpad users may be interested to check out

  http://w1.894.telia.com/~u89404340/touchpad/

- In 2.4 users of Japanese keyboards were able to type '|' or

  '\' characters without loading any custom keymap on the

  console.  With the keymap in 2.6, this is not possible

  anymore.  People with these keyboards have to load a keymap

  with loadkeys rebuilt from the source, since loadkeys in some

  vendor distributions cannot load keycodes larger than 127.

  There is a patch to fix this, but it has not been integrated

  (http://tinyurl.com/t75a).

- A FAQ on common problems with the new input layer is available

  at http://lwn.net/Articles/69107/

 

 

PnP layer.

~~~~~~~~~~

- Support for plug and play devices such as early ISAPnP cards has improved a

  lot in the 2.6 kernel. The new code behaves more closely to the code

  handling PCI devices (probe, remove etc callbacks), and also merges

  PnP BIOS access code.

- Report any regressions in plug & play functionality to

  Adam Belay <ambx1@neo.rr.com>

 

 

ALSA.

~~~~~

- The advanced linux sound architecture was merged into 2.6.

  This offers considerably improved functionality over the older OSS drivers,

  but requires new userspace tools.

- Several distros have shipped ALSA for some time, so you may already have the

  necessary tools. If not, you can find them at http://www.alsa-project.org/

- ALSA can emulate OSS interface using the snd_pcm_oss/snd_pcm_mixer

  modules, if your card produces nothing but silence, you may need to run

  alsamixer to unmute channels wich /dev/mixer doesn't see

- Note that the OSS drivers are also still functional, and still present.

  Many features/fixes that went into 2.4 are still not applied to these

  drivers, and it's still unclear if they will remain when 2.6 ships.

  The long term goal is to get everyone moved over to (the superior) ALSA.

 

 

AGP.

~~~~

- The agpgart driver got a long overdue cleanup which involved

  splitting it into an agpgart core, and per-chipset drivers.

  You may need to adjust your modules configuration to autoload

  the chipset drivers on loading the agpgart module.

- Generic AGP 3.0 support is now included.

 

DRI.

~~~~

- Direct rendering in 2.6 hasn't had much (if any?) testing on

  older versions of XFree86. Feedback on whether 4.1 works would

  be useful.

 

 

Faster system calls.

~~~~~~~~~~~~~~~~~~~~

- Systems that support the SYSENTER extension (Basically Intel Pentium-II

  and above, and AMD Athlons) now have a faster method of making the

  transition from userspace to kernelspace when a syscall is performed.

- Pentium Pro also has SYSENTER, but due to errata, is unusable.

- Without an updated glibc, this will not be noticable.

- VMWare 4 users may get crashes due to this.

  Zwane Mwaikambo wrote a patch for a "nosysenter" option which is worth

  googling for if there isn't a vmware update available.

- Regressions to torvalds@osdl.org and libc-alpha@sources.redhat.com

 

procps.

~~~~~~~

- The 2.6 /proc filesystems changed some statistics, which confuse older

  versions of procps. Rik van Riel and Robert Love have been maintaining a

  version of procps during the development of 2.6 which tracks changes to

  /proc which you can find at http://tech9.net/rml/procps/

- Alternatively, the procps by Albert Cahalan now supports the altered formats

  since v3.0.5  -- http://procps.sf.net/

- The /proc/meminfo format changed slightly which also broke gtop in strange

  ways. Likely this also broke some of the KDE/GNOME panel applets.

 

 

Framebuffer layer.

~~~~~~~~~~~~~~~~~~

- James Simmons has reworked the framebuffer/console layer considerably for

  2.6. Support for some cards is still lagging a little, but it should be

  functionally no different than previous incarnations.

- boot time arguments may have changed depending on your driver.

  an example of the change is..

    append = "video=radeon:1024x768-24@100"

  needs to become..

    append = "video=radeonfb:1024x768-24@100"

- Current userspace tools (fbset for eg) are not yet updated,

  and won't function as expected.

- The VESA framebuffer now enables MTRRs for the framebuffer memory range during

  initialisation (Note: PCI cards only).

  If you notice screen corruption, please report this, along with an lspci output,

  so your card can be blacklisted.

- Any problems should go to <jsimmons@infradead.org>

 

IDE.

~~~~

- The IDE code rewrite was subject to much criticism in early 2.5.x, which

  put off a lot of people from testing. This work was then subsequently

  dropped, and reverted back to a 2.4.18 IDE status.

  Since then additional work has occurred, but not to the extent

  of the first cleanup attempts.

- Known problems with the current IDE code. 

  o  Simplex IDE devices (eg Ali15x3) are missing DMA sometimes

  o  Most PCMCIA devices have unload races and may oops on eject

  o  Modular IDE does not yet work, modular IDE PCI modules sometimes

     oops on loading

  o  ide-scsi is completely broken in 2.6 currently. Known problem.

     If you need it either use 2.4 or fix it 8)

- IDE disk geometry translators like OnTrack, EZ Partition, Disk Manager

  are no longer autodetected. The only way forward is to remove the translator

  from the drive, and start over, or use boot parameters depending on the

  type of remapper used :-

    hdx=remap63   - add 63 to each sector (For OnTrack DM)

    hdx=remap     - remap 0->1 (For EZDrive)

- See also the CD Recording section for some important changes

  related to IDE CD writers.

 

IDE TCQ.

~~~~~~~~

- Tagged command queueing for IDE devices has been included.

- Not all combinations of controllers & devices may like this,

  so handle with care.

  READ AS: ** Don't use IDE TCQ on any data you value.

  It's likely bad combinations will be blacklisted as and when discovered.

 

- If you didn't choose the "TCQ on by default" option, you can enable

  it by using the command

 

    echo "using_tcq:32" > /proc/ide/hdX/settings

 

  (replacing 32 with 0 disables TCQ again).

 

- Report success/failure stories to Jens Axboe <axboe@suse.de> with

  inclusion of hdparm -i /dev/hdX, and lspci output.

 

 

SCSI.

~~~~~

- Various SCSI drivers still need work, and don't even compile.

- Various drivers currently lack error handling.

  These drivers will cause warnings during compilation due to

  missing abort: & reset: functions.

- Note, that some drivers have had these members removed, but still

  lack error handling. Those noticed so far are ncr53c8xxx, sym53c8xx

- large dev_t support allowing thousands of disks to be

  supported (was 128 or 256 in the 2.4 series)

- major code cleanup, initially to support the block layer (bio)

  improvements have led to:

   - better throughput (?) [less double handling of data]

   - per HBA locks (there was a single io_request_lock in

     the 2.4 series)

   - more flexible interface to HBA drivers

   - better hotplug support, especially for USB mass storage

     and ieee1394 sbp2 devices [well it's work_in_progress]

- improved error processing and scanning code (support for

  large, sparse lun spaces)

- lots of scsi driver internals available via sysfs

 

 

v4l2.

~~~~~

- The video4linux API finally got its long awaited cleanup.

- xawtv, bttv and most other existing v4l tools are also compatible

  with the new v4l2 layer. You should notice no loss in functionality.

- See http://bytesex.org/v4l/ for more information.

 

 

Quota reworking.

~~~~~~~~~~~~~~~~

The new quota system needs new tools. Supports 32 bit uids.

http://www.sf.net/projects/li

eclipse 使用心得

昨天捣鼓了一天的eclipse,自我感觉良好,感觉eclipse有点像DELPHI,一切为插件的口号让人激动不已,当然eclipse可以作为C++的IDE,前提是安装c/c++ide插件,具体下载http://www.eclipse.org/downloads/,

ECLIPSE 包括JDT(标准插件)和PDE 插件开发环境,更让人不可思议的是,它居然有完全汉化的版本,就连帮助也是全汉化的,汉化语言包是作为插件安装进入ide的,像我这样外语不好的朋友可以有福了.

不过Language Pack有大约1几个文件,都在http://download.eclipse.org/eclipse/downloads/drops/L-3.1.1_Language_Packs-200510051300/index.php,全都要下载下来,镜像下载点个人感觉台湾的yat-sen大学的快,浙江大学的下载点估计已经关闭了(大陆的就是不行啊),下载后将这些文件解压,每个目录下面都有一个eclipse目录,大家可以之间把它们覆盖到你的eclipse安装目录下.

不过我建议把他们全部复制到一个单独的目录里,然后在eclipse安装目录下建立一个links目录,然后在links目录下建立一个*.link的文本文档,在文档里写入path=C:\\eclipse311\\lag路径(我的语言包是放在C:\eclipse311\lag下的),然后重新打开eclipse,一个几乎全中文的界面就跳出来了.

客户端到服务端,c/s结构,用户验证

java真的很难写啊,用惯了Delphi,C#之类容易调试的编程工具,

没办法一点一点的写吧,

今天又写了个从客户端发送字符串,到服务端验证的代码,刚好把前一次的用户验证类用上,不过做了些修改.

通过这段时间的写代码,渐渐的对java也熟悉些了,速度也慢慢快起来了,自己心中窃喜

附件:talk.rar,3620 bytes

从客户端往服务端发送消息的代码

客户端

public class TalkClient {

   

    public static void main(String[] args) {

        // Create application frame.

        ClientSend cs = new ClientSend();

        TalkClientFrame frame = new TalkClientFrame(cs);

       

        // Show frame

        frame.setVisible(true);

       

    }

}

//----------------------------------------------------

import java.net.*;

public class ClientSend {

private DatagramSocket ds_CSend;

private DatagramPacket dp_CSend;

public ClientSend(){

try{

    ds_CSend = new DatagramSocket(8080);

}

catch(Exception e){

e.printStackTrace();

}

}

public void Sended(byte[] buf,String sip){

try{

    dp_CSend = new DatagramPacket(buf,buf.length,InetAddress.getByName(sip),8888);

    ds_CSend.send(dp_CSend);

}

catch(Exception e){

e.printStackTrace();

}

}

}

///----------------------------------------------------------------

import java.awt.*;

import java.awt.event.*;

import java.net.*;

public class TalkClientFrame extends Frame {

     private List lst = new List(6);//存放对话内容

     private TextField tf_Data = new TextField(20);//存放发送内容       

     private TextField tf_ip = new TextField(15);//存放IP和PORT;

     private ClientSend cs;

  

     public TalkClientFrame(ClientSend cs) {

     this.cs = cs;

     tf_ip.setText("127.0.0.1");

        Panel p_Data = new Panel();//放置tf_Data,tf_ip的容器

 

     

//-----------------------布局-----------------------------------

        this.add(lst,"Center");

        this.add(p_Data,"South");

        p_Data.add(tf_ip,"West");

        p_Data.add(tf_Data,"East");

       

        tf_Data.addActionListener(new ActionListener(){

        public void actionPerformed(ActionEvent evt){

        //

       

        tf_Dataactionperformed(evt);

        }

        });

//----------------------------------------------------------------

        MenuBar menuBar = new MenuBar();

        Menu menuFile = new Menu();

        MenuItem menuFileExit = new MenuItem();

       

        menuFile.setLabel("文件(F)");

        menuFileExit.setLabel("退出(X)");

       

        // Add action listener.for the menu button

        menuFileExit.addActionListener

        (

            new ActionListener() {

                public void actionPerformed(ActionEvent e) {

                if (tf_Data.getText().length()>0)

                    TalkClientFrame.this.windowClosed();

                }

            }

        );

        menuFile.add(menuFileExit);

        menuBar.add(menuFile);

       

        setTitle("TalkClient");

        setMenuBar(menuBar);

        setSize(new Dimension(350, 400));

       

        // Add window listener.

        this.addWindowListener

        (

            new WindowAdapter() {

                public void windowClosing(WindowEvent e) {

                    TalkClientFrame.this.windowClosed();

                }

            }

        ); 

    }

   

    void tf_Dataactionperformed(ActionEvent e){

    byte[] buf = tf_Data.getText().getBytes();

    String strIp = tf_ip.getText();

    try{

        cs.Sended(buf,strIp); 

         

    }

    catch(Exception ex){

    ex.printStackTrace();

    }

    tf_Data.setText("");

    }

    /**

     * Shutdown procedure when run as an application.

     */

    protected void windowClosed() {

   

    // TODO: Check if it is safe to close the application

   

        // Exit application.

        System.exit(0);

    }

   

}

服务端

public class talkServer {

public static void main(String[] args) {

// TODO: Add your code here

talkRecv tR = new talkRecv();

tR.Recved();

}

}

//------------------------------------------------

import java.net.*;

public class talkRecv {

private DatagramSocket ds_Recv;

private DatagramPacket dp_Recv;

public boolean b_stop=true;

public talkRecv(){

try{

    ds_Recv = new DatagramSocket(8888);//将8888端口作为接受端口

    byte[] buf = new byte[1024];

    dp_Recv = new DatagramPacket(buf,1024);

}

catch(Exception e){

e.printStackTrace();

}

}

public void Recved(){

while(b_stop){

try{

    ds_Recv.receive(dp_Recv);

    String str_info = new String(dp_Recv.getData(),0,dp_Recv.getLength());

    System.out.println("  ip:"+dp_Recv.getAddress().getHostAddress());    

    System.out.println("port:"+dp_Recv.getPort());

    System.out.println("data:"+str_info);

}

catch (Exception e){

e.printStackTrace();

}

}

}

}

//------------------------------------------------

这几个类都没怎么考虑对象的释放问题,这个问题希望那位大大能够关注一下,给小弟一点指点,小弟感激不禁

一个查询登陆数据验证的程序

有两个文件

public class talkServer {

/*中间件主程序

*/

public static void main(String[] args) {

// TODO: Add your code here

db_Access db= new db_Access();

if(db.loging(args[0],args[1])){

System.out.println("验证通过");

}

else{

System.out.println("验证失败");

};

}

}

///////////////////////////////////////////////////////////////////////

import java.sql.*;

import java.util.*;

public class db_Access {

private Connection db_connect;//定义与数据库进行连接的对象

private ResultSet rs;         //定义数据库查询结果对象

private Statement st;         //定义数据库查询对象

// private Vector vt;            //定义结果数组

public db_Access(){

try{

    Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");

    //知道是返回一个JDBC-ODBC的桥驱动程序对象,但是在这里这样写有什么作用

    //就不得而知了

    String url ="jdbc:odbc:talkdb";

    db_connect = DriverManager.getConnection(url);

    st = db_connect.createStatement(ResultSet.TYPE_SCROLL_SENSITIVE,

       ResultSet.CONCUR_READ_ONLY); //创建statement接口对象实例

}

catch(Exception e){

//可以把异常做成一个类,不知道有没有现成的好类可以用的

e.printStackTrace();

}

}

public boolean loging(String un,String pd){

String strSQL = "SELECT count(id) AS aid FROM userinfo WHERE (username ='"

  + un +"')AND(password ='" + pd +"')" ;

try{

    rs = st.executeQuery(strSQL); //执行设计好的sql语句

        rs.next();

            if (rs.getInt(1)==0){  //这里的getInt()的字段索引居然是1,那么0是什么哪?

    return false;

    }

    else{

    return true;

    }

}

catch(Exception e){

e.printStackTrace();

}

return false;

}

}

数据库格式为 id username password

有个问题,为什么当我故意查找错误的username和password的时候,

rs.getInt老是抛出"非法游标状态"的异常?正确的密码组合到没事情

我用的是select count啊,应该返回0这个值的啊,亲娘唉,真令人费解啊.

明天又要出发去武引勘测渠道了

  托老天爷的福,下了一场大雨。让我们好好的休息了三天,明天早上领导要求5:00到单位集合,统一吃早饭,然后出发,一组直奔金华镇,一组到复兴镇。我可能跟第一组先到金华镇。

  又要辛苦了,要早点休息。明天早上不要迟到。

classpath 问题

很简单的类的调用,但是在JCREAT中用工程和工作空间能够编译运行,但是在cmd下用java命令却运行不了

package killgod;

public class A {

/**

* Method sayHellow

*

*

*/

public void sayHellow() {

// TODO: Add your code here

String s1 = "我要发财",s2 = "我要发财";

if (s1 == s2 ){

  System.out.println("第一次试验:"+s1);

}

else System.out.println("世界和平");

s1 = new String("我要发财");

s2 = new String("我要发财");

if (s1 == s2 ){

  System.out.println("第2次试验:" + s1);

}

else System.out.println("第2次试验:世界和平");

}

}

运行类

package killgod;

public class SencondDemo {

public int x = 1;

/**

* Method main

*

*

* @param args

*

*/

public static void main(String[] args) {

// TODO: Add your code here

if(args.length > 0 ){

System.out.println("第一个参数是 "+args[0]);

}

else{

new SencondDemo().callA(new A());

}

}

/**

* Method callA

*

*

* @param a

*

*/

public static void callA(A a) {

// TODO: Add your code here

a.sayHellow();

}

}

我在cmd下面使用了 set CLASSPATH = ?????的命令,结果还是没有效果,真是奇怪啊!

看来classpath问题要好好研究一下了。

一个猴子扮苞谷的程序

先写点习作熟悉一下JAVA的工作

class monky

{

int[] goods = new int[100];

//getGood作为litte monky的行为成员

void getGood(int good,int i)

{

goods[i] = good;

}

//开始计算扳了多少

void count()

{

int all =0;

for(int i=0;i<100;i++)

{

all = all+goods[i];

  System.out.print(goods[i]+",");

}

  System.out.println(" ");

  System.out.print("总重:"+all);

}

}

class monkyPlay

{

public static void main(String[] args)

{

  monky mk = new monky();

for(int i=0;i<100;i++)

//随机产生不同重量的苞谷

  mk.getGood((int)(Math.random()*3000),i); 

  mk.count();  

}

}