You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

wakeserver.patch 6.6KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179
  1. To: etherboot-developers@lists.sourceforge.net
  2. X-face: #Qvg5o3u!)WoVDDi4-bFy`fl@""4^pm68%_,`puon{0Q6lQ-O,)3D.J.":A&^,#4O2vc8`?
  3. 3^1lhBh=EQH,"Qq*e1vY":she&t^8:!&Fb32Ed:nM2Y<E9|i[+z20G?CO=E=-IWv;bL"=Y`+`q,ML6
  4. ,!Me?==j&In1
  5. Mime-Version: 1.0
  6. Content-Type: multipart/mixed ;
  7. boundary="==_Exmh_-19971541890"
  8. From: Tilmann Bubeck <bubeck@think-at-work.de>
  9. Message-Id: <20010219195622.C97A84ABD8@chaos.think-at-work.de>
  10. Subject: [Etherboot-developers] Wake-on-LAN patch
  11. Sender: etherboot-developers-admin@lists.sourceforge.net
  12. Errors-To: etherboot-developers-admin@lists.sourceforge.net
  13. X-BeenThere: etherboot-developers@lists.sourceforge.net
  14. X-Mailman-Version: 2.0
  15. Precedence: bulk
  16. List-Help: <mailto:etherboot-developers-request@lists.sourceforge.net?subject=help>
  17. List-Post: <mailto:etherboot-developers@lists.sourceforge.net>
  18. List-Subscribe: <http://lists.sourceforge.net/lists/listinfo/etherboot-developers>,
  19. <mailto:etherboot-developers-request@lists.sourceforge.net?subject=subscribe>
  20. List-Id: Discussion list for Etherboot developers <etherboot-developers.lists.sourceforge.net>
  21. List-Unsubscribe: <http://lists.sourceforge.net/lists/listinfo/etherboot-developers>,
  22. <mailto:etherboot-developers-request@lists.sourceforge.net?subject=unsubscribe>
  23. List-Archive: <http://lists.sourceforge.net/archives//etherboot-developers/>
  24. Date: Mon, 19 Feb 2001 20:56:22 +0100
  25. Status: RO
  26. Content-Length: 5351
  27. Lines: 152
  28. This is a multipart MIME message.
  29. --==_Exmh_-19971541890
  30. Content-Type: text/plain; charset=us-ascii
  31. Hello!
  32. please find enclosed a patch to optionally enable etherboot to start the
  33. server it is booting from by sending a magic wake-on-lan packet to the
  34. sleeping server first.
  35. This is very important for an etherboot-server, which is not running all the
  36. time and is not easily accessible from the etherboot machine (e.g. because it
  37. is installed in the basement of the house and one must climb several stairs to
  38. switch the server on...)
  39. Are the authors of etherboot willing to accept this patch for inclusion?
  40. Please note, that the wake-on-lan code is only compiled in, when setting
  41. appropriate flags in src/Config.
  42. If you don't want to include the patch, should I change anything of the
  43. implementation or do you dislike the idea at all?
  44. Thanks!
  45. Till
  46. +-------+--------------------------------------------------------------+
  47. | | dr. tilmann bubeck think@work it consulting |
  48. | | professional services |
  49. | think | cell.: +49 172 8842972 widmaierstrasse 58 |
  50. | @work | fax : +49 711 7227734 70567 stuttgart |
  51. | | email: bubeck@think-at-work.de http://www.think-at-work.de |
  52. +-------+ -------------------------------------------------------------+
  53. --==_Exmh_-19971541890
  54. Content-Type: application/x-patch ; name="etherboot-4.7.17-wol.patch"
  55. Content-Description: etherboot-4.7.17-wol.patch
  56. Content-Disposition: attachment; filename="etherboot-4.7.17-wol.patch"
  57. diff -r -u etherboot-4.7.17/src/Config etherboot-4.7.17-wol/src/Config
  58. --- etherboot-4.7.17/src/Config Sat Jan 6 16:25:23 2001
  59. +++ etherboot-4.7.17-wol/src/Config Mon Feb 19 20:28:00 2001
  60. @@ -113,6 +113,16 @@
  61. # -DINTERNAL_BOOTP_DATA
  62. # - define if the area 0x93C00-0x93FFF is not available
  63. # for use for bootpd_data by the loader for some reason
  64. +# -DWAKEUP_SERVER
  65. +# - define this for sending a Wake-On-LAN (WOL)
  66. +# "Magic Packet" to a sleeping server, before trying
  67. +# a etherboot. Useful if your server is soft-off all
  68. +# the time and must be switched on when booting a
  69. +# client. Define SERVER_MAC with the MAC address of the
  70. +# server to wakeup. CAUTION! This MAC address is
  71. +# stored in the rom image. The rom is therefore not
  72. +# generic anymore but tailored for a specific
  73. +# server!
  74. # These default settings compile Etherboot with a small number of options.
  75. # You may wish to enable more of the features if the size of your ROM allows.
  76. @@ -142,6 +152,10 @@
  77. # These flags affect the loader that is prepended to the Etherboot image
  78. LCONFIG+= -DMOVEROM
  79. +
  80. +# Include code for sending a Wake-On-LAN (WOL) "Magic Packet" to a sleeping
  81. +# server, before trying a etherboot.
  82. +CFLAGS32+= -DWAKEUP_SERVER -DSERVER_MAC=0x00,0x01,0x02,0xDA,0xDF,0x77
  83. # you should normally not need to change these
  84. RM= rm -f
  85. diff -r -u etherboot-4.7.17/src/main.c etherboot-4.7.17-wol/src/main.c
  86. --- etherboot-4.7.17/src/main.c Fri Jan 5 12:45:29 2001
  87. +++ etherboot-4.7.17-wol/src/main.c Thu Feb 8 20:46:59 2001
  88. @@ -137,6 +137,7 @@
  89. * declarations, but in this case I like to see main() as the first
  90. * routine.
  91. */
  92. +static void wakeup_server(void) ;
  93. static int bootp(void);
  94. static int rarp(void);
  95. static void load(void);
  96. @@ -217,6 +218,11 @@
  97. rfc951_sleep(++card_retries);
  98. }
  99. #endif
  100. +
  101. +#ifdef WAKEUP_SERVER
  102. + wakeup_server();
  103. +#endif
  104. +
  105. while (1) {
  106. /* -1: timeout or ESC
  107. -2: error return from loader
  108. @@ -650,6 +656,46 @@
  109. return (0);
  110. }
  111. #endif /* DOWNLOAD_PROTO_TFTP */
  112. +
  113. +#ifdef WAKEUP_SERVER
  114. +#ifndef SERVER_MAC
  115. +#error "Please define SERVER_MAC to the MAC address of the sleeping server"
  116. +#endif
  117. +
  118. +/**************************************************************************
  119. +WOL - Wake up a sleeping server by transmitting a Wake-On-LAN (WOL) "Magic
  120. + Packet", used for restarting machines that have been soft-powered-down
  121. + (ACPI D3-warm state). It currently generates the standard AMD Magic
  122. + Packet format.
  123. +**************************************************************************/
  124. +static void wakeup_server(void)
  125. +{
  126. + unsigned char data[100];
  127. + int i, len, retry;
  128. + char server_adr[] = { SERVER_MAC };
  129. + unsigned long time;
  130. +
  131. + /* build "Magic Packet" */
  132. + len = 0;
  133. + data[len++] = 0xff;
  134. + data[len++] = 0xff;
  135. + data[len++] = 0xff;
  136. + data[len++] = 0xff;
  137. + data[len++] = 0xff;
  138. + data[len++] = 0xff;
  139. + for ( i = 0; i < 16; i++ ) {
  140. + memcpy(&data[len], server_adr, 6);
  141. + len += 6;
  142. + }
  143. +
  144. + printf("Sending Wake-On-LAN (WOL) \"Magic Packet\" to server %b:%b:%b:%b:%b:%b...",
  145. + server_adr[0], server_adr[1], server_adr[2],
  146. + server_adr[3], server_adr[4], server_adr[5]);
  147. +
  148. + eth_transmit(broadcast, 0x0842, len, data);
  149. + printf("done\n");
  150. +}
  151. +#endif
  152. #ifdef RARP_NOT_BOOTP
  153. /**************************************************************************
  154. --==_Exmh_-19971541890--
  155. _______________________________________________
  156. Etherboot-developers mailing list
  157. Etherboot-developers@lists.sourceforge.net
  158. http://lists.sourceforge.net/lists/listinfo/etherboot-developers