Codebase list nvram-wakeup / HEAD
HEAD

Tree @HEAD (Download .tar.gz)

 NVRAM-WakeUp
 (C) 2001-2004, Sergei Haller <Sergei.Haller@math.uni-giessen.de>
 $Id: README 870 2008-09-06 20:48:34Z tiber $


This is a (small) program  that can read and write  the WakeUp time in
the  BIOS  (via /dev/nvram on kernels >= 2.4.6 or via direct I/O).  On 
this  WakeUp  time  the computer will be powered on automatically from 
the soft-off state.

The original purpose of this program is to be called by VDR  (by Klaus
Schmidinger, see http://www.cadsoft.de/vdr/) so the machine which runs 
VDR  doesn't  have  to  run all the time but can decide by itself when
to wake up after a shutdown.

The  original  idea  I  had  from  an  email  by  Frank  Klingenhoefer 
<frank.private@t-online.de> on the linux-dvb mailinglist. See
  http://linuxtv.org/mailinglists/linux-dvb/2001/08-2001/msg00457.html

In the directory  VDR you will find a small script  which you can pass
to VDR via the -s command line option.

---- WARNING: --------------------------------------------------------
This program  writes into the  NVRAM  (used by  BIOS to store the CMOS
settings). This is  DANGEROUS.  Do it at  your own  risk.  Neither the
author  of  this program  (nvram-wakeup)  nor anyone else  can be made
responsible to any damage made by this program in any way.
(The worst case  happened to me is that on reboot the BIOS noticed the
illegal  contents of  the nvram and  set everything to default values.
But this doesn't mean that you can't destroy even your whole computer.)
                     YOU HAVE BEEN WARNED.
----------------------------------------------------------------------
 
1. First of all you need a recent 2.4 kernel (2.4.6 or newer) with the
   /dev/nvram  and  /dev/rtc  drivers  enabled (in  the  kernel or  as
   modules and in latter case the modules to be loaded.

   NOTE for Kernels 2.6.x: You must enable "Enhanced RTC support". the
   "generic /dev/rtc" is not enough.

   Since  release  0.95  of  nvram-wakeup  the device /dev/nvram isn't
   necessary  if  run with --directisa option. But read the warning in 
   the man page.

   If  the character devices /dev/nvram,  /dev/rtc or /dev/mem  do not
   exist on your system, you can create them (as root) with:

     mknod /dev/nvram c 10 144
     mknod /dev/rtc   c 10 135
     mknod /dev/mem   c 1  1

   or just (also as root)

     make devices

   in nvram-wakeup directory.

2. To compile nvram-wakeup just enter 

     make 
     
   on the command line. (You may want to take a look into Makefile)
   
   Now  run  nvram-wakeup  in debug mode and see if  it can autodetect
   your  board.  If  it  does  and  knows the addresses of this board,
   you're done. Enjoy the program.
   
   If   it   detects  your  board  correctly  but  doesn't  know  it's 
   configuration, there are two choices:
     - if you know that it worked with the old version (until 0.05) of
       nvram-wakeup,  please submit  the output of biosinfo and the MB
       number from the old version of nvram-wakeup.
     - if not,  read README.mb  how to determine the addresses of your
       board. And submit them to the author.
       While  waiting  for  the new release you can use the determined
       addresses  in a configuration file with the --configfile option
       (read nvram-wakeup(5) for more info)

   You may also look on the MB tracker list
   
     http://sourceforge.net/tracker/?group_id=35022&atid=412959
   
   or the latest SVN revision of the file boards.yaml
   
     http://nvram-wakeup.svn.sourceforge.net/viewvc/nvram-wakeup/trunk/nvram-wakeup/boards/boards.yaml
   
   if  your  board  is  already  supported  out-of-the-box  in the CVS
   version.

2a. The version 0.90 had  a complete rewrite of  large parts.  Some of
   the  boards  supported  in  the  older  versions  may  have  gotten
   incorrect autodetection strings in nvram-wakeup-mb.c. If it's true,
   please submit the correct ones.

3. nvram-wakeup detects automatically at run time if your RTC clock is
   running local time or  UTC/GMT. (run nvram-wakeup with the  --debug
   option to see what it detected)

4. Run  nvram-wakeup  without  options --settime or --disable. It will 
   only  READ  the  wake  up  date  and  time.  Check  if the reported 
   date/time  is  correct.  Do  it  several  times. (Setting different 
   values via BIOS setup and reading them with nvram-wakeup.)
 
5. If you think  it works always correct,  you can try  to specify the
   --settime option to nvram-wakeup (you may want to use the --nowrite
   option while testing). The (absolute) time is given as time_t value
   (number of seconds since epoch).

   NOTICE  that you do not specify the time to be set in nvram but the
       time  at which  the machine  should be  up  and  running.  I.e.
       nvram-wakeup will  set the  wakeup time  WAKEUP_BEFORE  minutes
       before the time specified with the --settime option.

   e.g. with
      nvram-wakeup -s $((`date +%s` + 20 * 60))
   you tell nvram-wakeup  that you want  the machine be up and running
   in 20 minutes again. The actual wakeup time will be set to
      20-WAKEUP_BEFORE minutes
   in the future.  If you want  to specify the EXACT time to be set in
   nvram, you can modify WAKEUP_BEFORE value to 0 in nvram-wakeup.h.

   Further,  there  is  a  NEED_TO_SHTDWN  constant in nvram-wakeup.h.
   nvram-wakeup   will  refuse  a  wakeup  time  which  is  less  than
   (NEED_TO_SHTDWN + WAKEUP_BEFORE) minutes in the future.

   If NEED_TO_SHTDWN is too small, it may happen that the wake up time
   is passed while shutdown process, so the machine  will wake  up one
   month or  (on the boards,  which store the  month number)  one year
   later than expected.

   Defaults for WAKEUP_BEFORE and NEED_TO_SHTDWN are 5 minutes each.

   
6. It should work now.
   (Run
      nvram-wakeup -s $((`date +%s` + 10 * 60))
   reboot  your  computer  and look  into BIOS  if the values  are set
   properly.  Turn  off  the  computer.  Sit  back.  It will  wake  up
   automatically.)
 
7. NOTE:  on  some  boards  (Asus AV7-133,  AV7-266,  TUV4X, ...)  the
   program  hwclock isn't  able to use the rtc device for getting CMOS
   time  if  the  wakeup  is  enabled  in  the  BIOS.  Please  use the
   --directisa option of hwclock.

8. NOTE: I  had  reports,  that  on  Epia M  boards some values (don't 
   remember,  which,  might  have been seconds) are stored not correct 
   before  first  use.  I.e., you  must  go  to BIOS Setup, enter some 
   values  different  to those, which are there, leave BIOS setup with
   saving. And then try nvram-wakeup.

9. Helper programs (see appropriate man pages for more information):

      biosinfo
          Prints  board  and  bios  information. Uses DMI-entries from 
          /dev/mem.
          
      cat_nvram [option]
          Dumps  the  contents  of  nvram  to  stdout using direct I/O
          functions.  The possible option is one of the values allowed
          for upper_method (see `man nvram-wakeup.conf')
      
      guess
          Tries  to  guess  the configuration from four dumps of nvram.
          See README.mb for more information.

      guess-helper
          Helper for guess. See README.mb for more information.
      
      rtc
          Prints the RTC Alarm values using ioctls on /dev/rtc.
          
      time <time>
          Where  <time>  is  number of seconds since epoch. Prints the
          corresponding  time  in UTC and Local Time in human readable
          form.

10. Further README's:

      README.mb
          This  document  should help you choose the right motherboard 
          settings.

      README.reboot
          This document should tell you on the reboot problems and the
          possible ways to solve or work around them.


----------------------------------------------------------------------
Suggestions,  success reports, failures etc. are very welcome.  Either
write me an eMail or post it on
   http://sourceforge.net/projects/nvram-wakeup/ - Tracker
or on the mailing list
   http://sourceforge.net/mail/?group_id=35022
or in the forum
   http://www.vdr-portal.de/board/board.php?boardid=9&sid=
----------------------------------------------------------------------
At  http://home.t-online.de/home/hubertus.sandmann/vdr_wakeup.htm  you
will find a nice detailed German introduction into nvram-wakeup.
(Thanks to Hubertus Sandmann)
----------------------------------------------------------------------
      And please don't forget to send me your new configurations
          (including the name and model of your motherboard)
          Or post it at the BIOS/MB Tracker on the homepage.
       It will be included in the next version of nvram-wakeup
----------------------------------------------------------------------