pentoo-overlay/sys-kernel/genkernel/files/genkernel-3.4.9-modules.patch
2008-11-29 17:35:05 +00:00

189 lines
6.8 KiB
Diff

diff -Naur genkernel-3.4.9/gen_compile.sh genkernel-3.4.9.modules/gen_compile.sh
--- genkernel-3.4.9/gen_compile.sh 2008-01-12 00:44:19.000000000 +0100
+++ genkernel-3.4.9.modules/gen_compile.sh 2008-01-28 22:07:43.000000000 +0100
@@ -325,65 +325,7 @@
}
compile_unionfs_modules() {
- if [ ! -f "${UNIONFS_MODULES_BINCACHE}" ]
- then
- [ -f "${UNIONFS_SRCTAR}" ] ||
- gen_die "Could not find unionfs source tarball: ${UNIONFS_SRCTAR}!"
- cd "${TEMP}"
- rm -rf ${UNIONFS_DIR} > /dev/null
- rm -rf unionfs* > /dev/null
- mkdir unionfs
- /bin/tar xzpf ${UNIONFS_SRCTAR} ||
- gen_die 'Could not extract unionfs source tarball!'
- [ -d "${UNIONFS_DIR}" ] ||
- gen_die 'Unionfs directory ${UNIONFS_DIR} is invalid!'
- cd "${UNIONFS_DIR}"
- print_info 1 'unionfs modules: >> Compiling...'
- echo "LINUXSRC=${KERNEL_DIR}" >> fistdev.mk
- echo 'TOPINC=-I$(LINUXSRC)/include' >> fistdev.mk
- echo "MODDIR= /lib/modules/${KV}" >> fistdev.mk
- echo "KVERS=${KV}" >> fistdev.mk
- echo "KERNELVERSION=${KV}" >> fistdev.mk
- # Fix for hardened/selinux systems to have extened attributes
- # per r2d2's request. Also add -DUNIONFS_UNSUPPORTED for 2.6.16
- echo "EXTRACFLAGS=-DUNIONFS_XATTR -DFIST_SETXATTR_CONSTVOID -DUNIONFS_UNSUPPORTED" \
- >> fistdev.mk
- # Here we do something really nasty and disable debugging, along with
- # change our default CFLAGS
- echo "UNIONFS_DEBUG_CFLAG=-DUNIONFS_NDEBUG" >> fistdev.mk
- echo "UNIONFS_OPT_CFLAG= -O2 -pipe" >> fistdev.mk
-
- if [ "${PAT}" -ge '6' ]
- then
- # ARCH is used by unionfs - and conflicts with genkernel
- ARCH_PUSH=${ARCH}
- unset ARCH
- # Compile unionfs module within the unionfs
- # environment not within the kernelsrc dir
- make unionfs.ko || gen_die 'failed to compile unionfs'
- ARCH=${ARCH_PUSH}
- else
- gen_die 'unionfs is only supported on 2.6 targets'
- fi
- print_info 1 'unionfs: >> Copying to cache...'
-
- mkdir -p ${TEMP}/unionfs/lib/modules/${KV}/kernel/fs/unionfs
-
- if [ -f unionfs.ko ]
- then
- cp -f unionfs.ko ${TEMP}/unionfs/lib/modules/${KV}/kernel/fs/unionfs
- else
- cp -f unionfs.o ${TEMP}/unionfs/lib/modules/${KV}/kernel/fs/unionfs
- fi
-
- cd ${TEMP}/unionfs
- /bin/tar -cjf "${UNIONFS_MODULES_BINCACHE}" . ||
- gen_die 'Could not create unionfs modules binary cache'
-
- cd "${TEMP}"
- rm -rf "${UNIONFS_DIR}" > /dev/null
- rm -rf unionfs > /dev/null
- fi
+ echo "Nothing to compile, unionfs is in kernel now"
}
compile_unionfs_utils() {
diff -Naur genkernel-3.4.9/gen_initramfs.sh genkernel-3.4.9.modules/gen_initramfs.sh
--- genkernel-3.4.9/gen_initramfs.sh 2008-01-12 00:44:19.000000000 +0100
+++ genkernel-3.4.9.modules/gen_initramfs.sh 2008-01-28 22:07:43.000000000 +0100
@@ -73,18 +73,7 @@
}
append_unionfs_modules(){
- if [ -d "${TEMP}/initramfs-unionfs-modules-temp" ]
- then
- rm -r "${TEMP}/initramfs-unionfs-modules-temp/"
- fi
- print_info 1 'UNIONFS MODULES: Adding support (compiling)...'
compile_unionfs_modules
- mkdir -p "${TEMP}/initramfs-unionfs-modules-temp/"
- /bin/tar -jxpf "${UNIONFS_MODULES_BINCACHE}" -C "${TEMP}/initramfs-unionfs-modules-temp" ||
- gen_die "Could not extract unionfs modules binary cache!";
- cd "${TEMP}/initramfs-unionfs-modules-temp/"
- find . -print | cpio ${CPIO_ARGS} --append -F "${CPIO}"
- rm -r "${TEMP}/initramfs-unionfs-modules-temp/"
}
append_unionfs_tools(){
@@ -454,7 +443,7 @@
append_data 'auxilary'
append_data 'busybox' "${BUSYBOX}"
# append_data 'devfs' "${DEVFS}"
- append_data 'unionfs_modules' "${UNIONFS}"
+# append_data 'unionfs_modules' "${UNIONFS}"
append_data 'unionfs_tools' "${UNIONFS}"
append_data 'lvm' "${LVM}"
append_data 'dmraid' "${DMRAID}"
diff -Naur genkernel-3.4.9/generic/initrd.defaults genkernel-3.4.9.modules/generic/initrd.defaults
--- genkernel-3.4.9/generic/initrd.defaults 2008-01-12 00:44:19.000000000 +0100
+++ genkernel-3.4.9.modules/generic/initrd.defaults 2008-01-28 22:07:43.000000000 +0100
@@ -76,6 +76,7 @@
CDROOT_TYPE='auto'
NEW_ROOT="/newroot"
CONSOLE="/dev/console"
+MODULESD="mnt/cdrom"
# Only sections that are in by default or those that
# are not module groups need to be defined here...
diff -Naur genkernel-3.4.9/generic/initrd.scripts genkernel-3.4.9.modules/generic/initrd.scripts
--- genkernel-3.4.9/generic/initrd.scripts 2008-01-12 00:44:19.000000000 +0100
+++ genkernel-3.4.9.modules/generic/initrd.scripts 2008-01-28 22:07:43.000000000 +0100
@@ -202,14 +202,27 @@
#
union_insert_dir() {
# detect branch 0 because newer unionfs doesn't support "0,1,2"
- BRANCH_0="/"$(/sbin/unionctl $1 --list | cut -d/ -f2- | cut -d'(' -f1)
- /sbin/unionctl $1 --add --after $BRANCH_0 --mode ro $2
+ # BRANCH_0="/"$(/sbin/unionctl $1 --list | cut -d/ -f2- | cut -d'(' -f1)
+ #/sbin/unionctl $1 --add --after $BRANCH_0 --mode ro $2
+ mount -t unionfs -o remount,add=:$2=ro unionfs $1
if [ $? = '0' ]
then
- good_msg "Addition of $2 to $1 after branch $BRANCH_0 successful"
+ 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`
+ do
+ mkdir -p ${MEMORY}/modules/`basename ${module} .mo`
+ mount -o loop,ro ${module} ${MEMORY}/modules/`basename ${module} .mo`
+ union_insert_dir $UNION ${MEMORY}/modules/`basename ${module} .mo`
+ done
+}
+
+
findnfsmount() {
if [ "${IP}" != '' ] || busybox udhcpc -R rootpath -n -s /bin/udhcpc.scripts
@@ -934,8 +947,8 @@
mkdir -p ${MEMORY}
mkdir -p ${UNION}
- good_msg "Loading unionfs module"
- modprobe unionfs > /dev/null 2>&1
+# good_msg "Loading unionfs module"
+# modprobe unionfs > /dev/null 2>&1
if [ -n "${UNIONFS}" ]
then
CHANGESDEV=${UNIONFS}
diff -Naur genkernel-3.4.9/generic/linuxrc genkernel-3.4.9.modules/generic/linuxrc
--- genkernel-3.4.9/generic/linuxrc 2008-01-12 00:44:19.000000000 +0100
+++ genkernel-3.4.9.modules/generic/linuxrc 2008-01-28 22:07:43.000000000 +0100
@@ -108,6 +108,10 @@
fi
fi
;;
+ # Allow user to specify the modules location
+ modules\=*)
+ MODULESD=`parse_opt "${x}"`
+ ;;
# Start Volume manager options
dolvm)
USE_LVM_NORMAL=1
@@ -613,7 +617,16 @@
# Make sure fstab notes livecd is mounted ro. Makes system skip remount which fails on unionfs 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
+ 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