From 55b7e8a8903e8e245331c4526ba37c1040768992 Mon Sep 17 00:00:00 2001 From: okuji Date: Tue, 6 Jun 2000 11:04:01 +0000 Subject: [PATCH] add a grub-specific tag into bootp/dhcp. --- ChangeLog | 15 +++++++++++++++ netboot/etherboot.h | 4 ++++ netboot/main.c | 32 ++++++++++++++++++++++++++------ 3 files changed, 45 insertions(+), 6 deletions(-) diff --git a/ChangeLog b/ChangeLog index a0a084ff2..8f1ac3570 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,18 @@ +2000-06-06 OKUJI Yoshinori + + * netboot/main.c (dhcprequest) [GRUB]: Set the length of the + Parameter Request List to (4 + 2). + Set the list to RFC1533_VENDOR_MAGIC and + RFC1533_VENDOR_CONFIGFILE in addition to the standard + parameters. + (decode_rfc1533) [GRUB]: If C is equal to + RFC1533_VENDOR_CONFIGFILE, copy the contents of the tag to + CONFIG_FILE. + If C is equal to RFC1533_VENDOR_MAGIC, increment + VENDOREXT_ISVALID. + * netboot/etherboot.h [GRUB] (RFC1533_VENDOR_CONFIGFILE): New + macro. Defined as 150. + 2000-06-03 OKUJI Yoshinori * stage2/asm.S (check_int13_extensions): Check the bitmap only diff --git a/netboot/etherboot.h b/netboot/etherboot.h index 97f61f831..b492077dc 100644 --- a/netboot/etherboot.h +++ b/netboot/etherboot.h @@ -261,6 +261,10 @@ Author: Martin Renters #define RFC1533_VENDOR_IMG 192 #define RFC1533_VENDOR_NUMOFIMG 16 +#ifdef GRUB +# define RFC1533_VENDOR_CONFIGFILE 150 +#endif /* GRUB */ + #define RFC1533_END 255 #define BOOTP_VENDOR_LEN 64 #ifndef NO_DHCP_SUPPORT diff --git a/netboot/main.c b/netboot/main.c index 186ebe61b..135bc3c8d 100644 --- a/netboot/main.c +++ b/netboot/main.c @@ -91,21 +91,29 @@ static const char dhcprequest[] = RFC2132_MAX_SIZE, 2, 2, 64, /* request parameters */ RFC2132_PARAM_LIST, -#ifdef IMAGE_FREEBSD +#ifdef GRUB + /* 4 standard + 2 vendortags */ + 4 + 2, +#else +# ifdef IMAGE_FREEBSD /* 4 standard + 4 vendortags + 8 motd + 16 menu items */ 4 + 4 + 8 + 16, -#else +# else /* 4 standard + 3 vendortags + 8 motd + 16 menu items */ 4 + 3 + 8 + 16, +# endif #endif /* Standard parameters */ RFC1533_NETMASK, RFC1533_GATEWAY, RFC1533_HOSTNAME, RFC1533_EXTENSIONPATH, /* Etherboot vendortags */ RFC1533_VENDOR_MAGIC, -#ifdef IMAGE_FREEBSD +#ifdef GRUB + RFC1533_VENDOR_CONFIGFILE, +#else /* ! GRUB */ +# ifdef IMAGE_FREEBSD RFC1533_VENDOR_HOWTO, -#endif +# endif RFC1533_VENDOR_MNUOPTS, RFC1533_VENDOR_SELECTION, /* 8 MOTD entries */ RFC1533_VENDOR_MOTD, @@ -133,6 +141,7 @@ static const char dhcprequest[] = RFC1533_VENDOR_IMG + 13, RFC1533_VENDOR_IMG + 14, RFC1533_VENDOR_IMG + 15, +#endif /* ! GRUB */ }; #endif /* ! NO_DHCP_SUPPORT */ @@ -953,8 +962,6 @@ decode_rfc1533 (unsigned char *p, int block, int len, int eof) } #endif /* ! NO_DHCP_SUPPORT */ - /* GRUB needs not to use any vendor-specific extension. */ -#ifndef GRUB else if (c == RFC1533_VENDOR_MAGIC # ifndef IMAGE_FREEBSD /* since FreeBSD uses tag 128 for swap definition */ && TAG_LEN(p) >= 6 && @@ -963,6 +970,19 @@ decode_rfc1533 (unsigned char *p, int block, int len, int eof) # endif ) vendorext_isvalid++; + + /* GRUB now handles its own tag. Get the name of a configuration + file from the network. Cool... */ +#ifdef GRUB + else if (c == RFC1533_VENDOR_CONFIGFILE) + { + grub_memmove (config_file, p + 2, TAG_LEN (p)); + + /* FIXME: Is this below really necessary??? */ + config_file[TAG_LEN (p)] = 0; + } +#else /* ! GRUB */ + # ifdef IMAGE_FREEBSD else if (c == RFC1533_VENDOR_HOWTO) { freebsd_howto = ((p[2]*256+p[3])*256+p[4])*256+p[5];