1.安装系统时,装好GCC编译器和rpmbuild
#yum install gcc*
#yum install rpm-build*
2.到以下地址下载源码RPM包:
ftp://ftp.redhat.com:/pub/redhat/linux/enterprise/5Server/en/os/SRPMS
选择与系统内相对应的源码RPM包,这里我们以2.6.18-164.e15为例.
使用#uname -r查看内核版本号,并且注意系统的是32位版本,还是64位版本.
3.安装源RPM包
#mkdir -p /usr/src/redhat/SOURCES
#rpm -ivh kernel-2.6.18-164.e15.src.rpm
安装时出现以下警告:
- warning: user mockbuild does not exist - using root
-
warning: group mockbuild does not exist - using root
-
warning: user mockbuild does not exist - using root
出现这种警告时,不必理会,是因为系统中不存在mockbuild用户和组.
4.编译内核配置
cd /usr/src/redhat/SPECS
rpmbuild --target=x86_64 -bp kernel-2.6.spec #给内核文件打补丁,这里--target请根据自己内核的版本设定.
###############编译时一般需要安装redhat-rpm-config和unifdef两个软件包###############
cd /usr/src/redhat/BUILD/kernel-2.6.18/linux-2.6.18.x86_64 #进入内核源码目录,准备编译内核.
5.编译内核fs模块
make menuconfig
如提示以下错误,请安装ncurses-devel软件包
- make[2]: *** [scripts/kconfig/lxdialog/checklist.o] Error 1
-
make[1]: *** [menuconfig] Error 2
-
make: *** [menuconfig] Error 2
进入File system------>选择Reiserfs support支持(建议标记为M),保存后退出.
- Reiserfs support | |
-
| |[*] Enable reiserfs debug mode | |
-
| |[*] Stats in /proc/fs/reiserfs
vi Makefile
修改以下内容,这里以2.6.18-164.e15为例(请根据自己内核版本修改)
VERSION = 2
PATCHLEVEL = 6
SUBLEVEL = 18
EXTRAVERSION = -164.e15
RHEL_MAJOR = 5
RHEL_MINOR = 4
NAME=x86_64
这是为了编译出来的模块与现有内核版本信息一致,否则无法挂在模块.
#make
- LD fs/reiserfs/built-in.o
-
CC [M] fs/reiserfs/bitmap.o
-
CC [M] fs/reiserfs/do_balan.o
-
CC [M] fs/reiserfs/namei.o
-
CC [M] fs/reiserfs/inode.o
-
CC [M] fs/reiserfs/file.o
-
CC [M] fs/reiserfs/dir.o
-
CC [M] fs/reiserfs/fix_node.o
-
CC [M] fs/reiserfs/super.o
-
CC [M] fs/reiserfs/prints.o
-
CC [M] fs/reiserfs/objectid.o
-
CC [M] fs/reiserfs/lbalance.o
-
CC [M] fs/reiserfs/ibalance.o
-
CC [M] fs/reiserfs/stree.o
-
CC [M] fs/reiserfs/hashes.o
-
CC [M] fs/reiserfs/tail_conversion.o
-
CC [M] fs/reiserfs/journal.o
-
CC [M] fs/reiserfs/resize.o
-
CC [M] fs/reiserfs/item_ops.o
-
CC [M] fs/reiserfs/ioctl.o
-
CC [M] fs/reiserfs/procfs.o
-
LD [M] fs/reiserfs/reiserfs.o
-
LD fs/squashfs/built-in.o
-
CC [M] fs/squashfs/inode.o
-
CC [M] fs/squashfs/squashfs2_0.o
当reiserfs编译完成后,就可以按ctrl+c中止了.
#make modules SUBDIRS=fs/reiserfs
#编译reiserfs模块,查看fs/reiserfs文件中是否存在reiserfs.ko文件,如果存在,则编译成功.
#mkdir /lib/modules/2.6.18-8.el5/kernel/fs/reiserfs
#cp fs/reiserfs/reiserfs.ko /lib/modules/2.6.18-8.el5/kernel/fs/reiserfs/
#depmod #生成依赖关系
#modprobe reiserfs #挂载reiserfs模块
#lsmod |grep reiserfs #查看模块是否挂在成功
5.安装reiserfsprogs-3.6.21.tar.gz工具:
#tar zxvf reiserfsprogs-3.6.21.tar.gz
#cd reiserfsprogs-3.6.21
#./configure
#make && make install
安装完成后会有mkreiserfs命令.
阅读(2755) | 评论(0) | 转发(0) |