|
@@ -0,0 +1,305 @@
|
|
|
+diff -up mkinitrd-6.0.93/mkinitrd.tuxonice mkinitrd-6.0.93/mkinitrd
|
|
|
+--- mkinitrd-6.0.93/mkinitrd.tuxonice 2010-03-18 13:27:18.000000000 +0900
|
|
|
|
|
|
+@@ -74,6 +74,8 @@ LD_SO_CONF=/etc/ld.so.conf
|
|
|
+ LD_SO_CONF_D=/etc/ld.so.conf.d/
|
|
|
+
|
|
|
+ [ -e /etc/sysconfig/mkinitrd ] && . /etc/sysconfig/mkinitrd
|
|
|
++[ -e /etc/sysconfig/mkinitrd-suspend2 ] && . /etc/sysconfig/mkinitrd-suspend2
|
|
|
++[ -e /etc/sysconfig/mkinitrd-tuxonice ] && . /etc/sysconfig/mkinitrd-tuxonice
|
|
|
+
|
|
|
+ CONFMODS="$MODULES"
|
|
|
+ MODULES=""
|
|
|
+@@ -91,7 +93,18 @@ modulefile=/etc/modules.conf
|
|
|
+ rc=0
|
|
|
+ nolvm=""
|
|
|
+ nodmraid=""
|
|
|
+-
|
|
|
++tuxoniceuserui="none"
|
|
|
++tuxoniceversion="30001"
|
|
|
++tuxonicefwtarget=""
|
|
|
++splashtheme="suspend2"
|
|
|
++
|
|
|
++DSDT="/boot/DSDT.aml"
|
|
|
++SWSUSPPROC="/proc/suspend2"
|
|
|
++USERUIPROC="userui_program"
|
|
|
++FWLOCPROC="filewriter_target"
|
|
|
++RESUMETAR="resume2"
|
|
|
++FWIDENT="Suspend2"
|
|
|
++UIPREFIX="suspend2"
|
|
|
+ IMAGESIZE=8000
|
|
|
+ PRESCSIMODS=""
|
|
|
+ fstab="/etc/fstab"
|
|
|
+@@ -111,6 +124,9 @@ usage () {
|
|
|
+ $cmd " [--image-version] [--force-raid-probe | --omit-raid-modules]"
|
|
|
+ $cmd " [--with=<module>] [--force-lvm-probe | --omit-lvm-modules]"
|
|
|
+ $cmd " [--builtin=<module>] [--omit-dmraid] [--net-dev=<interface>]"
|
|
|
++ $cmd " [--tuxonice-userui=<none | auto | text | fb>]"
|
|
|
++ $cmd " [--tuxonice-version=<version-string>] [--splash=<theme>]"
|
|
|
++ $cmd " [--dsdt-location=<location of DSDT-file>]"
|
|
|
+ $cmd " [--fstab=<fstab>] [--nocompress] <initrd-image> <kernel-version>"
|
|
|
+ $cmd ""
|
|
|
+ $cmd " (ex: `basename $0` /boot/initrd-2.2.5-15.img 2.2.5-15)"
|
|
|
+@@ -745,6 +761,125 @@ handlegraphics() {
|
|
|
+ qpopd
|
|
|
+ }
|
|
|
+
|
|
|
++IsANumber() {
|
|
|
++ case "$1" in *[!0-9]*|"") return 1 ;; esac
|
|
|
++ return 0
|
|
|
++}
|
|
|
++
|
|
|
++check_filewriter() {
|
|
|
++ # Filewriterhandling for Software Suspend 2
|
|
|
++ # we will check for /etc/hibernate/hibernate.conf and the filewriter
|
|
|
++ # settings there
|
|
|
++ local resume2 fwlocopt fwloc fwsize oldtarget newresume2
|
|
|
++
|
|
|
++ if [ -e $1/$RESUMETAR ]; then
|
|
|
++ resume2=$(cat $1/$RESUMETAR)
|
|
|
++ # if filewriter is already active use that information
|
|
|
++ if [ $(echo "$resume2"X | dd bs=5 count=1 2>/dev/null) = "file:" ]; then tuxonicefwtarget=$resume2; return; fi
|
|
|
++ else
|
|
|
++ # if resume2 does not exist the current kernel is not Suspend 2 enabled,
|
|
|
++ # so there is no way to determine filewriters target information anyway
|
|
|
++ return
|
|
|
++ fi
|
|
|
++
|
|
|
++ if [ ! -e $1/$2 ]; then return; fi
|
|
|
++ if [ -e /etc/hibernate/tuxonice.conf ]; then
|
|
|
++ fwlocopt=$(egrep ^FilewriterLocation /etc/hibernate/tuxonice.conf|tail -n 1)
|
|
|
++ elif [ -e /etc/hibernate/suspend2.conf ]; then
|
|
|
++ fwlocopt=$(egrep ^FilewriterLocation /etc/hibernate/suspend2.conf|tail -n 1)
|
|
|
++ elif [ ! -e /etc/hibernate/hibernate.conf ]; then
|
|
|
++ return;
|
|
|
++ else
|
|
|
++ fwlocopt=$(egrep ^FilewriterLocation /etc/hibernate/hibernate.conf|tail -n 1)
|
|
|
++ fi
|
|
|
++
|
|
|
++ if [ ! "$fwlocopt" ]; then return; fi
|
|
|
++ fwloc=$(echo $fwlocopt | awk '{ print $2 }')
|
|
|
++ fwsize=$(echo $fwlocopt | awk '{ print $3 }')
|
|
|
++
|
|
|
++ if [ ! -e "$fwloc" ]; then
|
|
|
++ if ! IsANumber "$fwsize"; then return; fi
|
|
|
++ {
|
|
|
++ echo "$FWIDENT"
|
|
|
++ dd if=/dev/zero bs=1M count=$fwsize 2>/dev/null
|
|
|
++
|
|
|
++ } > "$fwloc"
|
|
|
++ fi
|
|
|
++
|
|
|
++ oldtarget=$(cat $1/$2)
|
|
|
++ sync
|
|
|
++ echo "$fwloc" > $1/$2
|
|
|
++ newresume2=$(cat $1/$RESUMETAR)
|
|
|
++ echo "$oldtarget" > $1/$2
|
|
|
++ echo "$resume2" > $1/$RESUMETAR
|
|
|
++
|
|
|
++ if [ $(echo $newresume2 | dd bs=5 count=1 2>/dev/null) = "file:" ]; then tuxonicefwtarget=$newresume2; fi
|
|
|
++}
|
|
|
++
|
|
|
++inst_tuxonice() {
|
|
|
++ # TuxOnIce stuff
|
|
|
++ emit "echo Activating tux on ice"
|
|
|
++ userui="$tuxoniceuserui";
|
|
|
++ if [ "x$tuxoniceuserui" == "xauto" ]; then
|
|
|
++ if [ -f /sbin/${UIPREFIX}ui_fbsplash ]; then
|
|
|
++ userui="fb";
|
|
|
++ elif [ -f /sbin/${UIPREFIX}ui_text ]; then
|
|
|
++ userui="text";
|
|
|
++ else
|
|
|
++ userui="none";
|
|
|
++ fi
|
|
|
++ fi
|
|
|
++ if [ "x$userui" != "xnone" ]; then
|
|
|
++ if [ "x$userui" == "xfb" ]; then
|
|
|
++ if [ -f /sbin/${UIPREFIX}ui_fbsplash ]; then
|
|
|
++ inst /sbin/${UIPREFIX}ui_fbsplash "$2" /bin/${UIPREFIX}ui_fbsplash
|
|
|
++ if [ -e /etc/splash/${splashtheme} ]; then
|
|
|
++ mkdir "$2/etc/splash"
|
|
|
++ cp -prH /etc/splash/${splashtheme}/ "$2/etc/splash/"
|
|
|
++ fi
|
|
|
++ # check if splashtheme is a symlink and add one to initrd if that is the case
|
|
|
++ if [ -L /etc/splash/${splashtheme} ]; then
|
|
|
++ dlink=` find /etc/splash/${splashtheme} -printf '%l' `
|
|
|
++ dlink=$(basename $dlink)
|
|
|
++ ln -sf ${splashtheme} "$2/etc/splash/$dlink"
|
|
|
++ fi
|
|
|
++ if [ -e $2/etc/splash/{$splashtheme} ]; then
|
|
|
++ if [ ! -e $2/etc/splash/TuxOnIce ]; then
|
|
|
++ ln -sf ${splashtheme} "$2/etc/splash/TuxOnIce"
|
|
|
++ fi
|
|
|
++ if [ ! -e $2/etc/splash/suspend2 ]; then
|
|
|
++ ln -sf ${splashtheme} "$2/etc/splash/suspend2"
|
|
|
++ fi
|
|
|
++ fi
|
|
|
++ if [ -f /sbin/splash_helper ]; then
|
|
|
++ inst /sbin/splash_helper "$2" /bin/splash_helper
|
|
|
++ fi
|
|
|
++ emit "echo /bin/${UIPREFIX}ui_fbsplash > $1/$4"
|
|
|
++ else
|
|
|
++ error "WARNING: framebuffer UI for suspend not found, skipping."
|
|
|
++ fi
|
|
|
++ elif [ "x$userui" == "xtext" ]; then
|
|
|
++ if [ -f /sbin/${UIPREFIX}ui_text ]; then
|
|
|
++ inst /sbin/${UIPREFIX}ui_text "$2" /bin/${UIPREFIX}ui_text
|
|
|
++ emit "echo /bin/${UIPREFIX}ui_text > $1/$4"
|
|
|
++ else
|
|
|
++ error "WARNING: text UI for suspend not found, skipping."
|
|
|
++ fi
|
|
|
++ else
|
|
|
++ error "WARNING: unknown UI \"$userui\" specified."
|
|
|
++ fi
|
|
|
++ fi
|
|
|
++
|
|
|
++ # First try to resume with the parameter present on the kernel commandline
|
|
|
++ emit "echo Trying to resume from target specified as $RESUMETAR on cmdline."
|
|
|
++ emit "echo 1 > $1/do_resume"
|
|
|
++
|
|
|
++ # Then we will try the swapdevice/filetarget that was present while creating the initrd
|
|
|
++ emit "echo Trying to resume from $3."
|
|
|
++ emit "echo $3 > $1/$RESUMETAR"
|
|
|
++ emit "echo 1 > $1/do_resume"
|
|
|
++}
|
|
|
++
|
|
|
+ savedargs=$*
|
|
|
+ while [ $# -gt 0 ]; do
|
|
|
+ case $1 in
|
|
|
+@@ -945,6 +1080,54 @@ while [ $# -gt 0 ]; do
|
|
|
+ shift
|
|
|
+ fi
|
|
|
+ ;;
|
|
|
++ --splash*)
|
|
|
++ if echo $1 | grep -q '=' ; then
|
|
|
++ splashtheme=`echo $1 | sed 's/^--splash=//'`
|
|
|
++ else
|
|
|
++ splashtheme=$2
|
|
|
++ shift
|
|
|
++ fi
|
|
|
++ ;;
|
|
|
++ --tuxonice-userui*)
|
|
|
++ if echo $1 | grep -q '=' ; then
|
|
|
++ tuxoniceuserui=`echo $1 | sed 's/^--tuxonice-userui=//'`
|
|
|
++ else
|
|
|
++ tuxoniceuserui=$2
|
|
|
++ shift
|
|
|
++ fi
|
|
|
++ ;;
|
|
|
++ --tuxonice-version*)
|
|
|
++ if echo $1 | grep -q '=' ; then
|
|
|
++ tuxoniceversion=`echo $1 | sed 's/^--tuxonice-version=//'`
|
|
|
++ else
|
|
|
++ tuxoniceversion=$2
|
|
|
++ shift
|
|
|
++ fi
|
|
|
++ ;;
|
|
|
++ --suspend2-userui*)
|
|
|
++ if echo $1 | grep -q '=' ; then
|
|
|
++ tuxoniceuserui=`echo $1 | sed 's/^--suspend2-userui=//'`
|
|
|
++ else
|
|
|
++ tuxoniceuserui=$2
|
|
|
++ shift
|
|
|
++ fi
|
|
|
++ ;;
|
|
|
++ --suspend2-version*)
|
|
|
++ if echo $1 | grep -q '=' ; then
|
|
|
++ tuxoniceversion=`echo $1 | sed 's/^--suspend2-version=//'`
|
|
|
++ else
|
|
|
++ tuxoniceversion=$2
|
|
|
++ shift
|
|
|
++ fi
|
|
|
++ ;;
|
|
|
++ --dsdt-location*)
|
|
|
++ if echo $1 | grep -q '=' ; then
|
|
|
++ DSDT=`echo $1 | sed 's/^--dsdt-location=//'`
|
|
|
++ else
|
|
|
++ DSDT=$2
|
|
|
++ shift
|
|
|
++ fi
|
|
|
++ ;;
|
|
|
+ --help)
|
|
|
+ usage -n
|
|
|
+ ;;
|
|
|
+@@ -962,6 +1145,22 @@ while [ $# -gt 0 ]; do
|
|
|
+ shift
|
|
|
+ done
|
|
|
+
|
|
|
++if [ "$tuxoniceversion" -lt "20108" ]; then
|
|
|
++ SWSUSPPROC="/proc/software_suspend"
|
|
|
++elif [ "$tuxoniceversion" -ge "20208" ]; then
|
|
|
++ SWSUSPPROC="/sys/power/suspend2"
|
|
|
++ USERUIPROC="user_interface/program"
|
|
|
++ FWLOCPROC="filewriter/target"
|
|
|
++fi
|
|
|
++if [ "$tuxoniceversion" -ge "20211" ]; then
|
|
|
++ RESUMETAR="resume"
|
|
|
++fi
|
|
|
++if [ "$tuxoniceversion" -ge "20212" ]; then
|
|
|
++ SWSUSPPROC="/sys/power/tuxonice"
|
|
|
++ FWIDENT="TuxOnIce"
|
|
|
++ UIPREFIX="tuxonice"
|
|
|
++fi
|
|
|
++
|
|
|
+ if [ -z "$target" -o -z "$kernel" ]; then
|
|
|
+ usage
|
|
|
+ fi
|
|
|
+@@ -1186,6 +1385,7 @@ fi
|
|
|
+ mkdir -p $MNTIMAGE
|
|
|
+ mkdir -p $MNTIMAGE/lib/firmware
|
|
|
+ mkdir -p $MNTIMAGE/lib/modules/$kernel
|
|
|
++mkdir -p $MNTIMAGE/lib/splash
|
|
|
+ mkdir -p $MNTIMAGE/bin
|
|
|
+ mkdir -p $MNTIMAGE/etc
|
|
|
+ mkdir -p $MNTIMAGE/dev
|
|
|
+@@ -1220,6 +1420,10 @@ excludemods() {
|
|
|
+ echo $output
|
|
|
+ }
|
|
|
+
|
|
|
++if [ -e "$DSDT" ]; then
|
|
|
++ inst "$DSDT" "$MNTIMAGE/DSDT.aml"
|
|
|
++fi
|
|
|
++
|
|
|
+ if [ -n "$excludemodules" ]; then
|
|
|
+ MODULES=$(excludemods $MODULES)
|
|
|
+ availmodules=$(excludemods $availmodules)
|
|
|
+@@ -1253,6 +1457,7 @@ done
|
|
|
+ mknod $MNTIMAGE/dev/tty c 5 0
|
|
|
+ mknod $MNTIMAGE/dev/console c 5 1
|
|
|
+ mknod $MNTIMAGE/dev/ptmx c 5 2
|
|
|
++mknod $MNTIMAGE/dev/fb0 c 29 0
|
|
|
+
|
|
|
+ if [ -n "$raiddevices" ]; then
|
|
|
+ inst /sbin/mdadm "$MNTIMAGE"
|
|
|
+@@ -1496,6 +1701,7 @@ mknod /dev/console c 5 1
|
|
|
+ mknod /dev/ptmx c 5 2
|
|
|
+ mknod /dev/fb c 29 0
|
|
|
+ mknod /dev/hvc0 c 229 0
|
|
|
++mknod /dev/fb0 c 29 0
|
|
|
+ EOF
|
|
|
+
|
|
|
+ # XXX really we need to openvt too, in case someting changes the
|
|
|
+@@ -1628,8 +1834,21 @@ for cryptdev in ${!cryptolv@} ; do
|
|
|
+ emitcrypto `eval echo '$'$cryptdev`
|
|
|
+ done
|
|
|
+
|
|
|
+-if [ -z "$noresume" -a -n "$thawdev" ]; then
|
|
|
+- emit "resume $thawdev"
|
|
|
++if [ -z "$noresume" ]; then
|
|
|
++ if [ -n "$thawdev" ]; then
|
|
|
++ emit "resume $thawdev"
|
|
|
++ fi
|
|
|
++ check_filewriter $SWSUSPPROC $FWLOCPROC
|
|
|
++ swsuspdev="$thawdev"
|
|
|
++ if [ -n "$tuxonicefwtarget" ]; then
|
|
|
++ inst_tuxonice $SWSUSPPROC $MNTIMAGE $tuxonicefwtarget $USERUIPROC
|
|
|
++ elif [ -n "$swsuspdev" ]; then
|
|
|
++ if [[ "$swsuspdev" =~ ^(UUID=|LABEL=) ]]; then
|
|
|
++ swsuspdev=$(resolve_device_name "$swsuspdev")
|
|
|
++ fi
|
|
|
++
|
|
|
++ inst_tuxonice $SWSUSPPROC $MNTIMAGE swap:$swsuspdev $USERUIPROC
|
|
|
++ fi
|
|
|
+ fi
|
|
|
+
|
|
|
+ if [ -n "$loopfs" ]; then
|