genkernel: moving one step closer to reintegration

This commit is contained in:
Zero_Chaos 2012-08-03 11:51:20 +00:00
parent 0c1c22530c
commit 0e6dc0a38a
3 changed files with 592 additions and 2 deletions

View file

@ -1,4 +1,5 @@
AUX 9999-pass-1.patch 19239 SHA256 fb91c073f91f673f6dfedcfaa44813f6ec180a45294f24c43f420cd3ddbae39c SHA512 d8344d156a2668fba7cf2a05aebd816c144865aafef175f7731a10000033b2c5b819c5340f03e9b6c18aa853b4a3797cc3182fe2d9578ce1665592700a961227 WHIRLPOOL 40393cdd0a713175d2f13542a97404b336638dd1dd483e8b89f945d00bdbecec1776562dcdb4d795dfb29cee11e0137fb9c9d948c86bf6fa0abdccd1293d7bc2
AUX 9999-pass-2.patch 18981 SHA256 35f2b4444f939147c8537c5a5b9de19b20475bfa2a3ef26d0e599b82211c66e3 SHA512 e3cb337b968918d3bcd7088c6cd386c44f20e4492f0e67eb58d44bda7d203d371ee35b36671e806ce96e29f1ac288672a9373519770c81916923c9a611e186c7 WHIRLPOOL 2dd77bc21a19446900a1ea81bdbd6d5a6cf703a85fd7934a47cfc0dd2ca7b881afac84c63c5c1dd13fe5b4d2e65b96e05af2c421e96b91faea9e21dd8350e0f7
AUX aufs-changes-e2fsprogs-2.diff 20004 SHA256 14ff71a533a2c87929e1fce7a30202075473ecc0ef5153a7354dac58d1383037 SHA512 1b3bdeebe4f798111a442433f2d62287de301993c5e1dc0116cc5fec13e2447d8ea8216bfb513687d806c9ad618f171d388ce034cf5c01dd7b539530e6cdffea WHIRLPOOL bee5422b50bb8d4d58e1f708dc3a153bd3ba820d82ad6ef7cfc2d539e92c641415e7b239553db17fad4b74c7ea6317408b401411a1daa539fc6cea21249e062d
AUX aufs-changes-e2fsprogs.diff 20200 SHA256 44de4dc551f908e1f5c6d1aaa327766c30cd85ebd1c56d80dff70627a8c93f4a SHA512 0abb05c34135673cceb29d1b3f734ae952617666d34de540bb1f7a0f1734a7c0de16a6b522fe03c83223c5273b1262544c40f29beaf46b8e506b7896d1793373 WHIRLPOOL 32cd8458ee2915f22ba6ab74bc692b3dea7e0397eb097d4a9d7dc78564deec2bc7c140b18d3d4650d2c0754e237b8876b0def03a2905c242ebb68842ce794863
AUX aufs-correct-hacked.diff 17462 SHA256 6e41a271bcb8db75930fb5dcc2ec655381d10d568f5705ddc5b0563c05cc9a3d SHA512 1a1f04364e09b13ea3249f2b47f97b55c562e7167d0a21d70c3b2209e50a108b8c3b4f74e6eb8bcea47ae248eeaead1e0b99490ea6bc070b9d80ec22374cb413 WHIRLPOOL 9585079cf39fafebf1fe0869abce1518c0c7eaf68bdc358a2bda93cc38c4040b9c827bb12f3fabe3073bf322aa4479668d8be0fcf64971340fdae2be2873e13d
@ -31,4 +32,4 @@ EBUILD genkernel-3.4.32.ebuild 5677 SHA256 7ffa9daa56da3768bdc03194479d27d1fa57c
EBUILD genkernel-3.4.33.1.ebuild 5478 SHA256 3d6fb20a9ba82ac0f664fad64d47228208597170161d2227362c019e7b026a5c SHA512 0e48a733234b56819f3d17884f4a5cf16e2311e53b75947ae828ba6dd44aa96b8a5ea54288b4d3dc472ef5b6ab354cad10d4f503613efed280abb94df5d89f3c WHIRLPOOL 8e6b2279559bec6823489c97cbed98f333225fa56bf526e79b9080bcada205d3a6fdaf64fab63b0ce2070ab8103e6a0ae45a6840018412e289fb5833e77f46a6
EBUILD genkernel-9999.2540.ebuild 5009 SHA256 54e051c18952c325edb2432a0eceaa5472e2209afd442f198eec47109e1d50f6 SHA512 b77d443b2f967e0cf5ea337788db92fd6f840b22faed367bfe8a1d791917f49ec36e7ed9013b776c845d0679dd468f150e66c8c3998477ab43a192fbe1dd2fa1 WHIRLPOOL f49d3a172d5a5d1826fcbacad8d79212085f6a9007062d644a07590572a0f63dec743d4bf7bbb02b936b865616816035593406a6e8a3ef39179d3b92f7868c09
EBUILD genkernel-9999.2998.ebuild 5009 SHA256 9d33c03cd3d32f34620e2a36c3d0e11416fe40da9b3e081e15ffcc3429289bfd SHA512 6f422752a95cff10460bf2d8ff95731889b03a758d6fb9464f44d118c15f2a2cd48f063c8ceee21e8d397ee3cd90df99f66236ab7ddd9167278b83bf37de066a WHIRLPOOL 8187aafde2b43b03bfa69bbfcaf43dc2a9661cb097e3ddf51d2aa6135fa72e0e1d3510c264357537da5d69f86b18944675953772718845d520eb20ed4fa8e4d1
EBUILD genkernel-9999.ebuild 5163 SHA256 571b4ce8bd0d8f4fa2aac06e94e6dea97d582fab841f18c220fe81272d808432 SHA512 bf08941432fb697d7157da311145153091ceb179ae0d19f2062fc798bbce78d7de44697422ad5aae9337b01eb0a5c172c87151e3b58a1957c6d25c2052414f0c WHIRLPOOL a8f74fcc227642b08b5fc6e5f97b1c17042fc8f85ab9de719123b9e319cfe3ed53db2b7ec9c539c06ad7db6f9fd1410ed8f02b4c2638de71db32ca01162d080a
EBUILD genkernel-9999.ebuild 5163 SHA256 993bb56492bbc227bc33e27bb196f730ea4ba89ee61a6e6feaf692f7c82e64b8 SHA512 505d67afeb3e35946a0c2ff53b709911288176776205e37703a17b9b08869fd7f4558650b6ad3269fa3191c99ea4e47a6b1b56cb3a3684d9555d6c5f23cfd85d WHIRLPOOL acec88e18ed02577e7bfe1573a24ae6644b7b001004194118730d8f2ac23b3fe61fb58cfb508de85153f214b9ee00e04eaa4d398007e43ecfb6cfc5a441223e5

View file

@ -0,0 +1,589 @@
diff --git a/defaults/initrd.defaults b/defaults/initrd.defaults
index 73fe4c9..aa265bc 100755
--- a/defaults/initrd.defaults
+++ b/defaults/initrd.defaults
@@ -73,6 +73,7 @@ CDROOT_TYPE='auto'
NEW_ROOT='/newroot'
CDROOT_PATH='/mnt/cdrom'
CONSOLE='/dev/console'
+MODULESD="mnt/cdrom"
LOOPS='/livecd.loop /zisofs /livecd.squashfs /image.squashfs /livecd.gcloop'
diff --git a/defaults/initrd.scripts b/defaults/initrd.scripts
index 082d44d..e0de42f 100755
--- a/defaults/initrd.scripts
+++ b/defaults/initrd.scripts
@@ -207,6 +207,192 @@ mount_sysfs() {
[ ${ret} -eq 0 ] || bad_msg "Failed to mount /sys!"
}
+# Insert a directory tree $2 to an union specified by $1
+# Top-level read-write branch is specified by it's index 0
+# $1 = union absolute path (starting with /)
+# $2 = path to data directory
+#
+union_insert_dir() {
+ # Always mount it over the precedent (add:1:)
+ mount -n -o remount,add:1:$2=rr aufs $1
+ if [ $? = '0' ]
+ then
+ good_msg "Addition of $2 to $1 successful"
+ fi
+}
+
+# Insert all modules found in $1, usually mnt/cdrom
+# added to allow users to add their own apps.
+union_insert_modules() {
+ for module in `ls ${NEW_ROOT}/$1/modules/*.mo 2>/dev/null| sort`
+ do
+ mkdir -p ${MEMORY}/modules/`basename ${module} .mo`
+ union_insert_dir $UNION ${MEMORY}/modules/`basename ${module} .mo`
+ done
+ for module in `ls ${NEW_ROOT}/$1/modules/*.lzm 2>/dev/null| sort`
+ do
+ mkdir -p ${MEMORY}/modules/`basename ${module} .lzm`
+ mount -o loop,ro ${module} ${MEMORY}/modules/`basename ${module} .lzm`
+ union_insert_dir $UNION ${MEMORY}/modules/`basename ${module} .lzm`
+ done
+}
+
+# Function to create an ext2 fs on $CHANGESDEV, $CHANGESMNT mountpoint
+create_changefs() {
+ local size
+ while [ 1 ]
+ do
+ read -p '<< Size of file (Enter for default 256 Mb): ' size
+ if [ -z "$size" ]; then
+ let size=256
+ fi
+ let size="$size"
+ if [ $size -lt 16 ]
+ then
+ bad_msg "Please give a size of at least 16 Mb"
+ else
+ dd if=/dev/zero of=$CHANGESMNT/livecd.aufs bs=1M count=$size
+ if [ $? = '0' ]
+ then
+ good_msg "Creation of livecd.aufs, $size Mb on $CHANGESDEV successful, formatting it ext2"
+ mke2fs -F $CHANGESMNT/livecd.aufs
+ break
+ else
+ rm -f $CHANGESMNT/livecd.aufs
+ bad_msg "Unable to create livecd.aufs on $CHANGESDEV of $size Mb"
+ bad_msg "Please give a size of at least 16 Mb"
+ bad_msg "Also check if your disk is full or read-only ?"
+ read -p '<< Type "a" to abort, anything else to continue : ' doabort
+ if [ "$doabort" = "a" ]; then
+ return 1
+ fi
+ fi
+ fi
+ done
+ return 0
+}
+
+setup_aufs() {
+ if [ "${USE_AUFS_NORMAL}" -eq '1' ]
+ then
+ # Directory used for rw changes in union mount filesystem
+ UNION=/union
+ MEMORY=/memory
+ # Mountpoint for the changesdev
+ CHANGESMNT=$NEW_ROOT/mnt/changesdev
+ if [ -z "$UID" ]
+ then
+ CHANGES=$MEMORY/aufs_changes/default
+ else
+ CHANGES=$MEMORY/aufs_changes/$UID
+ fi
+
+ mkdir -p ${MEMORY}
+ mkdir -p ${UNION}
+ mkdir -p ${CHANGESMNT}
+ for i in dev mnt mnt/cdrom mnt/livecd mnt/key tmp tmp/.initrd mnt/gentoo sys
+ do
+ mkdir -p "${NEW_ROOT}/${i}"
+ chmod 755 "${NEW_ROOT}/${i}"
+ done
+ [ ! -e "${NEW_ROOT}/dev/null" ] && mknod "${NEW_ROOT}"/dev/null c 1 3
+ [ ! -e "${NEW_ROOT}/dev/console" ] && mknod "${NEW_ROOT}"/dev/console c 5 1
+
+ bootstrapCD
+ if [ -n "${AUFS}" ]
+ then
+ if [ "${AUFS}" = "detect" ]
+ then
+ CHANGESMNT="${NEW_ROOT}/mnt/cdrom"
+ CHANGESDEV=${REAL_ROOT}
+ else
+ CHANGESDEV=${AUFS}
+ good_msg "mounting $CHANGESDEV to $MEMORY for aufs support"
+ # mount -t auto $CHANGESDEV $MEMORY
+ mount -t auto $CHANGESDEV $CHANGESMNT
+ ret=$?
+ if [ "${ret}" -ne 0 ]
+ then
+ bad_msg "mount of $CHANGESDEV failed falling back to ramdisk based aufs"
+ unset AUFS
+ fi
+ fi
+ # Check and attempt to create the changesfile
+ if [ ! -e $CHANGESMNT/livecd.aufs ] && [ -n "${AUFS}" ]
+ then
+ create_changefs
+ mount -t auto $CHANGESMNT/livecd.aufs $MEMORY
+ elif [ -n "${AUFS}" ]
+ then
+ local nbpass=0
+ while [ 1 ]
+ do
+ mount -t auto $CHANGESMNT/livecd.aufs $MEMORY
+ ret=$?
+ if [ "${ret}" -ne 0 ]
+ then
+ if [ $nbpass -eq 0 ]
+ then
+ bad_msg "mounting of changes file failed, Running e2fsck"
+ e2fsck $CHANGESMNT/livecd.aufs
+ nbpass=$(($nbpass + 1))
+ else
+ bad_msg "mount of $CHANGESDEV failed falling back to ramdisk based aufs"
+ bad_msg "your livecd.aufs might be messed up, and I couldn't fix it"
+ bad_msg "moving livecd.aufs to livecd.aufs.bad"
+ mv $CHANGESMNT/livecd.aufs $CHANGESMNT/livecd.aufs.bad
+ bad_msg "try to fix it yourself with e2fsck later on, sorry for disturbing"
+ break
+ fi
+ else
+ if [ $nbpass -eq 1 ]
+ then
+ good_msg "e2fsck seemed successful. Please check your files after bootup"
+ fi
+ break
+ fi
+ done
+ if [ -f ${MEMORY}/.doclean.sh ]
+ then
+ good_msg "finishing the permanent changes cleanup"
+ . ${MEMORY}/.doclean.sh
+ rm ${MEMORY}/.doclean.sh
+ fi
+ fi
+ # mount tmpfs only in the case when changes= boot parameter was
+ # empty or we were not able to mount the storage device
+ if [ "${CDROOT}" -eq '1' -a ! -f ${CHANGESMNT}/livecd.aufs ]
+ then
+ umount $MEMORY
+ bad_msg "failed to find livecd.aufs file on $CHANGESDEV"
+ bad_msg "create an ext2 livecd.aufs file on this device if you wish to use it for aufs"
+ bad_msg "falling back to ramdisk based aufs for safety"
+ mount -t tmpfs tmpfs $MEMORY
+ XINO=$MEMORY
+ else
+ XINO=$MEMORY/xino
+ mkdir -p $XINO
+ mount -t tmpfs tmpfs $XINO
+ fi
+ else
+ good_msg "Mounting ramdisk to $MEMORY for aufs support..."
+ mount -t tmpfs tmpfs $MEMORY
+ XINO=$MEMORY
+ fi
+
+ mkdir -p $CHANGES
+ mount -t aufs -n -o nowarn_perm,udba=none,xino=$XINO/.aufs.xino,br:$CHANGES=rw aufs ${UNION}
+ ret=$?
+ if [ "${ret}" -ne 0 ]
+ then
+ bad_msg "Can't setup union ${UNION} in directory!"
+ USE_AUFS_NORMAL=0
+ fi
+ else
+ USE_AUFS_NORMAL=0
+ fi
+}
+
findnfsmount() {
if [ "${IP}" != '' ] || busybox udhcpc -n -T 15 -q
then
diff --git a/defaults/linuxrc b/defaults/linuxrc
index f434339..5e2d1b8 100755
--- a/defaults/linuxrc
+++ b/defaults/linuxrc
@@ -229,6 +229,38 @@ do
aufs)
USE_AUFS_NORMAL=1
;;
+ aufs\=*)
+ USE_AUFS_NORMAL=1
+ CMD_AUFS=`parse_opt "${x}"`
+ echo ${CMD_AUFS}|grep , >/dev/null 2>&1
+ if [ "$?" -eq '0' ]
+ then
+ UID=`echo ${CMD_AUFS#*,}`
+ AUFS=`echo ${CMD_AUFS%,*}`
+ else
+ AUFS=${CMD_AUFS}
+ fi
+ ;;
+ changes\=*)
+ USE_AUFS_NORMAL=1
+ CMD_AUFS=`parse_opt "${x}"`
+ echo ${CMD_AUFS}|grep , >/dev/null 2>&1
+ if [ "$?" -eq '0' ]
+ then
+ UID=`echo ${CMD_AUFS#*,}`
+ AUFS=`echo ${CMD_AUFS%,*}`
+ else
+ AUFS=${CMD_AUFS}
+ fi
+ ;;
+ persistent)
+ USE_AUFS_NORMAL=1
+ AUFS="detect"
+ ;;
+ # Allow user to specify the modules location
+ modules\=*)
+ MODULESD=`parse_opt "${x}"`
+ ;;
unionfs)
if [ ! -x /sbin/unionfs ]
then
@@ -406,17 +438,23 @@ rundebugshell
if [ "${CDROOT}" = '1' ]
then
- good_msg "Making tmpfs for ${NEW_ROOT}"
- mount -n -t tmpfs tmpfs "${NEW_ROOT}"
+ setup_aufs
+ if [ "${USE_AUFS_NORMAL}" -eq '1' ]
+ then
+ CHROOT=${UNION}
+ else
+ CHROOT=${NEW_ROOT}
+ good_msg "Making tmpfs for ${NEW_ROOT}"
+ mount -t tmpfs tmpfs ${NEW_ROOT}
- for i in dev mnt mnt/livecd mnt/key tmp tmp/.initrd mnt/gentoo sys
- do
- mkdir -p "${NEW_ROOT}/${i}"
- chmod 755 "${NEW_ROOT}/${i}"
- done
- [ ! -d "${CDROOT_PATH}" ] && mkdir -p "${CDROOT_PATH}"
- [ ! -e "${NEW_ROOT}/dev/null" ] && mknod "${NEW_ROOT}"/dev/null c 1 3
- [ ! -e "${NEW_ROOT}/dev/console" ] && mknod "${NEW_ROOT}"/dev/console c 5 1
+ for i in dev mnt mnt/cdrom mnt/livecd mnt/key tmp tmp/.initrd mnt/gentoo sys
+ do
+ mkdir -p "${NEW_ROOT}/${i}"
+ chmod 755 "${NEW_ROOT}/${i}"
+ done
+ [ ! -e "${NEW_ROOT}/dev/null" ] && mknod "${NEW_ROOT}"/dev/null c 1 3
+ [ ! -e "${NEW_ROOT}/dev/console" ] && mknod "${NEW_ROOT}"/dev/console c 5 1
+ fi
# For SGI LiveCDs ...
if [ "${LOOPTYPE}" = "sgimips" ]
@@ -432,7 +470,7 @@ then
[ ! -e "${NEW_ROOT}/dev/tty1" ] && mknod "${NEW_ROOT}/dev/tty1" c 4 1
fi
- if [ "${REAL_ROOT}" != "/dev/nfs" ] && [ "${LOOPTYPE}" != "sgimips" ]
+ if [ "${REAL_ROOT}" != "/dev/nfs" ] && [ "${LOOPTYPE}" != "sgimips" ] && [ "${USE_AUFS_NORMAL}" != '1' ]
then
bootstrapCD
fi
@@ -748,7 +786,23 @@ then
fi
fi
+ if [ "${USE_AUFS_NORMAL}" -eq '1' ]
+ then
+ union_insert_dir ${UNION} ${NEW_ROOT}/${FS_LOCATION}
+ # 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
+ warn_msg "Adding all modules in $MODULESD/modules/"
+ if [ "${MODULESD}" = "mnt/cdrom" ]
+ then
+ union_insert_modules mnt/cdrom
+ else
+ mkdir ${NEW_ROOT}/mnt/modulesd
+ mount "${MODULESD}" ${NEW_ROOT}/mnt/modulesd
+ union_insert_modules ${NEW_ROOT}/mnt/modulesd
+ fi
+ fi
# Unpacking additional packages from NFS mount
# This is useful for adding kernel modules to /lib
@@ -771,57 +825,57 @@ then
then
setup_unionfs ${NEW_ROOT} /${FS_LOCATION}
CHROOT=/union
- elif [ "${USE_AUFS_NORMAL}" != '1' ]; then
-
- good_msg "Copying read-write image contents to tmpfs"
- # Copy over stuff that should be writable
- (cd "${NEW_ROOT}/${FS_LOCATION}"; cp -a ${ROOT_TREES} "${NEW_ROOT}") || {
- bad_msg "Copying failed, dropping into a shell."
- do_rundebugshell
- }
-
- # Now we do the links.
- for x in ${ROOT_LINKS}
- do
- if [ -L "${NEW_ROOT}/${FS_LOCATION}/${x}" ]
+ else
+ #XXX this hunk confuses me more than a little and needs to be rewritten sanely at some point
+ if [ ! "${USE_AUFS_NORMAL}" -eq '1' ]
then
- ln -s "$(readlink ${NEW_ROOT}/${FS_LOCATION}/${x})" "${x}" 2>/dev/null
- else
- # List all subdirectories of x
- find "${NEW_ROOT}/${FS_LOCATION}/${x}" -type d 2>/dev/null | while read directory
- do
- # Strip the prefix of the FS_LOCATION
- directory="${directory#${NEW_ROOT}/${FS_LOCATION}/}"
+ good_msg "Copying read-write image contents to tmpfs"
+ # Copy over stuff that should be writable
+ (cd "${NEW_ROOT}/${FS_LOCATION}"; cp -a ${ROOT_TREES} "${NEW_ROOT}")
- # Skip this directory if we already linked a parent directory
- if [ "${current_parent}" != '' ]; then
- var=$(echo "${directory}" | grep "^${current_parent}")
- if [ "${var}" != '' ]; then
- continue
- fi
- fi
- # Test if the directory exists already
- if [ -e "/${NEW_ROOT}/${directory}" ]
+ # Now we do the links.
+ for x in ${ROOT_LINKS}
+ do
+ if [ -L "${NEW_ROOT}/${FS_LOCATION}/${x}" ]
then
- # It does exist, link all the individual files
- for file in $(ls /${NEW_ROOT}/${FS_LOCATION}/${directory})
+ ln -s "`readlink ${NEW_ROOT}/${FS_LOCATION}/${x}`" "${x}" 2>/dev/null
+ else
+ # List all subdirectories of x
+ find "${NEW_ROOT}/${FS_LOCATION}/${x}" -type d 2>/dev/null | while read directory
do
- if [ ! -d "/${NEW_ROOT}/${FS_LOCATION}/${directory}/${file}" ] && [ ! -e "${NEW_ROOT}/${directory}/${file}" ]; then
- ln -s "/${FS_LOCATION}/${directory}/${file}" "${directory}/${file}" 2> /dev/null
+ # Strip the prefix of the FS_LOCATION
+ directory="${directory#${NEW_ROOT}/${FS_LOCATION}/}"
+
+ # Skip this directory if we already linked a parent directory
+ if [ "${current_parent}" != '' ]; then
+ var=`echo "${directory}" | grep "^${current_parent}"`
+ if [ "${var}" != '' ]; then
+ continue
+ fi
+ fi
+ # Test if the directory exists already
+ if [ -e "/${NEW_ROOT}/${directory}" ]
+ then
+ # It does exist, link all the individual files
+ for file in `ls /${NEW_ROOT}/${FS_LOCATION}/${directory}`
+ do
+ if [ ! -d "/${NEW_ROOT}/${FS_LOCATION}/${directory}/${file}" ] && [ ! -e "${NEW_ROOT}/${directory}/${file}" ]; then
+ ln -s "/${FS_LOCATION}/${directory}/${file}" "${directory}/${file}" 2> /dev/null
+ fi
+ done
+ else
+ # It does not exist, make a link to the livecd
+ ln -s "/${FS_LOCATION}/${directory}" "${directory}" 2>/dev/null
+ current_parent="${directory}"
fi
done
- else
- # It does not exist, make a link to the livecd
- ln -s "/${FS_LOCATION}/${directory}" "${directory}" 2>/dev/null
- current_parent="${directory}"
fi
done
- fi
- done
-
- mkdir initramfs proc tmp sys run 2>/dev/null
- chmod 1777 tmp
+ mkdir initramfs proc tmp sys 2>/dev/null
+ chmod 1777 tmp
+ fi
+ #XXX: end extremely confusing hunk
fi
#UML=$(cat /proc/cpuinfo|grep UML|sed -e 's|model name.*: ||')
@@ -842,13 +896,18 @@ else
setup_unionfs /union_changes ${NEW_ROOT}
mkdir -p ${UNION}/tmp/.initrd
fi
+ if [ "${USE_AUFS_NORMAL}" -eq '1' ]
+ then
+ union_insert_dir ${UNION} ${NEW_ROOT}
+ mkdir -p ${UNION}/tmp/.initrd
+ fi
fi
# Mount the additional things as required by udev & systemd
if [ -f ${NEW_ROOT}/etc/initramfs.mounts ]; then
fslist=$(get_mounts_list)
else
- fslist="/usr"
+ fslist="/usr"
fi
for fs in $fslist; do
@@ -886,6 +945,35 @@ fi
verbose_kmsg
+if [ "${USE_AUFS_NORMAL}" -eq '1' ]
+then
+ mkdir -p /${CHROOT}/.unions/memory 2>/dev/null
+ mount -o move /memory /${CHROOT}/.unions/memory || echo '*: Failed to move aufs /memory into the system root!'
+ for i in tmp var/tmp mnt/gentoo mnt/livecd
+ do
+ mkdir -p ${CHROOT}/$i
+ chmod 755 ${CHROOT}/$i
+ done
+ # This will prevent from putting junk on the CHANGESDEV
+ mkdir -p ${CHROOT}/usr/portage/distfiles
+ mount -t tmpfs tmpfs ${CHROOT}/var/tmp
+ mount -t tmpfs tmpfs ${CHROOT}/tmp
+ mount -t tmpfs tmpfs ${CHROOT}/usr/portage/distfiles
+ warn_msg "/tmp /var/tmp /usr/portage/distfiles are mounted in ram"
+ warn_msg "consider saving important files elsewhere..."
+ read -t 3 UNUSEDVAL
+ mount -o bind ${NEW_ROOT}/mnt/cdrom ${CHROOT}/mnt/cdrom
+ mount -o bind ${NEW_ROOT}/mnt/livecd ${CHROOT}/mnt/livecd
+ if [ -e $MEMORY/keyboard -a "${CDROOT}" -eq '1' ]
+ then
+ cp $MEMORY/keyboard ${CHROOT}/etc/sysconfig/keyboard
+ elif [ -e /etc/sysconfig/keyboard -a "${CDROOT}" -eq '1' ]
+ then
+ mkdir -p ${NEW_ROOT}/etc/sysconfig/
+ cp /etc/sysconfig/keyboard ${CHROOT}/etc/sysconfig/keyboard
+ fi
+fi
+
echo -ne "${GOOD}>>${NORMAL}${BOLD} Booting (initramfs)${NORMAL}"
cd "${CHROOT}"
diff --git a/gen_compile.sh b/gen_compile.sh
index cbd3432..cdd4643 100755
--- a/gen_compile.sh
+++ b/gen_compile.sh
@@ -565,6 +565,58 @@ compile_device_mapper() {
compile_lvm
}
+compile_e2fstools() {
+ if [ -f "${E2FSPROGS_BINCACHE}" ]
+ then
+ print_info 1 "e2fstools: >> Using cache"
+ else
+ [ ! -f "${E2FSPROGS_SRCTAR}" ] &&
+ gen_die "Could not find e2fsprogs source tarball: ${E2FSPROGS_SRCTAR}. Please place it there, or place another version, changing /etc/genkernel.conf as necessary!"
+ cd "${TEMP}"
+ rm -rf "${E2FSPROGS_DIR}"
+ tar -zxpf "${E2FSPROGS_SRCTAR}"
+ [ ! -d "${E2FSPROGS_DIR}" ] &&
+ gen_die "e2fsprogs directory ${E2FSPROGS_DIR} invalid"
+ cd "${E2FSPROGS_DIR}"
+ print_info 1 'e2fsprogs: >> Configuring...'
+ LDFLAGS="-static" ./configure >> ${LOGFILE} 2>&1 ||
+ gen_die 'Configuring e2fsprogs failed!'
+ print_info 1 'e2fsprogs: >> Compiling libs...'
+ #MAKE=${UTILS_MAKE} compile_generic "" ""
+ make libs >> ${LOGFILE} 2>&1 ||
+ gen_die 'Compiling e2fsprogs libs failed!'
+ print_info 1 'e2fsprogs: >> Compiling e2fsck...'
+ cd "${TEMP}/${E2FSPROGS_DIR}/e2fsck"
+ make e2fsck.static >> ${LOGFILE} 2>&1 ||
+ gen_die 'Compiling static e2fsck failed!'
+ cd "${TEMP}/${E2FSPROGS_DIR}/misc"
+ print_info 1 'e2fsprogs: >> Compiling mke2fs...'
+ make mke2fs.static >> ${LOGFILE} 2>&1 ||
+ gen_die 'Compiling static mke2fs failed!'
+ cd "${TEMP}/${E2FSPROGS_DIR}"
+ print_info 1 'e2fsprogs: >> Copying to cache...'
+ [ -f "${TEMP}/${E2FSPROGS_DIR}/misc/mke2fs.static" ] ||
+ gen_die 'mke2fs executable does not exist!'
+ [ -f "${TEMP}/${E2FSPROGS_DIR}/e2fsck/e2fsck.static" ] ||
+ gen_die 'e2fsck executable does not exist!'
+ strip "${TEMP}/${E2FSPROGS_DIR}/misc/mke2fs.static" "${TEMP}/${E2FSPROGS_DIR}/e2fsck/e2fsck.static" ||
+ gen_die 'Could not strip e2fs binaries!'
+
+ mkdir "${TEMP}/e2fsprogs"
+ mkdir "${TEMP}/e2fsprogs/sbin"
+ install -m 0755 -s misc/mke2fs.static "${TEMP}/e2fsprogs/sbin/mke2fs"
+ install -m 0755 -s e2fsck/e2fsck.static "${TEMP}/e2fsprogs/sbin/e2fsck"
+ print_info 1 ' >> Copying to bincache...'
+ cd "${TEMP}/e2fsprogs"
+ /bin/tar -cjf "${E2FSPROGS_BINCACHE}" sbin/ ||
+ gen_die 'Could not create binary cache'
+
+ cd "${TEMP}"
+ rm -rf "${TEMP}/e2fsprogs" > /dev/null
+ rm -rf "${E2FSPROGS_DIR}" > /dev/null
+ fi
+}
+
compile_fuse() {
if [ ! -f "${FUSE_BINCACHE}" ]
then
diff --git a/gen_determineargs.sh b/gen_determineargs.sh
index 7f352f8..a0563fd 100755
--- a/gen_determineargs.sh
+++ b/gen_determineargs.sh
@@ -144,6 +144,7 @@ determine_real_args() {
MDADM_BINCACHE=`cache_replace "${MDADM_BINCACHE}"`
DMRAID_BINCACHE=`cache_replace "${DMRAID_BINCACHE}"`
ISCSI_BINCACHE=`cache_replace "${ISCSI_BINCACHE}"`
+ E2FSPROGS_BINCACHE=`cache_replace "${E2FSPROGS_BINCACHE}"`
BLKID_BINCACHE=`cache_replace "${BLKID_BINCACHE}"`
FUSE_BINCACHE=`cache_replace "${FUSE_BINCACHE}"`
UNIONFS_FUSE_BINCACHE=`cache_replace "${UNIONFS_FUSE_BINCACHE}"`
diff --git a/gen_initramfs.sh b/gen_initramfs.sh
index ac90830..75bb47f 100755
--- a/gen_initramfs.sh
+++ b/gen_initramfs.sh
@@ -127,6 +127,26 @@ append_busybox() {
rm -rf "${TEMP}/initramfs-busybox-temp" > /dev/null
}
+# Used to add e2fs file making inside initramfs for aufs changes saving
+append_e2fstools(){
+ if [ -d "${TEMP}/initramfs-e2fsprogs-temp" ]
+ then
+ rm -r "${TEMP}/initramfs-e2fsprogs-temp/"
+ fi
+ #print_info 1 'E2FSTOOLS: Adding support (compiling binaries)...'
+ # Using different name for blkid compatibility
+ #compile_e2fstools
+ cd ${TEMP}
+ mkdir -p "${TEMP}/initramfs-e2fsprogs-temp/"
+ #XXX: do we want to add an if statement here or just include it? I say include it...
+ copy_binaries "${TEMP}"/initramfs-e2fsprogs-temp/ /sbin/{e2fsck,mke2fs}
+ #/bin/tar -jxpf "${E2FSPROGS_BINCACHE}" -C "${TEMP}/initramfs-e2fsprogs-temp/" ||
+ # gen_die "Could not extract e2fsprogs binary cache!"
+ cd "${TEMP}/initramfs-e2fsprogs-temp/"
+ find . -print | cpio ${CPIO_ARGS} --append -F "${CPIO}"
+ rm -rf "${TEMP}/initramfs-e2fsprogs-temp" > /dev/null
+}
+
append_blkid(){
if [ -d "${TEMP}/initramfs-blkid-temp" ]
then
@@ -741,6 +762,7 @@ create_initramfs() {
append_data 'base_layout'
append_data 'auxilary' "${BUSYBOX}"
append_data 'busybox' "${BUSYBOX}"
+ append_data 'e2fstools'
append_data 'lvm' "${LVM}"
append_data 'dmraid' "${DMRAID}"
append_data 'iscsi' "${ISCSI}"

View file

@ -75,7 +75,7 @@ src_unpack() {
fi
use selinux && sed -i 's/###//g' "${S}"/gen_compile.sh
cd "${S}"
use pentoo && epatch "${FILESDIR}"/9999-pass-1.patch
use pentoo && epatch "${FILESDIR}"/9999-pass-2.patch
}
src_compile() {