Re: Swsusp, resume and kernel versions

From: Nigel Cunningham
Date: Fri Feb 18 2005 - 05:35:04 EST


Hi Stefan.

For Suspend2, we also put a device id in the space, so there's only room
for one character, which is a lower or upper case Z. (We also validate
the device ID, so a random Z won't cause an oops).

Thanks for the code. With your/Suse's permission, I'll ask Bernard
(cc'd) to include the script in the docs somewhere with the appropriate
credit.

Thanks and regards,

Nigel

On Fri, 2005-02-18 at 08:05, Stefan Seyfried wrote:
> Nigel Cunningham wrote:
>
> > If the mistakenly booted kernel isn't suspend enabled, however, you need
> > a more generic method of removing the image, such as mkswapping the
> > storage device. This is what I was speaking of.
>
> The following code is used in the SUSE bootscripts to do exactly this:
>
> ----------------------------------------------------
> get_swap_id() {
> local line;
> fdisk -l | while read line; do
> case "$line" in
> /*Linux\ [sS]wap*) echo "${line%% *}"
> esac
> done
> }
>
> check_swap_sig () {
> local part="$(get_swap_id)"
> local where what type rest p c
> while read where what type rest ; do
> test "$type" = "swap" || continue
> c=continue
> for p in $part ; do
> test "$p" = "$where" && c=true
> done
> $c
> case "$(dd if=$where bs=1 count=6 skip=4086 2>/dev/null)" in
> S1SUSP|S2SUSP) mkswap $where
> esac
> done < /etc/fstab
> }
> ---------------------------------------------------------------------
>
> This invalidates the suspend signature if the kernel has not already
> done it. It probably does not cover the softwaresuspend2 signature but
> that should be trivial to add.
>
> Regards,
>
> Stefan
--
Nigel Cunningham
Software Engineer, Canberra, Australia
http://www.cyclades.com

Ph: +61 (2) 6292 8028 Mob: +61 (417) 100 574

-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/