aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorFabio Erculiani <lxnay@sabayon.org>2011-01-04 23:45:40 +0100
committerSebastian Pipping <sebastian@pipping.org>2011-01-05 15:10:37 +0100
commit7516bfc8574effc73a97732a827eb953a9d6a267 (patch)
treebd238e4be908c07ba1a7a416115206b81a12e4a5
parentFix "doslowusb" and automatic "slowusb" behaviour. (diff)
downloadgenkernel-lxnay.tar.gz
genkernel-lxnay.tar.bz2
genkernel-lxnay.zip
add AUFS support inside linuxrc and initramfs.lxnay
If kernel is compiled with aufs support (which is not in the kernel as of today) or aufs module is available, and cmdline contains "aufs" the live system will boot using aufs. This is just minimal support and requires to have aufs inside the running kernel. Aufs module compilation might be added to the ebuild in future.
-rwxr-xr-xdefaults/initrd.scripts35
-rwxr-xr-xdefaults/linuxrc14
2 files changed, 48 insertions, 1 deletions
diff --git a/defaults/initrd.scripts b/defaults/initrd.scripts
index 447d6323..7d2781ac 100755
--- a/defaults/initrd.scripts
+++ b/defaults/initrd.scripts
@@ -215,6 +215,13 @@ mount_sysfs() {
[ "$ret" -eq '0' ] || bad_msg "Failed to mount /sys!"
}
+aufs_setup_dir() {
+ mount -t aufs -o "br:$OVERLAY=rw:$2=ro" -- aufs $1
+ if [ "$?" -eq '0' ]; then
+ good_msg "Addition of $2 to $OVERLAY merged into $1"
+ fi
+}
+
findnfsmount() {
if [ "${IP}" != '' ] || busybox udhcpc -n -T 15 -q
then
@@ -1048,6 +1055,34 @@ getdvhoff() {
echo $(( $(hexdump -n 4 -s $((316 + 12 * $2)) -e '"%i"' $1) * 512))
}
+setup_aufs() {
+
+ # 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
+
+ aufs_setup_dir "${UNION}" "${NEW_ROOT}/${FS_LOCATION}"
+
+ # setup internal mounts
+ 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
+ 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"
+
+}
+
setup_unionfs() {
local rw_dir=$1
local ro_dir=$2
diff --git a/defaults/linuxrc b/defaults/linuxrc
index 59f1ea54..69c0d841 100755
--- a/defaults/linuxrc
+++ b/defaults/linuxrc
@@ -218,6 +218,8 @@ do
keymap\=*)
keymap=`parse_opt "${x}"`
;;
+ aufs)
+ USE_AUFS_NORMAL=1
unionfs)
if [ ! -x /sbin/unionfs ]
then
@@ -630,7 +632,12 @@ then
fi
- if [ "${USE_UNIONFS_NORMAL}" = '1' ]
+ if [ "${USE_AUFS_NORMAL}" -eq '1' ]
+ then
+ good_msg 'Setting up aufs mounts'
+ setup_aufs
+ CHROOT="${UNION}"
+ elif [ "${USE_UNIONFS_NORMAL}" = '1' ]
then
setup_unionfs ${NEW_ROOT} ${NEW_ROOT}/${FS_LOCATION}
CHROOT=/union
@@ -707,6 +714,11 @@ else
setup_unionfs /union_changes ${NEW_ROOT}
mkdir -p ${UNION}/tmp/.initrd
fi
+ if [ "${USE_AUFS_NORMAL}" = '1' ]
+ then
+ setup_aufs
+ mkdir -p ${UNION}/tmp/.initrd
+ fi
fi
# Execute script on the cdrom just before boot to update things if necessary