Files
for-gentoo/sys-kernel/genkernel/files/3.4.18/0007-aufs2-upstream.patch
T

101 lines
3.1 KiB
Diff

commit 4d54e7d0984dfdfe09b121dd845f6131c5b715d5
Author: Fabio Erculiani <lxnay@sabayon.org>
Date: Sun Aug 28 11:23:03 2011 +0200
aufs: add basic support to AUFS2, requires kernel with aufs module or built-in
diff --git a/defaults/initrd.scripts b/defaults/initrd.scripts
index 51ebcce..32e3417 100755
--- a/defaults/initrd.scripts
+++ b/defaults/initrd.scripts
@@ -1082,6 +1089,34 @@ getdvhoff() {
echo $(( $(hexdump -n 4 -s $((316 + 12 * $2)) -e '"%i"' $1) * 512))
}
+setup_squashfs_aufs() {
+ (
+ # Setup aufs directories and vars
+ local overlay=/mnt/overlay
+ local static=/mnt/livecd
+
+ for i in "${overlay}" "${static}"; do
+ [ ! -d "${i}" ] && mkdir -p "${i}"
+ done
+ good_msg "Loading aufs"
+ modprobe aufs > /dev/null 2>&1
+
+ cd "${NEW_ROOT}"
+ mount -t squashfs -o loop,ro "mnt/cdrom${LOOPEXT}${LOOP}" "${static}"
+ mount -t tmpfs none "${overlay}"
+ mount -t aufs -o br:${overlay}:${static} aufs "${NEW_ROOT}"
+
+ [ ! -d "${NEW_ROOT}${overlay}" ] && mkdir -p "${NEW_ROOT}${overlay}"
+ [ ! -d "${NEW_ROOT}${static}" ] && mkdir -p "${NEW_ROOT}${static}"
+ echo "aufs / aufs defaults 0 0" > "${NEW_ROOT}"/etc/fstab
+ for i in "${overlay}" "${static}"; do mount --move "${i}" "${NEW_ROOT}${i}"; done
+
+ # have handy /mnt/cdrom as well
+ [ ! -d "${NEW_ROOT}/mnt/cdrom" ] && mkdir -p "${NEW_ROOT}/mnt/cdrom"
+ mount --bind mnt/cdrom "${NEW_ROOT}/mnt/cdrom"
+ )
+}
+
setup_unionfs() {
local rw_dir=$1
local ro_dir=$2
diff --git a/defaults/linuxrc b/defaults/linuxrc
index 0843f5d..7aa11e3 100755
--- a/defaults/linuxrc
+++ b/defaults/linuxrc
@@ -213,6 +213,9 @@ do
keymap\=*)
keymap=`parse_opt "${x}"`
;;
+ aufs)
+ USE_AUFS_NORMAL=1
+ ;;
unionfs)
if [ ! -x /sbin/unionfs ]
then
@@ -569,9 +572,14 @@ then
FS_LOCATION='mnt/livecd'
elif [ "${LOOPTYPE}" = 'squashfs' ]
then
- good_msg 'Mounting squashfs filesystem'
- mount -t squashfs -o loop,ro "${NEW_ROOT}/mnt/cdrom/${LOOPEXT}${LOOP}" "${NEW_ROOT}/mnt/livecd"
- test_success 'Mount filesystem'
+ if [ "${USE_AUFS_NORMAL}" != '1' ]; then
+ good_msg 'Mounting squashfs filesystem'
+ mount -t squashfs -o loop,ro "${NEW_ROOT}/mnt/cdrom/${LOOPEXT}${LOOP}" "${NEW_ROOT}/mnt/livecd"
+ else
+ good_msg 'Mounting squashfs & aufs filesystems'
+ setup_squashfs_aufs
+ test_success 'Mount filesystem'
+ fi
FS_LOCATION='mnt/livecd'
elif [ "${LOOPTYPE}" = 'gcloop' ]
then
@@ -636,7 +644,7 @@ then
then
setup_unionfs ${NEW_ROOT} ${NEW_ROOT}/${FS_LOCATION}
CHROOT=/union
- else
+ elif [ "${USE_AUFS_NORMAL}" != '1' ]; then
good_msg "Copying read-write image contents to tmpfs"
# Copy over stuff that should be writable
diff --git a/doc/genkernel.8.txt b/doc/genkernel.8.txt
index 21c7919..bf621ce 100644
--- a/doc/genkernel.8.txt
+++ b/doc/genkernel.8.txt
@@ -511,6 +511,9 @@ which the ramdisk scripts would recognize.
*nounionfs*::
Enables/disables UnionFS.
+*aufs*::
+ Enables support for AUFS2 (if available in the kernel).
+
*real_rootflags*=<...>::
Additional flags to mount the real root system with.
For example *real_rootflags*=noatime would make "-o ro,noatime".