geninitrd/trunk/geninitrd

arekm cvs at pld-linux.org
Sun Apr 9 15:01:55 CEST 2006


Author: arekm
Date: Sun Apr  9 15:01:53 2006
New Revision: 7337

Modified:
   geninitrd/trunk/geninitrd
Log:
Mainline suspend support. Suspend 2 renamed. Both suspends turned off by default.

Modified: geninitrd/trunk/geninitrd
==============================================================================
--- geninitrd/trunk/geninitrd	(original)
+++ geninitrd/trunk/geninitrd	Sun Apr  9 15:01:53 2006
@@ -20,7 +20,8 @@
 USERAIDSTART="yes"
 USEMDADMSTATIC="no"
 USEINSMODSTATIC="no"
-USESUSPEND="yes"
+USESUSPEND="no"
+USESUSPEND2="no"
 uselvm="no"
 usenfs="no"
 # it should be safe to remove scsi_mod from here, but I'm not sure...
@@ -58,7 +59,7 @@
 	echo "       [--initrdfs=rom|ext2|cram] [--modules-conf=<modules.conf>]" 
 	echo "       [--with-raidstart] [--without-raidstart] [--with-insmod-static]" 
 	echo "       [--without-bootsplash] [--lvmtoolsversion=1|2] [--without-udev]"
-	echo "       [--without-suspend2] [--without-dmraid]"
+	echo "       [--with-suspend] [--with-suspend2] [--without-dmraid]"
 	echo "       <initrd-image> <kernel-version>" 
 	echo "       (ex: `basename $0` /boot/initrd-2.2.5-15.img 2.2.5-15)" 
 	exit 1
@@ -712,8 +713,11 @@
 	--without-bootsplash)
 		BOOT_SPLASH="no"
 		;;
-	--without-suspend2)
-		USESUSPEND2="no";
+	--with-suspend)
+		USESUSPEND="yes";
+		;;
+	--with-suspend2)
+		USESUSPEND2="yes";
 		;;
 	--lvmtoolsversion=|--lvmversion=)
 		LVMTOOLSVERSION="`echo $1 | awk -F= '{print $2;}'`"
@@ -888,6 +892,13 @@
 	exit 1
 fi
 
+if is_yes "$USESUSPEND"; then
+	if is_yes "$USESUSPEND2"; then
+		echo "Suspend2 shouldn't be used in parallel with mainline suspend!." 1>&2
+		exit 1
+	fi
+fi
+
 if [ ! -f /proc/mounts ]; then
     	echo "WARNING: /proc filesystem not mounted, may cause wrong results or failure." 1>&2
 fi
@@ -1013,6 +1024,20 @@
 #	echo "losetup $rootdev1 /loopfs$loopFile" >> "$RCFILE"
 #fi
 
+initrd_gen_suspend() {
+	if [ ! -x /usr/sbin/resume ]; then
+		echo "/usr/sbin/resume is missing !"
+		exit 1
+	fi
+	mkdir -p $MNTIMAGE/etc
+	mkdir -p $MNTIMAGE/dev
+	resume_dev="$(awk '/^resume device =/ { print $4 } ' /etc/suspend.conf)"
+	cp -HR /dev/snapshot $resume_dev $MNTIMAGE/dev
+	inst /etc/suspend.conf $MNTIMAGE/etc/suspend.conf
+	inst /usr/sbin/resume "$MNTIMAGE/bin/resume"
+	echo "resume" >> "$s"
+}
+
 initrd_gen_suspend2() {
 	MODULES=""
 	for mod in $SUSPEND2MODS; do
@@ -1266,6 +1291,10 @@
 	initrd_gen_udev
 fi
 
+if is_yes "$USESUSPEND"; then
+	initrd_gen_suspend
+fi
+
 if is_yes "$USESUSPEND2"; then
 	initrd_gen_suspend2
 fi


More information about the pld-cvs-commit mailing list