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 (see serial) and terminal (see terminal) before anything else at the start-up time.
How the preset menu works is slightly complicated:
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 (see Configuration).
Another point you should take care is that the diskless support (see Diskless) diverts the preset menu. Diskless images embed a preset menu to execute the command bootp (see 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