Bug#474691: Can't resume from swap file hibernation (as opposed to partition)
On Mon, 07 Apr 2008, Alan Jenkins wrote:
> To resume from a swap file within a partition using the original swsusp,
> you find the block offset of the swap file header using e.g. swap-offset
> from the uswsusp package, and add "resume=<dev>" and
> "resume_offset=<blocks>" parameters to the kernel command-line.
> Unfortunately this parameter is not recognised by the initramfs scripts
> (so it would only work if you booted without an initramfs).
ack,
never used that.
> diff --git a/resume b/resume
> index d997f81..8a41f83 100755
> --- a/resume
> +++ b/resume
> @@ -34,5 +34,5 @@ fi
>
> if [ -e /sys/power/resume ]; then
> # hardcode path, uswsusp ships an resume binary too
> - /bin/resume ${resume}
> + /bin/resume ${resume} ${resume_offset}
> fi
ack
that looks like a start, but misses a definition of resume_offset
in the cmdline parsing and it's export.
so rewrote that too:
diff --git a/init b/init
index 3a93ef8..70f4384 100755
--- a/init
+++ b/init
@@ -50,6 +50,7 @@ export rootmnt=/root
export debug=
export panic=
export blacklist=
+export resume_offset=
# Parse command line options
for x in $(cat /proc/cmdline); do
@@ -97,6 +98,9 @@ for x in $(cat /proc/cmdline); do
resume=*)
RESUME="${x#resume=}"
;;
+ resume_offset=*)
+ resume_offset="${x#resume_offset=}"
+ ;;
noresume)
noresume=y
;;
diff --git a/scripts/local-premount/resume b/scripts/local-premount/resume
index d997f81..6bf95e5 100755
--- a/scripts/local-premount/resume
+++ b/scripts/local-premount/resume
@@ -28,11 +28,13 @@ case $resume in
;;
esac
-if [ ! -e "${resume}" ]; then
- exit 0
-fi
+[ ! -e "${resume}" ] && exit 0
+
+[ ! -e /sys/power/resume ] && exit 0
-if [ -e /sys/power/resume ]; then
- # hardcode path, uswsusp ships an resume binary too
+# hardcode path, uswsusp ships an resume binary too
+if [ -n "${resume_offset}" ]; then
+ /bin/resume ${resume} ${resume_offset}
+else
/bin/resume ${resume}
fi
Reply to: