LinuxSir.cn,穿越时空的Linuxsir!

 找回密码
 注册
搜索
热搜: shell linux mysql
查看: 4140|回复: 34

SUSE 速度大提升,重新编译内核+CK补丁解决速度问题

[复制链接]
发表于 2006-5-30 23:30:33 | 显示全部楼层 |阅读模式
SUSE的速度一向是为人所诟病的。特别对于中国的情况,很多人的电脑并不是很快,
SUSE的内核设置对于我们来说是很慢的,Con Kolivas推出的补丁可以提高运行的效率。
SUSE社区的SUPER项目,也计划使用这个补丁来提高速度。这里贴一篇官方的HOW TO

准备
www.kernel.org下载内核
在任意地方解压内核。例子使用了linux-2.6.16.tar.bz2
CK补丁只有针对2.6.16版的,不要用高于这个的,如2.6.16.1等。
下载完放到/usr/src,然后解压
命令:
  1. cd /usr/src/
  2. tar xjf /usr/src/linux-2.6.16.tar.bz2
复制代码
打补丁:
把解压出的内核文件夹改名,例如你要打补丁到 2.6.16-ck11
命令:
  1. mv linux-2.6.16 linux-2.6.16-ck11
复制代码
然后下载你要打的补丁,这里是patch-2.6.16-ck11.bz2,在ftp.kernel.org的people
目录里面,ck文件夹,进去找到需要的版本。要适合你的源码版本,不然会出错。
在通常情况下,大多数补丁要求你进入内核目录,所以
  1. cd linux-2.6.16-ck11
复制代码
然后用下面的命令打上补丁, 把patch-2.6.16-ck11.bz2放到/usr/src,
  1. bzcat /usr/src/patch-2.6.16-ck11.bz2 | patch -p1
复制代码
下面是编译内核的内容,我用的是SUSE自带的config文件,在/boot目录,就是
那个config-2.6.16.13-4-default改名为.config放入内核源文件目录。如果
有什么提示说config文件没有定义的,要求定义,是因为SUSE改了内核,
全部用默认,一路回车。然后运行命令 make 就可以了。
make 完以后要安装
  1. make install
  2.   make modules_install
  3.   cp .config /boot/config-2.6.16-ck11
  4.   mkinitrd
复制代码
还有一点要说的是SUSE的mkinitrd命令,在源文件目录直接运行就可以了,会自动
生成initrd文件并放入/boot目录,你只要改下menu.list就可以了。
这些就不翻译了,很多人看得懂。

Quick walthrough on manually patching to -ck for beginners.
Preparing:
Download the latest kernel from www.kernel.org
Untar it somewhere (people most often use /usr/src/linux-XXX but that
requires root access to write to). Eg using linux-2.6.12.tar.bz2

rename it to the kernel you're going to patch it to (this is optional but it
allows you to know which kernel is where). Eg if you are patching up to
2.6.12-ck6:

then download the patch you'll be patching with (in this case
patch-2.6.12-ck6.bz2).

By convention most kernel patches are diffed in a way that requires you to
enter the top directory of the kernel you're patching:


Then patch by uncompressing it (bzcat) and patching it (patch) one go by
piping the output of bzcat to patch like so:


Configuring:

Your kernel source needs configuring and the easiest way for beginners is to
copy an existing configuration that you know works and working from that. Eg
most distributions copy the config file to /boot and you'll find something
like this:

/boot/config-2.6.11-1-686-smp
You can either open this from the kernel configuration menu or copy it to be
used by the update script (recommended):

cp /boot/config-2.6.11-1-686-smp .config
A feature of 2.6 kernels that can be exploited is that the kernel build itself
can include the configuration data in it and the contents read easily if the
following options are enabled in general setup (recommended):

  • Kernel .config support

  •    Enable access to .config through /proc/config.gz
    If these are enabled you can copy the existing config and use that instead:

    gunzip -c /proc/config.gz > .config

    Now you can do the configuration either by bringing up one of the menu based
    configuring tools but this won't show you what new options have appeared from
    getting a new kernel so I recommend the oldconfig script:
    make oldconfig

    This will only prompt you for any new features in the kernel which are usually
    easy enough to understand, but generally if you don't know then choosing the
    default recommended by the script just by pressing enter will do.

    Building:
    The 2.6 kernel build process is simple:
    make

    If you have more than one processor such as with hyperthreading or real
    multiprocessor you can speed up the process with parallel builds which the
    kernel build does exceptionally well. Replace X below with the number of
    cpus you have + 1 (a quirk in the build process requires one extra job).
    Higher "job numbers" than what I've recommended are pointless as at most
    they can only speed up the build process by less than 1%.

    make -jX

    If you are already running a -ck kernel, you can use BATCH scheduling to make
    the build process virtually unnoticeable by using only spare cpu cycles,
    provided you have schedtools installed:

    schedtool -B -e make -jX

    if not, the next best thing on mainline is to nice the make heavily:

    nice -n 19 make -jX

    Note that 'nicing' the build process does _not_ slow down how long it takes
    to build. It just means that if you do anything else on your machine at the
    same time it will take priority cpu away.
    Installing:
    A lot of distributions support methods for installing custom kernels so if you
    desire you can use that method. Otherwise here is a manual summary:

    cp arch/i386/boot/bzImage /boot/vmlinuz-2.6.12-ck6
    make modules_install
    cp .config /boot/config-2.6.12-ck6 (optional)
    mkinitrd /boot/initrd-2.6.12-ck6.img 2.6.12-ck6 (only required if you use initrd)

    if you have another architecture like x86_64 the first step is instead:

    cp arch/x86_64/boot/bzImage /boot/vmlinuz-2.6.12-ck6
    Then you have to add the information to your bootloader.
    Many distributions have automated tools for installing new custom kernels in
    their configuration tools and you can use those. Be wary to never make a new
    kernel the only option, as if it doesn't boot you may be in serious trouble.
    Also it is not a good idea to make it the default kernel to boot if you have
    not booted it at least once before.

    Manual bootloader install to be done (hopefully)...
    Con Kolivas

    Last Modified:
    Tue Jan 24 11:30:11 2006
  •  楼主| 发表于 2006-5-31 00:37:35 | 显示全部楼层

    还有点问题

    发现一个问题,启动splash没有了。还没有解决。有人有办法吗?
    速度到是真的提高了。
    回复 支持 反对

    使用道具 举报

    发表于 2006-5-31 01:06:02 | 显示全部楼层
    Post by rqn
    发现一个问题,启动splash没有了。还没有解决。有人有办法吗?
    速度到是真的提高了。

    mkinitrd一个
    回复 支持 反对

    使用道具 举报

     楼主| 发表于 2006-5-31 01:09:40 | 显示全部楼层
    mkinitrd我试过,还运行过splash命令,结果不能启动,我就换回原来的initrd了。
    刚才又试了一下wine,发现wine的速度居然飞快,哈哈.终于可以用我的比特精灵下5Q的东西了。
    不要splash也行,反正我原来也都喜欢按F2的。
    回复 支持 反对

    使用道具 举报

    发表于 2006-5-31 02:18:54 | 显示全部楼层
    Post by rqn
    mkinitrd我试过,还运行过splash命令,结果不能启动,我就换回原来的initrd了。
    刚才又试了一下wine,发现wine的速度居然飞快,哈哈.终于可以用我的比特精灵下5Q的东西了。
    不要splash也行,反正我原来也都喜欢按F2的。

    mkinitrd -s MxN
    MxN是分辨率
    然后给kernel那行传递相应的vga=???的参数
    记着Bootsplash只支持16bits色的FrameBuffer
    两者统一就没问题了
    回复 支持 反对

    使用道具 举报

    发表于 2006-5-31 02:19:46 | 显示全部楼层
    顺便,kernel-source都装了你还下载干什么呢?
    回复 支持 反对

    使用道具 举报

    发表于 2006-5-31 08:41:09 | 显示全部楼层
    能提高添加网络安装源的速度吗?还有能提高打开模块的速度吗?我每次看到正在启动某某模块的字样就不爽。
    回复 支持 反对

    使用道具 举报

    发表于 2006-5-31 08:48:35 | 显示全部楼层
    回复 支持 反对

    使用道具 举报

    发表于 2006-5-31 09:16:41 | 显示全部楼层
    jamesl 老兄:
    如何升级网络安装源的问题!谢谢!
    回复 支持 反对

    使用道具 举报

    发表于 2006-5-31 09:26:42 | 显示全部楼层
    把ftp这个目录下载了,回头看看,谢谢了
    回复 支持 反对

    使用道具 举报

    您需要登录后才可以回帖 登录 | 注册

    本版积分规则

    快速回复 返回顶部 返回列表