|
|
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,然后解压
命令:
- cd /usr/src/
- tar xjf /usr/src/linux-2.6.16.tar.bz2
复制代码 打补丁:
把解压出的内核文件夹改名,例如你要打补丁到 2.6.16-ck11
命令:- mv linux-2.6.16 linux-2.6.16-ck11
复制代码 然后下载你要打的补丁,这里是patch-2.6.16-ck11.bz2,在ftp.kernel.org的people
目录里面,ck文件夹,进去找到需要的版本。要适合你的源码版本,不然会出错。
在通常情况下,大多数补丁要求你进入内核目录,所以然后用下面的命令打上补丁, 把patch-2.6.16-ck11.bz2放到/usr/src,- 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 完以后要安装- make install
- make modules_install
- cp .config /boot/config-2.6.16-ck11
- 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 |
|