grub.info: Preset Menu

Go forward to Security
Go backward to Serial terminal
Go up to Top
Go to the top op grub

Embedding a configuration file into GRUB

   GRUB supports a "preset menu" which is to be always loaded before
starting. The preset menu feature is useful, for example, when your
computer has no console but a serial cable. In this case, it is
critical to set up the serial terminal as soon as possible, since you
cannot see any message until the serial terminal begins to work. So it
is good to run the commands `serial' (*note serial::) and `terminal'
(*note terminal::) before anything else at the start-up time.
   How the preset menu works is slightly complicated:
  1. GRUB checks if the preset menu feature is used, and loads the
     preset menu, if available. This includes running commands and
     reading boot entries, like an ordinary configuration file.
  2. GRUB checks if the configuration file is available. Note that this
     check is performed *regardless of the existence of the preset
     menu*. The configuration file is loaded even if the preset menu was
     loaded.
  3. If the preset menu includes any boot entries, they are cleared when
     the configuration file is loaded. It doesn't matter whether the
     configuration file has any entries or no entry. The boot entries
     in the preset menu are used only when GRUB fails in loading the
     configuration file.
   To enable the preset menu feature, you must rebuild GRUB specifying a
file to the configure script with the option `--enable-preset-menu'.
The file has the same semantics as normal configuration files (*note
Configuration::).
   Another point you should take care is that the diskless support
(*note Diskless::) diverts the preset menu. Diskless images embed a
preset menu to execute the command `bootp' (*note bootp::)
automatically, unless you specify your own preset menu to the configure
script. This means that you must put commands to initialize a network in
the preset menu yourself, because diskless images don't set it up
implicitly, when you use the preset menu explicitly.
   Therefore, a typical preset menu used with diskless support would be
like this:
     # Set up the serial terminal, first of all.
     serial --unit=0 --speed=19200
     terminal --timeout=0 serial
     # Initialize the network.
     dhcp