On Mon, Jul 03, 2006 at 08:34:58PM +0200, Rafael J. Wysocki wrote:
> Great.  I'd like to create a HOWTO patch describing this, but I have no
> experience with initramfs and/or yaird.  Would you please describe
> shortly all steps needed to make it work?

It's not bad. I really think that getting ususpend integrated into
standard initrd/initramfs setups will be more fruitful than the support
in the suspend-0.2 release for generating a custom initrd.

In fact, I'd suggest you remove that in favor of a HOWTO like this. I
don't think it's very realistic to think that people will use a
ususpend-only initrd when every major linux distribution has mature and
flexible early-userspace implementations. otoh, maybe it's useful as an
example to distribution packagers.

anyway:

1. Run a 2.6.17 or newer kernel compiled with CONFIG_SOFTWARE_SUSPEND,
   debian unstable, and install yaird.

2. Use yaird to generate a working initramfs (if you're familiar with
   initrd, initramfs is exactly the same from a user perspective, for
   our purposes). On debian unstable, yaird is used to generate a new
   initramfs automatically when a new kernel is installed if yaird is
   installed and initramfs-tools isn't.

   A good way to test out yaird is "yaird -o /tmp/i -f directory". This
   creates a directory in /tmp/i with the same contents as the initramfs
   image it would otherwise generate without "-f directory". You can
   inspect the image and read the /tmp/i/init script to check that
   everything looks OK.

   If you're generating an initramfs for a kernel version other than the
   one currently running, you need to give yaird the desired kernel
   version as an argument, eg.
   "yaird -o /boot/initrd.img-2.6.17 2.6.17".

   Once you have your initramfs, you'll need to configure your boot
   loader to use it. The relevant part of my /boot/grub/menu.lst looks
   like this:

   title           Debian GNU/Linux, kernel 2.6.17.2
   root            (hd0,0)
   kernel          /vmlinuz-2.6.17.2 ro
   initrd          /initrd.img-2.6.17.2
   boot

   where (hd0,0) is my /boot partition.

3. Install the ususpend userland tools. Get the latest release from
   http://suspend.sourceforge.net/ and do "make && make install".

4. Edit the yaird config so it puts the "resume" program and
   its config file, /etc/suspend.conf, into the initramfs. This patch
   contains the necessary modification to the config file:

diff -ur y/Templates.cfg /etc/yaird/Templates.cfg
--- y/Templates.cfg     2006-07-03 23:02:00.974998000 -0400
+++ /etc/yaird/Templates.cfg    2006-07-03 23:03:45.000000000 -0400
@@ -400,6 +400,8 @@
        #
        TEMPLATE resume
        BEGIN
+               FILE "/usr/local/sbin/resume"
+               FILE "/etc/suspend.conf"
                SCRIPT "/init"
                BEGIN
                        !if [ -z "$noresume" ]
@@ -412,6 +414,9 @@
                        !  if [ -w /proc/software_suspend/do_resume ]; then
                        !    echo > /proc/software_suspend/do_resume
                        !  fi
+                       !  # for ususpend
+                       !  mkcdev /dev/snapshot misc/snapshot
+                       !  /usr/local/sbin/resume
                        !  # for swsusp
                        !  if [ -n "$resume" ]
                        !  then

   A previous version of this patch tested for the presence of the
   'resume' program before trying to run it, but this was pointless
   since yaird will fail if it can't include a file given by a FILE
   directive while generating the initramfs.

   In addition, it's necessary to tell yaird somehow which partition is
   your suspend partition. There are two ways to do this. The default
   yaird config calls the 'RESUME' template in /etc/yaird/Default.cfg
   without any argument. With this setup, yaird finds the suspend
   partition by looking for a swap partition in /etc/fstab with the
   'resume' option (the comments in Default.cfg explain this).

   The other way is to just give the RESUME in Default.cfg an explicit
   argument naming the suspend swap partition. I think this makes a
   little more sense, since it keeps more suspend-related information in
   the same config file.

5. Make a backup of your old (presumably working) initramfs from step 1,
   and generate a new one with ususpend support. For example:

   # mv /boot/initrd.img-2.6.17.2 /boot/initrd.img-2.6.17.2-old
   # yaird -o /boot/initrd.img-2.6.17.2 2.6.17.2

6. Try to suspend and resume. If you're using Bernard Blackham's
   hibernate scripts, the version currently in svn supports calling the
   s2disk program to suspend. Maybe he'll do a release soon. You can
   always do things by hand; I assume the reader at this point has some
   familiarity with the tricks needed to successfully suspend/resume
   using other methods.

I think that's it. Have I left anything out?

Jason

Using Tomcat but need to do more? Need to support web services, security?
Get stuff done quickly with pre-integrated technology to make your job easier
Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo
http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642
_______________________________________________
Suspend-devel mailing list
Suspend-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/suspend-devel

Reply via email to