<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">

<html>
  <head>
    <!-- this stylesheet will later on be added by lfparser automatically: -->
<style type="text/css">
<!--
  pre { font-family:monospace,Courier }
  pre.code { font-family:monospace,Courier;background-color:#aedbe8; }
  p.code { width:80%; alignment:center; background-color:#aedbe8; 
        border-style:none; border-width:medium; border-color:#aedbe8; 
        padding:0.1cm ; text-align:left }
-->
</style>

    <title></title>
  </head>

  <body>
    <h1>Fn-F12: Hibernate an IBM Thinkpad T20 laptop</h1>

    <h4>ArticleCategory:</h4>
    Hardware 

    <h4>AuthorImage:[Here we need a little image from you]</h4>
    <img src="../../common/images2/JanAlonzo.jpg" alt="[Photo of the Author]" width="150" height="155"> 

    <h4>TranslationInfo:[Author + translation history. mailto: or
    http://homepage]</h4>

    <p>original in en <a href=
    "http://www.unpluggable.com/">Jan Alonzo</a></p>

    <h4>AboutTheAuthor:[A small biography about the author]</h4>

    <p>Jan runs Debian Linux on his IBM T20</p>

    <h4>Abstract:</h4>
    This article explains how to make Hibernate (suspend-to-disk) work on a IBM Thinkpad T20
    with no windows installed. The solution presented here may also
    work for other Thinkpads with a Phoenix BIOS but I have
    tested it only on a T20. 

    <h4>ArticleIllustration:</h4>
    <img src="../../common/images2/article359/t20.jpg" alt="t20" hspace="10" width="200" height="111"> 

    <h4>ArticleBody:</h4>

    <h2>Software Requirements</h2>

    <p>You need the following programs installed for hibernate to
    work:</p>

<table><tr><td>
    <ul>
      <li>fdisk or cfdisk for partitioning your hard drive.</li>

      <li>dosfstools for creating the FAT16 filesystem.</li>

      <li><a href=
      "http://samba.org/ftp/unpacked/junkcode/tphdisk.c">tphdisk.c
      (from samba.org)</a> for creating the <em>hibernate</em> file
      (local copy: <a href=
      "../../common/src2/article359/tphdisk.tar.gz">tphdisk.tar.gz</a>)</li>
    </ul>
</td></tr></table>

    <p>fdisk usually comes with your default Linux install. cfdisk
    usually comes with a <a href="http://www.debian.org">Debian</a>
    default install. tphdisk was written by Andrew Tridgell for his
    Thinkpad T20.</p>

    <h2>Creating the DOS Partition</h2>

    <p>First you have to make sure that you have a spare
    <em>PRIMARY</em> block in your device. This is important as
    Thinkpads only hibernate on PRIMARY partitions, not on extended
    partitions. Been there, done that.</p>

    <p>The rule of thumb is: "size of RAM + size of graphic
    adapter's RAM + extra MBs for safety". If you are planning to
    upgrade your RAM soon, make sure you take into consideration
    the size of your future RAM, or else you have to recreate the
    partition again.</p>

    <p>Once you have created the partition, set it to type "Hidden
    Win95 (FAT16) LBA". The partition code is "1E".</p>
<pre class="code">
RAM:     128 MB
VGA RAM:   8 MB

Hibernation partion: 150 MB (for safety)
</pre>

    <p>It is up to you how much extra you want to put in the
    partition. If you're having problems, kindly refer to the
    <strong>Troubleshooting</strong> section.</p>

    <p>Now Reboot your laptop.</p>

    <h2>Formatting the partition</h2>

    <p>mkdosfs is part of the dosfstools package.</p>
<pre class="code">
As root:

$ mkdosfs /dev/hdaX
</pre>

    <p>... where hdaX is the partition you just created above
    (<em>Creating the DOS Partition section</em>).</p>

    <p>Now mount the partition:</p>
<pre class="code">
$ mount /dev/hdaX /mnt/hibernate
</pre>

    <h2>Creating the hibernation file</h2>

    <ol>
      <li>Get tphdisk at <a href=
      "http://samba.org/ftp/unpacked/junkcode/tphdisk.c">http://samba.org/ftp/unpacked/junkcode/tphdisk.c</a>
      or local copy: <a href=
      "../../common/src2/article359/tphdisk.tar.gz">tphdisk.tar.gz</a></li>

      <li>Compile tphdisk.</li>

      <li>Create the file "save2dsk.bin".
      <strong>save2dsk.bin</strong> is the filename of the
      hibernation file. No, it's not an optional filename.</li>
    </ol>
<pre class="code">
$ gcc -o tphdisk tphdisk.c
$ ./tphdisk N &gt; /mnt/hibernate/save2dsk.bin

</pre>

    <p>... where:</p>

    <p><strong>N</strong> = size of the file. See rule of thumb
    above.</p>

    <p>Reboot your laptop.</p>

    <h2>Sound</h2>
    It is a known problem that the cs46xx sound card driver of the
    T20 does not re-initialize the hardware registers after a
    suspend or hibernate operation. In other words Linux will be
    fully operational but you will not hear any sound after a
    suspend to ram or suspend to disk. A work around is to run
    manually "/etc/init.d/alsasound restart" if you care about
    sound. <br>
    See also <a href=
    "http://panopticon.csustan.edu/thood/tp600lnx.htm#secsnd">http://panopticon.csustan.edu/thood/tp600lnx.htm#secsnd</a>
    for more suggestions on how to solve this "sound silent
    problem". 

    <h2>Testing</h2>

    <ul>
      <li>Press <strong>Fn-F12</strong>.</li>
    </ul>

    <p>Your screen should blank and after a couple of seconds, the
    Phoenix BIOS hibernate utility should come up and start dumping
    the contents of your RAM to your newly created hibernation
    file:<br>
    </p>

    <center>
      <img src="../../common/images2/article359/t20-hibernate.jpg" alt="Phoenix BIOS hibernate" width="320" height="299">
    </center>
    <br>
    <br>
     

    <h2>Troubleshooting</h2>

    <ol>
      <li>While creating the hibernation file, I received an error
      says "Write Failed"!</li>
    </ol>

    <ul>
      <li>Make sure you put enough space in your partition. Try to
      make it bigger and see if that works.</li>

      <li>Your thinkpad should be using Phoenix BIOS.<br>
      </li>
    </ul>

    <ol>
      <li>When I tried to hibernate, the system just hangs!</li>
    </ol>

    <ul>
      <li>Make sure your hibernate partition is mounted</li>

      <li>Your did something wrong! Backtrack and make sure you got
      everything alright.</li>
    </ul>

    <ol>
      <li>"System is invalid"!</li>
    </ol>

    <ul>
      <li>You formatted the partition with the wrong filesystem.
      (See <em>Creating the DOS Partition</em> above)</li>

      <li>The partition is an extended (logical) partition. I told
      you it has to be PRIMARY.</li>
    </ul>
  </body>
</html>