Grub4dos Guide - PXE Booting
The Grub4dos file grldr can be used as a Preboot eXecution Environment (PXE) boot file. Alternatively, GRUB.EXE can be loaded from another PXE boot loader - e.g. from pxelinux.0.
This section has been added at the request of boot-land forum member Climbing and is based upon instructions he posted here
The following information has been taken from the README_GRUB4DOS.txt file included with the Grub4dos build 2009-02-05 download -
The following walkthrough will create a PXE Server using Windows XP and
tftpd32 (opensource TFTP server) on the host PC. Apologies to Linux users for the (continuing) bias towards Windows.
- Download tftpd32 from here (tested with Version 3.29) and unzip the contents to C:\tftpd32\.
- Create folder C:\tftpd32\root\ - this will be the root folder containing PXE boot file(s) and any disk images or files you want to access from the client PC.
- Copy grldr to C:\tftpd32\root\.
- Create folder C:\tftpd32\root\menu.lst\ - the Grub4dos configuration file will be placed in this directory
- Open C:\tftpd32\tftpd32.exe. Select the Settings button (bottom middle of Tftpd32 window) and copy the settings from figure 1. (below) -
- Ensuring that the Base Directory is set to the root folder we created earlier (C:\tftpd32\root).
- Note - IP Address: 192.168.1.4 (in DHCP Options and Advanced TFTP Options) refers to my IP address. You can bind DHCP and TFTP to your own IP address or just leave these options unchecked.
- Ensure that Allow '\' As virtual root is enabled - this will allow file/folder paths to treat C:\tftpd32\root\ as the root of the drive (e.g. entering chainloader /pxelinux.0 from the Grub4dos command line will chainload C:\tftpd32\root\pxelinux.0.
figure 1.
- Select OK to save settings. You will be prompted to restart Tftpd32, close the program and restart it.
- Select the DHCP server tab and copy the settings from figure 2. (below) - changing the IP pool starting address and Size of pool if required.
figure 2.
- The IP pool starting address will be the IP address allocated to the first PC connecting to the PXE server. The Size of pool will limit the maximum number of client PC's. For a full explanation of Tftpd32 settings, refer to C:\tftpd32\tftpd32.chm
- Copy any disk images or files you want to boot via PXE to C:\tftpd32\root\ - in the following example we will boot C:\tftpd32\root\dos.img (an MSDOS based floppy disk image)
- Test your setup by booting the client PC via PXE. As we have not yet created a configuration file you will enter the Grub4dos Command Line Interface.
- The root device will be detected as (pd), and should be the Base directory as configured by tftpd32 - in our case C:\tftpd32\root\
- Entering the root command, followed by [ENTER] will result in the following output (note - device (fd33) is equivalent to (pd)) -
grub> root
(fd33): Filesystem type is pxe, using whole disk
- To load dos.img, we will enter the commands -
- map --mem (pd)/dos.img (fd0) [ENTER]
- map --hook [ENTER]
- root (fd0) [ENTER]
- chainloader+1 [ENTER]
- boot [ENTER]
This results in the following output -
grub> map --mem (pd)/dos.img (fd0)
FAT12 BPB found with 0xEB (jmp) leading the boot sector.
probed C/H/S =80/2/18, probed total sectors = 2880
.
grub> map --hook
grub> root (fd0)
Filesystem type is fat, using whole disk
grub> chainloader +1
grub> boot_
- Note from README_GRUB4DOS.txt - "You cannot directly map an image file on (pd). You must map it in memory using
the --mem option."
- Other warnings from README_GRUB4DOS.txt include -
- "You can't list files in the pxe device"
- "The blocklist command will not work with a file in the pxe device"
- Now that we have a series of working commands, we can add them to a configuration file - e.g.
title Load DOS.img
map --mem (pd)/dos.img (fd0)
map --hook
root (fd0)
chainloader +1
- Open notepad and create your configuration file, then save as C:\tftpd32\root\menu.lst\default. NOTE - you must save this file without a file extension (default, not default.txt). Grub4dos will automatically load this file from all client PC's. It is possible to create individual configuration files for different client PC's by using a configuration file based on either the MAC address or IP address of the client PC (to convert your IP address to the hexadecimal format used by Grub4dos, see here) - refer to the extract from README_GRUB4DOS.txt at the start of this section (here).
Some example configuration file entries include -
- Chainload BartPE (RAM loading image using Windows Server 2003 SP1 files ramdisk.sys, setupldr.exe (renamed as ntldr) and startrom.n12 (renamed as startrom.0)).
title BartPE
pxe keep
chainloader --raw (pd)/startrom.0
- Chainload Windows PE 2.1.
title WinPE 2.1
pxe keep
chainloader --raw (pd)/Boot/pxeboot.0
- Boot from MSDOS .iso file (see here).
title DOS (.iso file)
map --mem (pd)/ISO/dos.iso (0xFF)
map --hook
root (0xFF)
chainloader (0xFF)
- Chainload pxelinux boot loader.
title PXELinux
pxe keep
chainloader --raw (pd)/pxelinux.0
- Load/return to Grub4dos from pxelinux (this entry should be added to the pxelinux configuration file \pxelinux.cfg\default).
LABEL grub4dos.pxe
MENU LABEL GRUB4DOS with PXE
kernel /grub.exe
append keeppxe