Linux内核升级与Reser4文件系统

概述:想使用Reiser4文件系统,以便使用小文件系统的性能优势,用于BIND的数据文件存储,不过,实际测试之后未发现性能方面的大幅提升。主要目的是想提高NAMED服务启动速度与加载速度。

# 查看当前内核版本,测试环境为Linux  AS4 U7+Bind9.2.4
[root@localhost src]# uname -a
Linux localhost.localdomain 2.6.9-78.ELsmp #1 SMP Wed Jul 9 15:39:47 EDT 2008 i686 i686 i386 GNU/Linux

# 下载内核及对应版本的reiser4内核补丁,保存位置在/usr/src

http://www.kernel.org/pub/linux/kernel/people/edward/reiser4/reiser4-for-2.6/
http://www.kernel.org/pub/linux/utils/fs/reiser4/reiser4progs/
http://www.kernel.org/pub/linux/kernel/v2.6/

http://www.kernel.org/pub/linux/kernel/v2.6/linux-2.6.28.tar.gz
http://www.kernel.org/pub/linux/utils/fs/reiser4/reiser4progs/reiser4progs-1.0.7.tar.gz
http://www.kernel.org/pub/linux/kernel/people/edward/reiser4/reiser4-for-2.6/reiser4-for-2.6.28.patch.gz
http://www.kernel.org/pub/linux/utils/fs/reiser4/libaal/libaal-1.0.5.tar.gz

linux-2.6.28.tar.gz
libaal-1.0.5.tar.gz
reiser4-for-2.6.28.patch.gz
reiser4progs-1.0.7.tar.gz

# 解压
[root@localhost src]# tar zxvf linux-2.6.28.tar.gz

# 建立连接
[root@localhost src]# ln -s linux-2.6.28 linux-2.6
[root@localhost src]# ln -s linux-2.6 linux
[root@localhost src]# ll
total 67060
drwxr-xr-x   5 root root     4096 Jul 28 09:05 kernels
-rw-r–r–   1 root root   336052 Jul 25 03:53 libaal-1.0.5.tar.gz
lrwxrwxrwx   1 root root        9 Jul 28 09:40 linux -> linux-2.6
lrwxrwxrwx   1 root root       12 Jul 28 09:40 linux-2.6 -> linux-2.6.28
drwxr-xr-x  22 root root     4096 Dec 25  2008 linux-2.6.28
-rw-r–r–   1 root root 66766084 Dec 25  2008 linux-2.6.28.tar.gz
drwxr-xr-x   7 root root     4096 Jul 28 09:06 redhat
-rw-r–r–   1 root root   606988 Jul 27 15:28 reiser4-for-2.6.28.patch.gz
-rw-r–r–   1 root root   844306 Feb 10 00:42 reiser4progs-1.0.7.tar.gz

# 安装reiser4相关的组件
[root@localhost src]# tar zxvf libaal-1.0.5.tar.gz
[root@localhost src]# cd libaal-1.0.5
[root@localhost libaal-1.0.5]# ./configure –prefix=/usr
[root@localhost libaal-1.0.5]# make
[root@localhost libaal-1.0.5]# make install
[root@localhost libaal-1.0.5]# /sbin/ldconfig

[root@localhost libaal-1.0.5]# cd ..
[root@localhost src]# tar zxvf reiser4progs-1.0.7.tar.gz
[root@localhost src]# cd reiser4progs-1.0.7
[root@localhost reiser4progs-1.0.7]# ./configure –prefix=/usr
[root@localhost reiser4progs-1.0.7]# make
[root@localhost reiser4progs-1.0.7]# make install
[root@localhost reiser4progs-1.0.7] /sbin/ldconfig
# 检查源代码、配置核心选项、升级内核模块
[root@localhost reiser4progs-1.0.7]# cd ..
[root@localhost src]# cd linux
[root@localhost linux]#
[root@localhost linux]# gzip -cd ../reiser4-for-2.6.28.patch.gz | patch -p1
# 确保源代码目录下没有不正确的.o文件
[root@localhost linux]# make mrproper
[root@localhost linux]# make menuconfig
# 弹出内核配置菜单
记得要把下面的选上(实际配置中未找到这项)
Code maturity level options
—> Prompt for development and/or incomplete code/drivers
然后确保4k stacks没有选
Kernel hacking —> Use 4Kb for kernel stacks instead of 8Kb
记得把reiser4的选项选上
File system—>reiser4相关的全选上

[*] Networking support  —>
Networking options  —>
[*] Network packet filtering framework (Netfilter)  —>
Core Netfilter Configuration  —>如果不清楚细节,最好选择所有子项
<M> Netfilter connection tracking support
<*>   “state” match support
# 如果上述state没有选中,则添加“iptables -A INPUT -m state –state ESTABLISHED,RELATED -j ACCEPT”规则时,可能会出现
No chain/target/match by that name?
[root@localhost linux]# make clean
[root@localhost linux]# make dep
HOSTCC  scripts/basic/fixdep
HOSTCC  scripts/basic/docproc
HOSTCC  scripts/basic/hash
HOSTCC  scripts/kconfig/conf.o
HOSTCC  scripts/kconfig/kxgettext.o
HOSTCC  scripts/kconfig/zconf.tab.o
HOSTLD  scripts/kconfig/conf
scripts/kconfig/conf -s arch/x86/Kconfig
*** Warning: make dep is unnecessary now.
[root@localhost linux]# make bzImage

Root device is (253, 0)
Setup is 12696 bytes (padded to 12800 bytes).
System is 2034 kB
CRC 13160a8f
Kernel: arch/x86/boot/bzImage is ready  (#1)
#
[root@localhost linux]# make modules
[root@localhost linux]# make modules_install
[root@localhost linux]# make install
sh /usr/src/linux-2.6.23.17/arch/i386/boot/install.sh 2.6.23.17 arch/i386/boot/bzImage System.map “/boot”

# 以下两步无须执行,在2.6内核中
[root@localhost linux]# mkinitrd /boot/initrd-2.6.23-17.EL.img 2.6.23-17
/lib/modules/2.6.23-17 is not a directory.
[root@localhost linux]# cp arch/i386/boot/bzImage /boot/bzImage-2.6.22-17

# 查看修改grub.conf设置
[root@localhost linux]# make install
sh /usr/src/linux-2.6.28/arch/x86/boot/install.sh 2.6.28 arch/x86/boot/bzImage System.map “/boot”
[root@localhost linux]# cat /etc/grub.conf
# grub.conf generated by anaconda
#
# Note that you do not have to rerun grub after making changes to this file
# NOTICE:  You do not have a /boot partition.  This means that
#          all kernel and initrd paths are relative to /, eg.
#          root (hd0,0)
#          kernel /boot/vmlinuz-version ro root=/dev/sda1
#          initrd /boot/initrd-version.img
#boot=/dev/sda
default=1
timeout=5
splashimage=(hd0,0)/boot/grub/splash.xpm.gz
hiddenmenu
title Red Hat Enterprise Linux AS (2.6.28)
root (hd0,0)
kernel /boot/vmlinuz-2.6.28 ro root=LABEL=/ rhgb quiet
initrd /boot/initrd-2.6.28.img
title Red Hat Enterprise Linux AS (2.6.9-78.ELsmp)
root (hd0,0)
kernel /boot/vmlinuz-2.6.9-78.ELsmp ro root=LABEL=/ rhgb quiet
initrd /boot/initrd-2.6.9-78.ELsmp.img
title Red Hat Enterprise Linux AS-up (2.6.9-78.EL)
root (hd0,0)
kernel /boot/vmlinuz-2.6.9-78.EL ro root=LABEL=/ rhgb quiet
initrd /boot/initrd-2.6.9-78.EL.img

# 重启服务器查看内核

#创建Reiser4文件系统

[root@localhost ~]# mkfs.reiser4 /dev/sda2
mkfs.reiser4 1.0.7
Copyright (C) 2001-2005 by Hans Reiser, licensing governed by reiser4progs/COPYING.

Block size 4096 will be used.
Linux 2.6.28 is detected.
Error: Device /dev/sda2 is mounted at the moment. Use -f to force over.
[root@localhost ~]# umount /dev/sda2
[root@localhost ~]# df
Filesystem           1K-blocks      Used Available Use% Mounted on
/dev/sda1             10072456    532052   9028736   6% /
none                   4141308         0   4141308   0% /dev/shm
/dev/sda5             40725488     81988  38574732   1% /home
/dev/sda6             42330672   4106984  36073392  11% /usr
[root@localhost ~]# mkfs.reiser4 /dev/sda2
mkfs.reiser4 1.0.7
Copyright (C) 2001-2005 by Hans Reiser, licensing governed by reiser4progs/COPYING.

Block size 4096 will be used.
Linux 2.6.28 is detected.
Uuid 98d002b8-cc2e-4035-a3de-bdeeb92dafbf will be used.
Reiser4 is going to be created on /dev/sda2.
(Yes/No): Yes
Creating reiser4 on /dev/sda2 … done
[root@localhost ~]#

[root@localhost ~]# cat /etc/fstab
# This file is edited by fstab-sync – see ‘man fstab-sync’ for details
LABEL=/                 /                       ext3    defaults        1 1
none                    /dev/pts                devpts  gid=5,mode=620  0 0
none                    /dev/shm                tmpfs   defaults        0 0
LABEL=/home             /home                   ext3    defaults        1 2
none                    /proc                   proc    defaults        0 0
none                    /sys                    sysfs   defaults        0 0
LABEL=/usr              /usr                    ext3    defaults        1 2
#LABEL=/var/named        /var/named              ext3    defaults        1 2
/dev/sda2               /var/named              reiser4 defaults       0 0
LABEL=SWAP-sda3         swap                    swap    defaults        0 0
/dev/scd0               /media/cdrom            auto    pamconsole,exec,noauto,managed 0 0

注:linux-2.6.28内核升级时,在make modules  时会出现如下指示:

drivers/net/igb/igb_main.c: In function `igb_up’:
drivers/net/igb/igb_main.c:130: sorry, unimplemented: inlining failed in call to ‘igb_set_rah_pool’: function body not available
drivers/net/igb/igb_main.c:938: sorry, unimplemented: called from here
drivers/net/igb/igb_main.c:133: sorry, unimplemented: inlining failed in call to ‘igb_set_vmolr’: function body not available
drivers/net/igb/igb_main.c:939: sorry, unimplemented: called from here
make[3]: *** [drivers/net/igb/igb_main.o] 错误 1
make[2]: *** [drivers/net/igb] 错误 2
make[1]: *** [drivers/net] 错误 2
make: *** [drivers] 错误 2

官方已经确认问题,不过,我用官方提供的igb_main.c替换后,编译仍然未通过

发表评论