Here's a so-far-untested patch that should make GRUB use BOOTP/DHCP
vendor attribute 150 to specify the name of the configuration file to
use.

-----------------------------------------------------------------------

2000-06-05  Chip Salzenberg  <[EMAIL PROTECTED]>

        * netboot/etherboot.h (RFC1533_VENDOR_CFGFILE) [GRUB]: Define.
        (RFC1533_VENDOR_*) [!GRUB]: Don't define.
        * netboot/main.c (vendorext_magic) [!GRUB]: Don't define.
        (dhcprequest): Reorganize to eliminate duplication.
        [GRUB] Request RFC1533_VENDOR_CFGFILE.
        [!GRUB] Request everything but RFC1533_VENDOR_CFGFILE.
        (decode_rfc1533) [GRUB]: Decode RFC1533_VENDOR_CFGFILE.

Index: netboot/etherboot.h
diff -u -2 -r1.6 etherboot.h
--- netboot/etherboot.h 2000/05/29 08:59:38     1.6
+++ netboot/etherboot.h 2000/06/06 01:33:09
@@ -250,4 +250,10 @@
 #define RFC1533_VENDOR_MINOR   0
 
+#ifdef GRUB
+
+#define RFC1533_VENDOR_CFGFILE 150
+
+#else /* !GRUB */
+
 #define RFC1533_VENDOR_MAGIC   128
 #define RFC1533_VENDOR_ADDPARM 129
@@ -261,4 +267,6 @@
 #define RFC1533_VENDOR_IMG     192
 #define RFC1533_VENDOR_NUMOFIMG        16
+
+#endif /* !GRUB */
 
 #define RFC1533_END            255

Index: netboot/main.c
diff -u -2 -r1.8 main.c
--- netboot/main.c      2000/05/29 08:59:38     1.8
+++ netboot/main.c      2000/06/06 01:33:09
@@ -64,6 +64,7 @@
 #endif /* NO_DHCP_SUPPORT */
 
-/* �Eth */
+#ifndef GRUB
 static unsigned char vendorext_magic[] = {0xE4, 0x45, 0x74, 0x68};
+#endif /* ! GRUB */
 
 #ifdef NO_DHCP_SUPPORT
@@ -80,6 +81,7 @@
   RFC2132_MSG_TYPE, 1, DHCPDISCOVER,
   RFC2132_MAX_SIZE, 2, 2, 64,
-  RFC2132_PARAM_LIST, 4, RFC1533_NETMASK, RFC1533_GATEWAY,
-  RFC1533_HOSTNAME, RFC1533_EXTENSIONPATH
+  RFC2132_PARAM_LIST, 4,
+       RFC1533_NETMASK, RFC1533_GATEWAY,
+       RFC1533_HOSTNAME, RFC1533_EXTENSIONPATH,
 };
 
@@ -90,16 +92,32 @@
   RFC2132_REQ_ADDR, 4, 0, 0, 0, 0,
   RFC2132_MAX_SIZE, 2, 2, 64,
+
   /* request parameters */
   RFC2132_PARAM_LIST,
-#ifdef  IMAGE_FREEBSD
-  /* 4 standard + 4 vendortags + 8 motd + 16 menu items */
-  4 + 4 + 8 + 16,
+
+  4    /* standard */
+#ifdef GRUB
+  + 1  /* GRUB vendor */
 #else
-  /* 4 standard + 3 vendortags + 8 motd + 16 menu items */
-  4 + 3 + 8 + 16,
+# ifdef  IMAGE_FREEBSD
+   + 1 /* Etherboot vendor -> FreeBSD */
+# endif
+  + 3  /* Etherboot vendor */
+  + 8  /* Etherboot motd */
+  + 16 /* Etherboot menu items */
 #endif
+  + 0,
+
   /* Standard parameters */
   RFC1533_NETMASK, RFC1533_GATEWAY,
   RFC1533_HOSTNAME, RFC1533_EXTENSIONPATH,
+
+#ifdef GRUB
+
+  /* GRUB vendortags */
+  RFC1533_VENDOR_CFGFILE,
+
+#else /* ! GRUB */
+
   /* Etherboot vendortags */
   RFC1533_VENDOR_MAGIC,
@@ -134,4 +152,7 @@
   RFC1533_VENDOR_IMG + 14,
   RFC1533_VENDOR_IMG + 15,
+
+#endif /* ! GRUB */
+
 };
 
@@ -953,7 +974,15 @@
            }
 #endif /* ! NO_DHCP_SUPPORT */
-         
-         /* GRUB needs not to use any vendor-specific extension.  */
-#ifndef GRUB
+
+#ifdef GRUB
+
+         else if (c == RFC1533_VENDOR_CFGFILE)
+           {
+             grub_memmove (config_file, p + 2, TAG_LEN(p));
+             config_file[ TAG_LEN(p) ] = '\0';
+           }
+
+#else /* ! GRUB */
+
          else if (c == RFC1533_VENDOR_MAGIC
 # ifndef IMAGE_FREEBSD   /* since FreeBSD uses tag 128 for swap definition */


-- 
Chip Salzenberg              - a.k.a. -              <[EMAIL PROTECTED]>
"I wanted to play hopscotch with the impenetrable mystery of existence,
    but he stepped in a wormhole and had to go in early."  // MST3K


----- End forwarded message -----

-- 
Chip Salzenberg              - a.k.a. -              <[EMAIL PROTECTED]>
"I wanted to play hopscotch with the impenetrable mystery of existence,
    but he stepped in a wormhole and had to go in early."  // MST3K

Reply via email to