[ltp] Thinkpad R30/R31 hibernation file details + more info wanted.

Paul Sladen linux-thinkpad@linux-thinkpad.org
Thu, 3 Jul 2003 18:01:26 +0100 (BST)


Under GNU/Linux everything now works on the ThinkPad R31, except with the
TV-Out (and people have nearly figured that out!);  So, I figured it might
be good to work out the hibernation partition format too.  The R30/R31
hibernation setup is different to any other ThinkPad model.

About 6 weeks ago, I spent a long time reading lots of reference manuals and
formulated how I thought the hibernate (suspend-to-disk) system worked.

It relies on a magic file; and the only known way of creating the file is by
installing Windows 98, then using the SleepMgr programs from IBM.  

Two days ago I finally got around to installing Windows 98 [over the IBM
Recovery Partition] and creating the hibernation file.  My conclusions are:

  1)  The FAT partition is irrelevant;  The BIOS can't read the FAT, nor
      the partition table.  Just SleepMgr only knows how to write to FAT.

  2)  The CMOS (NVRAM) contains a pointer to the start of the hibernation
      file.  (Probably just a starting LBA sector number).

  3)  The first sector (512 Bytes) of the file is the header; the rest of
      the file just follows it and all of the information is there.

  4)  The hibernation file has to be contiguous (so could be anywhere).
      Under Linux, we should be able to put it in its own partition.

Note: Point (1) is contrary to what others have suggested.  So don't sue me!

So, here's the file looks like:  (Not that anyone/anything actually cares!)

] -r-xr-xr-x    1 paul     paul     412221440 Jun 29 23:24 acr_0v.dat

The `acr' it turns out, means `Acer';  as in the other Laptop manufacturer.

Presumably bits of the R31 (being low-end) are nicked/shared/brought from
Acer kit.  The hibernation file format is shared with that of the Acer's--
although I still haven't found any Acer technical/service manuals that might
give CMOS layout information.

So `acr_0v.dat';  Here's the interesting parts of the first 512 bytes:

] 0000  41 43 45 52 20 30 56 20  53 55 53 50 45 4e 44 2e  |ACER 0V SUSPEND.|
] 0010  00 00 00 92 18 00 00 00  aa 1c b1 5a 03 41 43 52  |........ª.±Z.ACR|
] 0020  5f 30 56 20 20 44 41 54  ff ff 00 00 ff ff 00 00  |_0V  DAT??..??..|
] 0030  00 00 03 67 ff 3e 2c 00  00 00 00 00 00 00 00 00  |...g?>,.........|
] ...         ^^^^^ ^^^^^^^^^^^              v.........v
] 01f0  00 00 00 00 00 00 00 00  00 00 00 00 00 01 00 62  |...............b|

Most of the sector is null.  The first line speaks for itself, the second
line seems to have a string of the file name, as it would be represented in
the DOS FAT structures [`ACR_0V  DAT'].  (eg.  The double space character).

I assume the last 32bits (4 bytes) are a checksum, or flag + 16bit checksum.

I normally have 384MB in the laptop;  writing this to disk using Fn-F12 is
taking the BIOS 1:45m (~105 seconds), so for my testing, I've dropped it to
128MB and the BIOS quite happily uses the same file.

I guess there is just a maximum limit in the header, but I don't know which
yet.  Neither have I found the changes in the CMOS RAM--there were just too
many bit-changes (since my previous snapshot) to show anything obvious up.

I would welcome suggestions about what space (probably 4-8 bytes worth) is
"left" in the CMOS and isn't known to be used for other stuff.  This would
be useful and might help in finding the offset pointer to the file.   Also,
would knowing where the data is stored on ThinkPad's, or Acer's might help.

Help Me:

  1) Documentation on the CMOS offset locations.

  2) Dumps of the first 512 bytes of the `acr_0v.dat' file:

     $ dd if=/dos/ibm/acr_0v.dat of=./sector.dat bs=512 count=1

     Mail me this file, along with your RAM size.  (Only R30/R31 owners!)

The more data points, the more I can guess.  Thank you for listening.

	-Paul

PS.  This *Acer* SleepMgr.exe /might/ work under DOS (boot from Floppy/CD):
     http://www.paul.sladen.org/thinkpad-r31/sleepmgr-acer/SleepMgr.exe
-- 
War is inconsistent with Truth.  Nottingham, GB