Files
sablink-distro/sys-kernel/genkernel/files/genkernel-3.4.9-aufs.patch
T
(no author) 67b76de2f3 updated aufs patch
git-svn-id: http://svn.sabayonlinux.org/overlay@1861 d7aec97c-591d-0410-af39-a8856400b30a
2007-12-17 19:46:17 +00:00

120 lines
3.4 KiB
Diff

diff -Nurp genkernel-3.4.9_pre11.orig/generic/initrd.scripts genkernel-3.4.9_pre11/generic/initrd.scripts
--- genkernel-3.4.9_pre11.orig/generic/initrd.scripts 2007-12-17 19:43:39.000000000 +0000
+++ genkernel-3.4.9_pre11/generic/initrd.scripts 2007-12-17 19:44:44.000000000 +0000
@@ -193,6 +193,13 @@ union_setup_dir() {
fi
}
+aufs_setup_dir() {
+ mount -t aufs -o br=$OVERLAY:$2 none $1
+ if [ "$?" -eq '0' ]; then
+ good_msg "Addition of $2 to $OVERLAY merged into $1"
+ fi
+}
+
findnfsmount() {
if [ "${IP}" != '' ] || busybox udhcpc -R rootpath -n -s /bin/udhcpc.scripts
@@ -810,6 +817,20 @@ rundebugshell() {
fi
}
+setup_aufs() {
+ if [ "${USE_AUFS_NORMAL}" -eq '1' ]
+ then
+ # Directory used for rw changes in union mount filesystem
+ UNION=/aufs
+ OVERLAY=/overlay
+ mkdir -p ${UNION}
+ mkdir -p ${OVERLAY}
+ mount -t tmpfs none ${OVERLAY}
+ good_msg "Loading aufs module (if module)"
+ modprobe aufs > /dev/null 2>&1
+ fi
+}
+
setup_unionfs() {
if [ "${USE_UNIONFS_NORMAL}" -eq '1' ]
then
diff -Nurp genkernel-3.4.9_pre11.orig/generic/linuxrc genkernel-3.4.9_pre11/generic/linuxrc
--- genkernel-3.4.9_pre11.orig/generic/linuxrc 2007-12-17 19:43:39.000000000 +0000
+++ genkernel-3.4.9_pre11/generic/linuxrc 2007-12-17 19:44:49.000000000 +0000
@@ -80,6 +80,9 @@ do
unionfs)
USE_UNIONFS_NORMAL=1
;;
+ aufs)
+ USE_AUFS_NORMAL=1
+ ;;
unionfs\=*)
USE_UNIONFS_NORMAL=1
CMD_UNIONFS=`parse_opt "${x}"`
@@ -230,11 +233,12 @@ then
startLUKS
fi
-# Set up unionfs
+# Set up unionfs or aufs
mkdir -p ${NEW_ROOT}
setup_unionfs
+setup_aufs
-if [ "${USE_UNIONFS_NORMAL}" -eq '1' ]
+if [ "${USE_UNIONFS_NORMAL}" -eq '1' ] || [ "${USE_AUFS_NORMAL}" -eq '1' ]
then
CHROOT=${UNION}
else
@@ -248,7 +252,7 @@ tuxonice_resume
if [ "${CDROOT}" -eq '1' ]
then
- if [ ! "${USE_UNIONFS_NORMAL}" -eq '1' ]
+ if [ ! "${USE_UNIONFS_NORMAL}" -eq '1' ] && [ ! "${USE_AUFS_NORMAL}" -eq '1' ]
then
good_msg "Making tmpfs for ${NEW_ROOT}"
mount -t tmpfs tmpfs ${NEW_ROOT}
@@ -605,6 +609,22 @@ then
mv /${UNION}/etc/fstab.new /${UNION}/etc/fstab
fi
+ if [ "${USE_AUFS_NORMAL}" -eq '1' ]
+ then
+ aufs_setup_dir ${UNION} ${NEW_ROOT}/${FS_LOCATION}
+
+ mkdir -p ${UNION}/mnt/livecd
+ if [ ! -e "${UNION}/mnt/cdrom" ]; then
+ mkdir ${UNION}/mnt/cdrom -p
+ fi
+ mount --bind ${NEW_ROOT}/${FS_LOCATION} ${UNION}/mnt/livecd
+ mount --bind ${NEW_ROOT}/mnt/cdrom ${UNION}/mnt/cdrom
+
+ # Make sure fstab notes livecd is mounted ro. Makes system skip remount which fails on aufs dirs.
+ sed -e 's|\(.*\s/\s*tmpfs\s*\)defaults\(.*\)|\1defaults,ro\2|' /${UNION}/etc/fstab > /${UNION}/etc/fstab.new
+ mv /${UNION}/etc/fstab.new /${UNION}/etc/fstab
+ fi
+
# Unpacking additional packages from NFS mount
# This is useful for adding kernel modules to /lib
# We do this now, so that additional packages can add whereever they want.
@@ -622,7 +642,7 @@ then
fi
- if [ ! "${USE_UNIONFS_NORMAL}" -eq '1' ]
+ if [ ! "${USE_UNIONFS_NORMAL}" -eq '1' ] && [ ! "${USE_AUFS_NORMAL}" -eq '1' ]
then
good_msg "Copying read-write image contents to tmpfs"
# Copy over stuff that should be writable
@@ -705,6 +725,11 @@ else
union_setup_dir ${UNION} ${NEW_ROOT}/${FS_LOCATION}
mkdir -p ${UNION}/tmp/.initrd
fi
+ if [ "${USE_AUFS_NORMAL}" -eq '1' ]
+ then
+ aufs_setup_dir ${UNION} ${NEW_ROOT}/${FS_LOCATION}
+ mkdir -p ${UNION}/tmp/.initrd
+ fi
fi
# Execute script on the cdrom just before boot to update things if necessary