aufs: add basic support to AUFS2, requires kernel with aufs module or built-in

cleanup-cruft
Fabio Erculiani 14 years ago
parent 78667c1e13
commit 4d54e7d098

@ -5,6 +5,10 @@
# Distributed under the GPL v2
# $Id$
28 Aug 2011; Fabio Erculiani <lxnay@gentoo.org> defaults/initrd.scripts,
defaults/linuxrc, doc/genkernel.8.txt:
Add basic support to AUFS2, requires kernel with aufs module or built-in
16 Aug 2011; Fabio Erculiani <lxnay@gentoo.org> gen_compile.sh:
gen_compile: correct MAKEOPTS usage on utils task

@ -924,6 +924,13 @@ sdelay() {
then
good_msg "Waiting ${SDELAY} seconds..."
sleep ${SDELAY}
elif [ "${CDROOT}" = '1' ]
then
# many CD/DVD drives require extra sleep, especially when
# connected via USB. Many people reported that 1 second sleep
# is not enough on their notebooks, that's why sleep 3, when booting
# off a livecd is a better default.
sleep 3
else
good_msg 'Hint: Use parameter scandelay[=seconds] if you need waiting here'
fi
@ -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

@ -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

@ -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".

Loading…
Cancel
Save