This is how I compiled a kernel for Ubuntu 8.04 which supports AUFS
with NFS branches.
Thanks to recent AUFS inclusions, there is less work to do now than
was required for Ubuntu 7.10, but you still need additional patches.
This was performed with Ubuntu's linux-source package version 2.6.24-16.30.
--------
Install supporting packages and prepare the source:
# apt-get install linux-source ncurses-dev cvs build-essential
# cd /usr/src
# tar xjvf linux-source-VER.tar.bz2
# ln -s linux-source-VER linux
Acquire the default configuration file for the kernel source you've
gotten. It will can be found in the linux-image package, such as
linux-image-2.6.20-16-i386. The package places it in /boot, so an
example of the configuration file is /boot/config-2.6.22-14-386. Copy
it to /usr/src/linux/.config.
# cd /usr/src/linux
# cp /boot/config-VER-ARCH .
# cp config-VER-ARCH .config
The .config file must be in place prior to adding AUFS to the source
tree, because without it you cannot build include/linux/version.h,
which AUFS's makefile needs.
Since I use this as a drop-in replacement for the standard generic
kernel, its version must be (falsely) set to match. Otherwise, there
would be difficulty loading modules, especially in the initrd.
# vi Makefile
Set EXTRAVERSION so that the four version variables will match the
version on Ubuntu's generic kernel. For example, if the generic
kernel's version were 2.6.22-14-generic, you would set EXTRAVERSION as
follows:
EXTRAVERSION = -14-generic
Create a couple of files that the AUFS installer will need:
# make include/linux/version.h
# make include/linux/utsrelease.h
Now acquire AUFS as instructed at http://aufs.sourceforge.net/
# cd /usr/src
# mkdir aufs.wcvs
# cd aufs.wcvs
# cvs -d:pserver:[EMAIL PROTECTED]:/cvsroot/aufs login
# cvs -z3 -d:pserver:[EMAIL PROTECTED]:/cvsroot/aufs co aufs
Apply the patch. Again, this patch works for Ubuntu's linux-source
2.6.24-16.30. It is likely that the linux-source package for Ubuntu
will continue to change as AUFS supplants UnionFS.
# cd /src/aufs.wcvs/aufs
# patch -p0 < PATCHFILE
Install AUFS to the kernel source.
# cd /usr/src/aufs.wcvs/aufs
# make KDIR=/usr/src/linux -f local.mk kconfig
Follow the instructions that are printed, which involve entering the
following commands. When editing linux/fs/Kconfig, insert the command
before the final "endmenu".
# cp -a fs/* ../../linux/fs
# cp -a include/* ../../linux/include
# cd ../../linux
# vi fs/Makefile
# vi fs/Kconfig
Next, configure and build the kernel.
# cd /usr/src/linux
# make menuconfig
Since I use AUFS with NFS, I disable all AUFS options except
lhash.patch as illustrated below. Your needs may vary.
File systems
[*] Another unionfs
[*] lhash.patch for NFS branch
Now the kernel is ready to build and install, which is left as an
exercise to the reader.
--- fs/aufs/vfsub.c.orig 2008-04-21 15:23:22.058045742 +0000
+++ fs/aufs/vfsub.c 2008-04-21 15:29:28.853578761 +0000
@@ -57,7 +57,7 @@
dir->i_ino, AuDLNPair(dentry), symname, mode);
IMustLock(dir);
- err = vfs_symlink(dir, dentry, symname, mode);
+ err = vfs_symlink(dir, dentry, NULL, symname, mode);
if (!err) {
/* dir inode is locked */
au_update_fuse_h_inode(NULL, dentry->d_parent); /*ignore*/
@@ -74,7 +74,7 @@
LKTRTrace("i%lu, %.*s, 0x%x\n", dir->i_ino, AuDLNPair(dentry), mode);
IMustLock(dir);
- err = vfs_mknod(dir, dentry, mode, dev);
+ err = vfs_mknod(dir, dentry, NULL, mode, dev);
if (!err) {
/* dir inode is locked */
au_update_fuse_h_inode(NULL, dentry->d_parent); /*ignore*/
@@ -93,7 +93,7 @@
IMustLock(dir);
lockdep_off();
- err = vfs_link(src_dentry, dir, dentry);
+ err = vfs_link(src_dentry, NULL, dir, dentry, NULL);
lockdep_on();
if (!err) {
LKTRTrace("src_i %p, dst_i %p\n",
@@ -119,7 +119,7 @@
IMustLock(src_dir);
lockdep_off();
- err = vfs_rename(src_dir, src_dentry, dir, dentry);
+ err = vfs_rename(src_dir, src_dentry, NULL, dir, dentry, NULL);
lockdep_on();
if (!err) {
/* dir inode is locked */
@@ -137,7 +137,7 @@
LKTRTrace("i%lu, %.*s, 0x%x\n", dir->i_ino, AuDLNPair(dentry), mode);
IMustLock(dir);
- err = vfs_mkdir(dir, dentry, mode);
+ err = vfs_mkdir(dir, dentry, NULL, mode);
if (!err) {
/* dir inode is locked */
au_update_fuse_h_inode(NULL, dentry->d_parent); /*ignore*/
@@ -154,7 +154,7 @@
IMustLock(dir);
lockdep_off();
- err = vfs_rmdir(dir, dentry);
+ err = vfs_rmdir(dir, dentry, NULL);
lockdep_on();
/* dir inode is locked */
if (!err)
@@ -171,7 +171,7 @@
/* vfs_unlink() locks inode */
lockdep_off();
- err = vfs_unlink(dir, dentry);
+ err = vfs_unlink(dir, dentry, NULL);
lockdep_on();
/* dir inode is locked */
if (!err)
@@ -402,7 +402,7 @@
if (!IS_IMMUTABLE(h_inode) && !IS_APPEND(h_inode)) {
vfsub_ignore(a->vargs);
lockdep_off();
- *a->errp = notify_change(a->h_dentry, a->ia);
+ *a->errp = notify_change(a->h_dentry, NULL, a->ia);
lockdep_on();
if (!*a->errp)
au_update_fuse_h_inode(NULL, a->h_dentry); /*ignore*/
--- fs/aufs/i_op.c.orig 2008-04-21 15:33:48.317492725 +0000
+++ fs/aufs/i_op.c 2008-04-21 15:52:18.234235556 +0000
@@ -57,7 +57,7 @@
AuTraceErr(err);
}
-#if 1
+#if 0
if (!err)
err = au_security_inode_permission(h_inode, mask, fake_nd,
dlgt);
@@ -610,7 +610,7 @@
struct vfsub_args vargs;
struct super_block *sb;
__u32 events;
- struct file *file;
+/* struct file *file; */
loff_t sz;
struct au_icpup_args rargs;
@@ -621,6 +621,7 @@
sb = dentry->d_sb;
si_read_lock(sb, AuLock_FLUSH);
+#if 0
file = NULL;
if (ia->ia_valid & ATTR_FILE) {
/* currently ftruncate(2) only */
@@ -628,6 +629,7 @@
fi_write_lock(file);
ia->ia_file = au_h_fptr(file);
}
+#endif
sz = -1;
if ((ia->ia_valid & ATTR_SIZE)
@@ -675,11 +677,13 @@
}
di_write_unlock(dentry);
out:
+#if 0
if (file) {
ia->ia_file = file;
//ia->ia_valid |= ATTR_FILE;
fi_write_unlock(file);
}
+#endif
si_read_unlock(sb);
AuTraceErr(err);
return err;
--- fs/aufs/misc.c.orig 2008-04-21 15:34:10.247823539 +0000
+++ fs/aufs/misc.c 2008-04-21 15:34:47.618387274 +0000
@@ -306,7 +306,7 @@
if (err == 1) {
ia->ia_size = dst->f_pos;
ia->ia_valid = ATTR_SIZE | ATTR_FILE;
- ia->ia_file = dst;
+/* ia->ia_file = dst; */
vfsub_i_lock_nested(h_i, AuLsc_I_CHILD2);
err = vfsub_notify_change(h_d, ia, &vargs);
vfsub_i_unlock(h_i);
-------------------------------------------------------------------------
This SF.net email is sponsored by the 2008 JavaOne(SM) Conference
Don't miss this year's exciting event. There's still time to save $100.
Use priority code J8TL2D2.
http://ad.doubleclick.net/clk;198757673;13503038;p?http://java.sun.com/javaone