Redhat ntfs driver complie

来源:互联网 发布:广联达预算软件购买 编辑:程序博客网 时间:2024/06/02 19:51

1.Download the related kernel src.rpm.

Download website: ftp://ftp.redhat.com/pub/redhat/linux/enterprise/5Server/en/os/SRPMS/

root -->uname -r             //check your system kernel version.       

2.6.18-194.el5xen

So, you need download the following src.rpm:

root --> wget ftp://ftp.redhat.com/pub/redhat/linux/enterprise/5Server/en/os/SRPMS/kernel-2.6.18-194.el5.src.rpm

2.Prepare the build environment

root -->yum install gcc make ncurses-devel rpm-build

3.Rpmbuild

root -->rpm -ivh kernel-2.6.18-194.el5.src.rpm
root -->rpmbuild -bp --target=i686  /usr/src/redhat/SPECS/kernel-2.6.spec
root -->vi  /usr/src/redhat/BUILD/kernel-2.6.18/linux-2.6.18.i686/Makefile

- - -   EXTRAVERSION = -prep
+++ EXTRAVERSION = -194.el5xen

Pls modify this line to be suitable for your own kernel.

4.Complie

root -->cd /usr/src/redhat/BUILD/kernel-2.6.18/linux-2.6.18.i686

root -->make oldconfig

root -->make menuconfig

Select the ntfs module, you could build the ntfs module as a ko file , or as build-in kernel module.

root -->make modules SUBDIRS=/usr/src/redhat/BUILD/kernel-2.6.18/linux-2.6.18.i686/fs/ntfs/

Unfortunately, there is one bug in the ntfs code,you maybe come across the following error:

fs/ntfs/aops.c:418: error: (Each undeclared identifier is reported only once
fs/ntfs/aops.c:418: error: for each function it appears in.)
make[2]: *** [fs/ntfs/aops.o] Error 1
make[1]: *** [fs/ntfs] Error 2
make: *** [fs] Error 2

You should modify two files, aops.c and compress.c

aops.c

    - - -   zero_user_page(page, 0, PAGE_CACHE_SIZE, KM_USER0);
    +++ zero_user(page, 0, PAGE_CACHE_SIZE);

compress.c

   - - -   zero_user_page(page, 0, PAGE_CACHE_SIZE, KM_USER0);
   +++  zero_user(page, 0, PAGE_CACHE_SIZE);

So, make again:

root -->make modules SUBDIRS=/usr/src/redhat/BUILD/kernel-2.6.18/linux-2.6.18.i686/fs/ntfs/

Congretulations to you, you will find the ntfs.ko under the /usr/src/redhat/BUILD/kernel-2.6.18/linux-2.6.18.i686/fs/ntfs

5.Install

root -->insmod /usr/src/redhat/BUILD/kernel-2.6.18/linux-2.6.18.i686/fs/ntfs/ntfs.ko

You could copy this file to /lib/modules/2.6.18-194.el5xen/kernel/fs/ntfs/, and add the following line to /etc/rc.local

insmod /lib/modules/2.6.18-194.el5xen/kernel/fs/ntfs/ntfs.ko

6. Any doubt pls check with me

linuxdba@qq.com,thx

原创粉丝点击