Netboot Mailing List (by thread)

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

patch for WOL from Boot-Rom



Hi ,

i have made a little patch for etherboot 4.4.5 to support sending WOL
packets from the bootrom at start time.

If anybody can use it ...

By, 

Joachim

-- 
mailto:joachim.wolff@gmx.net

Windows 9x kann dank 32 Bit alles ...
Wenn ich 32 Bitīs getrunken habe, glaube ich auch, dass ich alles kann
...
--- /tmp/etherboot-4.4.5/src/main.c	Sat Feb 19 10:13:13 2000
+++ main.c	Thu Apr 13 21:52:57 2000
@@ -101,6 +101,32 @@
 #endif /* NO_DHCP_SUPPORT */
 char	broadcast[] = { 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF };
 
+
+/*******************************************************
+build wol packet
+*******************************************************/
+void send_wol(wol_addr)
+unsigned char wol_addr[6];
+{
+        unsigned char *ptr;
+        unsigned char buf [140];
+        int i, j;
+
+        /* stolen from ../contrib/wakeonlan/wol.c */
+	/* Build the message to send - 6 x 0xff then 16 x MAC address */
+        ptr = buf;
+        for (i = 0; i < 28; i++)  /* space for the packet header */
+                *ptr++ = 0xff;    /* will be overwrited later    */
+        for (i = 0; i < 6; i++)
+                *ptr++ = 0xff;
+        for (j = 0; j < 16; j++)
+                for (i = 0; i < 6; i++)
+                        *ptr++ = wol_addr [i];
+
+	udp_transmit ( IP_BROADCAST, 0, 60000, 130, buf );
+}
+
+
 /**************************************************************************
 MAIN - Kick off routine
 **************************************************************************/
@@ -110,6 +136,12 @@
 	static int card_retries = 0;
 	int i;
 
+	/****************************/
+	unsigned char wol_addr_1[] = { 0x00 , 0xE0 , 0x7D , 0x01 , 0x02 , 0x03 };
+	unsigned char wol_addr_2[] = { 0x00 , 0xE0 , 0x7D , 0x04 , 0x05 , 0x06 };
+	/****************************/
+
+
 #ifdef SERIAL_CONSOLE
 	serial_init();
 #endif  
@@ -131,6 +163,30 @@
 #endif
 	printf("ROM segment 0x%x length 0x%x\n", rom.rom_segment,
 		rom.rom_length << 1);
+
+
+
+	/*******************************************
+	first prepare the card
+	*******************************************/
+
+	gateA20();
+	print_config();
+
+	while (!eth_probe()) {
+		printf("No adapter found");
+		if (!setjmp(jmp_bootmenu))
+			rfc951_sleep(++card_retries);
+	}
+
+	/********************************************
+	send wol packets
+	********************************************/
+	send_wol (wol_addr_1);
+	send_wol (wol_addr_2);
+	/*******************************************/
+
+
 #ifdef ASK_BOOT
 	while (1) {
 		int c;
@@ -155,19 +211,19 @@
 			break;
 	}
 #endif
-	gateA20();
-	print_config();
+	//	gateA20();
+	//      print_config();
 #ifdef EMERGENCYDISKBOOT
 	if (!eth_probe()) {
 		printf("No adapter found\n");
 		exit(0);
 	}
 #else
-	while (!eth_probe()) {
-		printf("No adapter found");
-		if (!setjmp(jmp_bootmenu))
-			rfc951_sleep(++card_retries);
-	}
+	//	while (!eth_probe()) {
+	//	printf("No adapter found");
+	//	if (!setjmp(jmp_bootmenu))
+	//		rfc951_sleep(++card_retries);
+	//}
 #endif
 	kernel = DEFAULT_BOOTFILE;
 	while (1) {


For requests or suggestions regarding this mailing list archive please write to netboot@gkminix.han.de.