Friday, May 1, 2009

Centos: nilfs compiling from src

Download source:
2.6.18 centos kernel source code (kernel-devel-2.6.18-128.el5.centos.plus.i686.rpm)
http://rpm.pbone.net/index.php3/stat/4/idpl/12390365/com/kernel-devel-2.6.18-128.el5.centos.plus.i686.rpm.html
kernel module source code
http://www.nilfs.org/download/nilfs-2.0.12.tar.bz2
patch for Centos
http://www.nilfs.org/pub/centos/5/SRPMS/nilfs-kmod-2.0.12-r.src.rpm
userland utilities source code
http://www.nilfs.org/download/nilfs-utils-2.0.12.tar.bz2

Required packages:
gcc
yum install gcc
e2fsprogs-devel
yum install e2fsprogs-devel

default installed: make binutils

Installation Instructions:
I. use Centos rpm installer to unpackage the kernel source code
The source code will be in the directory :
/usr/src/kernels/2.6.18-128.1.6.el5-i686

2. untar the nilfs kernel module source code and userland utilities source code
kernel module is in the directory: nilfs-2.0.12
utilities is in the directory: nilfs-utils-2.0.12

3. uncompress the nilfs-kmod-2.0.12-r.src.rpm package and copy the patch file nilfs-rhel5-kern-feature.patch to the kernel module src directory nilfs-2.0.12
_______________________________________________________

--- a/fs/kern_feature.h 2008-02-12 08:38:22.000000000 -0000
+++ b/fs/kern_feature.h 2009-04-09 12:27:24.000000000 -0000
@@ -30,6 +30,25 @@
/*
* Please define as 0/1 here if you want to override
*/
+/* for Red Hat Enterprise Linux / CentOS 5.x */
+#if defined(RHEL_MAJOR) && (RHEL_MAJOR == 5)
+# define NEED_MOUNT_SEMAPHORE 1
+# define NEED_INODE_GENERIC_IP 0
+# define NEED_INODE_BLKSIZE 0
+# define HAVE_PAGE_MKWRITE 1
+# if (RHEL_MINOR < 1)
+# define PageChecked PageFsMisc
+# define SetPageChecked SetPageFsMisc
+# define ClearPageChecked ClearPageFsMisc
+# endif
+# if (RHEL_MINOR > 0)
+# define NEED_INC_NLINK 0
+# if (RHEL_MINOR > 2)
+# define NEED_DROP_NLINK 0
+# define HAVE_LE32_64_ADD_CPU 1
+# endif
+# endif
+#endif

/*
* defaults dependent to kernel versions
_______________________________________________________

4. apply the patch to the kernel module source code
root: ~> patch -p1 < nilfs-rehel-kern-feature.patch

5. compile the kernel module source code root: ~> make
root: ~> make install

6. compile the utils source code
root: ~> make
root: ~> make install

Userful resource:
http://www.nilfs.org/download/READMEv2
http://www.cyberciti.biz/faq/appy-patch-file-using-patch-command/
http://rpm.pbone.net/index.php3/stat/4/idpl/12390365/com/kernel-devel-2.6.18-128.el5.centos.plus.i686.rpm.html
http://www.nilfs.org/en/faq.html
http://www.nilfs.org/en/pkg_centos.html