--- /dev/null
+# Note: This recipe is a bit of a hack (READ: Massive hack) for now as it needs kernel
+# patches in the source tree in order to build. Without those patches it will fail.
+
+DESCRIPTION = "Aufs2 is a stackable unification filesystem."
+LICENSE = "GPL"
+DEPENDS = "virtual/kernel"
+
+PACKAGE_ARCH = "${MACHINE_ARCH}"
+RSUGGESTS_${PN} = "aufs2-util"
+
+inherit module
+
+SRCREV = "3dee4b597c9c8d02157603f9018e22a5fa898621"
+
+SRC_URI = " \
+ git://git.c3sl.ufpr.br/pub/scm/aufs/aufs2-standalone.git;protocol=http;branch=aufs2-27 \
+ file://rc.aufs2 \
+"
+
+inherit update-rc.d
+
+INITSCRIPT_NAME = "aufs2-init"
+INITSCRIPT_PARAMS = "start 30 5 2 . stop 40 0 1 6 ."
+
+S = "${WORKDIR}/git"
+
+EXTRA_OEMAKE = "CONFIG_AUFS_FS=m KDIR=${STAGING_KERNEL_DIR} DESTDIR=${D}"
+
+# Enable inotify support.
+do_compile_prepend() {
+ sed -i "s:HINOTIFY =:HINOTIFY = y:g" ${S}/config.mk
+}
+
+do_install() {
+ mkdir -p ${D}/lib/modules/${KERNEL_VERSION}/misc
+ cp ${S}/*.ko ${D}/lib/modules/${KERNEL_VERSION}/misc
+ install -d ${D}${sysconfdir}/init.d/
+ cp -pP ${WORKDIR}/rc.aufs2 ${D}${sysconfdir}/init.d/aufs2-init
+}
+
+# This is really crufty but I don't want to change the aufs2-utils recipe as I know it's used by the Touchbook. - DJWillis
+# The reason for this is so the userspace ABI is there when the utils are built later
+# (if you build 'in tree' you will have this but this recipe builds as a module)
+
+do_stage() {
+ install -d ${STAGING_KERNEL_DIR}/include/linux/
+ install -m 0644 ${S}/include/linux/aufs_type.h ${STAGING_KERNEL_DIR}/include/linux/
+}
+
+FILES_${PN} += "/lib/modules/${KERNEL_VERSION}/misc/*.ko.*"
--- /dev/null
+#!/bin/sh
+
+DESC="AUFS2 union file system module."
+NAME="aufs2"
+
+d_stop() {
+ if `grep -q aufs /proc/modules` ; then
+ rmmod aufs
+ fi
+}
+
+d_start() {
+ insmod $(busybox find /lib/modules/$(uname -r) -name "aufs.ko")
+}
+
+case "$1" in
+ start)
+ echo -n "Starting $DESC: $NAME"
+ d_start
+ echo "."
+ ;;
+ stop)
+ echo -n "Stopping $DESC: $NAME"
+ d_stop
+ echo "."
+ ;;
+ restart|force-reload)
+ echo -n "Restarting $DESC: $NAME"
+ d_stop
+ sleep 1
+ d_start
+ echo "."
+ ;;
+ *)
+ echo "Usage: $0 {start|stop|restart|force-reload}" >&2
+ exit 1
+ ;;
+esac
+
+exit 0