diff -rpu grub/docs/grub.texi grub-alpha/docs/grub.texi --- grub/docs/grub.texi Tue Feb 27 11:23:55 2001 +++ grub/docs/grub.texi Tue Mar 6 11:52:00 2001 @@ -1156,11 +1156,12 @@ see @file{netboot/README.netboot} in the @node General usage of network support @section How to set up your network -GRUB requires a file server and optionally a server that will assign an -IP address to the machine on which GRUB is running. For the former, only -TFTP is supported at the moment. The latter is either BOOTP, DHCP or a -RARP address@hidden is deprecated, since it cannot serve much -information}. It is not necessary to run both the servers on one +To use a network, GRUB requires a file server and/or a server that will +assign an IP address to the machine on which GRUB is running. Depending on +what you want to do, either one is needed or both. +For the former, only TFTP is supported at the moment. The latter is either +BOOTP, DHCP or a RARP address@hidden is deprecated, since it cannot +serve much information}. It is not necessary to run both the servers on one computer. How to configure these servers is beyond the scope of this document, so please refer to the manuals specific to those protocols/servers. @@ -1204,6 +1205,18 @@ grub> @kbd{boot} @end group @end example +Optionaly, by giving the option @code{--with-configfile} to @command{bootp}, +you can instruct GRUB to load the configuration file specified via the tag address@hidden for BOOTP/DHCP servers (for explanations, see @ref{Diskless}). +This allows a dynamic configuration of GRUB. +For example, the @file{menu.lst} used at boot time can specify the sole line address@hidden --with-configfile} in order to instruct GRUB to retrieve the +configuration file specified by the BOOTP/DHCP server. + +Please note that the name given by the server is @strong{not} supposed to be the +name of a remote file. That is, you can specify @file{(hd0,0)/grub/menu.lst} to +tell GRUB to load a _local_ file. If no device is specified, the filename +given will be relative to the `root' set. @node Diskless @section Booting from a network diff -rpu grub/stage2/builtins.c grub-alpha/stage2/builtins.c --- grub/stage2/builtins.c Thu Mar 1 11:31:41 2001 +++ grub/stage2/builtins.c Tue Mar 6 15:16:22 2001 @@ -80,6 +80,11 @@ int show_menu = 1; /* The BIOS drive map. */ static unsigned short bios_drive_map[DRIVE_MAP_SIZE + 1]; +/* Prototypes for allowing straightfoward calling of builtins functions + * inside other functions */ + +static int configfile_func (char *arg, int flags); + /* Initialize the data for builtins. */ void init_builtins (void) @@ -349,6 +354,18 @@ static struct builtin builtin_boot = static int bootp_func (char *arg, int flags) { + int with_configfile = 0; + + /* For sanity, we parse the options first */ + while (1) + { + if (grub_memcmp (arg, "--with-configfile", 17) == 0) + with_configfile = 1; + else + break; + arg = skip_to (0, arg); + } + if (! bootp ()) { if (errnum == ERR_NONE) @@ -359,6 +376,15 @@ bootp_func (char *arg, int flags) /* Notify the configuration. */ print_network_configuration (); + /* It's the responsability of the administrator to correctly configure the + * bootp/dhcp server. CAUTION : there might be an endless loop if the menu + * file loaded just tells `bootp --with-configfile'. But to be sure that + * the config file name has changed is not enough : the whole name is + * built from the `root' AND the filename. So a simple test on the + * filename wouldn't be sufficient. So...*/ + if (with_configfile) + configfile_func (config_file, BUILTIN_CMDLINE); + return 0; } @@ -367,8 +393,10 @@ static struct builtin builtin_bootp = "bootp", bootp_func, BUILTIN_CMDLINE | BUILTIN_MENU, - "bootp", - "Initialize a network device via BOOTP." + "bootp [--with-configfile]", + "Initialize a network device via BOOTP. If the option \"--with-configfile\"" + "is given, try to get a remote configfile specified via the 150 vendor TAG," + " and loads it as a new configfile." }; #endif /* SUPPORT_NETBOOT */