grub4dos version 0.4.5c 2013-04-19 is included in the Tiny PXE Server Download. Two grub4dos files were included in previous versions of the Tiny PXE Server download, both standalone files without any file dependencies. Tiny PXE Server version 22.214.171.124 (dated 12/2/2017 (19:29)) includes only grldr. As it is possible that grub.exe may be reintroduced, I have decided to include in in this guide. In the scope of this guide the two versions and their usage are as follows -
grldr - Network Bootstrap Program that can be chainloaded - e.g. via iPXE. grldr uses a menu - if a menu is not found then an embedded menu will be loaded. grldr also has a command-line interface accessible from the menu by pressing the C key.
grub.exe - can be loaded by PXELINUX, iPXE, etc. grub.exe also uses a menu system with a built in menu (if a menu is not found) and a command-line interface. Unlike grldr it's possible to pass parameters directly to grub.exe.
grub4dos is a sophisticated boot manager with its own scripting language - due to the range of commands it supports I recommend that you refer to the following sites for more information -
Grub4dos Guide (diddy) - although it was written for an older version of Grub4dos (v 0.4.4) it covers basic usage relevant to newer versions.
Grub4dos Guide (RMPrepUSB) - up to date guide covering the grub4dos version included in the Tiny PXE Server download.
PXE related notes from the Grub4dos help file README_GRUB4DOS.txt -
Configuration File Path
The default path for the Grub4dos configuration file is the \menu.lst\ directory - the path is relative to the Grub4dos Network Bootstrap Program - grldr (or grub.exe). It's possible to use separate configuration files for each client PC by using a filename based upon information unique to each client. Configuration file names are parsed in the following order -
MAC Address - lowercase hexadecimal with - separators. The MAC address needs to be preceded with it's ARP type. E.g. for MAC address 08 00 27 7A 13 19 on a card with ARP type 1, use filename 01-08-00-27-7a-13-19.
Clients IP (v4) address in a hexadecimal format. E.g. IP address 192.168.2.3 resolves to C0A80203 - therefore use filename C0A80203.
Clients IP (v4) address in a hexadecimal format minus last digit from previous attempt. E.g. if C0A80203 was just attempted, try C0A8020, then try C0A802, etc.
On a test system with the following setup...
MAC = 01-08-00-27-7a-13-19
IP Address = C0A80202
...the attempted load order will be as follows -
Grub4dos Menu System
The default Grub4dos menu (i.e. the embedded menu loaded if a menu file cannot be located) is text based. Grub4dos also has built in graphic support for splash images. The syntax for graphic support is covered in detail here.
The splashimage command can be used without defining a graphicsmode providing that a supported image type is specified and the image is of a resolution supported by the client systems VESA BIOS Extensions (VBE) mode.
title Win98 DOS Boot Disk
map --mem (pd)/images/win98.ima (fd0)
title Win98 DOS Boot Disk (Memdisk)
It's also possible to load submenus -
title Floppy Disk Image Submenu
Putting all this together -
Screenshot of the above menu as displayed on the client system -
Now let's take a closer look at the menu entry syntax -
title - this acts as a placemark and also contains the text that will be displayed for the menu entry.
map --mem - the README_GRUB4DOS.txt file states that "...You must use --mem option if you want to map a file in the pxe device...". Mapping a file to memory creates a RAMDisk.
kernel - "...Attempt to load the primary boot image from FILE. The rest of the line is passed verbatim as the "kernel command line". Any modules must be reloaded after using this command..." In the scope of this guide the file specified here (including path) is usually a linux kernel type file. Unlike PXELINUX menu entries, parameters are specified in the kernel entry - these parameters are usually listed in the APPEND entry in PXELINUX. Quick reminder about the file path - assuming the file is loaded from the server then the path must specify the (pd) device + path relative to the tftp root directory (see examples above).
initrd - linux initial ramdisk file with path.
pxe - options are pxe keep ("...Keep the PXE stack. The default behaviour of GRUB4DOS is to unload...") and pxe unload ("...Unload the PXE stack immediately..."). pxe keep is required if chainloading another Network Bootstrap Program (e.g. pxelinux.0).
Chainloading iPXE Scripts
iPXE supports HTTP and SANBOOT - consequently there are times when it might be useful to chainload ipxe.lkrn from grub4dos. The following menu entry shows the syntax for loading ipxe.lkrn (kernel) with a script (initrd) -
If chainloading ipxe.lkrn the iPXE scripts used in this guide may need to be edited to add commands for configuring the Client PCs network interface. This is not required when using iPXE as the network bootstrap program with a script set as altfilename in config.ini as the network interface is automatically configured. To configure the first network adapter, simply add the following code at the start of any scripts to run the dhcp command -